On Tuesday 31 October 2017 15:22:39 Chris Albertson wrote: > What "P", "D" and "I" are depends on what you measure. Do you have a > position sensor or a velocity sensor or for that matter a temperature > sensor? > > A quadrature encoders can be used as either a position or as a > velocity sensor for velocity sensing you need to combine it with a > clock or counter. > > "P" is always the error signal. That is the difference between what > you want and what you got > > P's using can be either error in position, error in velocity or error > in temperature, or heading (if reading a compass) It depends on the > sensor. > > D is the rate of change in P over the period of one control cycle, I > is the sum of all past P. > > So the first question is "What are you measuring?" > > If using quadrature sensor the simples way to use it by just counting, > this measures position. So P is the error is position. > > If using the encoders as a velocity sensor then P is the error in > velocity. The sensor is just a spinning disk and if it measures > position of velocity depends on what you software does when a pulse > comes. If your software costs it is measuring position if your > software samples a clock if is measuring velocity. > > A really common way is to do to conversion from position to velocity > inside the PID loop while commuting P. The loop first subtracts the > current position from the previous position and assumes a constant > loop period and then has velocity in units of "position counts per > loop period" (which is position over time) It then compares this > with the set point which is kept in units of courts per period and > then you have P. > > There are lots of ways to do this but a common error is mixing up > units. It is a lilt confusing becait "counts" is position" but "counts > per period" is velocity and surprisingly we can convert position to > velocity with a subtraction. It is easy to miss that. > > So two easy errors (1) you've crossed up your units or > (2) quantization error from the sensor (not enough encoder ticks per > period) > > You fix #1 by being careful and #2 by either making the period much > longer (like 100X longer) or buying a better encoder or using the > ticks to sample a high resolution clock. (but if you do this, now you > are directly measuring speed so see #1 above) > I think I have that grokked now.
But in converting it to use two pid's, selecting which one by the gear shift position, I just ran into a show stopper. I cannot connect the encoder index to motion.spindle-index, which is an i/o bit, but halchecker won't let me feed both pid's. It wouldn't let me use a different by last letter name, taking an exit when it found a: net spndl.FF0 <= [SPINDLE_9]FF0L => pid.sl.FF0 So it had to dup the whole [SPINDLE_9] stanza as separate [SPINDLE_L] and [SPINDLE_H] stanza's. That worked until I got to this: hal code: net spindle-indexh-enable <=> motion.spindle-index-enable net spindle-indexl-enable <=> motion.spindle-index-enable And halcheck had a cow over that. Since that signal is I think a tristated signal, when neither is true, it seems I ought to be able to do that. Its required for spindle synched moves like rigid tapping I think. Since I'd like to do that in either gear, how to I manage that bidirectional coupling so it knows when to start the Z move? Or do I throw out the whole dual pid idea, and mux2 the FF0 and Igain from the output of a couple scale modules, effecting the majority of the corrections that way, with one more mux2 & a couple scales? Now I gotta go see if I can miss all the trick or treaters & see if I can round up a sack of dinner. Thanks Chris. Cheers, Gene Heskett -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) Genes Web page <http://geneslinuxbox.net:6309/gene> ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
