PID

PID-controller in additive description form

    PID

Library

Modelica/Blocks/Continuous

Description

This is the text-book version of a PID-controller.For a more practically useful PID-controller, useblock LimPID.

The PID block can be initialized in differentways controlled by parameter initType. The possiblevalues of initType are defined inModelica.Blocks.Types.InitPID.This type is identical toTypes.Init,with the only exception that the additional optionDoNotUse_InitialIntegratorState is added forbackward compatibility reasons (= integrator is initialized withInitialState whereas differential part is initialized withNoInit which was the initialization in version 2.2 of the Modelicastandard 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 isSteadyState because initial transients are then no longerpresent. If initType = InitPID.SteadyState, then in somecases difficulties might occur. The reason is theequation of the integrator:

   der(y) = k*u;

The steady state equation "der(x)=0" leads to the condition that the input u to theintegrator is zero. If the input u is already (directly or indirectly) definedby another initial condition, then the initialization problem is singular(has none or infinitely many solutions). This situation occurs oftenfor mechanical systems, where, e.g., u = desiredSpeed - measuredSpeed andsince speed is both a state and a derivative, it is natural toinitialize it with zero. As sketched this is, however, not possible.The solution is to not initialize u or the variable that is usedto compute u by an algebraic equation.

Parameters

PID_0

NameLabelDescriptionData TypeValid Values

mo_k

k

Gain

Scalar

mo_Ti

Ti

Time Constant of Integrator

Scalar

mo_Td

Td

Time Constant of Derivative block

Scalar

mo_Nd

Nd

The higher Nd, the more ideal the derivative block

Scalar

mo_initType

initType

Type of initialization (1: no init, 2: steady state, 3: initial state, 4: initial output)

Structure

mo_initType/choice1

No initialization (start values are used as guess values with fixed=false)

Number

0
1

mo_initType/choice2

Steady state initialization (derivatives of states are zero)

Number

0
1

mo_initType/choice3

Initialization with initial states

Number

0
1

mo_initType/choice4

Initialization with initial outputs (and steady state of the states if possible)

Number

0
1

mo_initType/choice5

Do not use, only for backward compatibility (initialize only integrator state)

Number

0
1

mo_xi_start

xi_start

Initial or guess value for integrator output (= integrator state)

Scalar

mo_xd_start

xd_start

Initial or guess value for state of derivative block

Scalar

mo_y_start

y_start

Initial value of output

Scalar

PID_1

NameLabelDescriptionData TypeValid Values

mo__nmodifiers

Number of Modifiers

Specifies the number of modifiers

Number

mo__modifiers

Modifiers

Add new modifier

Structure

mo__modifiers/varname

Variable name

Cell of strings

mo__modifiers/attribute

Attribute

Cell of strings

'start'
'fixed'

mo__modifiers/value

Value

Ports

NameTypeDescriptionIO TypeNumber

u

implicit

Connector of Real input signal

input

1

y

implicit

Connector of Real output signal

output

1