LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modify Vi controls/data ranges

So I'm programming a VI that interfaces to a machine, and gives it either currents or voltages to output and measure. 

 

My previous post is here: http://forums.ni.com/t5/LabVIEW/Multiple-interfaces-multiple-windows-not-sure-how-to-word-this/td-p/...

 

Basically, I have a Vi all wired up and ready to go, but it only outputs voltage/measures current. 

I have a drop down menu that selects 0 when voltage source mode, and 1 when current source mode, and can use that to switch the VI around so that when 0 its outputting voltage and 1 outputting current. The issue is, then my start/stop variables need to change names, and have different data ranges, and a lot of other things have to change, such as the graph axes. 

 

Ideally, i'd be able to do all of this in one VI, and I'm hoping not to have to have two separate Vi's, since when I change one thing in one VI, I have to mirror it in the other, it feels inefficient. 

 

Suggestions?

 

 

0 Kudos
Message 1 of 15
(3,220 Views)

It really depends on the structure of your program and how many things have to change in how many places.

 

Please post your VI with note about what needs to change.

 

Lynn

Message 2 of 15
(3,219 Views)

I'd post the code, but I can't since I'm being paid to produce it.

 

I'm posting the visual interface, the things i circled in red need to change when I change the voltage/current indicator in the top left.

 

Its not TOO many changes each time (with finished voltage source takes ~5 minutes to make a current), but here is the dev process:

 

1.  Update voltage

2.  Copy voltage code entirely over to current code. 

3.  Change ~10 variable names and ~6 wiring positions.

4.  Update input parameters datarange (For example, I can allow someone to put in 110 for the input on voltage, but if I didn't change the range and they put in 110 amps... that would be very bad).

5.  Test to make sure everything was done correctly.

 

I want to leave behind code that doesn't involve this ridiculous process in order to be updated.

 

0 Kudos
Message 3 of 15
(3,214 Views)

If you just want to change the labels, you can use captions instead of labels and use a property node to change the caption text.  If you want to display entirely different controls and indicators, you can use the visibility property to hide one set and make the other set visible.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 15
(3,204 Views)

 


@tbob wrote:

If you just want to change the labels, you can use captions instead of labels and use a property node to change the caption text.  If you want to display entirely different controls and indicators, you can use the visibility property to hide one set and make the other set visible.

 


 

I think I'd have to use different controls, since the data ranges change drastically.

 

I'm just worried my code will be hideous with selectors everywhere saying "Is it current or voltage?"

 

I'm not sure what to do

0 Kudos
Message 5 of 15
(3,201 Views)

You can also use a tab control with duplicates in the same relative position.

 

If you have duplicate controls, why you need selectors? The event structure would only execute when a specific control changes and if they are different, there is no problem.

0 Kudos
Message 6 of 15
(3,198 Views)

Using tabs is way better than hiding and unhiding controls.  Good idea Dennis.

Name all of your controls and indicators with a V or I at the end.  Like Source Settings - V for the voltage tab and Source Settings - I for the current tab.  That will avoid confusion on your block diagram.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 7 of 15
(3,189 Views)

 


@tbob wrote:

Using tabs is way better than hiding and unhiding controls.  Good idea Dennis.

Name all of your controls and indicators with a V or I at the end.  Like Source Settings - V for the voltage tab and Source Settings - I for the current tab.  That will avoid confusion on your block diagram.

 


 

I'm liking Dennis's idea too, I'll try it out and see how it looks.

 

So nice you can just back up working code 🙂

0 Kudos
Message 8 of 15
(3,179 Views)

Do you know how to use the same control/indicator on different tabs? That might make some things simpler as well.

0 Kudos
Message 9 of 15
(3,173 Views)

@Dennis Knutson wrote:

Do you know how to use the same control/indicator on different tabs? That might make some things simpler as well.


You can do that?  Show me!!!!!

- tbob

Inventor of the WORM Global
0 Kudos
Message 10 of 15
(3,170 Views)