CS 4272 HardwareSoftware Codesign Assignment 1 Guo Liang

  • Slides: 21
Download presentation
CS 4272 Hardware-Software Co-design Assignment 1 Guo Liang School of Computing National University of

CS 4272 Hardware-Software Co-design Assignment 1 Guo Liang School of Computing National University of Singapore

Assignment 1 l Use Rhapsody to model a shuttle system – – l Due

Assignment 1 l Use Rhapsody to model a shuttle system – – l Due by: 20 Sep 2007 Individual work The helping hand – – IVLE discuss forum Lab session: (COM 1 -01 -14) l l – Tuesday 1400 -1800 Wednesday 1500 -1800 guol@comp. nus. edu. sg

Rhapsody l “visual design environment to create requirements and model embedded software” – l

Rhapsody l “visual design environment to create requirements and model embedded software” – l Analysis, design, implementation, and testing Allows – – – Create UML model - class diagrams, object diagrams and statecharts Generate executable code for the model (Java, C, or C++) Animate, execute and test the UML model

Rhapsody l Basic usage – – – Create classes / objects Create Statechart for

Rhapsody l Basic usage – – – Create classes / objects Create Statechart for classes Set up model configuration Generate code Compile and run / animate

Rhapsody l l Available at COM 1 -01 -14 Embedded Systems Teaching Lab 1

Rhapsody l l Available at COM 1 -01 -14 Embedded Systems Teaching Lab 1 Tutorials – l Help List of Books Rhapsody in J tutorial Demo

Reminder - Procedure l l l Create classes, attributes, methods, and their associations and

Reminder - Procedure l l l Create classes, attributes, methods, and their associations and multiplicities Create statecharts for classes Create objects, their initializations and their links Edit “Default. Config” Run and debug

Reminder - Add Object Diagram

Reminder - Add Object Diagram

Reminder - Create Object l l Object name <instance name>: <class name> Initialization

Reminder - Create Object l l Object name <instance name>: <class name> Initialization

Create Event Argument

Create Event Argument

Create Sequence Diagram l l Role name All objects to be shown

Create Sequence Diagram l l Role name All objects to be shown

Shuttle System l A railway system – l Order-based system – – – l

Shuttle System l A railway system – l Order-based system – – – l Shuttles running on it to transport passengers Passenger places an order Shuttles bid for the order Successful shuttle move passengers from start station to destination. A management system (MS) controls orders.

Shuttle System l 4 stations connected in a ring 1 2 0 3

Shuttle System l 4 stations connected in a ring 1 2 0 3

Protocol – Order Assignment ENV Management System Shuttle 1 Shuttle 2 order offer assign

Protocol – Order Assignment ENV Management System Shuttle 1 Shuttle 2 order offer assign offer

Protocol – Shuttle Movement Shuttle ENV Track depart check arrive not free If track

Protocol – Shuttle Movement Shuttle ENV Track depart check arrive not free If track is occupied by another shuttle free If no shuttle on the track occupy release

Order Assignment shuttles s 1 neworder Env neworder Management System neworder Shuttle: • Capacity

Order Assignment shuttles s 1 neworder Env neworder Management System neworder Shuttle: • Capacity • Unit fare • Initial station s 2 s 3 Order: • Start station • Destination • # of passengers

Order Assignment (Cont. ) shuttles s 1 When to Offer: • No assignment; •

Order Assignment (Cont. ) shuttles s 1 When to Offer: • No assignment; • Order size <= capacity offer(10) Management System offer(20) refuse s 2 s 3 May use the same event “offer” for both cases, e. g refuse = offer(9999)

Order Assignment (Cont. ) shuttles s 1 assign Management System s 2 MS assigns

Order Assignment (Cont. ) shuttles s 1 assign Management System s 2 MS assigns order to shuttle s 1, since it made the lowest offer of 10 dollars. No event sent to s 2 and s 3

Process Order After s 1 (at station 1) got assignment (1 2, 5 passengers):

Process Order After s 1 (at station 1) got assignment (1 2, 5 passengers): 1. It loads since it is already at start station 1. @station 1 s 1 load

Process Order (Cont. ) 2. It checks the availability of track, then move onto

Process Order (Cont. ) 2. It checks the availability of track, then move onto track if available. @station 1 Track Request to move s 1 depart Env @track 1 Track occupied s 1 Track free s 1 Move to track

Process Order (Cont. ) 3. It arrives destination, then unloads. @track 1 Track release

Process Order (Cont. ) 3. It arrives destination, then unloads. @track 1 Track release s 1 arrive @station 2 s 1 unload Env