On this page
You can specify a duration constraint on any State in a State Machine. The minimum and maximum duration spent by the State can be provided through min and max of the duration constraints.
You can use one of the four different modes: min, max, average, and random, to simulate a State that has a duration constraint. You can select a duration mode through the value of the durationSimulationMode tag of the «SimulationConfig» stereotype.
Cameo Simulation Toolkit supports the following time suffixes: ms (millisecond), s (second), m or min (minute), h (hour), and d (day). You can parse the time unit that is specified as a suffix after a number or at the end of an expression string. If you do not specify a suffix, the millisecond will be used by default. The examples are as follows
- 100 m or 100min is 100 minutes.
- xs is the value of the property x in seconds.
- 200 is 200 milliseconds.
Min
When you select min as the duration simulation mode, Cameo Simulation Toolkit will increase the time spent on a State Machine by the min duration specified on the duration constraint when the element, to which a duration constraint is applied, is activated.
Max
If you select max as the duration simulation mode, Cameo Simulation Toolkit will increase the time spent on a State Machine by the max duration specified on the duration constraint when the element, to which a duration constraint is applied, is activated.
Average
When Cameo Simulation Toolkit simulates your model with the average duration simulation mode, it will use the average value between the max and min duration of the duration constraint as the duration of time spent on simulating the element, to which the duration constraint applied.
Random
The random mode allows Cameo Simulation Toolkit to obtain the duration of time spent on simulating an element, to which a duration constraint applied, from a uniformly distributed random number between the min and max duration of the duration constraint.
If you simulate a model without specifying any duration simulation mode, Cameo Simulation Toolkit will ignore duration constraints and obtain the time spent on simulating the States and State Machines from the simulation clock.
If you simulation a State that has a duration constraint with a duration simulation mode and the time spent on Entry, Exit, and DoActivity Behaviors are beyond the range of the duration constraint specified on the State, the State will be considered as a broken constraint element, and Cameo Simulation Toolkit will pause the model simulation at the State.
Related pages