# PID Controller Example

In this example, we are designing a PID controller whose job is to minimize the effects of a disturbance force on the position, velocity, and acceleration of a block.

Referring to the figure above, a mass of 2Kg is subjected to a disturbance force, F(t). The PID is required to apply a stabilizing force to damp out the effects of the disturbance and bring the block back to where it was.

The design objective
The objective of the optimization is to determine the parameters of the PID controller so that the sum of the RMS deviations (from initial rest position) of Displacement, Velocity, and Acceleration due to the disturbance is minimized.
The design variables
Three gains of the PID controller, ${k}_{p},{k}_{i},{k}_{d}$ are defined as Design Variables (Dv).
DV Value bL, bU
kp 0.0 (0.0, 1.0)
ki 0.5 (0.0, 1.0)
kd 0.0 (0.0, 1.0)
The constraint
1 – kp2 – kd2 – ki2 < 0