SacArea-BayDeltaProjects / HydroRDITemplate

CR1000 and CR6 Datalogger template for RDI ADCPs
2 stars 0 forks source link

RealTime Function and "Mod..." variables #32

Closed violetteta8 closed 5 years ago

violetteta8 commented 5 years ago

I learned that the RealTime function returns the time for each part of the rTime array (rTime(9)) of the BEGINNING of the scan based on the datalogger's real-time clock. However, this does not start any timing functions whatsoever. Ex: I wrote a test to see what the burst wasn't working when I tried to adjust it to start in the 14th minute (If Mod15Minutes > 840 AND Mod15Minutes < 860 then GetBurst = True). Our assumption was that this meant "a buffer within 20sec of the 14th minute in the scan". However, the function was not working, so I created a variable called "BurstReachedMod" to return the value of "Mod15Minutes" when that part of the code was reached: ... BurstReachedMod = Mod15Minutes If Mod15Minutes > 840 AND Mod15Minutes < 860 then GetBurst = True ...

The value returned EVERY TIME is evenly divisible by 60, meaning that the Mod functions are simply holding the values at mm:00 of every minute.

I also created a timer to try to see when that part of the scan was reached, the timer has been between 3 and 4 seconds from the start of the scan even though the Mod values is returning the mm:00 value.

This needs to be addressed so we better understand our timing throughout the program. This could solve some of the other problems we were seeing with the burst, wiping, sensor measurements, etc. EVERYTHING!

violetteta8 commented 5 years ago

In the Suna project, I adjusted how the timers/mod stuff was working. Now, instead of "If Mod15Minutes >x AND <y", we say "If Mod15Minutes = n". Moved all MOD stuff to BEGINNING of scan, and set flags to begin EXO/SUNA wipe and sample processes based on the Mod timers. Then, created "scan" timers to tell when to initiate each function within the scan. This example shows how we control timing within the scan (note, these aren't necessarily the actual variable names): SunaStart = Timer(SunaTimer,mSec,2) 'start a timer at beginning of scan ' then do a loop until we reached whatever time we want a process to start, and read the timer until we 'reach the threshold. Do SunaStart = Timer(SunaTimer,mSec,4) 'read timer If SunaStart > 13 Then StartSample = True ExitDo Else StartSample = False Delay(1,250,mSec) Loop