Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

CR1000, Rain gauge total resetting


Naia Feb 1, 2011 11:56 PM

I have a tipping bucket rain gauge and a CR1000. I am recording tips(rain_in) and overall tips(RainTotal_in). Unfortunately, the site looses power occasionally. When the power is cycled, the RainTotal_in resets to zero. How can I prevent this?

I have tried by using the GetRecord command, but the RainTotal_in always displays as NAN. Suggestions or other approach recommendations?

Here is my code:

SequentialMode
Public Rain_in, RainTotal_in
Public LastRain(3)
Public RainMonth 'Monthly rain total

DataTable(Rain,True,-1)
DataInterval(0,1,Min,0)
Totalize(1,Rain_in,FP2,0)
Sample(1, RainTotal_in,FP2)
Sample(1,RainMonth,FP2)'Not using
EndTable

BeginProg
Scan(1,Sec,1,0)
PulseCount(Rain_in,1,2,2,0,0.003937,0)
RainTotal_in = RainTotal_in + Rain_in

If RainTotal_in = 0 Then
GetRecord(LastRain,Rain,3)
RainTotal_in = LastRain(2) + Rain_in

EndIf

CallTable(Rain)

NextScan
EndProg


aps Feb 2, 2011 03:24 PM

To avoid resetting working variables, include the command Preservevariables in the program. See the help for further details. This works through most reset scenarios.

The Getrecord instruction would also work except the last parameter should be 1 for the most recent record.

* Last updated by: aps on 2/2/2011 @ 11:07 AM *

Log in or register to post/reply in the forum.