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: 

Identical SubVi's Simutaneously

I'm trying to run a simple program to cycle multiple test stands on and off.

 

I have a main program in which I want to control 8 separate stands with multiple copies of the same sub-vi.

 

However, when I change the time on or time off for one sub-vi if effects the other.

 

I have tried the following and a control in one sub-vi controls the all of them.

 

-Selecting preallocated clone reentrant execution in the VI properties.

-Copying code and pasting to a blank vi, saving as a different name, and changed all label names.

 

Thanks,

-Derek

 

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

Please post your code so we can see what you're doing and make suggestions.

 

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
0 Kudos
Message 2 of 7
(2,812 Views)

take a look into the examples for Asynchronous Call By Reference 0X140 would be the flags to use for Open VI Ref to call and collect n clones where each clone has a seperate dataspace.


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 7
(2,799 Views)

Attached is the code.

 

Some more clarification:

 

On the Stand 1 tab

-Turning on the system switch, selecting the counter button, and setting a time for on and off the program counts the # of cycles.

 

On Stand 2 tab.

- The same procedure for stand 1 tab is performed but my problem is I have a different on and off time for stand tab 2. Stand tab 1 conforms to the duration of stand tab 2 which I'd like them to be independent of each other.

 

Please note that TestStand2 and Endurance_V3 are identical sub-vi's I was just trying to eliminate any potential reasons why they aren't operating independently.

 

Thanks for any help,

-Derek

Download All
0 Kudos
Message 4 of 7
(2,793 Views)

Well that would be a different issue than the sub vi dataspaces.  Lets look at what you loops do when run is pressed:

 

  • The main while loop starts iteration 0
  • All control terminals are read and passed to the two sub vis
  • both subvis start their own loops.......

 

The main sub vi loop cannot complete iteration 0 until both sub-vis reach an exit condition.... this isn't happening unless you press estop


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 7
(2,781 Views)

It's easy to miss but in the sub-VI there is an "OR" condition so that the sub-VI while loop is terminated on the last frame of the flat sequence structure. The main VI is iterating, I just can't get the two sub-VIs to be controlled separately.

 

-Derek

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

You need to understand dataflow.

 

A structure can't complete until all code inside of it has executed.  So your while loop in the main VI can't finish and iterate again until all code inside of it completes.  That includes your subVI's.  The subVI's can't complete until the while loops inside of them stop.

 

You have some odd constructs.  Doing a <=0 to drive a select to send a False constant if it is True, or a True constant if it is false, is 4 times too much code.  Flip your boolean logic so that it is >0.  Now you can eliminate the True and False constants and the Select function and wire the result of the >0 directly into the local variables.

 

Actually, the local variables inside the first frame of the flat sequence structure are useless.  Whatever you send to them will get overwritten with new values in the second frame of the sequence structrure.  Only then will the values from the indicators get passed out of the subVI and back to the main VI.

 

The while loop inside the subVI is pointless since it only executes one time.  ORing with the E-stop control is pointless because whether a True or False is passed into the subVI, the loop only executes one time because of the True in the final frame of the sequence structure.

 

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

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