Analog rate of change - old forum post


Joined on 10-16-2007
Posts 1
Rate-of-Change for Analog Input

I have a SNAP-AITM thermocouple module with a SNAP-UP1-ADS brain, SNAP-PAC-S1 controller, and PACControl Pro software. I’m looking for an elegant way to measure/record the rate of temperature change on the TC. I currently use a chart with a 1-second delay. Since that delay is not reliable in terms of repeatability, I use a Get Seconds command and then subtract the old value from the new and calculate the rate. Anybody have a more elegant solution, maybe one that offloads this to the brain? I’ve been thinking of looking at a PID and getting the derivative value, has anybody done something along these lines? Any other more elegant solution that doesn’t require me to do the timing on a chart?
10-19-2007, 4:53 AM

Joined on 12-01-2003
Optomation Systems, Madrid, Spain
Posts 153
Re: Rate-of-Change for Analog Input

Interesting question that brings up some important low level technical points.

I presume that you using PACControl and not ioControl to develop and run the chart on the SNAP-PAC-S1 controller. But as the I/O is running on the SNAP-UP1-ADS there are at least three latency delays in the overall synchronism. The general concept of your chart program sounds fine, but you should be writing it locally on the SNAP-UP1-ADS to avoid any uncontrollable time cycles in transferring the data over Ethernet to the SNAP-PAC-S1.

The problem is that PACControl only allows the SNAP-UP1-ADS to be used as a slave device and not as a control engine. The simplest solution would be to upgrade your SNAP-UP1-ADS to a SNAP_PAC-R1/R2 and develop the program under PACControl, but you could also try downgrading your SNAP-PAC-S1 to Version7 software and developing under ioProject V7. Opto22 should be able to supply you with a suitable kernel.

Another alternative would be to develop the program using ioControl V7 which does allow the SNAP-UP1-ADS to be used as a control engine, and then use the scratchpad or memory map to transfer the final calculated rate of change value to the SNAP-PAC-S1 controller under PACProject. It’s a bit dirtier but cheaper than upgrading hardware.

There also is a possibility of using the datalogging function directly on the brain. This is on the I/O side of the processor so will always give a faster response than the control engine side of the brain. You can set this up using ioManager or writing to the memorymap directly from the SNAP-PAC-S1. This will datastamp a configured data sample with an I/O based millisecond timer, and you could decode the resulting strings to get the sample time and values. You will still need to work on the problem that this is a circular file of 300 lines, but if you are looking for the temperature change based on a specific event it could be the answer.

It would also be nice to know what time base you are sampling the temperature input and over what time base you require to integrate over.

Finally I hope you are using the command Delay (msec) and not Delay (sec). The multitasking operating system knows the difference in calculating when it has to check the chart.