Week 4: Introduction To Rhapsody (1)

Submitted By helloworldsydney
Words: 1454
Pages: 6

ELEC5620: Lab Activity
Lab 4 (week 5): Introduction to Rhapsody (1)
IBM Rational Rhapsody family provides a collaborative design, development and test environment for systems engineers and software engineers.
● Rapid prototyping and execution to address errors earlier when they are least costly to fix. ● Automatic consistency checking to enhance agility and improve reuse with collaboration to reduce both recurring and non- with collaboration to reduce both recurring and nonrecurring costs.
● Share, collaborate, and review your engineering lifecycle artifacts created with Rational
Rhapsody or other design tools, such as Mathworks Simulink, with the extended engineering team.
The first lab on Rhapsody RT will familiarise you with the Rhapsody RT system by doing 3 exercises. You will then be required to implement a small system and demonstrate it to the tutor. Lab task outline
Task 1: Implement the small “Hello World” example.
Task 2: Modify the example’s state diagram so that it generates timed messages.
Task 3: Use the techniques used in Task 1 and Task 2, create a state diagram for the bidding system. Content
Task 1: Implement the small “Hello World” example.
1. Create a project: Start Rational Rhapsody. Within Rational Rhapsody, select File > New or New Project to create a new project called HelloWorld. Click OK then Yes to save the project. 2. The browser on the left shows you everything that is in the model. Note that Rhapsody creates an Object Model Diagram (OMD), which is a diagram that shows a complete or partial view of the structure of a modeled system at a specific time.
3. Drawing a class: click on the OMD in the browser, then click the Class icon in the drawing toolbar on the right, then click in the diagram window to draw a class. Name it
Display just by typing the word into the class. If the drawing toolbar is not shown, click
View | Toolbars | Drawing.

If you wish, you can delete a class. There are 2 ways of deleting a class. Right click on the class, then: If you use the delete key or select Remove from View, then the class
Display is just removed from this diagram, but remains in the browser. If you select
Delete from Model, then you must confirm with Yes in order to remove the class from the entire model.
4. To create a runnable object, you must add a constructor. Right-click on the class and choose Add New > Constructor. You do not need any constructor arguments, so just click OK. The constructor appears immediately in the Display class in the OMD.
5. Right-click Display class and select Display Options. Set the options to display All attributes and All operations.
You can see the constructor in both the browser and the OMD. Click in the browser on
Package | Default | Classes | Display | Operations.
6. We will now add an implementation. Select the Display constructor in the browser and double-click to open the features window. Select the Implementation tab and enter the following: cout<< “Hello, World!” << endl; #include <iostream>
Since you have used cout, you must include the iostream header in the Display class. In the browser, select the Display class and double-click to bring up the features.
Select the Properties tab and ensure that the Common View is selected, and enter
<iostream> into the “ImpIncludes” property.
7. In order to generate code, you must first create a component. Expand the Components in the browser, then Configurations and DefaultConfig. Double click on DefaultConfig, select the Initialisation tab, expand the Default package, and select the Display class.
The main program will now create an initial instance of the Display class.
8. You are now ready to generate and run your code. Save the model. Select
Generate/Make/Run. Click Yes. The message “Hello, World!” will be displayed.
If there are errors during the compilation, double-click the relevant line to find out where the error occurred.
Before continuing, make sure you stop the executable by one of the following