04-20-2020 07:59 AM
Another new user with an issue. Working on the attached VI, first I would like to combine the "Temperature" data with the "Voltage" data, then create and write that to an excel file. I would also like to have a way to adjust the save rate on the front panel (sometimes I'll save at 10hz, sometimes every 30 seconds).
Back ground information: The basic function of this VI to use a cDaq 9174 with a 9211 TC card and a 9221 DC card The "Measure channels" boolean starts the measuring, the "Save data" boolean is intended to start and stop data saving (the "saving data" light is only confirming that data is being saved). The "Data Save Location" is as you'd expect, which is that I would like to pick my file save location.
Thank you.
Solved! Go to Solution.
04-20-2020 08:38 AM
1. Combine your voltage and temperature measurements into 1 task. That can be as simple as putting everything into one DAQ Assistant. However...
2. I REALLY dislike the Express VIs and the Dynamic Data Type. That abstract too much away. You can make something A LOT more efficient if you use the actual DAQmx API. Start here: Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications.
3. Do you really need an Excel (*.xlsx) file? Those get really slow to write and can cause other issues. I normally recommend a tab delimited text file with a .txt extension. Excel can still open those up formatted into columns. Again, get rid of the Express VI (Write Measurement File). At the rates you are talking, you can probably get away with using the Write To Delimited Spreadsheet File.
4. As far as writing rate, you can use the Elapsed Time VI (pretty much the only Express VI I will use). You set the time limit and it outputs a Boolean if that time has elapsed. It can even autoreset to start counting again.
04-20-2020 08:57 AM
Thank you for the reply.
1. The voltage and temp measurements were separated because of scaling. Eventually the temps will exceed 200 - 250 degrees where the voltage will never exceed 50 (expected to be around 30, so I separated them into two different charts to help with visual resolution.
2. I'll look into the "10 Functions" link you sent, maybe I'll be able to improve on what I have. 🙂
3. I do not need an actual *.xls file but I do need one that Excel can easily read, so a *.csv (or other format) would be fine.
4. Didn't see the "Elapsed Time VI", I'll check it out.
04-24-2020 07:45 AM - edited 04-24-2020 07:51 AM
UPDATE: Ok, so I got it to work (VI attached), but I still have a couple questions.
1. I'm running into a buffer error (# 200279) when I increase the speed, any suggestions on fixing that?, - the current fix is to just run the DAQ Assistants at a very low frequency (1 to 3 Hz).
2. The "Saving Data LED" lights up correctly when the "Save Data" boolean is switched "on", but when turned off the LED stays lit. Any suggestions on how to turn it off when saving stops?
Extra Credit: In a perfect world the graphs would update at about 100Hz and the "save data" loop would be adjustable to save from once a minute to 100Hz, any suggestions on how to do that?
05-05-2020 07:51 AM
Wrote a VI using DAQ Assistant for a cDAQ-9171 with a NI-9221 card. I would like to acquire and view the data at 100 or even 1,000 Hz but only want to save at 1Hz, any suggestion on how to fix my VI to do that?
05-05-2020 08:06 AM
Hi Rich,
@Rich_Tennant_Tech wrote:
I would like to acquire and view the data at 100 or even 1,000 Hz
It doesn't make sense to view data at 100Hz or even 1kHz: you cannot view that fast and most monitors only update at 60Hz…
That being said: you just need to set reasonable values for samplerate and number of samples to read. There's a relation between those two values and the loop iteration time: do you know that? (Hint: Samplerate is given in "samples per second", number of samples is given in "samples" and you want to have a certain time, given in "seconds"…)
@Rich_Tennant_Tech wrote:
but only want to save at 1Hz, any suggestion on how to fix my VI to do that?
You need to collect the data of 100 loop iterations (when "viewing at 100Hz") and then save the data. Then collect again for 100 iterations…
(Still this doesn't make sense to me.)
05-05-2020 08:27 AM
For the data to smoothly scroll across my laptop screen I need it to read at 100 Hz or more, 1,000Hz shows the best, it is what it is. But again, "right now" I only need to save at 1Hz, possibly more later but for that would be good enough. Coding wise do you have a suggestion on how to save at the lower rate?
05-06-2020 01:35 AM
Hi Rich,
@Rich_Tennant_Tech wrote:
Coding wise do you have a suggestion on how to save at the lower rate?
As I wrote before, even if I don't like to repeat myself:
You need to collect the data of 100 loop iterations (when "viewing at 100Hz") and then save the data. Then collect again for 100 iterations…
05-06-2020 06:03 AM
Well, is there a way to average it? Say, take every 10 points and average them into 1?
05-06-2020 06:38 AM
Hi Rich,
@Rich_Tennant_Tech wrote:
Well, is there a way to average it? Say, take every 10 points and average them into 1?
Yes, sure!
Take the average of 10 points using the Mean function in the math palette…