Guard on state machine transition always evaluating to false

Moderator: Moderators

Guard on state machine transition always evaluating to false

Postby curtiselaugh@gmail.com » Wed Jun 22, 2022 5:12 pm

I have a difficult problem to solve regarding guards on value properties in classifier state machines. I apologize for no visuals, but showing my work is not possible. I'll first describe this system model (Given), then what I do to cause the error (When), and finally what happens (Then).

Given: I have decomposed a system into two subsystems. Each subsystem has a value property of the same type as the other subsystems. These two value properties are joined together with an inherited port and a redefined interface. (Basically, whenever the value type on the source end of the port changes, the value type on the target end of the port changes, too. The method is described here https://www.youtube.com/watch?v=di7oJYtp1T8). Finally, the value property is typed by an enumeration with two strings for enumeration literals (literal1, literal2).

Each of these subsystems have a classifier behavior in a state machine. The interaction of these two state machines leads us to the When:

When: Both state machines have an initial state, which is entered when the parent system is simulated. Next, I transition the state machine of the source subsystem (the one that controls the value type in the redefined interface) to a state. This state has an opaque action which sets the value of the value property to literal1. Next, I transition the target subsystem to a state which is guarded by the value of the value type.

I.E: <valueType>=="literal1"

Then: In a nutshell, nothing happens. The guard is false so the transition does not fire. This seems impossible, since the value in the simulation for this target subsystem's value type clearly says "literal1". You can watch it change when the opaque action on the source subsystem fires. I dug into the debug code, though, and found that for some reason the guard is evaluated before the system reads the value property of the target subsystem.

The debug output from the simulation looks something like this:

Evaluating guard: selection=="literal1"
The context is : State Secondary
Evalutation result is: false
[register] object=subsystemB@######
outflow=[literal1]
selction=[literal1]

etc., etc., etc...

Why does the simulation engine evaluate a guard before even registering the object? It doesn't seem like I'm modeling something too out of the ordinary. Please help!
curtiselaugh@gmail.com
Forum Newbie
Forum Newbie
 
Posts: 13
Posts Rating:0
Joined: Tue Jun 14, 2022 11:08 am

Re: Guard on state machine transition always evaluating to false

Postby curtiselaugh@gmail.com » Thu Jun 23, 2022 11:12 am

I found a solution to my problem. When I redefined the interface, the value property receieved an 0..* multiplicity. Taking this out, and making the multiplicity unspecified cleared up the blocked guard. I don't know why this worked, but it did!

Some lessons learned along the way were how to turn on the debugger https://docs.nomagic.com/display/CST190/Console+log%27s+filter+options, and how to incrementally reproduce my problem in a sandbox until I isolated the problem, which was this spurious multiplicity element.
curtiselaugh@gmail.com
Forum Newbie
Forum Newbie
 
Posts: 13
Posts Rating:0
Joined: Tue Jun 14, 2022 11:08 am


Return to Cameo Simulation Toolkits

Who is online

Users browsing this forum: No registered users and 0 guests