First of all, I don't know how to properly name the problem I am having and maybe is a naive question. I will illustrate it with an example, sorry about that.

I want to optimize the air condition system of a home. The air condition system has two bottoms to set the minimum and the maximum temperature, so we can set the system to be between a rage of say 18-28ºC.

What I mean by optimizing the system, is that I want to find out the best values to set the air condition so the temperature in the living room is always set to 21ºC.

To do so, I have a lot of data about inside temperature, outside temperature, how many people is in the living room (as it would be more difficult to keep the temperature cool in summer), how many time the frontal door is open...

As I am using temperatures and the air condition system does not change the temperature automatically, I have thought that time series modeling could be a good idea to solved this problem. I was thinking of considering all the variables like the outside temperature, the people in the living room and the time the frontal door is open as exogeneous series.

Can I predict at what temperature should I set the minimum and maximum of the air conditioning? If so, how could I do that? I am having troubles to see if that makes sense as I am trying to set the temperature in the living room to 21ºC by just setting the air condition system, and there's no way I can predict the temperature that there will be, or is there a way?

To me, what makes more sense is given a pair of minimum and maximum temperature try to predict the temperature that will be in the living room. The disadvantage of this approach is that I would need to compute the predictions for all the combinations of minimum and maximum temperatures of the air condition. Does this makes more sense?


2 Answers 2


I think the way to think about the air-conditioner is that it can be heating or cooling the room. The controls are indicative, but not really helpful for your system. Does it have adjustable power?

An important problem is that the room is never at 21 degrees, and some places can be too hot and some too cold.

I don't think problem is best approached as a time-series model, but rather with theory from "control systems" or "feedback control systems", https://en.wikipedia.org/wiki/Control_system.

Using your data, you may be able to start estimating

  • how much heat people will add to your room
  • how much heat is leaked to the outside
  • how much heat the air conditioner absorbs or adds to the room

This will determine the fraction of time or the power with which your airconditioner should be blowing to warm up or cool down the room.

If you are using a very direct sensor and loop it may be simpler than that and you don't really need a model, just a good feedback loop. Because a system will theoretically find a balance if you use the simple rule to start heating when it's too cold and start cooling when it's too warm. The problem there is that there is a delay between the warming up and sensing the warming up, because the air around the air-conditioner will be warm if it's heating. And the other way around. But that effect may not be too big.

  • $\begingroup$ Should I modify the system in order to do that? What I want is to create a model so I can optimize the system I already have, not changing it. Is it possible with this approach? $\endgroup$
    – Marisa
    Commented Jan 25, 2019 at 10:18
  • $\begingroup$ How could I estimate how much heat people will add to my room and so on? Exploratory analysis? $\endgroup$
    – Marisa
    Commented Jan 25, 2019 at 10:19

It seems that this problem is based on trying to design a system that makes adjustments to temperature based on certain inputs - this is more the issue rather than trying to predict the temperature per se.

In this regard, a good way of modelling such a problem would be a state-space model that adjusts to changes in the environment instantaneously. A Kalman Filter is one such example.

Consider the following scenario:

The outside air temperature during a given time interval ranges between 15 to 20 degrees Celsius. Let's assume it's a warm climate for this time of year.

time    celsius
25/01/2019 09:00    15
25/01/2019 09:30    15
25/01/2019 10:00    15
25/01/2019 10:30    15
25/01/2019 11:00    15
25/01/2019 11:30    15
25/01/2019 12:00    15
25/01/2019 12:30    16
25/01/2019 13:00    17
25/01/2019 13:30    18
25/01/2019 14:00    19
25/01/2019 14:30    20
25/01/2019 15:00    20
25/01/2019 15:30    20

Additionally, also assume for the moment that one person is in the room the whole time - keeping the temperature from body heat constant. The temperature in the room is 21°C at 09:00. However, if the temperature rises by 2°C or greater, then the temperature of the room will also start to increase. In this regard, the cold air system needs to be triggered in order to bring the temperature back to 21°C.

Let's model this problem using the KFAS library in R:

model <- SSModel(outsidetemp ~ SSMtrend(1, Q = 0.01), H = 0.01)
out <- KFS(model)
ts.plot(ts(outsidetemp[1:14]), out$a[1:14], out$att[1:14], out$alpha[1:14], col = 1:4)

From the table, we see that as temperature increases, so does a (one-step ahead predictions of states), att (filtered estimates of states), alpha (smoothed estimates of states).

kalman filter table

Here is a graphical illustration:

outside air temperature

Using alpha as the benchmark, we can see that at step 9, the outside air temperature has increased to 17°C while alpha reads 17.04012. As a result, the cold air system is triggered, which would presumably be colder than 21°C so as to bring the room temperature back to 21°C once again. If the Kalman Filter is detecting that the outside air temperature continues to increase, then the cold air system will be left on to keep the room at the desired temperature.

As an example, the temperature of a passenger aircraft mid-flight is quite warm, roughly 25°C or so. However, the reason it can feel quite cold (apart from the fact that passengers are typically sitting still), is that air colder than 25°C must be pumped into the cabin in order to compensate for the vast amount of body heat being given off by passengers. A similar scenario would be at play in this instance.

I have simply used outside air temperature as an example of how a system could be created using the Kalman Filter. Of course, one would need to account for numerous factors, such as number of people in the room, other heating sources, etc. However, the main objective here seems to be designing a system that can react to changes in temperature, rather than trying to predict the temperature per se.

  • $\begingroup$ Hi Michael, thanks for your explanation and approach. It is interesting, however I can't see how could I predict in this example to which temperature should I set my air conditioning in order to keep the living room to 21ºC. Could you point it out for me? Thanks! $\endgroup$
    – Marisa
    Commented Jan 28, 2019 at 10:03
  • $\begingroup$ I was working off the assumption that the air conditioner would adjust automatically, e.g. let's say it's 10°C outside, then the air conditioner would need to be at a higher temperature to keep the room at 21°C. However, if it was 30°C outside, then the air from the air conditioner would have to be much cooler. So, both temperature and timing must be taken into account, since if the air coming from the conditioner was 21°C, then it would take longer to get the room itself to this temperature than if the conditioner was set to 15°C in hot weather. $\endgroup$ Commented Jan 29, 2019 at 10:15
  • $\begingroup$ Following on from this, you will probably need timing data to figure this out. e.g. the temperature outside is 25°C. We desire a room temperature of 21°C. Scenario 1 = air conditioner set to 21°C. Scenario 2 = air conditioner set to 15°C. How long would it take for the room temperature to drop to 21°C under both scenarios? $\endgroup$ Commented Jan 29, 2019 at 10:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.