10-17-2017 11:53 PM
Hey guys, so I need to save two different sets of data to two different files. One data set (DatasetA) is a few local variables that I'm continuously appending to the end of a file (no problems here). The other data set (DatasetB) is two arrays that I'm trying to always dump to a new file called 'base_name'+'iteration_number'.csv.
Here is where my problem lies. I need to be able to run the VI without logging any data during normal operation. The user must hit the start button to begin data logging (for a set amount of time) and once that time expires, dump the logged data to the files. If I stop and start the whole VI between each data log, then DatasetB is properly saved to a new file. If I hit the start test button multiple times without resetting the VI, then each logged DatasetB (DatasetB1, DatasetB2, etc) is appended to a single file. What I need is a new file each time I hit the start test button. I am currently using the 'Save To Series Of Files' option.
Any advice or help would be very much appreciated! Thanks in advance
Solved! Go to Solution.
10-18-2017 01:10 AM
Why are you passing filename, it has already configured in the configuration dialog.
Remove the file path and try.
10-18-2017 04:07 AM - edited 10-18-2017 04:10 AM
Ok, I have some hints (based on what I see in "Mosquito.vi"):
I think people from the forum could give better advice what kind of design pattern could be used here, if you explain what is the goal of this VI. Plus some more info, do you need tight sync between those two DAQmx task data stream? Maybe you need to use some form of triggered acquisition...
edit: plus info for point 2.: so if you want to sample only a single channel, you also need to change the DAQmx init part...
10-19-2017 05:48 PM
Sorry I went MIA, I had a few other issues that needed to be addressed these last couple of days. This is all great advice, thank you! I implemented items 2 and 3 that you recommended and now it all works properly.
I don't need a sync between the two data streams. The digital data input rate is governed by the speed of a paddlewheel which will vary significantly in frequency. The analog data input is just a load cell that actually only needs a sampling rate of 200 Hz, but the NI9237 that I'm using has a minimum sampling rate of ~1.6K so we're just going with 2K Hz. We aren't doing any analysis of any curves, just averages over a set duration.
You're right, I have much to learn about Labview. Resources online for a beginner seemed to point me in every direction possible so I just started from the DAQ Assistant and then went from there. If you have a recommendation for a good document on how to approach Labview, I'd be interested in reading it.
10-19-2017 07:30 PM
To build off of this,
When using the Open/Create/Replace File primitive, I can't seem to figure out how to identify whether or not a file is being created and then opened, or just opened. It would be nice to be able to do this so I can add a header line whenever a file is created, but not every time it is opened after its creation.
10-19-2017 07:35 PM
Nevermind, I found the 'Check if File or Folder Exists' VI...
10-19-2017 11:37 PM
If you are a beginner in LabVIEW, it is not a bad start. You should go on with the learning, and you will see you will improve fast.
First of all, here is a page from our fellow forum member, Hooovahh:
https://forums.ni.com/t5/Community-Documents/Unofficial-Forum-Rules-and-Guidelines/ta-p/3536495
Scroll down to the section "Looking For Free Training". Pay special attention to the last two links. Either if you are a student, or you own an active LV licence (SSP), you are eligible to access the LabVIEW Core 1, 2, 3 etc online video trainings. I really like the new versions of these "core" ones (v2015). There is even an online training "Data Acquisition Using NI-DAQmx and LabVIEW" under this site.
Plus, I guess you already know this page?: http://www.ni.com/product-documentation/5434/en/
OK, back to your actual application, I downloaded your original VIs, and checked them again:
Anyway, before trying to further improve your code, some learning would help to make it a faster journey 🙂