LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set propotional gain explicity in labVIEW

Solved!
Go to solution

Hi all,

When I use the PID vi. the propotional gain(kc) can only be varied in front panel. Since I am doing the instrument control project. Is there any way to make propotional gain(Kc) dependent, which is Kc= K1+K2* current(measured). The current is measured by using DAQmx and K1, K2 is changeable in front panel, so there is no need to change Kc manually.

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

Help us to help you.

Sample code please!

Benoit

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

Hi Jayden,

 

Is there any way to make propotional gain(Kc) dependent, which is Kc= K1+K2* current(measured).

So you have a problem in creating a simple math expression in LabVIEW?

Really?

check.png

Suggestion: take the online training resources offered for free in the header of this LabVIEW board!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 9
(4,257 Views)

Hi Gerdw,

Thanks for your reply. In fact, I don't know how to make propotional gain(Kc) variable, please see attachment.

0 Kudos
Message 4 of 9
(4,247 Views)
Solution
Accepted by Jaydennnn

Hi Jayden,

 

Kc is an element in the PIDGains cluster. Use cluster functions to change the KC value within that cluster!

 

Did you notice my suggestion? When you don't know about those basic LabVIEW items you really should take those learning resources!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 9
(4,245 Views)
Solution
Accepted by Jaydennnn

Jaydennnn you are wiring the input of the PID gain to a control which is why the only way to modify the values are through the front panel. Controls are meant to be controlled via front panel interaction.

See GerdW's post on how to calculate the Kc value you desire and then bundle the computed value into the Gain input of the PID.vi 

 

PID function Gain.png

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

Hi marcelmorin & GerdW,

 

It works now! Appreciate it. 

0 Kudos
Message 7 of 9
(4,217 Views)

Hi Marcel,

 

why do you suggest the plain Bundle function and not BundleByName?

- Bundle expects a wire at each input…

- BundleByName creates much better self-documenting code…

(The PID gains is a typedefined cluster anyway…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 9
(4,203 Views)

You're correct GertW! For clarification regarding this post I've attached what the "cleaner" code looks like.

PID function Gain.png

Thanks for the input on making the code cleaner and more readable.

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