Block Parameters in Generated Code
To control how the block parameters appear in the generated code, you can either
define the parameters as Simulink.Parameter objects in the MATLAB® workspace or use the Model Parameter Configuration dialog box. For more
information, see Control Appearance of Block Parameters in Generated Code.
Simulink® PLC Coder™ exports tunable parameters as exported symbols and preserves the names of these parameters in the generated code. It does not mangle these names. As a result, if you use a reserved IDE keyword as a tunable parameter name, the code generation can cause compilation errors in the IDE. As a best practice, do not use IDE keywords as tunable parameter names.
The coder maps tunable parameters in the generated code as listed in the following table:
| Target IDE | Parameter Storage Class | |||
|---|---|---|---|---|
Model default | ExportedGlobal | ImportedExtern | ImportedExternPointer | |
| CODESYS 2.3 | Local function block variables | Global variable | Variable is not defined in generated code and expected to be defined externally. | Ignored. If you set the parameter to this value, the software treats
it the same as ImportedExtern. |
| CODESYS 3.5 | Local function block variables | Global variable | Variable is not defined in generated code and expected to be defined externally. | Ignored. If you set the parameter to this value, the software treats
it the same as ImportedExtern. |
| B&R Automation Studio® 3.0 | Local function block variable | Local function block variable | Local function block variable. | Ignored. If you set the parameter to this value, the software treats
it the same as ImportedExtern. |
| B&R Automation Studio 4.0 | Local function block variable | Local function block variable | Local function block variable. | Ignored. If you set the parameter to this value, the software treats
it the same as ImportedExtern |
Beckhoff® TwinCAT® 2.11 | Local function block variable | Global variable | Variable is not defined in generated code and expected to be defined externally. | Ignored. If you set the parameter to this value, the software treats
it the same as ImportedExtern. |
| KW-Software MULTIPROG® 5.0 | Local function block variable | Local function block variable | Local function block variable. | Ignored. If you set the parameter to this value, the software treats
it the same as ImportedExtern. |
Phoenix Contact® PC WORX™ 6.0 | Local function block variable | Global variable | Variable is not defined in generated code and expected to be defined externally. | Ignored. If you set the parameter to this value, the software treats
it the same as ImportedExtern. |
| RSLogix™ 5000 17, 18: AOI | AOI local tags | AOI input tags | AOI input tags. | Ignored. If you set the parameter to this value, the software treats
it the same as ImportedExtern. |
| RSLogix 5000 17, 18: Routine | Instance fields of program UDT tags | Program tags | Variable is not defined in generated code and expected to be defined externally. | Ignored. If you set the parameter to this value, the software treats
it the same as ImportedExtern. |
Siemens® SIMATIC® STEP® 7 | Local function block variable | Global variable | Variable is not defined in generated code and expected to be defined externally. | Ignored. If you set the parameter to this value, the software treats
it the same as ImportedExtern. |
Siemens TIA Portal | Local function block variable | Global variable | Variable is not defined in generated code and expected to be defined externally. | Ignored. If you set the parameter to this value, the software treats
it the same as ImportedExtern |
| Generic | Local function block variable | Global variable | Variable is not defined in generated code and expected to be defined externally. | Ignored. If you set the parameter to this value, the software treats
it the same as ImportedExtern. |
| PLCopen | Local function block variable | Global variable | Variable is not defined in generated code and expected to be defined externally. | Ignored. If you set the parameter to this value, the software treats
it the same as ImportedExtern. |