09-01-2020 03:46 AM
Hi all,
The goal of my application is to read data from three subVIs simultaneously, each representing a different NI module, and put this data into a 1D array that is continuously being updated while the VI is running.
When I run my code with simulated hardware all three subVIs run at the same time and their data is being continuously updated but the main vi is not.
The array in the main VI is not updating.
How can I change that?
-Emilie.
Solved! Go to Solution.
09-01-2020 04:32 AM - edited 09-01-2020 04:34 AM
Hi Emilie,
@erabrannan wrote:
When I run my code with simulated hardware all three subVIs run at the same time and their data is being continuously updated but the main vi is not.
The array in the main VI is not updating.
How can I change that?
You can change this by using THINK DATAFLOW!
The mainVI loop can only iterate once the subVIs are finished. But your subVIs wait for user interaction because they have their own loops…
Simple solution: get rid of the loops in the subVIs.
Better solution: think about a suitable program architecture!
09-01-2020 04:40 AM
Dear Emilie,
Could you reshare the VIs in a older version of Labview (2014 or even 2018)( Under File >Save for previous versions). I think most users here have not yet switched to 2020 and won't be able to open them.
From the snippet you provided, I have a question. Do those subVIs have While loops inside ?
--DeX
09-01-2020 08:52 AM
@DeXteR_INIT wrote:
Dear Emilie,
Could you reshare the VIs in a older version of Labview (2014 or even 2018)( Under File >Save for previous versions). I think most users here have not yet switched to 2020 and won't be able to open them.
From the snippet you provided, I have a question. Do those subVIs have While loops inside ?
--DeX
They do.
09-01-2020
12:25 PM
- last edited on
08-20-2024
04:02 PM
by
Content Cleaner
I would suggest perhaps reading about the Producer/Consumer architecture/design.
You could pass Queue references into each of your subVIs and have them enqueue their data elements, and then have a separate loop in your main VI (not a loop around the subVIs, but side-by-side with them) dequeue elements and place them into a shift register feeding a graph.
You should also consider passing information about the source with the data elements (e.g. an enum, number or string that identifies the subVI that sends the data) so that the Consumer (the loop in your main VI with the graph) can correctly append the data elements to the right source.
A simple example is attached (saved in 2019).
Maps are used to store the data to simplify finding a data set by name, which you might consider since you have 2020 (at least based on a previous comment).