Energy Management in Buildings with Intermittent and Limited Renewable Resources

Filipe Barata 1,* and José Igreja 2,3 1 Instituto Politécnico de Lisboa (IPL), Instituto Superior de Engenharia de Lisboa (ISEL), Electrical, Energy and Automation Department (ADEEEA), Rua Conselheiro Emídio Navarro 1, 1959-007 Lisboa, Portugal 2 Instituto Politécnico de Lisboa (IPL), Instituto Superior de Engenharia de Lisboa (ISEL), Mechanical Engineering Department (ADEM), Rua Conselheiro Emídio Navarro 1, 1959-007 Lisboa, Portugal; jmigreja@dem.isel.ipl.pt 3 Instituto de Engenharia de Sistemas e Computadores-Investigação e Desenvolvimento (INESC-ID), Rua Alves Redol 9, 1000-029 Lisboa, Portugal * Correspondence: fbarata@deea.isel.ipl.pt; Tel.: +351-969-061-813


Introduction
Data from the literature [1] shows that 39% of the United States' primary energy is consumed by buildings, with space heating and cooling being responsible for 54% of the site energy consumption in the residential sector, and 37% in the commercial sector during 2017.In Europe, air conditioning equipment systems are also the main energy consumer in buildings, consisting of 70% of the final energy use [2,3].Considering these data, the importance of reducing the energy used in all types of building in order to improve their efficiency and sustainability is clear.This theme is nowadays a hot topic for financial, social, and environmental impacts all over the world.Demand response (DR) mechanisms [4,5], are nowadays seen as a reliable option when they are applied to buildings, and they have been able to significantly reduce the energy consumption.DR is nowadays mostly used to encourage customers to manage their daily loads wisely, by considering the electricity price.But even so, DR strategies must be improved in the following two aspects: they need to consider different load types and also need to deal with the distributed renewable resource aspects.In order to provide a response to the novel challenges that DR requires, industries are developing new communication technologies in order to ensure the necessary requirements allowing for effective residential appliance scheduling programs [6,7].These DR mechanisms, along with demand-side management (DSM) approaches, aim to be a solution in order to support buildings in upcoming smart grids (SG) [8,9], preparing them to work efficiently in an unpredictable environment, where the electrical energy will mainly be provided by intermittent renewable sources [10].Nowadays, the production of electricity system follows the load.However, the renewable sources of electricity are essentially intermittent, and it is vital that they provide flexibility to the grid so as to absorb the variations from these sources.With SGs, the production is able to control the energy consumption; so, when the sun and wind are available, a building's consumption needs must be readjusted.In this way, consumers will no longer be mere spectators and will have an active role in the electricity grid system [11].Distinct approaches are being studied in order to deal with the poor controllability, intermittence, unpredictability and flexibility of renewable green sources, in order to achieve a DSM solution for balancing supply-demand.Additionally, the novel solutions that incorporate the occupants' behavior inside the buildings, taking into account their energy consumption habits, are evolving.[12].It has been noted that this is a complex problem, because DSM strategies must consider the control issues of different appliances, such as heating ventilation and air conditioning (HVAC) systems, washing machines, refrigerators, lighting, or even electric vehicle charging.
The study presented in this paper applies to the SG technological environment [13,14], and is intended to provide a response to the renewable resources' variability, assuming that home appliances will be fully manageable and controllable.These different DSM methods [15] will provide solutions to manage loads in order to achieve a supply-demand balance, such as load control techniques [16,17], which may also involve price signals with distinct tariff prices throughout the day to promote the load shifting [18], as well as other methods that encourage energy conservation, sustainability, and efficiency [19].Consequently, an original control solution with DSM is proposed based on model-based predictive control (MPC) techniques.In comparison with the other traditional HVAC control solutions used in the residential sector, MPC is capable of saving between 16-41% energy [20].Therefore, the MPC's characteristics make it appropriate for load management and optimization processes regarding set-point temperature control [21,22], and [23] for a complete review on MPCs in HVAC control systems.
The MPC control techniques can be applied to problems with a distributed nature [24][25][26][27].Distributed model predictive control (DMPC) algorithms support distributed sensing and control using local controllers.These controllers can be understood as cooperative agents that decide their actions by considering the information exchanged between them [28].This is the reason it was the chosen methodology used to tackle the distributed problem presented in this paper.As mentioned, DMPC is appropriate for work in distributed scenarios, and consequently, in multi agent system (MAS) structures, where distinct agents using MPC control strategies are able to interact between them, exchanging information about their state, being impacted by the influences from each other, and using that data to solve/optimize their local control problems [29,30].In the literature, an agent is defined as an autonomous, pro-active, and social entity, which drives its actions and decisions in order to accomplish is objective, cooperating/competing by considering the external influences created by its pairs [31].The SG idea was built around this concept; an infrastructure where different identities cooperate so as to acquire a collective perception.The developed system presented in this paper considers the existence of autonomous agents, which are entities defined as thermal control areas (TCAs).The entities are within a distributed framework, where the TCAs cooperate in a coordinated way by exchanging information in order to achieve a global goal [32][33][34].The TCAs' demand units share green resources between themselves, and each minimizes its energy costs according to a given cost function.In this paper, global coordination is achieved using a sequential access order, which is established by a proposed green energy auction mechanism.The global objective is to maximize green energy consumption.
The work presented here is distinct and has the advantage of providing a solution that integrates a set of features and concepts that are already present in smart grid technologies, such as intelligent control, distributed generation, energy efficiency, energy saving, DSM, intermittent energy resources, smart loads management, thermal comfort, real-time price negotiation, and energy auction markets mechanisms.These characteristics deliver a unique structure, where different subsystems with different roles can be intelligently combined, aiming for a more efficient, secure, and sustainable energy system.Therefore, this work intends to provide an innovative DMPC solution that is able to efficiently manage networks, adapting consumption to the smart grid using intermittent renewable energy sources.
In particular, it provides new developments in DSM using renewable energy sources, and uses a backup of fossil energy, using an hourly auction access mechanism that allows for managing loads in order to balance the demand and supply.Equally, the proposed DSM energy usage optimization scheme allows the consumer to choose a trade-off between comfort or energy savings, in an hourly manner.The energy forecast inclusion (renewable and fossil fuel) enables the system to decide how and when to split the energy among the users, while at the same time satisfying all of the power and comfort constraints.It has been noticed that this innovative distributed optimization scheme is also suitable for use in scenarios where energy sources, renewable or fossil, are scarce, and energy must be rationed or carefully spent.For instance, in remote areas or on cruise ships where the rooms must be acclimatized and the fuel resources are limited.The organization of this paper is as follows: Section 2 describes the proposed approach, the global concept scenario, and the dynamical formulation.Section 3 designates the DMPC formulation and implemented algorithm.Section 4 illustrates the methodology used with simulation results.In Section 5, the key conclusions are drawn and future objectives are suggested.

Distributed Scenario Set-Up
The conceptual scenario involves a set of buildings with electrical power provided by a renewable energy grid with a local energy storage capability.Henceforward, the term "house" will be applied so as to classify any type of construction for housing, offices, services, or other kinds of analogous buildings.
The set W = {w 1 , w 2 , . . ., w N S } identifies the group of houses in consideration, and the different spaces or rooms in each house are specified by N S sets, given by D i = {d i1 , d i2 , . . ., d iNd i }, where i = 1, . . ., N S , and Nd i is the number of rooms for house i.
Because of the room diversity that can exist in each house, each area may vary in its construction materials, sun exposure, occupancy, and indoor temperature set-points.This variety implies that considerably different energy is needed to weatherize different spaces as well as different fixed consumption profiles.
In this paper, a TCA is an autonomous thermal control entity in an environment where several may coexist in different spaces belonging to houses, seen as an agent in a distributed scenario, where the actions and reactions are treated as a unit on a global distributed environment set, defined by W. Therefore, depending on the infrastructure that is intended to be implemented and to manage, a set of buildings or a simple division may represent a TCA.
The main idea is using a DMPC control law to manage the indoor temperature and energy consumption in each TCA within W. And by doing so, taking advantage of the MPC predictive capabilities and constraint handling, so that each agent can receive this information from the others, as well as about outdoor temperature forecasts, future occupation, indoor temperature frame, and the thermal disturbances profile.Consequently, each agent's control action depends on its own thermal comfort specifications, and it also depends on its neighbors, the weather forecast, and shared available energy.Feasibility is achieved by using soft constraints in the optimization problem formulation; feasibility is also important for ensuring stability.This scenario considers the existence of two resources, the red, from the grid provided by the fossil source, and the green, from the renewable or clean source.The first is always available in auction with a kWh price that is always higher than the second.On the contrary, the green is limited, intermittent, and must be consumed, stored, or grid delivered, and when it becomes insufficient, the fossil fuel is consumed and increases the energy costs.
It is assumed here that the traded electricity comes from a wholesale market that is priced in real time, where the market operators (MO) provide the green resource auction.The agents set their bid prices a day-ahead, indicating how much they are willing to pay in order to consume the clean energy.The bid can be made hourly or daily, according to specific consumption needs.If the user knows in advance that they will have a determined period (a day) with a major load profile (due to household appliances, comfort needs, etc.), they will consequently bid higher so as to try to "ensure" green energy (at lower price than red energy).Then, the MO receives the TCA bid value and establishes a sequential order by which the TCA can access green energy.The access order is stored in a matrix, A O , with a (N S × N) dimension.So, each agent comprises a specific TCA, a DMPC controller, and an hourly bid mechanism that provides the DSM.The red resource consumption will have a penalty because of the soft constraint violation imposed by the maximum available green resource.Each TCA sends information on about how much of the clean resource is still available, and when the divisions thermally interact, they also pass information about future temperatures on to one another.
Therefore, in a setup that prioritizes clean energy consumption, the DSM approach allows for managing the distributed loads in order to obtain a supply-demand balance, providing indoor thermal comfort that allows for lesser costs, consequently reducing CO 2 emissions.With this active DSM control strategy, the energy supplied from the intermittent resources is maximized by the optimal control used for the various appliances.
Each TCA has several external inputs, namely, the outdoor temperature; the available renewable power forecasts; the MO kWh price, the access order to the renewable resource; and, when dynamically coupled, the neighbors' indoor temperature forecasts.It has been noticed that the indoor temperature is the only private information that is exchanged, and each agent is blind to the others' dynamics and inputs.However, this issue may not be relevant when the adjacent areas belong to the same building, but it may represent a barrier when the adjacent areas are from distinct agents.Figure 1 presents an example of the implemented TCA framework.
intermittent, and must be consumed, stored, or grid delivered, and when it becomes insufficient, the fossil fuel is consumed and increases the energy costs.
It is assumed here that the traded electricity comes from a wholesale market that is priced in real time, where the market operators (MO) provide the green resource auction.The agents set their bid prices a day-ahead, indicating how much they are willing to pay in order to consume the clean energy.The bid can be made hourly or daily, according to specific consumption needs.If the user knows in advance that they will have a determined period (a day) with a major load profile (due to household appliances, comfort needs, etc.), they will consequently bid higher so as to try to "ensure" green energy (at lower price than red energy).Then, the MO receives the TCA bid value and establishes a sequential order by which the TCA can access green energy.The access order is stored in a matrix, AO, with a ( ) dimension.So, each agent comprises a specific TCA, a DMPC controller, and an hourly bid mechanism that provides the DSM.The red resource consumption will have a penalty because of the soft constraint violation imposed by the maximum available green resource.Each TCA sends information on about how much of the clean resource is still available, and when the divisions thermally interact, they also pass information about future temperatures on to one another.
Therefore, in a setup that prioritizes clean energy consumption, the DSM approach allows for managing the distributed loads in order to obtain a supply-demand balance, providing indoor thermal comfort that allows for lesser costs, consequently reducing CO2 emissions.With this active DSM control strategy, the energy supplied from the intermittent resources is maximized by the optimal control used for the various appliances.
Each TCA has several external inputs, namely, the outdoor temperature; the available renewable power forecasts; the MO kWh price, the access order to the renewable resource; and, when dynamically coupled, the neighbors' indoor temperature forecasts.It has been noticed that the indoor temperature is the only private information that is exchanged, and each agent is blind to the others' dynamics and inputs.However, this issue may not be relevant when the adjacent areas belong to the same building, but it may represent a barrier when the adjacent areas are from distinct agents.Figure 1 presents an example of the implemented TCA framework.The example depicted in Figure 1 shows that the implemented system is dependent on weather and power forecasts.As wind and solar power are not dispatched, their production levels need to be predictable.For wind power, the 24 h ahead of the prediction averages the absolute error and can be between 10-20% of the installed capacity for one single zone.When the aggregation of zones is made, the value may drop to 5-8% [35,36].The forecast error is significantly lowered for the first six hours.The solar energy forecast has similar problems as that of the wind.Nevertheless, in order for the sun's path through the sky to be known, solar power forecasting needs a higher predictability.The example depicted in Figure 1 shows that the implemented system is dependent on weather and power forecasts.As wind and solar power are not dispatched, their production levels need to be predictable.For wind power, the 24 h ahead of the prediction averages the absolute error and can be between 10-20% of the installed capacity for one single zone.When the aggregation of zones is Energies 2018, 11, 2748 5 of 21 made, the value may drop to 5-8% [35,36].The forecast error is significantly lowered for the first six hours.The solar energy forecast has similar problems as that of the wind.Nevertheless, in order for the sun's path through the sky to be known, solar power forecasting needs a higher predictability.Also, nowadays, temperature forecasts are particularly reliable and accurate, with more than a 92% accuracy for one day ahead forecasting [37].

TCA Dynamical Models
House models can be built with more or less complexity, depending of what aim is to be accomplished.As described in the literature [38], a first order energy balance model is used to describe a basic room or division, considering only the existing dominant dynamics.Consider the dynamic model of each TCA: where, in Equation (1), Q i l losses is the heat and cooling losses (kW) from the TCA (i) division (l), T i l is the inside temperature ( • C), C i l eq is the equivalent thermal capacitance (kJ is the heat and cooling power (kW) and Q i l Pd is the thermal disturbances (kW) (e.g., the load generated by the occupants, direct sunlight, electrical devices, or doors and windows' opening, in order to recycle the indoor air).In Equations ( 2) and (3), T oa is the outdoor temperature ( • C), R i lg eq is the thermal resistance between division (l) and the adjacent zone (g), R i l eq is the parallel equivalent thermal resistance ( • C/kW), R i l th is the air thermal resistance to the bulk of division, and R ih lm eq is the thermal resistance between division (l) and the adjacent zone (m) from subsystems (i) and (h).Note that these are the basic equations for structure thermal modelling and can be explained by the several divisions and floors interacting between them.
Equation (1) can be written, for the N s TCAs and for each division (l), in the following format: thermal contributions f rom adjacent areas inside the same house thermal contributions f rom adjacent areas f rom other houses ∆t, Energies 2018, 11, 2748 where N s is number of TCA's, Nd i is the number of divisions inside the subsystem (i); T i l is the indoor temperature in TCA (i) inside the division (l); u i l is the used power to provide comfort in TCA (i) inside the division (l); A ih lm is an element from the state matrix A, which relates to the state (indoor temperature) in the division (m) from TCA (h), with the state from division (l) in TCA (i); v i l is the thermal disturbance in the TCA/subsystem (i) inside the division (l); T oa is the temperature of the outside air ( • C); and P i l Pd is the thermal disturbance due to the heat produced by the occupants, sunlight, electrical appliances, or any other generic heat sources.
As mentioned, there are several degrees of complexity for house modelling techniques [39].In this work, more complex or non-linear models would unnecessarily increase the computational time, and also, if the prediction horizon is too long, the computation and the reliability of the optimizer might be a problem.Thus, the model that has been considered is linear and is suitable for control purposes, as follows: where x ∈ R n is the state variable, indoor room temperatures, vector containing all of the division temperatures ( • C) of all of the TCAs; u ∈ R m is the input vector containing all of the heating and cooling power sources (W) needed to weatherize each division; v ∈ R n includes all of the heat disturbances (W); k is an integer number that denotes discrete time; and A ∈ R n×n and B ∈ R n×m are matrices.Notice that the number of stated variables is n = ∑ Ns i=1 Nd i .Thus, as an example of a TCA scenario model, Figure 2 depicts a set of houses/TCAs with different plans and different zones that are thermally connected in a distributed environment.As previously mentioned, side-by-side rooms can be doubly coupled, both thermally and by the power constraint.
Energies 2018, x, x FOR PEER REVIEW 6 of 22 As mentioned, there are several degrees of complexity for house modelling techniques [39].In this work, more complex or non-linear models would unnecessarily increase the computational time, and also, if the prediction horizon is too long, the computation and the reliability of the optimizer might be a problem.Thus, the model that has been considered is linear and is suitable for control purposes, as follows: where x ∈ ℝ n is the state variable, indoor room temperatures, vector containing all of the division temperatures (°C) of all of the TCAs; u ∈ ℝ m is the input vector containing all of the heating and cooling power sources (W) needed to weatherize each division; v ∈ ℝ n includes all of the heat disturbances (W); k is an integer number that denotes discrete time; and A ∈ ℝ n×n and B ∈ ℝ n×m are matrices.Notice that the number of stated variables is n = ∑  .Thus, as an example of a TCA scenario model, Figure 2 depicts a set of houses/TCAs with different plans and different zones that are thermally connected in a distributed environment.As previously mentioned, side-by-side rooms can be doubly coupled, both thermally and by the power constraint.For each division, using Equation ( 4), it can be written in terms of the space-state model, as follows:  For each division, using Equation ( 4), it can be written in terms of the space-state model, as follows:

MPC Formalization
For large-scale systems, the centralized MPC is considered practically unfeasible, because of the limitations imposed by the computational efforts and by communication, and the scientific community is consensual about overcoming these drawbacks using distributed MPC optimization algorithms in multi-agent setups [25].Smart grids are characterized by complex dynamics and mutual influences between all of the involved identities, and the DMPC algorithms should be able to deal with the different types of existent coupling among the subsystems; the constraints' satisfaction must also be safeguarded in the closed-loop system, as well as the required stability and feasibility, see the literature [26] for a comprehensive survey.Stability issues will not be treated here, but feedback stability is provided by choosing a sufficiently long predictive horizon and is verified by results presented in Section 4.
The DMPC methodologies are generally characterized by the type of couplings or by the interactions assumed between the involved variables or subsystems [40][41][42].The scenario presented here represents the most complex example; the subsystems are doubly coupled, dynamically and by the power constraints.
Figure 3 depicts the sequential scheme proposed for the DMPC solution.Note that each TCA updates their data, and the available power is passed sequentially, one by one, guaranteeing the satisfaction of the green resource constraints.The MPC optimization is solved by each TCA at each time step, according to the sequential DMPC (the scheme depicted in Figure 3), which considers N W TCA. The available green power forecast is received by the agent who made the highest bid (first in the sequential access scheme) and this information is used as the power constraint value in Equation (9).The agent optimization problem predicts the consumption, subtracts it from the maximum availability that was initially received, and passes that information on to the next on the sequence in the list.In Figure 3,  represents the green resource forecasts,  is the maximum available expected green resource for TCA (i),  and  * are the indoor temperature and indoor temperature prediction,  and  * are the optimal power generated by the MPC controller and the predicted consumption, and  represents the thermal disturbances.The maximum available resource,  , is different for each TCA, and takes into account which TCAs are ahead in the access order consumed, as follows: The minimization problem is a trade-off between four terms, energy consumption to weatherize the space, the power peak and the constraints violations related to the comfort temperature frame and the limited green power.In the literature [23], the control action is typically conditioned only by the consumption and temperature.The combination of these four terms forms the cost function that is able to deal with the intermittent energy resource.The formulated optimization is a distributed linear constrained quadratic programing optimization problem, which is coupled by constraints that must be solved sequentially for each TCA at each time step.The typically distributed MPC relies on the quadratic cost functions, and in principle, a linear cost function could be used.Furthermore, a quadratic cost function provides smoother signals for the actuators, because the square functions penalize smaller errors than the linear relations, so it is expected that the quadratic cost provides smoother energy profiles with less saturation signals for the actuators.Constrained quadratic programming can be solved using, for instance, a MATLAB ® fmincon routine.Accordingly, the optimization problem in each TCA is given by Equations ( 9) and ( 16)- (19) In Figure 3, u Tgreen represents the green resource forecasts, U i is the maximum available expected green resource for TCA (i), T i l and T i l * are the indoor temperature and indoor temperature prediction, u i l and u i l * are the optimal power generated by the MPC controller and the predicted consumption, and v i l represents the thermal disturbances.The maximum available resource, U i , is different for each TCA, and takes into account which TCAs are ahead in the access order consumed, as follows: The minimization problem is a trade-off between four terms, energy consumption to weatherize the space, the power peak and the constraints violations related to the comfort temperature frame and the limited green power.In the literature [23], the control action is typically conditioned only by the consumption and temperature.The combination of these four terms forms the cost function that is able to deal with the intermittent energy resource.The formulated optimization is a distributed linear constrained quadratic programing optimization problem, which is coupled by constraints that must be solved sequentially for each TCA at each time step.The typically distributed MPC relies on the quadratic cost functions, and in principle, a linear cost function could be used.Furthermore, a quadratic cost function provides smoother signals for the actuators, because the square functions penalize smaller errors than the linear relations, so it is expected that the quadratic cost provides smoother energy profiles with less saturation signals for the actuators.Constrained quadratic programming can be solved using, for instance, a MATLAB ® fmincon routine.Accordingly, the optimization problem in each TCA is given by Equations ( 9) and ( 16)- (19), as follows: Energies 2018, 11, 2748 With the following: In compact form, Equation ( 9) results in a quadratic optimization problem, namely: With the following: and is subject to the following constraints: predicted temperatures f rom adjacent areas inside the same house predicted temperatures f rom adjacent areas f rom other houses In Equation ( 9), u i l is the power control input (the space is cooled when u i l < 0 and is heated when u i l > 0) of house (i) and room (l).Nd i represents the number of rooms inside the house (i), Ψ i represents the penalty value when the power constraint is exceeded, φ i is the penalty value for the peak power, Ξ i is the penalty value when the comfort range is overcome, and H P is the prediction horizon.In Equation ( 17), T i l and T i l are the established max-min comfort temperature boundaries and ε i l and ε i l represent the temperature violation vectors.In Equation ( 18), γ i and γ i represent the power violations, and U i , and U i (with U i = −U i ) are the maximum green available resources left to TCA (i).We have noted that in each TCA (i), the power consumed in all divisions may not exceed U i .In Equation ( 16), x i * l and u i * l represent the predicted temperature and power consumption within the prediction horizon, respectively.
The weighting coefficients in the cost function penalize the different terms between them, giving more importance to some relative to others.Also, as we are using soft constraints, the comfort and power constraints can always be exceeded, although, when the ratio between the coefficients is higher than 104, the controller ensures comfort by satisfying the temperature constraint or power constraint completely, respectively.With this structure, each TCA may vary the penalty values hourly, increasing the flexibility of all of the systems.The user is able to parameterize different time frames during the day, allowing for the choice between cost savings or comfort.

Algorithm
In this subsection, the DMPC optimization algorithm is presented.The algorithm code was written in MATLAB ® , using the optimization routine (fmincon) in order to find the optimal power sequence for each house (Equation ( 14)), subject to the constraints (Equations ( 16)-( 19)).The agents set their bid prices a day-ahead, indicating how much they are willing to pay in order to consume clean energy.Then, the MO receives the TCAs' bid value and establishes a sequential order by which the TCAs can access green energy.The access order is stored in a matrix, A O .The minimization problem is solved using the first TCA, which, after knowing how much will be consumed, sends the information about how much of clean resource is still available to the next.The minimization problem is solved for each TCA in the sequential scheme, presented in Figure 3.The algorithm's main steps are summarized in Algorithm 1.
Required for all TCAs: Thermal disturbances, comfort temperature gap, hourly constraints parameters, and hourly auction bid.
for k = 1:N do Apply to all TCA u i l (1 Communicate temperature predictions to adjacent TCAs Set sequence order at k instant to green resource based on the bid values for i = 1:N S (number of TCAs) do Verify TCA's reference in matrix A O Obtain optimal sequence u i l (1 : N) solving Equation ( 9), J i (k) Update available green resource values for next TCA in matrix A O end for Update batteries available energy end for

Results
In order to explain and prove this concept, one-day simulation results were obtained from three houses, as follows: two of them were side-by-side, and consequently, were thermally interacting (with a thermal resistance of the walls between them of R 12 = 30 • C/kW), and the third was isolated.It has been noted that the houses' controllers need to inform each other about future temperatures when their houses are thermally interconnected.In this case, consider the brown and two blues zones (notice that the blue zones interact through a wall) in Figure 2, as an example of what was simulated.Table 1 presents the TCAs' thermal characteristics and the bid value (made in a previous auction, provided by the MO) that establishes the access order.The used prediction horizon value, H P , for all of the simulations is 24 h.The performance of the controllers is measured using the closed-loop total energy consumption, as shown in Equations ( 20)-( 23), as follows: the peak power consumption is as follows: the total comfort violation is as follows: and the total power violation is as follows: The performance index summarizes the controller behavior and allows comparing distinct parameterization and quickly evaluating if the consumer preferred energy savings or comfort.
In order to simplify the sequence order, we considered TCA 1, TCA 2, and TCA 3 during the 24 h period.However, despite this simplification, which was intended for a better understanding of the proposed solution, the built system also supported differentiated hourly access orders.The outdoor ambient temperature profile (Figure 4a) was measured on 3 June 2016 from a sensor located at the authors' affiliation in Lisbon, Instituto Superior de Engenharia de Lisboa (ISEL) [43], Building F. The TCA 1 and TCA 2 load profile, presented in Figure 4b, correspond to two adjacent classrooms in building F, with computers and monitors prepared for 12 and 6 students, respectively.The classrooms are available between 08:00 to 23:00 (night classes), and the occupancy varies according the class schedules.The TCA 3 load profile corresponds to a room in the student's dormitory (building R), with three students.The loads between 11:00 and 19:00 are considered as nothing or as negligible, and between 21:00 and 01:00, the equipment heat loads are mainly related to cooking, the dishwasher, and the washing and drying of clothes.
The thermal disturbances were obtained considering the hourly contributions of the occupants, lighting, and appliance gains to the peak and latent loads, according American Society of Heating, Refrigerating and Air-Conditioning Engineers (ASHRAE) [44].
The thermal characteristics and prices for all of the agents and scenarios are presented in Table 1.
The developed system considers that each TCA is independent from the others, and that they may have different hourly penalty values favoring cost or temperature.Thus, in order to explain this concept, distinct scenarios are presented.The first, is considered a balanced scenario, with no energy storage and no explicit preference between comfort and consumption.Table 2 shows the penalty values that are used in Scenarios I and II.The red price is the fixed kWh cost from the grid, and the green price is the bid value (kWh price) that each thermal control area (TCA) is willing to pay.Despite the thermal disturbances presented in Figure 4b, it can be seen in Figure 5, that all of the indoor temperatures are predominantly inside their narrow bounds.This behavior is achieved as a result of the predictive knowledge of disturbance and by using space thermal storage.Thus, in the morning (for instance), the MPC precools the space's temperature before the thermal load begins, namely until 08:00, 11:00, and 09:00 for TCA 1, TCA 2, and TCA 3, respectively.The precooling  The red price is the fixed kWh cost from the grid, and the green price is the bid value (kWh price) that each thermal control area (TCA) is willing to pay.The red price is the fixed kWh cost from the grid, and the green price is the bid value (kWh price) that each thermal control area (TCA) is willing to pay.Despite the thermal disturbances presented in Figure 4b, it can be seen in Figure 5, that all of the indoor temperatures are predominantly inside their narrow bounds.This behavior is achieved as a result of the predictive knowledge of disturbance and by using space thermal storage.Thus, in the morning (for instance), the MPC precools the space's temperature before the thermal load begins, namely until 08:00, 11:00, and 09:00 for TCA 1, TCA 2, and TCA 3, respectively.The precooling Despite the thermal disturbances presented in Figure 4b, it can be seen in Figure 5, that all of the indoor temperatures are predominantly inside their narrow bounds.This behavior is achieved as a result of the predictive knowledge of disturbance and by using space thermal storage.Thus, Energies 2018, 11, 2748 13 of 21 in the morning (for instance), the MPC precools the space's temperature before the thermal load begins, namely until 08:00, 11:00, and 09:00 for TCA 1, TCA 2, and TCA 3, respectively.The precooling behavior also has the advantage of reducing the peak power consumption of the systems, as well as flattening the control profile.The same happens with the power consumption (Figure 6), which shows that the controllers only try to consume when the green resource is available; however, with TCA 3 being the last in the sequence, it merely receives the remaining resources, which, in several periods, does not oblige to the major consumption of the red resource.As mentioned, when the power consumption is negative, the space is cooled, and when it is positive, the space is heated.Consequently, in the left graphs of Figure 6, the green available resource for each TCA has a positive (power max) and negative (power min) boundary (U i = −U i ).In the right side of Figure 6, the consumption modulus is presented, and therefore, only the positive power boundary value is shown (power max).Also, the consumption value presented on the left side is described in terms of green and red.Note that, when the power constraint is not exceeded, only the clean resource is consumed, but when it is, the energy from the grid is used.
Energies 2018, x, x FOR PEER REVIEW 13 of 22 behavior also has the advantage of reducing the peak power consumption of the systems, as well as flattening the control profile.The same happens with the power consumption (Figure 6), which shows that the controllers only try to consume when the green resource is available; however, with TCA 3 being the last in the sequence, it merely receives the remaining resources, which, in several periods, does not oblige to the major consumption of the red resource.As mentioned, when the power consumption is negative, the space is cooled, and when it is positive, the space is heated.Consequently, in the left graphs of Figure 6, the green available resource for each TCA has a positive (power max) and negative (power min) boundary ( = − ).In the right side of Figure 6, the consumption modulus is presented, and therefore, only the positive power boundary value is shown (power max).Also, the consumption value presented on the left side is described in terms of green and red.Note that, when the power constraint is not exceeded, only the clean resource is consumed, but when it is, the energy from the grid is used.Scenario II is intended to show the benefit of having energy storage, with the only difference compared with Scenario I being the addition of a set of batteries with a 1.0 kWh of capacity.With this energy supplement provided by the batteries, compared with the previous scenario, the indoor temperature (Figure 8) had a minor deviation relative to the defined comfort gap.behavior also has the advantage of reducing the peak power consumption of the systems, as well as flattening the control profile.The same happens with the power consumption (Figure 6), which shows that the controllers only try to consume when the green resource is available; however, with TCA 3 being the last in the sequence, it merely receives the remaining resources, which, in several periods, does not oblige to the major consumption of the red resource.As mentioned, when the power consumption is negative, the space is cooled, and when it is positive, the space is heated.Consequently, in the left graphs of Figure 6, the green available resource for each TCA has a positive (power max) and negative (power min) boundary ( = − ).In the right side of Figure 6, the consumption modulus is presented, and therefore, only the positive power boundary value is shown (power max).Also, the consumption value presented on the left side is described in terms of green and red.Note that, when the power constraint is not exceeded, only the clean resource is consumed, but when it is, the energy from the grid is used.Scenario II is intended to show the benefit of having energy storage, with the only difference compared with Scenario I being the addition of a set of batteries with a 1.0 kWh of capacity.With this energy supplement provided by the batteries, compared with the previous scenario, the indoor temperature (Figure 8) had a minor deviation relative to the defined comfort gap.Scenario II is intended to show the benefit of having energy storage, with the only difference compared with Scenario I being the addition of a set of batteries with a 1.0 kWh of capacity.With this energy supplement provided by the batteries, compared with the previous scenario, the indoor temperature (Figure 8) had a minor deviation relative to the defined comfort gap.Additionally, as expected, the power constraint of all of the agents was respected (Figure 9) except for in the interval between 17-21 h in TCA 3, where a small amount of the red resource was consumed.Compared with Figure 7, Figure 10 shows that consumption was reduced.The agent that most benefited from this modification was TCA 3, the energy surplus allowed for it to consume, almost exclusively, the green resource, bought at lower bid price, and thus, it presented the lowest cost.The batteries profile is presented in Figure 11.Additionally, as expected, the power constraint of all of the agents was respected (Figure 9) except for in the interval between 17-21 h in TCA 3, where a small amount of the red resource was consumed.Additionally, as expected, the power constraint of all of the agents was respected (Figure 9) except for in the interval between 17-21 h in TCA 3, where a small amount of the red resource was consumed.Compared with Figure 7, Figure 10 shows that consumption was reduced.The agent that most benefited from this modification was TCA 3, the energy surplus allowed for it to consume, almost exclusively, the green resource, bought at lower bid price, and thus, it presented the lowest cost.The batteries profile is presented in Figure 11.Compared with Figure 7, Figure 10 shows that consumption was reduced.The agent that most benefited from this modification was TCA 3, the energy surplus allowed for it to consume, almost exclusively, the green resource, bought at lower bid price, and thus, it presented the lowest cost.The batteries profile is presented in Figure 11.Additionally, as expected, the power constraint of all of the agents was respected (Figure 9) except for in the interval between 17-21 h in TCA 3, where a small amount of the red resource was consumed.Compared with Figure 7, Figure 10 shows that consumption was reduced.The agent that most benefited from this modification was TCA 3, the energy surplus allowed for it to consume, almost exclusively, the green resource, bought at lower bid price, and thus, it presented the lowest cost.The batteries profile is presented in Figure 11.In Scenario III, the penalty value of the parameters related to consumption were increased (Table 3).Comfort is not relevant in this scenario (Figure 12), the agents are mostly concerned with reducing the consumption and complying with the power constraints.With this variation, the soft power constraint was transformed into a hard constraint, with the consumption profile continually maintained inside the bounds, meaning that no (or negligible) red resource was consumed (as shown in Figure 13).Therefore, compared with Scenario I, the consumption and energy costs, (Figure 14) were decreased in all of the agents.Because of its parameterization, TCA3 is obliged to consume only the available green resource, and for this reason, it showed a lower consumption and presented minor costs.Consequently, the TCA 3 indoor temperature was the one that was most penalized, presenting the highest deviation from the chosen temperature comfort gap.
The main focus of Scenario IV, for all of the TCAs, is the indoor temperature, as the comfort temperature range must be respected independently of the required energy consumption.Thus, the temperature penalty value was increased and the penalty value regarding consumption was decreased, as shown in Table 4.In Scenario III, the penalty value of the parameters related to consumption were increased (Table 3).Comfort is not relevant in this scenario (Figure 12), the agents are mostly concerned with reducing the consumption and complying with the power constraints.With this variation, the soft power constraint was transformed into a hard constraint, with the consumption profile continually maintained inside the bounds, meaning that no (or negligible) red resource was consumed (as shown in Figure 13).Therefore, compared with Scenario I, the consumption and energy costs, (Figure 14) were decreased in all of the agents.Because of its parameterization, TCA3 is obliged to consume only the available green resource, and for this reason, it showed a lower consumption and presented minor costs.Consequently, the TCA 3 indoor temperature was the one that was most penalized, presenting the highest deviation from the chosen temperature comfort gap.
The main focus of Scenario IV, for all of the TCAs, is the indoor temperature, as the comfort temperature range must be respected independently of the required energy consumption.Thus, the temperature penalty value was increased and the penalty value regarding consumption was decreased, as shown in Table 4.In Scenario III, the penalty value of the parameters related to consumption were increased (Table 3).Comfort is not relevant in this scenario (Figure 12), the agents are mostly concerned with reducing the consumption and complying with the power constraints.With this variation, the soft power constraint was transformed into a hard constraint, with the consumption profile continually maintained inside the bounds, meaning that no (or negligible) red resource was consumed (as shown in Figure 13).Therefore, compared with Scenario I, the consumption and energy costs, (Figure 14) were decreased in all of the agents.Because of its parameterization, TCA3 is obliged to consume only the available green resource, and for this reason, it showed a lower consumption and presented minor costs.Consequently, the TCA 3 indoor temperature was the one that was most penalized, presenting the highest deviation from the chosen temperature comfort gap.
The main focus of Scenario IV, for all of the TCAs, is the indoor temperature, as the comfort temperature range must be respected independently of the required energy consumption.Thus, the temperature penalty value was increased and the penalty value regarding consumption was decreased, as shown in Table 4.As is seen in Figure 15, for all of the agents, the indoor temperature is mainly kept inside the temperature bounds, and consequently, the power constraints (Figure 16) are exceeded and the red resource consumption and cost has increased significantly (Figure 17).As is seen in Figure 15, for all of the agents, the indoor temperature is mainly kept inside the temperature bounds, and consequently, the power constraints (Figure 16) are exceeded and the red resource consumption and cost has increased significantly (Figure 17).As is seen in Figure 15, for all of the agents, the indoor temperature is mainly kept inside the temperature bounds, and consequently, the power constraints (Figure 16) are exceeded and the red resource consumption and cost has increased significantly (Figure 17).As is seen in Figure 15, for all of the agents, the indoor temperature is mainly kept inside the temperature bounds, and consequently, the power constraints (Figure 16) are exceeded and the red resource consumption and cost has increased significantly (Figure 17).Distinct results were obtained in the proposed scenarios.Figure 18 summarizes the obtained costs for the 24 h simulation and ily heating/cooling total cost.
Table 5 shows the controller's performance index.Distinct results were obtained in the proposed scenarios.Figure 18 summarizes the obtained costs for the 24 h simulation and ily heating/cooling total cost.
Table 5 shows the controller's performance index.Distinct results were obtained in the proposed scenarios.Figure 18 summarizes the obtained costs for the 24 h simulation and ily heating/cooling total cost.
Table 5 shows the controller's performance index.Distinct results were obtained in the proposed scenarios.Figure 18 summarizes the obtained costs for the 24 h simulation and ily heating/cooling total cost.
Table 5 shows the controller's performance index.Comparing the economic differences between the scenarios, Scenario III was shown to be the most economical, with cost differences for TCA 1, TCA 2, and TCA 3 of less 2%, 13%, and 37%, respectively, when compared with Scenario I, and less 2%, 30%, and 35% when compared with Scenario IV, respectively.The parameters that penalized consumption were significantly increased, leading to a situation of less energy usage, and consequently, to a negligible power violation index, J γ .However, this decreased consumption led to a higher indoor temperature deviation from the established boundaries, resulting in a comfort violation index, J ε , of 600%, 26%, and 52%, on the higher end compared with Scenario I for TCA 1, TCA 2, and TCA 3, respectively.On the other hand, Scenario IV was the most expensive.In this scenario, the penalty value in the temperature constraint was increased, showing that the consumers were only concerned about maintaining the temperature inside the boundaries.Thus, all of the required resources were consumed with respect to the temperature gap, leading to higher costs.
In several situations, comfort may be more relevant than cost, for example, in rooms with children, or in specific spaces in labs or hospitals that need to be accurately acclimatized.Nevertheless, even by prioritizing the indoor temperature, the minimization function (in due proportion, given by the penalty values) also minimizes the other terms.The parameterizations from the first and second scenarios were shown to be the most balanced, with a compromise between comfort and cost.

Conclusions
The developed scheme provides an integrated DSM solution for thermal comfort and energy efficiency, which optimally adjusts the demand to the supply and is based on distributed MPC techniques.The developed solution uses the thermal comfort area concept to define the agents that share information and that operate in a distributed environment.Each TCA solves its parameterized optimization problem with its own predictions, as well as with the information shared by its neighbors.This was possible by using predictive control concepts and practices to develop the desired solution based on a distributed algorithm.The proposed solution contributes positively, with a methodology that allows for the design of new solutions that increase energy efficiency in the distribution networks, including the methods that involve demand-side management and prices.
The flexibility of the implemented scheme is shown compared with the different scenario results analysis.The system is able to obtain energy and cost savings (37%), and, as is also shown through the penalty index values, the user may restrict their consumption to the maximum that is available, or may choose to benefit from indoor comfort.
Taking advantage of the predictive knowledge of the disturbance and using the space thermal storage the controllers are able to precool the spaces, with the additional benefit of reduce the peak power consumption of the systems and smoother the control profiles.

Figure 1 .
Figure 1.Example of a thermal control area (TCA) conceptual framework energy management tool.

Figure 1 .
Figure 1.Example of a thermal control area (TCA) conceptual framework energy management tool.

Figure 7 .
Figure 7. Scenario I-the accumulated power and heating/cooling total cost.

Figure 7 .
Figure 7. Scenario I-the accumulated power and heating/cooling total cost.

Figure 7 .
Figure 7. Scenario I-the accumulated power and heating/cooling total cost.

Figure 10 .
Figure 10.Scenario II-the accumulated power and heating/cooling total cost.

Figure 10 .
Figure 10.Scenario II-the accumulated power and heating/cooling total cost.

Figure 10 .
Figure 10.Scenario II-the accumulated power and heating/cooling total cost.

Figure 10 .
Figure 10.Scenario II-the accumulated power and heating/cooling total cost.

Figure 14 .
Figure 14.Scenario III-the accumulated power and heating/cooling total cost.

Figure 14 .
Figure 14.Scenario III-the accumulated power and heating/cooling total cost.

3 Figure 14 .
Figure 14.Scenario III-the accumulated power and heating/cooling total cost.

Figure 14 .
Figure 14.Scenario III-the accumulated power and heating/cooling total cost.

Figure 17 .
Figure 17.Scenario IV-the accumulated power and heating/cooling total cost.

Figure 17 .
Figure 17.Scenario IV-the accumulated power and heating/cooling total cost.

Figure 17 .
Figure 17.Scenario IV-the accumulated power and heating/cooling total cost.

Figure 17 .
Figure 17.Scenario IV-the accumulated power and heating/cooling total cost.
and cooling power (kW) C i l eq equivalent thermal capacitance (kJ/ • C)Q i l Pd external thermal disturbances (kW) Q i l lossesheat and cooling losses (kW) R i l eq equivalent thermal resistance ( • C/kW) R i lg eq thermal resistance between division (l) and the adjacent zone (g) (• C/kW) R i l roo f equivalent roof thermal resistance ( • C/kW) R il th air thermal resistance to bulk of division ( • C/kW) R i l walls equivalent walls thermal resistance ( • C/kW) T, T maximum and minimum comfort temperature limits T i l inside temperature ( • C) T out outdoor temperature ( • C) U, U maximum and minimum green resource limits u i l power control input (kW) u Tgreen green resource forecasts v i l thermal disturbance (kW) from subsystem (i) division (l) Greek Letters γ, γ violations vectors for the maximum and minimum power ε, ε violations vectors for the maximum and minimum temperature Ξ penalty value for the comfort constraint ϕ penalty value for power consumption Ψ penalty value for the power term

Table 2 .
Penalty values scenarios I and II.

Table 2 .
Penalty values scenarios I and II.

Table 2 .
Penalty values scenarios I and II.

Table 3 .
Penalty values Scenario III.

Table 3 .
Penalty values Scenario III.

Table 3 .
Penalty values Scenario III.

Table 4 .
Penalty values for Scenario IV.

Table 4 .
Penalty values for Scenario IV.

Table 4 .
Penalty values for Scenario IV.

Table 4 .
Penalty values for Scenario IV.