# GSPID Controller

The GSPIDÂ Controller extension is a standard PIDÂ (proportional, integral, derivative) controller with gain scheduling. It can be connected to fields in your simulation using a connection container. The effective proportional, integral, and differential gains are linearly interpolated within their respective range, based on the value and defined range of the scheduling variable.

The controller takes the setpoint, process variable, and scheduling parameter among its inputs. The error to be corrected is computed based on the difference between the setpoint and process variable. The controller also contains two additional features:Â a low-pass filter on the process variable signal, and an integral anti-windup function that prevents integration when the output reaches its limits.

**To add a GSPIDÂ Controller:**

- In a scene or mechanism, select
**Dynamics**in the Toolbox. - Double-click
**GSPIDÂ Controller**to add it to the scene or mechanism. - Configure the following fields in the Properties panel.
- Inputs
**Setpoint**: Specifies the desired value for the Process Variable.**Process Variable**: The actual value of the variable that is to be controlled. This input is necessarily in the same units as the setpoint (and also the error between the two).**Input Filter Time Constant**: The time constant (in seconds)Â of the low-pass filter on the process variable signal.**Scheduling Variable**: Current value of the variable on which the gains are scheduled. For example, in an engine speed governor use case, it can be RPMÂ or engine load.**Reset Integral**: Select this box to set the integral term to zero.**Anti Windup**: Enable this option to limit the integral term to prevent it from trying to go outside of the**Control Output Range**, avoiding "integral wind-up".**Gain Range**: Specifies the range for the controller gains (Proportional Gain*K*, Integral Gain_{p}*K*, Differential Gain_{i}*K*) that correspond to the_{d}**Scheduling Variable Range**. Note that the left point is not necessarily the minimum value.

- Parameters
**Scheduling Variable Range**: Specifies the range of the**Scheduling Variable**, which is used to determine the current gains.**Control Output Range**: Control Output will be clamped to this range.

- Inputs

In addition, the following outputs are available.

- Control Output: The output of the GSPIDÂ Controller (the sum of the proportional, integral and differential terms) exerted on the system used to correct errors. This output is limited by the
**Control Output Range**parameter. - Error: The error in the system, determined by
**Setpoint**subtracted by**Process Variable**. - Proportional Term: The proportional component (P) used that factors into the Control Effort exerted on the system to correct errors.
- Integral Term: The integral component (I) used that factors into the Control Effort exerted on the system to correct errors.
- Differential Term: The differential (D) component used that factors into the Control Effort exerted on the system to correct errors.
- Current Gain:Â Current gains (
*K*,_{p}*K*,_{i}*K*) being computed based on the current value of_{d}**Scheduling Variable**.