以下简单模型是正确的并且在 dymola 中工作:
model new_timer
Modelica.Blocks.Logical.Timer timer;
Real my_time( start=0);
equation
timer.u=true;
my_time=timer.y;
end new_timer;
但是,在使用 dymola 进行“检查”期间,以下一项是正确的,但在模拟期间不起作用:
model new_timer
Modelica.Blocks.Logical.Timer timer;
Real my_time( start=0);
algorithm
timer.u:=true;
my_time:=timer.y;
end new_timer;
我想知道并寻找一种使后者工作的方法。dymola报错如下:
Failed to generate code for an algebraic loop
involving when equations or algorithms with when parts.
Unknowns:
my_time
timer.entryTime
timer.u
timer.y
Equations:
when timer.u then
timer.entryTime = time;
end when;
timer.y = (if timer.u then time-timer.entryTime else 0.0);
algorithm
timer.u := true;
my_time := timer.y;
You may be able to cut the loop
by putting 'pre' around some of the references to
unknown continuous time variables in when parts or when conditions.
Translation aborted.