Explanation of UML with Model Train Controller as an example
Size: 619.27 KB
Language: en
Added: Oct 05, 2021
Slides: 28 pages
Slide Content
RMK COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING EC8791 EMBEDDED AND REAL TIME SYSTEMS S. Rajalakshmi AP/ECE
UML (Unified Modeling Language) Visual language used to capture the design tasks. E ncourages design by successive rather than re-thinking the design at each new level of abstraction . UML is an object-oriented modeling language . Used to model the outside world that interacts with the system (Objects- People/Machines) Structural Description Specify the overall structure of the design (ii) Behavioral Description Used to specify the behavior of the system. One way to specify the behavior of an operation is a state machine.
The UML description of the Display class - An object describing a display (such as a CRT screen)
UML DIAGRAM
Edraw Max Moqups Microsoft Visio Concept Draw Star UML Umbrello UML Designer Tool Altova UML tools
3. DESIGN EXAMPLE: MODEL TRAIN CONTROLLER
Model train setup
Model train controller – WORKING PRINCIPLE 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.
R e q u i r e m en t s Console controls up to 8 trains on 1 track. Throttle has at least 63 levels. Inertia control adjusts responsiveness with at least 8 levels. Emergency stop button. Error detection scheme on messages. Ignore erroneous messages
Requirements form name p u rpos e inputs outputs f unct io ns perform a n ce model train controller control speed of <= 8 model trains throttle, inertia, emergency stop, train # train control signals set engine speed w. inertia; emergency stop can update train speed at least 10 t imes/sec manufacturing cost $50 power physical si z e/ w e i g h t wall powered console comfortable for 2 hands; < 2 lbs.
Requirements form name pu rpose inputs outputs fun c tions performance model train controller control speed of <= 8 model trains throttle, inertia, emergency stop, train # train control signals set engine speed w. inertia; emergency stop can update train speed at least 10 times/sec manufacturing cost $50 power physical size/we i ght wall powered console comfortable for 2 hands; < 2 lbs. 8
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 s, 0 is at least 100 s. t i me logic 1 logic 58 s >= 100 s 10
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 10 Error correction data byte gives ECC. 11
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. 12
F unctions Console : read state of front panel; format messages; T ransmit messages. Train : receive message; interpret m essage ; control the train.
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: c omma n d) 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.
Sequence Diagram for transmitting a control input.
Sequence diagram for set-speed command received by the train