Hello World
PRESENTATION
Embark on your MBSE journey by learning to model and visualize your first system with Papyrus, laying the groundwork for your exploration into complex systems engineering, where your first model and visualization await to bring theory to vivid life.
Prerequisites
Ensure your workstation is set up with Designer, Launcher, and Cygwin installed to fully engage with the modeling and visualization process.
Skills that you will acquire
On Designer:
- Create a Model, a Project and a Service,
- Add a Life Phase to a Service,
- Create a Use Case and a User Story in this former,
- Complete a User Story with flow and interfaces, internal activities,
- Generate State Machine from User Stories and an associated C++ Code, as an executable,
- Export a XML contening Types and Flows created in your model.
On Virtual Bench:
- Login on Virtual Bench,
- Import Types and Flows,
- Create a Project and add Environments in it (HMI, Scene2D and Timeline),
- Add a New Scenario,
- Use Environment elements (Timeline action, Test Criteria, Text),
- Add Model Instance,
- Add behaviours between the bench and your model,
- Run your scenario.
Duration
1h
MODELISATION ON DESIGNER
Create a Model
- Papyrus
- Rhapsody
Start your model by establishing a new Designer project, selecting the CIL4SysLanguage for systems engineering.
- Click on File > New > Papyrus Project
- Select CIL4SysLanguage checkbox
- Click on Next
- Type the name of the Papyrus Project: HelloWorld, in the project name field
Please ensure that there are no spaces in your model name.
- Click on Next
- Select CIL4Sys Full Project Template in the field: “You can load a template”
- Click on Finish
- Click on File > New
- Type the name of the project: HelloWorld
- Click on OK
- Rhapsody will ask you if you want to create a new folder for the project, Click on Yes

Create a Project
- Papyrus
- Rhapsody
Define your system's scope by creating a new project within Papyrus, preparing yourself for detailed modeling.
- Select HelloWorld in CIL4Sys Overview. You can use the Refresh View button when selecting the Overview tab.
- Click on New Project
Sometimes, the button does not appear because of the size of the window. You can either resize the Overview tab horizontally or use a bigger screen.
- Type the name of the project: MyProject
Please ensure that there are no spaces in your model name.
- Click on OK
- Click on Ok in the confirmation dialog box
- Click on File > Add To Model
- Choose the file called Sim4Sys_DesignerForRhapsody_Profile.sbsx
- Click on Open
- Click on File > Add To Model
- Choose the file called Sim4SysLibraries.sbsx
- Click on Open
- Right Click on the Project
- Click on Sim4Sys Designer > Perspectives > Create Sim4Sys perspective
- Click on the Sim4Sys Perspective on the Toolbar
Even if the perspective is selected click on it again, sometime Rhapsody doesn't use the perspective even if it is selected.
Create a Service MySpec
- Papyrus
- Rhapsody
Action: Add a service named "MySpec" to the model.
Explanation: We are adding the 'MySpec' service to represent a key functionality of our system, such as user management. This service is crucial because it defines how users interact with our system, directly influencing the user experience and the system's security.
- Double Click on the MyProject Structure diagram. This will open the product composite structure diagram (CSD).
- You can resize the composite structure diagram by dragging the corners.
- Composite Structure Diagrams allow the users to "Peek Inside" a product to see exactly what it is composed of.
- Drag&Drop a New Service in the product CSD (the large box with the name of the product)
- Select Create
- Type the name of the service: MySpec
- Click on OK

- Right Click on the Project
- Click on Sim4Sys Designer > Template > Operational Project
- Type the name of the attribute: MySpec
- Click on Create

Add a Life Phase to a Service
- Papyrus
- Rhapsody
Action: *Define a lifecycle phase "Standard Use" for a service. *
Explanation: By specifying a 'Standard Use' lifecycle phase, we clarify the normal conditions under which this service is supposed to operate. This helps us model expected behaviors and prepare the system for robustness testing by visualizing real usage conditions.
By default, we suggest you two different phases: Standard Use and Visualization.
- Select MySpec Package in CIL4Sys Overview (refresh if it does not appear).
- Click on Complete Life Phases
- Drag&Drop a New Life Phase in the diagram pane for relevant phases of the service
- Select Standard Use
- Click on OK

Explanation: There is no need to add a life phase to a service in Rhapsody, It will be done automaticly when completing the User Story.
Create a simple Use Case
- Papyrus
- Rhapsody
Action: Create a use case "say hello".
Explanation: The 'say hello' use case illustrates a simple yet fundamental interaction between the user and the system, where the system greets the user with a message. This use case serves as a starting point for modeling more complex interactions and demonstrates our system's responsiveness to user inputs.
- Select Standard Use
- Click on Complete Use Cases
- Drag&Drop an actor on the diagram
- Select User as the type of your new actor
- Drag&Drop a New UseCase on the diagram
- Type the name of the use case: say hello
- Click on OK
- Double Click on the Use Case Diagram
- Drag&Drop an Use Case on the diagram
- Type the name of the use case: say hello
- Drag&Drop an Actor on the diagram
- Type the name of the Actor: User
- Click on Create

Create a User Story in a Use Case
- Papyrus
- Rhapsody
Action: Develop a user story within the context of a defined use case.
Explication: Crafting a user story within a use case allows you to detail specific user interactions, providing clarity on how features should behave and be experienced by the user.
- Select say hello package in the CIL4Sys Overview
- Click on New User Story
- Type the name of the user story: say hello
- Click on OK
- Double Click on the user story: say hello

- Right Click on the use case in the diagram
- Click Sim4Sys Designer > Add New > Sequence Diagram
- Type the name of the Sequence Diagram: say hello
- Click on Create

Complete the User Story
- Papyrus
- Rhapsody
Action: Enrich your user story with detailed flows, states, and interfaces, and then generate a State Machine from all your user stories.
Explication: Completing the user story by adding detailed elements and generating a State Machine ensures that the dynamic behavior of the system is clearly modeled and executable, facilitating both understanding and implementation.
- Drag&Drop a New State on the MySpec Service lifeline
- Select FirstState
- Click on OK
- Rename the state after creation (in Active). You can do it just after the creation or by the Properties view of Papyrus
- Trace a New Message between the User lifeline and the MySpec Service lifeline
- In the Flow Selection window, click on Create a new flow
- Drag&Drop a New Interface on the diagram
- Type the name of the interface: I_request
- Click on OK
- Drag&Drop a New Flow in the newly created interface
- Type the name
- Click on Add Data
- Type the name of the data: name
- Select the type of the data: TextType
- Click on OK
A good manner is to create an interface per flow.
- Go back on the user story
- Trace a New message between the user and the service
- Select the newly created flow
- Click on OK
- Trace a message between the service lifeline on itself (internal activity)
- Click on Create a new Activity
- Type the name of the activity: create_message
- Click on OK
- Right-click on the service lifeline
- Select Edit > Create Variable
- Type the name of the variable: message_to_say
- Choose the type: TextType
- Set an init value: INIT
- Click on OK
- Right-click on the create_message activity
- Choose Edit > Complete Activity
- Select C++ Code
- Click on Next
- Type the code to create_message:
message_to_say = "Hello from " + request_to_say_hello_name;
- Click on Finish
- Trace a New Message between the service and the user
- Click on Create a New Flow
- Drag&Drop a New Interface on the diagram
- Type the name of the interface: I_feedback
- Drag&Drop a New Flow in the newly created interface
- Type the name: say
- Click on Add Data
- Type the name of the data: message
- Select the type of the data: TextType
- Click on OK
- Go back on the user story
- Trace a new message between the service and the user
- Select the newly created flow
- Click on OK
- Select the data value: message_to_say
- Click on OK
- Select the user story in the CIL4Sys Overview
- Click on Generate State Machine
- Click on Ok in the confirmation dialog box

- Drag&Drop a System Border on the Diagram
- Select itsUser
- Click on Ok
- Drag&Drop a Lifeline on the Diagram
- Select itsMySpec
- Click on Ok
- Drag&Drop a Entrying State Condition Mark on the MySpec lifeline
- Select FirstState
- Click on OK
- Rename the state after creation (in Active). You can do it just after the creation or by the Properties view of Rhapsody
- Trace a New Message between the User lifeline and the MySpec lifeline
- Click on New
- Type the name of the Flow: request_to_say_hello
- Add New Parameter with type Rhpstring and Name name.
- Click on Create
- Click on Connect
If the name is not change after the popup press escape
- Trace a message between the MySpec lifeline on itself (internal activity)
- Click on New
- Type the name of the activity: create_message
- Click on Create
- Right-click on the MySpec lifeline
- Click on Sim4Sys Designer > Add New > Variable
- Type the name of the attribute: message_to_say
- Choose the type: RhpString
- Set an init value: "INIT"
- Click on OK
- Double Click on the create_message operation under MySpec
- Click on Implementation
- Type the code to create_message:
message_to_say = "Hello from " + request_to_say_hello_name;
- Click on OK
- Trace a New Message between the lifeline MySpec and the user
- Click on New
- Type the name of the Flow: say
- Add New Parameter with type RhpString and Name message.
- Click on Create
- Click on Connect
- Select the data value: message_to_say
- Click on OK
- Right Click on the Sequence Diagram
- Click on Sim4Sys Designer > Statecharts > Generate transitions

Generate Code
- Papyrus
- Rhapsody
Action: Convert your detailed state machine into executable C++ code.
Explication: Generating C++ code from your state machine directly translates your model’s dynamics into a programmable format, bridging the gap between design and practical application.
If you have the community version of Designer (free version), please build the executable via Hub4Sys as shown on this page
- Before generating the code, ensure that the CIL4SysLibs are already part of the project.
- If it's not the case, you must add the Libs in File > New > Other... In the new window, select Extra Libraries in the Sim4Sys folder. If you have a Pro access, you can add Sim4Sys Pro - Build Libraries instead:
- Click on the Overview menu, thanks to the following icon:
- Click on [Code] Generate and build in CIL4Sys Overview
- Select MyProject
- Click on OK
- Select Cygwin GCC
- Click on Finish
- Click on OK in the confirmation dialog box
You can also compile with MinGW.
To do that, please follow this process.
- Right Click on the Project
- Click on Sim4Sys Designer > Template > Configure Deployment
- Choose the folder called : Libs
- Click on Open
- Choose the System MySpec to connect it to Virtual Bench.
- Click on OK
- Choose the folder where you want to put the .xml file.
- Click on Open
- Open the Components in the Deployement package.
- Right Click on VBComponent
- Click on Build Component
- Click on Yes

Export a XML
- Papyrus
- Rhapsody
Action: Export the model to an XML file for integration with Virtual Bench.
Explanation: Exporting our model to XML plays a crucial role in preparing for simulation. This allows us to seamlessly transfer the model's structure and data to Virtual Bench, where we can simulate and test the system's behavior in a controlled environment. This step ensures that our design meets expectations before going into production.
To do so, in Overview, Service Tab, select your project and click on Export File XML.

Explanation: There is no need to export the XML file, It was done automaticly when generating the code.
Visualization with Virtual Bench
The final step is to export your model to XML and run it in a visualization. This shows how models can be used outside their native environment and how they move from modeling to visualization.
This section explains how to set up communication between your model and the visualization.
Log in to Virtual Bench
Sign in to the Sim4Sys Virtual Bench platform to prepare your model for visualization.
- Open Sim4Sys Virtual Bench in your browser.
- Sign in with your username and password.
- On the Home page, find your sandbox project and open it:
- Double-click the project card, or
- Click the menu and select Run.

Create one by clicking New Project. In the Project name field, enter e.g. "Sandbox your name" — the URL is generated automatically. Add a short description for the project, and check the option to open the project automatically after creation.

Add Model & Import Types and Flows
Action: Add the model to Virtual Bench and import the types and flows from your model.
Explanation: Adding the model and importing its data into Virtual Bench prepares the visualization environment so you can test and validate the system’s behavior under visualized conditions.
1. Open the Models tab and add a new model
- On the project opening page, open the sidebar and click Resources. A new window opens with a list of resources.
- Select the Models tab, then click the New button.

2. Configure the model (General and Connectivity)
- General tab (): Give the model a name (e.g. HelloWorld).
- Connectivity tab (): Set the path to the model executable file.
To set the path: click the button, navigate to the folder that contains the model executable, then copy the path and select the file. Because of browser security, Virtual Bench cannot obtain the path from the file picker, so paste the path into the text field before the file name.

3. Import types and flows (Database tab)
- Open the Database tab ().
- Import types and flows from your design model into Virtual Bench by either:
- Dragging and dropping your previously generated XML file, or
- Clicking Browse File and selecting the XML file you generated earlier (it is in the
HelloWorld\exportfolder).

The summary lists imported types and flows, plus any updated or deleted flows. Expand the Data comparison section to see the details of the changes.

4. Confirm and verify
- Click Confirm import to save the changes.
- Open the Flows tab () and confirm that the imported flows are listed.

Environment
Action: Add HMI, Scene2D, and Timeline environments in Virtual Bench for visualization.
Explanation: HMI, Scene2D, and Timeline provide visual and temporal frameworks to observe system behavior. Each type offers a different view—user interface (HMI), spatial representation (Scene2D), and event timeline (Timeline)—so you can inspect and understand the system from multiple angles.