LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PID range question

Solved!
Go to solution

Hi,

I'm trying to understand what is the proper way to define a PID output range. here is the problem:

I want to control the roll angle of an aircraft which gets input between 0 and 2.5 volts, when 0 means full left and 2.5 means full right. so if the angle is just right I'd like the PID output to be 1.25.

what is the proper way to write it?
should I set the PID's output range to [0 to 2.5] or use [-100 to 100] and adjust the output accordingly using an expression node with [(x+100)/80], or should I use an entirely different method?

 

I currently use 0-2.5 which works fine at the steady state, but at the beginning of the run, when the aircraft is level I get an output of 0, which tilts it violently to the left.

 

Another question is what is the proper way to reverse the PID's output:
Because of different axes definitions, sending 2.5 to the roll channel will increase the roll feedback, while sending 2.5 to the pitch channel will reduce the pitch. So I need to inverse the PID's action, but again, I don't know what will be the proper way of doing it:
should I inverse the output range (i.e 100 to -100), or should I multiply by -1 either the proccess variable, the setpoint or the output?

thanks a lot for your comments!

0 Kudos
Message 1 of 5
(2,655 Views)
Solution
Accepted by shayelk

Hi shayelk,

 

you should set your output range to [0, 2.5] and you are done…

 

but at the beginning of the run, when the aircraft is level I get an output of 0, which tilts it violently to the left.

The PID from NI's toolkit work bumpless (see it's help!). All you need to do is to provide the "manual control" at all times…

 

So I need to inverse the PID's action

should I inverse the output range (i.e 100 to -100), or should I multiply by -1 either the proccess variable, the setpoint or the output?

All those options are wrong. This is done by inversion negation of Kp aka P…

 

Wikipedia is a good source of information here, read this paragraph to understand why you need to negate Kp!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 5
(2,653 Views)

thanks a lot!
funny how I didn't think of negating P. Just to make sure I got it right- the result of negating P would practicaly be similar to multiplying the output by -1, right?

I didn't understand the part about the PID working bumpless though. What do you mean by "provide the manual control at all times"?

0 Kudos
Message 3 of 5
(2,628 Views)

Hi shayelk,

 

the result of negating P would practicaly be similar to multiplying the output by -1, right?

Well, negating P changes the direction the PID control works. It's like changing from a heater to a cooler…

 

What do you mean by "provide the manual control at all times"?

From the help of Advanced PID:

manual control specifies the value of the control output when auto? is FALSE.

When auto? is FALSE, this VI uses manual control. This VI uses bumpless transfer from manual control to automatic control.

When the PID is off (auto?=FALSE) it will output the value wired at manual control. When switching to auto?=TRUE it will not jump to a new output value, but will "sweep" to a new value as is said: bumpless…

 

I think that's what you want: when activating the PID it should start with the last value provided by manual control

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 5
(2,622 Views)

Thanks! once again, you've been a great help!

0 Kudos
Message 5 of 5
(2,611 Views)