LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Open/create multiple new CSV files while saving collected data for different SET points

Hello!

 

I have created the attached VI, it is an illustration to system that I have.

 

The system will be running and measuring several data every 1 second, there will be several SET points during the test, and for each SET point I need to collect 20 data ( that means for 20 seconds)..

 

-I need for each test point, to open a new file (CSV) to collect the 20 data, and then close it. When I switch to the another SET point, I will need to open a new file (CSV) and save the new 20 data on it... how can I do that ? what should I add to my VI to be able to do that ?

 

Please not that I cannot stop the VI and re-lunch it, because the system I'm measuring is being controlled using the same VI. 

 

ataalkhatib97_0-1698895742436.png

 

 

Best Regards,

Ata Alkhatib

0 Kudos
Message 1 of 5
(1,063 Views)

Hi Ata,

 


@ataalkhatib97 wrote:

When I switch to the another SET point, I will need to open a new file (CSV) and save the new 20 data on it... how can I do that ? what should I add to my VI to be able to do that ?


You need to create the filepath inside your loop when you want to change the filepath. Creating it once before the loop does not fit to your requirements.

You can even automate that step by using a case structure with the selector connected to your "new setpoint" condition!

 

You should also cleanup the VI and downconvert it to an older LabVIEW version when you need more help. (I prefer LV2019…)

When you attach images (which is fine here) then please don't scale them in weird ways.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(1,019 Views)

Thank you for your comments.

 

I made the below adjustment base in your advice, but it didn't work.. I reconfigured the take new setpoint mechanical action to "Switch Until release" and it opens two files "I have to pick two files" and then when I press "Take readings" it keep on opening the files again and again.

 

Snippet.png

 

I added a Snippet, it may work

 

Download All
0 Kudos
Message 3 of 5
(976 Views)

Hi Ata,

 


@ataalkhatib97 wrote:

Thank you for your comments.

 

I added a Snippet, it may work


You forgot to downconvert as I asked for…

 


@ataalkhatib97 wrote:

I reconfigured the take new setpoint mechanical action to "Switch Until release" and it opens two files "I have to pick two files" and then when I press "Take readings" it keep on opening the files again and again.


On your snippet:

  • "Switch until released" is used seldomly. Do you really want to create new setpoints as long as the button is pressed - or only once when the button is latched?
  • There is a path control: WriteSpreadsheetFile will not ask for a path when that control contains a valid path. As the same path is used twice in the loop both file operations will ask. Simple solution: provide a valid filepath!
  • There is a "default if unwired" tunnel on the left case structure: do you know what happens in the other case? Ever thought about using a shift register to store your filepath for next iterations?
  • "Take readings" only allows to save data to your file. So item above: provide a valid filepath!
  • Converting the result of GetDateTimeString into integer data is nonsense: do you really get the data you expect???
  • You still didn't cleanup the code…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(969 Views)

GerdW,

 

I'm still new to the LabVIEW, I figured out what do you mean by clean up a VI, I did it, But I don't know how to downconvert a VI. Sorry

 

I followed your comments, and the VI works perfectly ! Thanks.

- I changed the 'Create new Setpoint' mechanical to 'Latch when pressed'

- Included the shift registers.

 

Now, I can create multiple files and save the readings whenever I want.

 

But one issue I noticed is that, when ever the 'Select file Window open' when I want to open a new file, the complete VI freezes, that means that the continues signal controls I have in the system will stop for multiple seconds...

Is there anyway to solve this issue ? or I have to import the data collection strategy to a separate VI ? If I have to do that, how the TWO VI will be running in the same time ? Knowing that I'm using 2 cDAQ - 9185 Chasse for the system.

 

Best Regards,

Ata

Snipp.png

Download All
0 Kudos
Message 5 of 5
(945 Views)