510 likes | 678 Views
Case Studies. Comet case studies. Elevator control system. From task structuring to target system configuration. Task structuring. Centralized solution. Determine tasks for each subsystem Define task interfaces Design of data abstraction classes. Task structuring. Centralized solution.
E N D
Case Studies Comet case studies Elevator control system From task structuring to target system configuration.
Task structuring Centralized solution • Determine tasks for each subsystem • Define task interfaces • Design of data abstraction classes
Task structuring Centralized solution Assumptions • Elevator Control System is mapped to a single CPU or to a multiprocessor configuration with shared memory • Elevator Status&Plan object is accessible to all elevators and to the scheduler • We can use a centralized repository of data
Task structuring Centralized solution Procedure • Analize all the objects on the collaboration diagrams • Apply the task structuring criteria
Task structuring Elevator subsystem Elevator button Interface • Asynchronous input device interface criterion -> Separate task • Task inversion criteria -> One task handles all the elevator buttons
Task structuring Elevator subsystem Elevator Manager • Structured as a Coordinator Object
Task structuring Elevator subsystem Elevator Status&Plan • Passive data abstraction object -> doesn’t need a separate thread of control
Task structuring Elevator subsystem Elevator Control «external output device» :FloorLamp «coordinator» :Scheduler D6a.1: Direction Lamp Output D10a: Departed (Floor#) D6a: Off Up Direction Lamp «output device interface»:DirectionLampInterface «state dependent control»:ElevatorControl D6: Up «output device interface» :MotorInterface D9: Elevator Started D10: Departed (Floor#) D7: Start Up Motor Command D8: Motor Response «external output device» :Motor «entity» :ElevatorStatus&Plan
Task structuring Elevator subsystem Elevator Control Each Elevator Control object is mapped to a separate Elevator Controller task It interacts with several output device interface objects such as: • Motor Interface • Door Interface • Elevator Lamps Interface Do we need separate tasks?
Task structuring Elevator subsystem Output devices • Passive devices • Output request executed on demand • The calling task has to wait for the output request to complete • Elevator Controller doesn’t execute concurrently with Motor Interface and Door interface By the Control Clustering Criteria we combine these tasks with the Elevator Controller task
Task structuring Elevator subsystem Elevator Controller doesn’t execute concurrently with Motor Interface and Door interface Elevator Moving Approaching Floor/Check This Floor Entry/Departed Approaching Requested Floor/Stop ,On Direction Lamp Elevator Stopping Elevator Stopped/Open Door, Off Elevator Lamp, Arrived Elevator Door Opening Door opened/Start Timer Elevator at Floor
Task structuring Elevator subsystem Summary For the Elevator Control subsystem we have four tasks • Elevator Buttons Interface • Arrival Sensors Interface • Elevator Manager • Elevator Controller
Task structuring Elevator subsystem
Task structuring Floor subsystem We start from the floor subsystem structure. «data collection subsystem» :FloorSubsystem Floor Button Request Service Request «subsystem» : Scheduler «input device interface» :FloorButtonInterface «external input device» : FloorButton Floor Lamp Command Floor Lamp Output «output device interface» :FloorLampInterface «external output device» : FloorLamp «subsytem» :ElevatorSubsystem Direction Lamp Output Direction Lamp Command «external output device» : DirectionLamp «output device interface» :DirectionLampInterface
Task structuring Floor subsystem We determine the Floor Button Interface task We consider Floor Lamp Interface and Direction Lamp Interface • Are passive output devices • Receive concurrent requests from the Elevator Controller instances We use monitors tasks to serialize the requests
Task structuring Centralized solution
Task structuring Centralized solution
Task structuring Define Task interfaces • Consider message interfaces between concurrent tasks • Map them to loosely or tightly coupled messages • Add name and parameters of each message
Task structuring Define Task interfaces For instance: Elevator Request <<asynchronous input device interface>> :Elevator Buttons Interface <<coordinator>> :Elevator Manager Elevator Request(Elevator#,floor#,direction) <<asynchronous input device interface>> :Elevator Buttons Interface <<coordinator>> :Elevator Manager
Task structuring Define Task interfaces
Task structuring Define Task interfaces
<<data abstraction>> Elevator Status&Plan + arrived(elevator#,floor#,direction) + departed(elevator#,floor#,direction) + checkThisFloor(in elevator#,in floor#,out floor status, out direction) + checkNextDestination(in elevator,#out direction) + updatePlan(elevator#,floor#, direction ,out idlestatus) + selectElevator(in floor#, out elevator#,in direction) Task structuring Design of Data Abstraction Class
Distributed Solution • -Subsystem Structuring • Design of Device Interface classes • Design of information hiding classes • Design of Device Interface classes • Design of State-Dependent classes • Detailed software design • Design of Connector objects • Design of Composite Tasks • Target system configuration
General description Distributed solution Physical configuration: • Multiple nodes interconnected by a LAN • No shared memory • All communication is via loosely coupled messages
Task structuring Distributed Solution
General description Distributed solution An emerging issue • Now the Scheduler and the multiple instances of the ElevatorManager cannot directly access Elevator Status&Plan data object We may: • Embed ElevatorStatus&Plan in a server object • Use replicated data
General description Distributed solution Server solution • Clients access the ElevatorStatus&Plan with a synchronous message with reply Risk of Bottleneck!
General description Distributed solution Data replication solution • Each instance of the Elevator Subsystem maintains a Local ElevatorStatus&Plan • The Scheduler Subsystem maintains an Overall Status&Plan Faster data access
Subsystem Structuring Distributed solution Structure of Elevator Subsystem • Similar to the centralized solution -Each Elevator subsystem contains a Local Elevator Status&Plan object
Task structuring Distributed solution
Task structuring Distributed solution
Subsystem Structuring Distributed solution Structure of Scheduler Subsystem • Elevator Status&Plan Server Task • Receives Status and commitment messages • Updates Overall Elevator Status&Plan -Elevator scheduler • Receives Service Requests messages
Subsystem Structuring Distributed solution
Design of information hiding classes We design the operations of • Device Interface classes • Data abstraction class(distributed) • State Dependent class
<<Output Device interface>> Floor Lamp Interface <<Output Device interface>> Arrival Sensor Interface + initialize() +off() + initialize() + read(out sensorInput) Design of information hiding classes Design of device interface classes
<<Output Device interface>> Motor Interface <<Output Device interface>> Door Interface + initialize() + stop(out stopped) + up(out started) + down(out started) + initialize() + open(out opened) + close(out closed) Design of information hiding classes Design of device interface classes
Design of information hiding classes Design of Data Abstraction Class <<data abstraction>> LocalElevator Status&Plan + arrived(elevator#,floor#,direction) + departed(elevator#,floor#,direction) + checkThisFloor(in elevator#,in floor#,out floor status, out direction) + checkNextDestination(in elevator,#out direction) + updatePlan(elevator#,floor#, direction ,out idlestatus)
Design of information hiding classes Design of Data Abstraction Class <<data abstraction>> OverallElevator Status&Plan + arrived(elevator#,floor#,direction) + departed(elevator#,floor#,direction) + updatePlan(elevator#,floor#, direction ,out idlestatus) + selectElevator(in floor#, out elevator#,in direction)
<<state dependent control>> Elevator Control + processEvent(in event,out action) + currentStatus():Status Design of information hiding classes Design of State Dependent Class
Detailed Software Design Two main phases: • Design of the connector objects • Design of the composite tasks
Detailed Software Design Design of connector objects We introduce connectors to hide the details of message communication. The sender tasks should be unaware of the location of the receiver tasks Location transparency
Detailed Software Design Design of connector objects Elevator subsystem
Detailed Software Design Design of connector objects Elevator subsystem Messages from Arrival Sensor Interface and Elevator Manager to Elevator controller never overlap-> We can use one message buffer instead of two We introduce three message queue connectors to hide the details of asynchronous(and possibly remote) communication
Detailed Software Design Design of connector objects
Detailed Software Design Design of composite tasks Elevator Controller Task embeds • Three output device interfaces • One state dependent control object • Two objects that provide synchronization
Detailed Software Design Design of composite tasks • Resource monitor tasks embed the passive I/O interfaces for the devices they operate • Each device interface object for an asynchronous I/O device is placed inside the task supporting that device
Detailed Software Design Design of composite tasks
System Configuration Distributed solution Target system configuration • Instances of the component types are defined • Component instances are interconnected • Component instances are mapped to physical nodes
System Configuration Distributed solution A possible physical configuration • One Elevator Subsystem for each elevator node • One Floor Subsystem for each floor node
System Configuration Distributed solution