Main Content

Simulate a Variant Subsystem in Startup with Fast Restart Enabled

This example shows you how you can simulate a fog lamp with startup variant activation time with fast restart enabled.

Model

Open the model slexVariantSubsystemWithStartup. The model contains a variant subsystem block Controller with two choices Sensors Connected and Driver Switch with the conditions VSS_MODE == 1 and VSS_MODE == 2 respectively.The Sensors Connected choice is the equivalent of the sensors overriding the manual switching of the fog lamps based on the ambient light. The Drivers Switch choice is equiavalent of the driver switching on or off the fog lamp.

Simulate the Model

Startup variant activation time with the fast restart allows you to perform iterative simulations without having to recompile the model or terminating the simulation each time.

1 Set the Variant activation time to startup in the Block Parameters dialog.

2 Enable fast restart by clicking on the Fast restart button on the simulation menu.

3 To simulate using the Driver Switch as the active choice, set VSS_MODE to 2. The output LightCommand is a delayed Driver Switch signal.

4 Compile and Run the simulation.

5 Switch the active variant choice to Sensor Connected by setting VSS_MODE to 1 and run the simulation again. The output LightCommand is high until SensorOutput is high, independent of the Driver Switch signal.

When you simulate the model for the second simulation it will not rebuild the model because there is no structural change in the model. With fast restart enabled you will notice that the model is initialized, and ready to be run without the need to re-compile each time.