Skip to main content

Websocket Configuration

The websocket buttons facilitate the connection between Sim4Sys and executables.

Displayed here are the websockets deployed within the scenario.

Add a new websocket

You can introduce new websockets by pressing the "add executable instance" button:

Add button

Choose the executable to link, and specify both the name and the port number for the websocket:

Create websocket

note

Each websocket requires a distinct port number. The Virtual Bench automatically suggests an available port number by default.

Edit a websocket

You can modify a websocket by clicking on the "Edit" button: Edit websocket button



Alternatively, right-clicking on its websocket button will also allow for editing. This action will open the websocket connection pop-up, where further modifications can be made (refer to the subsequent sections for more details).

Definition of Clock flows

Right-clicking on a websocket button enables you to link the clock flow and the sampling time flow that you previously imported:

Websocket connection

info

The clock flow is dispatched at each iteration of the Virtual Bench, and this flow should not contain any parameters.

The sampling time flow is transmitted at the commencement of the scenario execution. This flow includes only one parameter, either an integer or decimal, which conveys the sampling time value.

Change the address

Right-clicking on a websocket button gives you the option to modify the address. This adjustment enables the executable to run on a different machine than where the Virtual Bench simulation is hosted.

Websocket connection

Clone a websocket

To replicate a websocket within a scenario, press the "Clone" button:

Clone websocket button

This action triggers a summary window detailing the duplication specifics, including the count of scenario elements linked to a mapping instance of this websocket:

Cloning confirmation

Here, you can assign a new name for your duplicated websocket. Confirming the duplication process results in the creation of a cloned websocket that retains the original's flows, types, and mappings. Additionally, all scenario elements within each context are replicated and grouped, facilitating efficient management of, for instance, HMI clusters.

Moreover, the interface offers a feature to search and replace the names of scenario elements set to be duplicated by opting for "Yes" in the combobox and selecting the elements whose names you wish to modify.

Cloning confirmation 2

Delete a websocket

Clicking the "Delete" button with the left mouse button will result in one of two outcomes, depending on how the websocket is being used:

  • If the websocket is not in use, it will be removed:
Delete websocket

  • If the executable is currently in use, a notification will appear indicating that deletion is not possible:
Websocket cannot be deleted

Model to model mapping instances

Double-clicking on the websocket grants access to its model to model mapping instances:

Init mapping flow

Contrary to the information provided on the Model to model mapping instances page, this view exclusively lists the model to model mapping instances associated with the scenario that are related only to the selected websocket.

Init mapping flow

These flows are sent at the beginning of the scenario, making them ideal for initializing certain system parameters through an Engineer flow, such as the weight of a vehicle or the life state of software.

To add an init mapping flow, click on "Add init mapping flow Init mapping flow"

Find init mapping flow

Then, select the flow you want to send at the start of the scenario:

Choose flow to add

Choose the value(s) for the flow to initiate:

Choose value

This instance will be listed under "init mapping flows":

List of init mapping flows

To modify an init mapping flow, click on the "Edit" button: Edit

To remove an init mapping flow, click on the "Delete" button: Delete

To duplicate an init mapping flow across multiple scenarios, click on the "Copy" button: Copy init mapping flow

Following this, a popup will appear, prompting you to select the scenario(s) where you wish to copy the init mapping flow.

Model Parts Instances Configurations

Before proceeding, ensure that you have created model parts within the Project tab (for guidance, refer to Model Part). To instantiate a model part, you will need to click on the add button.

Model Part Instances

After clicking the add button, you will be prompted to configure the parameters for the model part instance:

ParameterReformulated DescriptionRequiredUniqueEditable
NameThe unique identifier for the model part instance, created automatically.✔️✔️
Model PartThe specific model part this instance is derived from, as specified in the executable linked to the websocket.✔️✔️✔️
Instance NameAllows for the assignment of a custom name to the instance, applicable only if the model part type is external.✔️
Associated WebsocketEnables the selection of a websocket to associate with this instance, relevant when the model part type is Other Model.✔️
note

In future releases, it will be generated automatically upon the creation of the associated model part.