Main Content

Simulate Conditionally Executed Referenced Models

You can run a standalone simulation of a conditionally executed referenced model, or conditional model. A standalone simulation is useful for unit testing because it provides consistent data across simulations in terms of data type, dimension, and sample time. Use normal, accelerator, or rapid accelerator mode to simulate a conditional model.

Triggered, Enabled, and Triggered and Enabled Models

Triggered, enabled, and triggered and enabled models require an external input to drive the Trigger or Enable blocks. In the Signal Attributes pane of the Trigger or Enable block dialog box, specify values for the signal data type, dimension, and sample time.

To run a standalone simulation, specify the inputs using the Input configuration parameter. For details about how to specify the input, see Comparison of Signal Loading Techniques. The following conditions apply when you use the Input parameter for Trigger and Enable block inputs:

  • Use the last data input for the trigger or enable input. For a triggered and enabled model, use the last data input for the trigger input.

  • If you do not provide any input values, the simulation uses zero as the default values.

You can log data to determine which signal caused the model to run. For the Trigger or Enable block, in the Main pane of the Block Parameters dialog box, select Show output port.

Function-Call Models

When you simulate a function-call model, the Model block conditionally executes when it receives a function-call event. A Stateflow® chart, Function-Call Generator block, or S-Function block can provide function-call events.

You can also configure the model to calculate output at specific times using a variable-step solver. For more information, see Samples to Export for Variable-Step Solvers.

See Also

| |

Related Topics