Matthew Waters, Ken Young, Ira D. Baxter


Ladder logic is a graphical language widely used to program Programmable Logic Controllers (PLCs). PLCs are found at the heart of most industrial control systems used in automation because they are robust, they are relatively easy to program and because they are a proven technology. However there is currently no means to measure the intrinsic properties and qualities of the code produced. This paper details a method for creating tools to calculate software metrics for ladder logic, specifically Rockwell Automation’s implementation of ladder logic for its ControlLogix family of PLCs, Import-Export language version 2.6. Results obtained from these tools are briefly discussed also.


  1. IEEE Standard 610.12, 1990, IEEE Standard Glossary of Software Engineering Terminology
  2. A. Phukan, M. Kalava and V. Prabhu, 2005. Complexity metrics for manufacturing control architectures based on software and information flow. Computers & Industrial Engineering 49 1-20
  3. G. Frey, 2002, Software Quality in Logic Controller Programming, Proceedings of the IEEE SMC
  4. M. B. Younis and G. Frey, 2007. Software Quality Measures to Determine the Diagnosability of PLC Applications. Proceedings of the IEEE ETFA.
  5. Thomas McCabe, 1976, A Complexity Measure, IEEE Transactions on Software Engineering, Volume 2, No 4, pp 308-320
  6. F. Danielsson, P. Moore, P Eriksson, 2003, Validation, off-line programming and optimization of industrial control logic, Mechatronics 13 571-585
  7. I. D. Baxter, C. Pidgeon, M. Mehlich, 2004, DMS®: Program Transformations For Practical Scalable Software Evolution, Proceedings of the IEEE International Conference on Software Engineering
  8. A. Watson, T McCabe, 1996, Structured Testing: A Testing Methodology Using the Cyclomatic Complexity Metric, NIST Special Publication 500-235
  9. Halstead operator occurrence: 37222
  10. Halstead operand occurrence: 108478
  11. Halstead program length: 145700
  12. Halstead program vocabulary: 1918
  13. Halstead program volume: 1588914.89
  14. Halstead program difficulty: 1541.38
  15. Halstead program effort: 2449115919.79
  16. Halstead bug prediction: 529.64
  17. PROGRAM MainProgram @ line 59508
  18. lines and comments. 139 routines. Number of Rungs: 2713 Aggregate cyclomatic complexity: 4535 Mean cyclomatic complexity: 32.63 Median cyclomatic complexity: 4.00 Mean Cyclomatic complexity per rung:
  19. rung: 26 Position of rung with maximum
  20. rung: 81 Position of rung with maximum number
  21. of PrimitiveTests, occurs @ line: 59702 Decision density: 0.65 Halstead unique operators: 67 Halstead unique operands: 955 Halstead operator occurrence: 18365 Halstead operand occurrence: 56269 Halstead program length: 74634 Halstead program vocabulary: 1022 Halstead program volume: 746129.49 Halstead program difficulty: 1973.83 Halstead program effort:
  22. ROUTINE S_Dcu @ line 20278 410 lines of l5k code without blank
  23. lines and comments. Number of Rungs: 102 Number of Rungs with comments: 102 Cyclomatic complexity: 114 Cyclomatic complexity of the largest
  24. rung: 9 Position of rung with maximum
  25. a rung: 11 Position of rung with maximum number
  26. of PrimitiveTests, occurs @ line: 20675 Mean number PrimitiveTests per rung:

Paper Citation

in Harvard Style

Waters M., Young K. and D. Baxter I. (2008). CALCULATING SOFTWARE METRICS FOR LADDER LOGIC . In Proceedings of the Fifth International Conference on Informatics in Control, Automation and Robotics - Volume 4: ICINCO, ISBN 978-989-8111-31-9, pages 143-150. DOI: 10.5220/0001495901430150

in Bibtex Style

author={Matthew Waters and Ken Young and Ira D. Baxter},
booktitle={Proceedings of the Fifth International Conference on Informatics in Control, Automation and Robotics - Volume 4: ICINCO,},

in EndNote Style

JO - Proceedings of the Fifth International Conference on Informatics in Control, Automation and Robotics - Volume 4: ICINCO,
SN - 978-989-8111-31-9
AU - Waters M.
AU - Young K.
AU - D. Baxter I.
PY - 2008
SP - 143
EP - 150
DO - 10.5220/0001495901430150