Download presentation
Presentation is loading. Please wait.
Published byByron Bailey Modified over 8 years ago
2
© 2000 Morgan Kaufman Overheads for Computers as Components 1. Embedded Computing 1.1 Introduction 1.2 Complex system and microprocessors 1.3 Embedded system design process 1.4 Formalisms for system designs 1.5 Design example: model train controller
3
© 2000 Morgan Kaufman Overheads for Computers as Components Introduction zExample: model train controller.
4
© 2000 Morgan Kaufman Overheads for Computers as Components Purposes of example zFollow a design through several levels of abstraction. zGain experience with UML.
5
© 2000 Morgan Kaufman Overheads for Computers as Components Model train setup console power supply rcvrmotor ECCaddressheadercommand
6
© 2000 Morgan Kaufman Overheads for Computers as Components Requirements zConsole can control 8 trains on 1 track. zThrottle has at least 63 levels. zInertia control adjusts responsiveness with at least 8 levels. zEmergency stop button. zError detection scheme on messages.
7
© 2000 Morgan Kaufman Overheads for Computers as Components Requirements form
8
© 2000 Morgan Kaufman Overheads for Computers as Components Conceptual specification zBefore we create a detailed specification, we will make an initial, simplified specification. yGives us practice in specification and UML. yGood idea in general to identify potential problems before investing too much effort in detail.
9
© 2000 Morgan Kaufman Overheads for Computers as Components Basic system commands
10
© 2000 Morgan Kaufman Overheads for Computers as Components Typical control sequence :console:train_rcvr set-inertia set-speed estop
11
© 2000 Morgan Kaufman Overheads for Computers as Components Message classes command set-inertia value: unsigned- integer set-speed value: integer estop Class diagram
12
© 2000 Morgan Kaufman Overheads for Computers as Components Roles of message classes zImplemented message subclasses derived from message class. yAttributes and operations will be filled in for detailed specification. zImplemented message subclasses specify message type by their class. yMay have to add type as parameter to data structure in implementation.
13
© 2000 Morgan Kaufman Overheads for Computers as Components Collaboration diagram Shows the transmit/receive relationship between console and receiver (ignores role of track): :console:receiver 1..n: command Specify the type of message and its sequence
14
© 2000 Morgan Kaufman Overheads for Computers as Components System structure modeling zSome classes define non-computer components. yDenote by name *. zChoose important systems at this point to show basic relationships.
15
© 2000 Morgan Kaufman Overheads for Computers as Components Console system classes console panelformattertransmitter knobs*sender* 1 1 1 1 1 1 1 1 1 1 zConsole: yread state of front panel; yformat messages; ytransmit messages.
16
© 2000 Morgan Kaufman Overheads for Computers as Components Console class roles zpanel: contains analog knobs and interface to the digital part of the system. zformatter: reads knob settings and turns them into bit streams. ztransmitter: inteface to the analog electronics to send data on track. zknobs*: describes the knobs, buttons, levers on the panel. zsender*:describes the analog electronics that send bits along the track.
17
© 2000 Morgan Kaufman Overheads for Computers as Components Train system classes train set train receiver controller motor interface detector*pulser* 1 1..t 1 1 1 1 1 1 1 1 1 1 zTrain: yreceive message; yinterpret message; ycontrol the train.
18
© 2000 Morgan Kaufman Overheads for Computers as Components Train class roles zreceiver: know how to digitize signal from track. zcontroller: interprets received commands and makes control decisions. zmotor interface: generates signals required by motor. zdetector*: digitizes signal from track. zpulser*: turn digital commands into analog signals required to control the motor speed.
19
© 2000 Morgan Kaufman Overheads for Computers as Components Detailed specification zWe can now fill in the details of the conceptual specification: ymore classes; ybehaviors. zSketching out the spec first helps us understand the basic relationships in the system.
20
© 2000 Morgan Kaufman Overheads for Computers as Components Console physical object classes knobs* train-knob: integer speed-knob: integer inertia-knob: unsigned- integer emergency-stop: boolean sender* send-bit() detector* read-bit() : integer set-knobs() When the train number is changed, the other control signals are reset to the proper values for that train, which were stored in the formatter of the console.
21
© 2000 Morgan Kaufman Overheads for Computers as Components Train speed control zMotor controlled by pulse width modulation (PWM): V + - duty cycle pulser* pulse-width: unsigned- integer direction: boolean
22
© 2000 Morgan Kaufman Overheads for Computers as Components Panel class panel train-number() : integer speed() : integer inertia() : integer estop() : boolean new-settings() Software interface to its physical device. No internal variable. Read panel knobs. new-settings() calls set-knobs(). zpanel class defines the controls. It represents the controls for the current train
23
© 2000 Morgan Kaufman Overheads for Computers as Components Motor interface class motor-interface speed: integer zmotor-interface class defines the motor speed held as state.
24
© 2000 Morgan Kaufman Overheads for Computers as Components Transmitter class transmitter send-speed(adrs: integer, speed: integer) send-inertia(adrs: integer, val: integer) set-estop(adrs: integer) ztransmitter class has one behavior for each type of message sent.
25
© 2000 Morgan Kaufman Overheads for Computers as Components Receiver class receiver current: command new: boolean read-cmd() new-cmd() : boolean cmd-type(msg-type: command) rcv-speed(val: integer) rcv-inertia(val:integer) zreceiver function provides methods to: ydetect a new message; ydetermine its type; yread its parameters (estop has no parameters). znew: a flag showing when the current command has been processed
26
© 2000 Morgan Kaufman Overheads for Computers as Components Formatter class formatter current-train: integer current-speed[ntrains]: integer current-inertia[ntrains]: unsigned-integer current-estop[ntrains]: boolean send-command() : panel-active() : boolean operate() zFormatter class holds state for each train, setting for current train. zoperate() performs the basic formatting task. Repeatedly read the panel. zpanel-active(): true whenever the panel’s values do not correspond to the current values. interface to the transmitter
27
© 2000 Morgan Kaufman Overheads for Computers as Components Control input cases zUse a soft panel to show current panel settings for each train. zChanging train number: ymust change soft panel settings to reflect current throttle/inertia/estop: zControlling throttle/inertia/estop: yread panel, check for changes, perform command.
28
© 2000 Morgan Kaufman Overheads for Computers as Components Control input sequence diagram :knobs:panel:formatter:transmitter change in speed/ inertia/estop change in train number change in control settings read panel panel settings panel-active send-command send-speed, send-inertia. send-estop read panel panel settings read panel panel settings change in train # set-knobs new-settings operate
29
© 2000 Morgan Kaufman Overheads for Computers as Components Formatter operate behavior idle update-panel() send-command() panel-active() new train number other T F
30
© 2000 Morgan Kaufman Overheads for Computers as Components Panel-active behavior panel*:read-train() current-train = train-knob update-screen changed = true T panel*:read-speed() current-speed = throttle changed = true T F... F current-train != train-knob changed = false
31
© 2000 Morgan Kaufman Overheads for Computers as Components Controller class controller current-train: integer current-speed[ntrains]: integer current-direction[ntrains]: boolean current-inertia[ntrains]: unsigned-integer operate() issue-command()
32
© 2000 Morgan Kaufman Overheads for Computers as Components Setting the speed zDon’t want to change speed instantaneously. zController should change speed gradually by sending several commands.
33
© 2000 Morgan Kaufman Overheads for Computers as Components Sequence diagram for set-speed command :receiver:controller:motor-interface:pulser* new-cmd cmd-type rcv-speed set-speed set-pulse operateread-cmd
34
© 2000 Morgan Kaufman Overheads for Computers as Components Controller operate behavior issue-command() receive-command() wait for a command from receiver idle set-speed
35
© 2000 Morgan Kaufman Overheads for Computers as Components Refined command classes command type: 3-bits address: 3-bits parity: 1-bit set-inertia type=001 value: 3-bits set-speed type=010 value: 7-bits estop type=000
36
© 2000 Morgan Kaufman Overheads for Computers as Components Summary zSeparate specification and programming. ySmall mistakes are easier to fix in the spec. yBig mistakes in programming cost a lot of time. zcan’t completely separate specification and architecture. yMake a few basic assumptions.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.