blockPID
Extends from Interfaces.SISO (Single Input Single Output continuous control block).
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.Init.
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 |
In many cases, the most useful initial condition is SteadyState because initial transients are then no longer present. If initType = Init.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 |
|---|---|---|---|
| Real | k | 1 | Gain |
| SI.Time | Ti | Time Constant of Integrator | |
| SI.Time | Td | Time Constant of Derivative block | |
| Real | Nd | 10 | The higher Nd, the more ideal the derivative block |
| SI.Time | unitTime | 1 | |
| Initialization | |||
| Init | initType | Init.InitialState | Type of initialization (1: no init, 2: steady state, 3: initial state, 4: initial output) |
| Real | xi_start | 0 | Initial or guess 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 |
|---|---|---|---|
| RealInput | u (from SISO) | Connector of Real input signal | |
| RealOutput | y (from SISO) | Connector of Real output signal |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Blocks.Math.Gain | P | Proportional part of PID controller | |
| Blocks.Continuous.Integrator | I | Integral part of PID controller | |
| Blocks.Continuous.Derivative | D | Derivative part of PID controller | |
| Blocks.Math.Gain | Gain | Gain of PID controller | |
| Blocks.Math.Add3 | Add |