# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution
Highlighted

## PID range question

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?

Message 1 of 5
(893 Views)
Highlighted
Solution
Accepted by topic author shayelk

## Re: PID range question

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
CLAD expired, using LV2011SP1 + LV2017 (+LV2019 sometimes) on Win7+cRIO
Kudos are welcome

Message 2 of 5
(891 Views)
Highlighted

## Re: PID range question

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"?

Message 3 of 5
(866 Views)
Highlighted

## Re: PID range question

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
CLAD expired, using LV2011SP1 + LV2017 (+LV2019 sometimes) on Win7+cRIO
Kudos are welcome

Message 4 of 5
(860 Views)
Highlighted

## Re: PID range question

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

Message 5 of 5
(849 Views)