Siemens S7
S7 Communication is a network protocol built by Siemens and is used in their PLCs to read and write from and to variables.
The S7 communication protocol by Siemens does not meet today's security standards and should not be used.
The Siemens Target is compatible with the following PLCs:
300 | 400 | WinAC | 1200 | 1500 | |
---|---|---|---|---|---|
DB Read/Write | X | X | X | X | X |
EB Read/Write | X | X | X | X | X |
AB Read/Write | X | X | X | X | X |
MB Read/Write | X | X | X | X | X |
TM Read/Write | X | X | X | ||
CT Read/Write | X | X | X |
Siemens TIA Portal PLC Configuration
Some TIA Portal settings are required to activate the S7 communication:
DB Properties
Full Access
PUT/GET Communication
Target Configuration
The Siemens Target has the following parameters:
Host
: Host name or IP Address of the Siemens PLC.Port
: Port of the Siemens PLC. Default is102
.Rack
: Rack of the Siemens PLC.Slot
: Slot of the Siemens PLC.ConnectionType
: S7 connection type. Can bePg
,Op
orBasic
.TargetType
: The type is alwaysSiemens
for this Target.
For the common parameters, see the Introduction.
Corresponding Edge
configuration and Device Twin
definition to activate the Siemens Target service:
- Edge-UI
- Device Twin
S7
is in this example the Name
of the Target. This can be any unique name.
{
"S7": {
"Port": 102,
"Host": "192.168.1.20",
"Rack": 0,
"Slot": 1,
"ConnectionType": "Pg",
"TargetType": "Siemens",
"MessagesPerSecondLimit": 1.0,
"BufferSize": 1,
"Constants": {},
"Enabled": true
}
}
Data Streaming
S7 Communication is a address based protocol, therefore no discovery or name based signal access is possible. The syntax for the signal name is: Name,Area.Offset,DataType[,ArrayLength]
.
Name
: The output signal name used in all subsequent processing steps.Areas
:Inputs
:i, e, ib
Marker
:m, f
Outputs
:q, a, qb
Timer
:t, tm
Counter
:c, z, ct
Data Blocks
:DB[number]
Offset
: The offset in byte from the beginning of the specified area.DataType
:x
:Boolean
. When reading a register, the bit position can be added in square brackets. E.g.x[5]
.b
:Byte
w
:UInt16
dw
:UInt32
lw
:UInt64
si
:SByte
i
:Int16
di
:Int32
li
:Int64
r
:Float
dr
:Double
c
:Char ASCII (1 Byte)
wc
:Char Unicode (2 Bytes)
s
:String ASCII (1 Byte)
. The length of the string must be added in square brackets. E.g.s[12]
.ws
:String Unicode (2 Bytes)
. The length of the string must be added in square brackets. E.g.ws[12]
.
ArrayLength
: Length of the array to read. If not present, it defaults to1
.
The Signals to read or write are configured in the Router.
For information how signals are named and labeled in Data Lakes, please read the Data Lake documentation.