blockLimPID

P, PI, PD, and PID controller with limited output, anti-windup compensation and delayed, smooth activation (if wanted)
Diagram of LimPID

Information

1. Purpose of model

This model is a LimPID controller which was copied from ClaRa.Components.Utilities.Blocks.LimPID and the following was changed:

  • The reset ability can be turned off. In some situations, the reset of the controller at activation prohibits the controller from reacting correctly: If the control error decreases directly after activation, the controller will not do anything even if there is still a control error > 0.
  • The amount of states was reduced by exchanging the first order blocks by TransiEnt.Basics.Blocks.FirstOrderTransiEnt and exchanging the equations for the reset values. This improves the speed.

2. Level of detail, physical effects considered, and physical insight

(Description)

3. Limits of validity

(Description)

4. Interfaces

u_s: input for set value

u_m: input for measured value

activateInput: input to turn on the controller

y: output

5. Nomenclature

(no elements)

6. Governing Equations

(no equations)

7. Remarks for Usage

(none)

8. Validation

(no validation or testing necessary)

9. References

(none)

10. Version History

Model created by Carsten Bode (c.bode@tuhh.de), Nov 2018

Parameters

TypeNameDefaultDescription
General Design of Controller
Modelica.Blocks.Types.SimpleControllercontrollerTypeModelica.Blocks.Types.SimpleController.PIDType of controller
Realsign1set to 1 if a positive control error leads to a positive control output, else -1
Normalisation of I/O Signals
BooleanperUnitConversiontrueTrue, if input and output values should be normalised with respect to reference values
Realu_ref1Reference value for controlled variable
Realy_ref1Reference value for actuated variable
Limiter for Controller Output
Realy_max1Upper limit of output
Realy_min-y_maxLower limit of output
Time Response of the Controller
Realk1Gain of Proportional block
Modelica.Units.SI.TimeTau_i0.51/Ti is gain of integrator block
Modelica.Units.SI.TimeTau_d0.1Gain of derivative block
Anti-Windup Compensation
Modelica.Units.SI.TimeNi0.91/Ni is gain of anti-windup compensation
Derivative Filtering
RealNd1The smaller Nd, the more ideal the derivative block, setting Nd=0 introduces ideal derivative
Controller activation
Booleanuse_activateInputfalseProvide Boolean input to switch controller on/off.
ClaRa.Basics.Units.Timet_activation0.0Time when controller is switched on. For use_activateInput==true the controller is switched on if (time>t_activation AND activateController=true).
ClaRa.Basics.Units.TimeTau_lag_I0.0Time lag for activation of integral part AFTER controller is being switched on
Realy_inactive1Controller output if controller is not active
Booleanuse_resetuse_activateInput or t_activation > 0Use reset ability
I/O Filters
RealTau_in0Time constant for input smoothening, Tau_in=0 refers to signal no smoothening
RealTau_out0time constant for output smoothening, Tau_out=0 refers to signal no smoothening
Initialisation
IntegerinitOption501Initialisation option
BooleanlimitsAtInittrue= false, if limits are ignored during initializiation
Realxi_start0Initial or guess value value for integrator output (= integrator state)
Realy_start0Initial value of output
Expert Settings › DAE Index Reduction
RealTau_add0Set to >0 for additional state after add block in controller, if DAE-index reduction fails.
Expert Settings › Obsolete Settings
Realxd_start0Initial or guess value for state of derivative block

Connectors

TypeNameDefaultDescription
Modelica.Blocks.Interfaces.RealInputu_sConnector of setpoint input signal
Modelica.Blocks.Interfaces.RealInputu_mConnector of measurement input signal
Modelica.Blocks.Interfaces.BooleanInputactivateInputtrue, if controller is on
Modelica.Blocks.Interfaces.RealOutputyConnector of actuator output signal

Components

TypeNameDefaultDescription
RealcontrolErroru_s - u_mControl error (set point - measurement)
RealcontrolErrorRel(u_s - u_m)/max(Modelica.Constants.eps, u_s)Relative control error (set point - measurement)/(set point)
Modelica.Blocks.Math.GainP
ClaRa.Components.Utilities.Blocks.IntegratorI
ClaRa.Components.Utilities.Blocks.DerivativeClaRaD_approx
Modelica.Blocks.Math.Add3addPID
Modelica.Blocks.Math.AddaddI
Modelica.Blocks.Math.GaingainTrack
Modelica.Blocks.Nonlinear.Limiterlimiter
Modelica.Blocks.Sources.ConstantDzero
Modelica.Blocks.Sources.RealExpressionIzero
Modelica.Blocks.Math.GaintoPUconvert input values to "per unit"
Modelica.Blocks.Math.Feedbackfeedback
Modelica.Blocks.Math.GainfromPUconvert output values to "Real"
Modelica.Blocks.Logical.Switchswitch_OnOff_I
Modelica.Blocks.Sources.ConstantI_off_zero
Modelica.Blocks.Logical.Switchswitch_OnOff
Modelica.Blocks.Sources.RealExpressiony_unlocked
TransiEnt.Basics.Blocks.FirstOrdersmoothPIDInput
TransiEnt.Basics.Blocks.FirstOrdersmoothPIDOutput
Modelica.Blocks.Math.FeedbackaddSat
TransiEnt.Basics.Blocks.FirstOrdersmoothPIDOutput1
Modelica.Blocks.Sources.RealExpressiony_start_I
Modelica.Blocks.Math.FeedbackresetP
Modelica.Blocks.Sources.RealExpressiony_unlocked1
Modelica.Blocks.Math.AddresetPD
Modelica.Blocks.Sources.RealExpressiony_unlocked2
Modelica.Blocks.Sources.BooleanExpressionactivate_
Modelica.Blocks.Logical.Timertime_lag_I_activation
Modelica.Blocks.Logical.AndcontrollerActive
Modelica.Blocks.Routing.BooleanPassThroughbooleanPassThrough
Modelica.Blocks.Logical.GreaterThresholdI_activation

Revisions

  • 15.04.09 First revision, Boris Michaelsen, XRG Simulation GmbH
  • 25.11.09 Update to independently set the gain and time constants of the PID, added a new parameter "sign" for case dependent control error evaluation, Friedrich Gottelt, XRG Simulation GmbH