Arduino-PID-AutoTune-Library
Arduino-PID-AutoTune-Library copied to clipboard
How can a library work?
We need to strive for setpoint. And in the code at the start of tuning, this is what input was like that - it will be instead of setpoint. And all the time it will float near input.
int PID_ATune::Runtime() { justevaled=false; if(peakCount>9 && running) { running = false; FinishUp(); return 1; } unsigned long now = millis();
if((now-lastTime)<sampleTime) return false;
lastTime = now;
double refVal = *input; --------------------------------------------------------------?
justevaled=true;
if(!running) ------------------------------------------------ first start
{ //initialize working variables the first time around
peakType = 0;
peakCount=0;
justchanged=false;
absMax=refVal;
absMin=refVal;
setpoint = refVal; ----------------------------------first start setpoint = input ?
running = true;
outputStart = *output;
*output = outputStart+oStep;
}
else
{
if(refVal>absMax)absMax=refVal;
if(refVal<absMin)absMin=refVal;
}
if(refVal>setpoint+noiseBand) *output = outputStart-oStep; -------------------? input and input ? else if (refVal<setpoint-noiseBand) *output = outputStart+oStep; ----------- ? input and input ?
"corrected" output float near input? or maybe near setpoint ???????????
http://brettbeauregard.com/blog/2012/01/arduino-pid-autotune-library/