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.

The best solution to implement a measurement cycle with two parts.


tomasafonso Aug 28, 2023 02:55 PM

Hello.

I am working with a CR1000x. My measurement cycle is 6 hours (360 minutes) and it repeats indefinitely. This cycle has two parts:

1) The first 30 minutes I have to acquire some analog sensors every second and save the values in a table.

2) Between minutes 31 and 359 I only have to acquire the data from a weather station once a minute and store them in another table.

I can think of a couple of ways to do it but I would like you to recommend the best solution from the point of view of electrical consumption, which is critical in my case.

Greetings


JDavis Aug 31, 2023 02:52 PM

One approach is to use SubScan within a 6 hour scan. I recommend against that. Staying within the scan, the datalogger won't power down all the way to sleep.

Use the TimeIsBetween() instruction to exit the scan early. Finishing a scan will let the data logger drop to low power sleep. ContinueScan jumps to NextScan.

BeginProg
  Scan (1,Sec,0,0)
    If NOT  TimeIsBetween (0,1800,21600,Sec) Then
      ContinueScan
    EndIf
    'Measurement here
    'CallTable here
  NextScan
  SlowSequence
  Scan (1,Min,3,0)
    If NOT TimeIsBetween (31,360,360,min) Then
      ContinueScan
      'Measurement here
      'CallTable here
    EndIf
  NextScan
EndProg

The data logger will wake up once per second, but will go quickly to sleep if no measurements need to be performed. 

Double check what I set the intervals to in the example.

There is another method that might save a bit more power. I used it for a station in Antarctica. Be sure to test this well, because a mistake can make the program stop making measurements or get stuck in a loop.

 

BeginProg
  Do
    Scan (1,Sec,0,1800) '1 second scan for 30 minutes

      'Measurement here
      'CallTable here
    NextScan
    Scan (1,Min,0,330) '1 minute scan for the rest of 6 hours
      'Measurement here
      'CallTable here
    EndIf
  NextScan
Loop 'Returns to Do
EndProg

 Double check the scan counts. When the first scan completes 1800 cycles, it will exit and the second scan can start.

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