Monitoring of Analog value

Chibu

Member
Join Date
Feb 2023
Location
Ontario
Posts
49
Hi Guys,

I'm working on a Lintel Test Machine control application with AB Guardlogix PLC, which involves Pressing Lintel Sample and monitoring the applied load (analog input) until the load value gets to a constant value then a sudden ramp up of value. That is the point to be monitored/detected as Break Point.

Please guys, how can I monitor an analog input to detect this Point?

Any ideas will be appreciated.
 
Compare input values for a period of time when there is little change, the near constant value, for instance , if point-to-point change is less than ±0.1 for X samples or whatever values apply to your signal. Satisfying the conditions for X samples declares 'constant state'.

Once the near constant state has been detected, enable a rate-of-change alarm for polarity and rate of the load change. The time stamp on the rate of change alarm is the inflection point.
 
A moving mean is usually useful for these cases, with a proper adjustment of the number of points the mean is based on, and the acquisition time between samples.
Then for detecting stability you can compare the absolute difference between the actual value and the mean value, and if it is inside a threshold, it is stable.

For your Break Point, compute (Act_value - Mov_mean_value), and check if it is positive and greater than a 'ramp threshold'.
 
Compare input values for a period of time when there is little change, the near constant value, for instance , if point-to-point change is less than ±0.1 for X samples or whatever values apply to your signal. Satisfying the conditions for X samples declares 'constant state'.

Once the near constant state has been detected, enable a rate-of-change alarm for polarity and rate of the load change. The time stamp on the rate of change alarm is the inflection point.

Thanks for the input.

Please, if you don't mind, could you please help attach a code sample or drawing of the ladder logic or FBD? Sorry if I'm asking too much
 
A moving mean is usually useful for these cases, with a proper adjustment of the number of points the mean is based on, and the acquisition time between samples.
Then for detecting stability you can compare the absolute difference between the actual value and the mean value, and if it is inside a threshold, it is stable.

For your Break Point, compute (Act_value - Mov_mean_value), and check if it is positive and greater than a 'ramp threshold'.

Thanks too for the input.

By Moving Mean, are you referring to the MAVE Instruction (Moving Average)?

In your free time, could you please help attach a code sample or drawing of the ladder logic or FBD? Sorry if I'm asking too much

I will be grateful.
 
A 4-20 mA (or 0-10 VDC) signal comes into the card. The card translates this into 0-27647. That is your analog range. You scale this either in PLC or OPC to your desired display output if needed. For instance, a level sensor, you scale 0-27647 to 0-100%.

Edit: The range I used is for Siemens. They use 15 bits instead of 16 to allow for over range values without having to account for it in your scaling.
 
A 4-20 mA (or 0-10 VDC) signal comes into the card. The card translates this into 0-27647. That is your analog range. You scale this either in PLC or OPC to your desired display output if needed. For instance, a level sensor, you scale 0-27647 to 0-100%.

Edit: The range I used is for Siemens. They use 15 bits instead of 16 to allow for over range values without having to account for it in your scaling.

Not Scaling issue Bro. Please, could you review Post #1?
 
there are a few statistical approaches that may work here. mean and standard deviation might be enough to know when the values are at a given level (constant), but those might not be enough to discriminate between an increasing ramp and a decreasing ramp from there.

You can calculate the slope of some number of samples of the most recent data (analog input values representing load) vs. time, and when that calculated slope is near zero (below some threshold), the algorithm "considers" the load to be constant, and changes a a bit, e.g. "Load_Is_Constant," from 0 to 1.

Then, when the value of the Load_Is_Constant bit is 1, and the calculated slope then rises above another threshold (greater than the first, to account for noise), the algorithm could consider a ramp to have started, so it changes the value of Load_Is_Constant back to 0, and changes another bit, e.g. "Ramp_Started," from 0 to 1.

So the slope calculation, plus two cascading Start/Stop circuits driven by the threshold checks as part of the Start conditions, might do the trick.

The formula for slope is here: https://www.mathsisfun.com/data/least-squares-regression.html. I am pretty sure those sums could be calculated, and re-calculated, in an incremental manner as each new value comes in, with a single FIFO of the measured values (FFL/FFU instructions for Allen-Bradley). The FIFO holds the most recent N data values (y), and you maintain scalar tags for each of the terms (Σy, Σxy; Σx and Σx2 are constants e.g. Σx = (N-1)(N-2)/2; x is time ≡ sequence number). Each time a new datum (y value) is sampled

  • the current value of Σy is subtracted from, and the datum value (N-1)ynew is added to, Σxy,
  • the oldest datum yold is removed from, and the ynew is appended to, the FIFO
  • and yold and ynew values are used to adjust Σy.
For accuracy it would be best to use the raw INT (or UINT) data directly, and store them and the various sums in DINT or UDINT, or even LREAL if it's available, arrays.

That part is easy. The tricky part will be characterizing the system to determine the best sampling size (N) and frequency, but that will be true for any of the other excellent methods mentioned so far as well.
 
Last edited:
monitoring the applied load (analog input) until the load value gets to a constant value then a sudden ramp up of value. That is the point to be monitored/detected as Break Point.


One aspect of this is that, no matter the implemented algorithm, you will not be able to detect and/or confirm a Break Point until after it has occurred, by at least one and possibly two or more sample periods, depending on the level of noise.

Also note that, again whatever the implemented algorithm, there may be false positives (faux Break Point detected) and/or false negatives (actual Break Point not detected).

It would be useful to know the character of the data (sample time, common cause variation or noise, etc.), e.g. a few trends of what the data for a Break Point do, and do not, look like.
 
there are a few statistical approaches that may work here. mean and standard deviation might be enough to know when the values are at a given level (constant), but those might not be enough to discriminate between an increasing ramp and a decreasing ramp from there.

You can calculate the slope of some number of samples of the most recent data (analog input values representing load) vs. time, and when that calculated slope is near zero (below some threshold), the algorithm "considers" the load to be constant, and changes a a bit, e.g. "Load_Is_Constant," from 0 to 1.

Then, when the value of the Load_Is_Constant bit is 1, and the calculated slope then rises above another threshold (greater than the first, to account for noise), the algorithm could consider a ramp to have started, so it changes the value of Load_Is_Constant back to 0, and changes another bit, e.g. "Ramp_Started," from 0 to 1.

So the slope calculation, plus two cascading Start/Stop circuits driven by the threshold checks as part of the Start conditions, might do the trick.

The formula for slope is here: https://www.mathsisfun.com/data/least-squares-regression.html. I am pretty sure those sums could be calculated, and re-calculated, in an incremental manner as each new value comes in, with a single FIFO of the measured values (FFL/FFU instructions for Allen-Bradley). The FIFO holds the most recent N data values (y), and you maintain scalar tags for each of the terms (Σy, Σxy; Σx and Σx2 are constants e.g. Σx = (N-1)(N-2)/2; x is time ≡ sequence number). Each time a new datum (y value) is sampled

  • the current value of Σy is subtracted from, and the datum value (N-1)ynew is added to, Σxy,
  • the oldest datum yold is removed from, and the ynew is appended to, the FIFO
  • and yold and ynew values are used to adjust Σy.
For accuracy it would be best to use the raw INT (or UINT) data directly, and store them and the various sums in DINT or UDINT, or even LREAL if it's available, arrays.

That part is easy. The tricky part will be characterizing the system to determine the best sampling size (N) and frequency, but that will be true for any of the other excellent methods mentioned so far as well.

Thanks, I appreciate your input.
Let me try to digest it.
 
One aspect of this is that, no matter the implemented algorithm, you will not be able to detect and/or confirm a Break Point until after it has occurred, by at least one and possibly two or more sample periods, depending on the level of noise.

Also note that, again whatever the implemented algorithm, there may be false positives (faux Break Point detected) and/or false negatives (actual Break Point not detected).

It would be useful to know the character of the data (sample time, common cause variation or noise, etc.), e.g. a few trends of what the data for a Break Point do, and do not, look like.

Well noted with thanks.
 

Similar Topics

Hello, I have a 24 volt dc system. I want to monitor the system voltage by using a resistor. Ohms law says it should be 1.5k for a range of 6 =...
Replies
5
Views
2,339
hi everyone i have 2 24 volt dc power supplies that i need to monitor the voltage on . using ab slc 5/05 processor . i have a ton of 1746-ni4...
Replies
13
Views
8,150
Our punch press has a SLC500 with HELM weight module (HM-604-WM) for tonnage monitoring. The operator enters the weight range on the HMI, which is...
Replies
9
Views
147
Hello, I have been trying to figure out how to connect to and monitor a DLR that is on a remote rack from my PLC. The local has a 1756-L81E and...
Replies
0
Views
81
Good day, we have 15 analog inputs, we need to log the data in excel and monitor these values through web browser. We're planning to go with Delta...
Replies
1
Views
80
Back
Top Bottom