7.2.3 PID
Description
PID computes the controlOutput element of the data structure tPID:
controlOutput[n] = controlOutput[n-1]
+ controlHistory[n] * abcCoefficient[0]
+ controlHistory[n-1] * abcCoefficient[1]
+ controlHistory[n-2] * abcCoefficient[2]
//where
abcCoefficient[0] = Kp + Ki + Kd
abcCoefficient[1] = -(Kp + 2*Kd)
abcCoefficient[2] = Kd
ControlHistory[n] = MeasuredOutput[n] - ReferenceInput[n]
Prototype
void PID ( tPID* PIDStruct );
Arguments
Parameters |
Description |
---|---|
PIDStruct |
A pointer to a PID data structure of type tPID |
Returns
Pointer to PIDStruct
Remarks
controlOutput element is updated by the PID() routine. The controlOutput will be subject to saturation.
Source File
- pid_aa.s
Function Profile
Device |
Program Words |
Cycles |
---|---|---|
PIC32A |
22 |
34 |
System resource usage
- W0…W7 - used, not restored.
- ACCA, ACCB - used, not restored
- CORCON - saved, used, restored
- REPEAT - instruction usage – None