このページは前リリースの情報です。該当の英語のページはこのリリースで削除されています。
バリアント システム
バリアント ブロック、シンボリック次元、パラメーターのバリアントのコード生成
バリアント ブロックやバリアント パラメーターを含むモデルまたはシンボリック次元を使用するモデルでは、プリプロセッサの条件をもつコードを生成します。バリアント ブロックおよびバリアント パラメーターの場合、プリプロセッサの条件はコンパイル時までアクティブなバリアントの選択を遅らせるか、アクティブなバリアントの選択を許可しません。シンボリック次元の場合、プリプロセッサの条件はシミュレーション中にシンボル全体に対して確立される制約を定義します。
トピック
バリアント ブロック
- バリアント モデルを使用して C のプリプロセッサ条件を使用するコードを生成する
この例では、プリプロセッサの条件によって、どのコードが組み込み実行ファイルのリンク先になるかを制御するために、コードを生成するモデル バリアントの利用方法を説明します。
バリアント パラメーター
- Options to Represent Variant Parameters in Generated Code
You can generate the code only for active values or for both active and inactive values of variant parameters in Simulink®. You can also represent the values of variant parameters as inline variables or as tunable variables in the generated code. - 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
- Run Executable for Different Variant Parameter Values Without Recompiling Code
This example shows how to generate an executable that runs for different set of variant parameter values without needing to recompile the code for each set of values.
シンボリック次元
- 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. - 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. - 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.