Skip to main content

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:
Add button
  1. A mapping can be defined by an "Element":
Create simu to model mapping

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

Edit simu to model mapping

You can enter a fixed value, or select a parameter of the element that will be the value to be emitted.

  1. A mapping can be defined for "All elements":
Create simu to model mapping

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:

Delete unused simu to model mappings

Check the once you want to delete and click on "Ok".

tip

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":

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 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 Add button Flows sent
  • Add a simu to model mapping by clicking on
create reuse model
  • 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:

Choose simu to model to add

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:

S->M tab

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 Edit mapping instance
  • You can modify the event by selecting At initialization or Continually in the Choose Event scrolling menu
choose websocket

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 Edit event

  • You can modify the websocket by selecting the one you want in the Choose websocket scrolling menu

choose websocket
  • Click on Save

EDITION

  • You can edit every simu-to-model 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 context elements related to a simu to model instance, have a look on the tree structure, inside the mapping itself:

Context elements of a simu to model mapping instance