vdr-plugin-softhddevice-drm-gles 1.6.4-d0291bb
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
13// Comment this in to transmit PID controller data for tuning/visualization. See DEVELOPER/README.md for instructions.
14// #define PID_CONTROLLER_TUNING_AID_ADDRESS "192.168.2.22"
15
22public:
23 cPidController(double, double, double, double);
24 double GetTargetValue() { return targetValue; }
25 double GetPTerm() { return pTerm; }
26 double GetITerm() { return iTerm; }
27 double GetDTerm() { return dTerm; }
28 void Reset();
30 double Update(double, double);
31
32private:
33 double proportionalGain = 0;
34 double integralGain = 0;
35 double derivativeGain = 0;
36
37 double pTerm = 0;
38 double iTerm = 0;
39 double dTerm = 0;
40
41 double targetValue = 0;
42 double integralSum = 0;
43 double previousError = 0;
44
45 bool firstRun = true;
46 double maxOutput = 0;
47 double maxIntegral = 0;
48
49#ifdef PID_CONTROLLER_TUNING_AID_ADDRESS
50 void SendTuningAidData(double, double, double, double, double, double);
51#endif
52};
53
54#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.
void Reset()
Reset 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)
Calculate 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.