You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

A State Invariant is one of the UML elements. It is a runtime constraint applied to a lifeline in a Sequence diagram to specify conditions that are always true when a State is a current State. It is used to validate States. You may also specify State Invariants in the States directly. State Invariants on lifelines resolves variables in the same order as it does in message arguments. 

When Cameo Simulation Toolkit runs a State Invariant in a model, it also evaluates its constraints. If the constraints are not satisfied, the evaluation will fail or return false and Cameo Simulation Toolkit will stop simulation (if "ConstraintAsBreakpoint" is set to true) at that invalid constraint or point. However, you can still continue the simulation to the next point. You can define constraints using any of the supported languages in Cameo Simulation Toolkit. State Invariants are used mostly in Interactions, but you can also use them in a State Machine diagram. 


A State Invariant containing constraints being evaluated during execution.

Cameo Simulation Toolkit supports duration constraints between State invariants. The following figure shows, e.g., from State S1 to S2 takes 20 seconds of total simulation time; 10 seconds from duration constrains of the a Activity and another 10 seconds out of {15s} duration constrains. From State S3 to S4 takes 15 seconds of simulation time out of {15s} duration constraint.

Duration constraints between State invariants are supported.