Research on a Rule-Driven Diagnosis and Automatic Refactoring Framework for IEC 61131-3 XML Control Programs
Abstract
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.