EC8791
EMBEDDED AND REAL
TIME SYSTEMS
Mr.C.KARTHIKEYAN
AP/ECE/RMKCET
Design example: Model train controller
Learning of UML through Model Train Controller
THE EMBEDDED SYSTEM DESIGN PROCESS Contd..
Model train setup
console
power
supply
rcvr motor
header Command ECCaddress
Model train controller – WORKING PRINCIPLE
For design, we start with requirement first
The user sends messages to the train with a control box attached to the tracks.
The control box consists of a console, throttle, emergency stop button, and so on.
Since the train receives its electrical power from the two rails of the track, the control box
can send signals to the train over the tracks by modulating the power supply voltage.
The control panel sends packets over the tracks to the receiver on the train.
This is a one-way communication system—the model train cannot send commands back to
the user.
Requirements
• Console can control 8 trains on 1 track.
• Throttle –controls the speed
• Inertia control- to adjust the speed
• Emergency stop button.
• Error detection scheme on messages.
7
Sample requirements form.
THE EMBEDDED SYSTEM DESIGN PROCESS Contd..
Requirements form
name model train controller
purpose control speed of <= 8 model trains
inputs throttle, inertia, emergency stop,
train #
outputs train control signals
functions set engine speed w. inertia;
emergency stop
performance can update train speed at least 10
times/sec
manufacturing cost $50
power wall powered
physical
size/weight
console comfortable for 2 hands; < 2
lbs.
9
The DCC standard is given in two documents:
■ Standard S-9.1, the DCC Electrical Standard, defines how
bits are encoded on the rails for transmission.
■ Standard S-9.2, the DCC Communication Standard,
defines the packets that carry information.
.
DCC electrical standard
1 is 58 ms, 0 is at least 100
ms.
time
logic 1 logic 0
58 ms >= 100 ms
11
DCC packet types
• Baseline packet: minimum packet that must
be accepted by all DCC implementations.
– Address data byte gives receiver address.
– Instruction data byte gives basic instruction.
– 0110 1 0 10
– Error correction data byte gives ECC.
12
DCC communication standard
• Basic packet format: PSA(sD)+E.
• P: preamble = 1111111111.
• S: packet start bit = 0.
• A: address data byte.
• s: data byte start bit.
• D: data byte (info in CU bit format )
• E: packet end bit = 1.
13
2.(i)Conceptual specification
14
functions
Console:
read state of front panel;
format messages;
transmit messages.
Train:
receive message;
interpret message;
control the train.
Console system classes
console
panel formatter transmitter
receiver* sender*
1
1
1
11
1
1
1
1
1
16
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
17
Train speed control
• Motor controlled by pulse width modulation:
V
+
-
18
2.(ii)Console physical object classes
knobs*
train-knob: integer
speed-knob: integer
inertia-knob: unsigned-
integer
emergency-stop: boolean
Set-knobs()
pulser*
pulse-width: unsigned-
integer
direction: boolean
sender*
send-bit()
detector*
read-bit() : integer
Panel and motor interface classes
panel
train-number() : integer
speed() : integer
inertia() : integer
estop() : boolean
new-settings()
motor-interface
speed: integer
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)
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()
Formatter class holds state for
each train, setting for current
train.
The operate() operation
performs the basic formatting
task.
• MODEL TRAIN
• MECHANISM
• ES DESIGN PROCESS
• REQ, REQ CHART
• DCC
• SPEC
• DETAILED,CONCEPTUAL
Summary

Unit 1a train

  • 1.
    EC8791 EMBEDDED AND REAL TIMESYSTEMS Mr.C.KARTHIKEYAN AP/ECE/RMKCET
  • 2.
    Design example: Modeltrain controller Learning of UML through Model Train Controller
  • 3.
    THE EMBEDDED SYSTEMDESIGN PROCESS Contd..
  • 4.
    Model train setup console power supply rcvrmotor header Command ECCaddress
  • 6.
    Model train controller– WORKING PRINCIPLE For design, we start with requirement first The user sends messages to the train with a control box attached to the tracks. The control box consists of a console, throttle, emergency stop button, and so on. Since the train receives its electrical power from the two rails of the track, the control box can send signals to the train over the tracks by modulating the power supply voltage. The control panel sends packets over the tracks to the receiver on the train. This is a one-way communication system—the model train cannot send commands back to the user.
  • 7.
    Requirements • Console cancontrol 8 trains on 1 track. • Throttle –controls the speed • Inertia control- to adjust the speed • Emergency stop button. • Error detection scheme on messages. 7
  • 8.
    Sample requirements form. THEEMBEDDED SYSTEM DESIGN PROCESS Contd..
  • 9.
    Requirements form name modeltrain controller purpose control speed of <= 8 model trains inputs throttle, inertia, emergency stop, train # outputs train control signals functions set engine speed w. inertia; emergency stop performance can update train speed at least 10 times/sec manufacturing cost $50 power wall powered physical size/weight console comfortable for 2 hands; < 2 lbs. 9
  • 10.
    The DCC standardis given in two documents: ■ Standard S-9.1, the DCC Electrical Standard, defines how bits are encoded on the rails for transmission. ■ Standard S-9.2, the DCC Communication Standard, defines the packets that carry information. .
  • 11.
    DCC electrical standard 1is 58 ms, 0 is at least 100 ms. time logic 1 logic 0 58 ms >= 100 ms 11
  • 12.
    DCC packet types •Baseline packet: minimum packet that must be accepted by all DCC implementations. – Address data byte gives receiver address. – Instruction data byte gives basic instruction. – 0110 1 0 10 – Error correction data byte gives ECC. 12
  • 13.
    DCC communication standard •Basic packet format: PSA(sD)+E. • P: preamble = 1111111111. • S: packet start bit = 0. • A: address data byte. • s: data byte start bit. • D: data byte (info in CU bit format ) • E: packet end bit = 1. 13
  • 14.
  • 15.
    functions Console: read state offront panel; format messages; transmit messages. Train: receive message; interpret message; control the train.
  • 16.
    Console system classes console panelformatter transmitter receiver* sender* 1 1 1 11 1 1 1 1 1 16
  • 17.
    Train system classes trainset train receiver controller motor interface detector* pulser* 1 1..t 1 1 1 1 1 1 1 1 1 1 17
  • 18.
    Train speed control •Motor controlled by pulse width modulation: V + - 18
  • 19.
    2.(ii)Console physical objectclasses knobs* train-knob: integer speed-knob: integer inertia-knob: unsigned- integer emergency-stop: boolean Set-knobs() pulser* pulse-width: unsigned- integer direction: boolean sender* send-bit() detector* read-bit() : integer
  • 20.
    Panel and motorinterface classes panel train-number() : integer speed() : integer inertia() : integer estop() : boolean new-settings() motor-interface speed: integer
  • 21.
    Transmitter and receiverclasses 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)
  • 22.
    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() Formatter class holds state for each train, setting for current train. The operate() operation performs the basic formatting task.
  • 23.
    • MODEL TRAIN •MECHANISM • ES DESIGN PROCESS • REQ, REQ CHART • DCC • SPEC • DETAILED,CONCEPTUAL Summary