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: 

producer/consumer question

Solved!
Go to solution

I m bit confused, thanks for down converting, so you acquire the data and you use Queue to write into measurement file, you also have write to spreadsheet vi to write some notes is that correct ?

 

When do you want to write comments ? What kinda (some example) ? While writing comments do you need current data also to be appended to file?

0 Kudos
Message 11 of 16
(705 Views)
Solution
Accepted by topic author matomato

@matomato wrote:
3 - I don't know how to introduce a new loop in the producer/consumer scheme

So it appears that this is the crux of the problem. Adding a third loop is fairly simple. I've attached a simple modification that shows an example. In this particular method I'm actually wiring a value to the Timeout terminal of the event structure. Usually you don't have to do this, and you can actually do it an alternate way which would not require this, but at the cost of adding an indicator. It's also one of the really rare instances when I use a sequence structure. One could argue that you can simply connect the wire from the Boolean constant to the local variable to each loop, but I don't like the green wire going to each loop like that. The use of a sequence frame in this case is trivial and non-obtrusive.

 

 

Have you gone through the LabVIEW tutorials? Please go through the LabVIEW tutorials. To learn more about LabVIEW it is recommended that you go through the introduction material, tutorial(s), and other material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. You can also take the online courses for free.

0 Kudos
Message 12 of 16
(699 Views)

HI systemcrash,

 

Thanks for the reply.

 

You're right, I acquire data continuosly from the DAQ and I want to write and save some additional notes without stopping the acquisition.

 

These additional notes/comments are strings or array of strings, for example, the name and  surname of user, the type of analysis, the time, etc.

 

The main idea is to write these comments before and during the acquisition. This because the acquisition can be quite long, hours, and the user should be different. In this case, I want that the new user introduces the same notes/comments of the first one but without stopping the acquisition. Schematically the system is composed by three steps:

 

 

1 - the user 1 writes the comments in a file 1 before to start the acquisition (using the write to spreadsheet subVI)

2 - start the acquisition and save the data from the daq in a file 2 (as indicated by the VI with the Write Measurement File)

3 - the new user writes its comments and saves a new file, the number 3, without stopping the acquisition.

 

From yesterday I have changed a little bit the VI. I have introduced the write to spreadsheet subVI in the consumer loop to create the file 1 when the he clicks the save data buttom. Unfortunately, in this way, when the second user wants to save his data the file 3 overwrites the file 1 and this in not good. I was thinking to use the Build Path VI to save have file 1 and 3 and call these files with the date& time of their saving ....but until now I didn't sort it out. 

 

Any suggest?

Let me know if I answered your questions.

 

matomato

 

 

Download All
0 Kudos
Message 13 of 16
(697 Views)

Have modified your VI, the way you want can be implemented in many ways, As Smercurio suggested having event, that works too. Try this out and let us know.

 

Your consumer loop isn't disturbed for, 3rd loop takes care of adding details to file. But a new file is created everytime save data is pressed.

 

Let me know if you need data in same file or want to write the new data to old file (append operation)

Download All
0 Kudos
Message 14 of 16
(688 Views)

Hi Smercurio_fc

 

Thanks for  your  help. Your VI works perfectly.

 

I will follow your suggestion for the tutorials.

regards

 

matomato

 

 

0 Kudos
Message 15 of 16
(663 Views)

Hi Systemcrach

 

Thanks for your reply and help. The VI looks and works ok for my application.

 

I would like to write the data in the same file.

 

Regards

 

matomato

0 Kudos
Message 16 of 16
(661 Views)