Lots of good responses already here, but I want to
emphasize a couple of the points.

If you are reading the temperature 20 times per second,
then you should only run the PID loop 20 times per
second. Anything more is just excess gain and an
invitation to trouble. The actual loop rate (read and
correct) should not happen more than about 10 times
in one time constant of the system. My guess is that
the time constant of your extruder is in the range
of one second and the bed heater might be in the
range of 5 seconds.

Integral wind up is a significant problem in heater
systems. There are three main ways to combat integral
problems. (1) use little or no integral term (2) freeze 
the integral accumulation when the output is at the 
extremes of its range (3) dump excess accumulated
integral when the input command changes direction.
The latter is not applicable to temperature control
because your input command is not changing direction.

I have not tried it, but it would seem that FF0 would
be quite helpful in heater systems because it would
not be influenced by the unequal positive and negative
gain of the system where heat pushes the temperature
up but only passive cooling pulls it down.

If the heater element is not easily damaged by excess
input, I would start by setting everything but FF0
to zero and get an approximately correct response from
FF0. With FF0 set such that you do not quite get the
desired temperature, add some P gain. D gain is added
to help prevent overshoot. I gain is added only when
the P gain leaves the system always slightly short of
the target during the steady state condition.

Steve Stallings
 

> -----Original Message-----
> From: Charles Steinkuehler [mailto:[email protected]] 
> Sent: Thursday, June 27, 2013 9:57 AM
> To: EMC2-Users-List
> Subject: [Emc-users] PID Best Practices
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> 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!
> 
> - -- 
> Charles Steinkuehler
> [email protected]
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (MingW32)
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
> 
> iEYEARECAAYFAlHMRJEACgkQLywbqEHdNFyrHgCgsyuk4DSU6LvRNFl3MjvrOzVr
> 7sIAoKIqOrqqPdZzUXp0W2uy4jmHPc9A
> =KzET
> -----END PGP SIGNATURE-----
> 
> --------------------------------------------------------------
> ----------------
> 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
> 


------------------------------------------------------------------------------
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

Reply via email to