Reader small image

You're reading from  Mastering PLC Programming

Product typeBook
Published inMar 2023
PublisherPackt
ISBN-139781804612880
Edition1st Edition
Right arrow
Author (1)
Mason White
Mason White
author image
Mason White

M.T. White has been programming since the age of 12. His fascination with robotics flourished when he was a child programming microcontrollers such as Arduinos. M.T. currently holds an undergraduate degree in mathematics, a master's degree in soft ware engineering, and is currently working on an MBA in IT project management. M.T. is currently working as a soft ware developer for a major US defense contractor and is an adjunct CIS instructor at ECPI University. His background mostly stems from the automation industry where he programmed PLCs and HMIs for many different types of applications. M.T. has programmed many different brands of PLCs over the years and has developed HMIs using many different tools.
Read more about Mason White

Right arrow

Software engineering for PLCs

Software engineering is more than just writing programs. Software engineering is the art of effectively solving problems. A major problem with the current industrial programming mindset is that software is often treated almost as a second-class citizen to the hardware. In other words, PLC software is treated as a complement to hardware. More often than not, the software is treated as a throwaway component. It is not uncommon for software practices to be thrown to the wind in automation programming. As such, code\bases that can be easily modified and last for years will often have to be discarded long before they should. Many books and training courses treat PLC software in this way, which, in turn, continues a cycle of treating PLC software as a complement to PLC hardware. Overall, this is a flawed philosophy. Software is every bit as important as (and to certain extents, more important than) hardware. In all, when properly written programs are implemented, machines will be more easily modifiable and correctable. Software can then be transferred to other machines, which will minimize coding defects and yield successful manufacturing operations.

For many non-traditional software developers, a very bad philosophy has taken root. Many of these developers feel that a working solution is a good solution. However, imagine that you’re a car mechanic. Would it be wise to weld the hood shut so that every time you needed an oil change, the hood would have to be cut off with a plasma cutter? Technically, the hood would function the same way as it would on your vehicle now. It would still protect the elements of your engine but at the cost of needing to cut it open for routine maintenance. Though welding your hood onto your vehicle would work, it would not be a wise engineering choice. Software development should be approached in the same way. Just because a solution works does not make it a good solution.

How should a software engineer approach a problem? The answer to that question is the same way any other type of engineer would approach a problem: by first understanding the issue and then developing an effective solution for it. When software engineers approach a problem, they need to try to implement a solution that solves the problem in a way that is simple, efficient, and as easy to maintain as possible. In much the same way as an electrical or mechanical engineer would design their product, a software developer will need to do the same. A software engineer will have to learn to develop solutions that fulfill the requirements of the original problem as well as concoct a solution that can be easily modified in the future. A software engineer must have the following in mind when developing software:

  • Does the solution solve the problem?
  • Is the solution overcomplicated?
  • Can the solution be easily modified if changes are needed?
  • Can the solution be verified to ensure it works (can it be easily tested)?

Often, this mentality is lost on PLC programmers. Many PLC programmers do not see themselves as software engineers; however, it must be understood that the moment a keyboard or mouse is touched with the intent of programming something to solve a problem, the programmer becomes a software engineer. When code is developed with this mentality, the same mentality that electrical engineers would use to implement their design, a codebase is created that is clean, easy to maintain, and easy to upgrade, and it will pass the test of time and allow for adaptation for the future.

A key feature of modern software and a key feature of a quality software developer is reusability. Quality code can be used for many different projects without rewriting it. In the automation realm, this can be a bit challenging, as every PLC producer has their own take on PLC development software. However, many PLCs follow what is known as the IEC 61131-3 standard, which provides some uniformity across PLC platforms.

Previous PageNext Page
You have been reading a chapter from
Mastering PLC Programming
Published in: Mar 2023Publisher: PacktISBN-13: 9781804612880
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime

Author (1)

author image
Mason White

M.T. White has been programming since the age of 12. His fascination with robotics flourished when he was a child programming microcontrollers such as Arduinos. M.T. currently holds an undergraduate degree in mathematics, a master's degree in soft ware engineering, and is currently working on an MBA in IT project management. M.T. is currently working as a soft ware developer for a major US defense contractor and is an adjunct CIS instructor at ECPI University. His background mostly stems from the automation industry where he programmed PLCs and HMIs for many different types of applications. M.T. has programmed many different brands of PLCs over the years and has developed HMIs using many different tools.
Read more about Mason White