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
25b7068
commit 0a122d1
Showing
7 changed files
with
151 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,12 @@ | ||
within; | ||
model DeadEnd | ||
model State1 | ||
end State1; | ||
State1 state1; | ||
model State2 | ||
end State2; | ||
State2 state2; | ||
equation | ||
transition(state1, state2, true, immediate=false); | ||
initialState(state1); | ||
end DeadEnd; |
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,21 @@ | ||
// name: DeadEnd | ||
// keywords: state machines | ||
// status: correct | ||
// | ||
|
||
loadFile("DeadEnd.mo"); | ||
simulate(DeadEnd, startTime=0, stopTime=2, numberOfIntervals=0); getErrorString(); | ||
val(state1.active,2); | ||
val(state2.active,2); | ||
|
||
// Result: | ||
// true | ||
// record SimulationResult | ||
// resultFile = "DeadEnd_res.mat", | ||
// simulationOptions = "startTime = 0.0, stopTime = 2.0, numberOfIntervals = 0, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'DeadEnd', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''", | ||
// messages = "" | ||
// end SimulationResult; | ||
// "" | ||
// 0.0 | ||
// 1.0 | ||
// endResult |
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,69 @@ | ||
within ; | ||
block MLS33_17_3_7NA "Example from the MLS 3.3, Section 17.3.7, No Annotations" | ||
inner Integer v(start=0); | ||
model State1 | ||
inner Integer count(start=0); | ||
inner outer output Integer v; | ||
StateA stateA; | ||
StateB stateB; | ||
StateC stateC; | ||
StateD stateD; | ||
StateX stateX; | ||
StateY stateY; | ||
model StateA | ||
outer output Integer v; | ||
equation | ||
v = previous(v) + 2; | ||
end StateA; | ||
|
||
model StateB | ||
outer output Integer v; | ||
equation | ||
v = previous(v) - 1; | ||
end StateB; | ||
|
||
model StateC | ||
outer output Integer count; | ||
equation | ||
count = previous(count) + 1; | ||
end StateC; | ||
|
||
model StateD | ||
end StateD; | ||
equation | ||
initialState(stateA); | ||
transition(stateA, stateB, v >= 6, immediate=false); | ||
transition(stateB, stateC, v == 0, immediate=false); | ||
transition(stateC, stateA, true, immediate=false, priority=2); | ||
transition(stateC, stateD, count >= 2, immediate=false); | ||
public | ||
model StateX | ||
outer input Integer v; | ||
Integer i(start=0); | ||
Integer w; | ||
equation | ||
i = previous(i) + 1; | ||
w = v; | ||
end StateX; | ||
|
||
model StateY | ||
Integer j(start=0); | ||
equation | ||
j = previous(j) + 1; | ||
end StateY; | ||
equation | ||
transition(stateX, stateY, stateX.i > 20, immediate=false); | ||
initialState(stateX); | ||
end State1; | ||
State1 state1; | ||
model State2 | ||
outer output Integer v; | ||
equation | ||
v = previous(v) + 5; | ||
end State2; | ||
State2 state2; | ||
equation | ||
transition(state1, state2, activeState(state1.stateD) and activeState(state1.stateY), immediate=false); | ||
transition(state2, state1, v >= 20, immediate=false); | ||
initialState(state1); | ||
end MLS33_17_3_7NA; |
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,20 @@ | ||
// name: MLS33_17_3_7NA | ||
// keywords: state machines | ||
// status: correct | ||
// | ||
|
||
loadFile("MLS33_17_3_7NA.mo"); | ||
simulate(MLS33_17_3_7NA, startTime=0, stopTime=30, numberOfIntervals=0); getErrorString(); | ||
val(v,30.0); | ||
|
||
// Result: | ||
// true | ||
// record SimulationResult | ||
// resultFile = "MLS33_17_3_7NA_res.mat", | ||
// simulationOptions = "startTime = 0.0, stopTime = 30.0, numberOfIntervals = 0, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'MLS33_17_3_7NA', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''", | ||
// messages = "" | ||
// end SimulationResult; | ||
// "Warning: The initial conditions are not fully specified. Use +d=initialization for more information. | ||
// " | ||
// 18.0 | ||
// endResult |
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
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,8 @@ | ||
within; | ||
model SingleState | ||
model State1 | ||
end State1; | ||
State1 state1; | ||
equation | ||
initialState(state1); | ||
end SingleState; |
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,18 @@ | ||
// name: SingleState | ||
// keywords: state machines | ||
// status: correct | ||
// | ||
|
||
loadFile("SingleState.mo"); | ||
simulate(SingleState, startTime=0, stopTime=2, numberOfIntervals=0); getErrorString(); | ||
|
||
// Result: | ||
// true | ||
// record SimulationResult | ||
// resultFile = "SingleState_res.mat", | ||
// simulationOptions = "startTime = 0.0, stopTime = 20.0, numberOfIntervals = 0, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'DeadEnd', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''", | ||
// messages = "" | ||
// end SimulationResult; | ||
// "Warning: The initial conditions are not fully specified. Use +d=initialization for more information. | ||
// " | ||
// endResult |