semf
|
Implementation of an pid (proportional integral derivative) regulator. More...
#include <pidcontroller.h>
Public Member Functions | |
PidController (double kp, double ki, double kd, double sampleTime, double yMin, double yMax, double setpoint=0, double yStart=0, double deltaMax=DBL_MAX) | |
Constructor. More... | |
virtual | ~PidController ()=default |
void | setKp (double kp) |
Set the proportional gain. More... | |
double | kp () const |
Returns the proportional gain. More... | |
void | setKi (double ki) |
Set the gain of the integral. More... | |
double | ki () const |
Get the gain of the integral. More... | |
void | setKd (double kd) |
Set the gain of the derivative. More... | |
double | kd () const |
Returns the gain of the derivative. More... | |
void | setSampleTime (double sampleTime) |
Set the sample time of the controller. More... | |
double | sampleTime () const |
Returns the current configured sample time. More... | |
void | setSetpoint (double setpoint) |
Set the controller set point. More... | |
double | setpoint () const |
Returns the current set point. More... | |
void | setMaxOutput (double max) |
Limits the maximum value of the output. More... | |
double | maxOuput () const |
Returns the maximum value which the output is allowed to have. More... | |
void | setMinOutput (double min) |
Set the minimum possible output. More... | |
double | minOutput () const |
Returns the minimum possible output. More... | |
void | setMaxDelta (double delta) |
Set the max delta of the output between two samples. More... | |
double | maxDelta () const |
Returns Set the max delta of the output between two samples. More... | |
void | reset (double yStart=0) |
Resets the past sampled values which will be used for the calculation of the integral and derivative. More... | |
virtual double | calculate (double currentValue) |
Calculates the output value dependent to the actual value. This method must be called cyclically at the interval of the set sampling time. More... | |
Implementation of an pid (proportional integral derivative) regulator.
Definition at line 20 of file pidcontroller.h.
semf::PidController::PidController | ( | double | kp, |
double | ki, | ||
double | kd, | ||
double | sampleTime, | ||
double | yMin, | ||
double | yMax, | ||
double | setpoint = 0 , |
||
double | yStart = 0 , |
||
double | deltaMax = DBL_MAX |
||
) |
Constructor.
kp | Proportional coefficient. |
ki | Integral coefficient. |
kd | Derivative coefficient. |
sampleTime | The sampling time [s]. |
yMin | The minimum output value. |
yMax | The maximum output value. |
setpoint | The value on which the output is to be regulated. |
yStart | This value is used for the first calculation. |
deltaMax | The maximum permissible change of the output value. |
Definition at line 16 of file pidcontroller.cpp.
|
virtualdefault |
|
virtual |
Calculates the output value dependent to the actual value. This method must be called cyclically at the interval of the set sampling time.
currentValue | The current value. |
Definition at line 146 of file pidcontroller.cpp.
double semf::PidController::kd | ( | ) | const |
Returns the gain of the derivative.
Definition at line 71 of file pidcontroller.cpp.
double semf::PidController::ki | ( | ) | const |
Get the gain of the integral.
Definition at line 57 of file pidcontroller.cpp.
double semf::PidController::kp | ( | ) | const |
Returns the proportional gain.
Definition at line 45 of file pidcontroller.cpp.
double semf::PidController::maxDelta | ( | ) | const |
Returns Set the max delta of the output between two samples.
Definition at line 129 of file pidcontroller.cpp.
double semf::PidController::maxOuput | ( | ) | const |
Returns the maximum value which the output is allowed to have.
Definition at line 107 of file pidcontroller.cpp.
double semf::PidController::minOutput | ( | ) | const |
Returns the minimum possible output.
Definition at line 118 of file pidcontroller.cpp.
void semf::PidController::reset | ( | double | yStart = 0 | ) |
Resets the past sampled values which will be used for the calculation of the integral and derivative.
yStart | The start value for the integral (should 0 of no integral is used). |
Definition at line 134 of file pidcontroller.cpp.
double semf::PidController::sampleTime | ( | ) | const |
Returns the current configured sample time.
Definition at line 85 of file pidcontroller.cpp.
void semf::PidController::setKd | ( | double | kd | ) |
Set the gain of the derivative.
kd | The new gain. |
Definition at line 62 of file pidcontroller.cpp.
void semf::PidController::setKi | ( | double | ki | ) |
Set the gain of the integral.
ki | The new gain. |
Definition at line 50 of file pidcontroller.cpp.
void semf::PidController::setKp | ( | double | kp | ) |
Set the proportional gain.
kp | The new gain |
Definition at line 37 of file pidcontroller.cpp.
void semf::PidController::setMaxDelta | ( | double | delta | ) |
Set the max delta of the output between two samples.
delta | The max delta of the output. |
Definition at line 123 of file pidcontroller.cpp.
void semf::PidController::setMaxOutput | ( | double | max | ) |
Limits the maximum value of the output.
max | The maximum value of the output. |
Definition at line 101 of file pidcontroller.cpp.
void semf::PidController::setMinOutput | ( | double | min | ) |
Set the minimum possible output.
min | The minimum possible output. |
Definition at line 112 of file pidcontroller.cpp.
double semf::PidController::setpoint | ( | ) | const |
Returns the current set point.
Definition at line 96 of file pidcontroller.cpp.
void semf::PidController::setSampleTime | ( | double | sampleTime | ) |
Set the sample time of the controller.
sampleTime | The sample time. |
Definition at line 76 of file pidcontroller.cpp.
void semf::PidController::setSetpoint | ( | double | setpoint | ) |
Set the controller set point.
setpoint | The set point. |
Definition at line 90 of file pidcontroller.cpp.