# Feedback Traction Controller - PID Controller

A Proportional-Integral-Derivative (PID) controller is a feedback controller that computes a vehicle input using the error, the integral of error, and the rate of change of error between a desired vehicle response and the actual vehicle response.

To use a PID control you enter proportional (KP), integral (KI), and derivative (KD) gains, the type of desired response (for example, longitudinal speed or acceleration), and reference the desired response (for example, a table of speed vs time). The Altair Driver then applies the Proportional-Integral-Derivative (PID) control law to calculate the throttle and brake signals.

## Algorithm

Parameters
Demand Signal U
Feedback or response signal X
Error e
Proportional gain Proportional gain
Derivative gain Derivative gain
Integral gain Integral gain
Integral control flag Integral control flag
Integral band Integral band
Driver throttle output O throttle
Driver brake output O brake
Drive Ratio
Gear Ratio

## Types

• VELOCITY CONTROL - Demand signal is a velocity profile with time or distance traveled as independent variable.
• ACCELERATION CONTROL - Demand signal is an acceleration profile with time or distance traveled as independent variable.
• Demand signal can be constant, expression driver, user defined curve, or MotionView Signal (similar to Open Loop controller).
[LONG_PID_CONTROLLER]
TAG = 'PID'
TYPE = 'FOLLOW_VELOCITY'
DEMAND_SIGNAL = 'DEMAND_SPEED'
I_ACTIVE_BAND = 2
KP 	 			= 100
KD 				= 20
KI 				= 10
INITIAL_ERROR 		= -5
[FEEDFORWARD LONGITUDINAL CONTROLLER]
TAG Attr - string REQUIRED

<PID >

Attr - string OPTIONAL
• By default assumes FOLLOW_VELOCITY.
• Options:
• FOLLOW_VELOCITY
• FOLLOW_ACCELERATION
DEMAND_SIGNAL Attr - string REQUIRED

Block name that contains the demand signal. See the Demand Signal Block topic to learn more about all of the available methods.

I_ACTIVE_BAND Attr - real OPTIONAL
• Band in which integral control is activate.
If absent:
• Integral gain is always active. May lead to overcompensation.
KP Attr - real OPTIONAL
• Proportional gain
If absent:
• KP = 0
KD Attr - real OPTIONAL
• Differential gain
If absent:
• KD = 0
KI Attr - real OPTIONAL
• Integral gain
If absent:
• KI = 0
INITIAL_ERROR Attr-real OPTIONAL
• Integral error
If absent:
• INITIAL_ERROR = 0