Overview
The Dilution Control System supports native communication with Siemens S7 PLCs using the S7-TCP (ISO-on-TCP) protocol. This provides high-performance direct access to PLC data blocks without additional gateways.
Communication uses the SNAP7 open-source library, which provides S7 protocol implementation compatible with all S7 PLC families.
Supported Models
| PLC Family | Models | Notes |
|---|---|---|
| S7-1500 | All models | Recommended, best performance |
| S7-1200 | All models (V4.0+) | Ensure PUT/GET access enabled |
| S7-300 | CPU 31x, 31xC | With Ethernet CP or integrated |
| S7-400 | CPU 41x, 41xH | With Ethernet CP |
Configuration
PLC Prerequisites
Before connecting, configure the PLC in TIA Portal or STEP 7:
-
Enable PUT/GET Access (S7-1200/1500)
In TIA Portal: PLC Properties > Protection & Security > Connection mechanisms
- Check "Permit access with PUT/GET communication"
-
Configure Data Block Access
For each DB used:
- Disable "Optimized block access" (use standard access)
- Set DB to "Non-retained" if appropriate
-
Note the Rack/Slot Numbers
- S7-1200: Rack 0, Slot 1
- S7-1500: Rack 0, Slot 1
- S7-300/400: Check hardware configuration
Dilution Control Configuration
Connection Settings
| Protocol | Siemens S7-TCP |
|
| IP Address | 192.168.1.30 |
PLC IP address |
| Port | 102 |
ISO-on-TCP port |
| Rack | 0 |
Rack number |
| Slot | 1 |
CPU slot |
Data Blocks
Configure the data block addresses for setpoints and feedbacks:
Recommended DB Structure
DB100 - Setpoints (from Dilution Control)
| DB100.DBD0 | Zone 1 Setpoint | REAL (0-100%) |
| DB100.DBD4 | Zone 2 Setpoint | REAL (0-100%) |
| ... | ... | ... |
| DB100.DBD188 | Zone 48 Setpoint | REAL (0-100%) |
| DB100.DBW200 | Global Mode | INT |
| DB100.DBW202 | Heartbeat | INT |
DB101 - Feedbacks (to Dilution Control)
| DB101.DBD0 | Zone 1 Feedback | REAL (0-100%) |
| DB101.DBD4 | Zone 2 Feedback | REAL (0-100%) |
| ... | ... | ... |
| DB101.DBD188 | Zone 48 Feedback | REAL (0-100%) |
| DB101.DBW200 | System Status | INT |
Address Configuration
Data Block Settings
| Setpoint DB Number | 100 |
| Setpoint Start Offset | 0 |
| Feedback DB Number | 101 |
| Feedback Start Offset | 0 |
| Number of Zones | 48 |
| Data Type | REAL (4 bytes) |
PLC Program Requirements
The PLC program should handle:
Setpoint Processing
- Read setpoints from DB100
- Apply limits and ramp rates
- Output to analog modules controlling valves
- Handle mode switching (Auto/Manual)
Feedback Processing
- Read analog inputs from valve position sensors
- Scale to 0-100% range
- Write to DB101 for reading by Dilution Control
Watchdog Handling
// Check heartbeat in PLC program
IF DB100.Heartbeat = OldHeartbeat THEN
HeartbeatTimeout := HeartbeatTimeout + CycleTime;
IF HeartbeatTimeout > T#5s THEN
// Communication lost - hold last positions
CommLost := TRUE;
END_IF;
ELSE
OldHeartbeat := DB100.Heartbeat;
HeartbeatTimeout := T#0s;
CommLost := FALSE;
END_IF;
Testing
-
Test Connection
Click Test Connection. Verify "Connected to S7-xxx" message.
-
Monitor Feedbacks
Verify feedback values appear in the zone panel (0-100% range).
-
Test Manual Control
Set a zone to Manual, change setpoint, verify valve moves.
-
Verify Heartbeat
Monitor DB100.DBW202 in PLC - should increment every 500ms.
Troubleshooting
| Problem | Cause | Solution |
|---|---|---|
| Connection refused | PUT/GET not enabled | Enable PUT/GET in TIA Portal |
| Connection timeout | Wrong IP or port blocked | Verify IP, check firewall for port 102 |
| Wrong rack/slot | Configuration mismatch | S7-1200/1500: Rack 0, Slot 1 |
| Read error on DB | DB doesn't exist | Create DB in PLC program |
| Values all zero | Optimized block access | Disable optimized access for DB |