vdr-plugin-softhddevice-drm-gles 1.6.2
pidcontroller.h
Go to the documentation of this file.
1// SPDX-License-Identifier: AGPL-3.0-or-later
2
10#ifndef PID_CONTROLLER_H
11#define PID_CONTROLLER_H
12
18// Comment this in to transmit PID controller data for tuning/visualization. See DEVELOPER/README.md for instructions.
19// #define PID_CONTROLLER_TUNING_AID_ADDRESS "192.168.2.22"
20
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();
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
59#endif
PID Controller.
double integralGain
Integral Gain (Ki) - Drift correction.
double targetValue
The desired buffer fill level in frames.
double integralSum
Accumulator for the I-term.
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 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.
void Reset()
Reset the internal state (integral sum and error history).
double Update(double, double)
Calculate the new output value.