Structured Text Code Generation Limitations
R2026bGeneral Limitations
The Simulink® PLC Coder™ software does not support:
Stateflow® messages
Stateflow empty chart output functions.
Simulink states in Stateflow charts.
Step block
Clock block
Shared state variables between subsystems
MATLAB System block or system objects
MATLAB® classes.
The
Simulink.LookupTable,Simulink.Breakpoint, andSimulink.DualScaledParameterobjects.Code generation when
UseRowMajorAlgorithm="on".To perform numeric comparisons with
enumdata type values inside model subsystem blocks, use a data type conversion block to convert the enum to an integer.Testbench generation for models using software-in-the-loop (SIL) or processor-in-the-loop (PIL) simulation mode.
Non top-level Stateflow function call output events that call Simulink subsystems.
Half-precision data types.
Execution of callback functions during code generation. Before code generation, you must compile or simulate the model to execute the callback functions.
Expressions generated for parameter objects using the
slexprfunction.C code S-Function
Restrictions
The structured text language has inherent restrictions. As a result, the Simulink PLC Coder software has these restrictions:
Supports code generation only for atomic subsystems.
Supports automatic, inline, or reusable function packaging for code generation. Nonreusable function packaging is not supported.
Does not support blocks that require continuous time semantics. This restriction includes integrator blocks, zero-crossing detection blocks, physical blocks, such as Simscape™ library blocks and so on.
Does not support recursion (including recursive events).
Does not support nonfinite data, for example
NaNorInf.
Data Type Limitations
Simulink.Signal Limitations
Simulink PLC Coder does not support:
The
Simulink.CoderInfoIdentifiername property withSimulink.ParameterandSimulink.Signalobjects.Code generation for Simulink signals that do not resolve to a
Simulink.Signaldata store memory object.Signal lines named using
Simulink.Signalmappings.
Fixed-Point Data Type Multiword Operations
Simulink PLC Coder does not support code generation for block parameter settings that require fixed-point data types with more than 64-bits.
MITSUBISHI Data Type Limitations
When you generate code for the MITSUBISHI ELECTRIC MELSOFT GX Works3 target IDE
and your model contains int8 or uint8 data
types, Simulink
PLC Coder converts int8 to int16, and
uint8 to uint16. This data type conversion
could lead to a difference between simulation results and run-time results.
Do not use these unsupported data types in your model.
Schneider EcoStruxure Control Expert Data Type Limitations
When you generate code for the Schneider EcoStruxure Control Expert and your model
contains double, enumeration, and
int8 data types, Simulink
PLC Coder converts double data types to
single, enumeration data types to 32-bit
integers, and int8 data types to 16-bit integers. This data type
conversion could lead to a difference between simulation results and run-time
results. Do not use these unsupported data types in your model.
string Data Type Support Limitations
Simulink PLC Coder does not support:
String manipulation operations
Code generation for Simulink string manipulation blocks
Code Generation Limitations
Model Reference Code Generation Limitations
When you generate IEC 61131-10 Structured Text code for model references:
The top-level subsystem must be a single atomic subsystem block with input and output ports.
The connections to the top-level subsystem input and output ports must be in order. For example, if you have two input ports and connect input two to input port one, Simulink PLC Coder generates an error and code generation errors out.
You must not use the Model block parameters.
You must not use virtual buses.
You must set the Simulation mode model configuration parameter of the Model block to
Normal.You must remove unused input and output signals from the reference model top-level subsystem.
Variant Activation Time
When you set the Variant Subsystem block Variant
activation time parameter to a value other than update
diagram, Simulink
PLC Coder throws a warning during code generation.
Stateflow Inlining
When your Stateflow chart has over 400 functions then more than 20 percent of the
generated functions are inlined due to access to chart data. To prevent function
inlining, pass the chart data as parameters. When you pass
struct and array data types, change the functions to use
the format y = f(y) to avoid inlining the functions and
improve code generation performance.
IDE Feature Support Matrix
This table summarizes the support for model reference, 64-bit integer data type,
string data type, double-precision data type, and enumerated data
type across target IDEs.
| Target IDE | Model Reference | 64-bit Integer | String | Double-Precision | Enumerated |
|---|---|---|---|---|---|
| CODESYS 3.5 | Yes | Yes | Yes | Yes | Yes |
| CODESYS 2.3 | Yes | No | Yes | Yes | Yes |
| Rockwell Automation® Studio 5000: AOI | Yes | No | Yes | No, converts to single-precision | No, converts to 32-bit integer |
| Rockwell Automation Studio 5000: Routine | No | No | Yes | No, converts to single-precision | No, converts to 32-bit integer |
| Rockwell Automation RSLogix 5000: AOI | No | No | No | No, converts to single-precision | No, converts to 32-bit integer |
| Rockwell Automation RSLogix 5000: Routine | No | No | Yes | No, converts to single-precision | No, converts to 32-bit integer |
| Siemens® TIA Portal | No | No | Yes | No, converts to single-precision | No, converts to 16-bit integer |
| Siemens TIA Portal: Double Precision | Yes | Yes | Yes | Yes | No, converts to 16-bit integer |
| Siemens SIMATIC Step 7 | No | No | Yes | No, converts to single-precision | No, converts to 16-bit integer |
| Schneider Electric - EcoStruxure Control Expert | Yes | No | Yes | No, converts to single-precision | No, converts to 32-bit integer |
| Schneider Electric - EcoStruxure Machine Expert | Yes | Yes | Yes | Yes | Yes |
OMRON® Sysmac® Studio | Yes | Yes | Yes | Yes | Yes |
OMRON Sysmac Studio - IEC 61131-10 XML | Yes | Yes | Yes | Yes | Yes |
| MITSUBISHI ELECTRIC MELSOFT GX Works3 | Yes | No | Yes | Yes | No, converts to 32-bit integer |
| B&R Automation Studio® 4.0 | No | Yes | Yes | Yes | Yes |
| Beckhoff® TwinCAT® 2.11 | No | No | Yes | Yes | Yes |
| Beckhoff TwinCAT 3 | No | Yes | Yes | Yes | Yes |
| CAREL STone | No | No | Yes | Yes | Yes |
| Danfoss Alsmart Design | No | No | Yes | Yes | Yes |
| Generic | Yes | Yes | Yes | Yes | Yes |
| KW-Software MULTIPROG® 5.0 | Yes | No | No | Yes | No, converts to 16-bit integer |
| PLCopen XML | No | Yes | Yes | Yes | Yes |
Phoenix Contact® PC WORX™ 6.0 | Yes | No | No | Yes | No, converts to 16-bit integer |
| Rexroth IndraWorks | No | Yes | Yes | Yes | Yes |
| Selectron CAP1131 | No | No | Yes | No, converts to single-precision | No, converts to 32-bit integer |