vdr-plugin-softhddevice-drm-gles 1.5.9-20e15de
pidcontroller.h
Go to the documentation of this file.
1
18#ifndef PID_CONTROLLER_H
19#define PID_CONTROLLER_H
20
21// Comment this in to transmit PID controller data for tuning/visualization. See DEVELOPER/README.md for instructions.
22// #define PID_CONTROLLER_TUNING_AID_ADDRESS "192.168.2.22"
23
25public:
26 cPidController(double, double, double, double);
27 double GetTargetValue() { return targetValue; }
28 double GetPTerm() { return pTerm; }
29 double GetITerm() { return iTerm; }
30 double GetDTerm() { return dTerm; }
31 void Reset();
32 void SetTargetValue(double value) { targetValue = value; }
33 double Update(double, double);
34
35private:
36 double proportionalGain = 0;
37 double integralGain = 0;
38 double derivativeGain = 0;
39
40 double pTerm = 0;
41 double iTerm = 0;
42 double dTerm = 0;
43
44 double targetValue = 0;
45 double integralSum = 0;
46 double previousError = 0;
47
48 bool firstRun = true;
49 double maxOutput = 0;
50 double maxIntegral = 0;
51
52#ifdef PID_CONTROLLER_TUNING_AID_ADDRESS
53 void SendTuningAidData(double, double, double, double, double, double);
54#endif
55};
56
57#endif
double integralGain
Integral Gain (Ki) - Drift correction.
double targetValue
The desired buffer fill level in frames.
double integralSum
Accumulator for the I-term.
void Reset()
Resets the internal state (integral sum and error history)
double maxOutput
Hard limit for output correction.
double GetTargetValue()
double maxIntegral
Anti-windup limit for the integral term.
double iTerm
Integral term.
double dTerm
Derivative term.
double GetPTerm()
double proportionalGain
Proportional Gain (Kp) - Reaction strength.
double Update(double, double)
Calculates the new output value.
double pTerm
Proportional term.
double GetDTerm()
void SetTargetValue(double value)
bool firstRun
Flag for first run.
double GetITerm()
double previousError
Error from the previous step (for D-term)
double derivativeGain
Derivative Gain (Kd) - Dampening.