Parking Meter Example
States = {0, 1, 2, ..., 60}
Inputs = {coin5, coin25, tick, absent}
Outputs = { expired, safe, absent }
initialState = 0
where safe simply indicates that there is still money in the meter. The update function is given by the following table:
if |
then update(s, x) =
|
x = tick and (s = 0 or s = 1) | (0, expired) |
x = tick and s > 1 | (s - 1, safe) |
x = coin5 | (min(s + 5, 60), safe ) |
x = coin25 | (min(s + 25, 60), safe ) |
x = absent | (s, absent) |
Example:
InputSequence = coin25, tick 20, coin5, tick 10, ...
StateResponse = 0, 25, 24, ..., 6, 5, 10, 9, 8, ..., 2, 1, 0 5
OutputSequence = expired, safe, safe, ..., safe, safe, safe, safe, safe, ..., safe, safe, expired 5