FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
PidWithExternalState.h
1#pragma once
2
22{
23public:
24 void Initialize(double P, double I, double D, double minOut, double maxOut);
25
27 double Output(double error, double integratedError, double time) const;
28
30 double IntegralRate(double error, double integratedError) const;
31
33 void Accept(double error, double time);
34
35private:
36 double m_P = 0.0;
37 double m_I = 0.0;
38 double m_D = 0.0;
39 double m_minOut = 0.0;
40 double m_maxOut = 0.0;
41 bool m_hasLast = false;
42 double m_lastError = 0.0;
43 double m_lastTime = 0.0;
44};
PID controller for use inside a SimObject, whose integral is a state that FhSim integrates.
Definition PidWithExternalState.h:22
double Output(double error, double integratedError, double time) const
The bounded controller output for error, the integrated error and the time.
void Accept(double error, double time)
Stores the error of an accepted step for the derivative part.
double IntegralRate(double error, double integratedError) const
The rate of the integral state: the error, or zero while the integral part alone is past a bound (ant...