LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Communicate between separate VI's using OOP

Hello,

I have a question relating to how two separate labview programs can communicate with each other. Specifically I want to make a temperature controller using the OOP features of labview, and implement a Model-Viewer-Controller design.

I would like the Controller Object to launch the Viewer (the GUI) object. My question is though, how will these objects communicate between themselves?

The Viewer object is used to set the desired temperature, and display current temperature. Some how it must communicate this to the Controller object who will use its Model Object to create the correct response (i.e. change the set temperature of some hardware device, although generically the Model Object is an abstract class, to be implemented by it child classes), and then communicate back to the Viewer with the current temperature.

I was wondering if the Vi server tools are the right for this?

Thanks,
Paul.
0 Kudos
Message 1 of 7
(3,168 Views)
Hi labJunky,
you can use Queues and Notifier for this.
Mike
0 Kudos
Message 2 of 7
(3,164 Views)
Thanks Mike,
Yes, that's perfect, I will use a combination.
Very simple!

How to I get the controller object to launch the Viewer objects GUI though? I am not really sure how this works, since a Vi has one front panel, but an Object is a collection of method Vi's. If the Viewer was simply one Vi, then the GUI is that Vi's Front Panel, but if Viewer is an Object which of the method Vi's Front Panel's do I choose?
0 Kudos
Message 3 of 7
(3,153 Views)
So you will send some from your device VI to the GUI VI? Ok, you can use User Events for it. It works like Queue.
0 Kudos
Message 4 of 7
(3,148 Views)

Hello labJunky,

Thank you for contacting National Instruments.  I just wanted to clarify a few things regarding your question.  Are you actually using LabVIEW Object Oriented Programming to achieve this or are you trying to utilize VI Server to dynamically call another VI's Front Panel?  Here is a Knowledgebase article that explains how to dynamically load and run a VI apart from your main VI.  Also here is an example program that shows how to utilize VI Server that will call VIs to run in parallel to your main program.

If this is not what you are looking for, could you please explain your implementation further?  Here are a few links about typical Object Oriented Programming FAQ and Graphical Object Oriented Programming that may help.  However, if you could explain to me your program in a little bit further detail I would be happy to look into it for you.

I hope this helps.

Thanks!
Bob H
Applications Engineer

National Instruments

 
Thanks!
Bob H
Applications Engineer
National Instruments
Message 5 of 7
(3,113 Views)
Hi Bob, thanks for your post.

Here is what I want to program using an object oriented approach.
I want to make a temperature controller, which has three objects. A Controller Object, a model object, and a view object. The controller is a mediator between the model (which will talk to the hardware), and the view (which will display the current temperature, and where the set temperature can be changed).

The controller will have a method like myController.addView(Object View), and addModel(). So when I run the controller and give it a View object, I want it to open a window with a temperature indicator, and a set temperature control. When the set temperature is changed, the view object will notify the controller of this change (using an event), and the controller will run a method on the Model object which will control some piece of hardware setting its Temperature to a new value. The model will also send events (from time to time) to tell the controller that the temperature (of the device) has changed. The controller will then tell the view to update its temperature indicator.

I have found a nice article about implementing the Model-View-Controller design pattern using Java (I am a java programmer, trying to use labView). The article is here: http://java.sun.com/developer/technicalArticles/javase/mvc/
I would like to program this in labView.

Also I would like to make my code reusable as much as possible. So the controller, view, and model objects will all be abstract classes, to be implemented by code specific to the device. Also some devices will require more than one type of view object displaying the data in different ways.

I hope this makes what I am trying to do more clear.

So basically I want the View object to open a window with a temperature indicator and a set temperature control. I want the controller object to start the view object and tell it to open the window. But I am not sure how to do that with labView.

Thanks, any advise will be valuable!
Paul.
0 Kudos
Message 6 of 7
(3,086 Views)
 

Hi Lab,

I am an absolute noob with LVOOP so I don't know if this helps, but...

In this thread on LAVA I was asking how to access LVOOP objects from paralle loops. I used an Action Engine to share the objects and the approach was blessed by the father of LVOOP.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 7
(3,077 Views)