Real-Time Systems time dependent control oriented driven by events rather than data.

29
Real-Time Systems • time dependent • control oriented • driven by events rather than data

Transcript of Real-Time Systems time dependent control oriented driven by events rather than data.

Page 1: Real-Time Systems time dependent control oriented driven by events rather than data.

Real-Time Systems

• time dependent

• control oriented

• driven by events rather than data

Page 2: 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

Page 3: Real-Time Systems time dependent control oriented driven by events rather than data.

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

Page 4: Real-Time Systems time dependent control oriented driven by events rather than data.

Control Flow Diagram (3)

control item

window into CSPEC

Page 5: Real-Time Systems time dependent control oriented driven by events rather than data.

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

Page 6: Real-Time Systems time dependent control oriented driven by events rather than data.

A Data Flow Process Bubble

currenttemperature

safe pointtemperature

checktemperature

status

Page 7: Real-Time Systems time dependent control oriented driven by events rather than data.

PSPEC for check temperature

If current temperature> safe temperature

then

set status to “true”;

else

set status to “false”;

end if;

Page 8: Real-Time Systems time dependent control oriented driven by events rather than data.

Control Flow Diagram for check temperature

check temperature

above safepoint

Page 9: Real-Time Systems time dependent control oriented driven by events rather than data.

Data Flow for Copier

read opinput

managecopying

produceuserdisplays

reloadpaper

performproblemdiagnosis

op commandsand data copy info

copystatus

displays

reloadreqs.

reloadstatus

problemtype

problemindicator

Page 10: Real-Time Systems time dependent control oriented driven by events rather than data.

Copier Events

• start/stop

• paper feed (jammed, empty, etc.)

• finished

Page 11: Real-Time Systems time dependent control oriented driven by events rather than data.

Control Flow for Copier

read opinput

managecopying

produceuserdisplays

reloadpaper

performproblemdiagnosis

start/stop paperfeedstatus

alarm

full

finished

Page 12: Real-Time Systems time dependent control oriented driven by events rather than data.

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

Page 13: Real-Time Systems time dependent control oriented driven by events rather than data.

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

Page 14: Real-Time Systems time dependent control oriented driven by events rather than data.

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

Page 15: Real-Time Systems time dependent control oriented driven by events rather than data.

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)

Page 16: Real-Time Systems time dependent control oriented driven by events rather than data.

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.

Page 17: Real-Time Systems time dependent control oriented driven by events rather than data.

State Transition Diagrams

possible state

possible transition between states

Page 18: Real-Time Systems time dependent control oriented driven by events rather than data.

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

Page 19: Real-Time Systems time dependent control oriented driven by events rather than data.

State Transition Matrix for Copier

state\stimuli start full jammed done empty unjammed outputsread com. MC - DP RC RP - -make copies - - DP RC RP - copiesreload paper - RC - - RP - -diagnosis prob. - - DP - RP RC -

Page 20: Real-Time Systems time dependent control oriented driven by events rather than data.

makingcopies

readingcommands

diagnosingproblem

reloadingpaper

not empty andstart

making copies

emptyreload paper

full

readingcommands

jammeddiagnosing

problem

not jammedreading

commands

idle

readingcommands

copies done

readingcommands

State Transition Diagram --Copy Machine

empty and start

reloading paper

Page 21: Real-Time Systems time dependent control oriented driven by events rather than data.

STIMULUS STATE

LIFT PHONE

DIAL 9

DIAL 1-8

DIAL 0

HANG UP PHONE

SEVENTH DIGIT COLLECTED

IDLE

DIAL TONE STATE

__

__

__

__

__

DIAL TONE STATE

__

DISTINCTIVE DIAL TONE

COLLECTING 7 DIGITS

OPERATOR

IDLE

__

DISTINCTIVE DIAL TONE STATE

__

COLLECTING 7 DIGITS

COLLECTING 7 DIGITS

OPERATOR

IDLE

__

OPERATOR STATE

__

__

__

__

IDLE

__

COLLECTING 7 DIGITS STATE

__

COLLECTING 7 DIGITS

COLLECTING 7 DIGITS

COLLECTING 7 DIGITS

IDLE

IF CALLED PARTY BUSY, BUSY STATE; OTHERWISE, RINGING STATE

RINGING STATE

__

__

__

__

IDLE

__

BUSY STATE

__

__

__

__

IDLE

__

OUTPUTS

QUIET

DIAL TONE TOCALLING PARTY

DISTINCTIVEDIAL TONE TOCALLING PARTY

CONNECTCALLING PARTYTO OPERATOR

NO TONE TOCALLING PARTY

RINGING SIGNALTO CALLEDPARTY; RINGINGTONE TO CALLINGPARTY

BUSY TONE TOCALLING PARTY

Page 22: Real-Time Systems time dependent control oriented driven by events rather than data.

IDLEDIALTONE

RINGING

DISTIN.DIALTONE

BUSY

BUSY

ON HOOK/QUIET

DIAL BUSY NUMBER/BUSY TONE

CALLED PARTYOFF HOOK/

CONNECTED

DIAL IDLE NUMBER/RING BACK TONE

DIAL IDLE NUMBER/RING BACK TONE

DIAL BUSY NUMBER/BUSY TONE

ON HOOK/QUIET

ON HOOK/QUIET

ON HOOK/QUIET

OFF HOOK/DIAL TONE

ON HOOK/QUIET

DIAL 9/DISTINCTIVE

DIAL TONE

Page 23: Real-Time Systems time dependent control oriented driven by events rather than data.

State Transition Matrix for CD player

state\stimuli on button off button play door open track sel. door closed end play outputsidle if disk rp - if disk dp - if disk dp if do dc idle quietready ready idle ready door open ready - idle musicdoor open door open - door open - door open door closed - quietdisk playing - idle - door open disk play - rp musicready play - idle disk play door open disk play - - musicdoor closed - idle disk play door open disk play - - musictrack sel. - idle disk play - track sel. - - music

Page 24: Real-Time Systems time dependent control oriented driven by events rather than data.

The state diagram depends on the range of facilities on the CD player.

IdleIdle

Door CloseDoor Close

ReadyReadyDisk Door

open

Disk Dooropen

Ready to play

Ready to play

IdleIdle

Diskplaying

Diskplaying

Trackselection

Trackselection

Off buttonOnbutton

Door closed

Off button

Open door

Door open

Door closed

End of playPlay button

Off button

Off button

Off button

Track selector

Track selector

Playbutton

Page 25: Real-Time Systems time dependent control oriented driven by events rather than data.

State Transition Matrix for SIMPLE CD Player (2)

state\stimuli power play door stop track select outputoff if disc ready else on ------ ----- ---- ----- quieton off ndm door open ndm ndm quietready off play door open ready play musicdoor open off if disc play else ndm if disc ready else on door open if disc play else ndm quietplay off play door open ready play musicno disc m off ndm door open ndm ndm quiet

Page 26: Real-Time Systems time dependent control oriented driven by events rather than data.

Off

On(no disc)

Door Open

Off

Play

Readydisc

power

door

power

power

play | track select

power

stop

door

play | track select

door

powerpower

door

door

CD PlayerState Transition Diagram

Display Messageno disc

play | track select| stop

door

play | stop |track select

power

play | track select

stop

play | track select

stop

Page 27: Real-Time Systems time dependent control oriented driven by events rather than data.

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

Page 28: Real-Time Systems time dependent control oriented driven by events rather than data.

State Transistion Matrix for Microwave Oven

state\stimuli half full timer door open door closed start timeout outputhalf half full set time op dis op en timed op ccfull half full set time op dis op en timed op ccset time set time set time set time op dis op en timed op set timeop disabled/light on half/op dis full/op dis set time/op dis op dis op en op dis op disop enabled/light off half full set time op dis op en timed op op entimed operation op dis op en timed op cccooking complete op dis op en op en op en

Page 29: Real-Time Systems time dependent control oriented driven by events rather than data.

IdleIdle

Fullpower on

Fullpower on

Half power on

Half power on

Settime

Settime

Operationdisabled

Operationdisabled

Operationenabled

Operationenabled

Timedoperation

Timedoperation

Cookingcomplete

Cookingcomplete

IdleIdle

TimerTimer

Timer

Full Power Full

Power

Half Power

Half Power

Door open

Door open

Door closed

Door closed

Start

Timeout