(→SimB) |
|||
Line 40: | Line 40: | ||
==== Direct Activation ==== | ==== Direct Activation ==== | ||
A direct activation requires the fields <tt>id</tt>, and <tt>execute</tt> to be defined. | A direct activation activates an event to be executed in the future. | ||
It requires the fields <tt>id</tt>, and <tt>execute</tt> to be defined. | |||
All other fields can be defined optionally. | All other fields can be defined optionally. | ||
Line 73: | Line 74: | ||
==== Probabilistic Choice ==== | ==== Probabilistic Choice ==== | ||
A probabilistic choice selects an event to be executed in the future. | |||
It requires the two fields <tt>id</tt>, and <tt>chooseActivation</tt>. <tt>chooseActivation</tt> is a Map storing Key-Value pairs where activations (identified by their <tt>id</tt>) are mapped to a probability. It is possible to chain multiple probabilistic choices together, but eventually, a direct activation must be reached. | |||
<pre> | <pre> |
SimB is a simulator built on top of ProB. It is available in the latest SNAPSHOT version in the new JavaFX based user interface ProB2-UI (https://github.com/hhu-stups/prob2_ui), The modeler can write SimB annotations for a formal model to simulate it. Furthermore, it is then possible to validate probabilistic and timing properties with statistical validation techniques such as hypothesis testing and estimation.
Start SimB via "Open Simulator" in the "Advanced" Menu after opening a machine.
Now, you can open a SimB file (JSON format) controlling the underlying formal model.
A SimB file consists of probabilistic and timing elements to simulate the model. Within these elements, the modeler can user B expressions which are evaluated on the current state.
In the following, an example for a SimB file controlling a Traffic Lights for cars and pedestrians is shown:
{ "activations": [ {"id":"$initialise_machine", "execute":"$initialise_machine", "activating":"choose"}, {"id":"choose", "chooseActivation":{"cars_ry": "0.8", "peds_g": "0.2"}}, {"id":"cars_ry", "execute":"cars_ry", "after":5000, "activating":"cars_g"}, {"id":"cars_g", "execute":"cars_g", "after":500, "activating":"cars_y"}, {"id":"cars_y", "execute":"cars_y", "after":5000, "activating":"cars_r"}, {"id":"cars_r", "execute":"cars_r", "after":500, "activating":"choose"}, {"id":"peds_g", "execute":"peds_g", "after":5000, "activating":"peds_r"}, {"id":"peds_r", "execute":"peds_r", "after":5000, "activating":"choose"} ] }
The SimB file always contains an activations field storing all elements controlling the simulation in a list. There are two types of activations: direct activation and probabilistic choice. All activations are identified by their id.
A direct activation activates an event to be executed in the future. It requires the fields id, and execute to be defined. All other fields can be defined optionally.
{ "id": ... "execute": ... "after": ... "activating": ... "activationKind": ... "additionalGuards": ... "fixedVariables": .... "probabilisticVariables": .... "priority": ... }
A probabilistic choice selects an event to be executed in the future. It requires the two fields id, and chooseActivation. chooseActivation is a Map storing Key-Value pairs where activations (identified by their id) are mapped to a probability. It is possible to chain multiple probabilistic choices together, but eventually, a direct activation must be reached.
{ "id": ... "chooseActivation": ... }