K-ST: A Formal Executable Semantics of the Structured Text Language for PLCs
- 14 September 2023
- journal article
- research article
- Published by Institute of Electrical and Electronics Engineers (IEEE) in IEEE Transactions on Software Engineering
- Vol. 49 (10) , 4796-4813
Abstract
Programmable Logic Controllers (PLCs) are responsible for automating process control in many industrial systems (e.g. in manufacturing and public infrastructure), and thus it is critical to ensure that they operate correctly and safely. The majority of PLCs are programmed in languages such as Structured Text (ST). However, a lack of formal semantics makes it difficult to ascertain the correctness of their translators and compilers, which vary from vendor-to-vendor. In this work, we develop K-ST, a formal executable semantics for ST in the K framework. Defined with respect to the IEC 61131-3 standard and PLC vendor manuals, K-ST is a high-level reference semantics that can be used to evaluate the correctness and consistency of different ST implementations. We validate K-ST by executing 567 ST programs extracted from GitHub and comparing the results against existing commercial compilers (i.e., CODESYS, CX-Programmer, and GX Works2). We then apply K-ST to validate the implementation of the open source OpenPLC platform, comparing the executions of several test programs to uncover five bugs and nine functional defects in the compiler.Keywords
All Related Versions
Funding Information
- National Key R&D Program of China (2020YFB2010900)
- NSFC (61833015, 62293511)
- Provincial Key R&D Program of Zhejiang (2020C01038, 2021C01032)
- Starry Night Science Fund of Zhejiang University Shanghai Institute for Advanced Study (SN-ZJU-SIAS-001)
This publication has 44 references indexed in Scilit:
- An overview of model checking practices on verification of PLC softwareSoftware and Systems Modeling, 2014
- IMP: A Simple Imperative Language2014
- Compiler validation via equivalence modulo inputsACM SIGPLAN Notices, 2014
- Overview and SIMPLE Case StudyElectronic Notes in Theoretical Computer Science, 2014
- Formal Verification of Complex Properties on PLC Programs2014
- An executable formal semantics of C with applicationsACM SIGPLAN Notices, 2012
- Conversion of ST Control Programs to ANSI C for Verification Purposese-Informatica Software Engineering Journal, 2012
- Semantics and Analysis of Instruction List ProgramsElectronic Notes in Theoretical Computer Science, 2005
- Verification of PLC Programs Given as Sequential Function Charts2004
- Rewriting logic: roadmap and bibliographyTheoretical Computer Science, 2002