FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
PID controller

Yet another PID controller.

+ Collaboration diagram for PID controller:
Author
Mats NÃ¥vik Hval
Date
20.06.2011 MNH: Initial version.

A PID controller for one signal:

\[ u = K_p (r - y) + K_d (\dot r - \dot y) + K_i \int (r - y)\, dt \]

with \( y \) the Current input and \( r \) the Desired input. The rate \( \dot y \) is an input port (Differentiation="Functional", the default) or is calculated by the object as the difference of Current between two accepted steps divided by the time between them (Differentiation="Numerical"). The units are not stated in the code.

Input ports

Name Width Description
Current 1 Measured value \( y \)
Desired 1 Desired value \( r \)
CurrentRate 1 Rate of the measured value. Only with Differentiation set to Functional
DesiredRate 1 Rate of the desired value \( \dot r \)

Output ports

Name Width Description
Out 1 The control output \( u \)

Configuration parameters

The gain names are in lower case.

Name Width Description
kp 1 Proportional gain. Default 0
ki 1 Integral gain. Default 0
kd 1 Derivative gain. Default 0
Differentiation 1 Where the rate of Current comes from: Functional (the CurrentRate input port) or Numerical (backward difference between accepted steps). Default Functional. Any other value is a parameter error

States

Name Width Description
Error 1 Integral of the error \( r - y \). Initial value 0