Variant blocks allow you to create a single model that caters to multiple variant requirements. Such models have a fixed common structure and a finite set of variable components. The variable components are activated depending on the variant choice that you select. Thus, the resultant active model is a combination of the fixed structure and the variable components based on the variant choice. The use of variant blocks in a model helps in reusability of the model for different conditional expressions called variant choices. For more information and examples, see Variant Subsystems (Simulink).
However, you cannot simulate on real-time target hardware using code that does not specify default variant choices. Before you generate code for real-time simulation, use the Variant Manager to identify variant blocks in your model and to manage the variation points that are modeled using those blocks. To learn how to use the variant manager, see Variant Manager Overview (Simulink).
Simscape™ does not support conditional compilation for model variants.