Ticket #4618: stateMachine2.mo
File stateMachine2.mo, 459 bytes (added by , 7 years ago) |
---|
Line | |
---|---|
1 | model stateMachine2 |
2 | |
3 | firstState s1; |
4 | secondState s2; |
5 | Real t; |
6 | Clock c = Clock(0.01); |
7 | |
8 | block firstState |
9 | Real x1; |
10 | equation |
11 | x1 = previous(x1)+interval(); |
12 | end firstState; |
13 | |
14 | block secondState |
15 | Real x2; |
16 | equation |
17 | x2 = previous(x2)+interval(); |
18 | end secondState; |
19 | |
20 | equation |
21 | t = sample(time,c); |
22 | initialState(s1); |
23 | transition(s1, s2, t > 0.5, immediate= false, reset= true, synchronize= false, priority= 1); |
24 | |
25 | end stateMachine2; |