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.

b1096b1e-2b42-4492-b6c2-3c669462f696

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.

21efdd6f-573a-4880-8805-ccc166e9136d

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

Reference

ConstructBehavior
AcceptingPathsConstruct

Concepts

Cord Scripts

Other Resources

Modeling Toolbox