To address common quality problems in petroleum industrial control programs during function block reuse and engineering implementation, such as non-standard naming, missing comments, hard-coded numeric literals, and hidden cross-module dependencies, this paper proposes a rule-driven static diagnosis and structured refactoring framework for IEC 61131-3 control programs. Based on XML-based structured representation, the proposed method formalizes program governance requirements, including naming consistency, code quality integrity, and module structural safety, into executable rules. It enables unified identification of quality issues at the interface, content, and structural levels of control programs, and performs structured refactoring for problems with clearly defined correction boundaries. Experimental results show that the proposed method can effectively identify typical quality defects and improve the standardization, maintainability, and reviewability of control programs while preserving program semantic stability. The study provides a practical governance approach for industrial control program quality management and function block engineering management.
The Factory Acceptance Test (FAT) of Process Control Systems (PCS) on offshore platforms traditionally relies on manual channel-by-channel verification, which is time-consuming, error-prone, and heavily dependent on human factors. This paper presents an automated channel testing system that significantly improves testing efficiency and reliability. The system integrates a programmable logic controller (PLC) as the signal generation and acquisition unit, a custom-designed rapid connection interface for direct terminal block access, and a Java-based software platform utilizing OPC communication and MySQL database. The software automatically parses engineering configurations, executes test sequences, compares measured values against expected ranges, and generates comprehensive test reports. A case study on a 520-channel DCS system demonstrates that the proposed system reduces testing time from approximately 8 person-hours to less than 2 person-hours while eliminating manual recording errors. Furthermore, we extend the evaluation to three additional projects with varying scales (150-1500 channels), showing consistent efficiency gains. The system also supports flexible test point selection (e.g., 3-point or 5-point method) and provides statistical analysis of channel accuracy. This work not only automates a tedious industrial task but also lays the foundation for intelligent testing in digital oilfield environments.