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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LVOOP - Plugin architecture and asynchronous calls

Dears,

 

even though I've been reading here for a lot of time this is my first message in this forum. I've been using LabVIEW for some years, but never used its LVOOP capabilites. I think I'm missing something in the approach of OOP, and I'm writing here to get suggestions from you. Thanks for reading and correcting me.

 

In a software suite developed by my company there is a tool to make some measurements, e.g. THD or VPP, on acquired waveforms. Available measurements are actually hard coded in LV code. I'm trying to change it into a plugin architecture based on LVOOP.

 

What I need is to display a subpanel where measurement parameters are set. Idea is: I define a plugin ancestor in charge of loading the front panel of selected measurement. Correct front panel is chosen at run time thanks to OOP.

 

Ancestor contains a "LoadPanel" VI which calls via asynchronous call a "CallMeasureFrontPanel" VI. "CallMeasureFrontPanel" has static dispatch templates, otherwise can't be asynchronously called. This VI finally calls "MeasureFrontPanel", with dynamic dispatch terminals. "MeasureFrontPanel" is overridden in child classes.

 

Ancestor has a "PanelLoaded" boolean attribute which is set to True by "MeasureFrontPanel" VI. Main VI polls on this attribute to verify that plugin has been correctly loaded.

 

A screenshot of Main.

 

Code.png

 

 

Overridden "MeasureFrontPanel" sets PanelLoaded attribute to True:

 

Code.png

 

 

What happens is that the loop in main always times out. I believe that my problem resides in LoadPanel:

 

Code.png

 

The object I return from this VI, which is then used to access "PanelLoaded" attribute, is not the same object that runs in "MeasureFrontPanel". If so, how could I get rid of it?

 

Thanks for comments,

Andrea

0 Kudos
Message 1 of 9
(4,172 Views)

Andrea,

 

why do you want to use asynchronous calls for the FPs?

0 Kudos
Message 2 of 9
(4,163 Views)

Because it's how I understood plugin architectures should be developed as written here... Is it not right?

0 Kudos
Message 3 of 9
(4,152 Views)

The idea behind plugins is to load a whole class dynamically (LVCLASS) not just a VI from a class.

 

 

0 Kudos
Message 4 of 9
(4,145 Views)

Have you already seen this? https://decibel.ni.com/content/docs/DOC-21441

 

0 Kudos
Message 5 of 9
(4,139 Views)

Oli_Wachno,

 

sorry I don't understand your answer. I want to run in asynchronous way a VI because it must be embedded in a subpanel. I want to use classes, because in my understanding it is the best way to implement a plugin architecture. I'm experiencing problems, for sure due to my poor understanding of LVOOP in general, and for sure to my limits in programming.

 

But really I don't understand what is the advice in your message.

 

Thanks for better explanation,

Andrea

0 Kudos
Message 6 of 9
(4,136 Views)

@andrea.angeloni.alfamation wrote:

sorry I don't understand your answer. I want to run in asynchronous way a VI because it must be embedded in a subpanel.


What I have done for this is pass the subpanel reference into the object's initializing VI (or constructor if you really want to call it that).  Then the class itself can decide which VI's panel to load.  It could load up a parent's GUI VI if it wanted to.  If needed, you could also have the initializing VI call whichever VI needs to run Asynchronously.


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 7 of 9
(4,125 Views)

Plugin refers to classes (in you case measurements) that can be dynamically loaded from disc.

The idea is to write an application which is implemented only using the parent class. The class eventually being worked with is only determined at runtime.

Thus you write you application once, all you have to provide are classes (different measurement types) inheriting from your measurement master.

 

 

The way I would do it:

 

  • Create a Parent Class Measurement.lvclass. This class has a must-overwrite dynamic dispatch Configure_Measurement.vi
  • Create measurement classes as children of Measurement.lvclass. For each Configure Measurement.vi, call the configuration FP of the existing driver.

 

 

0 Kudos
Message 8 of 9
(4,106 Views)

crossrulz,

 

subpanel reference is stored within ancestor class. I removed asynchronous call. "LoadPanel" is dynamic dispatch, overridden in child object.

Subpanel is correctly shown, but loop shown on first post is still exiting for timeout.

 

Referring to the main shown on first post, I don't understand how to have the wire coming out from LoadPanel to refer to the child object.

 

Thanks,

Andrea

 

EDIT: to be more precise, wire from LoadPanel is istance of expected child object. LoadPanel correctly runs MeasureFrontPanel. What I miss is the link between object in MeasureFrontPanel and LoadPanel, in my understanding I'm working with two different istances while I want them to be the same. Again, I could be totally missing some basic concept, sorry for it.

0 Kudos
Message 9 of 9
(4,084 Views)