Add GetIntegral() and SetIntegral(double) for user-space anti-windup
This commit is contained in:
parent
9b4ca0e5b6
commit
5a5320e7e6
14
PID_v1.cpp
14
PID_v1.cpp
@ -182,6 +182,20 @@ void PID::SetMode(int Mode)
|
||||
inAuto = newAuto;
|
||||
}
|
||||
|
||||
/* GetIntegral(...)*************************************************************
|
||||
* Get Integral term for user access to anti-windup schemes
|
||||
******************************************************************************/
|
||||
double PID::GetIntegral(){
|
||||
return outputSum;
|
||||
}
|
||||
|
||||
/* SetIntegral(...)*************************************************************
|
||||
* Set Integral term for user access to anti-windup schemes
|
||||
******************************************************************************/
|
||||
void PID::SetIntegral(double Integral){
|
||||
outputSum = Integral;
|
||||
}
|
||||
|
||||
/* Initialize()****************************************************************
|
||||
* does all the things that need to happen to ensure a bumpless transfer
|
||||
* from manual to automatic mode.
|
||||
|
2
PID_v1.h
2
PID_v1.h
@ -50,6 +50,7 @@ class PID
|
||||
// once it is set in the constructor.
|
||||
void SetSampleTime(int); // * sets the frequency, in Milliseconds, with which
|
||||
// the PID calculation is performed. default is 100
|
||||
void SetIntegral(double); // * sets the internal Integral term, in output units
|
||||
|
||||
|
||||
|
||||
@ -59,6 +60,7 @@ class PID
|
||||
double GetKd(); // where it's important to know what is actually
|
||||
int GetMode(); // inside the PID.
|
||||
int GetDirection(); //
|
||||
double GetIntegral(); //
|
||||
|
||||
private:
|
||||
void Initialize();
|
||||
|
Loading…
Reference in New Issue
Block a user