Variant Lamp Design
This example shows how to design a system that uses variant transitions to generate code that can be used in a variety of different software situations.
Some of the lamps have the ability to be dimmed. Within that subset, there are lamps that can be set high or low and lamps that can only be set to high, medium, or low.
Entry to the variant configurations are guarded by a transition condition that uses a Simulink parameter or MATLAB variable that is defined in the base workspace.
In this example, the variant configurations are guarded by a condition with a Simulink parameter. In this case, HAS_DIMMER1 and HAS_DIMMER2 are parameter objects.
When you generate code from the Simulink model, your code includes only the active variant state machine. If you are using Embedded Coder, you have the option to include a preprocessor conditional statement in the generated code.
For more information, see Code Generation Using Variant Transitions.