Duet PID Tuning

Discussion in 'Calibration, Help, and Troubleshooting' started by Spoon Unit, Aug 21, 2017.

  1. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,095
    Likes Received:
    322
    Guide here - https://duet3d.com/wiki/Tuning_the_heater_temperature_control

    1.19.1 fixes a 1.19 bug where the results of tuning were not fed back to the DWC GCODE console.


    My results on the E3D V6 (after centering, heating the bad, and put the fan on full blast).

    Pre PID-tuning defaults (from I don't know exactly where... factory default possibly)

    9:24:09 AM
    M307 H1

    Heater 1 model: gain 340.0, time constant 140.0, dead time 5.5, max PWM 1.00, mode: PID
    Computed PID parameters for setpoint change: P13.4, I0.095, D51.4
    Computed PID parameters for load change: P13.4, I0.949, D51.4

    Post PID-tuning

    9:36:28 AM
    M307 H1

    Heater 1 model: gain 214.1, time constant 115.3, dead time 2.9, max PWM 1.00, mode: PID
    Computed PID parameters for setpoint change: P33.2, I0.288, D67.3
    Computed PID parameters for load change: P33.2, I4.002, D67.3

    Ran M500 after M307 report and no config-override.g created. Not sure if that's a bug or I should have run M500 immediately. Ahhh ... it seems to have appeared now, potentially a UI update delay.

    So now I have a config-override-g containing;

    ; This is a system-generated file - do not edit
    ; Heater model parameters
    M307 H0 A90.0 C700.0 D10.0 S1.00 B1
    M307 H1 A214.1 C115.3 D2.9 S1.00 B0
    M307 H2 A340.0 C140.0 D5.5 S1.00 B0
    M307 H3 A340.0 C140.0 D5.5 S1.00 B0
    M307 H4 A340.0 C140.0 D5.5 S1.00 B0
    M307 H5 A340.0 C140.0 D5.5 S1.00 B0
    M307 H6 A340.0 C140.0 D5.5 S1.00 B0
    M307 H7 A340.0 C140.0 D5.5 S1.00 B0
    ; Z probe parameters
    G31 T1 P500 X-60.0 Y0.0 Z1.23
    G31 T3 P500 X0.0 Y0.0 Z0.70
    G31 T4 P500 X0.0 Y0.0 Z0.00

    Interesting that probe overrides are here too, so need to remember the config.g entry will be ignored now. Not sure why that's gone in there. Implies there's another tuning mechanism to let me tweak that and save to the override too.

    For me the bed seems to work fine, so I won't tune that.

    My 'problem' that set me on this trail of tuning was that the last degree or two ramped up extremely slowly, delaying the start of the print. Pre 1.19 that didn't happen as the temp could be within 2.5 degrees I think to start the print, but in 1.19 was tweaked to be within a single degree. Thus this final slow ramp was a bit painful. This was leading me to pre-heat the hotend 2 degrees warmer.

    I can see already that I'm now in a worse position that I was in before. My method was clearly flawed. I had decided to center the hotend on the bed prior to tuning, lower to 1mm, and I heated the bed to 75. Clearly this has helped the system to heat the hotend and resulted in flawed settings.

    So now it's taking this long to get to 214 after a command to go to 215.

    upload_2017-8-21_10-0-19.png

    Of course, I'm now running this without the gale blowing (should heat quciker?) and without the hotend next to a hot bed (should heat slower).

    So really I want two types of PID approach I guess. I want a PID approach for setting the temp when the nozzle is parked with zero gale, and a PID approach for mid-print temp changes. A realise I could set the PID params mid print, but that's going to be a faff I suspect.

    OK. So, new approach. I'll park the head, turn the fan off, and PID tune frmo there. With zero gale blowing.

    While it cools, as an aside, I have to say that temperature stability on the Duet has been amazing compared to the RUMBA. This is particularly noticeable when programming a temperature drop. For example, I tend to print the first layer quite hot to get good adhesion, then move to a print temp. I've still got some E3D Everyday Black PLA (fast running out unfortunately), and it has a wonderful characteristic of going from shiny to mat at around 197C. So, on the Rumba, if I switched from a temp of 215 to 197, I risked a heater fault or extrusion disablement as the temp would overshoot massively to hit as low as 170. The workaround was simply to go down in steps over several layers, not too much of a faff in S3D. Either Marlin was poor or the RUMBA was poor at this element of control. Not so with the Duet. You change the temperature and it lowers to the new target, never going below by more than 0.1 of a degree if at all. This results in less faff with S3D.

    OK. So after parking, cooling, and re-running, I now have this:

    10:50:26 AM
    M307 H1

    Heater 1 model: gain 256.8, time constant 140.0, dead time 3.4, max PWM 1.00, mode: PID
    Computed PID parameters for setpoint change: P28.8, I0.206, D68.1
    Computed PID parameters for load change: P28.8, I2.945, D68.1

    Let's M500 that, reboot and reheat. This time I noticed the location of the refresh button in the settings page (different than where it is for GCODE files - minor inconsistency) and the file is update straight away. New value in the override file.

    M307 H1 A256.8 C140.0 D3.4 S1.00 B0

    Still not really quite what I hoped for

    upload_2017-8-21_11-0-22.png

    It's a such a long climb for those final two degrees.

    I neglected to mention I'm using a sock too.

    I think, in the end, I really like the way the heat is well controlled. I've got a simple workaround to getting to a faster initial launch, just by requesting a couple more degrees before I launch my print.
     
  2. dc42

    dc42 Well-Known Member

    Joined:
    Aug 16, 2016
    Messages:
    171
    Likes Received:
    70
    You can adjust the A parameter in the M307 command generated by tuning to correct any initial undershoot or overshoot. Reduce it if there is undershoot, and increase it if there is overshoot.
     
  3. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,095
    Likes Received:
    322
    @dc42 thanks. I wasn't sure how much to alter the numbers. I started by reducing the number by 50. That certainly worked, but overshot massively. After a bunch of tweaking, I ended up with only a change of 0.8 downward. This is enough to overcome the really slow final couple of degrees, but doesn't overshoot too much (only 0.4) before setting to a stable temp. Brilliant.
     

Share This Page