Docstoc

Real Time Systems

Document Sample
Real Time Systems Powered By Docstoc
					         Real-Time Systems


• time dependent
• control oriented
• driven by events rather than data
       Control Flow Diagram
• extension to data flow diagram to represent
  control flow rather than data flow
• contains same processes as the data flow
  diagram but instead of showing data flow, it
  diagrams control flow
• diagram the events that cause the various
  process to be activated
      Control Flow Diagram (2)

• together with the CSPEC (control
  specification) show
  –   how software behaves when the event or
      control signal is sensed
  –   which processes are invoked as a consequence
      of the occurrence of the event
Control Flow Diagram (3)

                control item



                window into CSPEC
Drawing a Control Flow Diagram

• draw the data flow diagram and remove all
  of the data flow arrows
• add control items and windows into CSPEC
  where needed
A Data Flow Process Bubble
       current
       temperature

                                  status
                    check
      safe point    temperature
      temperature
  PSPEC for check temperature
If current temperature> safe temperature
      then
             set status to “true”;
      else
             set status to “false”;
   end if;
Control Flow Diagram for check
          temperature


            check         above safepoint
            temperature
op commands
            Data Flow for Copier
and data                               copy            displays
                 copy info             status
   read op                   manage             produce
                                                user
   input                     copying
                                                displays
        reload           problem
        reqs.            indicator         problem
                      reload     perform type
        reload        status     problem
        paper
                                 diagnosis
             Copier Events


• start/stop
• paper feed (jammed, empty, etc.)
• finished
        Control Flow for Copier
     start/stop          paper       alarm
                         feed
read op          manage status
                                   produce
input            copying           user
                          finished displays


                     perform
     reload
                     problem
     paper
                     diagnosis
          full
         Determining Events
• list all sensors that are read by software
• list all interrupt conditions
• list all switches activated by operator
• list all data conditions
• look at noun-verb combinations reviewing
  control items as possible CSPEC I/Os
• identify states, how each state is reached, &
  define transitions between states
        Microwave Oven Events
•   Half Power -- user pressed
•   Full Power -- user pressed
•   Timer -- user set
•   Door open -- switch not closed
•   Door Closed -- switch is closed
•   Start -- user pressed
•   Timeout -- timer has finished
    Control Flow Diagram and
             CSPEC
• event that flows from the outside world into
  | (CSPEC) implies the CSPEC will activate
  one or more processes in the CFD
• A control item that emanates from a process
  and flows into | (CSPEC) implies control
  and activation of some other process or
  outside entity
                   Events
• events occur at discrete points in time and
  cause an instantaneous change in the state
  of a process
• can occur asynchronously (any point in
  time) or synchronously (at clocked
  intervals)
     State Transition Diagrams

• graphical representation of the events and
  the stimuli that cause transition from one
  event to another
• above each transition list the input/output
  that cause/result from the stimuli and event.
State Transition Diagrams

                 possible state



                 possible transition
                 between states
         State Transition Matrix
•   uses a tabular rather than graphical form
•   all possible states identify the rows
•   all stimuli identify the columns
•   at intersection next possible state is listed
•   add column at end of matrix for outputs
                                            ON HOOK/QUIET

                                                DIAL BUSY NUMBER/
                                                    BUSY TONE          BUSY
                                     DISTIN.
              ON HOOK/QUIET
                                      DIAL
                                      TONE

                       DIAL 9/
                    DISTINCTIVE             DIAL IDLE NUMBER/
                     DIAL TONE               RING BACK TONE

       OFF HOOK/DIAL TONE                                   CALLED PARTY
                                DIAL IDLE NUMBER/
                                                              OFF HOOK/
                                 RING BACK TONE              CONNECTED
                        DIAL
IDLE    ON HOOK/QUIET                           RINGING
                        TONE


                                DIAL BUSY NUMBER/
                                    BUSY TONE




                ON HOOK/QUIET
                                     BUSY

                     ON HOOK/QUIET
The state diagram depends on the range of facilities on the CD player.



                                                                     Door open
                                                                                                             Idle
                                 Off button                                         Off button
         Idle           On
                        button
                                                 Open door           Door closed                    Off button
                                 Ready                Disk Door                    Ready to
          Door closed                                   open                         play
                                                                                                         Off button
                                    Off button
                                                                           Play button
         Door Close                                          End of play                    Track selector


                                                                      Disk
                                                                                                             Track selector
                                                                     playing
                                                                                    Play        Track
                                                                                   button
                                                                                              selection
        Microwave Oven Events
•   Half Power -- user pressed
•   Full Power -- user pressed
•   Timer -- user set
•   Door open -- switch not closed
•   Door Closed -- switch is closed
•   Start -- user pressed
•   Timeout -- timer has finished
                 Full
               power on

        Full              Timer
       Power                                        Timer
                   Full
                  Power
                                     Set                      Timed        Timeout   Cooking
Idle
                                    time                     operation               complete
                Half
               Power
       Half                                   Door          Start
                          Timer               closed
       Power


                 Half               Door            Operation       Door
                                    open                            open               Idle
               power on                              enabled
                                           Door
                                           closed

                                  Operation
                                  disabled

				
DOCUMENT INFO