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.

40 lines
895 B
C++
Raw Permalink Normal View History

/* A PID controller.
2019-04-12 09:45:12 +02:00
*
* Author: Steffen Vogel <post@steffenvogel.de>
* SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
* SPDX-License-Identifier: Apache-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:
// 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
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