Duty cycle when sampling in streaming mode

Post any questions you may have about our current range of USB data loggers
Post Reply
LPH
Newbie
Posts: 0
Joined: Wed May 19, 2010 2:08 pm
Location: Stockholm

Duty cycle when sampling in streaming mode

Post by LPH »

Hi,

I'm using a pl1216 and I'm unsure aboute the period/duty cycle when sampling in streaming mode. If I set the sampling interval to e.g. 100 msec, what time elapse between the intervals when the device collects data? My collected data is power and I collect these to get a dose (energy) so I need control over time. Are there any other programming related (or other) aspects affecting elapsed time between samples?

Thanks!
Patrik

Pico Stuart
Site Admin
Site Admin
Posts: 78
Joined: Tue Jun 30, 2009 3:08 pm

Re: Duty cycle when sampling in streaming mode

Post by Pico Stuart »

Dear Patrik,

The devices operate in any of the following modes:

Using PicoLog

Real time continuous mode. The unit collects data as fast as possible, computes a smoothed signal, and then transmits data at a slower rate to the PC. This mode results in the fastest screen updates but is limited in speed to several milliseconds between samples.

Streaming mode. The unit collects and downloads data continuously with a guaranteed sampling interval. For faster sampling, use block mode.

Block mode. The unit collects data to an internal buffer at high speed, and then uploads the buffer contents to the PC as a block. This mode allows the fastest sampling rates, but the data collected has gaps caused by the dead time between blocks.


Using API

Capture modes
Three modes are available for capturing data:
BM_SINGLE: collect a single block of data and exit
BM_WINDOW: collect a series of overlapping blocks of data
BM_STREAM: collect a continuous stream of data
BM_SINGLE is useful when you wish to collect data at high speed for a short period:for example, to collect 1000 readings in 50 milliseconds.

BM_WINDOW is useful when collecting several blocks of data at low speeds - for example when collecting 10,000 samples over 10 seconds. Collecting a sequence of single blocks like this would take 10 seconds for each block, so displayed data would
not be updated frequently. Using windowing, it is possible to ask for a new block more frequently, for example every second, and to receive a block containing 9 seconds of repeat data and 1 second of new data. The block is effectively a 10-second window that advances one second per cycle.

BM_STREAM is useful when you need to collect data continuously for long periods. In principle, it could be used to collect data indefinitely. Every time pl1000GetValues
is called, it returns the new readings since the last time it was called. The noOfValues argument passed to pl1000Run must be sufficient to ensure that the buffer does not overflow between successive calls to pl1000GetValues . For example, if you call pl1000GetValues every second and you are collecting 500
samples per second, then noOfValues must be at least 500, or preferably 1000, to allow for delays in the operating system.

pl1000SetInterval

The fastest possible sampling interval is 1 microsecond, when the number of samples
is 8129 divided by the number of channels active and the capture mode is BM_SINGLE. Under all other conditions, the fastest possible sampling interval is 10 microseconds.

Please do not hesitate to contact me if you require further assistance via support@picotech.com

Kindest regards,

Stuart
Technical Speciliast

LPH
Newbie
Posts: 0
Joined: Wed May 19, 2010 2:08 pm
Location: Stockholm

Re: Duty cycle when sampling in streaming mode

Post by LPH »

Hi Stuart,

thanks for Your reply. Im not completely clear about what is happening. I use PicoLog in streaming mode (BM_STREAM) and I call pl1000GetValues inside a while loop. The (pseudo) code looks as follows;

pl1000SetInterval()

While total < condition

pl1000Run()
Do while not ready
loop

pl1000GetValues()
total = total + collected value
end while

If the interval is say 100ms, what time elapses between successive 100ms intervals? Does it depend on the while loop? I could clock the while loop of course but it seems bulky...

Should the calling of pl1000Run be inside the while loop in streaming mode? Is there a better way to code this?

Is it possible to understand my question? :)

Regards
Patrik

Robin
Advanced User
Advanced User
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: Duty cycle when sampling in streaming mode

Post by Robin »

Hi Patrick

You only need to call Run once and then you can call GetValues in your loop.

As you are using streaming mode, there will be no gaps in the data.

See collect_streaming() in pl1000con.c

Robin

Post Reply