1. Choose a suitable network
For an automation project (especially a medium-to-large-scale control system), network selection is crucial; some have even proposed the concept that "the network is the controller." First, the network must be open to facilitate integration of different devices and future system expansion. Second, the network type must be selected based on the transmission performance requirements of different network layers, requiring a thorough understanding of the network standard's protocols and mechanisms. Furthermore, system cost, device compatibility, and suitability for the field environment must be comprehensively considered to determine the network standard used at different layers. The performance of a real-time system can be measured from three aspects: time, reliability, and application.
II. Mastering the PLC Scanning Principle
Compared to other control devices, the most important feature of a PLC is its "scanning" capability. After power-on, the PLC automatically and repeatedly executes program scanning and I/O scanning, which consists of three stages: input sampling, user program execution, and output refresh. Completing these three stages constitutes one scan cycle. During the input sampling stage, the PLC sequentially reads all input states and data in a scanning manner and stores them in the corresponding cells of the I/O image area. After input sampling is complete, it proceeds to the user program execution and output refresh stages. Even if the input states and data change, the states and data of the corresponding cells in the I/O image area remain unchanged. During the user program execution stage, the PLC scans the program (ladder diagram) sequentially from top to bottom and left to right, refreshing the states of the corresponding cells in the RAM storage area or I/O image area based on the results of logical operations. During the output refresh stage, all output latch circuits are refreshed based on the corresponding states and data in the I/O image area, and then the corresponding peripherals are driven by the output circuits. This is when the PLC's actual output is generated. It is evident that the process and results controlled by a PLC program differ from those of a relay logic circuit, especially regarding the sequence of ladder steps and the capture of pulse signals, which are closely related to the scanning principle of the PLC. In practice, many programming problems stem from this, often leading to unexpected results. Therefore, designing PLC programs requires a thorough understanding of the fundamental principles of PLCs.
III. Strive for structured programming
Improving program quality, increasing programming efficiency, and ensuring good readability, reliability, maintainability, and structure are the goals of every programmer. IEC 61131-3, a standardized programming language for industrial control introduced by the International Electrotechnical Commission (IEC) in 1999, features openness, portability, structured programming and data, and strong error detection and correction capabilities, making it suitable for PLC programming. Using structured programming facilitates program construction (especially complex programs), multi-person design, debugging, and software management. While software engineering principles are widely accepted by programmers, translating these principles into conscious behavior during software development is not an easy task.
IV. Emphasize Anti-interference Measures
Automated systems are used in harsh industrial environments, making anti-interference measures particularly important. In practice, interference frequently leads to commissioning failures or even equipment damage. Interference in automated systems can be categorized into three main sources:
1) Space radiation interference;
2) Interference introduced by external system lines, including power lines, signal lines, grounding systems, etc.
3) Electromagnetic radiation and line interference within the system.
V. To address these interferences, the following measures should be considered during project implementation:
1) Environmental adaptability and electromagnetic compatibility should be fully considered when designing the system structure and selecting equipment;
2) Use a high-performance power supply to suppress interference introduced by the power grid;
3) Select and lay cables and wires appropriately;
4) Isolation or filtering devices are used in the hardware.
5) Software measures to improve reliability include digital filtering, timed correction of reference point potential, and information redundancy.
6) Choose the correct grounding method. Generally, single-point grounding and series single-point grounding are used.