Initial Spike when cooling (0.4.3)

Hi,
I have about a 0.8C spike at the start of every fermentation, after which the algorithm converges and everything works fine. Wondering what settings I need to tweak to get a better response at the start of the ferment, as it’s probably the most important part for ester formation.

Settings:

{
  "kind": "Control",
  "pids": [
    {
      "kind": "Pid",
      "name": "heater1",
      "enabled": true,
      "setPoint": {
        "kind": "SetPointSimple",
        "name": "fridgeset",
        "value": -6.2383
      },
      "inputSensor": {
        "kind": "TempSensorFallback",
        "onBackupSensor": false,
        "sensor": {
          "kind": "TempSensor",
          "name": "fridge",
          "sensor": {
            "kind": "OneWireTempSensor",
            "value": 13.875,
            "connected": true,
            "address": "280FD4730600008A",
            "calibrationOffset": 0
          }
        }
      },
      "inputError": 20.0547,
      "Kp": 10,
      "Ti": 600,
      "Td": 0,
      "p": -200.5469,
      "i": 0,
      "d": 0,
      "actuatorIsNegative": false,
      "outputActuator": {
        "kind": "ActuatorPwm",
        "value": 0,
        "period": 4,
        "minVal": 0,
        "maxVal": 100,
        "target": {
          "kind": "ActuatorMutexDriver",
          "mutexGroup": {
            "kind": "ActuatorMutexGroup",
            "deadTime": 1800000,
            "waitTime": 0
          },
          "target": {
            "kind": "ActuatorPin",
            "state": false,
            "pin": 10,
            "invert": false
          }
        }
      }
    },
    {
      "kind": "Pid",
      "name": "heater2",
      "enabled": true,
      "setPoint": {
        "kind": "SetPointSimple",
        "name": "beer2set",
        "value": null
      },
      "inputSensor": {
        "kind": "TempSensor",
        "name": "beer2",
        "sensor": {
          "kind": "OneWireTempSensor",
          "value": 17.5,
          "connected": true,
          "address": "2814A273060000D8",
          "calibrationOffset": 0
        }
      },
      "inputError": null,
      "Kp": 10,
      "Ti": 600,
      "Td": 0,
      "p": 0,
      "i": 0,
      "d": 0,
      "actuatorIsNegative": false,
      "outputActuator": {
        "kind": "ActuatorPwm",
        "value": 0,
        "period": 4,
        "minVal": 0,
        "maxVal": 100,
        "target": {
          "kind": "ActuatorMutexDriver",
          "mutexGroup": {
            "kind": "ActuatorMutexGroup",
            "deadTime": 1800000,
            "waitTime": 0
          },
          "target": {
            "kind": "ActuatorNop",
            "state": false
          }
        }
      }
    },
    {
      "kind": "Pid",
      "name": "cooler",
      "enabled": true,
      "setPoint": {
        "kind": "SetPointSimple",
        "name": "fridgeset",
        "value": -6.2383
      },
      "inputSensor": {
        "kind": "TempSensorFallback",
        "onBackupSensor": false,
        "sensor": {
          "kind": "TempSensor",
          "name": "fridge",
          "sensor": {
            "kind": "OneWireTempSensor",
            "value": 13.875,
            "connected": true,
            "address": "280FD4730600008A",
            "calibrationOffset": 0
          }
        }
      },
      "inputError": 20.0547,
      "Kp": 10,
      "Ti": 3600,
      "Td": 0,
      "p": -200.5469,
      "i": 0,
      "d": 0,
      "actuatorIsNegative": true,
      "outputActuator": {
        "kind": "ActuatorPwm",
        "value": 100,
        "period": 1200,
        "minVal": 0,
        "maxVal": 100,
        "target": {
          "kind": "ActuatorMutexDriver",
          "mutexGroup": {
            "kind": "ActuatorMutexGroup",
            "deadTime": 1800000,
            "waitTime": 0
          },
          "target": {
            "kind": "ActuatorTimeLimited",
            "minOnTime": 300,
            "minOffTime": 900,
            "maxOnTime": 65535,
            "state": false,
            "target": {
              "kind": "ActuatorPin",
              "state": false,
              "pin": 11,
              "invert": false
            }
          }
        }
      }
    },
    {
      "kind": "Pid",
      "name": "beer2fridge",
      "enabled": true,
      "setPoint": {
        "kind": "SetPointSimple",
        "name": "beer1set",
        "value": 3.7617
      },
      "inputSensor": {
        "kind": "TempSensor",
        "name": "beer1",
        "sensor": {
          "kind": "OneWireTempSensor",
          "value": 11.8125,
          "connected": true,
          "address": "28389573060000C6",
          "calibrationOffset": 0
        }
      },
      "inputError": 7.9961,
      "Kp": 10,
      "Ti": 7200,
      "Td": 1200,
      "p": -79.9609,
      "i": 0,
      "d": -0.0391,
      "actuatorIsNegative": false,
      "outputActuator": {
        "kind": "ActuatorSetPoint",
        "targetSetPoint": {
          "kind": "SetPointSimple",
          "name": "fridgeset",
          "value": -6.2383
        },
        "targetSensor": {
          "kind": "TempSensor",
          "name": "fridge",
          "sensor": {
            "kind": "OneWireTempSensor",
            "value": 13.875,
            "connected": true,
            "address": "280FD4730600008A",
            "calibrationOffset": 0
          }
        },
        "referenceSetPoint": {
          "kind": "SetPointSimple",
          "name": "beer1set",
          "value": 3.7617
        },
        "output": -10,
        "achieved": 10.1133,
        "minimum": -10,
        "maximum": 10
      }
    }
  ]
}

Can you zoom in on the first part of the graph?

Sure! I started with the overview for context.

Here’s another batch (last one was 40L, whereas this is 20L), with a less aggressive ramp, but similar behaviour.

Some things that will help:

  • Increase beer-to-fridge Td, so you have more lookahead based on the derivative
  • Reduce the maximum difference between beer and fridge setpoint
  • Update to 0.4.4, there are some changes related to integrator anti-windup that will help.
  • Increase the filtering in the beer-to-fridge PID for a much smoother fridge setting.

Cool, I’ll update, tweak those values and see how I get on with the next brew. It’ll be about 3 weeks before I can see the effect.

Just an update. Still using 0.4.3, as I wanted to test each change in isolation, but applied all the settings tweaks you suggested, brought the difference down to 0.1-0.2C. Looking good!

1 Like

Just to follow up on this. I’ve updated to 0.4.4, but there’s still a bit of a wobble over the first 48 hours until the temperature settles. A picture paints a 1000 words as usual:

Any ideas?

Current Settings that were changed from default:
Beer-to-fridge (Td): 2400
Beer/fridge max difference: 5
beer-to-fridge input filter delay time: 39 seconds

Recommended changes:

  • Increase beer-to-fridge filtering to get a much smoother fridge setting. Set the derivative filtering to max.
  • Increase beer-to-fridge Kp from 5 to 10 (so it clips and you don’t get integrator windup)
  • Increase beer-to-fridge Ti (your integrator winds up to quickly, you need a larger time constant).