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.

record rain only if non zero value


dfunke King County Apr 5, 2012 11:44 PM

Hi, we want to record rain from a TB3 at one minute intervals, but only write to the table those records with rain. Easy enough with a 1 minute scan, but it's nice to keep the scan at 10 seconds.

CR200
10 second scan

DataTable(Tips,Rain_in >0.00000,6000)
DataInterval(0,1,Min)
Totalize(1,Rain_in,False)
EndTable
I tried the above but it will write the total (since the previous write) only when a tip happened in the last scan of the minute.

'TB4 Rain Gauge measurement Rain_in:
PulseCount(Rain_in,P_SW,2,0,0.01,0)

We have been writing to the table when any scan has a tip, but we don't like having to deal with the seconds in our database.

DataTable(Tips2,Rain_in<>0.00000,6000)
Totalize(1,Rain_in,False)
EndTable

Thanks

Dave


aps Apr 6, 2012 08:07 AM

In the CR200 to do this you need to keep a running total of the rain within the main scan which is reset after data is stored.

This code should do this:

'CR200 Series Datalogger

Public rain_in, rain_in_min

'Define Data Tables
DataTable(Tips,rain_in_min >0,6000)
DataInterval(0,1,Min)
Totalize(1,rain_in,False)
EndTable


'Main Program
BeginProg
Scan (10,Sec)
PulseCount (rain_in,P_LL,0,0,1.0,0)
'Totalise the rain here for the test
rain_in_min=rain_in_min+rain_in
CallTable Tips
'Reset total after data stored (at end of the minute)
If Tips.output(1,1) Then rain_in_min=0
NextScan
EndProg


mortenx Nov 12, 2020 07:53 AM

what this 10 sec is? what this does ? why not 1 or 60?

'Main Program
BeginProg
Scan (10,Sec)

nsw Nov 20, 2020 11:32 AM

The original request from Dave was to have the Scan at 10s.

It could run at 1s or 60s as you say, but there may be other measurements that need to work at 10s. For Help on the Scan instruction, please see CRbasic Help for Scan.

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