• Tags
  • Documentation
  • Order
  • Register
  • Login
Duet3D Logo Duet3D
  • Tags
  • Documentation
  • Order
  • Register
  • Login

Strategy for PID tuning multiple heat zones

Scheduled Pinned Locked Moved
Tuning and tweaking
5
13
1.3k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • undefined
    deckingman
    last edited by 20 Jan 2022, 13:48

    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.

    Ian
    https://somei3deas.wordpress.com/
    https://www.youtube.com/@deckingman

    undefined 1 Reply Last reply 26 Feb 2022, 22:28 Reply Quote 3
    • undefined TWinkler referenced this topic 26 Jan 2022, 02:38
    • undefined deckingman referenced this topic 27 Jan 2022, 12:04
    • undefined
      nhfoley
      last edited by 20 Feb 2022, 22:47

      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.

      1 Reply Last reply Reply Quote 0
      • undefined
        nhfoley
        last edited by 25 Feb 2022, 22:27

        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?

        undefined 1 Reply Last reply 26 Feb 2022, 00:49 Reply Quote 0
        • undefined
          deckingman @nhfoley
          last edited by 26 Feb 2022, 00:49

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

          Ian
          https://somei3deas.wordpress.com/
          https://www.youtube.com/@deckingman

          undefined 1 Reply Last reply 26 Feb 2022, 01:06 Reply Quote 0
          • undefined
            nhfoley @deckingman
            last edited by 26 Feb 2022, 01:06

            Yes, I may do that, but keep the second sensor wired & reporting to DWC for monitoring purposes.

            undefined 1 Reply Last reply 26 Feb 2022, 06:44 Reply Quote 0
            • undefined
              nhfoley @nhfoley
              last edited by 26 Feb 2022, 06:44

              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.

              undefined 1 Reply Last reply 26 Feb 2022, 07:27 Reply Quote 0
              • undefined
                deckingman @nhfoley
                last edited by 26 Feb 2022, 07:27

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

                Ian
                https://somei3deas.wordpress.com/
                https://www.youtube.com/@deckingman

                undefined 1 Reply Last reply 26 Feb 2022, 17:07 Reply Quote 0
                • undefined
                  zapta @deckingman
                  last edited by zapta 26 Feb 2022, 17:07

                  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.

                  0a202913-06fa-40b2-be27-d67329ce3935-image.png

                  undefined 1 Reply Last reply 26 Feb 2022, 20:18 Reply Quote 0
                  • undefined
                    deckingman @zapta
                    last edited by 26 Feb 2022, 20:18

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

                    Ian
                    https://somei3deas.wordpress.com/
                    https://www.youtube.com/@deckingman

                    undefined 1 Reply Last reply 26 Feb 2022, 22:27 Reply Quote 0
                    • undefined
                      zapta @deckingman
                      last edited by 26 Feb 2022, 22:27

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

                      1 Reply Last reply Reply Quote 0
                      • undefined
                        OwenD @deckingman
                        last edited by 26 Feb 2022, 22:28

                        @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
                        undefined 1 Reply Last reply 26 Feb 2022, 22:36 Reply Quote 0
                        • undefined
                          deckingman @OwenD
                          last edited by 26 Feb 2022, 22:36

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

                          Brilliant! I'm currently the other side of the world from my printer but I'll give it a go when I get back. Thanks.

                          Ian
                          https://somei3deas.wordpress.com/
                          https://www.youtube.com/@deckingman

                          1 Reply Last reply Reply Quote 0
                          • undefined jay_s_uk referenced this topic 19 Dec 2022, 10:06
                          • undefined
                            ardisf
                            last edited by ardisf 20 Dec 2022, 08:48

                            This post is deleted!
                            1 Reply Last reply Reply Quote 0
                            8 out of 13
                            • First post
                              8/13
                              Last post
                            Unless otherwise noted, all forum content is licensed under CC-BY-SA