|
| 1 | +within ; |
| 2 | +model TicksInState "Test for TicksInState" |
| 3 | + inner Integer i(start = 0); |
| 4 | + |
| 5 | + block State1 |
| 6 | + outer output Integer i; |
| 7 | + equation |
| 8 | + i = previous(i) + 2; |
| 9 | + annotation(Icon(graphics={ Text(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, textString = "%name")}), |
| 10 | + Diagram(graphics={ Text(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, textString = "%stateText", fontSize = 10)}), showDiagram = true, singleInstance = true); |
| 11 | + end State1; |
| 12 | + |
| 13 | + State1 state1 annotation(Placement(transformation(extent={{-56,62},{-10,76}}))); |
| 14 | + |
| 15 | + block State2 |
| 16 | + outer output Integer i; |
| 17 | + equation |
| 18 | + i = previous(i) - 1; |
| 19 | + annotation(Icon(graphics={ Text(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, textString = "%name")}), Diagram(graphics={ Text(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, textString = "%stateText", fontSize = 10)}), showDiagram = true, singleInstance = true); |
| 20 | + end State2; |
| 21 | + |
| 22 | + State2 state2 annotation(Placement(transformation(extent={{-56,40},{-12,54}}))); |
| 23 | +equation |
| 24 | + transition(state1, state2,ticksInState() > 4, |
| 25 | + immediate=false, reset=true, synchronize=false, priority=1) annotation(Line(points={{-8,69}, |
| 26 | + {-4,58},{-10,47}}, color = {175, 175, 175}, thickness = 0.25, smooth = Smooth.Bezier), Text(string = "%condition", extent = {{6, -4}, {6, -10}}, lineColor = {95, 95, 95}, fontSize=10, textStyle = {TextStyle.Bold}, horizontalAlignment = TextAlignment.Left)); |
| 27 | + transition(state2, state1,ticksInState() > 5, |
| 28 | + immediate=false, reset=true, synchronize=false, priority=1) annotation(Line(points={{-58,47}, |
| 29 | + {-66,58},{-58,69}}, color = {175, 175, 175}, thickness = 0.25, smooth = Smooth.Bezier), Text(string = "%condition", extent = {{-6, 4}, {-6, 10}}, lineColor = {95, 95, 95}, fontSize=10, textStyle = {TextStyle.Bold}, horizontalAlignment = TextAlignment.Right)); |
| 30 | + initialState(state1) annotation(Line(points={{-34.5336,78},{-36,84}}, color = {175, 175, 175}, thickness = 0.25, smooth = Smooth.Bezier, arrow = {Arrow.Filled, Arrow.None})); |
| 31 | + annotation(Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics={ Text(extent = {{-62, 94}, {-12, 84}}, lineColor = {0, 0, 0}, fontSize = 10, |
| 32 | + horizontalAlignment = TextAlignment.Left, textString = "%declarations")})); |
| 33 | +end TicksInState; |
0 commit comments