**Category:****
**Controllers > PID Control

The PID Controller (Digital) block is discrete time PID, feed forward compensator.

The PID Controller (Digital) block models a PID compensator as though implemented on a processor using either backward-rectangular approximation or the higher precision trapezoidal method for integration and filtering. This block provides anti-windup of the integrator component by separately calculating the PDF components, comparing this to the actuator saturation limits, and setting integration limits at each time step. PIDF, IF, PD, I, or P control can be implemented by choosing 0 gains for the unused components.

An input is provided to reset the integrator. This input, if held high, latches the integrator to the specified initial condition. Momentary reset can be accomplished by using an external one shot.

Band limiting filters are provided for the proportional and
derivative components. Derivative bandwidth specification guarantees no more
than 10^{o} phase difference at that frequency as compared to true
derivative. A rooftop filter is used to provide roll-off at high frequency. A
simple second order low pass filter is used to limit proportional component
bandwidth.

**Integral Gain:** Indicates the multiplying factor for
the integral component of control.

**Proportional Gain:** Indicates the multiplying factor
for the proportional component of control.

**Derivative Gain:** Indicates the multiplying factor
for the derivative component of control.

**Feed forward Gain**: Indicates the multiplying factor
for the control component that feeds directly from the input to the output of
the PID controller.

**Controller Clock Frequency:** Sets the update rate of
the PID compensator in hertz.

**Actuator Low Saturation Limit**: Defines the lower
operating limit of the device connected to the PID output.

**Actuator High Saturation Limit:** Defines the upper
operating limit of the device connected to the PID output.

**Integrator Reset Value:** Defines the value at which
the integrator is initialized upon setting the Integrator Reset input high.

**Derivative Bandwidth:** Indicates the limiting
frequency of the derivative component of control in hertz.

**Proportional Bandwidth**: Indicates the limiting
frequency of the proportional component of control in hertz.

**Use Higher Precision:** When this option is activated,
Tustinâ€™s method of integration is used for higher precision in integration and
filtering. When this option is de-activated, backward rectangular integration is
selected.

**Command:** Indicates the input signal to PID
controller.

**Measurement:** Indicates the controlled variable input
measurement for PID controller.

**Integrator Reset:** When this option is set high, it
latches integrator to Integrator Reset Value. When low, it allows integration to
resume.

**Output:** Indicates the PID controller output
signal.

**Diagram name:
**Discrete PID Controller

**Location: **Examples > eMotor > Brush DC

The following example illustrates the use of the PID compensator in shaping the dynamic response of a position control loop in feedback with a DC torque motor and rotary optical encoder. A profiler issues a command to move from 0 to 3 rad, and back to 0.