LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"instance of" a class

I'm writing a test program for our lab using LVOOP. All instruments are child classes of a general device.lvclass. I want to be able to save and load the specific system configuration (what instrument are used). In order to know which specific child class is loaded I thought of saving the class path in the config file and using the Default Instance property of the class library dynamically load the specific objects (see path2class.bmp).
Is there a way to define a method in the general parent class that uses the dynamical despatch inputs to get the incoming wire type? Please find class2path.bmp for my basic idea which DOESN'T work.
 
Thanks a lot,
Y
Download All
0 Kudos
Message 1 of 10
(4,429 Views)

What about using the property node "Class Name" ?

 

0 Kudos
Message 2 of 10
(4,419 Views)
Perhaps I was not clear about the problem. The thing is that if you write the method in the PARENT class the class properties return the PARENT class properties even if the  method is called by a child class. The question is how to write a DYNAMIC method in the parent class that return the class properites of the dynamic wires, i.e. return the child class properties.
0 Kudos
Message 3 of 10
(4,416 Views)
Hey ysegev,
 
Thank you for contacting National Instruments.  I want to clarify, and make sure I understand your problem correctly.  You are expecting that method to return the path of the child, but it is returning the parent path instead, correct?
 
Would it be possible to post your sample project, so we can take a look at how you have everything set up?
 
Also, if you have not done so already, I would take a look at the LabVIEW help, specifically the LabVIEW object-oriented programming section.  There is some good information about static and dynamic dispatch member VIs, and I believe this could be helpful for you.
 
Regards,
 
Kevin H
National Instruments
WSN/Wireless DAQ Product Support Engineer
0 Kudos
Message 4 of 10
(4,357 Views)
If you are using LV8.5, then there is a VI in vi.lib that will give you this information exactly as you want it. The VI is not in the functions palette, but can be found directly at:

<LabVIEW>\vi.lib\utility\LVClass\Get LV Class Path.vi

P.S. Kevin, I think this would make a great KB 😉
Jarrod S.
National Instruments
0 Kudos
Message 5 of 10
(4,348 Views)

Hi all, thanks for your interest. Kelvin_H, your description is accurate. I want to have as little work as possible when someone adds a new instrument in the future, so I want all possible functionality to sit at the general parent class. This is the reason for not implementing this method in the child class. I'm using LV 8.2, and couldn't find anything useful in the help or forums.

If you are till intersted I will post my work tomorrow.

PS what is a KB?

0 Kudos
Message 6 of 10
(4,331 Views)
KB stands for Knowledge Base, an online article. The method I described works perfectly for you with LV8.5, but didn't exist in LV8.2. There have been some workarounds discussed in this thread on another discussion forum that might help you out. I think someone posted some example code that should get you started. They discuss how to get the specific class name from the wire there.
Jarrod S.
National Instruments
0 Kudos
Message 7 of 10
(4,317 Views)

Here is my project. It is an OO based general test program that follows the following guidelines-

1. Provide a simple template for standard experiments (e.g. vector scanning- IV curves etc) both in run time or using the LV block diagrams.

2. Easy to add new instruments.

3. Modular so complex experiments are easily built from the simple blocks.

4. EASY to maintain and debug.

The zip file contains the parent class- device, a few instruments as child classes and an almost finished rack.lvclass which manges the experimetal setup. Next I will make the experiment classes. The general guidelines of my work can be found in the attached txt file.

Download All
0 Kudos
Message 8 of 10
(4,294 Views)
Hey ysegev,
 
Were you able to take a look at what Jarrod posted?  It looks like there might be some good information there.  Let me know if that was able to help you out.
 
Regards,
 
Kevin H
National Instruments
WSN/Wireless DAQ Product Support Engineer
0 Kudos
Message 9 of 10
(4,267 Views)
yes i have, thank you both for the quick and sharp solutions.
0 Kudos
Message 10 of 10
(4,260 Views)