LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While loop rate not matching expected Samples/Rate (Hz) time using DAQmx

Highlighted

I am having trouble saving data at a particular rate.  I need the user to be able to choose the rate at which data is saved.  This might be 0.1 second, 1 second, 5 seconds, 3 minutes, etc.  My test vary from 30 seconds to 16 hours.

 

I expected the loop rate to be sample rate/samples per channel.  Like 1000S/1000Hz = 1 sec.  This saves at 0.62 sec.  Then when I change the Hz, it still does not match what I expect.  Please help. 

 

DAQmx

Chassis9174

9242 Voltage

9246 Current

9213 Thermocouple

9401 DIO/Counter

0 Kudos
Message 1 of 8
(308 Views)
Highlighted

Hi kyle,

 

what happens when you read voltage, current and thermocouples in their own DAQmx tasks and loops?

 

Right now you put all of them (from 3 different modules!) into just one task: the slowest module will determine the possible sample rates.

Did you read all the manuals? Which one might be the slowest module?

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 2 of 8
(301 Views)
Highlighted

On a side note, you might want to look at your code more closely. There are a lot of weird things going on.

 

A few small examples (I move the shift registers up slightly to show that they are not connected on the left):

 

altenbach_0-1604001001182.png

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 3 of 8
(279 Views)
Highlighted

GerdW, Yes, I have the same issue if I just sample the voltage.  I just try the Basic Power Measurement vi from NI that sample the current and voltage only.  The loop speed has the same issue.  That just uses the 50kS/s modules.  I want to sample slower and it is going too fast.  Your point is well taken since the TC module is 75S/s, but does not seem to be an issue with savings at 0.1 sec so I left it in there for now.  The values are just the same for in a certain time period.

 

Altenbach, Noted, the tunnels should have should not have been there and the wire should be connected to the shift registers.  For the TC, any channels without a thermocouple give me a large number.  I am just filtering that out.  Noted on the dbl output.  I just created this vi from my large vi that was needing the waveform.  I try the high resolution seconds and get the same timing values (at least to a few decimals).

 

How do you suggest to control the timing of my while loop?  Like I would like it to run at some rate I choose whether it be 0.1 sec or 10 sec without getting some buffer error.  Note I can take a general DAQmx vi from Labview with just voltage/current and have the same issue.  At 1000 hz and 1000 samples per channel, I was expecting this to take 1 sec so maybe there are some clock setting I do not have right....

 

 

0 Kudos
Message 4 of 8
(263 Views)
Highlighted

Here is a simple example sampling voltage only.    It give me the loop rate shown below.  I try placing a wait in the loop of S/CH / Rate (hz).  Ie 10,000/1000 = 10 seconds.  I get error 200279 when I do this even in the simple attached vi.  

 

S/CH    Rate (hz)   Loop time

1000     1000           0.62 sec

10000   1000           6.20 sec

 

Any idea on how I can get data at specific intervals like 1s or 10s without errors?  I get error 200279 when I try to place a wait function in the loop.

Thanks

0 Kudos
Message 5 of 8
(250 Views)
Highlighted

Hi Kyle,

 


@kyle_vi wrote:

Here is a simple example sampling voltage only.

S/CH    Rate (hz)   Loop time

1000     1000           0.62 sec

10000   1000           6.20 sec


Again I repeat my suggestion from message #2: "Did you read all the manuals?" (A common acronym is RTFM! :))

 

In case you don't have them at hand: here's the manual for your NI9242.

It contains a paragraph on "Data rates", which will be of big interest to you!

(Suddenly all your numbers on iteration times make a lot of sense…)

 

Btw. DAQmx offers property nodes and using them you can read the real sample rate of your DAQmx task:

 

On your last VI:

Why did you define "Loop rate" as SGL and ignore the coercion dot?

 

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
Message 6 of 8
(211 Views)
Highlighted

I have been trying to create the Sample Clock rate property but it did not have the selection available on the timing property node.  I finally find one from another vi on the web and pasted it in. Amazingly the loop rate is now as expected.  1000 hz/1000 samples gives me a loop rate of 1 sec instead of  0.62 sec and 1000 hz/10,000 samples give me a loop rate of 10 sec instead of 6.2 sec.  

 

Now when I drop a timing property node, the selections are available where I can create the sample clock rate myself.  Seems to be some bug in Labview that corrected itself when I pasted the Sample Clock Rate property node into my program.

 

Thanks GerdW, you forced me to spend 30 minutes hunting down a 2018 or less vi with the sample rate node.  

0 Kudos
Message 7 of 8
(184 Views)
Highlighted

#skeptical

 

Whatever it is you're now observing, my $ are on GerdW and the device manual being correct.  Perhaps your latest code no longer uses the device in question?   Or something, I dunno, but I very much doubt that you've found a way to make a device do something the manual says it can't.

 

Your hypothesis that you've somehow "healed" a physical device by tracking down an old copy of a property node is highly dubious.  In other words, I wouldn't spike the ball just yet, because it's very unlikely that you've actually crossed the goal line.

 

I don't know what IS going on, but I'll bet it ain't what you've been thinking.   You need some more hypotheses.  IMO.

 

 

-Kevin P

Message 8 of 8
(171 Views)