Shop OBEX P1 Docs P2 Docs Learn Events
PID issues — Parallax Forums

PID issues

spikecontrolspikecontrol Posts: 1
edited 2008-10-24 22:44 in BASIC Stamp
Hey
I have developed a relatively simple PID loop in a ucontroller. However iam a bit unsure about a few details:
1. In alot of the standard equations i have seen they contain Ts/Td for example, what does it mean to divide your sampling period by the derivative time.
2. If i specify a derivative time Td, does this mean i should take a sample (error sample i.e SP-PV) at say t(0) then a another sample at t(0+Td) and subtract from each other?
In any of the equations i have seen or code i have looked at there doesn't appear to be a timer that is set to sample the error difference for Td, all i see is Ts/Td, this is where the confusion comes in, if the code is not sampling for Td then why bother setting a Td? How does Ts/Td effect the loop?
The same above applies for the integral
My current understanding leads me to the following:
Use Interrupt to sample Analogue (PV) every say
* 1ms (faster then any real possible changes in·· measure value), once the sample is taken then evaluate P, I and D and output to PWM.
or
* Sample every 1ms evaluate P output to PWM, sample every Ti for integral and evaluate I output to PWM, sample every Td for derivative and evaluate D output to PWM.

Also is there any advantage to using floats if you result will ultimately go to a integer value?

Any suggestions would be appreciated.
Mike

Comments

Sign In or Register to comment.