Share via

Scenarios and Slicing

Scenarios provide a way to limit (or slice) a model program's more general behavior so that it is testable.

For example, a scenario may explore a short segment and then reset to the beginning of that segment. The template generates a machine for a scenario in the following manner.

machine Scenario() : Main
   (Add(_); Add(_); ReadAndReset())*

The scenario uses placeholders, instead of concrete parameters. It also omits the result of the call to ReadAndReset. The language used for scenarios is very similar to regular expressions. The atomic elements are actions, with parameters fixed or left open by using placeholders.

Exploring the Scenario machine yields the following graph.


When a scenario is combined with another behavior using the parallel composition operator (||), the resulting behavior contains only those steps that match. In the generated solution, the composition is constructed in the SlicedModelProgram machine as follows.

machine SlicedModelProgram() : Main
   Scenario() || ModelProgram() // Parallel composition.

Exploring machine SlicedModelProgram results in the following graph.


This state graph does not hit any bounds and is ready for testing.

Cord provides extensive built-in support for slicing. See the ConstructBehavior features such as the AcceptingPathsConstruct. For a set of detailed walkthroughs involving slicing using some special tools, see the Modeling Toolbox.

See Also




Cord Scripts

Other Resources

Modeling Toolbox