01-20-2020 03:08 AM
Hi,
I got 5 VIs, 1 which is the main frame created by me and the other 4 is for collecting data from different smart meters created by my friend. However, under the VI hierarchy, the 4 VIs for collecting data is not under the main frame. I would like my main frame to read data from the 4 VIs. Currently they are all on the same level on the hierarchy chart. Is there any way I could edit the VI hierarchy?
Solved! Go to Solution.
01-20-2020 04:17 AM
VI Hierarchy shows the way the VIs are arranged within your program. To change this, change the way your main VI is written.
However, it seems like you're asking the wrong question. Usually the hierarchy windows are useful as a debugging/informational tool, but not considered a design input.
Probably calling the 4 VIs within the main VI will do what you want, but there may be complications depending on the design.
As a side note, attaching the actual VIs rather than an image with default icons would make it easier to give further help 🙂
01-20-2020 08:43 AM
Hi,
Thank you for your quick response. May I know how do I call the 4 VIs within the main VI? Attached is my current progression. Main Frame is my main VI, while Metergroup1, Metergroup2, Metergroup3 and Metergroup4 are the 4 VIs which I want to call. I also attached a picture of how I want the hierarchy to become.
01-20-2020 08:58 AM
1. Add all of your VIs into a project.
2. Drag a VI from your project onto the block diagram of your main VI.
You can also use the "Select a VI..." from the palettes to open a file browser to select the VI to put on your block diagram. Sounds like you should really check out the free online tutorials. Links are at the top of the LabVIEW forum.
01-20-2020 09:27 AM - edited 01-20-2020 09:29 AM
I *think* what crossrulz wrote would work for you.
Looking at the code, I'd suggest you might make it easier to read if you could remove some of the seemingly duplicate globals/Network Variables - I guess probably the NVs are for physical channels so you need both in each case but I'm less sure about the duplicate NodeASG ON, NodeASG OFF etc, especially when they are doubles (why not boolean?). The "Off" channels appear to have inverted logic, which makes it a bit confusing...
Programmatic access for the Network Shared Variables would allow you to reduce the size of the Main Frame.vi even whilst retaining all of the variables by building a (reentrant) VI that takes a reference and does the =1, =0, current boolean and then timing circuit bit. You can see an example of this by right clicking on one of the nodes and choosing "Replace with Programmatic Access", and then you can wire the same reference into the second one.
As it is, changing the timing delay for any one circuit will affect all of the others because they're in the same outer While loop.
You could go further and make a subVI which takes the ON, OFF, Node boolean and the pair of Variables as inputs (perhaps using a cluster) and then had both of these instances of the subVI inside.
01-21-2020 04:39 AM
Thank you for your help, it was what I needed. Sorry, where can I check those free online tutorials as I did not see those links on the top?
01-21-2020 04:45 AM
Thank you for your reply, I will try your suggestion and improve on my design. Pardon me if I got any additional questions in the future.
01-21-2020 04:52 AM
Hi Olso,
@Olso wrote:
Sorry, where can I check those free online tutorials as I did not see those links on the top?
See here: