Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Belonging to [master]: - OpenModelica/OMCompiler#2105 - OpenModelica/OpenModelica-testsuite#818
- Loading branch information
1 parent
7a63969
commit 0844b0d
Showing
3 changed files
with
47 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
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 @@ | ||
model Ticket4618 | ||
firstState s1; | ||
secondState s2; | ||
Real t; | ||
inner Clock c = Clock(0.1); | ||
block firstState | ||
Real x1; | ||
outer Clock c; | ||
equation | ||
when c then | ||
x1 = previous(x1)+interval(); | ||
end when; | ||
end firstState; | ||
|
||
block secondState | ||
Real x2; | ||
outer Clock c; | ||
equation | ||
when c then | ||
x2 = previous(x2)+interval(); | ||
end when; | ||
end secondState; | ||
equation | ||
t = sample(time,c); | ||
initialState(s1); | ||
transition(s1, s2, t > 0.5, immediate = false, reset = true, synchronize = false, priority = 1); | ||
end Ticket4618; |
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,19 @@ | ||
// name: Ticket4618 | ||
// keywords: state machines | ||
// status: correct | ||
// | ||
|
||
loadFile("Ticket4618.mo"); | ||
echo(false); | ||
setCommandLineOptions("--simCodeTarget=Cpp"); getErrorString(); | ||
simulate(Ticket4618, startTime=0, stopTime=1.0, numberOfIntervals=0); getErrorString(); | ||
echo(true); | ||
val(s1.x1,1.0); | ||
val(s2.x2,1.0); | ||
|
||
// Result: | ||
// true | ||
// true | ||
// 0.7 | ||
// 0.4 | ||
// endResult |