|
1 | | -""" |
2 | | -SpeedControl defined by FSM, no shared actions with PowerSwitch |
3 | | -""" |
| 1 | + |
| 2 | +# pma --maxTransitions 100 --output SpeedControl SpeedControl |
| 3 | +# 3 states, 3 transitions, 1 accepting states, 0 unsafe states, 0 finished and 0 deadend states |
| 4 | + |
| 5 | +# actions here are just labels, but must be symbols with __name__ attribute |
4 | 6 |
|
5 | 7 | def IncrementSpeed(): pass |
6 | 8 |
|
7 | | -cleanup = (IncrementSpeed,) |
| 9 | +# states, key of each state here is its number in graph etc. below |
| 10 | + |
| 11 | +states = { |
| 12 | + 0 : {'SpeedControl': 0}, |
| 13 | + 1 : {'SpeedControl': 1}, |
| 14 | + 2 : {'SpeedControl': 2}, |
| 15 | +} |
| 16 | + |
| 17 | +# initial state, accepting states, unsafe states, frontier states, deadend states |
8 | 18 |
|
9 | 19 | initial = 0 |
10 | | -accepting = (0,) |
| 20 | +accepting = [0] |
| 21 | +unsafe = [] |
| 22 | +frontier = [] |
| 23 | +finished = [] |
| 24 | +deadend = [] |
| 25 | +runstarts = [0] |
| 26 | + |
| 27 | +# finite state machine, list of tuples: (current, (action, args, result), next) |
11 | 28 |
|
12 | | -graph = ((0, (IncrementSpeed, (), None), 1), |
13 | | - (1, (IncrementSpeed, (), None), 2), |
14 | | - (2, (IncrementSpeed, (), None), 0)) |
| 29 | +graph = ( |
| 30 | + (0, (IncrementSpeed, (), None), 1), |
| 31 | + (1, (IncrementSpeed, (), None), 2), |
| 32 | + (2, (IncrementSpeed, (), None), 0), |
| 33 | +) |
0 commit comments