Increase room temperature as fast as possible, but without overheating

I have a room which is about 25m². There is one heating in this room.

My Arduino can turn the heating on and off, by opening the valve with a motor. It can also read the current room temperature.

I want the Arduino to be able to increase the room temperature to a given value e.g. 25°C. This should on the one hand happen as fast as possible.

My first thought:

void loop() {
  if (currentTemperature < targetTemperature)
    heating.openValve();
  else
    heating.closeValve();
}

The problem with that code is that once the temperature is reached and the valve is closed, the radiator of the heating is still extremely hot causing the room temperature to increase even further.

Do you have any tips how this could be done properly? It doesn't need to be perfect and I would prefer not to spend hours on benchmarking my heating.

You need to look at PID control loops and take into account the stored heat in the radiator .
It’s not an easy control loop to get to work and the best solution is to also vary the water temperature in the radiators if you want anything like optimal control .

Another issue with on/off type control the actual temperature you get in the room depends on the outside temperature , which is effectively the load ( on a cold day the rate of rise of temp in the room is slow so it doesn’t overshoot as much as on a warm day when the rate of rise is fast ). For this reason people tend to up the temperature of their room stat on cold or windy days !! ( as the average room temp is lower).

As you say , the difficulty is caused by stored heat in the radiator and some sort of model ( as in some of the new smart thermostats) might help

Do you have proportional control of the valve or just open or closed?

felic:
I want the Arduino to be able to increase the room temperature to a given value e.g. 25°C. This should on the one hand happen as fast as possible.

The problem with that code is that once the temperature is reached and the valve is closed, the radiator of the heating is still extremely hot causing the room temperature to increase even further.

I wonder if the complexity of PID has much to offer in this case. The problem is that there is no cooling system to counteract excessive heat - and a cooling system would just waste energy anyway.

I reckon you need to do some tests to figure out how much the temperature rises after the heating valve is closed and then build into your program the decision to turn the valve off at T - R where T is the desired temperature and R is the number of degrees that the temperature will continue to rise after the valve is closed.

Of course the value of R may vary widely depending on the outside temperature and whether the room door is regularly opened and closed by people coming in and out on one day and not on another day.

It might help to have a small array with several (maybe 4 or 8 would be enough) values of R and if the Arduino discovered that the temperature did not rise to the desired value quickly enough (or if it rises too high) it could switch to using a different R value for the next few hours.

...R

The problem is that you have two distinct conditions.
PID is great to MAINTAIN the temperature, but start-up or such a huge system upset requires a whole different set of parameters for PID.
in this case, PID is not the way to go.

what you have is a thermal mass of predictable value.
you have the ability to add an equal thermal value to that.

what you have already expressed is that you need 100x BTU to heat the space, you add 100x, the space is heated, but you still have 20x that has already been put into the space.

overshoot is ineveitable.

PID would offer that you add some, watch the reaction and then add more...

but thermal is not a process that uses PID. cannot get more simple than that
there is no place in heating that D adds to good control because the process is so slow. I is not all that important.
and the real question is WHERE you measure your process.

at the far side of the room and you will always overshoot. it is inevitable. because there is no way to know how much heat has been applied and is already in the space, before the sensor can detect it. and once the sensor has detected a rise, then the process has already overshot.
if you put the sensor at the heating element, you have no control of the room.

because heat is both convection, radiation and conduction, all at the same time, your space sensor is not going to allow exacting control.

this becomes less and less apparent as you get closer to setpoint, but on start or a huge process change, it is worthless.

can you define 'overheating' ?

in order to heat the space, you have to add a temperature that is higher than the current value.

if you want to get the space to 25C, and it is at 24C, you can either add 25C over a long time, or add 30C for a short time.

also, you did not define all of the thermal masses. you can change the AIR temperature quickly by high exhange rates. you exchange all the air in the space in one minute with 25C air and the space will be at 25C.
if you add 1/20 of the volume at 25C, theoretically, it would take 20 units of time to exchange all the air.
in reality, the surfaces in the room will also have heat so the conduction of heat from the surfaces to the air will have to be accounted for.

what this is leading to is that you have a minimum of two separate processes. heating the air and heating the things in the air.
and you have two separate states of control. fast change of temperature and continual maintaining of temperature.

consider you did a full air change in short order, open the garage door, and the wind blows out all the air. shut the door and you have air at one temperature and the masses in the space at another. you only need to heat the air.

or, you shut off the heat for the weekend and on Monday, come in and turn the heat on. you heat the air quickly, but the masses in the space have a thermal exchange that will take place over a long period of time.
your first condition is met, fast heating of the AIR.
your second process condition is now to maintain that temperature over time as the thermal masses continue a heat exchange process that is totally independent of your space heating.

to heat the air, you have to introduce a massivly large heat to the space
then allow the two different thermal masses to equalize.
then add a smaller over-temperature mass to the space, and allow the two, closer thermal masses to equalize.....

no matter what you do, you have to add a heat to the space far above the setpoint, so defining overheating is vital to the solution of the problem.

if you were to think of your process as a long tunnel. at one end is your heater. fire wood at 300 degrees ? at the other is your minimum temperature, 15 degrees ? the tunnel is 100 meters long. the temperature gradient is relatively linear along the distance. WHERE do you place your sensor ?

The easiest: do some tests, monitoring the temperature of the room. Get the heaters on full blast, then check the temperature, switch off the heaters, and see how much the room continues to heat up. If you switch off the heaters at say 20°C, and it heats up to say 22.3°C, then to get to 25°C you should switch off the heater when you reach 22.7°C. The expected 2.3°C extra heating should get you very close to your desired temperature.

After that you get to the much different problem of keeping the temperature at that level, or at least as close as possible to it. The inherent delay in your heating system is one of the difficulties there: it takes a while between switching on the heater and the hot water reaching your radiators, just as it takes time for the heating to stop after switching it off. That's where PID would come in play.

The location of your sensor is of course critical, as different parts of the room may heat at different rates (fans can help here - both to distribute the heat, and to blow air over your hot radiators enhancing the heating effect - making your room heat up faster as well).

Better yet, since you don't want to spend time testing, write something that lets the arduino figure it out itself. Have an array of structs that it populates with initial temperatures, time it ran the heater, stop temperature and final temperature. Let it adjust those gradually until it's built its own model of what it takes to heat your space and keep it warm.

wildbill:
Better yet, since you don't want to spend time testing, write something that lets the arduino figure it out itself. Have an array of structs that it populates with initial temperatures, time it ran the heater, stop temperature and final temperature. Let it adjust those gradually until it's built its own model of what it takes to heat your space and keep it warm.

+1
you should be able to see a rise.
at, say, 5 deg prior to your final, shut off the heat
watch for the overshoot, ideally it will be 2-3 degrees.
if you have two conditions,
fast heat = 25%
slow heat = 5%
if your starting temp is more than 10 degrees delta, then shut off with when you are within 25% of that delta T
eg:
start at 12, goal is 25 = Delta T = 13 and 20% of 13 = 2.6
once at 22.4 degrees, shut off, data log the overshoot over 22.4

it may be just that simple.
get close, then let your 'maintain temperature' control take over.

wildbill:
Better yet, since you don't want to spend time testing, write something that lets the arduino figure it out itself.

That's probably only practical if the Arduino can be allowed to run continuously for several days, maybe for several weeks.

And it would be wise to save data to EEPROM memory or an SD Card so it is not lost if the Arduino crashes or the power fails.

Personally, I think I would like to start with some tests so I had some info with which to judge the behaviour of a more complex program. And I think it would need to be a complex program if it was to do better than a simple look-up system.

...R

I wonder how the OP plans to handle the situation where the Arduino opens the heat valve and the the Arduino goes TU, leaving the valve open?

Paul

Paul_KD7HB:
I wonder how the OP plans to handle the situation where the Arduino opens the heat valve and the the Arduino goes TU, leaving the valve open?

Interesting.

It could make things uncomfortable, but probably not life-threatening.

...R

Paul_KD7HB:
I wonder how the OP plans to handle the situation where the Arduino opens the heat valve and the the Arduino goes TU, leaving the valve open?

Probably just like with a normal thermostat: not.

felic:
The problem with that code is that once the temperature is reached and the valve is closed, the radiator of the heating is still extremely hot causing the room temperature to increase even further.

Do you have any tips how this could be done properly? It doesn't need to be perfect and I would prefer not to spend hours on benchmarking my heating.

This is basically like you driving a car or bike. You understand the behaviour of a car or bike. So if you need to change the car or bike to a new direction 90 degrees, you need to know in advance when to ease-off on the steering. That is, you normally don't make the steering angle go back to zero all of a sudden. You normally begin to ease the steering back to zero before you get to the 90 degrees heading direction.

For a room, that is able to store heat, and for a heater that is able to heat the room - you need information about the behaviour of this system. Like... how quickly this room gets cold (or cools down) when heat is not applied...... what rate of cooling? And what rate does the temperature increase when you apply heater power.

I agree with others that...... without some cooling system (to go with the heating system), it can be tricky to get the room temperature to behave in the way you want. The only thing you can do right now is to get some idea of how your room temperature behaves for some average outside temperature. And then you can do some tests to find out how long to apply heater power for....and when to cut the heater power. And then just hope that the room eventually reaches some kind of final temperature without 'overshooting' the mark too much.

The thing is... if conditions change, such as the outside temperature changes a lot, or people fill the room a lot etc, then your system changes. And things change depending on when you start applying heater power....and how much heater power....and for how long.

Your problem will probably not be easy to address unless you have cooling power as well.

wildbill:
Do you have proportional control of the valve or just open or closed?

The OP has not answered that. Assuming that it is on/off control, that the heating water is always at the same temperature, and that there is a big initial temperature difference between the actual and desired room temperatures I think the Arduino should be able to turn the radiator on, 'plot' the rate of change of room temperature and switch off so that the target is hit with acceptable accuracy.

Once the room is at the target temperature it is not going to be desirable to have the valve continuously opening and closing though, so there is going to have to some acceptable temperature band around the target temperature.

Knowing the outside temperature would help to tune things. However I think knowing the humidity of the air would also be an important factor. Damp air is going to take a lot more energy/time to heat than dry air.

ardly:
I think the Arduino should be able to turn the radiator on, 'plot' the rate of change of room temperature and switch off so that the target is hit with acceptable accuracy.

That's a very interesting idea. However I wonder if it would only be practical when there is a large difference between the actual and the desired temperature.

But that, in turn, raises a question that we have not yet asked the OP. Is his desire for fast and accurate heating only required for the initial rise in temperature from cold to normal?

Because the concept of fast seems unlikely to be relevant once the room has reached the desired temperature. Which makes me wonder how much trouble it is worth taking with the fine control of the temperature for a single event - perhaps just once or twice per day?

...R

Which makes me wonder how much trouble it is worth taking with the fine control of the temperature for a single event - perhaps just once or twice per day?

I think I see what you mean. The OPs requirement to reach temperature as fast as possible is not compatible with the requirement not to overshoot. So why not just open the valve, get to the target temperature then close the valve. Yes you will overshoot but you will know by how many degrees and how long it took to get there. That information can then be used to keep the temperature within a band of the target for the rest of the day.