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.

Scan at two different intervals?


rasteele Jan 2, 2013 08:08 PM

I have a weather station that is set up to scan at 10 second intervals and average every 2 minutes to a CR1000. Now I need to be able to log the max wind gust. Problem is that I need to scan for the max wind gust every 1 second along with keeping the 2 minute average. I thought about changing the interval for the whole scan to 1 second, but I'm not sure if that will cause an overrun. Is there an easy way to see this without loading the program? Thanks in advance for the help, I'm pretty new to CRBasic.

* Last updated by: rasteele on 1/2/2013 @ 1:13 PM *


kirving Jan 3, 2013 01:02 AM

The slowSequence instruction does what you describe, effectively allowing different scan intervals to run in parallel. We've used it in pretty simple cases to good effect, with the program structured something like this:

beginProg
'' do stuff once at program startup...
scan(60,sec,0,0)
'' do stuff every minute
callTable MinuteData
nextScan
slowSequence
scan(600,sec,0,0)
'' do stuff every 10 minutes
callTable TenMinData
nextScan
slowSequence
scan(2,sec,0,0)
'' do something every 2 seconds
callTable TwoSecData
nextScan
endProg

Note that 'slowSequence' scans do not need to be slower than the first scan, despite the name.

You probably want to call data tables in the same scan that is doing the measurement, so that the table 'sees' all the raw values.

The main documentation is in the Windows Help files provided with LoggerNet, and there ought to be a few other messages in the forum archives dealing with this feature.


rasteele Jan 3, 2013 02:44 PM

Thanks kirving, but unfortunately our wind speed monitor is measured with a PulseCount command. It doesn't say anywhere in the documentation that I found, but the compiler says you can't have a PulseCount in a SlowSequence.


kirving Jan 3, 2013 06:10 PM

Maybe the the 1-sec scan could be the first one, then other(s) done as slowSequence scans?


GTProdMgr Jan 3, 2013 07:34 PM

I think you want to know whether you can change the scan rate on your program from 10sec to 1sec without causing skipped scans or skipped records (what you are calling overruns).
Then your 2 minute average would be calculated from 120
measurements instead of 12. You want to predict whether
a 1 second program would work without having to send the program to the logger first.

Take a look at appendix B in the CR1000 manual:
http://s.campbellsci.com/documents/us/manuals/cr1000.pdf

Look at ProcessTime and MeasureTime, and SystemProcTime. These values are given in the status table and have units
of microseconds. If you add up these three values and the total is less than 1 million, there is a chance that a 1
second scan may work for you. I try to leave a little wiggle room when looking at these values, as much as 50% where possible (since this rule is only approximate and not absolute). So ideally you want to see a total like 500,000 to 700,000 microseconds. Then you probably have enough "room" for a 1 second scan that can still cycle through all of your sensors, measure them, make calculations and store data without falling behind (i.e. falling behind too much).
MaxProcTime can also be useful to watch.

Once you decide to send the program with the new/faster scan rate, you will want to watch for any Skipped scans or skipped records for the first day or so.

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