I'm building an insulated box in which I have about 5-6 liters of water which will be cooled/warmed by a Peltiers, driven by variable current. The setpoint will vary between 16 and 26 degrees C, and it will change gradually during a 24 hours cycle. The disturbance of the system is the outside temperature, in which the box will be placed. It is a room temperature, which change very slowly, mostly seasonally (almost no day/night change) between 19 and 29 degrees.
So as you can see, when the outside temperature is in between the inside temperature borders the Peltiers will need to switch directions from cooling to heating or opposite.
Another point that should be mentioned is that the Peltiers are more efficient (at cooling) when driven with lower current. Which means that when cooling it is not efficient to get to the setpoint fast and then stay there keeping the temperature. Also overshooting is not efficient too.
So my question is: what algorithm should I use in order to control the temperature in most energy efficient way?
Is it appropriate to change the setpoint in some short intervals, let say 5-10 minutes and use PID?
Or to measure somehow the speed of temperature change at the given power, then predicting if it enough to meet the setpoint at the needed time and correcting it if not.
Edit: Here is a step response of the system:
The sensor that measure the inside temp is located very close to the water ouflow from the Peltiers heatsink. The value jumps for some unknown reason that I have to investigate. The red line is the ambient temperature. First step is done on a stable system by switching on the lights over the box (it is illuminated and the lamps heat it for some extent) plus lowering the peltier current from 2.248A to 1.284A. Second step is increasing the current from 1.284A to 1.776A with lights still turned on. For the third step I didn't have time to wait for stabilization, it consists of further increasing the current from 1.776 to 2.259A and turning off the lighs. The horizontal axis lines are on every hour. From this picture it cannot be seen, but the deadtime is really small, it is hard to measured it, because in the moment I'm regulating the current by turning a potentiometer, so it takes some time and the step is not really rectangular, but I can say it is under 30 seconds. The measurements are taken every second, this is the minimum time that the sensor allows. So for me it looks like a first order system, bit I still don't have idea how it will be best to control it. There are 2 problems. First one is - the regulator has a gap between 0 and 0.5A, in which I cannot control the peltier. The only thing I can controll is the speed of its cooling fan, which will change the temperature on the hot side, thus on the cold side. But I haven't experimented with this. Second problem is the heating part. Cooling is proportional to the current, but heating will be proportional to the current + to the square of the current, which to me seems that will complicate a lot switching between cooling and heating. And this switching should be done gradually, passing through zero.