FSM Lecture 10- UML state machine internal state activities(entry/exit/do)

  • Post author:
  • Post category:Blog

 

UML state machine internal state activities(entry/exit/do)

 

 

In the previous article, we explored the simple state, the composite state, and we also understood how to draw a simple state in its simple compartment.

Now let’s discuss the internal activities compartment. Figure 1 shows the internal activity compartment area. 

UML state machine internal state activities
Figure 1. Internal activity compartment

 

Internal activities compartment

  • This compartment holds a list of internal behaviors associated with a state
  • Each entry has the following format:
  • <behavior-type-label>[‘/’ <behavior-expression>]
  • Example : ‘entry ‘, ‘exit’, ‘do’ are internal activities labels or keywords defined in the UML . Do not use these keywords to represent events in the state machine diagram

 

Internal activities labels

  • These labels identify the circumstances under which the behaviors specified by the ‘behavior-expression’ is executed.
  • entry: Behavior identified by <behavior-expression> will be executed upon entry to the state. Use the entry keyword if the state has entry action.
  • exit: Behavior identified by <behavior -expression> will be executed upon exit from the state. Use the exit keyword if a state has exit action.
  • do: Behavior identified by <behavior-expression> will be executed as long as the object is in the state or until the computation specified by the expression is completed. This represents ongoing behavior. Use the do keyword only if a state has do action.

 

UML state machine internal state activities
Figure 2. Example of Internal activity compartment

Look at Figure 2, in the STAT state, entry/disp_msg(“productive time”) and disp_time(mobj->pro_time)is an entry action. These 2 are entry actions separated by a comma. These entry actions are identified by the label ‘entry.’ There is an ‘exit’ label, and the exit action is disp_clr(). 

Whenever the object enters into STAT state, it displays a message onto the LCD. The message is “productive time.” And it also displays a value of one variable onto the display.

And whenever the object leaves this state, it clears the display. That’s an ‘exit’ action for this state. 

 

Similarly, when the object enters the IDLE state, it initializes some variables to 0. Pro_time, c_time, e_time, disp_time these are actually object’s attributes.

As I mentioned in the previous article, an object is nothing but a collection of attributes and methods or behaviors.

‘mobj’ that’s the main application object and rest are its variables, and it’s being initialized; that’s an ‘entry’ action for this state, and it also displays the time as 0, and it displays the message “set_time.” Commas separate all the ‘entry’ actions. And when the IDLE state is left, the ‘exit’ action is ‘display clear.’

 

FastBit Embedded Brain Academy Courses

click here: https://fastbitlab.com/course1

 

FastBitLab

The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.