LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is XControl the right choice for...

Hello

 

here is what I want to do: implement a PID controller that can be used as a FP element that shows the current setpoint, input and output and has two buttons. One that opens a config-window to input/change the PID values and another one that opens a graph that shows the setpoint, input, and output vs. time. The PID controller takes one input value, compares it to the setpoint and gives one output according to the PID-settings. This would be used inside a while loop where it would be operated continuously.

 

I already wrote a XControl that does the above, but ran into the following problems:

 

1) Since the control is an indicator (it takes the input value as input), it doesn't have an output. So I added a property to access the output. This means I have to first call the XControl and then get the output value via a property node. This somehow doesn't seem right 😉 Is there another way to get a heavily customized frontpanel object that has in- and output?

 

2) I use a hidden graph and a hidden cluster for the plot and the "config window". This makes it possible to show and hide these by just hitting the corresponding buttons. It would be really nice though, if  I could pin the graph and move it around, something like a dockable window... Is there a way to do this inside an Xcontrol?

 

thanks

 

Arun

0 Kudos
Message 1 of 6
(2,435 Views)

I don't think an xcontrol is the right tool for this...

 

 


Arun Persaud wrote:

1) Since the control is an indicator (it takes the input value as input), it doesn't have an output. So I added a property to access the output.


Like any other LabVIEW control, an xcontrol can be switched between being a control or an indicator. "RIght-click...change to indicator|control". You need to handle the state correctly in one of the facade cases. Check the documentation or look at the thermometer xcontrol example shipped with LabVIEW.

 

0 Kudos
Message 2 of 6
(2,421 Views)

I'm aware that the way I coded it, the XControl only works as an indicator and can't be used as a control. I have seen similar XControls that dissalow the change from indicator to control, so I think that can be taken care off... (I also looked at the examples before playing around with XControls ;))

 

My problem is that I would like to have an input and output and extra elements (e.g. plot that can be shown/hidden) on the front panel and apart from an XControl, I don't really know what other options there are to create your own FP elements... any ideas?

 

Arun

0 Kudos
Message 3 of 6
(2,413 Views)

Could you explain me what is the advantage you think of when you are trying to use XControl for PID application?

Emedding all the functionalities inside xcontrol does not seem like a good idea for me, or in that case someone might say that I need the complete project to be inside an xcontrol!

I don't think we should use Xcontrol for such application, as xontrols should only be used when something is concerened only with front panel functionality, like appending numbers or unit conversion.

-FraggerFox!
Certified LabVIEW Architect, Certified TestStand Developer
"What you think today is what you live tomorrow"
0 Kudos
Message 4 of 6
(2,397 Views)

I use PID in several of my applications. Each PID has a vi that does the calculation, a set of config parameters (PID on/off, output value to use when PID off, P,I,D, limit max. output value yes/no, max. output limit, etc). I also really like to have the option to quickly plot setpoint, input and output value vs. time, but I don't need to look at the plot all the time... So at the moment my code includes a typedef for these config parameters, the vi, a plot, some buttons to hide and show the plots and as I use event loops to handle my front panel, I need to add special events to hide and show the config option and the plot... if I have now say 4 PID controlled power supplies in my applications all of this takes up quite a bit in the front panel to organize and on the block diagram. By moving all this into an XControl, everything in the application looks a lot nicer... just one icon for the block diagram, I wire the input and a default value to it and I'm done. Also the PIDs on the front panel look exactly the same and I don't have to adjust the layout across all my applications when I change something (for example add a new config option).

 

I'm aware that XControl is probably not the right tool, but don't know what else to use... hence  this thread 😉

0 Kudos
Message 5 of 6
(2,382 Views)

Subpanels is one thing that comes to mind. You could implement your logic in a subVI and use subpanels to display information. Another thing to consider is to separate your processing from your UI altogether. Ben posted a decent write-up covering this. Define an API (most likely using queues or user events) to pass the data from your processing task to the UI for display. Similarly define a mechanism for passing data into the processing task if this is done while it is running. If you only need to pass it in when you start the task you can simply wire it in. By separating the UI and processing you have the flexibility of customizing your display as needed. This also allows you to reuse your processing tasks without worrying about how it is presented to the user.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 6 of 6
(2,372 Views)