Integration


goldfronts1

Recommended Posts

  • Replies 86
  • Created
  • Last Reply
  • 2 weeks later...

I'm not getting enough data points for my plots using the software polled mode. I am needing to get more data points. The only option I see available in the manual is the streaming mode. However, what I was told is that events will not work in streaming mode as the data is giving in blocks and not points.

Even by changing the timing options I am unable to get enough data points.

In streaming mode is there a way to do a real time integration of data and plot it without using an event?

Attached is my latest .ctl

Thanks

Newest file.ctl

Link to comment
Share on other sites

Still trying to figure out how to get more data points using streaming mode. I know that in streaming mode you only get data in blocks. Maybe there is some way in the normal mode to increase the frequency to get more data points. I've tried the timing option but that does not seem to work. Any suggestions? Thanks

Link to comment
Share on other sites

I'm not being rude, and my apologizes if it seemed that way, but I'm trying to teach you to learn the concepts and not have you simply copy whatever I do, and unfortunately it appears that you do not want to spend the time to learn the concepts. And I'm not talking about DAQFactory concepts, but rather the concepts of your particular experiment and integration when using DAQ devices. The fact that you asked what the units were on the bottom axis is an example of this and tells me that you are not taking the time to read and actually understand what I'm trying to explain to you. I don't mind answering lots of questions. Its my job to answer questions, but I feel we are going around in circles because you are not taking the time to actually understand these concepts. The biggest problem is that if you don't understand the concepts, you won't understand the limits of doing integration with discrete readings and the errors it generates. This is actually why I am against plug and play sensors, such as the ones NI offers. If the end user doesn't understand the signal conditioning, noise, and all the other important details of data acquisition and simply plugs something in and trusts the reading, they won't be able to critically examine the validity of the result.

Link to comment
Share on other sites

As for streaming, I don't know the limits of the U3. I think its 50k samples/sec, but truthfully, the LabJack guys are constantly improving their product and I can't keep up. Check their website.

Doing what you want to do is actually not particularly easy. Its easier to do if you do it after the experiment is over, rather than in-situ. So, before I delve into it, can you wait until the voltage readings are done and then do the integral, or do you need the integral live?

Link to comment
Share on other sites

Thanks for the the reply. I need to do the integral live as this is my controlling parameter in my experiment.

As far as the 50k samples/sec, is this in blocks of data?

In normal mode from what I am reading is that to control the frequency of data points is to control the "Timing", however, I have been unsuccessful in getting enough data points. Currently, I have the timing set to 0.03. And am averaging over 10.

Thanks

Link to comment
Share on other sites

Limits on streaming speeds are typically given in samples per second. "Blocks" really means nothing to you as the user as the block size is determined by a lot of factors that you really don't care about, such as USB bandwidth, interrupt priorities, etc.

Timing is used to do software polling, and changing the timing to 0.03 will give you 33 data points per second. You aren't going to be able to get much faster than that, maybe up to 100 samples/sec, but you are going to hit a limit because of the latencies in the USB->LabJack communications, so streaming is probably the best choice.

To setup streaming in general, I'll refer you to the DAQFactory - LabJack application guide. There is a full description there, with samples. I'm going to assume you are streaming to your existing channels (set their Timing to 0 first!). Then you just need to adjust the event for voltage2 to work with blocks of data. For that, you are going to need a global variable holding the time of the last block ending. To do that, add this line after the script that starts the streaming:

global lastTime = voltage2.time[0]

Then, in the Event for voltage2, adjust your code to look something like this:


private block = voltage2[lastTime, voltage2.time[0]]
for (private i = numrows(block) - 2, i >= 0, i--)

private newInt = int_v2[0] + (block[i] + Voltage2[i+1])/2 * (Voltage2.time[i] - Voltage2.time[i+1])
newInt.time = voltage2.time[i]
int_v2.addvalue(newInt)
newInt = (Voltage2.time[i] - startTime) / 60
newInt.time = voltage2.Time[i]
new_time.addValue(newInt)

endfor
nextTime = voltage2.time[0]

[/CODE]

That should be the general gist of it, though I didn't test it. Basically, we get all the data in the block by subsetting by time from the last data point to the most recent one. Then we cycle through it from the oldest (last) point in that block to the first and perform basically the same calc we did before. Note that we actually want to include the data point at nextTime in each iteration to calc the integral on the first data point from the next block.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.