Arduino-PID-AutoTune-Library icon indicating copy to clipboard operation
Arduino-PID-AutoTune-Library copied to clipboard

How can a library work?

Open neoblack2 opened this issue 5 years ago • 1 comments

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 ???????????

neoblack2 avatar Feb 10 '20 09:02 neoblack2

http://brettbeauregard.com/blog/2012/01/arduino-pid-autotune-library/

rtek1000 avatar Apr 23 '22 09:04 rtek1000