Skip to content

Commit

Permalink
Fix zero-crossing detection in CS FMUs
Browse files Browse the repository at this point in the history
fixes #233
  • Loading branch information
t-sommer committed Apr 7, 2022
1 parent 2ddad46 commit a4aaaef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cosimulation.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ void doFixedStep(ModelInstance *comp, bool* stateEvent, bool* timeEvent) {

// check for zero-crossings
for (int i = 0; i < NZ; i++) {
*stateEvent |= comp->z[i] * z[i] < 0;
*stateEvent |= (comp->z[i] <= 0 && z[i] > 0) || (comp->z[i] > 0 && z[i] <= 0);
}

// remember the current event indicators
Expand Down

0 comments on commit a4aaaef

Please sign in to comment.