I am attempting to set up a way to view a running rainfall total for the current day, that resets every 24hrs (midnight). What I have thus far...
Public DailyTotal
If TimeIntoInterval(0,24,Hr) Then TotalRun(DailyTotal,1,BucketsTips,8640),24,Hr
DailyTotal = DailyTotal * .01
I am not recieving anything when it is raining. The program has a 10 second data interval. DailyTotal paramter selected in the Digital output on my RTMC. I'm a novice, and have been staring at this far to long. What am i missing?
Don't use TotalRun() within an If statement. That was tripping you up. Make use of the RunReset parameter of TotalRun.
Note that is the program scan rate changes, the count for TotalRun and the TimeIntoInterval need to change.
Public BucketTips , DailyTotal Public RunReset As Boolean BeginProg Scan (10,Sec,0,0) RunReset = TimeIntoInterval (10,86400,Sec) TotalRun (DailyTotal,1,BucketTips * 0.01,8640, RunReset) NextScan EndProg
Here is another way to solve the problem.
Public BucketTips , DailyTotal DataTable (Table1,True,-1 ) DataInterval (0,1,Hr,10) Totalize (1,BucketTips,Long,False) Sample (1,DailyTotal,IEEE4) EndTable BeginProg Scan (10,Sec,0,0) PulseCount (BucketTips,1,P1 ,1,0,1.0,0) DailyTotal += BucketTips * 0.01 CallTable Table1 'Must be after CallTable If TimeIntoInterval (0,24,Hr)Then DailyTotal = 0 NextScan EndProg
The first option eliminates the need for the DailyTotal = DailyTotal * .01 line correct?
Thank you for the help!
Do not use:
DailyTotal = DailyTotal * .01
Every scan, your total would get smaller.