PIDdef ch, lmt, P, I, D
Purpose To set up the parameters for a Proportional, Integral and Derivative (PID) Controller function. The function PIDcompute( ) will make use of the parameters defined here for the corresponding channel ch.

ch  = channel number (1-16)
lmt  = Maximum (saturation) limit for the computed result.
P  = Proportional Gain (KP)
I = Integral Gain (KI )
D  = Differential Gain (KD)

Transfer Function of a PID Controller are defined as follow:

All four parameters: lmt, P, I & D can be either 16 or 32-bit integer constants or integer variables. For the lmt term, the computed controller output value by the PIDcompute( ) function is not allowed beyond the + lmt value (i.e. lmt represents the saturation point of the computed controller output). PIDcompute( ) function implements "Integrator anti-windup" feature, which will avoid integrating the error signal when output is already saturated .

Important: When this statement is run, the integral and differential terms of channel ch is set to zero. Hence PIDdef should be run only once during initialization and not repeatedly executed. Otherwise the PIDcompute( ) function will not run properly because of the loss of integral and differential data.

See Also PIDcompute( )

backbutton.gif (507 bytes)  Basic to TBASIC Reference Manual