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.

Avg/max/min of last 6 sec of a min


mak Oct 21, 2022 07:40 AM

Logger CR350, sensor SDI12.

I am trying to save power by reducing the number of scans, but also need data from every minute. Ideally, I want to record average/max/min data from 1 sec scans of the last 6 sec of every minute (54-60) and write that to a table. Is there an easy way to program this? Hopefully without scanning every 1 sec and only writing table for the last 6 sec (saving power!). 

Thanks for all support. 


JDavis Oct 21, 2022 05:00 PM

Do a 1 second scan, but don't measure every scan. The logger uses very little power waking up, then going back to sleep.

Make a boolean variable to mark when to do measurements. Also, use that within the DisableVar parameter of the Average(), Maximum(), and Minimum() instructions.

Suggested viewing:

https://www.campbellsci.com/videos/crbasic-4 

https://www.campbellsci.com/videos/crbasic-5

If you want to enable a range of time, I suggest TimeIsBetween().

Do note that the program will compile in SequentialMode. That can be a limiting factor in what measurements can be done within 1 second.

 

Public PTemp
Public MeasureEnable As Boolean

DataTable (Test,1,-1) 'Set table size to # of records, or -1 to autoallocate.
  DataInterval (0,60,Sec,10)
  Minimum (1,PTemp,IEEE4,NOT MeasureEnable,False)
EndTable

BeginProg
  Scan (1,Sec,0,0)

    MeasureEnable =   TimeIsBetween (54,60,60,Sec)
    If MeasureEnable Then
      PanelTemp (PTemp,60)
    EndIf
    
    CallTable Test
  NextScan
EndProg

 


mak Oct 24, 2022 06:53 AM

Exactly what I need. Thank you so much, Great support. 

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