Show Posts
Pages: [1]
1  Forum 2005-2010 (read only) / News / Re: Arduino PID Library on: January 23, 2011, 05:31:11 am
Hi br3ttb,
              Nice work out there. Library is awesome.I am still studying, not implemented yet. But I like to ask you something. There is a function that is:

void SetSampleTime(int NewSampleTime)
    if (NewSampleTime > 0)
      //convert the time-based tunings to reflect this change
      taur *= ((double)NewSampleTime)/((double) tSample);
      accError *= ((double) tSample)/((double)NewSampleTime);
      taud *= ((double)NewSampleTime)/((double) tSample);
      tSample = (unsigned long)NewSampleTime;

I am confused about this line:   taud *= ((double)NewSampleTime)/((double) tSample);
Shouldn't it be:     taud /= ((double)NewSampleTime)/((double) tSample);
                    or  taud *= ((double)) tSample/((double) NewSampleTime);

I mean: taud=TauD/tSampleInSec , right?
Pages: [1]