1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-16 00:00:02 +01:00
VILLASnode/common/include/villas/dsp/pid.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
946 B
C++
Raw Normal View History

2019-04-12 09:45:12 +02:00
/** A PID controller.
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
2022-03-15 09:05:42 -04:00
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
2022-05-19 17:40:10 +02:00
* @license Apache License 2.0
2019-04-12 09:45:12 +02:00
*********************************************************************************/
#pragma once
namespace villas {
namespace dsp {
class PID {
protected:
double dt;
double max;
double min;
double Kp;
double Kd;
double Ki;
double pre_error;
double integral;
2019-04-12 09:45:12 +02:00
public:
/**
2019-04-12 09:45:12 +02:00
* Kp - proportional gain
* Ki - Integral gain
* Kd - derivative gain
* dt - loop interval time
* max - maximum value of manipulated variable
* min - minimum value of manipulated variable
2019-04-12 09:45:12 +02:00
*/
PID(double _dt, double _max, double _min, double _Kp, double _Kd, double _Ki);
2019-04-12 09:45:12 +02:00
/** Returns the manipulated variable given a setpoint and current process value */
double calculate(double setpoint, double pv);
2019-04-12 09:45:12 +02:00
};
} // namespace dsp
} // namespace villas