1 Introduction
PLCs are control devices specifically designed for industrial environments and can generally be used directly in industrial settings without special measures. However, in high-reliability centralized power supply locations such as subways, the power supply system contains high-power electrical equipment that often generates strong interference signals when switching on and off. These interference signals can enter the PLC system along power lines, directly through the forward and backward channels of the control system, or radiate from space to the CPU system in the form of a field, severely affecting the reliable operation of the measurement and control system. This paper proposes anti-interference design schemes for both the hardware and software of a substation PLC measurement and control system, effectively improving the operational reliability of the system.
2PLC hardware anti-interference
2.1 Power Supply Side
Suppressing interference introduced by the power supply system: Interference from the power grid and frequency fluctuations directly affect the reliability and stability of the PLC system. Suppressing power supply system interference is a key aspect of improving the PLC's anti-interference performance. This can be achieved by installing a filtering, isolation, shielding, and switching power supply system. The purpose of the filter is to suppress interference signals transmitted from the power line into the system. To suppress voltage fluctuations caused by the start-up and shutdown of large-capacity equipment on the power grid and maintain a stable supply voltage, a switching power supply can be used. Separate power supply systems: The PLC controller and I/O system are powered by their own isolation transformers, separate from the main power supply. This ensures that a power outage at the input/output points will not affect the controller's power supply.
2.2 Grounding side
Proper grounding is crucial for ensuring reliable PLC operation and can prevent damage from accidental voltage surges. The grounding wire should be connected to the machine's grounding terminal. The basic unit must be grounded; if an extension unit is used, its grounding point should be connected to the basic unit's grounding point. To suppress interference from the power supply and input/output terminals, the PLC should be connected to a dedicated grounding wire, separate from the grounding points of power equipment (such as motors). Furthermore, the grounding resistance should be less than 10 ohms, the grounding wire should be thick, the grounding area should be greater than 2 square millimeters, and the grounding point should ideally be close to the PLC device, with a distance of less than 50 meters. The grounding wire should avoid high-voltage circuits; if this is unavoidable, it should intersect perpendicularly, shortening the length of parallel traces. Practice has shown that grounding is often a vital means of suppressing noise and preventing interference. A good grounding method can significantly suppress the coupling of internal noise, prevent the intrusion of external interference, and improve the system's anti-interference capability.
2.3 Signal Side
To achieve complete isolation between input and output circuits, optocouplers have been widely used in control systems in recent years and are considered one of the most effective measures to prevent interference. Optocouplers have the following characteristics: First, because they are sealed within a casing, they are not affected by external light; second, because they transmit signals via light, they disconnect the ground wires between various components; third, the dynamic resistance of the LED is very small, while the internal resistance of interference sources is generally large, thus the interference signal that can be transmitted to the input and output of the optocoupler becomes very small; fourth, the transfer ratio of an optocoupler is generally much smaller than the amplification factor of a transistor, making it far less sensitive to interference signals than a transistor, and the LED in an optocoupler only emits light when a certain current flows through it. Therefore, even under high interference voltage amplitudes, the LED cannot emit light due to insufficient energy, thus effectively suppressing the interference signal.
In terms of hardware design, the PLC first underwent rigorous selection and optimization of components, and adopted some unique methods in circuit structure and manufacturing process. For example, opto-isolation measures were used in the input/output circuits to achieve electrical floating, which facilitates grounding and improves anti-interference performance; in addition to conventional analog filtering, digital filtering was also added to each I/O port; internal electromagnetic shielding measures were adopted to prevent radiation interference; and a more advanced power supply circuit was used to prevent interference signals introduced by the power supply loop.
3PLC software anti-interference
Although hardware measures are employed in anti-interference design, the causes of interference signals are complex and highly random, making it difficult to guarantee that the system is completely immune to interference. Therefore, software anti-interference techniques are often used as a supplement to hardware measures, serving as an auxiliary means. Software anti-interference methods are simple, flexible, convenient, and resource-efficient, and have been widely used in microcomputer-based measurement and control systems.
In software design, fault-tolerant techniques are typically employed to improve the reliability of monitoring systems. The working principle of fault-tolerant techniques is to allow errors or failures to occur in the system. When such errors or failures occur, the system automatically takes appropriate fault-tolerant measures to eliminate them or mitigate their impact on the system, thereby ensuring its normal operation.
This article uses Siemens S7 series PLCs to discuss software fault tolerance technology for RS-485 network monitoring systems.
3.1 Fault-Tolerant Technologies for Data Communication
The monitoring system communicates with each field measurement and control substation in a master-slave manner, using fixed-frame-length or variable-frame-length message formats to exchange data. That is, the master station actively and cyclically sends data request messages to the slave station, and the slave station responds with data messages only after accepting the request.
To eliminate illegal data caused by line interference, the monitoring system verifies the correctness of the received response data. If a data communication error is detected, the system automatically discards the data frame and resends a data request message to obtain the correct data from the substation's response.
Sometimes, due to line interference, busy substations, or other reasons, a substation may not respond to a request from the master station. In such cases, a limited number of timed retransmissions of the data request message can be used to restore normal communication. If the substation still does not respond after one retransmission, the system will report an error message and begin communication with the next substation. The corresponding program is as follows:
cscl : l"pa100-cfcs"//Intail PA100 unit - number of retransmissions
l1
>=i
jctxzd // If the number of retransmissions is greater than or equal to 2, the communication will be interrupted.
txzd : l"pa100-zhno"//Communication interrupt subroutine
l1
-i
slw3
lar1
l1
opn"pa100-ztdb"//Intelai PA100 Unit - Communication Status db
tdbb[ar1 , p# 0.0 ] // If an interruption occurs, the corresponding substation communication status byte is set to 1.
3.2 Fault-tolerant technology for monitoring system operation
When a monitoring system operates for an extended period of time, system errors may occur. To ensure the normal and reliable operation of the system, software watchdog fault tolerance technology is required to automatically detect and eliminate errors, thereby restoring the system to normal operation.
(1) Software implementation of the internal watchdog: The internal watchdog is used to monitor whether the data received by the CP340 is normal after the command frame is successfully sent. If the data reception is unsuccessful, it is determined whether the internal watchdog timer has expired. If the timer has not expired, it means that the data has not been fully received and the data reception continues. If the timer expires, it means that there is an error in the data reception process due to interference. At this time, it should jump to the timeout handling program. The relevant program is shown below:
a"pa100-fscg" // If the command frame sent by CP340 is successfully transmitted
ls5t#500ms // Set timer t1 to 500ms
sst1 // Start timer
.
.
.
an"pa100-jscg" // If cp340 fails to receive data
jccsjc // Jump to timeout detection procedure
.
.
.
csjc : at1 //Timeout
jccscl // Jump to timeout handler
juend
(2) Software implementation of external watchdog: When the monitoring system experiences a complete failure error in serial communication, i.e., the system has no response, the system can be reinitialized through an external watchdog, i.e., the serial communication module is reset first, and then the serial port is reopened to restore normal communication.
am23.2 // When bit m23.2 is 1, timer t3 is started.
ls5t#500ms
sst3
anm23.2 // Modify the token when bit 23.2 is 0.
jcglp
call "p_rcv" , db2 // bit 23. When 2 is 1, reset the system receive function block.
en_r : = false
r : =true
laddr : =256
db_no : =4
dbb_no : =0
ndr : ="pa100-jscg"
error : ="pa100-jserror"
len : ="pa100-jslen"
status : ="pa100-jsstatus"
at3 //When the timer expires, change the token.
jcglp
juend
glp : l0 // Modify the token program to return to normal polling.
t"pa100-token"
set
rt3 // Reset timer t3
rm23.2 // Reset m23.2
end : nop0
(3) Software implementation of the PLC scan cycle watchdog: The PLC scan cycle watchdog is an effective measure to improve system reliability. It is a monitoring timer set inside the PLC. This is a hardware clock set to monitor the scan time of the PLC each time. It is preset with a specified time, and the scan time is monitored in each scan cycle to see if it exceeds the specified value. If the program runs normally, the watchdog is reset in the common processing stage of each scan cycle to avoid system failure due to the PLC entering an infinite loop during program execution or executing a program other than the intended one, which could lead to system paralysis. If the program runs abnormally and enters an infinite loop, the watchdog will not be cleared in time and will overflow, giving an alarm signal or stopping the PLC.
4. Conclusion
This paper details the anti-interference design of a PLC measurement and control system for substations. An anti-interference design scheme is proposed for the substation's operating environment, effectively improving the system's reliability through both hardware and software anti-interference measures. The system has been put into use, and operational results demonstrate that the implemented anti-interference measures effectively enhance system reliability.