PID controller and possibles way to improve it
March 29, 2013 03:46AM
Hi folks,

When printing yesterday, I was struck by the fact that the way the temperature is controlled on our printer is not the way to go for fast speed printing. Indeed, the PID controller is a feedback loop which means that it only begins to raise power when he sees that the temperature is droping (and, in a similar way, lower the power when temperature is raising again).
Also, for the thermistor to see the change in temperature, it requires a lot of times from the moment the temperature changed at the nozzle.
This is purely logical and driven by the transfer function of the system behaviour but you can see it clearly on Pronterface that the temperature will drop seconds after a layer has been infilled at high feed rate.

In the industry, we don't use this kind of controller because it means that the extrusion temperature is not constant with the feed rate and can lead to a product out of its allowed range of quality. Actually, we use a combined regulator based on a feedforward loop to ensure that the proper power is applied before the extrusion begins and a smaller feedback loop to compensate the error of modelization.
It means that if you can measure the perturbation on the system, you can overcome it before they impacts your controlled variable or, we know the perturbation before they appears since the feedrate is in the G-code. It should be fairly simple to read some lines in advance (like firmwares do with SD printing mode) and calculate the proper PWM duty cycle to bring the polymer to its required temperature.

To do that, we must have the filament temperature before the extruder (I always have an additional thermistor hanging in the air to measure room temperature), the required temperature, the polymer specific heat, the hotend power at 100% duty cycle, the hotend thermal dissipation at rest (which also depends on the required temperature) and the amount of plastic to be fed.
Alas, PLA doesn't have a constant specific heat and it requires a look-up table to rapidly calculate the proper amount of energy required. Also, it would means experimenting with each sample of filament to get this look-up table. But, it should be possible to automatize this procedure (like the autotune PID feature).

I don't have much time right now to experiment with that but I did some simulations using MATLAB/Simulink as a proof of concept. I know that it is not practical for average people to do that but it could be an interesting proof of concept for higher feedrate printing if someone doesn't know how to spend his free time ! smiling smiley

Also, for the record, I'm an industrial engineer in automation, so I know what I'm talking about.
Re: PID controller and possibles way to improve it
March 29, 2013 10:44AM

I don't have much time right now

You see, that's the likely reason why this wasn't implemented yet. You're no exemption from the usual, here.

Anyways, publishing your proof of concept would be a starter.

Generation 7 Electronics Teacup Firmware RepRap DIY
Re: PID controller and possibles way to improve it
March 29, 2013 11:16AM
Yeah, I understand and I was only proposing this to the afficionados like the ones who are deeply involved into this kind of development. It's just that 3D printing is not my main hobby and only a mean to produce parts (like I do also with my milling machine).

By the way, I don't find a G-Code command to specify a PWM duty cycle for the hotend heater (like the M106 for the fan). Does anyone know it ? (if it exists, but I don't see why it would not be implemented)
Thanks !
Re: PID controller and possibles way to improve it
March 30, 2013 08:32AM
M106 works for heaters with temperature control, too. Not sure wether temperature control overwrites this value a few milliseconds after setting it, though. ... that is assuming you use Teacup firmware.

Generation 7 Electronics Teacup Firmware RepRap DIY
Re: PID controller and possibles way to improve it
March 31, 2013 03:39PM
Alas, I'm using Marlin which doesn't support this feature. Thank you for the input anyway. smiling smiley
Sorry, only registered users may post in this forum.

Click here to login