Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f12e83b
commit 425e279
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
within; | ||
model StateMachine | ||
model State1 | ||
end State1; | ||
State1 state1; | ||
model State2 | ||
end State2; | ||
State2 state2; | ||
equation | ||
connect(a, b) annotation (Line( | ||
points={{-28,36},{0,72}}, | ||
color={175,175,175}, | ||
thickness=0.25, | ||
smooth=Smooth.Bezier, | ||
arrow={Arrow.Filled,Arrow.None})); | ||
transition(state1, state2, i > 10, true, immediate=false) annotation (Line( | ||
points={{-8,6},{0,72}}, | ||
color={175,175,175}, | ||
thickness=0.25, | ||
arrow={Arrow.Filled,Arrow.None})); | ||
initialState(state1); | ||
transition(state2, state1, b > 10, reset=false); | ||
transition(state2, state1, c > 20, false, false, true) annotation (Line( | ||
points={{-8,6},{0,72}}, | ||
color={175,175,175}, | ||
thickness=0.25, | ||
arrow={Arrow.Filled,Arrow.None})); | ||
end StateMachine; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// name: StateMachine | ||
// keywords: | ||
// status: correct | ||
// | ||
// Tests the getTransitions, addTransition and deleteTransition APIs. | ||
// | ||
|
||
loadFile("StateMachine.mo"); getErrorString(); | ||
getTransitions(StateMachine); getErrorString(); | ||
addTransition(StateMachine, "state1", "state2", "a > 1", annotate = Line(points={{-20,50},{22,34},{-20,6}},color={175,175,175},thickness=0.25,smooth=Smooth.Bezier)); getErrorString(); | ||
getTransitions(StateMachine); getErrorString(); | ||
deleteTransition(StateMachine, "state1", "state2", "a > 1", true, true, false, 1); getErrorString(); | ||
getTransitions(StateMachine); getErrorString(); | ||
|
||
// Result: | ||
// true | ||
// "" | ||
// {{"state1","state2","i > 10","false","true","false","1","Line(true, {0.0, 0.0}, 0, {{-8, 6}, {0, 72}}, {175, 175, 175}, LinePattern.Solid, 0.25, {Arrow.Filled, Arrow.None}, 3, Smooth.None)"},{"state2","state1","b > 10","true","false","false","1",""},{"state2","state1","c > 20","false","false","true","1","Line(true, {0.0, 0.0}, 0, {{-8, 6}, {0, 72}}, {175, 175, 175}, LinePattern.Solid, 0.25, {Arrow.Filled, Arrow.None}, 3, Smooth.None)"}} | ||
// "" | ||
// true | ||
// "" | ||
// {{"state1","state2","a > 1","true","true","false","1","Line(true, {0.0, 0.0}, 0, {{-20, 50}, {22, 34}, {-20, 6}}, {175, 175, 175}, LinePattern.Solid, 0.25, {Arrow.None, Arrow.None}, 3, Smooth.Bezier)"},{"state1","state2","i > 10","false","true","false","1","Line(true, {0.0, 0.0}, 0, {{-8, 6}, {0, 72}}, {175, 175, 175}, LinePattern.Solid, 0.25, {Arrow.Filled, Arrow.None}, 3, Smooth.None)"},{"state2","state1","b > 10","true","false","false","1",""},{"state2","state1","c > 20","false","false","true","1","Line(true, {0.0, 0.0}, 0, {{-8, 6}, {0, 72}}, {175, 175, 175}, LinePattern.Solid, 0.25, {Arrow.Filled, Arrow.None}, 3, Smooth.None)"}} | ||
// "" | ||
// true | ||
// "" | ||
// {{"state1","state2","i > 10","false","true","false","1","Line(true, {0.0, 0.0}, 0, {{-8, 6}, {0, 72}}, {175, 175, 175}, LinePattern.Solid, 0.25, {Arrow.Filled, Arrow.None}, 3, Smooth.None)"},{"state2","state1","b > 10","true","false","false","1",""},{"state2","state1","c > 20","false","false","true","1","Line(true, {0.0, 0.0}, 0, {{-8, 6}, {0, 72}}, {175, 175, 175}, LinePattern.Solid, 0.25, {Arrow.Filled, Arrow.None}, 3, Smooth.None)"}} | ||
// "" | ||
// endResult |