Application of Siemens PLC in Pneumatic System Monitoring
Pneumatic system monitoring using Siemens PLC can improve production efficiency by over 30% and reduce failure rates by 85%, making it a key technology in industrial automation.
1. Hardware Configuration
PLC and Expansion Module Selection
For pneumatic system monitoring, it is recommended to use the S7-1200 or S7-1500 series PLCs. For small to medium-sized pneumatic systems, choose CPU 1214C, while for large systems, it is advisable to use CPU 1517-3 PN/DP. For expansion modules, the analog input module SM 1231 AI can collect signals from pressure and flow sensors, while the digital input module SM 1221 DI is suitable for various switch state collections.
I/O Point Allocation Table
Address Symbol Name Function Description
I0.0 xStart System Start
I0.1 xStop System Stop
I0.2-I1.5 xCylinder_n_Front Cylinder n Front Position Detection
I1.6-I3.1 xCylinder_n_Back Cylinder n Back Position Detection
I4.0-I5.7 xPressureSwitch_n Pressure Switch n Status
IW64-IW72 aiPressure_n Pressure Sensor n Reading
IW80-IW88 aiFlowMeter_n Flow Meter n Reading
Q0.0-Q1.7 ySolenoidValve_n Solenoid Valve n Control
Q2.0 yAlarm Alarm Indication
Q2.1 yRunning Running Indication
Key Points of System Wiring
Analog sensors should use shielded twisted pairs with independent grounding.
Add an RC buffer circuit to the solenoid valve control circuit to suppress interference.
Position sensors should use three-wire NPN proximity switches, ensuring waterproof and dustproof measures.
Keep communication cables at least 30cm away from high voltage lines to reduce interference.
2. Control Program Design
Variable Definition Specifications
Variable naming follows Hungarian notation, with prefixes indicating data types:
x: Bool type (switch input)
y: Bool type (switch output)
ai: Analog input
m: Internal flag
t: Timer
c: Counter
db: Data block
Program Architecture Design
The program adopts a three-layer architecture design:
Main Program Layer (OB1): Executes cyclically, responsible for calling function blocks
Function Block Layer (FB): Implements specific functions
Data Block Layer (DB): Stores system parameters and operational data
OB1 Main [Main Loop]
|– FB1 SystemControl [System Control]
| |– DB1 SystemParameters [System Parameters]
|– FB2 PressureMonitoring [Pressure Monitoring]
| |– DB2 PressureData [Pressure Data]
|– FB3 FlowMonitoring [Flow Monitoring]
| |– DB3 FlowData [Flow Data]
|– FB4 AlarmHandling [Alarm Handling]
| |– DB4 AlarmData [Alarm Data]
|– FB5 DataLogging [Data Logging]
| |– DB5 HistoricalData [Historical Data]
Function Block Design – Example of Pressure Monitoring Function Block
// FB2 PressureMonitoring
// Function: Monitor pneumatic system pressure, detect anomalies, calculate statistics
// Input: Current pressure value, upper and lower limit parameters
// Output: Pressure status, statistical values, alarm status
// Input Parameters
VAR_INPUT
aiPressureValue : REAL; // Current pressure value
rPressureHigh : REAL; // Pressure upper limit
rPressureLow : REAL; // Pressure lower limit
xReset : BOOL; // Reset signal
END_VAR
// Output Parameters
VAR_OUTPUT
xPressureNormal : BOOL; // Pressure normal flag
xPressureHigh : BOOL; // Pressure high flag
xPressureLow : BOOL; // Pressure low flag
xPressureFluctuation : BOOL; // Pressure fluctuation flag
rPressureAvg : REAL; // Average pressure
END_VAR
// Static Variables
VAR
rPressureLast : REAL; // Last pressure value
rPressureSum : REAL; // Pressure accumulation
diSampleCount : DINT; // Sample count
rPressureMax : REAL; // Maximum pressure
rPressureMin : REAL; // Minimum pressure
tStableTimer : TON; // Stability timer
END_VAR
// Implementation Code
// 1. Pressure status determination
xPressureNormal := (aiPressureValue >= rPressureLow) AND (aiPressureValue <= rPressureHigh);
xPressureHigh := aiPressureValue > rPressureHigh;
xPressureLow := aiPressureValue < rPressureLow;
// 2. Pressure fluctuation detection
xPressureFluctuation := ABS(aiPressureValue – rPressureLast) > (rPressureHigh – rPressureLow) * 0.1;
// 3. Pressure statistical calculation
IF xReset THEN
rPressureSum := 0.0;
diSampleCount := 0;
rPressureMax := 0.0;
rPressureMin := 1000.0;
ELSE
// Accumulate pressure values
rPressureSum := rPressureSum + aiPressureValue;
diSampleCount := diSampleCount + 1;
// Update maximum and minimum values
rPressureMax := MAX(rPressureMax, aiPressureValue);
rPressureMin := MIN(rPressureMin, aiPressureValue);
// Calculate average value
IF diSampleCount > 0 THEN
rPressureAvg := rPressureSum / INT_TO_REAL(diSampleCount);
END_IF;
END_IF;
// Update last pressure value
rPressureLast := aiPressureValue;
3. Data Management and Storage
Parameter Configuration Table – Data Block Example
// DB1 SystemParameters
// Function: Store system configuration parameters
// Access: Global read/write
STRUCT
// General system parameters
sSystemName : STRING[30] := ‘Pneumatic Monitoring System’; // System Name
diSystemVersion : DINT := 101; // System Version Number (1.0.1)
// Pressure monitoring parameters
rPressureHighLimit : ARRAY[1..8] OF REAL := [8.5, 8.5, 8.5, 8.5, 8.5, 8.5, 8.5, 8.5]; // Pressure Upper Limit (bar)
rPressureLowLimit : ARRAY[1..8] OF REAL := [4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5, 4.5]; // Pressure Lower Limit (bar)
rPressureAlarmDelay : ARRAY[1..8] OF TIME := [T#2S, T#2S, T#2S, T#2S, T#2S, T#2S, T#2S, T#2S]; // Alarm Delay
// Flow monitoring parameters
rFlowHighLimit : ARRAY[1..8] OF REAL := [100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0]; // Flow Upper Limit (L/min)
rFlowLowLimit : ARRAY[1..8] OF REAL := [5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0]; // Flow Lower Limit (L/min)
// Data logging parameters
tSampleInterval : TIME := T#10S; // Sample Interval
diMaxRecords : DINT := 1000; // Maximum Record Count
xEnableDataLogging : BOOL := TRUE; // Enable Data Logging
// Communication parameters
sIPAddress : STRING[15] := ‘192.168.0.10’; // IP Address
diPort : DINT := 502; // Communication Port
xEnableRemote : BOOL := TRUE; // Enable Remote Access
END_STRUCT
Operational Data Logging
To monitor the health status of the system, the following data should be recorded regularly:
Pressure and flow peak and valley values of each air circuit
Cylinder action counts and cycles
Leakage rate calculation data (pressure drop/time)
System energy consumption data
Data collection cycles should be set according to the application scenario:
Fast Monitoring: 100ms/each
Standard Monitoring: 1s/each
Long-term Trend: 1min/each
4. Fault Diagnosis and Troubleshooting
Common Fault Analysis
Fault Phenomenon Possible Causes Diagnosis Method Solution
System pressure fluctuation	1. Unstable air supply
2. Leakage
3. Sensor failure	1. Monitor pressure curve
2. Check gradient changes	1. Adjust pressure reducing valve
2. Locate leakage points
3. Calibrate sensor
Cylinder action delay	1. Increased friction
2. Air circuit blockage
3. Insufficient air source pressure	1. Measure action time
2. Monitor load flow	1. Replace cylinder seal
2. Clean air circuit
3. Check air source
Abnormal system air consumption	1. Leakage
2. Pneumatic component damage
3. Control logic error	1. Leak test in shutdown state
2. Segment testing	1. Replace seal
2. Repair component
3. Optimize program
Control failure	1. Solenoid valve failure
2. I/O module failure
3. Program anomaly	1. Forced output test
2. Monitor I/O status	1. Replace solenoid valve
2. Replace module
3. Restore program
Status Control Design
Pneumatic system monitoring adopts a state machine design, mainly including the following states:
Initialization (INIT): System startup self-check
Standby (STANDBY): Waiting for start command
Running (RUNNING): Normal monitoring state
Alarm (ALARM): Abnormal state handling
Maintenance (MAINTENANCE): System maintenance mode
// State control code snippet
CASE #sysState OF
INIT: // Initialization
// System self-check, sensor calibration
#InitSystem();
IF #xInitDone THEN
#sysState := STANDBY;
END_IF;
STANDBY: // Standby
// Standby state, waiting for start
IF #xStart AND NOT #xError THEN
#sysState := RUNNING;
ELSIF #xMaintBtn THEN
#sysState := MAINTENANCE;
END_IF;
RUNNING: // Running
// Normal monitoring logic
#RunMonitoring();
IF #xStop THEN
#sysState := STANDBY;
ELSIF #xAlarmActive THEN
#sysState := ALARM;
END_IF;
ALARM: // Alarm
// Alarm handling
#HandleAlarm();
IF #xAlarmReset AND NOT #xAlarmActive THEN
#sysState := STANDBY;
END_IF;
MAINTENANCE: // Maintenance
// Maintenance mode
#MaintenanceMode();
IF #xMaintExit THEN
#sysState := INIT; // Reinitialize after exiting maintenance
END_IF;
ELSE // Undefined state
#sysState := INIT; // Restore to initial state
END_CASE;
5. User Interface Design
Interface Layout Description
The HMI interface adopts a multi-level structure:
Main Interface: Displays overall system status, provides navigation buttons
Monitoring Interface: Real-time display of pressure and flow curves, device status
Parameter Settings: System parameter configuration, permission management
Alarm Interface: Alarm information display, confirmation and reset
Trend Analysis: Historical data trend charts, export function
Main interface design key points:
Left Navigation Area: System function switching
Central Display Area: Overview of system status, display of key indicators
Right Operation Area: Control buttons, login information
Bottom Information Bar: Alarm information scrolling, system time, network status
Key visual elements of the monitoring interface:
Pressure/Flow Dashboard: Intuitive display of current values
Real-time Curve: Recent change trends
Cylinder Status Indicator: Animation showing current position
Solenoid Valve Status: Color indication of current on/off state
The monitoring system achieves efficient pneumatic system status monitoring through Siemens PLC, enhancing equipment reliability. We welcome the exchange of experiences and discussions on more intelligent monitoring solutions for pneumatic systems!