- •1.1 TODO LIST
- •2. PROGRAMMABLE LOGIC CONTROLLERS
- •2.1 INTRODUCTION
- •2.1.1 Ladder Logic
- •2.1.2 Programming
- •2.1.3 PLC Connections
- •2.1.4 Ladder Logic Inputs
- •2.1.5 Ladder Logic Outputs
- •2.2 A CASE STUDY
- •2.3 SUMMARY
- •2.4 PRACTICE PROBLEMS
- •2.5 PRACTICE PROBLEM SOLUTIONS
- •2.6 ASSIGNMENT PROBLEMS
- •3. PLC HARDWARE
- •3.1 INTRODUCTION
- •3.2 INPUTS AND OUTPUTS
- •3.2.1 Inputs
- •3.2.2 Output Modules
- •3.3 RELAYS
- •3.4 A CASE STUDY
- •3.5 ELECTRICAL WIRING DIAGRAMS
- •3.5.1 JIC Wiring Symbols
- •3.6 SUMMARY
- •3.7 PRACTICE PROBLEMS
- •3.8 PRACTICE PROBLEM SOLUTIONS
- •3.9 ASSIGNMENT PROBLEMS
- •4. LOGICAL SENSORS
- •4.1 INTRODUCTION
- •4.2 SENSOR WIRING
- •4.2.1 Switches
- •4.2.2 Transistor Transistor Logic (TTL)
- •4.2.3 Sinking/Sourcing
- •4.2.4 Solid State Relays
- •4.3 PRESENCE DETECTION
- •4.3.1 Contact Switches
- •4.3.2 Reed Switches
- •4.3.3 Optical (Photoelectric) Sensors
- •4.3.4 Capacitive Sensors
- •4.3.5 Inductive Sensors
- •4.3.6 Ultrasonic
- •4.3.7 Hall Effect
- •4.3.8 Fluid Flow
- •4.4 SUMMARY
- •4.5 PRACTICE PROBLEMS
- •4.6 PRACTICE PROBLEM SOLUTIONS
- •4.7 ASSIGNMENT PROBLEMS
- •5. LOGICAL ACTUATORS
- •5.1 INTRODUCTION
- •5.2 SOLENOIDS
- •5.3 VALVES
- •5.4 CYLINDERS
- •5.5 HYDRAULICS
- •5.6 PNEUMATICS
- •5.7 MOTORS
- •5.8 COMPUTERS
- •5.9 OTHERS
- •5.10 SUMMARY
- •5.11 PRACTICE PROBLEMS
- •5.12 PRACTICE PROBLEM SOLUTIONS
- •5.13 ASSIGNMENT PROBLEMS
- •6. BOOLEAN LOGIC DESIGN
- •6.1 INTRODUCTION
- •6.2 BOOLEAN ALGEBRA
- •6.3 LOGIC DESIGN
- •6.3.1 Boolean Algebra Techniques
- •6.4 COMMON LOGIC FORMS
- •6.4.1 Complex Gate Forms
- •6.4.2 Multiplexers
- •6.5 SIMPLE DESIGN CASES
- •6.5.1 Basic Logic Functions
- •6.5.2 Car Safety System
- •6.5.3 Motor Forward/Reverse
- •6.5.4 A Burglar Alarm
- •6.6 SUMMARY
- •6.7 PRACTICE PROBLEMS
- •6.8 PRACTICE PROBLEM SOLUTIONS
- •6.9 ASSIGNMENT PROBLEMS
- •7. KARNAUGH MAPS
- •7.1 INTRODUCTION
- •7.2 SUMMARY
- •7.3 PRACTICE PROBLEMS
- •7.4 PRACTICE PROBLEM SOLUTIONS
- •7.5 ASSIGNMENT PROBLEMS
- •8. PLC OPERATION
- •8.1 INTRODUCTION
- •8.2 OPERATION SEQUENCE
- •8.2.1 The Input and Output Scans
- •8.2.2 The Logic Scan
- •8.3 PLC STATUS
- •8.4 MEMORY TYPES
- •8.5 SOFTWARE BASED PLCS
- •8.6 SUMMARY
- •8.7 PRACTICE PROBLEMS
- •8.8 PRACTICE PROBLEM SOLUTIONS
- •8.9 ASSIGNMENT PROBLEMS
- •9. LATCHES, TIMERS, COUNTERS AND MORE
- •9.1 INTRODUCTION
- •9.2 LATCHES
- •9.3 TIMERS
- •9.4 COUNTERS
- •9.5 MASTER CONTROL RELAYS (MCRs)
- •9.6 INTERNAL RELAYS
- •9.7 DESIGN CASES
- •9.7.1 Basic Counters And Timers
plc boolean - 6.1
6. BOOLEAN LOGIC DESIGN
Topics:
•Boolean algebra
•Converting between Boolean algebra and logic gates and ladder logic
•Logic examples
Objectives:
•Be able to simplify designs with Boolean algebra and Karnaugh maps
6.1INTRODUCTION
The process of converting control objectives into a ladder logic program requires structured thought. Boolean algebra provides the tools needed to analyze and design these systems.
6.2 BOOLEAN ALGEBRA
Boolean algebra was developed in the 1800’s by James Bool, an Irish mathematician. It was found to be extremely useful for designing digital circuits, and it is still heavily used by electrical engineers and computer scientists. The techniques can model a logical system with a single equation. The equation can then be simplified and/or manipulated into new forms. The same techniques developed for circuit designers adapt very well to ladder logic programming.
Boolean equations consist of variables and operations and look very similar to normal algebraic equations. The three basic operators are AND, OR and NOT; more complex operators include exclusive or (EOR), not and (NAND), not or (NOR). Small truth tables for these functions are shown in Figure 6.1. Each operator is shown in a simple equation with the variables A and B being used to calculate a value for X. Truth tables are a simple (but bulky) method for showing all of the possible combinations that will turn an output on or off.
plc boolean - 6.2
Note: By convention a false state is also called off or 0 (zero). A true state is also called on or 1.
AND |
|
|
|
|
|
|
|
|
OR |
|
|
|
|
|
|
|
|
|
|
NOT |
|
|
|
|
|
|||||||
A |
|
|
|
|
X |
|
|
A |
|
|
X |
|
|
|
|
|
A |
|
|
|
X |
|||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||||||||||||||
B |
|
|
|
|
|
|
|
B |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
X = A B |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||
|
X = A + B |
|
|
|
|
|
X = A |
|
|
|
||||||||||||||||||||||
A |
B |
|
X |
|
A |
B |
|
|
|
X |
|
|
A |
|
|
X |
||||||||||||||||
|
|
|
|
|||||||||||||||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
0 |
|
|
0 |
|
|
|
|
0 |
0 |
|
|
0 |
|
|
|
|
0 |
0 |
|
|
|
|
1 |
|
|
|||||||
0 |
|
|
1 |
|
|
|
|
0 |
0 |
|
|
1 |
|
|
|
|
1 |
1 |
|
|
|
|
0 |
|
|
|||||||
1 |
|
|
0 |
|
|
|
|
0 |
1 |
|
|
0 |
|
|
|
|
1 |
|
|
|
|
|
|
|
|
|
|
|||||
1 |
|
|
1 |
|
|
|
|
1 |
1 |
|
|
1 |
|
|
|
|
1 |
|
|
|
|
|
|
|
|
|
|
|||||
NAND |
|
|
|
NOR |
|
|
|
|
|
EOR |
|
|
|
|
|
|||||||||||||||||
A |
|
|
|
|
X |
|
|
A |
|
|
X |
|
|
|
|
|
A |
|
|
|
X |
|||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||||||||||||||
B |
|
|
|
|
|
|
|
B |
|
|
|
|
|
|
|
|
|
B |
|
|
|
|
|
|||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||
X = |
|
|
|
|
|
|
|
X = |
|
|
|
|
|
|
|
|
|
X = A B |
||||||||||||||
A B |
|
|
A + B |
|
|
|
|
|||||||||||||||||||||||||
A |
B |
|
X |
|
|
A |
B |
|
|
X |
|
|
A |
B |
|
|
X |
|||||||||||||||
|
|
|
|
|
|
|
||||||||||||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
0 |
|
|
0 |
|
|
|
|
1 |
0 |
|
|
0 |
|
|
|
|
|
|
1 |
0 |
|
|
0 |
|
|
0 |
||||||
0 |
|
|
1 |
|
|
|
|
1 |
0 |
|
|
1 |
|
|
|
|
|
|
0 |
0 |
|
|
1 |
|
1 |
|||||||
1 |
|
|
0 |
|
|
|
|
1 |
1 |
|
|
0 |
|
|
|
|
|
|
0 |
1 |
|
|
0 |
|
1 |
|||||||
1 |
|
|
1 |
|
|
|
|
0 |
1 |
|
|
1 |
|
|
|
|
|
|
0 |
1 |
|
|
1 |
|
0 |
Note: The symbols used in these equations, such as + for OR are not universal standards and some authors will use different notations.
Note: The EOR function is available in gate form, but it is more often converted to its equivalent, as shown below.
X = A B = A B + A B
Figure 6.1 Boolean Operations with Truth Tables and Gates
In a Boolean equation the operators will be put in a more complex form as shown in Figure 6.2. The variable for these equations can only have a value of 0 for false, or 1 for
plc boolean - 6.3
true. The solution of the equation follows rules similar to normal algebra. Parts of the equation inside parenthesis are to be solved first. Operations are to be done in the sequence NOT, AND, OR. In the example the NOT function for C is done first, but the NOT over the first set of parentheses must wait until a single value is available. When there is a choice the AND operations are done before the OR operations. For the given set of variable values the result of the calculation is false.
given
X = ( A + B C) + A ( B + C)
assuming A=1, B=0, C=1
X = ( 1 + 0 1) + 1 ( 0 + 1) X = ( 1 + 0) + 1 ( 0 + 0)
X = ( 1) + 1 ( 0)
X = 0 + 0
X = 0
Figure 6.2 A Boolean Equation
The equations can be manipulated using the basic axioms of Boolean shown in Figure 6.3. A few of the axioms (associative, distributive, commutative) behave like normal algebra, but the other axioms have subtle differences that must not be ignored.
plc boolean - 6.4
Idempotent |
|
|
|
|
|
|
|
|
|
|
|
||||||||||
|
A + A = A |
A A = A |
|||||||||||||||||||
Associative |
|
|
|
|
|
|
|
|
|
|
|
||||||||||
|
( A + B) + C = A + ( B + C) |
( A B) C = A ( B C) |
|||||||||||||||||||
Commutative |
|
|
|
|
|
|
|
|
|
|
|
||||||||||
|
A + B = B + A |
A B = B A |
|||||||||||||||||||
Distributive |
|
|
|
|
|
|
|
|
|
|
|
||||||||||
|
A + ( B C) = ( A + B) ( A + C) |
A ( B + C) = ( A B) + ( A C) |
|||||||||||||||||||
Identity |
|
|
|
|
|
|
|
|
|
|
|
||||||||||
|
A + 0 = A |
A + 1 = 1 |
|||||||||||||||||||
|
A 0 = 0 |
A 1 = A |
|||||||||||||||||||
Complement |
|
|
|
|
|
|
|
|
|
|
|
||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
( |
|
|
) = A |
|||||||
|
A + A = 1 |
A |
|||||||||||||||||||
|
A |
|
= 0 |
|
|
|
|
|
|
|
|
|
|
|
|||||||
A |
|
|
|
|
|
|
|||||||||||||||
|
|
|
|
|
1 |
= 0 |
|
|
|
|
|
||||||||||
DeMorgan’s |
|
|
|
|
|
|
|
|
|
|
|
||||||||||
|
|
= |
|
|
|
|
|
|
= |
|
+ |
|
|
||||||||
|
|
|
|
|
|
A |
B |
A |
B |
||||||||||||
|
( A + B) |
( A B) |
Duality
interchange AND and OR operators, as well as all Universal, and Null sets. The resulting equation is equivalent to the original.
Figure 6.3 The Basic Axioms of Boolean Algebra
An example of equation manipulation is shown in Figure 6.4. The distributive axiom is applied to get equation (1). The idempotent axiom is used to get equation (2). Equation (3) is obtained by using the distributive axiom to move C outside the parentheses, but the identity axiom is used to deal with the lone C. The identity axiom is then used to simplify the contents of the parentheses to get equation (4). Finally the Identity axiom is
plc boolean - 6.5
used to get the final, simplified equation. Notice that using Boolean algebra has shown that 3 of the variables are entirely unneeded.
A = |
B |
( C ( |
D |
+ E + C) + |
F |
|
C) |
|
|||||||||
A = |
|
( |
|
C + E C + C C + |
|
C) |
|
||||||||||
B |
D |
F |
(1) |
||||||||||||||
A = |
|
( |
|
C + E C + C + |
|
C) |
|
||||||||||
B |
D |
F |
(2) |
||||||||||||||
A = |
|
C ( |
|
+ E + 1 + |
|
) |
|
||||||||||
B |
D |
F |
(3) |
||||||||||||||
A = |
|
C ( 1) |
|
||||||||||||||
B |
(4) |
||||||||||||||||
A = |
|
C |
|
||||||||||||||
B |
(5) |
Figure 6.4 Simplification of a Boolean Equation
Note: When simplifying Boolean algebra, OR operators have a lower priority, so they should be manipulated first. NOT operators have the highest priority, so they should be simplified last. Consider the example from before.
X = ( A + B C) + A ( B + C)
X = ( A) + ( B C) + A ( B + C)
X = ( A) ( B C) + A ( B + C)
X = A ( B + C) + A ( B + C)
X = A B + A C + A B + A C
X = A B + ( A C + A C) + A B
X = A B + C ( A + A) + A B
X = A B + C + A B
The higher priority operators are put in parenthases
DeMorgan’s theorem is applied
DeMorgan’s theorem is applied again
The equation is expanded
Terms with common terms are collected, here it is only NOT C
The redundant term is eliminated
A Boolean axiom is applied to simplify the equation further