Question

Consider the following state machine diagram: enter image description here

If we have the following event sequence :

Close door --> Start --> Open door -->  Reset 

and we need to know the corresponding response sequence starting from the initial state

(~Closed, ~Heat, ~Error)

My answer was as follows:

(Closed, ~Heat, ~Error) --> (Closed, Heat, ~Error) --> (~Closed, ~Heat, ~Error)

I think my answer is not correct because I didn't take into consideration the event reset, the state of the system after the event open door is the initial state (as shown from my written sequence) and according to the state diagram the system has no transition from this initial state to any state due to the event reset, so is my answer will be the right system response or it's wrong ?

Finally, If we need to edit this diagram such that the system will have the ability to control the heating process in which it will stop the heating after one minute and produces an alarm for five seconds. My suggestion is to create an action associated with the start oven event in which this action will create a variable called timer and set it to zero and during the looping of the heating process (state (Closed, Heat , ~Error) ) we will increment the timer variable as an action and then we will do a new state called alarm which has a transition from the state (Closed, Heat , ~Error) to this alarm stateEdit with a guard condition timer> 60. Moreover, to finish this modification this state timer should have a transition leaving it and terminating at the state (Closed ~ Heat Error). So is this modification will implement this heating control process? Or am I missing something?

Was it helpful?

Solution

Sorry but this diagram is a confusing mess. Let's clean it up.enter image description here

I've given the states nice short names to make talking about them easier. I put A on what you said was the 'initial state'.

I've removed the unlabeled loop transition from B to B since, well every state should have one of those if you're going to do that because no state here has a state change transition for every input. So it's better to stick with the convention of only showing state changing transitions. If an input doesn't take you anywhere else you don't go anywhere else.

Also added symmetry that should make it more obvious that errors are on the left and that the oven is closed on the bottom.

Finally I removed distracting noise commenting on what the symmetry should be showing.

initial state (~Closed, ~Heat, ~Error).

This I've named A.

event sequence : Close door --> Start --> Open door --> Reset

Takes us from A to B to C to A to A again because A has no Reset transition.

My answer was as follows: (Closed ~ Heat ~ Error ) --> (Closed Heat ~ Error) ---> (~ Closed ~ Heat ~ Error).

This translates to ... B to C to A

Which is pretty close to the same thing I said.

edit this diagram such that the system will has the ability to control the heating process in which it will stop the heating after one minute and produces an alarm for five seconds

Sounds like a new state to me. But you say:

My suggestion is to create an action associated with the start oven event in which this action will create a variable called timer and set it to zero and during the looping of the heating process (state (closed , heat , ~ error) ) we will increment the timer variable as an action and then we will do a new state called alarm which has a transition from the state (closed , heat , ~ error) to this alarm stateEdit with a guard condition timer> 60. Moreover , to finish this modification this state timer should have a transition leaving it and terminating at the state (Closed ~ Heat Error). So is this modification will implement this heating control process ?

Ugg.

or I am missing something ?

Yeah, that state machines don't have variables. They have states and transitions.

enter image description here

I can't be bothered to update the old states with ~ Alarm. I'm more tempted to simply remove all the ones with ~. But anyway this should do what you want.

Licensed under: CC-BY-SA with attribution
scroll top