Skip to content

Commit

Permalink
[NB] update event detection (#12427)
Browse files Browse the repository at this point in the history
- fix detecting pre variables as conditions after swapping execution order of Events and DetectStates modules
  • Loading branch information
kabdelhak committed May 15, 2024
1 parent 0afe158 commit 6ba1f8e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions OMCompiler/Compiler/NBackEnd/Modules/2_Pre/NBEvents.mo
Expand Up @@ -1029,6 +1029,13 @@ protected
Pointer.update(bucket_ptr, bucket);
then exp;

// replace $PRE variables with auxiliaries
// necessary if the $PRE variable is a when condition (cannot check the pre of a pre variable)
case Expression.CREF() guard(BVariable.isPrevious(BVariable.getVarPointer(exp.cref))) algorithm
(exp, bucket) := CompositeEvent.add(Condition.CONDITION(exp, iter), Pointer.access(bucket_ptr), true);
Pointer.update(bucket_ptr, bucket);
then exp;

// ToDo: math events (check the call name in a function and merge with sample case?)

else exp;
Expand Down

0 comments on commit 6ba1f8e

Please sign in to comment.