FSM operation

Jean-Marc Zanni 4 years ago in IQANdesign • updated by Gustav Widén (System support) 4 years ago 3

Not sure how transitions and state changes are handled or may be this is an issue with the simulate application. I am not a big specialist of state machine but it was my assumption that the rules were to

1) Evaluate transitions

2) Set state based on transition calculation.

3) Execute code corresponding to state (not directly applicable in IQAN)

Because my code was not working as I expected I wrote a small application:

1 virtual Button.

1 FSM with 3 states: Default, State1, State 2

Goal Have a toggle function every time I press the button, I switch state. basically a toggle.

Transition Default>State 1 = True

Transition State 1>State2 = PositiveFlank of push button

Transition State 2>State1 = PositiveFlank of push button

Added 2 event counters:

State =1


Result in simulation:

Program stuck in State 1

Counter not changing =0

remark: There was technically a transition from state 0 to state 1. Event counter 1 should have increased. It did not. Changed transition Default>State1 to happen after first scan. Then counter reads 1 but is stuck.

Is this the expected result??

Under review

Hi Jean-Marc,

I cannot reproduce your problem. This is how I did it, see attached project file:

FSM operation.ids4

Sorry, My mistake, works much better when I connect the Button object to the virtual digital in:)