From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unusual PID behavior with large Ti

Solved!
Go to solution

I'm working on a simulation of a control system for a linear piezomotor to hold a sample (thin wire) under constant tension. The motor's manufacturer suggests using only proportional gain to avoid instability, but their controller only has a 9-bit ADC for the speed-control voltage, which doesn't provide sufficient resolution for my application at reasonable values of Kc that avoid constant saturation of the controller output. I plan to therefore use a small integral gain to compensate for this.

 

While experimenting with PID gains, I discovered that the standard PID.vi has a bit of code that I believe causes unusual behavior for large values of Ti. If you look at the final treatment of the integrated error in the (eye-cancer-inducing) internals of PID.vi, the integrated error is coerced to the output range. Additionally, if the integrated error was out of range, the new value of integrated error is set to the coerced value - Kc*error. Ignoring the practical issue of my code's behavior, can someone explain the logic of this to me? I thought through it multiple times and couldn't find a reason why this is necessary. How is the output range in any way relevant to the integrated error, and what is the point of adding Kc*error and then subtracting it if the value is out of range?

 

In theory, a PI controller with a very large Ti should effectively converge to a P controller, but I discovered that a very large Ti in the attached VI prevents the process variable from ever reaching the set point for certain combinations of parameters (e.g. SP = 100 mN, Kc = 25, Ti = 1000 s). This is obviously some sort of artefact, and I couldn't find any reason for this to happen except for the above-mentioned behavior of PID.vi.

 

Am I missing something here? Is this the expected behavior or am I misusing PID.vi in some way?

0 Kudos
Message 1 of 3
(980 Views)
Solution
Accepted by topic author bcurzadd

Hi bcurzadd,

 


@bcurzadd wrote:

If you look at the final treatment of the integrated error in the (eye-cancer-inducing) internals of PID.vi, the integrated error is coerced to the output range. Additionally, if the integrated error was out of range, the new value of integrated error is set to the coerced value - Kc*error.

 

Am I missing something here? Is this the expected behavior or am I misusing PID.vi in some way?


You seem to miss to read the (context) help for the PID function: it explicitely mentions the anti-windup implementation…

 


@bcurzadd wrote:

In theory, a PI controller with a very large Ti should effectively converge to a P controller, but I discovered that a very large Ti in the attached VI prevents the process variable from ever reaching the set point for certain combinations of parameters (e.g. SP = 100 mN, Kc = 25, Ti = 1000 s).


When your PI controller converges into a P controller, then that behaviour is expected: a pure P controller will never remove the error term completely…

Best regards,
GerdW


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

@GerdW wrote:

Hi bcurzadd,

 


@bcurzadd wrote:

If you look at the final treatment of the integrated error in the (eye-cancer-inducing) internals of PID.vi, the integrated error is coerced to the output range. Additionally, if the integrated error was out of range, the new value of integrated error is set to the coerced value - Kc*error.

 

Am I missing something here? Is this the expected behavior or am I misusing PID.vi in some way?


You seem to miss to read the (context) help for the PID function: it explicitely mentions the anti-windup implementation…

 


@bcurzadd wrote:

In theory, a PI controller with a very large Ti should effectively converge to a P controller, but I discovered that a very large Ti in the attached VI prevents the process variable from ever reaching the set point for certain combinations of parameters (e.g. SP = 100 mN, Kc = 25, Ti = 1000 s).


When your PI controller converges into a P controller, then that behaviour is expected: a pure P controller will never remove the error term completely…


I definitely overlooked the documentation of the anti-windup implementation. It seems like the integrated error becomes extremely negative, since the proportional gain causes extreme saturation if its value is too high.

0 Kudos
Message 3 of 3
(924 Views)