Aller au contenu principal

Model-to-Simu Mappings

To start mapping your model with Virtual Bench, you must have imported your types and flows, according to the method described in the related page.

WHAT IS IT?

Create a model-to-simu mapping means allowing the system to send feedbacks to users, as well as data to the outside environment.

CREATE A MODEL-TO-SIMU MAPPING

There are two ways to create a model-to-simu mapping:

  • from an executable
  • from a context element

Create mapping from an executable

First, you have to go to the "Executable" list, in the specific project tab.

  • You can create a model-to-simu mapping, by clicking on the "Create a model-to-simu mapping" button:
Add button
Create model to simu mapping

After selection of your flow and element, you will be able to define the changes that the flow will cause on the selected item

Parameters

This category allows you to modify all the basic fields of the selected element that will be updated at the flow reception.

In our example, we choose a Text element:

Edit model to simu mapping

NB: According to the previous figure, the Text element will display "Car speed is lower than target !" when the flow "apply_shuttle_acceleration" will be received.



Check a parameter box to modify it. You can choose between Constant, Project Constant and Variable values.

  • Constant means a static value that you define directly during mapping creation.

  • Project Constant means a static value that you defined in your project. See Project Constants section to learn how to create one.

  • Variable means that you can associate an element field to a flow parameter. For example you can display a flow parameter "Event" as text in the field element "Text" of a Text Element.

Click on "Save" to add this mapping to the list of existing mappings.

List of model to simu mappings

remarque

Mappings are listed first by type, then by alphabetic order.

From here, you have the possibility to:

  • edit a mapping
  • get information on usage of it
  • delete an unused mapping

Flow parameter conditions

You can add logical conditions, concerning parameters or a parameters in a structure (structure.parameter) conveyed, on this mapping, by clicking on "Add condition":

Add condition

Triggered Behaviours

On some elements, you will have access to the extra category "Triggered Behaviours". It allows you to add special behaviors depending on the chosen context element.

model-to-simu Triggers

On Text element, you have the possibility to Clear, Concatenate, Add a new line, etc.

Create mapping from a context element

To create and associate a model-to-simu mapping to a context element, right-click on a context element and select "Receive flow":

Create mapping from a context element

You need to select the websocket and the flow to create the mapping. After creation, the mapping is automatically associated to the selected context element.

Create mapping from the element tab

  • Click on the element on which you want to add a mapping
  • In the element tab, click on the mappings icon
  • Click on Add button Flows received
  • Add a model to simu mapping by clicking on
create reuse model
  • Click on create button
  • Choose the flow desired
  • Click on ok

ASSOCIATE MODEL-TO-SIMU MAPPINGS TO CONTEXT ELEMENTS

remarque

If you created the mapping directly from a context element, the association is already done !

From the context element, associate a model-to-simu mapping to a context element, right-click on it and select "Receive flow":

Receive flow

Then, you have to click on "Reuse": Reuse flow and choose the wanted mapping.

From the element, you can associate a model-to-simu mapping to a context element and clicking on the model to simu mapping Add button and then

create reuse model

Then, you have to select the flow that you want to map with the selected element. They are ordered by websockets:

Choose model to simu to add

Click on "Save" when you finish.

If you select the previous context element (an orange frame surrounds it) and take a look on "Flows received" folder, you will see all mappings associated to it:

Flows received tab

From there, you can:

  • Show mapping: go to original mapping you created in the specific project tab
  • edit the mapping instance (duration, delay and conditions)
  • delete the mapping instance from the context element

CHANGE A FLOW'S EXECUTABLE

  • Click on the element where you want to change the executable

  • Go on the Mapping tab and search for the flow

  • Click on the edit button Create model to simu mapping

  • You can modify the websocket

choose websocket
  • Click on Save

EDITION

  • You can edit every model-to-simu mapping instances individualy, by clicking on "Edit mapping instance" button:
Edit mapping instance

You can modify:

  • delay of mapping
  • duration of mapping before restoration
  • flow parameter conditions
  • flow structure's parameter conditions
  • element name conditions
Edit duration and delay pop-up

And now, if you look at the mapping information, you will see the list of scenarios which have an instance of it:

Mapping information with scenario that used

GO FURTHER

If you want to know all model-to-simu mapping instances from a flow, have a look on the tree structure, inside the flow itself, you will find a folder with all instances related to it:

model to simu mapping instances of a flow

On the other hand, if you want to know all context elements related to an instance, have a look on the tree structure, inside the mapping itself:

Context elements of a model to simu mapping instance