Set Configuration Parameters for Code Generation of Model Hierarchies
To generate Structured Text code from a model reference hierarchy, the model reference hierarchy must satisfy:
The Simulink® requirements listed in:
The Simulink limitations listed in Signal Requirements and Limitations.
You must save any changes made to the referenced models. If you do not save the changes Simulink PLC Coder™ does not generate Structured Text code.
Configuration Parameter Requirements
A referenced model uses a configuration set in the same way a top model does. By default, every model in a hierarchy has its own configuration sett that is separate from the set used by the top model. Because each model can have its own configuration set, configuration parameter values can be different in different models. When Simulink PLC Coder encounters an inconsistent or unusable configuration setting, the action it takes depends on the parameter:
If parameter inconsistency has no significance, Simulink PLC Coder ignores or resolves the inconsistency without posting a warning.
If a nontrivial and possibly acceptance solution exists to an inconsistent parameter, Simulink PLC Coder resolves the conflict silently, resolves it with a warning, or generates an error.
If an acceptable resolution is not possible, the code generator produces an error. You must then change the parameter value to eliminate the issue.
When a model reference hierarchy contains many referenced models that have incompatible parameter values, or a changed parameter value must propagate to many referenced models, you can use configuration references to assign an externally stored configuration set to multiple models. For more information, see Share a Configuration Across Referenced Models.
This table lists the configuration parameters that can cause problems if set in certain ways, or if set differently in a referenced model than in a parent model. Where possible, the code generator resolves violations of these requirements, but most cases require you to make changes to the parameters in your models.
Configuration Parameters | Parameter Name | Requirement |
---|---|---|
PLC Code generation | Generate Functions Instead of Function Block | Values must be the same for top and referenced models. |
Emit Data type Worksheet Tags for PCWorx | Values must be the same for top and referenced models. | |
Aggressively inline Structured Text function calls | Values must be the same for top and referenced models. | |
Allow nesting of UDTs if fields are more than allowed threshold | Values must be the same for top and referenced models. | |
Enable unsigned integer and double datatypes in generated code | Values must be the same for top and referenced models. | |
Generate testbench for subsystem | Values must be the same for top and referenced models. | |
Include testbench diagnostic code | Values must be the same for top and referenced models. | |
Maximum number of fields allowed in a UDT | Values must be the same for top and referenced models. | |
Use Signal Builder / Signal Editor block time range to generate multi-testbench | Values must be the same for top and referenced models. | |
Code output directory | Values must be the same for top and referenced models. | |
Allow functions with zero inputs | Values must be the same for top and referenced models. | |
Show full target list | Values must be the same for top and referenced models. | |
Suppress auto-generated data types | Values must be the same for top and referenced models. | |
Target IDE path | Values must be the same for top and referenced models. | |
Target IDE | The top model value overwrites the referenced model value. The Target IDE must be set to one of these values:
|
Configuration Parameters | Parameter Name | Requirements |
---|---|---|
Comments | Include comments | Values must be the same for top and referenced models. |
Simulink block /Stateflow object comments | Values must be the same for top and referenced models. | |
include block description | Values must be the same for top and referenced models. | |
Show eliminated blocks | Values must be the same for top and referenced models. | |
Reports | Generate model Web view | Values must be the same for top and referenced models. |
Generate traceability report | Values must be the same for top and referenced models. | |
Open report automatically | Values must be the same for top and referenced models. |
Configuration Parameters | Parameter Name | Requirements |
---|---|---|
Optimization | Remove code from floating-point to integer conversions that wraps out-of-range values | Values must be the same for top and referenced models. |
Default parameter behavior | Values must be the same for top and referenced models. | |
Fold temporary variables using function block instance output variable | Values must be the same for top and referenced models. | |
Generate reusable code | Values must be the same for top and referenced models. | |
Inline named constants | Values must be the same for top and referenced models. | |
Remove unused ssmethod FB call arguments | Values must be the same for top and referenced models. | |
Reuse MATLAB Function block variables | Values must be the same for top and referenced models. | |
Loop unrolling threshold | Values must be the same for top and referenced models. | |
Signal storage reuse | Values must be the same for top and referenced models. |
Configuration Parameters | Parameter Name | Requirements |
---|---|---|
Identifiers | Externally defined identifiers | Values must be the same for top and referenced models. |
Use subsystem instance name as function block instance name | Values must be the same for top and referenced models. | |
Generate enum cast function | Values must be the same for top and referenced models. | |
Override target default enum behavior | Values must be the same for top and referenced models. | |
Inline enum cast function | Values must be the same for top and referenced models. | |
Override target default maximum identifier length | Values must be the same for top and referenced models. | |
Preserve alias type names for data types | Values must be the same for top and referenced models. | |
Maximum identifier length | Values must be the same for top and referenced models. | |
Reserved names | Values must be the same for top and referenced models. | |
Use the same reserved names as simulation target | Values must be the same for top and referenced models. |
Configuration Parameters | Parameter Name | Requirements |
---|---|---|
Interface | Generate logging code | Values must be the same for top and referenced models. |
Remove initialization statements for externally defined state variables | Values must be the same for top and referenced models. | |
Keep top-level ssmethod name the same as the non-top level name | Values must be the same for top and referenced models. | |
Remove top-level subsystem ssmethod type | Values must be the same for top and referenced models. | |
Use output argument syntax in function and function block calls | Values must be the same for top and referenced models. |