Defining GUI Experiment
When you execute your simulation, you will often need to display some information. For each simulation, you can define some inputs, outputs and behaviors:
- The inputs will be composed of parameters manipulated by the user for each simulation.
- The behaviors will be used to define behavior executed at each step of the experiment.
- The outputs will be composed of displays, monitors and inspectors. They will be defined inside the scope
output. The definition of their layout can also be set with thelayoutstatement.
A typical GUI experiment code follows this pattern:
experiment exp_name type: gui {
[input]
[behaviors]
output {
layout [layout_option]
[display statements]
[monitor statements]
}
}
Types of experiments​
You can define fours types of experiments (through the facet type):
guiexperiments (the default type) are used to play an experiment and displays its outputs. It is also used when the user wants to interact with the simulation.batchexperiments are used to play an experiment several times (usually with other input values), used for model exploration. We will come back to this notion a bit further in the tutorial.testexperiments are used to write unit tests on a model (used to ensure its quality).memorizeexperiments are GUI experiments in which the simulation state is kept in memory and the user can backtrack to any previous step.
Experiment attributes​
Inside experiment scope, you can access to some built-in attributes which can be useful, such as minimum_cycle_duration, to force the duration of one cycle.
experiment my_experiment type: gui {
float minimum_cycle_duration <- 2.0#minute;
}
In addition, the attribute simulations contain the list of all the simulation agents that are running in the current experiment. Whereas the attribute simulation represents a single simulation, the last element of the simulation list.