Optimizing Brewpiless for (uncommon) glycol setup

Hi all,
I have just set up my insulated conical with cooling jacked with a esp8266 (nodemcu) running Brewpiless. My system have a closed glycol loop which can either be cooled by a compressor or heated by a heat rod, i.e this is not a traditional glycol setup with a separate big glycol tank. The glycol system volume is only 4 liters.The system looks like this:

I use one temp sensor for beer, and have three relays controlling the cooler (compressor), heater (heat rod) and pump. I first tried to define a “fan” output for the pump but had issues. After the controller had been running for a while the “fan” output did not longer turn on, even when heater or cooler was running. I then modified the relay board hardware (by adding an extra diod and two leads) so the relay for the pump is turned on as an “or”-function of the heat and cool relay.

The hardware works great but now to the problem.

The algorithm does not really handle my setup as configured at the moment. The problem is that when for example the heater has heated to the set beer temperature there if an overshoot which turns on the cooler. Not optimal in my eyes. I do not really know where to start, since there is many parameters to change. I have started with the default settings:

“tempSetMin”: 1.0
“tempSetMax”: 30.0
“pidMax”: 10.000
“Kp”: 5.000
“Ki”: 0.250
“iMaxErr”: 0.500
“idleRangeH”: 1.000
“heatTargetH”: 0.299

I will post some plots to show how it behaves, and hope that some of you might have some hints how to start adjust the parameters.


Here is one example how the cooler and heater both goes on during the control cycle