modelica - When .. elsewhen equations seems to be reversed in Wolfram Systemmodeler -
when try simple modelica code in wolfram systemmodeler:
model bug integer y(start = 1); equation when time > 0.2 y = 5 "y = 2"; elsewhen time > 0.4 y = 4 "y = 3"; elsewhen time > 0.6 y = 3 "y = 4"; elsewhen time > 0.8 y = 2 "y = 5"; end when; end bug;
the result 1, 2, 3, 4, 5, this: model bug simulatiom. when-equations seems activated in reverse order.
on othe hand, changing "equation" "algorithm", , (of course) "=" ":=" code turns:
model nobug integer y(start = 1); algorithm when time > 0.2 y := 5; elsewhen time > 0.4 y := 4; elsewhen time > 0.6 y := 3; elsewhen time > 0.8 y := 2; end when; end nobug;
and result expected, 1, 5, 4, 3, 2, this: model nobug simulation
is relatively basic problem in wolfram systemmodeler implementation, or there else cannot see?
Comments
Post a Comment