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.



Engineers' Choice Awards
The Engineers' Choice Awards highlight some of the best new control, instrumentation and automation products as chosen by Control Engineering subscribers.
System Integrator Giants
The System Integrator Giants program lists the top 100 system integrators among companies listed in CFE Media's Global System Integrator Database.
System Integrator of the Year
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.
How to Maximize Factory Automation Efficiency with Low Cost Machine Vision
This eGuide illustrates solutions, applications and benefits of machine vision systems.
Wireless Reliability in Harsh Environments
Learn how to increase device reliability in harsh environments and decrease unplanned system downtime.
Human Factors and the Impact on Plant Safety
This eGuide contains a series of articles and videos that considers theoretical and practical; immediate needs and a look into the future.
May 2018
Salary and Career Survey, IT and OT convergence, robotic standards and safety, secure circuit protection
April 2018
Cybersecurity best practices, artificial intelligence, robotic additive manufacturing, embedded systems, IIoT integration, energy efficiency
March 2018
Digitalization integration, process sensors, edge computing, fog computing, condition monitoring, and motors
Edge Computing
This article collection contains several articles on how today's technologies heap benefits onto an edge-computing architecture such as faster computing, better networking, more memory, smarter analytics, cloud-based intelligence, and lower costs.
IIoT: Machines, Equipment, & Asset Management
Articles in this digital report highlight technologies that enable Industrial Internet of Things, IIoT-related products and strategies.
PLCs
Programmable logic controllers (PLCs) represent the logic (decision) part of the control loop of sense, decide, and actuate. Featured articles in this digital report compare PLCs and programmable automation controllers (PACs), industrial PCs, and robotic controllers.
SIDB

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

June 2018
Machine learning, produced water benefits, progressive cavity pumps
April 2018
ROVs, rigs, and the real time; wellsite valve manifolds; AI on a chip; analytics use for pipelines
February 2018
Focus on power systems, process safety, electrical and power systems, edge computing in the oil & gas industry
John O. Ayuk, PE, CFSE, PMP, CAP
Automation Engineer; Wood Group
Doug Baker
System Integrator; Cross Integrated Systems Group
Jose S. Vasquez, Jr.
Jose S. Vasquez, Jr.
Fire & Life Safety Engineer; Technip USA Inc.
Data Centers: Impacts of Climate and Cooling Technology
This course focuses on climate analysis, appropriateness of cooling system selection, and combining cooling systems.
Safety First: Arc Flash 101
This course will help identify and reveal electrical hazards and identify the solutions to implementing and maintaining a safe work environment.
Critical Power: Hospital Electrical Systems
This course explains how maintaining power and communication systems through emergency power-generation systems is critical.
Engineers' Choice Awards
The Engineers' Choice Awards highlight some of the best new control, instrumentation and automation products as chosen by Control Engineering subscribers.
System Integrator Giants
The System Integrator Giants program lists the top 100 system integrators among companies listed in CFE Media's Global System Integrator Database.
System Integrator of the Year
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.
How to Maximize Factory Automation Efficiency with Low Cost Machine Vision
This eGuide illustrates solutions, applications and benefits of machine vision systems.
Wireless Reliability in Harsh Environments
Learn how to increase device reliability in harsh environments and decrease unplanned system downtime.
Human Factors and the Impact on Plant Safety
This eGuide contains a series of articles and videos that considers theoretical and practical; immediate needs and a look into the future.
May 2018
Salary and Career Survey, IT and OT convergence, robotic standards and safety, secure circuit protection
April 2018
Cybersecurity best practices, artificial intelligence, robotic additive manufacturing, embedded systems, IIoT integration, energy efficiency
March 2018
Digitalization integration, process sensors, edge computing, fog computing, condition monitoring, and motors
Edge Computing
This article collection contains several articles on how today's technologies heap benefits onto an edge-computing architecture such as faster computing, better networking, more memory, smarter analytics, cloud-based intelligence, and lower costs.
IIoT: Machines, Equipment, & Asset Management
Articles in this digital report highlight technologies that enable Industrial Internet of Things, IIoT-related products and strategies.
PLCs
Programmable logic controllers (PLCs) represent the logic (decision) part of the control loop of sense, decide, and actuate. Featured articles in this digital report compare PLCs and programmable automation controllers (PACs), industrial PCs, and robotic controllers.
SIDB

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

June 2018
Machine learning, produced water benefits, progressive cavity pumps
April 2018
ROVs, rigs, and the real time; wellsite valve manifolds; AI on a chip; analytics use for pipelines
February 2018
Focus on power systems, process safety, electrical and power systems, edge computing in the oil & gas industry
John O. Ayuk, PE, CFSE, PMP, CAP
Automation Engineer; Wood Group
Doug Baker
System Integrator; Cross Integrated Systems Group
Jose S. Vasquez, Jr.
Jose S. Vasquez, Jr.
Fire & Life Safety Engineer; Technip USA Inc.
Data Centers: Impacts of Climate and Cooling Technology
This course focuses on climate analysis, appropriateness of cooling system selection, and combining cooling systems.
Safety First: Arc Flash 101
This course will help identify and reveal electrical hazards and identify the solutions to implementing and maintaining a safe work environment.
Critical Power: Hospital Electrical Systems
This course explains how maintaining power and communication systems through emergency power-generation systems is critical.
Engineers' Choice Awards
The Engineers' Choice Awards highlight some of the best new control, instrumentation and automation products as chosen by Control Engineering subscribers.
System Integrator Giants
The System Integrator Giants program lists the top 100 system integrators among companies listed in CFE Media's Global System Integrator Database.
System Integrator of the Year
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.
How to Maximize Factory Automation Efficiency with Low Cost Machine Vision
This eGuide illustrates solutions, applications and benefits of machine vision systems.
Wireless Reliability in Harsh Environments
Learn how to increase device reliability in harsh environments and decrease unplanned system downtime.
Human Factors and the Impact on Plant Safety
This eGuide contains a series of articles and videos that considers theoretical and practical; immediate needs and a look into the future.
May 2018
Salary and Career Survey, IT and OT convergence, robotic standards and safety, secure circuit protection
April 2018
Cybersecurity best practices, artificial intelligence, robotic additive manufacturing, embedded systems, IIoT integration, energy efficiency
March 2018
Digitalization integration, process sensors, edge computing, fog computing, condition monitoring, and motors
Edge Computing
This article collection contains several articles on how today's technologies heap benefits onto an edge-computing architecture such as faster computing, better networking, more memory, smarter analytics, cloud-based intelligence, and lower costs.
IIoT: Machines, Equipment, & Asset Management
Articles in this digital report highlight technologies that enable Industrial Internet of Things, IIoT-related products and strategies.
PLCs
Programmable logic controllers (PLCs) represent the logic (decision) part of the control loop of sense, decide, and actuate. Featured articles in this digital report compare PLCs and programmable automation controllers (PACs), industrial PCs, and robotic controllers.
SIDB

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

June 2018
Machine learning, produced water benefits, progressive cavity pumps
April 2018
ROVs, rigs, and the real time; wellsite valve manifolds; AI on a chip; analytics use for pipelines
February 2018
Focus on power systems, process safety, electrical and power systems, edge computing in the oil & gas industry
John O. Ayuk, PE, CFSE, PMP, CAP
Automation Engineer; Wood Group
Doug Baker
System Integrator; Cross Integrated Systems Group
Jose S. Vasquez, Jr.
Jose S. Vasquez, Jr.
Fire & Life Safety Engineer; Technip USA Inc.
Data Centers: Impacts of Climate and Cooling Technology
This course focuses on climate analysis, appropriateness of cooling system selection, and combining cooling systems.
Safety First: Arc Flash 101
This course will help identify and reveal electrical hazards and identify the solutions to implementing and maintaining a safe work environment.
Critical Power: Hospital Electrical Systems
This course explains how maintaining power and communication systems through emergency power-generation systems is critical.
click me