Siemens S7-TCP/IP Devices
The S7 TCP/IP (Simatic Step 7 - Transmission Control Protocol / Internet Protocol) is used to communicate with S7-300/400 or S7-1500 PLCs.
| More information about how to configure this device is available in the PLC Datasource hands-on section of the documentation. |
TIA Devices (Symbolic Addressing)
The S7 TCP/IP TIA stands for Simatic Step 7 - Transmission Control Protocol / Internet Protocol with the TIA (Totally Integrated Automation) Portal. This type of device supports automatic browsing through the PLC name space. It uses symbolic addresses, whereby symbolic names are assigned to the absolute addresses. This type of device can translate the symbolic names into the required absolute addresses automatically.
In order to connect with the PLC, it is necessary to provide the Host Name or IP during configuration.
I/O-Items can also be created manually, if the path to the TIA tag or component is known. The following
script creates an I/O-Item which reads data from a string tag with symbolic address PLC.Blocks.DB1.Text:
syslib.mass({
{
class = syslib.model.classes.IoItem,
operation = syslib.model.codes.MassOp.UPSERT,
path = "/System/Core/Connector/S7-1500/Text",
ObjectName = "Text",
ItemID = "PLC.Blocks.DB1.Text"
}
})
The connection type of a S7-TCP/IP TIA devices specifies how inmation identifies itself when connecting to the PLC. There are 3 Connection Types for this type of device:
-
HMI: Connect to the PLC as HMI (Human Machine Interface).
-
Dev: Connect to the PLC as a development system (TIA Portal).
-
Other: Connect to the PLC as a generic system.
Non-TIA Devices (Absolute Addressing)
With absolute addressing the PLC’s namespace cannot be browsed, so I/O Items need to be created manually. As data is directly read from and written to the memory of the device, each I/O Item needs to have its ItemID property configured, comprising the address identifier and the memory location.
For example, I/O Items can be created using the following Lua scripting Mass configuration example:
syslib.mass({
{
class = syslib.model.classes.IoItem,
operation = syslib.model.codes.MassOp.UPSERT,
path = "/System/Core/Connector/S7-300/DT1",
ObjectName = "DT1",
ItemID = "DB1.DT14",
IoType = syslib.model.codes.IoTypeMode.IOITEMTYPEPLCS7_300_400
}
})
For a detailed description of the ItemID syntax, see the S7-TCP/IP ItemID section.
The available connection types for this device are:
-
OP Connection
-
PG Connection
-
Projected
-
Routing
-
Other
Supported Data Types
The tables below list supported data types by inmation when communicating with a Siemens S7 PLC. Not all types are supported by every S7 PLC model, consult the Siemens documentation of your device for details.
Elementary Data Types
The following elementary data types are supported:
| Data Type | Description | Normalized Type | Range | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Binary numbers |
|||||||||||||
BOOL |
Single bit value |
VT_BOOL |
0 or 1 |
||||||||||
Bit strings |
|||||||||||||
BYTE |
Bit string of 8 bits |
VT_I1 |
0x00 … 0xFF |
||||||||||
WORD |
Bit string of 16 bits |
VT_I2 |
0x0000 … 0xFFFF |
||||||||||
DWORD |
Bit string of 32 bits |
VT_I4 |
0x00000000 … 0xFFFFFFFF |
||||||||||
LWORD |
Bit string of 64 bits |
VT_I8 |
0x0000000000000000 … 0xFFFFFFFFFFFFFFFF |
||||||||||
Integers |
|||||||||||||
SINT |
Signed 8-bit integer value |
VT_I1 |
-128 … 127 |
||||||||||
INT |
Signed 16-bit integer value |
VT_I2 |
-32,768 … 32,767 |
||||||||||
DINT |
Signed 32-bit integer value |
VT_I4 |
-2,147,483,648 … 2,147,483,647 |
||||||||||
USINT |
Unsigned 8-bit integer value |
VT_UI1 |
0 … 255 |
||||||||||
UINT |
Unsigned 16-bit integer value |
VT_UI2 |
0 … 65,535 |
||||||||||
UDINT |
Unsigned 32-bit integer value |
VT_UI4 |
0 … 4,294,967,295 |
||||||||||
LINT |
Signed 64-bit integer value |
VT_I8 |
-9,223,372,036,854,775,808 … 9,223,372,036,854,775,807 |
||||||||||
ULINT |
Unsigned 64-bit integer value |
VT_UI8 |
0 … 18,446,744,073,709,551,615 |
||||||||||
Floating-point numbers |
|||||||||||||
REAL |
32-bit IEEE single-precision floating point value |
VT_R4 |
\$-3.40282347E^38...-1.17549435E^-38\$ (negative values) 0 \$1.17549435E^-38...3.40282347E^38\$ (positive values) |
||||||||||
LREAL |
64-bit IEEE double-precision floating point value |
VT_R8 |
\$-1.7976931348623157E^308 ... -2.2250738585072014E^−308\$ (negative values) 0 \$2.2250738585072014E^−308 ... 1.7976931348623157E^308\$ (positive values) |
||||||||||
Timers |
|||||||||||||
S5TIME |
A 16-bit timer, representing a duration as the product from a time in the range 0 to 999 and a time basis. The time basis encodes the resolution of the duration. |
VT_I4 |
inmation provides this data as a number of milliseconds: 0 … 9990000 |
||||||||||
TIME |
A 32-bit timer, representing a signed duration as a number of milliseconds. |
VT_I4 |
-2,147,483,648 … 2,147,483,647 which is equal to -24d 20h 31m 23s 648ms … 24d 20h 31m 23s 647ms |
||||||||||
LTIME |
A 64-bit timer, representing a signed duration as a number of nanoseconds. |
VT_I8 |
-9,223,372,036,854,775,808 … 9,223,372,036,854,775,807 which is equal to -106751d 23h 47m 16s 854ms 775μs 808ns … 106751d 23h 47m 16s 854ms 775μs 807ns |
||||||||||
Date and time |
|||||||||||||
DATE |
A 16-bit unsigned integer representation of the number of days since 1990-01-01. |
VT_UI2 |
0 … 65,535 which is equal to 1990-01-01 … 2169-06-06 |
||||||||||
TIME_OF_DAY (TOD) |
A 32-bit unsigned integer representation of the number of milliseconds since the beginning of the day. |
VT_UI4 |
0 … 4,294,967,295 which is equal to 00:00:00.000 … 23:59:59.999 |
||||||||||
LTOD (LTIME_OF_DAY) |
A 64-bit unsigned integer representation of the number of nanoseconds since the beginning of the day. |
VT_UI8 |
0 … 18,446,744,073,709,551,615 which is equal to 00:00:00.000000000 … 23:59:59.999999999 |
||||||||||
Complex Data Types
The following complex data types are supported:
| Data Type | Description | Normalized Type | Range |
|---|---|---|---|
DT (DATE_AND_TIME) |
Represents date and time information. inmation provides this data as a JSON string in the I/O Items value, e.g.:
|
VT_BSTR |
1990-01-01-00:00:00.000 … 2089-12-31-23:59:59.999 |
LDT |
Represents date and time-of-day information in nanoseconds since 1970-01-01 00:00:00. |
VT_I8 |
1970-01-01-00:00:00.000000000 … 2262-04-11-23:47:16.854775807 |
DTL |
Represents date and time information in a structured way. inmation provides this data as a JSON string in the I/O Items value, e.g.: [source,json] ---- { "year":2019, "month":9, "weekDay":2, "day":22, "hour":15, "minute":27, "second":51, "nanosecond":314 } ---- |
VT_BSTR |
1970-01-01-00:00:00.000000000 … 2262-04-11-23:47:16.854775807 |
Character strings |
|||
CHAR |
Represents a single character in ASCII coding. |
VT_BSTR |
ASCII character set |
WCHAR |
Represents a single character of an expanded character set in UTF-16 coding. inmation provides this data as a UTF-8 encoded string in the I/O Items value. |
VT_BSTR |
$0000 … $D7FF |
STRING |
Represents a string of up to 254 characters of the codepage used to create the string. See the Siemens documentation for details. inmation uses the current codepage of the system the Datasource is running on to convert the string to UTF-8 encoding for the I/O Items value. |
VT_BSTR |
0 to 254 characters |
WSTRING |
Represents Unicode characters of type WCHAR in one character string. inmation converts the string data to UTF-8 encoding for the I/O Items value. |
VT_BSTR |
0 to 16382 characters |
ARRAY |
Represents a fixed number of components of the same data type. |
VT_ARRAY |
|
STRUCT (anonymous) |
Represents a data structure that consists of a fixed number of components of different data types. inmation supports direct access to individual structure components. |
<type of component> |
|