Book a Demo

Author Topic: I cannot get triggers with parameters to simulate correctly.  (Read 17670 times)

mse

  • EA User
  • **
  • Posts: 308
  • Karma: +1/-0
    • View Profile
I cannot get triggers with parameters to simulate correctly.
« on: November 20, 2020, 10:01:51 pm »
I keep getting the following error in the state chart simulation window:

TypeError: sim.s1 is undefined

I have a signal defined with the same name, and the transition in the state chart looks like this:

s1[this.s1.value == 1]

Why is it undefined? I tried moving the trigger and signal around in the model but that doesn't help (I thought it was a scope issue).
« Last Edit: November 21, 2020, 02:54:04 am by mse »

mse

  • EA User
  • **
  • Posts: 308
  • Karma: +1/-0
    • View Profile
Re: error in transition signal reference of statechart.
« Reply #1 on: November 21, 2020, 02:53:25 am »
I followed these directions and it still does not work, for some reason the trigger is not found even though it is clearly defined.

https://sparxsystems.com/enterprise_architect_user_guide/9.3/model_simulation/trigger_parameters.html

  • I have a signal named s10 with an attribute named val of type int.
  • I have a trigger named trg
  • In the transition guard I have: this.s10.val==1;

The error is:

Code: [Select]
[111303920]      TypeError: sim.trg is undefined
[111303922]      TypeError: sim.s10 is undefined

My EA version is:

Enterprise Architect (Corporate Edition)
15.1.1529
« Last Edit: November 21, 2020, 03:03:56 am by mse »

EAButNotForGames

  • EA User
  • **
  • Posts: 50
  • Karma: +0/-0
    • View Profile
Re: I cannot get triggers with parameters to simulate correctly.
« Reply #2 on: April 05, 2024, 07:05:23 pm »
Have you found a solution for this?

mse

  • EA User
  • **
  • Posts: 308
  • Karma: +1/-0
    • View Profile
Re: I cannot get triggers with parameters to simulate correctly.
« Reply #3 on: April 17, 2024, 08:52:37 pm »
I revisited this problem and was able to get it running, but with a limitation.

Scope seems to matter when defining the signals and triggers. This do not work when there is a package at the top of the hierarchy containing signals. The signal has to be defined at a level equal or below the class containing the statechart. The trigger then refers to the signal.

When creating a transition you have to use the prefix "sim" to refer to the signal in a guard for example like this:

sim.s10==1

Finally, the trigger and the signal have to have the same name.
« Last Edit: April 17, 2024, 08:56:32 pm by mse »