Skip to content

How can a library work? #23

Description

@neoblack2

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions