Contenu principal

Structured Text Code Generation Limitations

R2026b

General 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, and Simulink.DualScaledParameter objects.

  • Code generation when UseRowMajorAlgorithm="on".

  • To perform numeric comparisons with enum data 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 slexpr function.

  • 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 NaN or Inf.

Data Type Limitations

Simulink PLC Coder does not support:

  • The Simulink.CoderInfo Identifier name property with Simulink.Parameter and Simulink.Signal objects.

  • Code generation for Simulink signals that do not resolve to a Simulink.Signal data store memory object.

  • Signal lines named using Simulink.Signal mappings.

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 IDEModel Reference64-bit IntegerStringDouble-PrecisionEnumerated
CODESYS 3.5YesYesYesYesYes
CODESYS 2.3YesNoYesYesYes
Rockwell Automation® Studio 5000: AOIYesNoYesNo, converts to single-precisionNo, converts to 32-bit integer
Rockwell Automation Studio 5000: RoutineNoNoYesNo, converts to single-precisionNo, converts to 32-bit integer
Rockwell Automation RSLogix 5000: AOINoNoNoNo, converts to single-precisionNo, converts to 32-bit integer
Rockwell Automation RSLogix 5000: RoutineNoNoYesNo, converts to single-precisionNo, converts to 32-bit integer
Siemens® TIA PortalNoNoYesNo, converts to single-precisionNo, converts to 16-bit integer
Siemens TIA Portal: Double PrecisionYesYesYesYesNo, converts to 16-bit integer
Siemens SIMATIC Step 7NoNoYesNo, converts to single-precisionNo, converts to 16-bit integer
Schneider Electric - EcoStruxure Control ExpertYesNoYesNo, converts to single-precisionNo, converts to 32-bit integer
Schneider Electric - EcoStruxure Machine ExpertYesYesYesYesYes

OMRON® Sysmac® Studio

YesYesYesYesYes

OMRON Sysmac Studio - IEC 61131-10 XML

YesYesYesYesYes
MITSUBISHI ELECTRIC MELSOFT GX Works3YesNoYesYesNo, converts to 32-bit integer
B&R Automation Studio® 4.0NoYesYesYesYes
Beckhoff® TwinCAT® 2.11NoNoYesYesYes
Beckhoff TwinCAT 3NoYesYesYesYes
CAREL SToneNoNoYesYesYes
Danfoss Alsmart DesignNoNoYesYesYes
GenericYesYesYesYesYes
KW-Software MULTIPROG® 5.0YesNoNoYesNo, converts to 16-bit integer
PLCopen XMLNoYesYesYesYes

Phoenix Contact® PC WORX™ 6.0

YesNoNoYesNo, converts to 16-bit integer
Rexroth IndraWorksNoYesYesYesYes
Selectron CAP1131NoNoYesNo, converts to single-precisionNo, converts to 32-bit integer