Presentation is loading. Please wait.

Presentation is loading. Please wait.

Embedded Computer Systems Chapter1: Embedded Computing Eng. Husam Y. Alzaq Islamic University of Gaza 1 © 2010 Husam Alzaq Computers as Components.

Similar presentations


Presentation on theme: "Embedded Computer Systems Chapter1: Embedded Computing Eng. Husam Y. Alzaq Islamic University of Gaza 1 © 2010 Husam Alzaq Computers as Components."— Presentation transcript:

1

2 Embedded Computer Systems Chapter1: Embedded Computing Eng. Husam Y. Alzaq Islamic University of Gaza 1 © 2010 Husam Alzaq Computers as Components

3 Introduction zExample: model train controller. 2 © 2010 Husam Alzaq Computers as Components

4 Purposes of example zFollow a design through several levels of abstraction. zGain experience with UML. 3 © 2010 Husam Alzaq Computers as Components

5 Model train setup console power supply rcvrmotor ECCaddressheadercommand 4 © 2010 Husam Alzaq Computers as Components Message

6 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. 5 © 2010 Husam Alzaq Computers as Components

7 Requirements form 6 © 2010 Husam Alzaq Computers as Components

8 Digital Command Control zDCC created by model railroad hobbyists, picked up by industry. zDefines way in which model trains, controllers communicate. yLeaves many system design aspects open, allowing competition. zThis is a simple example of a big trend: yCell phones, digital TV rely on standards. 7 © 2010 Husam Alzaq Computers as Components

9 DCC documents zStandard S-9.1, DCC Electrical Standard. yDefines how bits are encoded on the rails. zStandard S-9.2, DCC Communication Standard. yDefines packet format and semantics. 8 © 2010 Husam Alzaq Computers as Components

10 DCC electrical standard zVoltage moves around the power supply voltage; adds no DC component.  1 is 58  s, 0 is at least 100  s. time logic 1logic 0 58  s>= 100  s 9 © 2010 Husam Alzaq Computers as Components

11 DCC communication standard zBasic packet format: PSA(sD)+E. zP: preamble = 1111111111. zS: packet start bit = 0. zA: address data byte. zs: data byte start bit. zD: data byte (data payload). zE: packet end bit = 1. 10 © 2010 Husam Alzaq Computers as Components

12 DCC packet types zBaseline packet: minimum packet that must be accepted by all DCC implementations. yAddress data byte gives receiver address. yInstruction data byte gives basic instruction. yError correction data byte gives ECC. 11 © 2010 Husam Alzaq Computers as Components

13 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. 12 © 2010 Husam Alzaq Computers as Components

14 Basic system commands 13 © 2010 Husam Alzaq Computers as Components

15 Typical control sequence :console:train_rcvr set-inertia set-speed estop 14 © 2010 Husam Alzaq Computers as Components

16 Message classes command set-inertia value: unsigned- integer set-speed value: integer estop 15 © 2010 Husam Alzaq Computers as Components

17 Roles of message classes zImplemented message classes derived from message class. yAttributes and operations will be filled in for detailed specification. zImplemented message classes specify message type by their class. yMay have to add type as parameter to data structure in implementation. 16 © 2010 Husam Alzaq Computers as Components

18 Subsystem collaboration diagram Shows relationship between console and receiver (ignores role of track): :console:receiver 1..n: command 17 © 2010 Husam Alzaq Computers as Components

19 System structure modeling zSome classes define non-computer components. yDenote by *name. zChoose important systems at this point to show basic relationships. 18 © 2010 Husam Alzaq Computers as Components

20 Major subsystem roles zConsole: yread state of front panel; yformat messages; ytransmit messages. zTrain: yreceive message; yinterpret message; ycontrol the train. 19 © 2010 Husam Alzaq Computers as Components

21 Console system classes console panelformattertransmitter receiver*sender* 1 1 1 1 1 1 1 1 1 1 20 © 2010 Husam Alzaq Computers as Components

22 Console class roles zpanel: describes analog knobs and interface hardware. zformatter: turns knob settings into bit streams. ztransmitter: sends data on track. 21 © 2010 Husam Alzaq Computers as Components

23 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 22 © 2010 Husam Alzaq Computers as Components

24 Train class roles zreceiver: digitizes signal from track. zcontroller: interprets received commands and makes control decisions. zmotor interface: generates signals required by motor. 23 © 2010 Husam Alzaq Computers as Components

25 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. 24 © 2010 Husam Alzaq Computers as Components

26 Train speed control zMotor controlled by pulse width modulation: V + - duty cycle 25 © 2010 Husam Alzaq Computers as Components

27 Console physical object classes knobs* train-knob: integer speed-knob: integer inertia-knob: unsigned- integer emergency-stop: boolean pulser* pulse-width: unsigned- integer direction: boolean sender* send-bit() detector* read-bit() : integer 26 © 2010 Husam Alzaq Computers as Components

28 Panel and motor interface classes panel train-number() : integer speed() : integer inertia() : integer estop() : boolean new-settings() motor-interface speed: integer 27 © 2010 Husam Alzaq Computers as Components

29 Class descriptions zpanel class defines the controls. ynew-settings() behavior reads the controls. zmotor-interface class defines the motor speed held as state. 28 © 2010 Husam Alzaq Computers as Components

30 Transmitter and receiver classes transmitter send-speed(adrs: integer, speed: integer) send-inertia(adrs: integer, val: integer) set-estop(adrs: integer) receiver current: command new: boolean read-cmd() new-cmd() : boolean rcv-type(msg-type: command) rcv-speed(val: integer) rcv-inertia(val:integer) 29 © 2010 Husam Alzaq Computers as Components

31 Class descriptions ztransmitter class has one behavior for each type of message sent. zreceiver function provides methods to: ydetect a new message; ydetermine its type; yread its parameters (estop has no parameters). 30 © 2010 Husam Alzaq Computers as Components

32 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() 31 © 2010 Husam Alzaq Computers as Components

33 Formatter class description zFormatter class holds state for each train, setting for current train. zThe operate() operation performs the basic formatting task. 32 © 2010 Husam Alzaq Computers as Components

34 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 train’s speed, etc. zControlling throttle/inertia/estop: yread panel, check for changes, perform command. 33 © 2010 Husam Alzaq Computers as Components

35 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 number set-knobs new-settings 34 © 2010 Husam Alzaq Computers as Components

36 Formatter operate behavior idle update-panel() send-command() panel-active()new train number other 35 © 2010 Husam Alzaq Computers as Components

37 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 36 © 2010 Husam Alzaq Computers as Components

38 Controller class controller current-train: integer current-speed[ntrains]: integer current-direction[ntrains]: boolean current-inertia[ntrains]: unsigned-integer operate() issue-command() 37 © 2010 Husam Alzaq Computers as Components

39 Setting the speed zDon’t want to change speed instantaneously. zController should change speed gradually by sending several commands. 38 © 2010 Husam Alzaq Computers as Components

40 Sequence diagram for set- speed command :receiver:controller:motor-interface:pulser* new-cmd cmd-type rcv-speed set-speed set-pulse 39 © 2010 Husam Alzaq Computers as Components

41 Controller operate behavior issue-command() receive-command() wait for a command from receiver 40 © 2010 Husam Alzaq Computers as Components

42 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 41 © 2010 Husam Alzaq Computers as Components

43 Summary zSeparate specification and programming. ySmall mistakes are easier to fix in the spec. yBig mistakes in programming cost a lot of time. zYou can’t completely separate specification and architecture. yMake a few tasteful assumptions. 42 © 2010 Husam Alzaq Computers as Components


Download ppt "Embedded Computer Systems Chapter1: Embedded Computing Eng. Husam Y. Alzaq Islamic University of Gaza 1 © 2010 Husam Alzaq Computers as Components."

Similar presentations


Ads by Google