Databases: The perfect complement to PLCs

February 3, 2010
/ Print / Reprints /
/ Text Size+
If you’re concerned about pulling historical data for regulatory purposes, add a relational database to your PLC.

PLC data written to a database is used to create this downtime report. Source: Inductive Automation.
Most controls engineers have tackled PLCs and can program them with one hand tied behind their backs. So what’s the next logical challenge? According to Inductive Automation President Steve Hechtman, “Think SQL and relational databases (RDBs). You’d be amazed at the similarity,” he says. “It’s the next logical progression.

“You might ask how it is they’re even related. For one thing, RDBs can be [like] an extension of PLC memory,” says Hechtman. Live values can be mirrored in RDBs bi-directionally. Historical values and events can be recorded there as well. But operators and managers can interact with them too. “Over the last six years I’ve delved heavily into SQL and learned a lot about relational databases. I’ve discovered that working with SQL is remarkably similar to working with PLCs and ladder logic,” adds Hechtman.

SQL has four basic commands and about a hundred different modifiers that can be applied to each in various ways to achieve all types of results. Hechtman provides an example: Imagine effluent from a wastewater plant with its flow, pH and other things being monitored and logged. That’s what you typically see. But now associate these with other things: discrete lab results, the name of the persons who did the lab work, the lab equipment IDs and calibration expiration dates, who was on shift at the time and the shift just prior, their certification levels, what chemicals where added and when, who the chemical suppliers were, how long the chemicals sat before use and so forth. All of this becomes relational data, meaning that if it’s arranged properly in tables, users can run SQL queries to obtain all types of interesting results. The queries might provide insight into the most likely conditions that could result in an improper discharge so it can be prevented in the future.

“SQL is a high level language that isn’t very hard to learn, and you can be very clever with it,” adds Hechtman. He prefers to think of it as a natural extension of his PLC programming skills. SQL can be used to obtain or extract the history of a machine for the period it has been operating, and that history can be stored in a relational database. Furthermore, RDBs and SQL pull people and processes together. Machines don’t run alone. They’re merely part of a containing process, and that process was devised by people. SQL and relational databases form the bridge to integrate processes, machinery and people.

Hechtman doesn’t believe a commercial-off-the-shelf (COTS ) software package can fit an application any more than a COTS palletizer program can fit into different food processors’ applications. Every machine is different and every business process is different. That’s where SQL comes in. It has to duplicate or augment existing process flows, and these are intimately connected to the machinery.

To get started, Hechtman suggests picking up a “Dummies” type book. Then download and install the open-source MySQL database server along with the MySQL administrator and query browser. It only takes a few minutes to install, and then engineers can begin to experiment. “You can read about a LEFT JOIN or INNER JOIN, but typing one in and observing the results is worth about 1,000 words,” says Hechtman.

Did you enjoy this article? Click here to subscribe to Food Engineering Magazine.

You must login or register in order to post a comment.



Image Galleries

Plant of the Year 2014

Blue Diamond Growers was chosen as Food Engineering's 2014 Plant of the Year. The Sacramento-based company is the world’s largest producer of almonds and almond ingredients.


Burns & McDonnell project manager RJ Hope and senior project engineer Justin Hamilton discuss the distinctions between Food Safety and Food Defense as well as the implications for food manufacturers of the Food Safety Modernization Act.
More Podcasts

FSMA Audit

What is the is most important step you have taken to become ready for a FSMA audit?
View Results Poll Archive

Food Engineering

FE September 2014

2014 September

The September 2014 issue of Food Engineering explores how lean manufacturing, quality improvements and increased automation helps processors meet rapidly changing demands. Also, read how robotics, advanced machine controls, software and OEE are just a few of the tools that can boost productivity on packaging lines.

Table Of Contents Subscribe


Food Authentication Using Bioorganic Molecules

This text provides critical tools and data needed to augment routine food analysis and enhance food safety by aiding in the detection of counterfeit, and potentially deleterious, foods.

More Products

Clear Seas Research

Clear Seas ResearchWith access to over one million professionals and more than 60 industry-specific publications,Clear Seas Research offers relevant insights from those who know your industry best. Let us customize a market research solution that exceeds your marketing goals.

Food Master

Food Master Cover 2014Food Master 2014 is now available!

Where the buying process begins in the food and beverage manufacturing market. 

Visit to learn more.


FE recent tweets

facebook_40.pngtwitter_40px.pngyoutube_40px.png linkedin_40px.pngGoogle +