PLC program debugging can be divided into two processes: simulation debugging and on-site debugging. Before that, a thorough check of the PLC's external wiring is crucial. The external wiring must be accurate. A pre-written test program can be used to scan and power on the external wiring to locate faults. However, for safety reasons, it's best to disconnect the main circuit. Once the wiring is confirmed to be correct, reconnect the main circuit and load the simulated debugging program into the user memory for further debugging until all parts function normally and can coordinately complete the overall control function.
1. Program simulation and debugging
After writing the designed program into the PLC, carefully check each line and correct any errors that occurred during writing. User programs are generally first simulated and debugged in a laboratory. Actual input signals can be simulated using toggle switches and buttons, and the on/off states of each output are displayed using relevant LEDs on the PLC. Generally, no actual load (such as contactors or solenoid valves) needs to be connected to the PLC. Based on the function chart, switches or buttons can be used to simulate actual feedback signals at appropriate times, such as the opening and closing of limit switch contacts. For sequential control programs, the main task of debugging is to check whether the program's operation conforms to the function chart, that is, whether the correct change in the active state of each step occurs when a certain transition condition is met. Specifically, whether all preceding steps become inactive, all subsequent steps become active, and whether the load driven by each step changes accordingly.
During debugging, all possible scenarios should be fully considered. Every branch in the function table diagram with selection sequences and every possible progression path of the system should be checked one by one without omission. If a problem is found, the ladder diagram and PLC program should be modified promptly until the relationship between input and output quantities fully meets the requirements under all possible conditions.
If the settings of some timers or counters in the program are too large, in order to shorten the debugging time, you can reduce them during debugging and then write their actual settings after the simulation debugging is completed.
While designing and simulating the debugging program, the console or control cabinet can be designed and manufactured, and the installation and wiring of other hardware besides the PLC can also be carried out at the same time.
2. On-site debugging of the program
After completing the above steps, install the PLC at the control site for online commissioning. During commissioning, potential problems with sensors, actuators, and hardwiring will be revealed, as well as issues in the PLC's external wiring diagram and ladder logic programming. These problems should be addressed promptly. If the commissioning fails to meet requirements, appropriate adjustments should be made to the corresponding hardware and software components; usually, only program modifications are needed to achieve the desired results. After successful commissioning and a period of testing, the system can be put into actual operation.
On-site program debugging:
PLC program on-site debugging refers to the actual debugging in an industrial setting after all equipment is installed and all connections are made. It is also the final debugging of the PLC program. The purpose of on-site debugging is to ensure that the PLC can be handed over to the user or put into trial operation after successful debugging. On-site debugging involves many people, so it is important to organize them well and have a debugging outline. The debugging process should proceed step by step according to the outline. At the beginning of debugging, the equipment may not be running, or even powered on. Power can be gradually added, the machine started, and load applied as debugging progresses until it operates under rated conditions. The specific process is roughly as follows:
1) Check the wiring and verify the addresses. This should be done point by point to ensure accuracy. Verification can be done without power, which involves checking the wiring, but is more complicated. Alternatively, you can check with power on, applying a signal to see if the control system's operation matches the design intent.
2) Check the analog input/output. Verify that the input/output modules are correct and functioning properly. If necessary, use standard instruments to check the accuracy of the input/output.
3) Check and test indicator lights. If there are indicator lights on the control panel, check their display first. Firstly, check if any lights are broken; secondly, check if the logic is correct. Indicator lights are a reflection of the system's operation; adjusting them correctly will facilitate further debugging.
4) Check the manual actions and manual control logic. After completing the above debugging, you can then debug the manual actions and manual control logic. Check each manual control output point to see if there is a corresponding output and the corresponding action, and then check if each manual control can be implemented. If there are any problems, resolve them immediately.
5) Semi-automatic operation. If the system can operate automatically, first test whether semi-automatic operation is possible. During debugging, proceed step by step until the entire control cycle is completed. Address the problem at the step or stage where an issue arises.
6) Automatic Operation. After completing the semi-automatic debugging, further debugging of the automatic operation can be performed. Several operating cycles should be observed to ensure that the system can operate correctly and continuously.
7) Analog signal debugging and parameter determination. The above debugging steps pertain to logic control. This is the first step in system debugging. After these basic debugging steps are completed, you can begin debugging analog and pulse signal control. The most important thing is to select appropriate control parameters. Generally speaking, this process is quite lengthy. You need to be patient and try various parameter options before selecting the optimal one. Some PLCs can obtain their PID parameters through self-tuning. However, this self-tuning process also requires a considerable amount of time to complete.
8) Abnormal Condition Check: After completing all the above debugging steps, the entire debugging process is basically finished. However, it's advisable to perform some abnormal condition checks. Check whether abnormal situations or unavoidable illegal operations will trigger a shutdown protection mechanism or alarm prompts.