|
vdr-plugin-softhddevice-drm-gles 1.5.9-20e15de
|
#include <pidcontroller.h>
Public Member Functions | |
| cPidController (double, double, double, double) | |
| Constructor for the PID Controller. | |
| double | GetTargetValue () |
| double | GetPTerm () |
| double | GetITerm () |
| double | GetDTerm () |
| void | Reset () |
| Resets the internal state (integral sum and error history) | |
| void | SetTargetValue (double value) |
| double | Update (double, double) |
| Calculates the new output value. | |
Private Attributes | |
| double | proportionalGain = 0 |
| Proportional Gain (Kp) - Reaction strength. | |
| double | integralGain = 0 |
| Integral Gain (Ki) - Drift correction. | |
| double | derivativeGain = 0 |
| Derivative Gain (Kd) - Dampening. | |
| double | pTerm = 0 |
| Proportional term. | |
| double | iTerm = 0 |
| Integral term. | |
| double | dTerm = 0 |
| Derivative term. | |
| double | targetValue = 0 |
| The desired buffer fill level in frames. | |
| double | integralSum = 0 |
| Accumulator for the I-term. | |
| double | previousError = 0 |
| Error from the previous step (for D-term) | |
| bool | firstRun = true |
| Flag for first run. | |
| double | maxOutput = 0 |
| Hard limit for output correction. | |
| double | maxIntegral = 0 |
| Anti-windup limit for the integral term. | |
Definition at line 24 of file pidcontroller.h.
| cPidController::cPidController | ( | double | kp, |
| double | ki, | ||
| double | kd, | ||
| double | maxOutput | ||
| ) |
Constructor for the PID Controller.
| kp | Proportional gain |
| ki | Integral gain |
| kd | Derivative gain |
| maxOutput | Max allowed output value (absolute) |
Definition at line 39 of file pidcontroller.cpp.
References integralGain, maxIntegral, and maxOutput.
|
inline |
Definition at line 30 of file pidcontroller.h.
References dTerm.
Referenced by cSoftHdAudio::ClockDriftCompensation().
|
inline |
Definition at line 29 of file pidcontroller.h.
References iTerm.
Referenced by cSoftHdAudio::ClockDriftCompensation().
|
inline |
Definition at line 28 of file pidcontroller.h.
References pTerm.
Referenced by cSoftHdAudio::ClockDriftCompensation().
|
inline |
Definition at line 27 of file pidcontroller.h.
References targetValue.
Referenced by cSoftHdAudio::ClockDriftCompensation().
| void cPidController::Reset | ( | ) |
Resets the internal state (integral sum and error history)
Definition at line 102 of file pidcontroller.cpp.
References dTerm, firstRun, integralSum, iTerm, previousError, and pTerm.
Referenced by cSoftHdAudio::DropSamplesOlderThanPtsMs(), cSoftHdAudio::FlushBuffers(), and Update().
|
inline |
Definition at line 32 of file pidcontroller.h.
References targetValue.
Referenced by cSoftHdAudio::ClockDriftCompensation().
| double cPidController::Update | ( | double | currentValue, |
| double | dt | ||
| ) |
Calculates the new output value.
| currentValue | The current value |
| dt | The time elapsed since the last update (seconds) |
Definition at line 59 of file pidcontroller.cpp.
References derivativeGain, dTerm, firstRun, integralGain, integralSum, iTerm, LOGWARNING, maxIntegral, maxOutput, previousError, proportionalGain, pTerm, Reset(), and targetValue.
Referenced by cSoftHdAudio::ClockDriftCompensation().
|
private |
Derivative Gain (Kd) - Dampening.
Definition at line 38 of file pidcontroller.h.
Referenced by Update().
|
private |
Derivative term.
Definition at line 42 of file pidcontroller.h.
Referenced by GetDTerm(), Reset(), and Update().
|
private |
Flag for first run.
Definition at line 48 of file pidcontroller.h.
|
private |
Integral Gain (Ki) - Drift correction.
Definition at line 37 of file pidcontroller.h.
Referenced by cPidController(), and Update().
|
private |
Accumulator for the I-term.
Definition at line 45 of file pidcontroller.h.
|
private |
Integral term.
Definition at line 41 of file pidcontroller.h.
Referenced by GetITerm(), Reset(), and Update().
|
private |
Anti-windup limit for the integral term.
Definition at line 50 of file pidcontroller.h.
Referenced by cPidController(), and Update().
|
private |
Hard limit for output correction.
Definition at line 49 of file pidcontroller.h.
Referenced by cPidController(), and Update().
|
private |
Error from the previous step (for D-term)
Definition at line 46 of file pidcontroller.h.
|
private |
Proportional Gain (Kp) - Reaction strength.
Definition at line 36 of file pidcontroller.h.
Referenced by Update().
|
private |
Proportional term.
Definition at line 40 of file pidcontroller.h.
Referenced by GetPTerm(), Reset(), and Update().
|
private |
The desired buffer fill level in frames.
Definition at line 44 of file pidcontroller.h.
Referenced by GetTargetValue(), SetTargetValue(), and Update().