Arduino-PID-AutoTune-Library
Arduino-PID-AutoTune-Library copied to clipboard
Reverse type of controller
This two lines of code are made for DIRECT type of pid controller. What if user wants reverse type? Output will never step in other direction. We have to swap +'s and -'s.
//oscillate the output base on the input's relation to the setpoint
if(refVal>setpoint+noiseBand) *output = outputStart-oStep;
else if (refVal<setpoint-noiseBand) *output = outputStart+oStep;
To this:
//oscillate the output base on the input's relation to the setpoint
if(refVal>setpoint+noiseBand) *output = outputStart+oStep;
else if (refVal<setpoint-noiseBand) *output = outputStart-oStep;
this is a valid problem. if you (or someone) deals with it in a branch I will merge.
I wouldn't find out if I wouldn't strugle with this issue for a month. First, when I had no idea what is wrong, I tried to solve it with setting output step to negative value. Oscilation acctualy worked, but parameters were negative. So I jumped into source of library.