Air tightness testing is a key aspect of product quality control. Implementing automated testing through Siemens PLC can significantly enhance efficiency and accuracy.
1. Hardware Configuration
Selection of PLC and Expansion Modules
The air tightness testing system requires high precision in data acquisition and response speed. It is recommended to use the S7-1200 series CPU 1214C as the main control unit, along with the following expansion modules:
SM 1231 AI 4×16bit Analog Input Module: Used for collecting pressure sensor data
SM 1232 AQ 2×14bit Analog Output Module: Used for controlling proportional valves
SM 1222 DQ 16×24VDC Digital Output Module: Used for controlling solenoid valves in the air circuit
I/O Point Allocation Table
Address Device Description Function Description
%I0.0 Start Button System Start
%I0.1 Stop Button System Stop
%I0.2 Emergency Stop Button Emergency Stop
%I0.3 Workpiece Detection Sensor Detects workpiece position
%I0.4 Air Source Pressure Switch Monitors air source status
%Q0.0 Air Source Solenoid Valve Controls main air source
%Q0.1 Inflation Solenoid Valve Controls inflation
%Q0.2 Pressure Relief Solenoid Valve Controls pressure relief
%Q0.3 Clamping Cylinder Controls workpiece clamping
%Q0.4 Pass Indicator Light Indicates successful test
%Q0.5 Fail Indicator Light Indicates failed test
%IW64 Pressure Sensor Monitors chamber pressure
%QW64 Proportional Pressure Regulator Precisely controls inflation pressure
2. Control Program Design
Program Architecture Design
The control program for air tightness testing adopts a three-layer architecture design:
Main Control Layer (OB1): System initialization, periodic function block calls, state management
Function Layer (FB): Testing process control, data acquisition processing, alarm monitoring
Data Layer (DB): Parameter configuration, historical data, status information
Function Block Design
//FB1: Air Tightness Testing Function Block
FUNCTION_BLOCK “LeakTest”
TITLE = ‘Air Tightness Testing Function Block’
{ S7_Optimized_Access := ‘TRUE’ }
VAR_INPUT
Start: Bool; //Start testing
Reset: Bool; //Reset
TargetPressure: Real; //Target pressure (bar)
StabilizationTime: Time; //Stabilization time (ms)
TestTime: Time; //Testing time (ms)
PressureDropLimit: Real; //Pressure drop limit (bar)
END_VAR
VAR_OUTPUT
Busy: Bool; //Testing in progress
Done: Bool; //Testing completed
Error: Bool; //Error
ErrorID: Int; //Error code
TestResult: Bool; //Test result: TRUE=pass, FALSE=fail
ActualPressureDrop: Real; //Actual pressure drop value (bar)
END_VAR
VAR
State: Int; //State machine state
PressureInitial: Real; //Initial pressure value
PressureFinal: Real; //Final pressure value
Timer1: TON; //Stabilization timer
Timer2: TON; //Testing timer
PressureDB: Array[0..99] of Real; //Pressure data buffer
DataIndex: Int; //Data index
END_VAR
BEGIN
//State machine implementation
CASE State OF
0: //Ready state
IF Start AND NOT Error THEN
State := 10;
Busy := TRUE;
Done := FALSE;
TestResult := FALSE;
DataIndex := 0;
END_IF;
10: //Inflation phase
//Control proportional valve output
//Monitor pressure rise
//Transition to next state after reaching target pressure
IF ActualPressure >= TargetPressure THEN
State := 20;
Timer1(IN:=FALSE);
END_IF;
20: //Stabilization phase
Timer1(IN:=TRUE, PT:=StabilizationTime);
//Save pressure data to buffer
IF Timer1.Q THEN
PressureInitial := ActualPressure;
State := 30;
Timer2(IN:=FALSE);
END_IF;
30: //Testing phase
Timer2(IN:=TRUE, PT:=TestTime);
//Save pressure data to buffer
IF Timer2.Q THEN
PressureFinal := ActualPressure;
ActualPressureDrop := PressureInitial – PressureFinal;
TestResult := (ActualPressureDrop <= PressureDropLimit);
State := 40;
END_IF;
40: //Result phase
Busy := FALSE;
Done := TRUE;
State := 0;
100: //Error handling
Error := TRUE;
Busy := FALSE;
Done := TRUE;
END_CASE;
//Error detection logic
IF Reset THEN
State := 0;
Error := FALSE;
ErrorID := 0;
Busy := FALSE;
Done := FALSE;
END_IF;
END_FUNCTION_BLOCK
3. Data Management and Storage
Parameter Configuration Table
The parameters of the air tightness testing system are managed through a global data block:
DATA_BLOCK “LeakTestParams”
TITLE = ‘Air Tightness Testing Parameters’
{ S7_Optimized_Access := ‘TRUE’ }
VERSION : 0.1
VAR
//System parameters
SystemName : String[30] := ‘Air Tightness Testing System’;
SystemVersion : String[10] := ‘V1.0’;
//Testing parameters
Products : Array[1..10] of “ProductType”;
CurrentProductID : Int := 1;
//Statistical data
TotalTests : UDInt := 0;
PassedTests : UDInt := 0;
FailedTests : UDInt := 0;
//Calibration data
CalibrationDate : Date;
CalibrationFactor : Real := 1.0;
END_VAR
//Custom Product Parameter Type
STRUCT “ProductType”
ProductID : Int;
ProductName : String[30];
TargetPressure : Real := 3.0; //Target pressure (bar)
StabilizationTime : Time := T#3S; //Stabilization time
TestTime : Time := T#5S; //Testing time
PressureDropLimit : Real := 0.05; //Allowed pressure drop (bar)
END_STRUCT;
BEGIN
//Product preset parameter initialization
Products[1].ProductID := 1;
Products[1].ProductName := ‘Small Pipe Fitting’;
Products[1].TargetPressure := 2.5;
Products[1].StabilizationTime := T#2S;
Products[1].TestTime := T#5S;
Products[1].PressureDropLimit := 0.03;
Products[2].ProductID := 2;
Products[2].ProductName := ‘Medium Pipe Fitting’;
Products[2].TargetPressure := 3.0;
Products[2].StabilizationTime := T#3S;
Products[2].TestTime := T#6S;
Products[2].PressureDropLimit := 0.04;
END_DATA_BLOCK
Operational Data Logging
System operational data is stored using the DataLog function, recording the following information after each test:
Test timestamp
Product ID and name
Testing parameters (target pressure, testing time, etc.)
Test result (pass/fail)
Actual pressure drop value
Operator ID
4. System Debugging Methods
Step-by-step Debugging Method
The debugging of the air tightness testing system should follow the principle of starting from simple to complex:
I/O Point Testing: Test input and output signals one by one
//Manual force output test
“Air Source Solenoid Valve” := TRUE;
//Delay 1 second
“Air Source Solenoid Valve” := FALSE;
Air Circuit Control Testing: Verify solenoid valve operation and air circuit sealing
Manually control each solenoid valve and observe changes in air circuit pressure
Check for leaks at pipeline connection points
Pressure Sensor Calibration:
Use a precision pressure gauge as a reference
Calibrate at multiple pressure points
Adjust sensor linearization parameters
Function Block Unit Testing:
Test the LeakTest function block using simulated input signals
Verify the conditions for state transitions
Confirm the correctness of testing logic and calculation results
Exception Simulation Testing
To ensure system stability, the following exception simulation tests should be conducted:
Pressure Source Anomaly: Simulate insufficient or fluctuating air source pressure
Leak Simulation: Use standard parts with known leak rates
Electrical Interference: Test system stability in a high-interference environment
Sensor Failure: Simulate sensor signal interruption or anomalies
5. Fault Diagnosis and Troubleshooting
Common Fault Analysis
Fault Phenomenon Possible Cause Troubleshooting Method
System does not start 1. Emergency stop button pressed<br>2. Insufficient air source pressure<br>3. PLC not powered on 1. Check emergency stop circuit<br>2. Confirm normal air source pressure<br>3. Check power indicator light
Pressure cannot reach set value 1. Insufficient air source pressure<br>2. Proportional valve failure<br>3. Pipeline leakage 1. Check air source pressure<br>2. Test proportional valve output<br>3. Check connection points with soapy water
High false positive rate 1. Parameter settings unreasonable<br>2. Low accuracy of pressure sensor<br>3. Large environmental temperature changes 1. Optimize testing parameters<br>2. Calibrate or replace sensor<br>3. Control environmental temperature
Data recording anomalies 1. SD card failure<br>2. DataLog function not configured<br>3. CPU overload 1. Replace SD card<br>2. Check DataLog configuration<br>3. Optimize program execution
Using Diagnostic Tools
Use the diagnostic tools provided by TIA Portal for troubleshooting:
Online diagnostics: Monitor CPU status and system errors
Variable monitoring table: Track changes in key variables
Trace function: Record pressure curves to analyze leakage characteristics
System logs: View system-level error information
Summary and Outlook
The air tightness testing system achieves fully automated control through Siemens PLC, improving testing efficiency and accuracy. We welcome you to share your implementation experiences and issues!