Optimise heating turn on times

Hi Chaps, Happy New Year to you all.

More of a math thing, I would like to implement into my home heating automation flows really.

My heating comes on at a time determined by the times set in a ‘Big Timer’ node (usually an hour before we get up for the day) However if the temperature is lower it takes longer for the heating to warm the house to the set levels. I would like to vary the turn on time of the heating to match the current temperatures of the house. Could anyone suggest a script or method to achieve this in maybe a function node. So basically the colder it is (measured by one of my room sensors) the earlier the heating will come on (initiated by a Sonoff relay via MQTT). I'm pretty good on the hardware side of things but the software part does not come easily I'm afraid.

Thanks.

A simple approch would be using the range-node for scaling the temperatur to a preheating time.

[{"id":"e029089a247cd7f6","type":"range","z":"afa28cf7e65fe890","minin":"5","maxin":"15","minout":"120","maxout":"30","action":"clamp","round":true,"property":"payload","name":"temperatur -> preheat time","x":460,"y":1300,"wires":[["6934b46b0ac49088"]]},{"id":"404d04c648d2d5d6","type":"inject","z":"afa28cf7e65fe890","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":150,"y":1200,"wires":[["e029089a247cd7f6"]]},{"id":"08610b58a7aaa7ff","type":"inject","z":"afa28cf7e65fe890","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"15","payloadType":"num","x":150,"y":1360,"wires":[["e029089a247cd7f6"]]},{"id":"6934b46b0ac49088","type":"debug","z":"afa28cf7e65fe890","name":"debug 520","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":1300,"wires":[]},{"id":"f69cccad482dc0ac","type":"inject","z":"afa28cf7e65fe890","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"30","payloadType":"num","x":150,"y":1400,"wires":[["e029089a247cd7f6"]]},{"id":"912025a4f18abc22","type":"inject","z":"afa28cf7e65fe890","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"5","payloadType":"num","x":150,"y":1240,"wires":[["e029089a247cd7f6"]]},{"id":"0fa17bf54ce4649e","type":"inject","z":"afa28cf7e65fe890","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"10","payloadType":"num","x":150,"y":1320,"wires":[["e029089a247cd7f6"]]},{"id":"ed050f9f4e4f0397","type":"inject","z":"afa28cf7e65fe890","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"7","payloadType":"num","x":150,"y":1280,"wires":[["e029089a247cd7f6"]]}]

The result can be stored in the flow-context for later.
If you need a non-linear function, you can build one with an excel sheet?

I use something similar, but with the outside temperatur to determine the needed preheating time.
But i don't use much math for it. I just save some data, plot it with the outside temperatur and then guess the values xD

This can be very successful but of course, depends a lot on your location and style of house.

For example, our house is on a hill exposed to Northerly winds and so heating requirements also depend on wind direction and speed.

I'd start with something simple as suggested, see how that goes. It is always possible to add complexity but hard to remove it. :slight_smile:

A simple flow like this might work, as long as Bigtimer lets you trigger a scheduled action at an earlier time, and your system can take happily accept multiple "ON" commands without an "OFF" in between.
I have guessed that the current indoors temperature might be available as a context variable.

Obviously choose your own inject times and threshold temperature levels.

1 Like

Thanks for those suggestions chaps. Given me some ideas to tinker with.

Do you control the temperature with node red?

Yes. From a dashboard I can set a temperature, and read a temperature measured by a sonoff device. Then I just compare the two and output a true or false to another sonoff relay device controlling my boiler. That's a little simplistic as I have several measuring devices, timers, delays, averaging and over ride too.

Its a bit clunky but it works. And I've had a lot of help from you guy's with this.

In that case, rather than changing the time at which the boiler starts up, you could ramp up the setpoint temperature to the final temperature at the time at which you want it warm. Ramp it up at the rate that the system achieves, and start the ramp and the boiler at an appropriate early time. Then the boiler will come on at whatever time is required to reach the final temperature at the right time.

When that is working you could refine it by varying the ramp rate dependant on the outside temperature and wind speed. The ramp should be slower when it is cold and windy as the rate the system can achieve will be less. The node node-red-contrib-ramp-thermostat (node) - Node-RED will do the ramp and thermostat for you if you want to use it.

have a look at heating my Gym room

you can load different profiles into cronplus depending on the outside temperature

OK thanks for that @juntiedt. Of course there are other ways to solve it and like you I would prefer cronplus over bigtimer.

I just illustrated a very simplistic approach that the OP might follow without changing their existing schedules.

1 Like

Thanks for that useful info chaps. I'll have a look and see how it goes.

this could also help to solve your problem
heating-curve

First of all I must stress this is a very simplistic theorectical solution and takes no account of external factors like style of house, prevalling wind etc. that @TotallyInformation mentioned.
It also makes the assumption the time to heat-up the house follows a straight-line graph.

Fig-1 is a rough sketch of the problem


The above figure shows the time to heat up the house is related to the difference between the actual temperature and the target temperature and that A, B,C, D and E are right angle triangles.

Fig-2 is an example showing how long it takes to warm the house from 16 to 20 deg C.


This information would be obtained by performing a series of experiments with house and bolier.
To keep the maths simple I've used figures that work out to nice integers.

Fig-3 is a bit of trigonometry to show alpha (tangent) is Perpendicular / Base


So for this particular house alpha is a constant of 0.1

Fig-4 is the equation to calculate the heating_time


To check the equation, let's assume the actual temperature is 12 deg C and the target temperature is 20 deg C. So heating_time is (20 - 12) / 0.1 i.e. 8/0.1 = 80 mins (double what is shown in Fig-2)

So we now know what the heating_time is. What is needed is to find out if the boiler needs to be turned-on so the house is "warm" for the time when the person "gets up".

Fig-5 illustrates the problem to be solved (where all the facts are known).


'tt' represents the 'target_time' or the time the person gets up.
'tn' is the 'time_now'
'ht' is the 'heating_time' obtained from the above calculations.

Here's a bit of pseudo code to operate the boiler.

if (ht >= (tt - tn)) {
    // turn-on boiler
}

else {
    // turn-off boiler 
}

I might pose this question to my students and see what they suggestions they come up with.

1 Like

I think I prefer my suggestion of using a profile ramp to control the setpoint, so the heating will automatically come on when the profile setpoint passes the current temperature. Using a profile it does not need to be a straight line.

With bonus points for students who ask "where in the house are you measuring the temperature"? :slight_smile: And is there a difference between the time to heat a 2nd floor room than a 1st/ground? And what about different exposure and sun levels for different sides of the house.

Of course, not many home systems will take all that into account.

An alternative method would be to take extended experimental readings of temperature and heating and put them into an analytical model (possibly a machine learning model). Some commercial heating systems such as my Drayton Wiser system claim to be able to do this - though in the Wiser case, I've never seen much evidence that it actually works.

But in truth, Colins method along with some good old "feelings" experimentation is enough.

One extra thing I'll mention though is that raw temperature alone does NOT make for a "comfortable" house. Comfort is a whole load of additional complexity. Because of that, any system you come up with needs to have an extra "comfort" control both up and down. (Comfort is measured with temperature, humidity, drafts, temperature gradients in a room and human activity and health levels).

1 Like

Interesting posts chaps. Thanks.