Inst ToolsInst ToolsInst Tools
  • Courses
  • Automation
    • PLC
    • Control System
    • Safety System
    • Communication
    • Fire & Gas System
  • Instrumentation
    • Design
    • Pressure
    • Temperature
    • Flow
    • Level
    • Vibration
    • Analyzer
    • Control Valve
    • Switch
    • Calibration
    • Erection & Commissioning
  • Interview
    • Instrumentation
    • Electrical
    • Electronics
    • Practical
  • Q&A
    • Instrumentation
    • Control System
    • Electrical
    • Electronics
    • Analog Electronics
    • Digital Electronics
    • Power Electronics
    • Microprocessor
  • Request
Search
  • Books
  • Software
  • Projects
  • Process
  • Tools
  • Basics
  • Formula
  • Power Plant
  • Root Cause Analysis
  • Electrical Basics
  • Animation
  • Standards
  • 4-20 mA Course
  • Siemens PLC Course
Reading: How to Simplify PLC Coding Using Karnaugh Maps?
Share
Font ResizerAa
Inst ToolsInst Tools
Font ResizerAa
  • Courses
  • Design
  • PLC
  • Interview
  • Control System
Search
  • Courses
  • Automation
    • PLC
    • Control System
    • Safety System
    • Communication
    • Fire & Gas System
  • Instrumentation
    • Design
    • Pressure
    • Temperature
    • Flow
    • Level
    • Vibration
    • Analyzer
    • Control Valve
    • Switch
    • Calibration
    • Erection & Commissioning
  • Interview
    • Instrumentation
    • Electrical
    • Electronics
    • Practical
  • Q&A
    • Instrumentation
    • Control System
    • Electrical
    • Electronics
    • Analog Electronics
    • Digital Electronics
    • Power Electronics
    • Microprocessor
  • Request
Follow US
All rights reserved. Reproduction in whole or in part without written permission is prohibited.
Inst Tools > Blog > PLC Tutorials > How to Simplify PLC Coding Using Karnaugh Maps?

How to Simplify PLC Coding Using Karnaugh Maps?

Learn a very useful programming Hint that would help you to simplify PLC coding designs using Boolean algebra and Karnaugh maps.

Last updated: November 21, 2022 4:06 pm
Hussien Ghareb
PLC Tutorials
No Comments
Share
7 Min Read
SHARE

As we said before PLC programming is Not Only Concerned to execute instructions that could handle the operation, No not at all.

Contents
PLC Example for “Water Bath Heater System”Step1: Draw the truth tableKarnaugh MapsStep 2: Divide the input variables up. I choose SQ and MWStep 3: Draw a Karnaugh map based on the input variablesStep 4: Look for patterns in the mapStep 5: Write the equation using the patternsStep 6: Convert the equation into ladder logic

Simplicity, reliability, and the ability to make structural adjustments to your PLC code are major factors that you have to consider when you are dealing with big projects.

Also, a major factor is the time taken by you to design the PLC code, so by the end of this article, we are going to learn a very useful programming Hint that would help you to simplify PLC coding designs using Boolean algebra and Karnaugh maps.

PLC Example for “Water Bath Heater System”

Here we have a simple Water Bath Heater (WBH) that is used to control the temperature of Natural Gas at the “Natural Gas Regulating & Metering Stations”.

There are some field instruments responsible to handle the Alarm system of the WBH such as (High Gas Pressure, High-Temperature or Low water levels… etc.).

Step1: Draw the truth table

Instead of converting the whole operation directly to a Boolean equation, it is put into a tabular form as shown in Fig. (1), and the rows and columns are chosen from the input variables.

PLC Coding Using Karnaugh Maps
Figure 1

The sequence is not binary, but it is organized so that only one of the bits changes at a time, so the sequence of bits is 00, 01, 11, 10… this step is very important.

Assuming that there are four main input switches (S – M – W – Q) that they are responsible to activate the alarm system by energizing an output Horn (A).

As we could Notice in Fig. (1) the truth table of the WBH system, the output alarm would be energized just in three cases:

  • S = 1 & Q = 1
  • S = 1 & M = 1 & Q = 1
  • S = 1 & M = 1 & W = 1 & Q = 1

NOTE:

A Truth Table is a tabular representation of all the combinations of values for inputs and their corresponding outputs. It is a mathematical table that shows all possible outcomes that would occur from all possible scenarios that are considered factual, hence the name.

Truth tables are usually used for logic problems as in Boolean algebra and electronic circuits.                                                                                                                       

Karnaugh Maps

The Karnaugh Map is defined as the graphical representation of Boolean Expressions with an array consisting of 2n cells arranged in a grid format, it will allow us to convert the WBH truth table to a simplified Boolean Expression without using Boolean Algebra calculation.

Step 2: Divide the input variables up. I choose SQ and MW

Next, the values from the truth table that are true are entered into the Karnaugh map as shown in Fig. (2).

Boolean Expressions PLC Program
Figure 2

Zeros can also be entered, but are not necessary.

Step 3: Draw a Karnaugh map based on the input variables

Step 4: Look for patterns in the map

When bits have been entered into the Karnaugh map there should be some obvious patterns.

These patterns typically have some sort of symmetry. In Fig. (3) there are two patterns that have been circled.

In this case, one of the patterns is because there are two bits beside each other. The second pattern is harder to see because the bits in the left- and right-hand side columns are beside each other.

(Note: Even though the table has a left- and right-hand column, the sides, and top/bottom wrap around.)

Some of the bits are used more than once, which will lead to some redundancy in the final equation, but it will also give a simpler.

Draw a Karnaugh map
Figure 3

Step 5: Write the equation using the patterns

The patterns can then be converted into a Boolean equation. This is done by first observing that all of the patterns sit in the third row as shown in Fig. (3), therefore the expression will be ANDed with SQ.

Next, there are two patterns in the second row,

  • One has (M) as the common term.
  • The second has (W bar) as the common term.

So, either (M) OR (W bar) will be ANDed with SQ.

These can now be combined into the equation:

A = S . Q . (M + Ẇ)

Step 6: Convert the equation into ladder logic

Finally, the equation is converted to ladder logic as shown in Fig. (4).

PLC Karnaugh maps
Figure 4

Karnaugh maps are an alternative method to simplifying equations with Boolean algebra. It is well suited to visual learners and is an excellent way to verify Boolean algebra calculations.

The example shown was for four variables, thus giving two variables for the rows and two variables for the columns. More variables can also be used. If there were five input variables there could be three variables used for the rows or columns with the pattern 000, 001, 011, 010, 110, 111, 101, 100.

If there is more than one output, a Karnaugh map is needed for each output.

Resources

  • Automating Manufacturing Systems with PLCs

(Version 4.6, December 15, 2004) By/ Hugh Jack

If you liked this article, then please subscribe to our YouTube Channel for Instrumentation, Electrical, PLC, and SCADA video tutorials.

You can also follow us on Facebook and Twitter to receive daily updates.

Read Next:

  • Redundancy in Siemens PLC
  • Allen Bradley PLC Hardware
  • Motor Classic Control Circuits
  • Control System Cyber Security
  • Features of Scada in IoT System
Don't Miss Our Updates
Be the first to get exclusive content straight to your email.
We promise not to spam you. You can unsubscribe at any time.
Invalid email address
You've successfully subscribed !

Continue Reading

PLC Pump Permissive Interlocks
PLC Programming Example using Limit Switch
Automatic Paper Cutting Machine Using CX-Programmer
Understanding the Scan Cycle of SIEMENS PLC
XG5000 PLC Programming for Automatic Exhaust Fan
Timer during Motor Direction Change PLC Program
Share This Article
Facebook Whatsapp Whatsapp LinkedIn Copy Link
Share
Leave a Comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Stay Connected

128.3kFollowersLike
69.1kFollowersFollow
210kSubscribersSubscribe
38kFollowersFollow

Categories

Explore More

PLC Programming Examples on Industrial Automation
Motor Classic Control Circuits using Single Push button
Automatic Sanitizer – Complex Ladder Logic PLC Examples
Global Acknowledgment Instruction in Safety PLC
100 Electrical Circuit Breaker Quiz
Start Stop of one Motor from the same Push button PLC program
FB Block in Siemens PLC Programming
Mixing Program with Timers and Counters in Omron PLC

Keep Learning

PLC Documents

PLC System Documentation

Connecting Blocks in Functional Block Diagram

Connecting Blocks in Functional Block Diagram – Studio 5000

Allen Bradley PLC communication is established

Procedure for Connecting Allen Bradley PLC and PC – RS Logix 500

PLC Program to Separate Different Size Objects

PLC Program to Separate Different Size Objects

memory types in siemens plc

#13 PLC Best Practices – Disable Unused Communication Ports

PLC program to control pump

Troubleshooting PLC Permissive Inputs

PLC Scan Time

PLC Scan Time

What is Ladder Diagram Programming ?

Learn More

Pressure Gauge Parts

Pressure Gauges with Bourdon Tube Principle

How is Data Stored in Standard Modbus Protocol?

How is Data Stored in Standard Modbus Protocol?

Renewable Energy Projects

200 Renewable Energy Projects for Students and Engineers

Electrical & Electronics Measurements Objective Questions

Electrical & Electronics Measurements Objective Questions – Set 3

Pumps Quiz

Pumps Quiz

Characteristics of Transducers Objective Questions

Characteristics of Transducers Objective Questions

RDOL starter

What are DOL and RDOL starters? Advantages, Disadvantages

Shunt-Wound DC Generator Principle

Shunt-Wound DC Generators

Menu

  • About
  • Privacy Policy
  • Copyright

Quick Links

  • Learn PLC
  • Helping Hand
  • Part Time Job

YouTube Subscribe

Follow US
All rights reserved. Reproduction in whole or in part without written permission is prohibited.
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?