Simu-to-Model 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 simu-to-model mapping means allowing the system to receive requests from users, as well as data from the outside environment, for example through its sensors.
CREATE A SIMU-TO-MODEL MAPPING
There are also two ways to create a simu-to-model mapping:
- from an executable
- from a context element
Create mapping from an executable
- You can associate a simu-to-model flow to an element, by clicking on the "Create a simu-to-model mapping" button:

- A mapping can be defined by an "Element":

After selection of your flow and element, you will be able to define the parameter values emitted by the Virtual-Bench:

You can enter a fixed value, or select a parameter of the element that will be the value to be emitted.
- A mapping can be defined for "All elements":

Click on "Save" to add this mapping to the list of existing mappings.
Notice that for "Element" mappings, the element type is specify. For "Enumeration" mappings, the HMI enumeration and the state are displayed.
You have the possibility to:
- edit a mapping
- get information on usage of it
To delete simu-to-model mappings, you must go back into the tree structure and click on the "Delete unused simu-to-model mappings" button of the node "Simu-to-model mapping". This action will offer you the list of unused mappings that can be deleted:

Check the once you want to delete and click on "Ok".
Check "(Select/Unselect all)" box in order to select all unused mappings in one time and delete them.
Create mapping from a context element
To create and associate a simu-to-model mapping to a context element, right-click on context element and select "Send flow":

You need to select the websocket and the flow to create the mapping. After creation, the mapping is automatically associated to the 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 blue mappings icon
- Click on
Flows sent
- Add a simu to model mapping by clicking on
- Click on create button
- Choose the flow desired
- Click on ok
ASSOCIATE SIMU-TO-MODEL MAPPINGS TO CONTEXT ELEMENTS
In the same way as model-to-simu mapping instances, associate a simu-to-model mapping to a context element by right-click on it and select "add a simu-to-model mapping" or adding it from the mapping tab.
Then, you have to select the flow that you want to map with the selected element. They are ordered by websockets:

Each event is defined by a websocket, an event action and a flow.
For example, for Buttons elements, you have two actions:
- "Pressed": associated flow will be emitted as long as the button is pressed.
- "Released": associated flow will be emitted only one time, when the button is released.
For Commodos, associate an "Enumeration" mapping: the flow will be emitted each time you switch to an other defined state.
For all elements, you have the 2 following actions:
- "At Initialization": associated flow will be emitted one time, at the start of simulation.
- "Continually": associated flow will be emitted as long as the simulation is running, with a frequency defined in the scenario (40ms by default).
Click on "Ok" once you finish.
If you select the previous context element and take a look on "Mapping" tab, you will see all mappings associated to it:

From there, you can:
- "show mapping": go to original mapping you created in the specific project tab
- delete the mapping instance from the context element
And as model-to-simu mapping information, you will see the list of scenarios which have an instance of your simu-to-model mapping.
CHANGE THE FLOW'S EVENT
If you miss chose your event, you can modify it.
- Click on the element where you want to change the event
- Go on the Mapping tab and search for the flow
- Click on the edit button
- You can modify the event by selecting At initialization or Continually in the Choose Event scrolling menu

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
-
You can modify the websocket by selecting the one you want in the Choose websocket scrolling menu

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

- You can modify:
- delay of mapping
- duration of mapping before restoration
- flow parameter conditions
- flow structure's parameter conditions
- element name conditions

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

GO FURTHER
If you want to know all context elements related to a simu to model instance, have a look on the tree structure, inside the mapping itself:
