This model can estimate future temperature of brew water based on current and past temperature measurements in various points in the system as well as on amount of water being pumped through the system.
There are four temperature measurements being made:
- ambient temperature
- water reservoir temperature (the thermometer touches the reservouir), though I am pretty sure this one could be estimated from past operation of the boiler.
- boiler temperature (the thermometer glued to the outside of the boiler at a selected point below water line)
- group head temperature (the thermometer glued to the outside of the group head at selected point). This one could also potentially be estimated from past operation but I tried it and it complicates my model too much.
In particular the model is designed to be able to calculate a single parameter, what is going to be the water temperature if used for brewing coffee, at a point in future, if heating element keeps adding given amount of energy and pump pumps given amount of water.
The way the model is being used depends on what the machine is waiting for. For example, when you want to brew coffee, it delays start of brewing until it can achieve stable temperature.
To achieve this as fast as possible (ie power on from cold to stable temperature) the machine is heating water at maximum power and the model is being executed 50 times a second to estimate what will be maximum temperature attained by brew water if we shut the power now. The idea here is we want to run the heater at max power for as long as possible and shut it off at exact moment so that the heat that spreads will cause the brew water to achieve the exact desired temperature.
Mind that brew water temperature is not measured directly. I can only measure it experimentally with a modified portafilter.
The parameters of the system are being observed and I use other filters to correct the parameters as system changes. For example, the system can detect amount of boiler scale developing rather precisely, mainly due to how it affects impedance between water in the boiler and the temperature sensor.
---
Now, I am pretty sure it is overkill for an espresso machine. I am doing this to teach myself some control theory. But the effects are real and the algorithm works like magic -- the machine starts and achieves optimal temperature in shortest possible time and then keeps it stable with no over or undershoots that could affect the brew.
In todays world the chips that can run this model are being sold for pennies and the only real complication is rather precise, noise free temperature measurement that you need for this plus measurement of amount of water being pumped.