| Name | Description |
|---|---|
| PID controller with limited output and anti-windup compensation and set-point weight | |
| PIDLimInteractive |
JARA2i.auto.PIDLim
K. Astrom, T. Hagglund (1995): PID Controllers: Theory, Design, and Tuning.Instrument Society of America.
| Kp | Proportional gain. |
| Ti | Integral time constant. |
| Td | Derivative time constant. |
| N | Derivative filter parameter. |
| Tt | Anti wind-up compensator time constant. |
| B | Setpoint weight. |
| ulow | Lower limit for the output. |
| uhigh | Upper limit for the output. |
| Type | Name | Default | Description |
|---|---|---|---|
| Real | samplePeriod0 | 0.1 | Sample period |
| Integer | dimSP | 1 | Dimension of the set-point signal |
| Integer | dimy | 1 | Dimension of the controlled variable signal |
| Integer | dimu | 1 | Dimension of the manipulated variable signal |
| Real | Kp0 | 1 | Proportional gain |
| Real | Ti0 | 1 | Integral time constant |
| Real | Td0 | 0.1 | Derivative time constant |
| Real | N0 | 10 | Derivative filter parameter |
| Real | Tt0 | 10 | Anti wind-up compensator time constant |
| Real | B0 | 1 | Set-point weight |
| Real | ulow0 | -1000 | Lower limit for the output |
| Real | uhigh0 | 1000 | Upper limit for the output |
| Type | Name | Description |
|---|---|---|
| cutReceiver | setPointSignal | Set-point signal |
| cutEmitter | uVarSignal | Manipulated variable |
| cutReceiver | yVarSignal | Controlled variable |
model PIDLim
"PID controller with limited output and anti-windup compensation and set-point weight"
extends interf.controllerI(
dimSP=1,
dimu=1,
dimy=1);
parameter Real samplePeriod0 = 0.1 "Sample period";
parameter Real Kp0= 1 "Proportional gain";
parameter Real Ti0 = 1 "Integral time constant";
parameter Real Td0 = 0.1 "Derivative time constant";
parameter Real N0 = 10 "Derivative filter parameter";
parameter Real Tt0 = 10 "Anti wind-up compensator time constant";
parameter Real B0 = 1 "Set-point weight";
parameter Real ulow0 = -1000 "Lower limit for the output";
parameter Real uhigh0 = 1000 "Upper limit for the output";
Real Kp(start=Kp0);
Real Ti(start=Ti0);
Real Td(start=Td0);
Real N(start=N0);
Real Tt(start=Tt0);
Real B(start=B0);
Real ulow(start=ulow0);
Real uhigh(start=uhigh0);
discrete Real P(start=0);
discrete Real I(start=0);
discrete Real D(start=0);
protected
discrete Real y;
Real bi(start=0);
Real ar(start=0);
Real bd(start=0);
Real ad(start=0);
Real uSinSat(start=0);
initial equation
pre(y) = yVar[1];
equation
der(Kp) = 0;
der(Ti) = 0;
der(Td) = 0;
der(N) = 0;
der(Tt) = 0;
der(B) = 0;
der(ulow) = 0;
der(uhigh) = 0;
bi = Kp*samplePeriod/Ti;
ar = samplePeriod/Tt;
ad = Td/(Td + N*samplePeriod);
bd = Kp*N*ad;
when sampleTrigger then
y = yVar[1];
P = Kp*(B*setPoint[1] - y);
D = ad*pre(D) - bd*(y - pre(y));
uSinSat = P + D + pre(I);
uVar[1] = if uSinSat < ulow then ulow else if uSinSat > uhigh then uhigh else
uSinSat;
I = pre(I) + bi*(setPoint[1] - y) + ar*(uVar[1] - uSinSat);
end when;
end PIDLim;
model PIDLimInteractive
// Physical model
PIDLim PIDLim1;
// Interface
input Real Iparam[8];
input Real Its;
input Real ySystem;
input Real setPoint;
input Real CKparam;
input Real CKts;
output Real O;
output Real Release;
protected
Boolean CKparamIs0(start=true, fixed=true);
Boolean CKtsIs0(start=true, fixed=true);
equation
// Model release
// -------------
{Release} = {8.0};
when CKparam > 0.5 and pre(CKparamIs0) or CKparam < 0.5
and not pre(CKparamIs0) then
CKparamIs0 =CKparam < 0.5;
reinit(PIDLim1.Kp,Iparam[1]);
reinit(PIDLim1.Ti,Iparam[2]);
reinit(PIDLim1.Td,Iparam[3]);
reinit(PIDLim1.N,Iparam[4]);
reinit(PIDLim1.Tt,Iparam[5]);
reinit(PIDLim1.B,Iparam[6]);
reinit(PIDLim1.ulow,Iparam[7]);
reinit(PIDLim1.uhigh,Iparam[8]);
// reinit(signalsp.signalI, Iparam.signal[9]);
end when;
// Interactive change of the input variables
// -----------------------------------------
when CKts > 0.5 and pre(CKtsIs0) or CKts < 0.5 and not
pre(CKtsIs0) then
CKtsIs0 =CKts < 0.5;
reinit(PIDLim1.samplePeriod,Its);
end when;
// Input variable (output of the system to be controlled)
// -------------------------------------------------------
PIDLim1.yVarSignal.signal = {ySystem};
PIDLim1.setPointSignal.signal = {setPoint};
// Output variables
// ----------------
{O} = {PIDLim1.uVar[1]};
end PIDLimInteractive;