S7 (Siemens)
The S7 protocol allows for direct, real-time communication with the Siemens Simatic PLC family. By using a native driver, it offers significantly lower latency than alternatives like OPC UA, making it ideal for applications requiring high response speeds.
Connection Parameters
To configure communication with the Siemens PLC, define the following fields:
- Name (Nombre): Unique identifier for the protocol.
- IP Address (Dirección IP): The IP address of the PLC on the network.
- Rack: The rack number where the CPU is located (typically
0). - Slot: The slot number where the CPU is located (typically
1for S7-1200/1500 and2for S7-300).
Variable Configuration
The S7 driver directly accesses the PLC's memory areas. For communication to work correctly, it is essential that the data blocks (DBs) being accessed have optimized access disabled in TIA Portal.
- Name (Nombre): Identifying name of the variable in InDataX.
- Type (Tipo): Data type (Real, Integer, Counter, etc.).
- Audit trail: Audit record for value changes.
- Record value (Registrar valor): Inclusion in the Thing's historical records.
- PLC Address (Dirección PLC): The exact memory address of the data.
Addressing Syntax
For InDataX to read from or write to the PLC, the address must follow a specific format that combines the memory area, data type, and position.
General Format
[Block Type][Block Number],[Data Type][Start Byte].[Bit Number]
Siemens' optimized access prevents direct addressing by offset. Ensure your DBs are "standard" (non-optimized) and that you have downloaded the configuration to the PLC before attempting to read from InDataX.
Address Components
| Component | Description | Possible Values |
|---|---|---|
| Block Type | PLC Memory Area | DB (Data Block), CT (Counter), MK (Merker/Markers), PA (Peripheral Outputs), PE (Peripheral Inputs), TM (Timer) |
| Block Number | Block Identifier | DB number or area number (e.g., 1, 01) |
| Data Type | Value Format | BI (Bit), BY (Byte), IN (Integer 16b), DI (Double Integer 32b), RE (Real/Float 32b) |
| Start Byte | Memory Offset | Position of the first byte (e.g., 0, 4, 10) |
| Bit Number | Only for BI type | Bit index within the byte (0 to 7) |
Common Examples
DB1,RE0: Reads a Real value from DB 1 starting at Byte 0.DB10,DI4: Reads a Double Integer from DB 10 starting at Byte 4.DB5,BI10.2: Reads Bit 2 of Byte 10 inside DB 5.MK0,BY5: Reads Byte 5 from the Merker area.
Troubleshooting and Optimization
To ensure optimal performance in communication with Siemens PLCs, it is important to consider the following scenarios:
Non-Existent or Incorrect Addresses
InDataX optimizes reading by grouping variables by memory blocks (same block type and number). This reduces the number of requests to the PLC. However, if a single variable has an incorrect address or one that does not exist on the PLC, the reading of the entire group of variables to which it belongs will fail.
- Solution: Verify that all offsets and DB numbers physically exist on the PLC and that the DB is not smaller than the requested offset.
Accumulation of Connection Errors
If you have multiple protocols configured that suffer from continuous connection or reading errors, constant retries can degrade the overall performance of the system.
- Solution: Temporarily disable protocols that are not in use or whose devices are offline to free up processing resources.
Performance Limits and Large Volumes
Although InDataX is highly efficient, managing more than 10,000 variables in a single S7 protocol can cause latency and performance issues.
- Solution:
- Split by protocols: Divide the load into several S7 protocols (which will open multiple parallel connections to the PLC).
- Distributed architecture: Consider splitting the load among different InDataX nodes or systems connected to each other to distribute the processing.