Siemens S7
The S7 plugin talks to Siemens PLCs through snap7, reading data blocks over TCP. It polls: at the rate you set, it asks the PLC for the bytes your signals are in and turns each response into one sample.
It only reads. VizuaLog never writes to a PLC.
Several S7 interfaces can run in one session, so a cell with several controllers is one session with one interface per PLC.
Config fields
Section titled “Config fields”| Field | Type | Default | Notes |
|---|---|---|---|
| IP | text | 192.168.0.1 | The PLC’s address. Validated as IPv4 |
| Rack | number | 0 | 0 – 10 |
| Slot | number | 2 | 0 – 10. Typically 1 for S7-1200/1500, 2 for S7-300/400 |
| Port | number | 102 | 102 – 65535. ISO-TSAP is 102; change it only behind a gateway |
| Poll interval (Hz) | slider | 20 | 10 – 100 |

Addressing
Section titled “Addressing”| Field | Required | Meaning |
|---|---|---|
db | Yes | Data block number. Its presence is what marks a signal as S7 |
byteOffset | Yes | Byte position of the value within that data block |
bit | bool only | Bit 0–7 within the byte. Defaults to 0 |
How a poll is executed
Section titled “How a poll is executed”Signals are grouped by data block. For each block the plugin reads one range in one request,
from the lowest byteOffset to the end of the highest, then picks each signal’s value out of
the bytes.
Each signal’s dataType decides how many bytes are read at its offset and how they are read. You
can write the types as TIA Portal shows them:
| TIA Portal | Write | Bytes |
|---|---|---|
Bool | bool | 1 (one bit of it, selected by bit) |
Byte | uint8 | 1 |
SInt / USInt | int8 / uint8 | 1 |
Int / UInt | int16 / uint16 | 2 |
Word | uint16 | 2 |
DInt / UDInt | int32 / uint32 | 4 |
DWord | uint32 | 4 |
Real | float32 | 4 |
LReal | float64 | 8 |
Both spellings work. A signal with a db key is read in the S7 dialect, so "Real", "DInt"
and "Word" are accepted alongside the canonical names. You can copy a data block as it is.
Every poll emits one value per signal, in signal order. A signal without a usable db or
byteOffset keeps its slot and reads NaN, so it cannot shift the signals after it. NaN
instead of 0.0 keeps an unread signal distinct from a real zero.
A data block with signals at offset 0 and offset 1200 is read as one 1200-byte range. Keep logged signals close together in the DB to keep polls small.
Connection states
Section titled “Connection states”A PLC accepting the connection does not mean data arrives. With wrong data block numbers the CPU answers and then returns nothing, so the states are:
| State | Means |
|---|---|
| Waiting for data… | The PLC answered. No poll has returned data yet |
| Connected | A poll has succeeded and readings are arriving |
| Not receiving data! | Readings were arriving and stopped, after three poll intervals or one second, whichever is longer |
| Connection failed… | The connection attempt failed, or the schema has no S7 addressing |
| Connection lost! | Reads failed repeatedly and the link was given up |
A schema with no S7 addressing refuses to start: “No signals with S7 addressing (db +
byteOffset) — nothing to read”. Every signal needs both db and byteOffset.
Example
Section titled “Example”Two REALs and two BOOLs in DB 100, written in TIA Portal spellings:
{ "dataSignals": [ { "name": "MotorTemp", "description": "Drive-end bearing temperature", "unit": "°C", "dataType": "Real", "minValue": 0, "maxValue": 150, "db": 100, "byteOffset": 0 }, { "name": "MotorSpeed", "unit": "rpm", "dataType": "Real", "minValue": 0, "maxValue": 3000, "db": 100, "byteOffset": 4 }, { "name": "MotorRunning", "dataType": "Bool", "db": 100, "byteOffset": 8, "bit": 0 }, { "name": "OverTempAlarm", "dataType": "Bool", "db": 100, "byteOffset": 8, "bit": 1 } ]}PLC-side setup
Section titled “PLC-side setup”The db, byteOffset and bit values in your file must match the PLC’s
layout. VizuaLog cannot check them against the program, and a wrong offset returns a plausible
but wrong number.
On an S7-1200 or S7-1500, snap7 can only read data blocks after two changes in TIA Portal:
- In the CPU properties, under Protection & Security → Connection mechanisms, enable Permit access with PUT/GET communication from remote partner.
- In the properties of each data block you read, under Attributes, clear Optimized block
access. An optimized block has no fixed byte layout, so
byteOffsethas nothing to point at.
Compile and download the program to the CPU afterwards. S7-300 and S7-400 CPUs need neither change.
Limitations
Section titled “Limitations”- A block is read across its whole extent. Signals at offset 0 and 5000 in one DB read 5000 bytes every cycle. Keep polled signals near each other, or split them across data blocks.
- No poll-overrun detection. If a cycle takes longer than the interval, because of a large extent, a busy CPU or a slow network, the real rate drops with no warning. Check timestamps in a recording if the rate matters.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Where to look |
|---|---|
| Cannot connect | Address, rack and slot. Slot is 1 on most S7-1200/1500 and 2 on S7-300/400, and a wrong slot fails exactly like a wrong address |
| Connection failed immediately, with a message about addressing | The schema has no signal with both db and byteOffset, so the poll is refused |
| Stuck on Waiting for data… | The CPU answered but no poll has returned. Wrong data block numbers do exactly this. On an S7-1200/1500, so do PUT/GET access being off and optimized data blocks (see PLC-side setup) |
| Connects, then drops | Another master may hold the connection resource, or the poll rate is more than the PLC will serve; lower it |
| Stays on Reconnecting… | The PLC is still unreachable: power, cable, network or a stopped PLCSIM. It picks up on its own when the PLC is back; press Disconnect to stop retrying |
A signal reads NaN | It has no db or no byteOffset in the file |
| Values are wrong but stable | Offsets are off, or the declared type does not match the DB layout. A DINT read as Real is the classic |
| Values update far slower than the poll rate | The DB span being read is large. Check how far apart the offsets in that block are |
All of these messages are kept in full in the event log after the toast has gone.