Following is a safety controller with input and output Condition given below for designing a state machine: Here SignalOk, SignalWeak and SignalLost are measurements signal quality of steering angle. SteeringAngle signal itself contains the original steering data. In case of 3 consecutive SignalOk, system controller will output ValidSignal with the steering angle data. In other cases, signal will be considered as CorrputSignal. I am using UML 2 state charts(Harel charts). This is so far what I have done:
N.B.:Parallel states and broadcasting is not supported yet, but nested states are supported. I don't know how to model this stream of inputs in state machine, any kind of help will be appreciated.
First I would recommend renaming the states, so that they don't resemble actions. I suggest to name them First Ok received
, Second Ok received
and Ok confirmed
.
Since the SteeringAngle
shall be ignored the first two times, the only transition triggered by it should be an internal transition in Ok confirmed
. This transition will also invoke ValidSignal
.
Nothing is specified about the order of SteeringAngle
and SignalOk
. Therefore, SteeringAngle
should be deferred in Second Ok received
. This way, even it it comes first, it will stay in the event pool.
Any reception of SignalWeak
or SignalLost
should return to Ready
. You could do this with a local transition of Operational
to Ready
.
One additional recommendation: Define an Initial state in Operational
and target the SystemOk
transition to Operational
. The effect is the same, but it results in a better separation of the two top level states.