blockPID
Extends from Interfaces.PartialSampledBlock (Partial block of Sampled library (icon + default parameters)).
Information
This is the text-book version of a PID-controller. For a more practically useful PID-controller, use block LimPID.
The PID block can be initialized in different ways controlled by parameter initType. The possible values of initType are defined in Modelica.Blocks.Types.InitPID. This type is identical to Types.Init, with the only exception that the additional option DoNotUse_InitialIntegratorState is added for backward compatibility reasons (= integrator is initialized with InitialState whereas differential part is initialized with NoInit which was the initialization in version 2.2 of the Modelica standard library).
Based on the setting of initType, the integrator (I) and derivative (D) blocks inside the PID controller are initialized according to the following table:
| initType | I.initType | D.initType |
| NoInit | NoInit | NoInit |
| SteadyState | SteadyState | SteadyState |
| InitialState | InitialState | InitialState |
| InitialOutput and initial equation: y = y_start |
NoInit | SteadyState |
| DoNotUse_InitialIntegratorState | InitialState | NoInit |
In many cases, the most useful initial condition is SteadyState because initial transients are then no longer present. If initType = InitPID.SteadyState, then in some cases difficulties might occur. The reason is the equation of the integrator:
der(y) = k*u;
The steady state equation "der(x)=0" leads to the condition that the input u to the integrator is zero. If the input u is already (directly or indirectly) defined by another initial condition, then the initialization problem is singular (has none or infinitely many solutions). This situation occurs often for mechanical systems, where, e.g., u = desiredSpeed - measuredSpeed and since speed is both a state and a derivative, it is natural to initialize it with zero. As sketched this is, however, not possible. The solution is to not initialize u or the variable that is used to compute u by an algebraic equation.
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Boolean | continuous (from PartialSampledBlock) | blockType == Types.BlockTypeWithGlobalDefault.Continuous or blockType == Types.BlockTypeWithGlobalDefault.UseSampleClockOption and sampleClock.blockType == Types.BlockType.Continuous | True, if continuous block, otherwise discrete block |
| Types.Init | init (from PartialSampledBlock) | Modelica_LinearSystems2.Controller.Internal.convertToInit(initType, sampleClock.initType) | Type of initialization (no init/steady state/initial state/initial output) |
| Types.PID_representation | pidRep | Types.PID_representation.timeConstants | Type of PID representation |
| Real | k | 1 | Gain of controller |
| Modelica.Units.SI.Time | Ti | Time constant of Integrator block | |
| Modelica.Units.SI.Time | Td | Time constant of Derivative block | |
| Real | Nd | 10 | The higher Nd, the more ideal the derivative block |
| Real | kp | 1 | P part parameter of gain representation |
| Real | ki | 1 | I part parameter of gain representation |
| Real | kd | 1 | D part parameter of gain representation |
| Advanced options | |||
| Types.BlockTypeWithGlobalDefault | blockType (from PartialSampledBlock) | Modelica_LinearSystems2.Controller.Types.BlockTypeWithGlobalDefault.UseSampleClockOption | Type of block |
| Types.InitWithGlobalDefault | initType (from PartialSampledBlock) | Types.InitWithGlobalDefault.UseSampleClockOption | Type of initialization (no init/steady state/initial state/initial output) |
| Advanced options › Discrete block parameters | |||
| Types.MethodWithGlobalDefault | methodType (from PartialSampledBlock) | Types.MethodWithGlobalDefault.UseSampleClockOption | Type of discretization if discrete block |
| Integer | sampleFactor (from PartialSampledBlock) | 1 | Sample factor (Ts = sampleFactor * sampleClock.sampleTime) |
| Initialization | |||
| Real | xi_start | 0 | Initial or guess value value for integrator output (= integrator state) |
| Real | xd_start | 0 | Initial or guess value for state of derivative block |
| Real | y_start | 0 | Initial value of output |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Blocks.Interfaces.RealInput | u | Continuous or discrete input signal of block | |
| Modelica.Blocks.Interfaces.RealOutput | y | Continuous or discrete output signal of block |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Sampler | sampler | ||
| Modelica.Blocks.Math.Gain | P | ||
| Derivative | D | ||
| Integrator | I | ||
| Modelica.Blocks.Math.Add3 | addPID | ||
| Modelica.Blocks.Math.Gain | gainPID |