Method for controlling heating in buildings
 The invention relates to a method for controlling the heating of a building, in which method the apparatus controlling the heating of the building is regulated in a desired manner.
 Of all energy used in Finland annually, 16% is taken up by the heating of residential buildings. In spite of the significant consumption of heating energy used in residential buildings, very little attention has been paid to their heating control systems during the past few decades. Therefore, a large portion of residential buildings are still being overheated. The lack of regulation methods lead to unnecessarily increasing energy consumption and poorer living conditions.
 Essential reasons for the fact that too little attention is paid to the heating control systems have been cost factors and the level of technology. Already since the 1970s, heating has been regulated in detached houses on the basis of temperature measured from the centre of a room. When people moved into blocks of flats, heating regulation based on the inside temperature had to be abandoned, because the available technologies did not permit the measuring of temperatures in every flat of the building. More inexpensive, but poorer in precision and energy efficiency were developed as replacements and became the standard in the field.
 The advances in technology during the past few years have enabled the design of cost-efficient heating control systems. The latest advances are systems that utilize the inside temperature measured from flats in the heating of blocks of flats. In addition, the improved computation capacity of computers permits the solving of complex calculation models and optimisation tasks in real time as part of the heating regulation process.
 Today, the most known and used way of regulating the heating of a building is table regulation. In table regulation, the power into the heating system is regulated only by the external temperature prevailing at the time. The idea of the regulation is that the heating power required by the building is determined fully on the basis of the external temperature of that moment.
 Table regulation is inexpensive to implement and most often produces passable inside temperature conditions, but it has several problems. Table regulation consumes significantly more energy than more advanced regulation methods, because it cannot take into consideration the actual inside
temperatures and, therefore, the actual heating requirement of the building. In addition to the external temperature, inside temperatures are substantially also influenced by people, electrical appliances, the sun and other thermal loads inside the building. Table regulation does not take into account the effect of these thermal loads, which then leads to too warm or cold flats on occasion. So that each flat would be warm enough, it is often necessary to control the heating in table-regulated buildings according to the coldest flat, which means the other flats are overheated and energy is consumed more than in an optimal situation.
 In heating regulation based on pressure difference compensation, which is more advanced than table regulation, the regulator measures the pressure difference on the supply and return sides of the heating circulation and tries to optimise the heating power supplied to the building with it. Pressure difference compensation is in principle able to detect and utilize external thermal loads affecting flats, which provides energy savings in comparison to table regulation.
 A weakness in pressure difference compensation is that it requires well operating radiator thermostat valves. The effect of inside temperature and external thermal loads on heating regulation is most often based only on the operation of the radiator thermostat valves. In practice, the thermostat valves perform insufficiently in older buildings, which means that the benefits from pressure difference compensation are poorer. Insufficient information on actual inside temperatures makes the optimisation of energy consumption more difficult, and the risk of making living conditions poorer increases. In addition, to function, pressure difference compensation requires a constant-speed pump, which is now becoming obsolete. A considerably more commonly used type of backwater pump is a constant-pressure pump, which keeps the pressure difference of water circulation constant and, thus, prevents the implementation of regulation based on pressure difference compensation.
 The heat accumulation capability of the shell of a building makes it possible to have an even more advanced heating regulation. Some known methods utilize this property when performing regulation based on thermodynamic models of the building and on weather forecasts. In systems of this type, the user inputs in the regulator external parameters affecting the thermodynamics of the building and the regulator utilizes weather forecasts when calculating control values for heating power. Generally, the aim is to
maintain as even inside temperatures as possible in such a manner that the thermodynamic shell of the building has time to react to future changes in the weather conditions.
 An advantage of these systems is that they do not rely directly on any individual building technology component, such as the operation of radiator thermostat valves. Taking into consideration the heat accumulation capability of the shell of a building brings energy savings without lowering the temperature in the rooms.
 However, systems of this type do not typically measure inside temperatures or use them actively in heating regulation. Therefore, ensuring good living conditions in addition to energy savings is difficult, since there is no reliable continuous measuring information on the flats. In some systems, the temperature in the flats is measured in some or all of the flats, but it is not utilized in the active real-time regulating process.
 Another essential weakness in this type of system relates to the thermodynamic models used by the regulator. The models are typically based on external parameters related to the thermodynamics of the building and input by the user. External parameters of this type include the size of the building, typical weather conditions on the site of the building and the surrounding shading factors. Models of this type are static and poorly adapting by nature. If the surroundings or the properties of the building change, the accuracy of the model decreases and the precision of control suffers, which leads to non-optimal energy consumption and living conditions.
 It is an object of the invention to provide a method that allows the drawbacks of the prior art to be eliminated. This has been achieved by a method of the invention. The invention has provided an automatic heating control method that takes into consideration the inside temperature of a block of flats as well as the thermodynamic behaviour of the building in its real-time regulation. The heating regulation method according to the invention minimizes the consumed heating energy and, at the same time, still ensures the desired inside temperatures in all flats in the building. The method of the invention is characterised in that it comprises the following steps of:
 measuring automatically and continuously at least the inside temperatures in different parts of the building,
 generating, on the basis of the measuring data, a thermodynamic model of the building that shows, among other things, the energy con-
sumption of the building and the behaviour of the inside temperature in different load and external temperature conditions,
 updating automatically the thermodynamic model of the building on the basis of the latest measuring data in real time, and
 generating a control value, by means of the updated thermodynamic model, as a mathematic optimisation task and regulating the apparatus controlling the heating in the building on the basis of the control value.
 Unlike the known methods, the method according to the invention uses as an essential part in active heating regulation the actual measured inside temperature of all flats and, at the same time, utilizes automatically learned and updated thermodynamic models of the building in real-time regulation.
 The method of the invention is based on two essential issues that may be defined as follows:
- The utilization of actual measured temperature in active real-time heating regulation.
- The automatic learning and the real-time adaptation of a thermodynamic model of a building to changing parameters of the building or surroundings and their utilization in real-time heating regulation.
 Above all, the invention provides the advantage that an ideal heating regulation provides in the flats an even inside temperature of a desired level with the smallest possible energy consumption. Without knowing the inside temperature, it is impossible to regulate heating in a building so as to maintain an even inside temperature. On the other hand, without known the thermodynamic behaviour of the building, it is impossible to regulate heating in the most energy-efficient way.
 With the method of the invention, it is possible to eliminate two essential problems of known solutions, the first one being that the inside temperatures and the temperature imbalance between flats are not sufficiently known. The second problem with the prior art is that the thermodynamic properties of a building are not utilized in an optimal manner.
 In the method of the invention, the inside temperatures are measured in all flats automatically and continuously. The measured data is used in real-time heating regulation in such a manner that the inside temperature always remains as required. This improves the comfort of living and the
accuracy of control. A more accurate control also means less overheating and, therefore, energy savings.
 In the method of the invention, real-time measuring information is collected of the building and, from it, the system learns automatically, the thermodynamic behaviour of the building. It is possible to calculate at each time the optimal control values for heating on the basis of the thermodynamic model. The thermodynamic model of the building is updated automatically as new measuring information becomes available, every hour, for example. This way, all factors affecting the inside temperature are automatically taken into consideration in regulation, and if changes occur in them, the regulation will compensate for them automatically. Contrary to known methods, the method of the invention does not need human input on the parameters of the building or microclimate in learning the model.
 In the following, the invention will be described in more detail by means of an example in the figure of the attached drawing that is a diagram of the method of the invention.
 The figure of the drawing shows the components and diagram of automatic heating regulation according to the invention. A basic requirement is that the building should have a system, with which the temperatures in the flats can be continuously measured and with which the heating of the building can be controlled. Other measuring data, such as humidity and air pressure data, can also be collected from the flats in addition to the temperature data. The operation of the system does not require a sensor in every room, but the accuracy and optimal values of regulation improve significantly the more flats have measuring sensors. Heating control can be implemented, for instance, by adjusting the valve position of the supply water in the heating circulation and, through it, by setting the water temperature going in to the heating circulation. The collection of measuring data or control of heating is not limited to the technical solutions described above, but technical implementations of other type are also possible.
 In item 1 of the figure of the drawing, the above-mentioned measuring data is collected to a cloud-based server, for instance. The collection of measuring data is automatic, real-time and continuous. The server has a measuring database, to which all collected history data is stored.
 In item 2 of the figure of the drawing, a thermodynamic model is generated for the building for the purpose of heating regulation. The ther-
modynamic model shows the energy consumption of the building and the behaviour of the inside temperature in different load and external temperature conditions. Software run on the server learns automatically the thermodynamic behaviour of the building. The server maintains and updates automatically the thermodynamic model of the building at certain intervals, every hour, for example. If, over time, changes occur in the thermodynamic properties of the building, the building-specific thermodynamic model adapts automatically to the changed conditions. With the procedure of the invention, heating regulation always has an up-to-date and accurate mathematical model available on the behaviour of the building in different conditions.
 A significant difference to the prior-art solutions is that, to generate the model, a user need not provide the system with external parameters describing the building, but the thermodynamic model is learned automatically directly from the collected measuring data.
 In item 3 of the figure of the drawing, the system fetches from a third party a weather forecast for the next days for heating regulation. The weather forecast may contain regional temperature, humidity, cloud cover, wind, or solar radiation intensity data, for instance. However, the fetched data is not limited to these, but other type of weather information may also be utilized. The weather forecast data and other actual weather data may be used in teaching the thermodynamic model of the building and to predict future behaviour. The system also learns automatically the effect of any regional weather phenomena on the building. In addition to or instead of weather information, the system may also utilize in its regulation other type of information from a third party, such as the varying energy price.
 For instance, in item 4 of the figure of the drawing, a heating regulator (item 5 in the figure) residing on a cloud server fetches via the Internet from the building real-time actual data on temperatures, humidity, heating energy consumption and supply water temperature of the flats. It is possible to utilize any technical measuring data collected from the building in regulation, and the data is not limited to the above-mentioned measuring data.
 In item 5 of the figure of the drawing, the heating regulator combines the data collected from the building and weather forecast (items 1 to 4 in the figure) and generates an optimal control value for heating regulation (item 6 in the figure). The heating regulator may use the above-mentioned weather forecasts, thermodynamic models of the building and other measuring
data collected from the building in the calculations. However, the data to be utilized in regulation is not limited to these. The method of the invention is characterised in that the calculation of the control value is done as a mathematical optimisation task, in which the energy consumption and/or energy costs of the building are minimized for the coming days.
 It is possible to use various constraints in optimisation to take into account the comfort of living, for instance, by maintaining during regulation the inside temperature within a range predefined by the user. Optimisation may be done in such a manner, for example, that the inside temperature is allowed to vary at most +/- 0.5 degrees from the normal level set for the building, or that the surface temperatures of water radiators are required to be at least at a certain level at predefined times of the day. Other constraints used in regulation may be taking into consideration any empty flats, flats with differing temperatures, or the temperature preferences of the resident, for instance. The comfort of living can also be evaluated in the regulation method by indexes generally used in the field, such as PMV (Predicted Mean Vote), PDD (Predicted Percentage of Dissatisfied) or aPMV (Adaptive PMV).
 For new buildings, in which a system utilizing the method of the invention has only recently been installed, it is not possible to form an accurate thermodynamic model right from the start on the basis of collected measuring data, because only a few days' worth of measuring data has been accumulated at that time. For situations like this, the method of the invention also continuously forms a non-building-specific general average thermodynamic model for buildings. The general model shows an indicative average behaviour of the building, in which case heating regulation according to the invention can be performed starting from the installation of the system. The system updates the building-specific model automatically to be more detailed as more measuring data is collected on the building. General thermodynamic models can also be formed by categories for buildings of different type or age. For instance, there may be specific general models for terraced houses or blocks of flats.
 In item 6 of the figure in the drawing, the method of the invention transmits via Internet a calculated optimal heating setting to the apparatus controlling the heating of the building. The apparatus controlling the heating of the building makes sure that the optimal setting calculated in the cloud service is updated to the valve setting of the supply water in heating circula-
tion, for instance. New reference values for heating regulation are calculated by the heating regulator 5 in real time, at 5 minute intervals, for instance.
 The invention has been described above with reference to the example shown in the figure. However, the invention is in no way restricted to the example of the figure but may be freely modified within the scope of the claims.