我是 Modelica 的新手,但我想用 2 个变量构建一个简单的状态机:初始步骤是“关闭”(变量 Light_cabin==0),然后如果 button_Evac == 1(第二个变量)然后转到“打开”步骤" 并且 Light_Cabin == 1 如果 Button_Evac==0 返回到初始步骤。这是我的状态机: state_machine
但是当我启动模拟时 Light_Cabin = 0 即使 button_Evac = 1 并且活动步骤是初始步骤。
这是我的代码:
model StateMachine
block Off
outer output Integer Light_Cabin;
equation
Light_Cabin = 0;
end Off;
block On
outer output Integer Light_Cabin;
equation
Light_Cabin = 1;
end On;
parameter Integer Button_Evac(start=0);
inner Integer Light_Cabin(start=0);
Off off;
On on;
equation
transition(
off,
on,
Button_Evac == 1,
immediate=true,
reset=false,
synchronize=false,
priority=1);
transition(
on,
off,
Button_Evac == 0,
immediate=true,
reset=false,
synchronize=false,
priority=1);
initialState(off);
end StateMachine;
如果您知道我的错误在哪里,请告诉我。谢谢你的帮助,埃洛伊丝