LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Starting all Sub-VIs parallel but loading of VIs is different

Hi guys,

 

I created a project with some VIs. One main VI is starting all other Sub-VIs, also a VI that reads data from a text file.

 

So I'm trying to start all VIs at the same moment. But according to the big text file that I read in, this VI is loading longer to create the array where the data is saved. There is a time delay because all other VIs are running since I'm using the start button.

 

I've already tried the time delay, sequence or case structure but it did not work.

I also tried to set the VI Connection into the read-in-VI but then the other VIs also starts earlier than the data read in.

 

I'm using labVIEW 2014 and to get the rigth values from the text file per time I used a for-structure.

 

Could anyone please help me how to start the other VIs when the first value from the text file is loading (not before and not after).

 

 

Thanks and best,

 

0 Kudos
Message 1 of 7
(2,993 Views)

Hi,

 

      Post your VI.

0 Kudos
Message 2 of 7
(2,983 Views)

Hi JuKL,

 

So I'm trying to start all VIs at the same moment.

While you post some VIs (or the whole project) please explain why you need to start those subVIs "at the same moment"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 7
(2,963 Views)

There are many ways to synchronize parallel tasks.  One is to use a Notifier (a one-to-many synchronization mechanism).  Have each of the VIs that need to "pause until the data have been read" do a Wait on Notification, and have the Data File Reader do a Send Notification when it finishes reading the data.

 

Bob Schor

0 Kudos
Message 4 of 7
(2,937 Views)

Hi Bob,

 

yes every VI should start when the data was read in.

Afterwards, at every calculation time/Step other values should be used from the data file to do calculation in the connected VIs.

 

F.e. there are 100 rows. After reading/loading, the values of row 1 are used for all VIs, then row 2 values etc...

 

At the Moment all VIs are running except the data file Reader VI because loading the data takes too long.

As consequence the other VIs already runned for (f.e.) 100 times until data read in starts.

And I want that all VIs start when data Reader VI uses first row values...

 

Could you please explain how to use the wait and send notification?

 

Thanks and best,

Julian

0 Kudos
Message 5 of 7
(2,924 Views)

@JuKI1994 wrote:

 

I've already tried the time delay, sequence or case structure but it did not work.


Execution order is fully determined by dataflow, so if the sequence structure"did not work" (Whatever that means), you are doing it wrong. Please show us what you tried. What do the various subVIs do?

 

Of course the file reading cannot start at the same time, it apparently needs a head start. Its it doing anything else or does it return after reading?

 

(For example, of you would place all other subVIs inside a single-frame flat sequence and wire ne of the outputs of the file reading subVI to the edge of the sequence structure, nothing in it can execute until the file has been read.)

0 Kudos
Message 6 of 7
(2,919 Views)

I agree with Christian -- attach your Top Level VI and be sure to indicate on its Block Diagram which VI is the data-reading VI that needs to execute before all of the others.  Be sure to attach the actual VI (not a picture of its Block Diagram), and be sure that you indicate which sub-VI reads the data and needs to run "first".

 

Depending on what we see when you show us the code, the answer may be something as simple as the following:  If the VIs running in Parallel have their own "Error Line" that sequence them with the VIs that (logically) follow them, then you branch the Error Line coming out of the "Read Input Data" (which you want to complete before the other parallel routines start to run) and run them into the Error In terminal(s) of the Parallel VIs you want to start after the Data have been read.  The Principle of Data Flow will (a) have Read Input Data execute first, and (b) have all of the Parallel processes "run in parallel" after the data have been read.

 

Bob Schor

0 Kudos
Message 7 of 7
(2,913 Views)