JARA2i.auto

Models of digital controllers

Information


 
 
 
 

Package Content

NameDescription
JARA2i.auto.PIDLim PIDLim PID controller with limited output and anti-windup compensation and set-point weight
PIDLimInteractive  


JARA2i.auto.PIDLim JARA2i.auto.PIDLim

PID controller with limited output and anti-windup compensation and set-point weight

JARA2i.auto.PIDLim

Information


                       This class models a PID controller with limited output and anti-windup compensation and set-point weight. 
The interactive variables of this class are shown in Table 1. This model has been extracted from (Astrom and Hagglund 1995).

References

K. Astrom, T. Hagglund (1995): PID Controllers: Theory, Design, and Tuning.Instrument Society of America.


Table 1. Interactive variables.
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.



Parameters

TypeNameDefaultDescription
RealsamplePeriod00.1Sample period
IntegerdimSP1Dimension of the set-point signal
Integerdimy1Dimension of the controlled variable signal
Integerdimu1Dimension of the manipulated variable signal
RealKp01Proportional gain
RealTi01Integral time constant
RealTd00.1Derivative time constant
RealN010Derivative filter parameter
RealTt010Anti wind-up compensator time constant
RealB01Set-point weight
Realulow0-1000Lower limit for the output
Realuhigh01000Upper limit for the output

Connectors

TypeNameDescription
cutReceiversetPointSignalSet-point signal
cutEmitteruVarSignalManipulated variable
cutReceiveryVarSignalControlled variable

Modelica definition

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;

JARA2i.auto.PIDLimInteractive

Modelica definition

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;

HTML-documentation generated by Dymola Tue Jul 24 19:08:19 2007.