Have you ever wondered how skilled PLC Programmers create, install
and test programs when presented with complex system requirements?
Today’s successful PLC programmers possess knowledge and skills in electrical,
mechanical, and software engineering.
In addition to having expert level skills
in vendor-specific PLC programming software,
PLC programmers rely on mathematical concepts to optimize their designs.
In this video, we’re going to have a look at some basic mathematical concepts
that are used to create Function Block programs.
Earlier we said that PLC programmers
rely on mathematical concepts to optimize their designs.
PLC programmers use Boolean Algebra,
also called Boolean Logic every time they create a program.
Don’t let the term Algebra scare you
because the concepts of Boolean Logic aren’t terribly difficult.
Boolean Logic centers around the fundamental concept
that all values are either True or False.
Going one step further,
True and False can be represented by either a 1 bit or a 0 bit.
You’ve likely noticed that most PLC programming languages
use the term BOOL to represent a digital input or output.
BOOL is short for Boolean.
Every digital I/O can be represented by a 1 or a 0.
Function Block Diagram or FBD as described in IEC 61131-3
is rapidly replacing Ladder Logic
as the programming language of choice amongst PLC programmers.
Let’s look at the two basic Function Blocks in FBD
and investigate the Boolean Algebra associated with each.
The OR Function Block has at least two inputs.
Earlier we said in Boolean Logic,
all values are either True or False
and can be represented by either a 1 or a 0 bit.
The OR Function Block has a Truth Table that does two things.
First of all, it lays out all of the possible input conditions.
Secondly, it indicates how the output reacts to the input conditions.
From the Truth Table, we can see that the C is True
when A OR B is True.
OK… Here’s where we get into the Boolean Algebra part.
The mathematical expression for the OR function block is A OR B equals C.
A plus sign is used to indicate the OR function.
In primary school, we were taught that the plus sign is used for addition.
So… it would appear that the OR function block performs Boolean addition!
Ok… Let’s move on to the AND Function Block.
The AND Function Block has at least two inputs.
From the AND Truth Table, we can see that C is True
when A AND B are True.
The mathematical expression for the AND function block
is A AND B equals C.
Notice the multiplication symbol used to indicate the AND function.
So, it would appear that the AND function block performs Boolean multiplication!
We can drop the multiplication symbol
and the expression looks like this.
As we said earlier,
PLC programmers rely on Boolean Logic to optimize their designs.
Let’s look at a simple example of Boolean Logic optimization.
On the first pass of converting a system requirement into a FUNCTION BLOCK DIAGRAM,
a programmer ended with three function blocks.
The programmer would ask herself…
Can I optimize this FUNCTION BLOCK DIAGRAM
and eliminate any of the function blocks using Boolean Algebra?
The answer is Yes.
So, let's see how.
The Boolean Logic expression for this program is:
D is equal to AB plus AC
Using a little high school math,
we use the Distributive Law
and a transformation occurs.
Alright… now let’s rebuild our FUNCTION BLOCK DIAGRAM
and see if we’ve made some progress towards optimization.
After using some basic algebra,
we’ve gone from three function blocks to two function blocks.
We’ve given you just a glimpse of how Boolean Logic
can be used in the optimization of PLC programs.
Like it or not,
seasoned PLC programmers have become mathematicians.
If you want to learn more,
you might want to review two of our other videos called
“What is a Control or Function Block?”
and “What is the Difference between Ladder Logic and Function Block Diagrams?”
You can find the links to these videos in the description.
OK… let’s review what we’ve covered in this video:
PLC programmers possess a variety of knowledge and skills in electrical,
mechanical, and software engineering.
PLC Programmers have expert level skills
in vendor-specific PLC programming software
and rely on mathematical concepts to optimize their designs.
Boolean Logic centers around the fundamental concept
that all values are either True or False
and can be represented by either a 1 bit or a 0 bit.
Function Block Diagram or FBD
is rapidly replacing Ladder Logic
as the programming language of choice amongst PLC programmers.
The two basic Function Blocks in FUNCTION BLOCK DIAGRAM
are OR and AND.
Boolean Logic can be used by PLC programmers
in the optimization of PLC programs.
Want to learn PLC programming in an easy to understand format
and take your career to the next level?
Head on over to realpars.com