Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The test case is currently failing. See FIXME statement in function StateMachineFlatten.addStateActivationAndReset(..).
- Loading branch information
1 parent
13853a5
commit cd62054
Showing
3 changed files
with
53 additions
and
1 deletion.
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,25 @@ | ||
model AccessFromOutside "Access previous value from local state variable from outside" | ||
output Real y; | ||
model State1 | ||
output Integer i(start=2); | ||
equation | ||
i = previous(i) + 2; | ||
end State1; | ||
State1 state1; | ||
model State2 | ||
end State2; | ||
State2 state2; | ||
equation | ||
initialState(state1); | ||
transition( | ||
state1, | ||
state2, | ||
state1.i > 10, | ||
immediate=false); | ||
transition( | ||
state2, | ||
state1, | ||
true, | ||
immediate=false); | ||
y = previous(state1.i); | ||
end AccessFromOutside; |
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,27 @@ | ||
// name: AccessFromOutside | ||
// keywords: state machines | ||
// status: correct | ||
// | ||
|
||
loadFile("AccessFromOutside.mo"); | ||
echo(false); | ||
setCommandLineOptions({"+simCodeTarget=Cpp"}); getErrorString(); | ||
simulate(AccessFromOutside, startTime=0, stopTime=10, numberOfIntervals = 0); getErrorString(); | ||
echo(true); | ||
val(state1.i,4.0); | ||
val(y,4.0); | ||
val(state1.i,5.0); | ||
val(y,5.0); | ||
val(state1.i,6.0); | ||
val(y,6.0); | ||
|
||
// Result: | ||
// true | ||
// true | ||
// 12.0 | ||
// 10.0 | ||
// 12.0 | ||
// 12.0 | ||
// 4.0 | ||
// 2.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