バリアント システム
バリアント ブロックが含まれるモデルまたはシンボリック次元を使用するモデルでは、プリプロセッサの条件をもつコードを生成します。バリアント ブロックの場合、プリプロセッサの条件はコンパイル時までアクティブなバリアントの選択を遅らせるか、アクティブなバリアントの選択を許可しません。シンボリック次元の場合、プリプロセッサの条件はシミュレーション中にシンボル全体に対して確立される制約を定義します。
トピック
- Represent Subsystem and Variant Models in Generated Code
Create a model with subsystem or variant models. Generate code that contains preprocessor conditionals that control the activation of each variant choice.
- Implement Symbolic Dimensions for Array Sizes in Generated Code
Specify dimension information as symbols in blocks and data objects. These symbols propagate throughout the model during simulation and then go into the generated code.
- Compile Code Conditionally for all Values of Variant Parameters with Same and Different Dimensions
This example shows how to generate a C code that contains all the active and inactive values of variant parameters. The values are enclosed in preprocessor conditionals
#if
and#elif
that enables you to compile the code conditionally based on the condition that evaluates totrue
. - Represent Variant Source and Sink Blocks in Generated Code
Generate code that contains preprocessor conditionals that control the activation of each variant choice and allow for no active variant choice.
- Represent Variant Condition Values of Enumerated Type in Generated Code
Generate C code from Simulink® models having variant condition values of enumerated type.
- Configure Symbolic Dimensions for S-Function Blocks
Configure S-functions to support forward propagation, backward propagation, or forward and backward propagation of symbolic dimensions during simulation.
- Code Generation for Variant Blocks
Generate code containing preprocessor conditionals that control the active variant choice for a Simulink model containing variant blocks.
- Generate Preprocessor Conditionals for Variant Systems
Define variant control variables and configure model for generating preprocessor conditional directives.
- Generate Code for Variant Subsystem with Child Subsystems of Different Output Signal Dimensions
This example shows how to use symbolic dimensions to generate code for a variant subsystem consisting of child subsystems of different output signal dimensions.
- バリアント モデルを使用して C のプリプロセッサ条件を使用するコードを生成する
この例では、プリプロセッサの条件によって、どのコードが組み込み実行ファイルのリンク先になるかを制御するために、コードを生成するモデル バリアントの利用方法を説明します。
- Improve Code Readability of Variant Parameters Using Enumerated Types
You can use enumerated types to improve code readability of variant control values in variant parameters. Simulink 列挙型 improve readability because enumerated types of variant controls values are represented as meaningful names instead of integers in the generated code.
- Reuse Variant Parameter Values from Handwritten Code Using Simulink.Parameter Variables
This example shows how to use
variables to generate a code that imports variant parameter values from your existing code. Importing variant parameter values allows you to reuse the values that your existing code defines. You can then integrate and compile the generated and existing code into a single executable. You can choose to generate a code that imports variant parameter values at the beginning of code compile, simulation-loop, or model startup phases of simulation and code generation workflows based on the activation time you specify. For more information, see Activate Variant During Different Stages of Simulation and Code Generation Workflow.Simulink.Parameter