Strategy for PID tuning multiple heat zones
-
This came up in another thread https://forum.duet3d.com/topic/26823/disabling-heater-fault. Essentially how does one tune the PID parameters for a hot end which has multiple heaters where there is conduction between the heat zones and so each heater has an effect on the other?
The following technique has worked out well for me. My hot end has two heat zones, separated by a heat break but inevitably, there is still significant transfer of heat from one zone to the other. By way of explanation I've used the term "Primary heater" to define the heater which is closest to the nozzle and "Secondary heater" to define the other heater, which in my case heats a "combining block where the 6 filaments join together. The primary heater is H1 and the secondary heater is H2.
The first step was to tune each individual heater to get some sort of PID "model" as a starting point. So I used M303 H2 S200 to tune the secondary heater to 200 deg C without heating the primary heater. After the hot end cooled, I then tuned the primary heater as a tool so that I get PID parameters with and without the fan. So I used M303 T0 S290 to tune that heater.
That's OK (ish) but it doesn't take account of the heat transfer between zones. In reality, the temperature of each zone will rise much more quickly when using both heaters, so the PID model won't be a good fit. What we really need to do is start heating one heater at the same time as starting the tuning cycle for the other.
I wrote a couple of little macros to do just that. Here is the macro for tuning the secondary heater.
; Macro to tune secondary heater ; start with all heaters at ambient T0 P0 ; select tool and suppress tool change macros G10 P0 S240:0 R240:0 ; set primary heater to 240 active and standby M303 H2 S200 ; tune secondary heater
In my case, the secondary heat zone will never get above 200 deg C, hence the "S200". The primary heater could be between 200 and 300 deg C depending on filament, and I elected to heat it to 240 as being a reasonable value.
Here is the macro for tuning the primary heater (as a tool)
; Macro to tune primary heater as tool ; start with all heaters at ambient T0 P0 ; select tool and suppress tool change macros G10 P0 S0:190 R0:190 ; set secondary heater to 190 active and standby M303 T0 S290 ; tune primary heater as tool
This seems to work well. The heating cycle reflects what happens in "real life" because I would normally set the active and standby temperatures for both heaters, then make the tool active.
This might be an iterative process as changes to one set of PID parameters will have an effect on the temperature profile of the other heater - I'll run those tuning macros a few more times until the parameters reported by M307 are repeatable.
One thing I found is that running M303 is "non-blocking". That is to say, it doesn't run like a macro which would need to finish before any other commands are acted on. So as things stand, the heater that was turned on manually by the macro will stay on at the end and needs to be turned off manually. I tried putting a G10 to turn off the heater after the M303 but it gets acted on as soon as the macro runs - it doesn't wait for the tuning cycle to complete as I hoped it might. If anyone can figure out how to automatically turn off the other heater after the tuning cycle completes, post the answer in this thread.
Hope this might be helpful.
-
-
-
Thanks for this - was wrapping my head around how to best solve this problem with a Mosquito Magnum+ with two heaters and sensors. Clever solution.
-
So I'm encountering a problem when attempting this strategy: because there is so much heat transfer between the two heater zones, the M303 algorithm is failing, because it can never complete a cooling cycle - the "passive" heater in this scenario is shedding enough heat to keep the actively autotuning heater from dropping far enough during the cooling cycle to proceed to the next phase of the algorithm.
Any thoughts on how to avoid, apart from manually triggering the passive heater to be off at just the right time during the autotune algo?
The best performance I have so far has been to autotune one heater by itself, roughly double the gain value, and then copy those parameters to both heater models. This works OK, but is still oscillating around the target temp enough that I suspect its influencing print quality. How can I improve further?
-
@nhfoley That's a tricky one. In my case I have a heat break between the two zones so although there is some transfer from one zone to the other, it isn't enough to prevent one zone from cooling sufficiently when the heater turns off.
I'd have thought that, where there is significant transfer between the two zones, then the best strategy would be to treat the hot end as a single heat zone. So maybe connect both heaters in parallel and simply use a single sensor.
-
Yes, I may do that, but keep the second sensor wired & reporting to DWC for monitoring purposes.
-
Almost accomplished this with the new RRF 3.4 multi-pin heater syntax! But held back on the upgrade to stay on production FW. Nonetheless, meatspace wiring of the two heaters in parallel is now correctly holding a temp +/-.02C, which is the noise floor of my sensor reading, anyway. With the other thermistor still wired in place, I can see that there is a roughly consistent 1C difference on the non-control side. Not perfect, but much better than what I was seeing before.
-
@nhfoley A mere 1 Deg difference between sensors means that it's effectively just a single zone so treating as such must be the best way to do the PID tuning. In my case, I can easily get 100 Deg C separation between the heat zones which is what I need for printing multiple filaments with a single nozzle. Do Slice engineering say why they use two sensors?
-
What we really need to do is start heating one heater at the same time as starting the tuning cycle for the other.
@deckingman, what is more important to you, the behavior during the initial heating or the stability once things are got to their target temperatures?
If it's the latter, then it maybe it's more representative to let two sides reaching roughly their target temperature and then tune them independently.
BTW, apparently, multivariable PID is a thing. Maybe you can convince @dc42 to support it, or just buy an of the shelf controller.
-
@zapta You clearly haven't read my opening post when I started this thread - please do so and you will see that I have developed a strategy to enable PID tuning of multiple heaters which works well for me.
The reason it didn't work for the other user is that he has a single heat zone so either heater will heat both parts of the hot end. In my case, I have two heat zones separated by a heat break giving more than 100 degC separation between the two zones.
The strategy I use gives me accurate, stable and repeatable temperature control of both zones and I don't need any advice on how you think it should be done thank you.
-
@deckingman said in Strategy for PID tuning multiple heat zones:
I don't need any advice on how you think it should be done thank you
@deckingman, it was not advice, it was guidance.
-
@deckingman said in Strategy for PID tuning multiple heat zones:
If anyone can figure out how to automatically turn off the other heater after the tuning cycle completes, post the answer in this thread.
T0 P0 ; select tool and suppress tool change macros G10 P0 S0:190 R0:190 ; set secondary heater to 190 active and standby M303 T0 S290 ; tune primary heater as tool while heat.heaters[0].state = "tuning" G4 S1 M568 P0 S0 R0 A0 ; turn off heaters associated with tool zero
-
@owend said in Strategy for PID tuning multiple heat zones:
while heat.heaters[0].state = "tuning"
G4 S1
M568 P0 S0 R0 A0 ; turn off heaters associated with tool zeroBrilliant! I'm currently the other side of the world from my printer but I'll give it a go when I get back. Thanks.
-
-
This post is deleted!