Main Content

Set Configuration Parameters for Code Generation of Model Hierarchies

Since R2025a

To generate Structured Text code from a model reference hierarchy, the model reference hierarchy must satisfy:

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 ParametersParameter NameRequirement
PLC Code generationGenerate Functions Instead of Function BlockValues must be the same for top and referenced models.
Emit Data type Worksheet Tags for PCWorxValues must be the same for top and referenced models.
Aggressively inline Structured Text function callsValues must be the same for top and referenced models.
Allow nesting of UDTs if fields are more than allowed thresholdValues must be the same for top and referenced models.
Enable unsigned integer and double datatypes in generated codeValues must be the same for top and referenced models.
Generate testbench for subsystemValues must be the same for top and referenced models.
Include testbench diagnostic codeValues must be the same for top and referenced models.
Maximum number of fields allowed in a UDTValues must be the same for top and referenced models.
Use Signal Builder / Signal Editor block time range to generate multi-testbenchValues must be the same for top and referenced models.
Code output directoryValues must be the same for top and referenced models.
Allow functions with zero inputsValues must be the same for top and referenced models.
Show full target listValues must be the same for top and referenced models.
Suppress auto-generated data typesValues must be the same for top and referenced models.
Target IDE pathValues 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:

  • CODESYS 3.5

  • CODESYS 2.3

  • Phoenix Contact® PC WORX™ 6.0

  • KW-Software MULTIPROG® 5.0

  • Rockwell Automation® Studio 5000 IDE: Routine

  • Generic

  • Siemens® TIA Portal IDE

  • Siemens TIA Portal Double IDE

Configuration ParametersParameter NameRequirements
CommentsInclude commentsValues must be the same for top and referenced models.
Simulink block /Stateflow object commentsValues must be the same for top and referenced models.
include block descriptionValues must be the same for top and referenced models.
Show eliminated blocksValues must be the same for top and referenced models.
ReportsGenerate model Web viewValues must be the same for top and referenced models.
Generate traceability reportValues must be the same for top and referenced models.
Open report automaticallyValues must be the same for top and referenced models.
Configuration ParametersParameter NameRequirements
OptimizationRemove code from floating-point to integer conversions that wraps out-of-range valuesValues must be the same for top and referenced models.
Default parameter behaviorValues must be the same for top and referenced models.
Fold temporary variables using function block instance output variableValues must be the same for top and referenced models.
Generate reusable codeValues must be the same for top and referenced models.
Inline named constantsValues must be the same for top and referenced models.
Remove unused ssmethod FB call argumentsValues must be the same for top and referenced models.
Reuse MATLAB Function block variablesValues must be the same for top and referenced models.
Loop unrolling thresholdValues must be the same for top and referenced models.
Signal storage reuseValues must be the same for top and referenced models.
Configuration ParametersParameter NameRequirements
IdentifiersExternally defined identifiersValues must be the same for top and referenced models.
Use subsystem instance name as function block instance nameValues must be the same for top and referenced models.
Generate enum cast functionValues must be the same for top and referenced models.
Override target default enum behaviorValues must be the same for top and referenced models.
Inline enum cast functionValues must be the same for top and referenced models.
Override target default maximum identifier lengthValues must be the same for top and referenced models.
Preserve alias type names for data typesValues must be the same for top and referenced models.
Maximum identifier lengthValues must be the same for top and referenced models.
Reserved namesValues must be the same for top and referenced models.
Use the same reserved names as simulation targetValues must be the same for top and referenced models.
Configuration ParametersParameter NameRequirements
InterfaceGenerate logging codeValues must be the same for top and referenced models.
Remove initialization statements for externally defined state variablesValues must be the same for top and referenced models.
Keep top-level ssmethod name the same as the non-top level nameValues must be the same for top and referenced models.
Remove top-level subsystem ssmethod typeValues must be the same for top and referenced models.
Use output argument syntax in function and function block callsValues must be the same for top and referenced models.

See Also

Topics