Simcenter Amesim Event is true but Statechart doesn't transition to the next state

2024-11-08T14:02:04.000-0500
Simcenter Amesim Automation Connect Simcenter System Simulation Client for Git Simcenter Amesim Teamcenter Share

Summary

You will learn here how to ensure a transition from one state to another when an event is true.


Details

When working with Statecharts, one problematic you might face is the Statechart being blocked in one state while one of its transition has an event which is true. 

 

Let's work on this simple example:

We want the Statechart's output to be equal to 10 once the input signal has reached 10. It must give 0 till it doesn't.

We create the following Statechart:

If the event e (in>a=10) is true, we must pass from State to Output = 10 and assign the value 10 to the output out.

 

But unfortunately, we don't get the expected results as the output remains stuck to 0:

Indeed, the input is greater than 10 during the whole simulation so we should get 10 as output. However, the Statechart remains stuck to the first State all simulation long. This is because the event is not triggered. Indeed, it is True at the beginning of the simulation (in=20>10) and keeps on being True so we have no trigger. To trigger an event, it has to pass from False to True.

 

In order to avoid this situation and get the expected behavior, we need to introduce an intermediate state and use the guards:

In this Statechart, during the initialization, we first check the branch going to the left because of the priorities (0 to the left, then 1 to the right). Inside the guard, you will have to write the event condition: in>a. If the input is greater than 10, it directly moves from State to Intermediate and then to Output = 10 as there is no condition to reach this last state. Otherwise, if the input is lower or equal to 10, the Statechart will go to the branch on the right-hand side to Waiting for e=True and stay there until the event e becomes True. In this case, the Statechart will see e passing from False to True and e will be triggered to reach Output = 10.

 

And with this Statechart, we get the expected results:

 

KB Article ID# KB000155410_EN_US

Contents

SummaryDetails

Associated Components

Amesim Automation Connect