Ladder logic 401: Data acquisition and analysis

A programmable logic controller (PLC) is designed to not only provide information on signal levels, but it can also capture data, and it can be analyzed. There are a number of challenges the user faces from a software and logistical standpoint.

03/22/2016


A programmable logic controller (PLC) is designed to not only provide information on signal levels, but it can also capture data and it can be analyzed. The methods, however, can vary a great deal depending on the platform so this will focus on a generic level.

First, capturing the signal levels: These assume a signed integer signal from an analog card, unknown resolution.

Example of capturing the signal levels from a signed integer signal from an analog card, unknown resolution. Courtesy: Frank Lamb, Automation Primer

The image above shows a random sampling of values collected from a typical analog card. Since analog/device (AD) converters don't change values very quickly, it can be difficult to see the spikes that may occur in the signal.

Example of capturing the signal levels from a signed integer signal from an analog card, unknown resolution, with corrected values. Courtesy: Frank Lamb, Automation Primer

If values can be sampled at a higher rate than a typical proportional-integral-derivative (PID) control scheme might require, it might show some data like this. The spikes in these images illustrate what you can do if you do some simple limiting of values based on averaging.

It is important to note that any modification of data collected will require a delay of the signal. After all, it takes time to process the signals and improve them.

This is one method of creating sampling pulses that will work on pretty much any PLC platform, a free-running timer. One problem with it is that it is not going to be particularly precise since it operates within the scan. If it is necessary to improve pr

This is one method of creating sampling pulses that will work on pretty much any PLC platform, a free-running timer. One problem with it is that it is not going to be particularly precise since it operates within the scan. If it is necessary to improve precision, a cyclic routine or interrupt can be used.

This is a method of capturing ten values into an array and uses a first in, first out (FIFO) instruction. Courtesy: Frank Lamb, Automation Primer

This is a method of capturing ten values into an array. It uses a first in, first out (FIFO) instruction, which is available in most of the more expensive processors. If the user wants to capture more values, increase the size of the array.

This method bypasses first in, first out (FIFO) instruction. Courtesy: Frank Lamb, Automation Primer

Here is another method for a user who doesn't have or doesn't want to use a FIFO instruction. Array and file movement capabilities are still needed, however. The first instruction moves nine elements, leaving room for the current signal value to be copied into the first, most recent element.

This example takes about 20 instructions for movement of 10 values. Courtesy: Frank Lamb, Automation Primer

This example takes about 20 instructions for movement of 10 values. Courtesy: Frank Lamb, Automation Primer

This takes about 20 instructions for movement of 10 values. The MOV instructions would each need to be replaced with a LD Vxxx and an OUT Vxxx where the V's are your desired data locations; sensor value and storage location. These are 16-bit accumulators.

Here is an instruction that averages all of the elements in an array. Courtesy: Frank Lamb, Automation Primer

Here is an instruction that averages all of the elements in an array. Again, this is available on higher-end PLCs.

This is the method needed if the user don't have arrays or an average instruction. Courtesy: Frank Lamb, Automation Primer

This is the method needed if the user don't have arrays or an average instruction. Courtesy: Frank Lamb, Automation Primer

This is the method needed if the user doesn't have arrays or an average instruction. Sum up all of the values and divide by the number of values. The user can keep a running average of values this way for two or three values at a time. This could in turn be read back into another array for a running record of averages for smoothing.

This rung calculates the rate of change or Delta between consecutive captures and it works on any platform. Courtesy: Frank Lamb, Automation Primer

This rung calculates the rate of change or Delta between consecutive captures and it works on any platform. Again, this could be read back into an array for analysis. It is useful for determining the direction of change as well as its amplitude. For filtering, the user can capture "spike" values.

When analyzing signals it can be useful to capture signals as quickly or frequently as possible, unlike control and filtering. The limit will be how often the card actually posts a new value to its register. By capturing lots of values in an array, you can determine the update rate of your analog card, or A-D converter. If the user has an average of five identical values in a row at a capture rate of 5ms, your card updates every 25ms. Also, the faster you capture signals, the more likely you are to record a "spike" or out of tolerance value.

The next post on ladder logic will focus on data manipulation once the data has been captured from the analog card.

Frank Lamb is the founder of Automation Consulting Services Inc. This article originally appeared on the Automation Primer blog. Automation Primer is a CFE Media content partner. Edited by Chris Vavra, production editor, Control Engineering, CFE Media, cvavra@cfemedia.com.

ONLINE extra

For more articles on PLCs and programming, see related articles below.



The Engineers' Choice Awards highlight some of the best new control, instrumentation and automation products as chosen by...
The System Integrator Giants program lists the top 100 system integrators among companies listed in CFE Media's Global System Integrator Database.
Each year, a panel of Control Engineering and Plant Engineering editors and industry expert judges select the System Integrator of the Year Award winners in three categories.
This eGuide illustrates solutions, applications and benefits of machine vision systems.
Learn how to increase device reliability in harsh environments and decrease unplanned system downtime.
This eGuide contains a series of articles and videos that considers theoretical and practical; immediate needs and a look into the future.
Robotic integration and cloud connections; SCADA and cybersecurity; Motor efficiency standards; Open- and closed-loop control; Augmented reality
Controller programming; Safety networks; Enclosure design; Power quality; Safety integrity levels; Increasing process efficiency
Additive manufacturing benefits; HMI and sensor tips; System integrator advice; Innovations from the industry
Featured articles highlight technologies that enable the Industrial Internet of Things, IIoT-related products and strategies to get data more easily to the user.
This article collection contains several articles on how automation and controls are helping human-machine interface (HMI) hardware and software advance.
This digital report will explore several aspects of how IIoT will transform manufacturing in the coming years.

Find and connect with the most suitable service provider for your unique application. Start searching the Global System Integrator Database Now!

Cloud, mobility, and remote operations; SCADA and contextual mobility; Custom UPS empowering a secure pipeline
Infrastructure for natural gas expansion; Artificial lift methods; Disruptive technology and fugitive gas emissions
Mobility as the means to offshore innovation; Preventing another Deepwater Horizon; ROVs as subsea robots; SCADA and the radio spectrum
Automation Engineer; Wood Group
System Integrator; Cross Integrated Systems Group
Jose S. Vasquez, Jr.
Fire & Life Safety Engineer; Technip USA Inc.
This course focuses on climate analysis, appropriateness of cooling system selection, and combining cooling systems.
This course will help identify and reveal electrical hazards and identify the solutions to implementing and maintaining a safe work environment.
This course explains how maintaining power and communication systems through emergency power-generation systems is critical.
The Engineers' Choice Awards highlight some of the best new control, instrumentation and automation products as chosen by...
The System Integrator Giants program lists the top 100 system integrators among companies listed in CFE Media's Global System Integrator Database.
Each year, a panel of Control Engineering and Plant Engineering editors and industry expert judges select the System Integrator of the Year Award winners in three categories.
This eGuide illustrates solutions, applications and benefits of machine vision systems.
Learn how to increase device reliability in harsh environments and decrease unplanned system downtime.
This eGuide contains a series of articles and videos that considers theoretical and practical; immediate needs and a look into the future.
Robotic integration and cloud connections; SCADA and cybersecurity; Motor efficiency standards; Open- and closed-loop control; Augmented reality
Controller programming; Safety networks; Enclosure design; Power quality; Safety integrity levels; Increasing process efficiency
Additive manufacturing benefits; HMI and sensor tips; System integrator advice; Innovations from the industry
Featured articles highlight technologies that enable the Industrial Internet of Things, IIoT-related products and strategies to get data more easily to the user.
This article collection contains several articles on how automation and controls are helping human-machine interface (HMI) hardware and software advance.
This digital report will explore several aspects of how IIoT will transform manufacturing in the coming years.

Find and connect with the most suitable service provider for your unique application. Start searching the Global System Integrator Database Now!

Cloud, mobility, and remote operations; SCADA and contextual mobility; Custom UPS empowering a secure pipeline
Infrastructure for natural gas expansion; Artificial lift methods; Disruptive technology and fugitive gas emissions
Mobility as the means to offshore innovation; Preventing another Deepwater Horizon; ROVs as subsea robots; SCADA and the radio spectrum
Automation Engineer; Wood Group
System Integrator; Cross Integrated Systems Group
Jose S. Vasquez, Jr.
Fire & Life Safety Engineer; Technip USA Inc.
This course focuses on climate analysis, appropriateness of cooling system selection, and combining cooling systems.
This course will help identify and reveal electrical hazards and identify the solutions to implementing and maintaining a safe work environment.
This course explains how maintaining power and communication systems through emergency power-generation systems is critical.
The Engineers' Choice Awards highlight some of the best new control, instrumentation and automation products as chosen by...
The System Integrator Giants program lists the top 100 system integrators among companies listed in CFE Media's Global System Integrator Database.
Each year, a panel of Control Engineering and Plant Engineering editors and industry expert judges select the System Integrator of the Year Award winners in three categories.
This eGuide illustrates solutions, applications and benefits of machine vision systems.
Learn how to increase device reliability in harsh environments and decrease unplanned system downtime.
This eGuide contains a series of articles and videos that considers theoretical and practical; immediate needs and a look into the future.
Robotic integration and cloud connections; SCADA and cybersecurity; Motor efficiency standards; Open- and closed-loop control; Augmented reality
Controller programming; Safety networks; Enclosure design; Power quality; Safety integrity levels; Increasing process efficiency
Additive manufacturing benefits; HMI and sensor tips; System integrator advice; Innovations from the industry
Featured articles highlight technologies that enable the Industrial Internet of Things, IIoT-related products and strategies to get data more easily to the user.
This article collection contains several articles on how automation and controls are helping human-machine interface (HMI) hardware and software advance.
This digital report will explore several aspects of how IIoT will transform manufacturing in the coming years.

Find and connect with the most suitable service provider for your unique application. Start searching the Global System Integrator Database Now!

Cloud, mobility, and remote operations; SCADA and contextual mobility; Custom UPS empowering a secure pipeline
Infrastructure for natural gas expansion; Artificial lift methods; Disruptive technology and fugitive gas emissions
Mobility as the means to offshore innovation; Preventing another Deepwater Horizon; ROVs as subsea robots; SCADA and the radio spectrum
Automation Engineer; Wood Group
System Integrator; Cross Integrated Systems Group
Jose S. Vasquez, Jr.
Fire & Life Safety Engineer; Technip USA Inc.
This course focuses on climate analysis, appropriateness of cooling system selection, and combining cooling systems.
This course will help identify and reveal electrical hazards and identify the solutions to implementing and maintaining a safe work environment.
This course explains how maintaining power and communication systems through emergency power-generation systems is critical.
click me