08-22-2022 02:58 AM
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?
08-22-2022 04:43 AM
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.
08-22-2022 05:30 AM
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
08-22-2022 07:39 AM
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.
08-22-2022 07:46 AM
@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.
08-22-2022 02:42 PM
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).
08-22-2022 03:32 PM
@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.
08-22-2022 03:41 PM
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.