Custom-Tailored Clone Detection for IEC 61131-3 Programming Languages

Automated production systems (aPS) are highly customized systems that consist of hardware and software. Such aPS are controlled by a programmable logic controller (PLC), often in accordance with the IEC 61131-3 standard that divides system implementation into so-called program organization units (POUs) as the smallest software unit and is comprised of multiple textual (Structured Text (ST)) and graphical (Function Block Diagram (FBD), Ladder Diagram (LD), and Sequential Function Chart(SFC)) programming languages that can be arbitrarily nested. A common practice during the development of such systems is reusing implementation artifacts by copying, pasting, and then modifying code. This approach is referred to as code cloning. It is used on a fine-granular level where a POU is cloned within a system variant. It is also applied on the coarse-granular system level, where the entire system is cloned and adapted to create a system variant, for example for another customer. This ad hoc practice for the development of variants is commonly referred to as clone-and-own. It allows the fast development of variants to meet varying customer requirements or altered regulatory guidelines. However, clone-and-own is a non-sustainable approach and does not scale with an increasing number of variants. It has a detrimental effect on the overall quality of a software system, such as the propagation of bugs to other variants, which harms maintenance. In order to support the effective development and maintenance of such systems, a detailed code clone analysis is required. On the one hand, an analysis of code clones within a variant (i.e., clone detection in the classical sense) supports experts in refactoring respective code into library components. On the other hand, an analysis of commonalities and differences between cloned variants (i.e., variability analysis) supports the maintenance and further reuse and facilitates the migration of variants into a software productline (SPL). In this paper, we present an approach for the automated detection of code clones within variants (intra variant clone detection) and between variants (inter variant clone detection) of IEC61131-3 control software with arbitrary nesting of both textual and graphical languages. We provide an implementation of the approach in the variability analysis toolkit (VAT) as a freely available prototype for the analysis of IEC 61131-3 programs. For the evaluation, we developed a meta-model-based mutation framework to measure our approach’s precision and recall. Besides, we evaluated our approach using the Pick and Place Unit (PPU) and Extended Pick and Place Unit (xPPU) scenarios. Results show the usefulness of intra and inter clone detection in the domain of automated production systems.

[1]  Michael Tiegelkamp,et al.  IEC 61131-3: Programming Industrial Automation Systems: Concepts and Programming Languages, Requirements for Programming Systems, Decision-Making Aids , 2001 .

[2]  Aasim Zafar,et al.  A Comprehensive Study of Software Product Line Frameworks , 2016 .

[3]  Bernhard Schätz,et al.  Clone detection in automotive model-based development , 2008, 2008 ACM/IEEE 30th International Conference on Software Engineering.

[4]  Farooque Azam,et al.  A Systematic Review on Code Clone Detection , 2019, IEEE Access.

[5]  Manishankar Mondal,et al.  A survey on clone refactoring and tracking , 2020, J. Syst. Softw..

[6]  Bernhard Schätz,et al.  Model clone detection in practice , 2010, IWSC '10.

[7]  James R. Cordy,et al.  Models are code too: Near-miss clone detection for Simulink models , 2012, 2012 28th IEEE International Conference on Software Maintenance (ICSM).

[8]  Birgit Vogel-Heuser,et al.  Maintainability and evolvability of control software in machine and plant manufacturing - An industrial survey , 2018, Control Engineering Practice.

[9]  Matthias Horbach,et al.  INFORMATIK 2013 - Informatik angepasst an Mensch, Organisation und Umwelt , 2013 .

[10]  James R. Cordy,et al.  Using mutation analysis for a model-clone detector comparison framework , 2013, 2013 35th International Conference on Software Engineering (ICSE).

[11]  Chanchal Kumar Roy,et al.  The vision of software clone management: Past, present, and future (Keynote paper) , 2014, 2014 Software Evolution Week - IEEE Conference on Software Maintenance, Reengineering, and Reverse Engineering (CSMR-WCRE).

[12]  Udo Kelter,et al.  A Generic Difference Algorithm for UML Models , 2005, Software Engineering.

[13]  Birgit Vogel-Heuser,et al.  Visualization of Variability Analysis of Control Software From Industrial Automation Systems , 2019, 2019 IEEE International Conference on Systems, Man and Cybernetics (SMC).

[14]  James R. Cordy,et al.  Near-miss model clone detection for Simulink models , 2012, 2012 6th International Workshop on Software Clones (IWSC).

[15]  David J. Paul,et al.  Analysis of Industrial Control System Software to Detect Semantic Clones , 2019, 2019 IEEE International Conference on Industrial Technology (ICIT).

[16]  Alexander Egyed,et al.  Enhancing Clone-and-Own with Systematic Reuse for Developing Software Variants , 2014, 2014 IEEE International Conference on Software Maintenance and Evolution.

[17]  Sandro Schulze,et al.  Automatische Synthese von Familienmodellen durch Analyse von block-basierten Funktionsmodellen , 2013, GI-Jahrestagung.

[18]  Giuliano Antoniol,et al.  Comparison and Evaluation of Clone Detection Tools , 2007, IEEE Transactions on Software Engineering.

[19]  Chanchal Kumar Roy,et al.  A Mutation/Injection-Based Automatic Framework for Evaluating Code Clone Detection Tools , 2009, 2009 International Conference on Software Testing, Verification, and Validation Workshops.

[20]  Birgit Vogel-Heuser,et al.  Family model mining for function block diagrams in automation software , 2014, SPLC '14.

[21]  Sandro Schulze,et al.  Detecting Variability in MATLAB/Simulink Models: An Industry-Inspired Technique and its Evaluation , 2017, SPLC.

[22]  Rikard Land,et al.  Migrating Industrial Systems towards Software Product Lines: Experiences and Observations through Case Studies , 2008, 2008 34th Euromicro Conference Software Engineering and Advanced Applications.

[23]  Charles W. Krueger,et al.  Easing the Transition to Software Mass Customization , 2001, PFE.

[24]  Birgit Vogel-Heuser,et al.  Key maturity indicators for module libraries for PLC-based control software in the domain of automated Production Systems , 2018 .

[25]  Jens Knodel,et al.  Analyzing the Source Code of Multiple Software Variants for Reuse Potential , 2011, 2011 18th Working Conference on Reverse Engineering.

[26]  René Just,et al.  The major mutation framework: efficient and scalable mutation analysis for Java , 2014, ISSTA 2014.

[27]  Martin White,et al.  Deep learning code fragments for code clone detection , 2016, 2016 31st IEEE/ACM International Conference on Automated Software Engineering (ASE).

[28]  Shinji Kusumoto,et al.  CCFinder: A Multilinguistic Token-Based Code Clone Detection System for Large Scale Source Code , 2002, IEEE Trans. Software Eng..

[29]  Elmar Jürgens,et al.  Index-based model clone detection , 2011, IWSC '11.

[30]  Sandro Schulze,et al.  Interface variability in family model mining , 2013, SPLC '13 Workshops.

[31]  David Lorge Parnas,et al.  On the Design and Development of Program Families , 2001, IEEE Transactions on Software Engineering.

[32]  Birgit Vogel-Heuser,et al.  Evolution in industrial plant automation: A case study , 2013, IECON 2013 - 39th Annual Conference of the IEEE Industrial Electronics Society.

[33]  Paul Clements,et al.  Software product lines - practices and patterns , 2001, SEI series in software engineering.

[34]  Birgit Vogel-Heuser,et al.  A Qualitative Study of Variability Management of Control Software for Industrial Automation Systems , 2018, 2018 IEEE International Conference on Software Maintenance and Evolution (ICSME).

[35]  Xin Chen,et al.  Detecting Java Code Clones Based on Bytecode Sequence Alignment , 2019, IEEE Access.

[36]  Ditmar Parmeza Cost and Efforts in Product Lines for Developing Safety Critical Products - An empirical study , 2015 .

[37]  Roland J. Weiss,et al.  Sustainability guidelines for long-living software systems , 2012, 2012 28th IEEE International Conference on Software Maintenance (ICSM).

[38]  Hoan Anh Nguyen,et al.  Complete and accurate clone detection in graph-based models , 2009, 2009 IEEE 31st International Conference on Software Engineering.

[39]  Ivan Porres,et al.  Difference and Union of Models , 2003, UML.

[40]  Chanchal Kumar Roy,et al.  Evaluating clone detection tools with BigCloneBench , 2015, 2015 IEEE International Conference on Software Maintenance and Evolution (ICSME).

[41]  Birgit Vogel-Heuser,et al.  Similarity Analysis of Control Software Using Graph Mining , 2019, 2019 IEEE 17th International Conference on Industrial Informatics (INDIN).

[42]  Alexander Egyed,et al.  The ECCO Tool: Extraction and Composition for Clone-and-Own , 2015, 2015 IEEE/ACM 37th IEEE International Conference on Software Engineering.

[43]  G. G. Stokes "J." , 1890, The New Yale Book of Quotations.

[44]  Birgit Vogel-Heuser,et al.  Analyzing Variability in Automation Software with the Variability Analysis Toolkit , 2019, SPLC.

[45]  Marek Obitko,et al.  Tool for visual difference display of programs in IEC 61131-3 ladder diagrams , 2015, 2015 IEEE International Conference on Industrial Technology (ICIT).

[46]  R. W. Lewis,et al.  Programming Industrial Control Systems Using IEC 1131-3 , 1995 .

[47]  B. Vogel‐Heuser,et al.  Reengineering Workflow for Planned Reuse of IEC 61131-3 Legacy Software , 2020, 2020 IEEE International Conference on Industrial Engineering and Engineering Management (IEEM).

[48]  James R. Cordy,et al.  Towards qualitative comparison of Simulink model clone detection approaches , 2012, 2012 6th International Workshop on Software Clones (IWSC).

[49]  Elmar Jürgens,et al.  Code clone detection in practice , 2010, 2010 ACM/IEEE 32nd International Conference on Software Engineering.

[50]  Chanchal K. Roy,et al.  A Survey on Software Clone Detection Research , 2007 .

[51]  Alexander Egyed,et al.  Exploring code clones in programmable logic controller software , 2017, 2017 22nd IEEE International Conference on Emerging Technologies and Factory Automation (ETFA).

[52]  Ramakrishnan Ramanathan,et al.  The IEC 61131-3 programming languages features for industrial control systems , 2014, 2014 World Automation Congress (WAC).

[53]  Elmar Jürgens,et al.  Do code clones matter? , 2009, 2009 IEEE 31st International Conference on Software Engineering.