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.
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.
04-26-2007 03:37 PM
04-27-2007 03:17 PM
Ok, I just typed a huge post to this, but IE died just before I submitted - very frustrating!
In any event, let me give a briefer response here.
First let's draw some distintions between the ideas you're considering. Starting with Libraries, an llb is basically a folder of VIs - there is an llb manager in LabVIEW that will allow you to toggle between an llb and a folder of VIs. On the other hand, an lvlib file is nothing more than an XML file which gathers links to VIs that you "add" to the library. Thus, those are fundamentally different objects.
The lvclass is the graphical answer to the OOP call. It sounds like you're having some trouble with the interface/paradigm it presents. Some of that is dicussed well - I would encourage you to read the "additional resources" linked at the following page: LabVIEW OOP
In particular, be sure to check out: LabVIEW Object-Oriented Programming: The Decisions Behind the Design
An Xcontrol is a very "special" object in LabVIEW - it allows you to build an object which behaves like a control (has a block diagram node, you can build properties and access then via a property node, etc.) but also allows that control to have dynamic behavior at both edit and run time. LabVIEW is actually processing things in the background to handle some of the Xcontrol behavior. There is a simple example in the Example Finder which you can launch from LabVIEW as Help -> Find Examples...
With that said, another idea you may consider is building a code module. This is basically a VI which is an interface to some data. This probably sounds like a lvclass, and it's similar. The idea is that you create a subVI which has a while loop with a shift register - unitialized. The loop conditional should be wired to only run once - it's only purpose is to get the shift register. The primary idea is that an uninitialized shift register (not wired from outside the loop structure) will hold its value across distinct calls/instances of a subVI. Thus, you can pass data to the VI and store it there for subsequent calls. The final piece of the puzzle is simply to put a case structure inside the loop - that case structure can have a case for each "operation" you want. More specifically, you will have an initialize case, which takes in your data and initializes the shift register from within the loop. After that, you won't have to wire your data to that VI anymore because it'll be stored in the shift register. Anyway, you can then build as many operations you'd like, and expose an inputs to the subVI for selecting the operation and passing parameters.
One difference between this and a lvclass is that the code module will only really work on one instance of your data, since it's operating on a consistent and stored piece of data across all calls to the subVI. To use the code module on two distinct copies of your data, you would have to make a copy of the code module. That's not too expensive actually, because you can make the guts of the subVI into subVIs (each case can call a subVI for example), so the copy/remame of your code module VI is all that's necessary and it'll use the same VIs underneath - we just need a new shift register to hold our second piece of data. On the other hand, if you only need to manage one piece of data.
Here's an example if you're interested: 3D Vector Code Module with Example
Finally, it sounds like the lvclass or the code module are good choices for you. In addition to the "copy" tradeoff - a potential downside of the code module against the lvclass - you may also consider that the complexity of the code module implemetation etc. is simpler (arguably) than the lvclass - your application needs will steer you to which is better. If you go the lvclass route, definitely read the additional resources linked at LabVIEW OOP as noted above.
Best Regards,
JLS