03-26-2014 09:56 PM - edited 03-26-2014 10:14 PM
I have a SubVI in my MainVI that has all input/output terminals occupied (28 terminals). I want to add more inputs to this SubVI but don't have anymore open terminals. How do I do this?
I tried to create a Cluster of few variables, and then I put that cluster into the input terminal of the SubVI, however, I don't understand how to take a cluster as an input in the SubVI and unbundle it into individual variables. When I try to do it, it gives me error. It says the input cluster has X elements (ex: 5 elements), and the cluster in my SubVI has 0 elements.
Is there a more efficient way to pass the inputs to the SubVI instead of connecting each variables to the SubVI's terminal?
Ex:
- Main VI has variables (Double): A, B, C, etc...
- Variables A, B,C, etc... are inputs to SubVI
- Main VI calls the SubVI continuously in a for loop until a certain condition is met
Requirements: While the program is running, I should be able to change the value of the variable from the MainVI and have that new updated variable reflect during the execution of the SubVI. This means, during N iteration of the SubVI, A could be = 25, however, I should be able to change A to 33, so that during the N+1 iteration of the SubVI, input to A = 33.
03-26-2014 10:13 PM
I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours
03-27-2014 12:21 PM
See my program attached.
Varibles are bundled into a cluster which is an input to a SubVI
The SubVI is continously executed in the for loop for 100 times
When you run the cMain, the variable values are passedi nto the subVI, however, if I were to change the varibles while the program is running, the updated varibles are not being updated in the cluster, thus the subVI doens't receive the new updated variables as inputs.
03-27-2014 12:29 PM
Data flow. If you move the terminals inside of the FOR loop, then they were update the cluster since they are actually being read each iteration.
03-27-2014 03:54 PM
Okay, now I understand. Thanks. Attached are the files where I fixed the issue.
I have a follow up question:
If required, is it okay to connect a local varible to the "Unbudle" output instead of the connecting the terminal directly? See cSub.vi for what I mean.
03-27-2014 06:38 PM
@aab-ufl wrote:
If required, is it okay to connect a local varible to the "Unbudle" output instead of the connecting the terminal directly?
For what reason? That sounds more like an architectural issue. And for that, we would need to know a lot more about what you are trying to do.