From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why writes LabVIEW only every 2 seconds the measured Value to a Excel (In a while loop with 100 ms tact)?

Hi everybody,

 

I use the myDAQ to measure speed, ampere, and voltage of a battery driven motor. (For Current measurement, i use a Sensor which outputs a 0-10 V signal). I placed all DAQ-Assitants in a while loop with a [Wait until next ms multiple] clock and set a value of 100 ms. I thougt, Labview will now write into my text file 10 times a second all values. In fact, as you can see in the attached text file, Labview only writes in a unsteady interval of 1-2 seconds a value, which is too less.

 

The question: Did I do anything wrong, how can you create VI that writes you lets say 10 values a second into text file? Or is simply the DigitalMultimeter input of the myDAQ not able to sample a rate of 10 Hz? I couldn´t find any information in the specification handbook about the sample rate of the DMM?

 

If anyone can help me would be great! Thanx a lot, Markus

Download All
0 Kudos
Message 1 of 9
(2,867 Views)

Acquire your data. After acquisition has stopped. Write the data to a *.csv file that is easily imported into Excel.

 

 

0 Kudos
Message 2 of 9
(2,845 Views)

Hi nyc,

 

thanx for your reply, i am afraid you missunderstood my problem or my english was too bad to explai it correctly:

Logging the data to excel works without problem if i select the path and "filename.xls"

 

I want to log 3 different Voltage signals with a sample rate of 10 Hz. But I am afraid the Digital Multimeter Input of the MyDAQ which is used also for reading a voltage signal is not able to measure this rate...

If I only measure "measured speed" and "measured current" which you can see in my above attached VI, LabView writes the correct number of 10 values a second into my "xls" (From AI0, AI1). Only if I add the DAQ assistant which reads the DigitalMultimeter Voltage, it slows my whole "while-loop" down...

 

Do you have any idea to solve this problem?...

0 Kudos
Message 3 of 9
(2,841 Views)

Your VI doesn't work because it can't write the data fast enough.

 

Acquire the data. THEN write the data.

0 Kudos
Message 4 of 9
(2,830 Views)

File I/O is not very efficient. I recommend that you do you file logging in a parallel task. Have one task do your data acquision. This task would then pass the data to be logged to the logging task via a queue. That way your file operations do not impact your data acquision. Also, express VIs are not very efficient. You would be better off accessing that directly using the DAQ VIs. The express VIs contain lots of steps that do not need to be done every time you call it such as initializing the device.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 5 of 9
(2,823 Views)

Ok i understand. So you think the reason why its so slow is not the DAQ (See http://www.ni.com/mydaq/specifications.htm, I couldn´t find any information about the maximum sampling rate of the integrated Digital Multimeter) but rather the software that it can´t write as fast..

 

In fact I have no idea how its possible in Labview to acquire data and write later because I just startet LabVIEW programming. Is there an example VI or help where I could learn that?

 

Thanx Again!

 

Markus

0 Kudos
Message 6 of 9
(2,821 Views)

Look at the examples for queues, producer/consumer architecture, DAQ programming, parallel tasks just to name a few. LabvIEW ships with some very good examples. Also, take some time and work through the online tutorials.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 7 of 9
(2,818 Views)

Ok Mark thanx a lot, i will check that out next week....

0 Kudos
Message 8 of 9
(2,813 Views)

No, that is not what was said.

 

Both your use of file output in the acquisition loop and the Express VIs for data acquisition are inefficient. You've already said that if you remove the dmm function, the loop speeds up considerably. Doesn't that answer your question as to the cause?

 

I'm not at all that familiar with MyDaq but have you tried using the second analog input channel to measure the voltage instead of the DMM. You can just add a new channel to the existing current DAQ Assistant.

0 Kudos
Message 9 of 9
(2,812 Views)