LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why it is not possible to use vi's with the same name in disable structure?

It throws an error message "A VI with the same name is already in memory". I thought the whole idea of disable structure is to disable the part of code Before compilation.

Is there any workaround other than renaming vi's?

 

0 Kudos
Message 1 of 8
(1,023 Views)

Yes, the disable structure does exclude the VI from compilation. But it still loads the VI into memory for editing. And LabVIEW does not allow two different VIs in memory.

 

So yes it's a compile time disable not an edit time disable.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 8
(997 Views)

First of all, disable structures (DDS) are used when an "out-of-the-system" edit needs to be made. It is the same as using comment, which is used for user understanding, in written code to disable chunks of code. It is wrong but temporarily OK. Using DDS is reasonable for quick testing and one-time debugging or in tiny projects. They are easy to forget in the code in the long term and the fact that they are not indexed (though you can search for all DDS in project) makes them inconvenient for extensive use. Usually DDSs used for debug in my projects usually evolve into case structure controlled by several Global variable bools that each allows debugging of a different code branch. See - DDS is temporary and out-of-the-system while global debug triggering is systematic.

 

Let's say you have multiple VIs making similar thing and thus you feel the urge to name them the same. Well if they are operating on similar data, consider using classes (LVOOP) which allow for same name (is actually very useful in this context), or any abstracting framework. If it's not the case, consider wrapping both the VIs in another VI where you select the needed VI of your choice. In LabVIEW you shouldn't have need to name two VIs the same. Maybe show an example?

 

Vit

0 Kudos
Message 3 of 8
(973 Views)

If multiple VI with the same name does the same thing differently, then you should have put the DDS inside that subVI to change the implementation and not at the caller level.

 

If they do not do the same thing, then their names should be different.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 4 of 8
(939 Views)

@santo_13 wrote:

If they do not do the same thing, then their names should be different.


Or put in different libraries or classes.  At the surface level, I would more likely go with an OOP solution and then use dynamic dispatch instead of the diagram disable.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 8
(933 Views)

I probably should've clarified a couple things. I am using a conditional disable structure. The VIs are doing the same thing but are made for different target bitness. Furthermore, the VIs are from a distribution of a device manufacturer so I'd prefer not to change them (including file names).

 

0 Kudos
Message 6 of 8
(909 Views)

@crossrulz wrote:

@santo_13 wrote:

If they do not do the same thing, then their names should be different.


Or put in different libraries or classes.  At the surface level, I would more likely go with an OOP solution and then use dynamic dispatch instead of the diagram disable.


Different library or class - Yeah, the qualified name so that they are still unique when loaded.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 7 of 8
(893 Views)

Two different VIs with the same file name can be simultaneously loaded into memory:

1. If they are owned by differently name libraries (.lvlib).  The library name is used as a prefix for the namespace.

or

2. If they are loaded in different contexts.

 

In your DDS, you could just have the paths to the files, then call the VIs dymanically.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 8 of 8
(888 Views)