I need to implement some Rate of Change Logic on one of my tanks and the only information I have is the Level(measured in feet) and the Gallons(which has already been scaled based on the feet in the tank). I need to calculate my rate of level change in gallons per hour and feet per hour .
You should be able to use the Deadtime function block to accomplish this. Make the tank level the input to the block, set the deadtime to 3600 seconcds, and then bring output from this block along with the current tank level to a Calc block to calculate the rate of change.
In reply to David Nelson:
Hi,
now it depends do you want the actual rate of change or some historical that only updates ones/hour?
Make a derivate calc block. "Rate=New value-old value/time -> new value => old value...."
If you call the block e.g. 1/second or use a timer there you have the time base
Niklas Flykt
Klinkmann Oy
Key Account Manager safety products
nikfly@gmail.com
In reply to Niklas Flykt:
In addition to what Niklas said, you can also take advantage of the fact that modules are being run based on schedule. So a simple CALC block that buffers the old value every module execution will do it.
You can also get a little fancy by using a user defined parameter that is configured as floating point array. You should be able to hold 127 old values and calculate rate of change that way.