LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

file generation

The main intention of me is to create a sub Vi which would create a file and save data for say 10,000 ms and then the file increments itself i.e it changes the name. There are followingproblems with my Vi.

 

  • All the data are same in my files generated.

Yes, I understand data flow and i know values would be same. but how can i do the changes so that the valuesof the data changes.

 

  • Only 1 set of data is saved in file 

in short, i want the while loop in the main vi. to be excuted more often i.e how can i cut short the time which is lost in subvi due to for loop i.e can i replace for loop with any other loop and still stick to my design.

 

Attached are my Vi's. Any help and comments are highly appreciated.

 

Download All
0 Kudos
Message 1 of 6
(2,724 Views)

Hi,

 

i just took a quick look at your subVI and I would recommend you not to use any kind of loops in a subVI. The problem is that the mainVI is waiting till the loop in the subVI is finished and so there can occur many problems.

 

To your problem "All the data are same in my files generated" : I executed the subVI alone and in every seven files there were several data, the time and the random number were not the same. If you execute it you see in every file the same data?

 

Do you have to use this in a subVI or can you combine both VIs in one VI?

 

regards,

 

Michael

 

 

 

 

0 Kudos
Message 2 of 6
(2,671 Views)

Thanks Michael,

 

yes, i have to use it as a subvi  otherwise i have to change the main Vi which is very tedious task.. as my Main Vi  is preety big. i was thinking maybe i can use global variable to transfer the data . but my problem is i have to use 5 global variables which makes my pc very slow any other suggestions.. or do u recommend me to do the changes in the main Vi.

 

Thanks a lot ..

 

Thnaks again for your suggestion

0 Kudos
Message 3 of 6
(2,660 Views)

Contrary to what you said, you do not understand data flow. If you did, you would not have used those local variables in the subVI since you would have quickly concluded that based on dataflow, there were unnecessary.

 

The subVI you uploaded does not match what the main VI is expecting. The main VI is linked to a different subVI. You do not need to use global variables to pass data to a subVI. If you have a process that is doing something, generating data while it's chugging along, and you have another process that should be logging that data, but at a different rate, then these are simply parallel processes that follow the staple producer-consumer architecture (Application Design Patterns: Producer/Consumer ). The two loops do not need to run at the same rate. If the rate of logging is very low, for example, once a minute, you do not set the loop to run once a minute. you set the loop to run quickly (but do not create Greedy Loops) so that it can respond to a "quit" command, and inside the loop you check to see if the required elapsed time has passed for you to perform the operation. This is standard programming design.

0 Kudos
Message 4 of 6
(2,656 Views)

No u didnt get my idea.. i was dropping the idea of making a subvi and was going to transfer the data with help of global variables to another Vi which would have my auto generation file.

I agree with you, i shouldnt have used local variables in the subvi. but actually this subvi was rather big and i just minimized it before uploading here..

Thanks for sending a link for queing. I will go through it and it seems better than global variable transfer.

How can i change the speed of the loop..i get it that i shouldnt be creating a loop but how should i increment my file name without using the loop.

0 Kudos
Message 5 of 6
(2,649 Views)

Attached is a snippet of a simple example that has a quick loop, but updates the time every 10 seconds. Clicking on the Stop button immediately stops the loop, instead of having to wait 10 seconds (or whatever the update interval is).

0 Kudos
Message 6 of 6
(2,639 Views)