Implementation of gain scheduling for PI controllers

Started by January 17, 2019
Hi,

I'm designing a controller for a boost converter. I'm able to find a set of gains
that fit for all situations, but I get a slow response at full-load.

I was thinking instead of using gain scheduling, 1 set of gains for little to no
load and 1 set of gain when load is significant (say more than 25% of the maximum
load).

Now my question. What are the gotchas about gain scheduling? In books they don't say
much about implementation details.

I was thinking that in order for gain scheduling to work, I need to apply the Ki
gain of the integrator AFTER the integration and not before.  That way I canchange
seamlessly from one set of gain to the other. 

I.e : 

Use this =>
integrator = integrator + error;
output = Ki*integrator + Kp*error;

Instead of 
integrator = integrator + Ki*error;
output = integrator + Kp*error;


Am I correct in that thinking?

Regards

Benjamin
On Friday, January 18, 2019 at 11:05:26 AM UTC+13, benjamin....@gmail.com wrote:
> Hi, > > I'm designing a controller for a boost converter. I'm able to find a set of gains
that fit for all situations, but I get a slow response at full-load.
> > I was thinking instead of using gain scheduling, 1 set of gains for little to no
load and 1 set of gain when load is significant (say more than 25% of the maximum load).
> > Now my question. What are the gotchas about gain scheduling? In books they don't
say much about implementation details.
> > I was thinking that in order for gain scheduling to work, I need to apply the Ki
gain of the integrator AFTER the integration and not before. That way I canchange seamlessly from one set of gain to the other.
> > I.e : > > Use this => > integrator = integrator + error; > output = Ki*integrator + Kp*error; > > Instead of > integrator = integrator + Ki*error; > output = integrator + Kp*error; > > > Am I correct in that thinking? > > Regards > > Benjamin
Makes no difference for a LTI system.
Le jeudi 17 janvier 2019 19:15:19 UTC-5, gyans...@gmail.com a écrit :
> On Friday, January 18, 2019 at 11:05:26 AM UTC+13, benjamin....@gmail.com wrote: > > Hi, > > > > I'm designing a controller for a boost converter. I'm able to find a set of
gains that fit for all situations, but I get a slow response at full-load.
> > > > I was thinking instead of using gain scheduling, 1 set of gains for little to no
load and 1 set of gain when load is significant (say more than 25% of the maximum load).
> > > > Now my question. What are the gotchas about gain scheduling? In books they don't
say much about implementation details.
> > > > I was thinking that in order for gain scheduling to work, I need to apply the Ki
gain of the integrator AFTER the integration and not before. That way I canchange seamlessly from one set of gain to the other.
> > > > I.e : > > > > Use this => > > integrator = integrator + error; > > output = Ki*integrator + Kp*error; > > > > Instead of > > integrator = integrator + Ki*error; > > output = integrator + Kp*error; > > > > > > Am I correct in that thinking? > > > > Regards > > > > Benjamin > > Makes no difference for a LTI system.
A PI controller with gain scheduling is not LTI, but LTV. What I meant, is that since Ki changes with time, I was thinking of implementing the integrator this way integrator += integrator; output = Ki(t)*integrator + Kp(t) *error; Am I on the right path? Are there any other gotchas when changing the gains "live" ?
benjamin.couillard@gmail.com writes:

> Le jeudi 17 janvier 2019 19:15:19 UTC-5, gyans...@gmail.com a écrit : >> On Friday, January 18, 2019 at 11:05:26 AM UTC+13, >> benjamin....@gmail.com wrote: >> > Hi, >> > >> > I'm designing a controller for a boost converter. I'm able to find >> > a set of gains that fit for all situations, but I get a slow >> > response at full-load. >> > >> > I was thinking instead of using gain scheduling, 1 set of gains >> > for little to no load and 1 set of gain when load is significant >> > (say more than 25% of the maximum load). >> > >> > Now my question. What are the gotchas about gain scheduling? In >> > books they don't say much about implementation details. >> > >> > I was thinking that in order for gain scheduling to work, I need >> > to apply the Ki gain of the integrator AFTER the integration and >> > not before. That way I canchange seamlessly from one set of gain >> > to the other. >> > >> > I.e : >> > >> > Use this => >> > integrator = integrator + error; >> > output = Ki*integrator + Kp*error; >> > >> > Instead of >> > integrator = integrator + Ki*error; >> > output = integrator + Kp*error; >> > >> > >> > Am I correct in that thinking? >> > >> > Regards >> > >> > Benjamin >> >> Makes no difference for a LTI system. > > A PI controller with gain scheduling is not LTI, but LTV. > > What I meant, is that since Ki changes with time, I was thinking of > implementing the integrator this way > > integrator += integrator; > output = Ki(t)*integrator + Kp(t) *error; > > Am I on the right path? Are there any other gotchas when changing the > gains "live" ?
Your choice seems backwards to me; it will cause a large "bump" in output when Ki changes. The other choice, which sums Ki(t)*error, does not have this problem. I have chosen to change in the opposite direction you suggest for this very reason. --
Le vendredi 18 janvier 2019 10:38:18 UTC-5, Radey Shouman a écrit :
> benjamin.couillard@gmail.com writes: > > > Le jeudi 17 janvier 2019 19:15:19 UTC-5, gyans...@gmail.com a
écrit :
> >> On Friday, January 18, 2019 at 11:05:26 AM UTC+13, > >> benjamin....@gmail.com wrote: > >> > Hi, > >> > > >> > I'm designing a controller for a boost converter. I'm able to find > >> > a set of gains that fit for all situations, but I get a slow > >> > response at full-load. > >> > > >> > I was thinking instead of using gain scheduling, 1 set of gains > >> > for little to no load and 1 set of gain when load is significant > >> > (say more than 25% of the maximum load). > >> > > >> > Now my question. What are the gotchas about gain scheduling? In > >> > books they don't say much about implementation details. > >> > > >> > I was thinking that in order for gain scheduling to work, I need > >> > to apply the Ki gain of the integrator AFTER the integration and > >> > not before. That way I canchange seamlessly from one set of gain > >> > to the other. > >> > > >> > I.e : > >> > > >> > Use this => > >> > integrator = integrator + error; > >> > output = Ki*integrator + Kp*error; > >> > > >> > Instead of > >> > integrator = integrator + Ki*error; > >> > output = integrator + Kp*error; > >> > > >> > > >> > Am I correct in that thinking? > >> > > >> > Regards > >> > > >> > Benjamin > >> > >> Makes no difference for a LTI system. > > > > A PI controller with gain scheduling is not LTI, but LTV. > > > > What I meant, is that since Ki changes with time, I was thinking of > > implementing the integrator this way > > > > integrator += integrator; > > output = Ki(t)*integrator + Kp(t) *error; > > > > Am I on the right path? Are there any other gotchas when changing the > > gains "live" ? > > Your choice seems backwards to me; it will cause a large "bump" in > output when Ki changes. The other choice, which sums Ki(t)*error, does > not have this problem. I have chosen to change in the opposite > direction you suggest for this very reason. > > > --
I see your point, but when Ki(t) decreases, the integrator will be stuck with a huge value for a long time? I'm not saying you're wrong, I'm just trying to see all issues and gotchas.
benjamin.couillard@gmail.com writes:

> Le vendredi 18 janvier 2019 10:38:18 UTC-5, Radey Shouman a écrit : >> benjamin.couillard@gmail.com writes: >> >> > Le jeudi 17 janvier 2019 19:15:19 UTC-5, gyans...@gmail.com a
écrit :
>> >> On Friday, January 18, 2019 at 11:05:26 AM UTC+13, >> >> benjamin....@gmail.com wrote: >> >> > Hi, >> >> > >> >> > I'm designing a controller for a boost converter. I'm able to find >> >> > a set of gains that fit for all situations, but I get a slow >> >> > response at full-load. >> >> > >> >> > I was thinking instead of using gain scheduling, 1 set of gains >> >> > for little to no load and 1 set of gain when load is significant >> >> > (say more than 25% of the maximum load). >> >> > >> >> > Now my question. What are the gotchas about gain scheduling? In >> >> > books they don't say much about implementation details. >> >> > >> >> > I was thinking that in order for gain scheduling to work, I need >> >> > to apply the Ki gain of the integrator AFTER the integration and >> >> > not before. That way I canchange seamlessly from one set of gain >> >> > to the other. >> >> > >> >> > I.e : >> >> > >> >> > Use this => >> >> > integrator = integrator + error; >> >> > output = Ki*integrator + Kp*error; >> >> > >> >> > Instead of >> >> > integrator = integrator + Ki*error; >> >> > output = integrator + Kp*error; >> >> > >> >> > >> >> > Am I correct in that thinking? >> >> > >> >> > Regards >> >> > >> >> > Benjamin >> >> >> >> Makes no difference for a LTI system. >> > >> > A PI controller with gain scheduling is not LTI, but LTV. >> > >> > What I meant, is that since Ki changes with time, I was thinking of >> > implementing the integrator this way >> > >> > integrator += integrator; >> > output = Ki(t)*integrator + Kp(t) *error; >> > >> > Am I on the right path? Are there any other gotchas when changing the >> > gains "live" ? >> >> Your choice seems backwards to me; it will cause a large "bump" in >> output when Ki changes. The other choice, which sums Ki(t)*error, does >> not have this problem. I have chosen to change in the opposite >> direction you suggest for this very reason. >> >> >> -- > > I see your point, but when Ki(t) decreases, the integrator will be > stuck with a huge value for a long time? I'm not saying you're wrong, > I'm just trying to see all issues and gotchas.
If the process is in reasonably good control at the time Ki(t) decreases, why should the integrator be "stuck"? It will change slower with smaller Ki, but that's the point of changing Ki. --
Le vendredi 18 janvier 2019 10:53:14 UTC-5, Radey Shouman a écrit :
> benjamin.couillard@gmail.com writes: > > > Le vendredi 18 janvier 2019 10:38:18 UTC-5, Radey Shouman a écrit : > >> benjamin.couillard@gmail.com writes: > >> > >> > Le jeudi 17 janvier 2019 19:15:19 UTC-5, gyans...@gmail.com a
écrit :
> >> >> On Friday, January 18, 2019 at 11:05:26 AM UTC+13, > >> >> benjamin....@gmail.com wrote: > >> >> > Hi, > >> >> > > >> >> > I'm designing a controller for a boost converter. I'm able to find > >> >> > a set of gains that fit for all situations, but I get a slow > >> >> > response at full-load. > >> >> > > >> >> > I was thinking instead of using gain scheduling, 1 set of gains > >> >> > for little to no load and 1 set of gain when load is significant > >> >> > (say more than 25% of the maximum load). > >> >> > > >> >> > Now my question. What are the gotchas about gain scheduling? In > >> >> > books they don't say much about implementation details. > >> >> > > >> >> > I was thinking that in order for gain scheduling to work, I need > >> >> > to apply the Ki gain of the integrator AFTER the integration and > >> >> > not before. That way I canchange seamlessly from one set of gain > >> >> > to the other. > >> >> > > >> >> > I.e : > >> >> > > >> >> > Use this => > >> >> > integrator = integrator + error; > >> >> > output = Ki*integrator + Kp*error; > >> >> > > >> >> > Instead of > >> >> > integrator = integrator + Ki*error; > >> >> > output = integrator + Kp*error; > >> >> > > >> >> > > >> >> > Am I correct in that thinking? > >> >> > > >> >> > Regards > >> >> > > >> >> > Benjamin > >> >> > >> >> Makes no difference for a LTI system. > >> > > >> > A PI controller with gain scheduling is not LTI, but LTV. > >> > > >> > What I meant, is that since Ki changes with time, I was thinking of > >> > implementing the integrator this way > >> > > >> > integrator += integrator; > >> > output = Ki(t)*integrator + Kp(t) *error; > >> > > >> > Am I on the right path? Are there any other gotchas when changing the > >> > gains "live" ? > >> > >> Your choice seems backwards to me; it will cause a large "bump" in > >> output when Ki changes. The other choice, which sums Ki(t)*error, does > >> not have this problem. I have chosen to change in the opposite > >> direction you suggest for this very reason. > >> > >> > >> -- > > > > I see your point, but when Ki(t) decreases, the integrator will be > > stuck with a huge value for a long time? I'm not saying you're wrong, > > I'm just trying to see all issues and gotchas. > > If the process is in reasonably good control at the time Ki(t) decreases, > why should the integrator be "stuck"? It will change slower with > smaller Ki, but that's the point of changing Ki. > > --
Yeah, I think you're right. I will try your solution in simulation.
On Saturday, January 19, 2019 at 2:24:35 AM UTC+13, benjamin....@gmail.com wrote:
> Le jeudi 17 janvier 2019 19:15:19 UTC-5, gyans...@gmail.com a écrit : > > On Friday, January 18, 2019 at 11:05:26 AM UTC+13, benjamin....@gmail.com
wrote:
> > > Hi, > > > > > > I'm designing a controller for a boost converter. I'm able to find a set of
gains that fit for all situations, but I get a slow response at full-load.
> > > > > > I was thinking instead of using gain scheduling, 1 set of gains for little to
no load and 1 set of gain when load is significant (say more than 25% of the maximum load).
> > > > > > Now my question. What are the gotchas about gain scheduling? In books they
don't say much about implementation details.
> > > > > > I was thinking that in order for gain scheduling to work, I need to apply the
Ki gain of the integrator AFTER the integration and not before. That way I canchange seamlessly from one set of gain to the other.
> > > > > > I.e : > > > > > > Use this => > > > integrator = integrator + error; > > > output = Ki*integrator + Kp*error; > > > > > > Instead of > > > integrator = integrator + Ki*error; > > > output = integrator + Kp*error; > > > > > > > > > Am I correct in that thinking? > > > > > > Regards > > > > > > Benjamin > > > > Makes no difference for a LTI system. > > A PI controller with gain scheduling is not LTI, but LTV. > > What I meant, is that since Ki changes with time, I was thinking of implementing
the integrator this way
> > integrator += integrator; > output = Ki(t)*integrator + Kp(t) *error; > > Am I on the right path? Are there any other gotchas when changing the gains "live"
? For what reason are you changing the gain anyway? Is it integrator windup or is it on startup you are worried? I usually just have a soft integrator on startup and switch on the full think later. Of course if you already have a mechanical integrator - as in a position servo then it is not quite so critical. A phase lag compensator ie a soft integrator is usually good enough. Or are you working in process control?
Le dimanche 20 janvier 2019 14:45:37 UTC-5, gyans...@gmail.com a
écrit :
> On Saturday, January 19, 2019 at 2:24:35 AM UTC+13, benjamin....@gmail.com wrote: > > Le jeudi 17 janvier 2019 19:15:19 UTC-5, gyans...@gmail.com a
écrit :
> > > On Friday, January 18, 2019 at 11:05:26 AM UTC+13, benjamin....@gmail.com
wrote:
> > > > Hi, > > > > > > > > I'm designing a controller for a boost converter. I'm able to find a set of
gains that fit for all situations, but I get a slow response at full-load.
> > > > > > > > I was thinking instead of using gain scheduling, 1 set of gains for little
to no load and 1 set of gain when load is significant (say more than 25% of the maximum load).
> > > > > > > > Now my question. What are the gotchas about gain scheduling? In books they
don't say much about implementation details.
> > > > > > > > I was thinking that in order for gain scheduling to work, I need to apply
the Ki gain of the integrator AFTER the integration and not before. That way I canchange seamlessly from one set of gain to the other.
> > > > > > > > I.e : > > > > > > > > Use this => > > > > integrator = integrator + error; > > > > output = Ki*integrator + Kp*error; > > > > > > > > Instead of > > > > integrator = integrator + Ki*error; > > > > output = integrator + Kp*error; > > > > > > > > > > > > Am I correct in that thinking? > > > > > > > > Regards > > > > > > > > Benjamin > > > > > > Makes no difference for a LTI system. > > > > A PI controller with gain scheduling is not LTI, but LTV. > > > > What I meant, is that since Ki changes with time, I was thinking of implementing
the integrator this way
> > > > integrator += integrator; > > output = Ki(t)*integrator + Kp(t) *error; > > > > Am I on the right path? Are there any other gotchas when changing the gains
"live" ?
> > For what reason are you changing the gain anyway? Is it integrator windup or is it
on startup you are worried? I usually just have a soft integrator on startup and switch on the full think later. Of course if you already have a mechanical integrator - as in a position servo then it is not quite so critical. A phase lag compensator ie a soft integrator is usually good enough. Or are you working in process control? As I said before, the transfer function of the booster DC/DC changes, a lot, depending on the load. With a fixed-gain, I can have a stable system, but the time response will be slow-ish at high loads. Thus, I was thinking of using gain scheduling, one set of gains for low loads and one set of gains for high loads. For the record, I have anti-windup implemented.
On Monday, January 21, 2019 at 10:26:16 AM UTC-5, benjamin....@gmail.com wrote:
> Le dimanche 20 janvier 2019 14:45:37 UTC-5, gyans...@gmail.com a
écrit :
> > On Saturday, January 19, 2019 at 2:24:35 AM UTC+13, benjamin....@gmail.com
wrote:
> > > Le jeudi 17 janvier 2019 19:15:19 UTC-5, gyans...@gmail.com a
écrit :
> > > > On Friday, January 18, 2019 at 11:05:26 AM UTC+13, benjamin....@gmail.com
wrote:
> > > > > Hi, > > > > > > > > > > I'm designing a controller for a boost converter. I'm able to find a set
of gains that fit for all situations, but I get a slow response at full-load.
> > > > > > > > > > I was thinking instead of using gain scheduling, 1 set of gains for little
to no load and 1 set of gain when load is significant (say more than 25% of the maximum load).
> > > > > > > > > > Now my question. What are the gotchas about gain scheduling? In books they
don't say much about implementation details.
> > > > > > > > > > I was thinking that in order for gain scheduling to work, I need to apply
the Ki gain of the integrator AFTER the integration and not before. That way I canchange seamlessly from one set of gain to the other.
> > > > > > > > > > I.e : > > > > > > > > > > Use this => > > > > > integrator = integrator + error; > > > > > output = Ki*integrator + Kp*error; > > > > > > > > > > Instead of > > > > > integrator = integrator + Ki*error; > > > > > output = integrator + Kp*error; > > > > > > > > > > > > > > > Am I correct in that thinking? > > > > > > > > > > Regards > > > > > > > > > > Benjamin > > > > > > > > Makes no difference for a LTI system. > > > > > > A PI controller with gain scheduling is not LTI, but LTV. > > > > > > What I meant, is that since Ki changes with time, I was thinking of
implementing the integrator this way
> > > > > > integrator += integrator; > > > output = Ki(t)*integrator + Kp(t) *error; > > > > > > Am I on the right path? Are there any other gotchas when changing the gains
"live" ?
> > > > For what reason are you changing the gain anyway? Is it integrator windup or is
it on startup you are worried? I usually just have a soft integrator on startup and switch on the full think later. Of course if you already have a mechanical integrator - as in a position servo then it is not quite so critical. A phase lag compensator ie a soft integrator is usually good enough. Or are you working in process control?
> > As I said before, the transfer function of the booster DC/DC changes, a lot,
depending on the load. With a fixed-gain, I can have a stable system, but the time response will be slow-ish at high loads.
> > Thus, I was thinking of using gain scheduling, one set of gains for low loads and
one set of gains for high loads.
> > For the record, I have anti-windup implemented.
just for clarification... is this system implemented in DSP or analog hardware? mark