Page 154 -
P. 154

5.4   Behavioral models  137


                                         State         Description

                                         Waiting       The oven is waiting for input. The display shows the current time.

                                         Half power    The oven power is set to 300 watts. The display shows ‘Half power’.
                                         Full power    The oven power is set to 600 watts. The display shows ‘Full power’.

                                         Set time      The cooking time is set to the user’s input value. The display shows
                                                       the cooking time selected and is updated as the time is set.
                                         Disabled      Oven operation is disabled for safety. Interior oven light is on.
                                                       Display shows ‘Not ready’.
                                         Enabled       Oven operation is enabled. Interior oven light is off. Display shows
                                                       ‘Ready to cook’.
                                         Operation     Oven in operation. Interior oven light is on. Display shows the timer
                                                       countdown. On completion of cooking, the buzzer is sounded for
                                                       five seconds. Oven light is on. Display shows ‘Cooking complete’
                                                       while buzzer is sounding.
                                         Stimulus      Description

                                         Half power    The user has pressed the half-power button.
                                         Full power    The user has pressed the full-power button.

                                         Timer         The user has pressed one of the timer buttons.
                                         Number        The user has pressed a numeric key.

                                         Door open     The oven door switch is not closed.
                                         Door closed   The oven door switch is closed.

                                         Start         The user has pressed the Start button.
                     Figure 5.17 States
                     and stimuli for the  Cancel       The user has pressed the Cancel button.
                     microwave oven



                                       their mind after selecting one of these and press the other button. The time is set and,
                                       if the door is closed, the Start button is enabled. Pushing this button starts the oven
                                       operation and cooking takes place for the specified time. This is the end of the cook-
                                       ing cycle and the system returns to the waiting state.
                                         The UML notation lets you indicate the activity that takes place in a state. In a
                                       detailed system specification you have to provide more detail about both the stimuli
                                       and the system states. I illustrate this in Figure 5.17, which shows a tabular descrip-
                                       tion of each state and how the stimuli that force state transitions are generated.
                                         The problem with state-based modeling is that the number of possible states
                                       increases rapidly. For large system models, therefore, you need to hide detail in the
   149   150   151   152   153   154   155   156   157   158   159