classStateMachines
State Machines
Extends from ModelicaReference.Icons.Information (Icon for general information packages).
Information
The state machines defined in the Modelica Language are based on the synchronous language elements. Note that the state machines defined in the Modelica Standard Library are not based on this.
Examples
inner Integer v(start=0);
block Increase
outer output Integer v;
equation
v = previous(v) + 2;
end Increase;
Increase increase;
block Decrease
outer output Integer v;
equation
v = previous(v) - 1;
end Decrease;
Decrease decrease;
equation
initialState(increase);
transition(increase, decrease, v>=6, immediate=false);
transition(decrease, increase, v==0, immediate=false);
In this example we will start in increase and increase v until a limit, and then decrease it, and repeat.