Temperature rate of change calc.

bwheat

Member
Join Date
Sep 2003
Location
LA
Posts
174
I need to calculate the rate of change of a temperature.
Using AB SLC 5/04, and 1746-NT8. Thermocouple measures temperature in an air duct. I need to monitor the rate of temperature change in the duct and flag and alarm when the rate of rise exceed 20 degrees per minute.

I guess I could take a sample every second and load the data into an array (block of registers) and average the temperatures after say 10 seconds, store the average, wait ten more seconds store the second average and subtract the first average from the second average and have the rate of change for 10 seconds BUT there has to be a better way.

If anybody has any suggestions please let me know.
 
You could have a timer keeping track of the elapsed time between incremental changes in temperature.

Let's say your signal has a resolution of tenths of a degree, and is reasonably noise-free. If your timer measures elapsed time between a one-degree change, then the timer ACC value represents seconds (or milliseconds or whatever) per degree. The inverse of that value is degrees per second (or milliseconds or whatever).
 
In a data table with 60 integers record the current temp every second, moving along and overwriting the temp of 60 seconds ago. Compare the value you are writing now to the value in the next data block (temp a minute ago). If diff > 20 degrees, activate alarm.

This will alarm a change of 20 degrees at any 1 minute span with a 1 second resolution, no averaging required.
 
temp rate of change calc

I am still working out the first suggestion.

The block of 60 registers makes sense. Just use indirect addressing to point to the correct registers and do a compare. To impliment this I have to create a data table with 60 registers. I cannot do this right now but I think will try it with 10 regisers and have a 6 second resolution.
 
Several ideals come to mind.

If your temperature reading is relatively noise-free, yoo can take a sample every 1.2 sec (= 1/50th min) with a self-reseting timer, storing that temperature. At the next timer.DN, compare the current to the stored, if the change is greater than 0.4º (20º/50min), then set the alarm. Capture the current temperature for use next timer.DN.

Alternatively, if you need to average the temperature, then create an 11 sample FIFO (Suggestion: Use the technique COP N10:1 N10:0 11, MOV CurrentTemp N10:11 for a quick & easy FIFO).

Calculate the rolling average for the last 10 samples, using the forumla:

CurrAVE = (9*CurrAVE - Sample#10 + CurrentTemp) / 10

Compare it to the previous rolling average:

PrevAVE = (9*PrevAVE - Sample#11 + Sample#1) / 10

Again, if the difference is less than (20º*(sample_rate(sec)/60), then alarm.

The good thing about this technique is that it reduces noise. The bad thing is that a sudden, real, but undersirable change will be masked as "noise", delaying detection for as many as 10 seconds.

Pick your poison.


Added after posting
Vetteboy's idea is a combo of both of my suggestions. Again, use the FIFO I suggest, making it 60 long, and loading it in N10:60.

Again it's a tradeoff. You have to wait for it to be a full 20º off before triggering the alarm, with a delay of a whole minute. You could compare it over only 30 seconds, and look for a 10º change, or 15 sec and look for 5. (or, as I suggested, sample over 1.2 and look for 0.4. )

Again, pick your poison.
 
Last edited:
It depends on if you need an alarm at an instantaneous rate of change of 20° per minute, or if the average rate of change over twenty minutes is greater than 20° (see the difference?)

For the first, take a reading every second or ten seconds or whatever, subtract the current reading from the last reading, divide by the number of seconds, multiply by 0.01667 to get minutes, and if the answer is > 20 or < -20 set your alarm. Copy the current reading into the last reading register, and wait for the timer.

For the second, you could do the same as above but every 20 minutes, but that would be quite crude. A better answer is to use the same process as the first, but take a rolling average. For example, for sample and rate of change taken every 30 seconds you would do yor rolling average over 40 samples.

To calculate a rolling average multiply the current rolling average by the number of samples, add the new sample, divide by the number of samples, and store the answer in the current rolling average.
 
Thanks Guys,
I think I will look at the delta T over 1.2 seconds. I need to know ASAP when the rate of change is too high. Like Mr. Nelson said the drawback to this approach is the possiblity of noise but I cant wait for a minute to go by before I do anything. I guess I picked my poison.
 
Last edited:
If your signal has noise riding on it, simply increase the time period. Starting from Allen's original example, if you were to increase the time period to 2.4 seconds (1/25 minute), the allowable variation would be 0.8 degrees (20/25). If you can look at the temperature signal with a 'scope, you can get a feel for the normal variation and adjust your time period accordingly.
 
Tom , I hope this isn't nit-picky but your algorithm for a "rolling average" in you 4th paragraph seems to yield a constantly rising rolling average with a constant signal. I think the initial multiplication should be by (number of samples - 1)
 
I just put the code in looking at the 1.2 second peroid with at .4 degree rate of change and I guess I am getting noise because I get the alarm but when I look at the temperature and my calculated delta T it is zero. Of course I am not watching the temperature when I get the alarm. I think I will try 2.8 and .8.
 
I don't have anything to add other than "thank yous" for the ideas. I have been working on a project that involves controlling the velocity of a hydraulic ram and this has sparked some thoughts. Rather than measuring distance over time as I have been, I'm going to see if I can monitor the rate of change as as has been suggested here.
 

Similar Topics

Hello, Does anyone know if there is a ready made function available in Siemens S7-300 series for rate of temperature rise/drop detection? I need...
Replies
3
Views
1,991
I’m attempting to send a temperature from a SLC-5/02 to an EZiMarquee display. The vendor said to use a MSG instruction to send the data to the...
Replies
1
Views
85
Hi!! I'm looking for Temperature rise calculation software from Rockwell, I just download "Product selection toolbox 2022" but this software is...
Replies
1
Views
211
I have S7 1512C controler for controlling 48 PID temperature loop, the output is PWM. Please I need the best, most efficient way to write the...
Replies
13
Views
604
I am looking for temperature/humidity sensor recommendations. Would like the sensor to display temp and humidity. Need to connect to a Contrologix...
Replies
4
Views
226
Back
Top Bottom