Skip to content

Fix event transition to "Complete" creation and trigger in esmini for events containing ParameterSetAction#678

Merged
eknabevcc merged 1 commit intoesmini:devfrom
sumanth-kandala-ai:sumanth/fix-parameter-action
Mar 17, 2025
Merged

Fix event transition to "Complete" creation and trigger in esmini for events containing ParameterSetAction#678
eknabevcc merged 1 commit intoesmini:devfrom
sumanth-kandala-ai:sumanth/fix-parameter-action

Conversation

@sumanth-kandala-ai
Copy link
Copy Markdown
Contributor

@sumanth-kandala-ai sumanth-kandala-ai commented Mar 10, 2025

Closes #677

Context:

Details When defining an Event that contains a single Action which is only responsible for setting a parameter like shown in the snippet below:
<Event maximumExecutionCount="1" name="Event 1" priority="parallel">
  <Action name="Action 1">
  	<GlobalAction>
  		<ParameterAction parameterRef="my_parameter">
  			<SetAction value="7" />
  		</ParameterAction>
  	</GlobalAction>
  </Action>
  <StartTrigger>
      <ConditionGroup>
          <Condition delay="0" conditionEdge="none" name="simulation_time">
              <ByValueCondition>
                  <SimulationTimeCondition value="0.0" rule="greaterThan"/>
              </ByValueCondition>
          </Condition>
      </ConditionGroup>
  </StartTrigger>
</Event>

The following logs show up on running a scenario with the above pattern:

[0.000] [info] Event 1 Condition 1-1: true, delay: 0.00, 0.0000 >= 0.0000, edge: none
[0.000] [info] Trigger /------------------------------------------------
[0.000] [info] Group 0:
[0.000] [info] Event 1 Condition 1-1: true
[0.000] [info] Trigger  ------------------------------------------------/
[0.000] [info] Event 1 standbyState -> startTransition -> runningState
[0.000] [info] Set parameter my_parameter = 1
[0.000] [info] Event 1 Action 1 initState -> startTransition -> runningState
[0.000] [info] Event 1 Action 1 runningState -> stopTransition -> completeState

Interestingly we don't see the logs at 0 seconds which blocks any Events defined subsequently:

[0.000] [info] Event 1 complete after 1 execution
[0.000] [info] Event 1 runningState -> endTransition -> completeState

Furthermore this same pattern used to work in older versions of esmini, i.e. esmini-2.36.2 and below.

Root Cause: It seems like this commit caused this regression.

Specifically in ScenarioReader.cpp the following change was made:

-                     ParameterSetAction *paramSetAction = new ParameterSetAction();
+                    ParameterSetAction *paramSetAction = new ParameterSetAction(action);

In contrast VariableSetAction, which works on the current version of esmini uses parent too instead of action and seems to work as expected. This also seems consistent since the empty constructor for ParameterSetAction in the previously working version of esmini here is now equivalent to the constructor that takes in a parent and not an action.

Let me know if you'd like me to add any tests for the same.

@sumanth-kandala-ai sumanth-kandala-ai marked this pull request as draft March 10, 2025 20:35
@sumanth-kandala-ai sumanth-kandala-ai changed the title Fix event transition to Complete"creation and trigger in esmini Fix event transition to "Complete" creation and trigger in esmini for events containing ParameterSetAction Mar 10, 2025
@sumanth-kandala-ai sumanth-kandala-ai marked this pull request as ready for review March 10, 2025 20:45
@sumanth-kandala-ai sumanth-kandala-ai changed the base branch from master to dev March 11, 2025 04:24
@eknabevcc eknabevcc merged commit e9f2275 into esmini:dev Mar 17, 2025
14 checks passed
@eknabevcc
Copy link
Copy Markdown
Collaborator

eknabevcc commented Mar 17, 2025

Wonderful. Nice find and fix, indeed! Thanks.

@eknabevcc
Copy link
Copy Markdown
Collaborator

Included in release v2.46.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants