An Output Instruction Based PLC Source Code Transformation Approach For Program Logic Simplification

Arup Ghosh, Shiming Qin, Jooyeoun Lee, Gi-Nam Wang


Due to the growing size and complexity of the PLC (Programmable Logic Controller) programs used for controlling the industrial processes, there is an increasing need for an approach that can help the users to understand the control logics of the PLC programs easily, and can assist them to analyze the programming errors effectively. In this paper, we propose an approach that takes the source code file of PLC program as the input; and transforms it into a hierarchical-structured XML (extensible markup language) file. The XML file format is based on the PLC output instructions and their corresponding conditions. It helps the users to identify the actual cause of a programming error quickly. In addition, a novel technique is applied that decomposes the PLC program into several smaller and modular sub-logic blocks. This makes the control logic simpler and easier to follow. An additional software application has also been developed for state-based graphical visualization of the XML file.

Full Text:




Liu, J. & Darabi. H. (2002). Ladder Logic Implementation of Ramadge-Wonham Supervisory Controller. Proceedings of the 6th International Workshop on Discrete Event Systems (WODES’02), Zaragoza, Spain, pp. 383–389.

Du, D., Liu, Y., Guo, X., Yamazaki, K., & Fujishima, M. (2009). Study on LD-VHDL conversion for FPGA-based PLC implementation. The International Journal of Advanced Manufacturing Technology, vol. 40, no. 11-12, pp. 1181–1190.

Bani Younis, M. & Frey, G. (2004). Visualization of PLC Programs Using XML. Proceedings of the American Control Conference (ACC’04), Boston, USA, pp. 3082–3087.

Siemens Simatic Step S7 Software. Website:, last retrieved on 6th July, 2017.

Allen-Bradley RSLogix Software. Website:, last retrieved on 6th July, 2017.

Fen, G. & Ning, W. (2006). A Transformation Algorithm of Ladder Diagram into Instruction List Based on AOV Digraph and Binary Tree. Proceedings of the IEEE Region 10 International Conference (TENCON’06), Hong Kong, China, pp. 1–4.

Hu, F., Fu, L., Liu, L., & Zhang, G. (2008). An Algorithm about Transforming PLC Ladder Diagram to Instruction List Based on Series-Parallel Merging Method. Proceedings of the Pacific-Asia Workshop on Computational Intelligence and Industrial Application (PACIIA’08), Wuhan, China, pp. 812–816.

Tan, A. & Ju, C. (2011). The Application of Maze algorithm in Translating Ladder Diagram into Instruction Lists of Programmable Logical Controller. Procedia Engineering, vol. 15, no. 1, pp. 264–268.

Yan, Y. & Zhang, H. (2010). Compiling ladder diagram into instruction list to comply with IEC 61131-3. Computers in Industry, vol. 61, no. 5, pp. 448–462.

Huang, L., Liu, W., & Liu, Z. (2009). Algorithm of transformation from PLC ladder diagram to structured text. Proceedings of the 9th International Conference on Electronic Measurement & Instruments (ICEMI’09), Beijing, China, pp. 4-778–4-782.

Estevez, E., Marcos, M., Iriondo, N., & Orive, D. (2007). Graphical Modelling of PLC-based Industrial Control Applications. Proceedings of the 26th American Control Conference (ACC’07), New York City, USA, pp. 220–225.

Estevez, E., Marcos, M., Orive, D., Irisarri, E., & Lopez, F. (2007). XML based Visualization of the IEC 61131-3 Graphical Languages. Proceedings of the 5th IEEE International Conference on Industrial Informatics (INDIN’07), Vienna, Austria, pp. 279–284.

Estevez, E., Marcos, M., Irisarri, E., Lopez, F., Sarachaga, I., & Burgos, A. (2008). A novel Approach to attain the true reusability of the code between different PLC programming Tools. Proceedings of the 7th IEEE International Workshop on Factory Communication Systems (WFCS’08), Dresden, Germany, pp. 315–322.

Estevez, E., Marcos, M., Orive, D., Lopez, F., Irisarri, E., & Perez, F. (2008). Middleware based on XML technologies for achieving true interoperability between PLC programming tools. Proceedings of the 17th World Congress of the International Federation of Automatic Control (IFAC’08), Seoul, Republic of Korea, pp. 8461–8466.

Marcos, M., Estevez, E., Perez, F., & Der Wal, E. (2009). XML exchange of control programs. IEEE Industrial Electronics Magazine, vol. 3, no. 4, pp. 32–35.

Lopez, F., Irisarri, E., Estevez, E., & Marcos, M. (2008). Graphical representation of factory automation Markup Languages. Proceedings of the 13th IEEE International Conference on Emerging Technologies and Factory Automation (ETFA’08), Hamburg, Germany, pp. 29–32.

Frey, G. & Bani Younis, M. (2004). A Re-Engineering Approach for PLC Programs using Finite Automata and UML. Proceedings of the IEEE International Conference on Information Reuse and Integration (IRI’04), Las Vegas, USA, pp. 24–29.

Bani Younis, M. & Frey, G. (2005). Formalization and Visualization of Non-binary PLC Programs. Proceedings of the 44th IEEE Conference on Decision and Control and European Control Conference (CDC-ECC’05), Seville, Spain, pp. 8367–8372.

Bani Younis, M. & Frey, G. (2006). UML-based approach for the re-engineering of PLC programs. Proceedings of the 32nd Annual Conference on IEEE Industrial Electronics (IECON’06), Paris, France, pp. 3691–3696.

Siemens Simatic Ladder Logic (LAD) for S7-300 and S7-400 Programming (Reference Manual). URL:, last retrieved on 6th July, 2017.

Siemens Simatic Statement List (STL) for S7-300 and S7-400 Programming (Reference Manual). URL:, last retrieved on 6th July, 2017.

Graphviz Software. Website:, last retrieved on 6th July, 2017.

Siemens Simatic System Software for S7-300/400 System and Standard Functions (Volume 1/2, Reference Manual). URL:, last retrieved on 6th July, 2017.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 License.