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

Reverse type of controller

Open bmandl opened this issue 9 years ago • 2 comments

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;

bmandl avatar May 30 '15 10:05 bmandl

this is a valid problem. if you (or someone) deals with it in a branch I will merge.

br3ttb avatar May 30 '15 10:05 br3ttb

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.

bmandl avatar May 30 '15 18:05 bmandl