Ladder Diagram (LD)
In the second mini project, we will write PLC programs to control different real-world systems. The programs will be written in the Ladder Diagram (LD) format which is the most popular language for writing PLC programs. Other formats for PLC programming are: Structured Text (ST), Function Block Diagram (FBD), Instruction List (IL), and sequential function chart (SFC). Many early PLCs did not have accompanying programming terminals that were capable of graphical representation of the logic, and so the logic was instead represented as a series of logic expressions in some version of Boolean format, similar to Boolean algebra. As programming terminals evolved, it became more common for ladder logic to be used, for the aforementioned reasons and because it was a familiar format used for electro-mechanical control panels. Newer formats such as state logic and Function Block (which is similar to the way logic is depicted when using digital integrated logic circuits) exist, but they are still not as popular as ladder logic. A primary reason for this is that PLCs solve the logic in a predictable and repeating sequence, and ladder logic allows the programmer (the person writing the logic) to see any issues with the timing of the logic sequence more easily than would be possible in other formats.
Instead of using a real PLC, we will use an open source PLC emulator called OpenPLC
to do the programming. The performance of the programs will be evaluated in simulated
environments representing the behavior of real-world processes. The OpenPLC is the first
fully functional standardized open source PLC, both in software and in hardware. In fact,
OpenPLC is an alternative program which simulates the behaviours and capabilities of
real PLCs with the help of simple and low-cost hardware such as Arduino or Raspberry
Pi. The focus of this software is to provide a low cost industrial solution for automation
and research. OpenPLC has also been used in many research papers as a framework for
industrial cybersecurity research, given that it is the only controller to provide the entire
source code. Once you learn how to work with OpenPLC, you can easily pick up how to
program real PLCs of different vendors.
Ladder Logic, though is different from mainstream coding languages, is very easy to pick
up. Here are a few tutorials on ladder logic to get you started: Tutorial 1, Tutorial 2. You
can also find a lot of tutorials in YouTube and Google. Note that there is no limitation on
the methods you can use in the following sections unless it is explicitly mentioned in the
write-up. For example, you can use any number of ladders and rungs you need in your
program. It should be also noted that since we will use an autograder for this project,
you must use the predetermined names of the inputs and outputs in your program (please
see Appendix for more detailed information). Failure to follow this instruction will lead
to significant points loss (ZERO) in your final grade. We will NOT accept any excuses
for naming mistakes.