Tuning question


#1

Hopefully an easy on.
I have a brewpi photon running 0.52 firmware.
I have the 200W space heater as my heating element and a chest freezer as my cooling.
I currently have 5 gallons of water in a glass carboy at the bottom of the freezer and 5 gallons of water in a SSBrewtech bucket on a platform above the compressor in the freezer.
The fridge temp probe is about 2/3’s the way up and in the middle of the freezer.
The beer temp probe is in a thermowell in the SSBrewtech bucket.
I also have another probe in the carboy (beer2).
I’m currently ramping from 50F to 70F over 24 hours, but I have done this a few times trying to get a feel for the photon setup after a year with the arduino setup.

When I’m heating the beer temp (the main probe) doesn’t reach the setpoint until the setpoint has reached 70F.

Here is the control algorithm.
{
“kind”: “Control”,
“pids”: [
{
“kind”: “Pid”,
“name”: “heater1pid”,
“enabled”: true,
“input”: {
“kind”: “SensorSetPointPair”,
“sensor”: {
“kind”: “TempSensorFallback”,
“onBackupSensor”: false,
“sensor”: {
“kind”: “TempSensorDelegate”,
“name”: “fridge”,
“delegate”: {
“kind”: “OneWireTempSensor”,
“value”: 17.625,
“connected”: true,
“address”: “28FF3A2582160309”,
“calibrationOffset”: 0
}
}
},
“setPoint”: {
“kind”: “SetPointSimple”,
“name”: “fridgeset”,
“value”: 17.7578
}
},
“output”: {
“kind”: “ActuatorPwm”,
“dutySetting”: 8.0977,
“period”: 240,
“minVal”: 0,
“maxVal”: 100,
“target”: {
“kind”: “ActuatorMutexDriver”,
“mutexGroup”: {
“kind”: “ActuatorMutexGroup”,
“deadTime”: 1200000,
“waitTime”: 1013652
},
“target”: {
“kind”: “ActuatorDigitalDelegate”,
“name”: “heater1”,
“delegate”: {
“kind”: “ActuatorPin”,
“state”: false,
“pin”: 11,
“invert”: false
}
}
}
},
“inputError”: -0.1133,
“Kp”: 10,
“Ti”: 300,
“Td”: 60,
“p”: 1.1328,
“i”: 7.2383,
“d”: -0.2734,
“actuatorIsNegative”: false
},
{
“kind”: “Pid”,
“name”: “heater2pid”,
“enabled”: true,
“input”: {
“kind”: “SensorSetPointPair”,
“sensor”: {
“kind”: “TempSensorDelegate”,
“name”: “beer2”,
“delegate”: {
“kind”: “TempSensorDisconnected”,
“value”: null,
“connected”: false
}
},
“setPoint”: {
“kind”: “SetPointSimple”,
“name”: “beer2set”,
“value”: null
}
},
“output”: {
“kind”: “ActuatorPwm”,
“dutySetting”: 0,
“period”: 4,
“minVal”: 0,
“maxVal”: 100,
“target”: {
“kind”: “ActuatorMutexDriver”,
“mutexGroup”: {
“kind”: “ActuatorMutexGroup”,
“deadTime”: 1200000,
“waitTime”: 1013649
},
“target”: {
“kind”: “ActuatorDigitalDelegate”,
“name”: “heater2”,
“delegate”: {
“kind”: “ActuatorNop”,
“state”: false
}
}
}
},
“inputError”: null,
“Kp”: 10,
“Ti”: 600,
“Td”: 60,
“p”: 0,
“i”: 0,
“d”: 0,
“actuatorIsNegative”: false
},
{
“kind”: “Pid”,
“name”: “coolerpid”,
“enabled”: true,
“input”: {
“kind”: “SensorSetPointPair”,
“sensor”: {
“kind”: “TempSensorFallback”,
“onBackupSensor”: false,
“sensor”: {
“kind”: “TempSensorDelegate”,
“name”: “fridge”,
“delegate”: {
“kind”: “OneWireTempSensor”,
“value”: 17.625,
“connected”: true,
“address”: “28FF3A2582160309”,
“calibrationOffset”: 0
}
}
},
“setPoint”: {
“kind”: “SetPointSimple”,
“name”: “fridgeset”,
“value”: 17.7578
}
},
“output”: {
“kind”: “ActuatorPwm”,
“dutySetting”: 1.3711,
“period”: 600,
“minVal”: 0,
“maxVal”: 100,
“target”: {
“kind”: “ActuatorMutexDriver”,
“mutexGroup”: {
“kind”: “ActuatorMutexGroup”,
“deadTime”: 1200000,
“waitTime”: 1013646
},
“target”: {
“kind”: “ActuatorTimeLimited”,
“minOnTime”: 180,
“minOffTime”: 1200,
“maxOnTime”: 65535,
“state”: false,
“target”: {
“kind”: “ActuatorDigitalDelegate”,
“name”: “cooler”,
“delegate”: {
“kind”: “ActuatorPin”,
“state”: false,
“pin”: 10,
“invert”: false
}
}
}
}
},
“inputError”: -0.1133,
“Kp”: 10,
“Ti”: 1800,
“Td”: 200,
“p”: 1.1328,
“i”: -1.6055,
“d”: -0.8984,
“actuatorIsNegative”: true
},
{
“kind”: “Pid”,
“name”: “beer2fridgepid”,
“enabled”: true,
“input”: {
“kind”: “SensorSetPointPair”,
“sensor”: {
“kind”: “TempSensorDelegate”,
“name”: “beer1”,
“delegate”: {
“kind”: “OneWireTempSensor”,
“value”: 11.125,
“connected”: true,
“address”: “28FF5C25251703CC”,
“calibrationOffset”: 0
}
},
“setPoint”: {
“kind”: “SetPointSimple”,
“name”: “beer1set”,
“value”: 12.2031
}
},
“output”: {
“kind”: “ActuatorOffset”,
“target”: {
“kind”: “SensorSetPointPair”,
“sensor”: {
“kind”: “TempSensorFallback”,
“onBackupSensor”: false,
“sensor”: {
“kind”: “TempSensorDelegate”,
“name”: “fridge”,
“delegate”: {
“kind”: “OneWireTempSensor”,
“value”: 17.625,
“connected”: true,
“address”: “28FF3A2582160309”,
“calibrationOffset”: 0
}
}
},
“setPoint”: {
“kind”: “SetPointSimple”,
“name”: “fridgeset”,
“value”: 17.7578
}
},
“reference”: {
“kind”: “SensorSetPointPair”,
“sensor”: {
“kind”: “TempSensorDelegate”,
“name”: “beer1”,
“delegate”: {
“kind”: “OneWireTempSensor”,
“value”: 11.125,
“connected”: true,
“address”: “28FF5C25251703CC”,
“calibrationOffset”: 0
}
},
“setPoint”: {
“kind”: “SetPointSimple”,
“name”: “beer1set”,
“value”: 12.2031
}
},
“useReferenceValue”: false,
“setting”: 5.5547,
“achieved”: 5.4219,
“minimum”: -5.5547,
“maximum”: 5.5547
},
“inputError”: -1.0938,
“Kp”: 11,
“Ti”: 7200,
“Td”: 1800,
“p”: 12.0313,
“i”: 0,
“d”: 1.0742,
“actuatorIsNegative”: false
}
]
}

So my main question is, should I be adjusting the beer-to-fridge PID or the Heater1 PID to help bring the beer temp to the setpoint?

Or do I just chill out, relax, and have a homebrew :slight_smile: ?


#2

As a reference, here is the previous ramp from 50F to 70F.


#3

The fridge setpoint is limited at 10 degrees Celsius above the beer setpoint by default. It looks like that limits how fast you can ramp. You can change this maximum difference in advanced settings.


#4

face palm
Thanks for the quick reply and pointing out the obvious thing that I should have seen.


#5

So the rise went mostly well, but the beer temp (and the beer2 but that is not the control temp) did overshoot the target by a bit and has taken a while to start to come back to the setpoint. Is this beer-to-fridge or cooler PID that needs adjusting. I’m not entirely sure how the three PID’s interact.
Same control parameters as earlier (expect the max temp difference).


#6

This is probably caused by integrator windup.
The integrator will not increase when:

  • The fridge temp cannot reach the setpoint
  • The setpoint is clipped to the maximum.

Because the integrator is required to track the ramp, I’m not sure there are a many options here. The PID doesn’t look ahead. Once the straight part is reached, the fridge setpoint quickly decreases.

I think you can improve this by increasing Kp, so the proportional part is bigger. This will require less action from the integral part.


#7

Would that be the Kp of the beer-to-fridge or of the cooler? Or should I just experiment?


#8

Beer-to-fridge. It seems that your fridge temperature is tracking just fine.

You could increase the filtering on the beer temp a bit to get a smoother fridge setpoint. But this also causes some delay for the PID input.


#9

One more question…
The beer temperature tracking is looking really good (thank you for the product and for your help). My question is if the beer setting (and therefor the heat/cool cycles) could be smoother. I see that while ramping down I am occasionally getting some heat cycles.
beer-to-fridge settings:
Kp: 15
Ti: 7200
Td: 2700
difference: 25
input delay: 318
derivative delay:318


#10

Do you mean the fridge setting?
I think it is mostly your high Td that is causing the fast fluctuations in fridge setpoint.