On Thursday 27 June 2013 10:04:30 Charles Steinkuehler did opine: > I am having some issues tuning the PID loop for temperature control on > my LinuxCNC controlled 3D printer, so I thought I'd ask about some > best practices for PID setup. > > QUESTION: > How are gains typically arranged in a PID control loop? Is the PID > output generally scaled to represent something real (like the 0-300 > degree range of my temperature readings), something arbitrary (like > +/- 100 or 1000), or just left at whatever random value seemed like a > good idea when the HAL file was first created? > > Does pushing gain around between the PID component and the output > driver change how easy/hard it is to tune the PID loop? > > BACKGROUND: > I have a temperature reading updated 20 times a second by user code > feeding into a standard HAL PID component that runs at the default 1 > mS rate. > > Driving the heater is a PWM output that is generated by my PRU code, > but mimics the behavior of the hm2 pwmgen (including generating output > for negative input values, which IMHO is just wrong, but I know why it > was done that way). > > Anyway, the PWM output has it's default scale, so 0.0 to 1.0 is no > output to full scale. I have a limit component between the PID and > the PWM to clip the negative PID output values, and a bias setting of > 0.5 on the PID. > > ...but this is turning out to be very hard to tune. I get good > results playing with P gain and adding in some D, but if I ever try > adding any I term it just goes crazy and oscillates (or just runs > away). I think my basic issue is integrator wind-up, and given my > very small 0.0-1.0 output range the integrator term can easily swamp > the output even with very small gains. By way of example, as my HAL > file stands now, a P gain setting of 0.5 is approximately my critical > gain, and P=0.3, D=0.93, I=0 was a pretty stable control loop. > > So I'm looking at clipping the I term with maxerrorI, but I am also > wondering about the overall gain setup. I have scale available on the > PWM, and obviously all the gain settings to play with on the PID > component, I'm just wondering if there's a somewhat standard way to > dial some of the knobs. > > Thanks!
I probably am going about it the wrong way, and I'm dealing with a motor and mass in the chuck that its spinning, which is really 2 different things. I turn all the stuff at the pid module off except FF0, which I look at as a scaling factor to be used to set the circuit gain to get somewhere near the correct speed as indicated by the pid.error signal being a reasonable value with constantly switching polarity. Also, the use of the limit2 for an abs function is different in my setup, basically it all runs in fwd mode, with relays in the motor control doing the reversing. So there are abs logic blocks where needed. I would also set the PWM's min's & max's to .01 and .99 to keep it alive when the input is active but out of range, thats how I 'clip'. I am also using a lincurve module between the pid output and the pwm input since the motor controller doesn't have a linear value vs speed scale. This has an added advantage in that at the higher speeds the pid's Pgain effect when you bring it in, is also reduced at those speeds where the controller is more sensitive, which allows me to use quite a bit more Pgain overall. I didn't find either Igain or Dgain to be all that helpful, but I am also using some FF1, perhaps 25% of the FF0 gain which seems to give better accel times, working better than Igain which can wind up. And I do have a limit2 intended to control the inrush ramp on speedups since the motor is rated at about 9 amps but the controller can make 25. In your case, with the heater being the target, I suspect its response may be faster than my 1hp treadmill motor and a 20 something pound chuck. Basically FF0 and Pgain with a bit of FF1 seem to be working well for the motor. Cheers, Gene -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) My web page: <http://coyoteden.dyndns-free.com:85/gene> is up! My views <http://www.armchairpatriot.com/What%20Has%20America%20Become.shtml> One way to make your old car run better is to look up the price of a new model. A pen in the hand of this president is far more dangerous than 200 million guns in the hands of law-abiding citizens. ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
