Siemens IDE Requirements
Target PLCs and Supported Data Types
To choose your target PLC based on supported data types, see the options in this table.
Data Type | S7-300/400 | S7-1200 | S7-1500 |
BOOL | Yes | Yes | Yes |
BYTE | Yes | Yes | Yes |
WORD | Yes | Yes | Yes |
DWORD | Yes | Yes | Yes |
LWORD | No | No | Yes |
SINT | No | Yes | Yes |
INT | Yes | Yes | Yes |
DINT | Yes | Yes | Yes |
USINT | No | Yes | Yes |
UINT | No | Yes | Yes |
UDINT | No | Yes | Yes |
LINT | No | No | Yes |
ULINT | No | No | Yes |
REAL | Yes | Yes | Yes |
LREAL | No | Yes | Yes |
To generate code for your S7-300/400 series PLCs use the SIMATIC® STEP® 7 or TIA Portal as the target IDE. To generate code for your S7-1200 or S7-1500 series PLCs, use the TIA Portal: Double Precision as the target IDE.
Double-Precision Floating-Point Data Types
To generate code for your Siemens® targets that do not support double-precision, floating-point data types, use the SIMATIC STEP 7 or TIA Portal as the target IDE. At code generation, Simulink® PLC Coder™ converts this data type to single-precision real data types in the generated code. Design your model so that the possible precision loss of generated code numeric results does not change the expected semantics of the model.
To generate code for your Siemens targets that support double-precision, floating-point
types, use Siemens TIA Portal: Double Precision as the target IDE.
The generated code uses the LREAL
type for
double-precision, floating-point types in the model. For more
information, see Target IDE.
int8 Data Type and Unsigned Integer Types
To generate code for your Siemens targets that do not support the int8 data type and unsigned integer data types, use Siemens SIMATIC Step 7 or Siemens TIA Portal as the target IDE. At code generation, Simulink PLC Coder converts the int8 data type and unsigned integer data types to int16 or int32 in the generated code.
Design your model to use int16 and int32 data types as much as possible instead of int8 or unsigned integer data types. The Simulink numeric results by using the int8 data type or unsigned integer data types can differ from the numeric results produced by the generated structured text.
Design your model so that the effects of integer data type conversion of the generated code do not change the expected semantics of the model.
To generate code for your Siemens targets that support the int8 data type and unsigned integer data types, use Siemens TIA Portal: Double Precision as the target IDE. The generated code preserves the int8 data type and unsigned integer data types. For more information, see Target IDE.
Unsigned Fixed-Point Data Types
Do not use unsigned, fixed-point data types in your model to generate code for your Siemens targets that do not support unsigned integer data types. For more information about coder limitations for fixed-point data type support, see Fixed Point Simulink PLC Coder Structured Text Code Generation.
Enumerated Data Types
The Siemens SIMATIC STEP 7 and TIA Portal target IDEs do not support enumerated data types. Simulink PLC Coder converts this data type to 16-bit signed integer data type in the generated code for Siemens targets.
Naming Constraints
The Siemens TIA Portal target IDEs earlier than v17 throw an error when variable names or function block names in the generated code contain numbers. For example, if your generated code is:
FUNCTION_BLOCK xg1479016 VAR_INPUT In1: LREAL; END_VAR VAR_OUTPUT Out1: LREAL; END_VAR Out1 := In1*2; END_FUNCTION_BLOCK
. When you import this generated code the TIA Portal IDE , this error
message or warning is generated 'HEX value or unsigned
number exceeds the BYTE-WORD-DWORD limit'
. This
warning is thrown as the TIA Portal importer considers
xg1479016
as a number and the value
exceeds 65535.