LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to create a class or something combining 3 controls together?

Solved!
Go to solution

Hi,

 

I need to gather data from  7 or 8 groups of sensors. Each group contains 4 to 9 sensors to display. When I gather data, sometimes I want to view the data changes vs time. Sometimes I want to switch to bar graph views with the mean values per 1 second.

 

For one group of data, I can just hide/show a waveform graph and an XY graph (see the attached test vi). However, I don't really want to repeat this procedure 7 or 8 times for all groups. Plus, if I do it this way, and if there is anything I want to modify, I have to do the modification 7 or 8 times. Therefore, I need a method to encapsulate the code, just what those text-based languages (like C++, ...) do.

 

Is it possible in labview?

 

Thanks!

0 Kudos
Message 1 of 19
(3,280 Views)
  • You can use a single graph (no need for xy) and switch the style and data accordingly. If all graphs have the same axis ranges, you can place them into a cluster and create an array of such clusters.
  • You should place the stop button in the upper loop, it is not needed inside the event. Now you can make it latch action and eliminate all these value property nodes.
  • You should place the switch before the upper case structure. The local variable is not needed.
  • Replace the lower case structure with a "select" and use a single instance of the property node. No need to have one in every case. code that is identical in all cases does not belong in a case structure. Only the strings differ.
  • you could create an xcontrol.
  • ...
Message 2 of 19
(3,248 Views)

You can encapsulate anything you want in a LabVIEW class.

0 Kudos
Message 3 of 19
(3,205 Views)

wiebe@CARYA wrote:

You can encapsulate anything you want in a LabVIEW class.


Thanks!

Do you know any example similar to it?

0 Kudos
Message 4 of 19
(3,165 Views)

@altenbach wrote:
  • You can use a single graph (no need for xy) and switch the style and data accordingly. If all graphs have the same axis ranges, you can place them into a cluster and create an array of such clusters.
  • You should place the stop button in the upper loop, it is not needed inside the event. Now you can make it latch action and eliminate all these value property nodes.
  • You should place the switch before the upper case structure. The local variable is not needed.
  • Replace the lower case structure with a "select" and use a single instance of the property node. No need to have one in every case. code that is identical in all cases does not belong in a case structure. Only the strings differ.
  • you could create an xcontrol.
  • ...

Thank you!

I started to heavily use labview this year. In the past, I used text-based language like C/C++ to do data sampling. Although I used labview a few years ago, but the application was quite simple.

 

Can you show me some examples for how to do the following?

 

  • You can use a single graph (no need for xy) and switch the style and data accordingly. If all graphs have the same axis ranges, you can place them into a cluster and create an array of such clusters.

For my application, the bar graph view is to show basically a 1d array vs a 1d array, the waveform view is to show multiple 1d arrays vs multiple 1d arrays. I don't know how to mkae a graph take different types of data.

0 Kudos
Message 5 of 19
(3,156 Views)

I am a little confused by what you mean by multiple types of datas?

What data types is this graph going to be graphing?

Chase
NI Technical Support Engineer
0 Kudos
Message 6 of 19
(3,134 Views)

@Chase.E wrote:

I am a little confused by what you mean by multiple types of datas?

What data types is this graph going to be graphing?


For bar graph view, what I want to plot is the mean values vs sensor number, so it's a 1d array for Y values, and a 1d array for X values, so basically it's a 2xN array.

For waveform view, it's a 1d array of waveforms. 

0 Kudos
Message 7 of 19
(3,130 Views)

@blueJack wrote:

wiebe@CARYA wrote:

You can encapsulate anything you want in a LabVIEW class.


Thanks!

Do you know any example similar to it?


Well, the information you've given will probably lead to some example that you did not intend. It's not going to be a trivial example, based on how I understand your request.

 

The beauty of OO is, the classes\objects (should) follow reality:

 

I need to gather data from  7 or 8 groups of sensors. Each group contains 4 to 9 sensors to display. When I gather data, sometimes I want to view the data changes vs time. Sometimes I want to switch to bar graph views with the mean values per 1 second.

So that could mean you want to make a group.lvclass, that contains a sensors.lvclass. group.lvclass uses a display.lvclass to show itself. display.lvclass has Childs, for instance a waveform graph. Group has a method "gather data.vi", and display a "Switch to bar graph views.vi" method.

 

Or something like that. My "solution" is probably not what you want. And if it is there will be other solutions that might be better.

 

To make an OO Analysis, you really have to own the problem. And your description (and my time) prevent me from having a full understanding of your problem.

0 Kudos
Message 8 of 19
(3,119 Views)

Thanks for the input. 

Although I know labview for quite a while, in the past years, I didn't use labview to write a very complex application for data acquisition. I used to use text-based language, like C/C++ to write DAQ code. It's just since last year when we decide to use new hardware for NI that I started to use labview heavily. 

I never used labview classes, so I have no clue how a labview class integrates a front panel object into it. I tried to use 'find example' in the menu, but didn't find anything. You have any suggestion?

 


wiebe@CARYA wrote:

@blueJack wrote:

wiebe@CARYA wrote:

You can encapsulate anything you want in a LabVIEW class.


Thanks!

Do you know any example similar to it?


Well, the information you've given will probably lead to some example that you did not intend. It's not going to be a trivial example, based on how I understand your request.

 

The beauty of OO is, the classes\objects (should) follow reality:

 

I need to gather data from  7 or 8 groups of sensors. Each group contains 4 to 9 sensors to display. When I gather data, sometimes I want to view the data changes vs time. Sometimes I want to switch to bar graph views with the mean values per 1 second.

So that could mean you want to make a group.lvclass, that contains a sensors.lvclass. group.lvclass uses a display.lvclass to show itself. display.lvclass has Childs, for instance a waveform graph. Group has a method "gather data.vi", and display a "Switch to bar graph views.vi" method.

 

Or something like that. My "solution" is probably not what you want. And if it is there will be other solutions that might be better.

 

To make an OO Analysis, you really have to own the problem. And your description (and my time) prevent me from having a full understanding of your problem.


 

0 Kudos
Message 9 of 19
(3,107 Views)

@blueJack wrote:

 

I never used labview classes, so I have no clue how a labview class integrates a front panel object into it. I tried to use 'find example' in the menu, but didn't find anything. You have any suggestion?


Building UI's with classes is particularly hard. Maybe not the best to start with if you'd ask me. Not because OO is not suited, but because in general UI's are not easy.

 

The problem is that usually when the classes are hierarchical, the UI is too. This is difficult to separate though, with updating values, catching events, and storing values all asking for (different) solutions.

 

If each class has it's own dialog, it's simple. Make the dialogs, and give each class a method that returns a reference to the dialog. Give the parent a method that run's the reference by reference (call by reference or call and collect\forget).

 

You can apply the same principle for hierarchies. The child shows it's panel with a subpanel. It calls it's parent method that inserts itself in the subpanel. The parent UI has a subpanel, and calls it's parent to insert it's UI... The Open and Close should also always call their parent methods, so the entire hierarchy get's opened and closed properly.

 

Note that the only way to do it without classes, would probably result in some kind of fake-OO idea anyway.

 

You can always use classes to do as much as you can, and put the UI's in non-OO VI's.

 

We might be able to make a small example (of a sub problem you're facing). But you'll have to give a very concrete and precise description. The entire scope of the problem will probably be too much work.

0 Kudos
Message 10 of 19
(3,095 Views)