Development of an Energy Management System for Smart Buildings in Order to Minimize Energy Cost and to Provide Flexibility Master’s Thesis in Sustainable Energy Systems KATHARINA SERENA STUMPF DEPARTMENT OF ELECTRICAL ENGINEERING CHALMERS UNIVERSITY OF TECHNOLOGY Gothenburg, Sweden 2023 www.chalmers.se www.chalmers.se Master’s thesis 2023 Development of an Energy Management System for Smart Buildings in Order to Minimize Energy Cost and to Provide Flexibility Katharina Serena Stumpf Department of Electrical Engineering Division of Electric Power Engineering Chalmers University of Technology Gothenburg, Sweden 2023 Development of an Energy Management System for Smart Buildings in Order to Minimize Energy Cost and to Provide Flexibility Katharina Serena Stumpf © Katharina Serena Stumpf, 2023. Supervisor: Mohammadreza Mazidi, Electric Power Engineering 1. Examiner: David Steen, Electric Power Engineering 2. Examiner: Damian Vogt, University of Stuttgart, Germany Master’s Thesis 2023 Department of Electrical Engineering Division of Electric Power Engineering Chalmers University of Technology SE - 412 96 Gothenburg Telephone +46 31 772 1000 Typeset in LATEX, template by K. Antoniadou-Plytaria, customized by K. S. Stumpf Printed by Chalmers Reproservice Gothenburg, Sweden 2023 ii Development of an Energy Management System for Smart Buildings in Order to Minimize Energy Cost and to Provide Flexibility Katharina Serena Stumpf Department of Electrical Engineering Chalmers University of Technology Abstract The demand for Energy Management Systems (EMSs) has grown significantly in the context of modern sustainable living. This thesis addresses this demand by devel- oping and evaluating an innovative EMS within the HSB Living Lab. The primary goal of the developed EMS is to minimize operation cost of the building by optimal scheduling of devices and maximizing revenue from providing flexibility. The thesis commences with an introduction to the growing significance of energy management in the face of increasing energy demand and the urgency of sustainable energy utilization. It delves into the background of EMS, highlighting its potential to integrate renewable sources and controllable loads for efficient energy utilization. The research methodology involves the design and implementation of an EMS tai- lored for the HSB Living Lab environment. The system orchestrates Battery Energy Storage (BES), Electric Vehicles (EVs), and controllable loads to balance energy supply and demand as well as the heating provided by the combination of a Heat Pump (HP), district heating and a Hot Water Tank (HWT). Real-world data col- lected from the living lab contributes to the evaluation of the system’s performance. Results underscore the effectiveness of the EMS in achieving energy optimization objectives. Case studies on different days demonstrate the system’s adaptability to diverse conditions and its ability to harness renewable energy sources as well as the influence of the HP on the providing of flexibility. On the summer day, a cost reduction of 56.13 % is achieved with the provision of flexibility and still 15.51 % without. The sensitivity analysis performed shows the impact of compensation on the amount of flexibility provided. In conclusion, the developed EMS stands as a testament to the potential of smart technologies in revolutionizing energy man- agement. By seamlessly integrating various energy resources and optimizing their consumption, the system reduces costs, increases energy efficiency, provides flexi- bility to the Distribution System Operator (DSO) and contributes to sustainability goals. This thesis contributes valuable insights into energy management and offers a practical blueprint for similar deployments in diverse settings. Keywords: Energy Management System (EMS), Flexibility, Energy Saving, Cost Reduction, Smart Buildings, Sustainability. iv Acknowledgments I would like to express my sincere gratitude to Mohammadreza Mazidi, my super- visor from Chalmers University of Technology, for all the guidance, support, and instruction he provided me throughout my thesis. I am extremely grateful to David Steen, my examiner from Chalmers University of Technology, for his help and im- portant suggestions. I could not have undertaken this journey without Damian Vogt from the University of Stuttgart, Germany, whom I thank for his help with the the- sis, as well as the opportunity, to finish my master’s degree in Gothenburg. I am also very thankful for my parents. It would have been impossible to complete my studies without their unwavering support. Katharina Serena Stumpf, Gothenburg, September 2023 List of Acronyms BES Battery Energy Storage COP Coefficient of Performance DA Day-Ahead Market DSO Distribution System Operator EBT Energy-Based Network Tariff EMS Energy Management System EV Electric Vehicle HP Heat Pump HWT Hot Water Tank LOS Length of Service PBT Power-Based Network Tariff PUT Preferred User Time PV Photovoltaic SOC State of Charge TSO Transmission System Operator Nomenclature ηBES Efficiency BES % ηEV Efficiency EV % ηHW T Efficiency HWT % ρw Density of water kg/m3 bW M Binary variable washing machine - cw Specific heat capacity of water kJ/kWK CDA Price DA market SEK/kWh CDH,EBT Price energy-based network tariff district heating SEK/kWh CDH,P BT Price power-based network tariff district heating SEK/kWh CEBT Price energy-based network tariff SEK/kWh Cex Price exported power SEK/kWh Cfix,d Daily fix costs SEK Cflex Price flexibility SEK/kWh CHSB Overall Costs SEK CP BT Price power-based network tariff SEK/kWh Ctax Price taxes SEK/kWh Ctot Total heat capacity of a building envelope kWh/K COP Coefficient of Performance - DW Dishwasher - DY Dryer - EBES Energy BES kWh EEV Energy EV kWh EHW T Energy HWT kWh HT C Charging power HWT kW HT D Discharging power HWT kW LOSp W M Length of washing machine program h max Maximum - min Minimum - n Factor - vii Nomenclature n Node - pi Parameter - Pbase Base load kW PBES,charg Charging power BES kW PBES,discharg Discharging power BES kW PBES Power BES kW PDW Power consumption dishwasher kW PDY Power consumption dryer kW PEV,charg Charging power EV kW PEV Power EV kW Pflex Flexibility kW PGrid Grid power kW PHP Heat pump power kW PL,peak Upper capacity limit kW PP V Power PV kW PW M Power consumption washing machine kW PUTEV,end End of preferred user time EV h PUTEV,start Start of preferred user time EV h PWMp t,s Consumption matrix washing machine - Q Heat kW Qb,d Heat demand building kW Qbase Base heat demand kW QDH District heating heat kW QHP Heat pump heat kW Req Thermal resistance K/kWh SW M Consumption scenarios washing machine - SOCBES State of Charge BES % SOCEV State of Charge EV % T Temperature °C t Time s TC Temperature cooling water layer HWT °C TH Temperature hot water layer HWT °C Tamb Ambient temperature °C Tfinish,W M Finishing time washing machine h Tin Indoor temperature °C Tout Outlet hot water temperature °C Tstart,W M Starting time washing machine h viii Nomenclature uBS,charg Binary Variable BES - uBS,discharg Binary Variable BES - VC Volume cooling water layer HWT l VH Volume hot water layer HWT l Vtot Total volume HWT l WM Washing machine - ix Contents List of Acronyms vi Nomenclature vii List of Figures xi List of Tables xiii 1 Introduction 1 1.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2 Aim and Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.3 Structure of the Thesis . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2 Theory 4 2.1 Energy Management Systems: State of the Art . . . . . . . . . . . . . 4 2.2 Residential Energy Management Systems . . . . . . . . . . . . . . . . 5 2.3 HSB Living Lab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.4 Congestion Management . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.4.1 Demand Side Flexibility . . . . . . . . . . . . . . . . . . . . . 8 2.4.1.1 Demand Side Flexibility: Electricity . . . . . . . . . 10 2.4.1.2 Demand Side Flexibility: Heating . . . . . . . . . . . 11 2.5 Modeling the Thermal Performance of the Building . . . . . . . . . . 12 2.6 Energy Market in Sweden . . . . . . . . . . . . . . . . . . . . . . . . 14 2.6.1 Electricity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.6.2 District Heating . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.6.2.1 Energy Costs . . . . . . . . . . . . . . . . . . . . . . 15 2.6.2.2 Power Costs . . . . . . . . . . . . . . . . . . . . . . . 16 2.6.2.3 Efficiency Costs . . . . . . . . . . . . . . . . . . . . . 16 3 Methods 18 3.1 Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 x Contents 3.1.1 Power and Heat Balance . . . . . . . . . . . . . . . . . . . . . 19 3.1.2 Cost Reduction . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.1.3 Provision of Flexibility . . . . . . . . . . . . . . . . . . . . . . 19 3.2 Battery Energy Storage . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.3 Electric Vehicle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.4 PV and Base Load . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 3.5 Controllable Loads . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 3.6 Heat Pump . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 3.7 Heat Demand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 3.8 Hot Water Tank . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 4 Results 32 4.1 Results for a Summer Day . . . . . . . . . . . . . . . . . . . . . . . . 33 4.1.1 Battery Energy Storage . . . . . . . . . . . . . . . . . . . . . 34 4.1.2 Base Load . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 4.1.3 Controllable Loads . . . . . . . . . . . . . . . . . . . . . . . . 37 4.1.4 Electric Vehicles . . . . . . . . . . . . . . . . . . . . . . . . . . 39 4.1.5 Heating Demand and Heating of the HSB Living Lab . . . . . 42 4.1.6 Reduction of Costs . . . . . . . . . . . . . . . . . . . . . . . . 43 4.2 Results for a Winter Day . . . . . . . . . . . . . . . . . . . . . . . . . 43 4.2.1 Battery Energy Storage . . . . . . . . . . . . . . . . . . . . . 43 4.2.2 Base Load . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 4.2.3 Controllable Loads . . . . . . . . . . . . . . . . . . . . . . . . 46 4.2.4 Electric Vehicles . . . . . . . . . . . . . . . . . . . . . . . . . . 47 4.2.5 Heating Demand and Heating of the HSB Living Lab . . . . . 50 4.2.6 Reduction of Costs . . . . . . . . . . . . . . . . . . . . . . . . 51 4.3 Flexibility Summer Day . . . . . . . . . . . . . . . . . . . . . . . . . 51 4.3.1 Sensitivity Analysis for Price of Flexibility . . . . . . . . . . . 51 4.3.2 Provision of Flexibility on a Summer Day . . . . . . . . . . . 53 4.4 Flexibility Dispatch Winter Day . . . . . . . . . . . . . . . . . . . . . 57 4.4.1 Sensitivity Analysis for Price of Flexibility . . . . . . . . . . . 57 4.4.2 Provision of Flexibility on a Winter Day . . . . . . . . . . . . 57 4.5 Differences Between a Summer and a Winter Day . . . . . . . . . . . 60 5 Discussion 62 5.1 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 6 Conclusion 65 xi List of Figures 2.1 Schematic diagram of the HSB Living Lab . . . . . . . . . . . . . . . 6 2.2 Schematic diagram of the flexibility dispatch . . . . . . . . . . . . . . 11 2.3 Lumped parameter model with one node . . . . . . . . . . . . . . . . 13 3.1 Flowchart of the implementation in Python . . . . . . . . . . . . . . . 18 3.2 PV generation and base load of the HSB Living Lab on 1/24/2022 and 7/24/2022, respectively . . . . . . . . . . . . . . . . . . . . . . . 25 3.3 Power consumption of the different washing machine programs . . . . 26 4.1 Temperatures of a summer and a winter day . . . . . . . . . . . . . . 32 4.2 PV production on a summer and a winter day . . . . . . . . . . . . . 33 4.3 SOC of the BES and the DA price on a summer day . . . . . . . . . 34 4.4 Charging power of the BES with the DA price and the PV production on a summer day . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 4.5 Charging and discharging power of the BES with the base load and the power drawn from the grid on a summer day . . . . . . . . . . . . 37 4.6 Consumption of the controllable loads with the DA price on a summer day . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 4.7 Charging of the EVs at the HSB Living Lab on a summer day . . . . 41 4.8 Heat demand and heating of the HSB Living Lab on a summer day . 42 4.9 SOC of the BES and the DA price on a winter day . . . . . . . . . . 44 4.10 Charging power of the BES with the DA price and the PV production on a winter day . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 4.11 Charging and discharging power of the BES with the base load and the power drawn from the grid on a winter day . . . . . . . . . . . . 46 4.12 Consumption of the controllable loads with the DA price on a winter day . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 4.13 Charging of the EVs at the HSB Living Lab on a winter day . . . . . 49 4.14 Heat demand and heating of the HSB Living Lab . . . . . . . . . . . 50 xii List of Figures 4.15 Sensitivity Analysis of the price for flexibility on a summer day . . . 52 4.16 Electrical loads with flexibility on a summer day with n = 5 . . . . . 55 4.17 Electrical loads with flexibility on a summer day with n = 3 . . . . . 56 4.18 Sensitivity Analysis of the price for flexibility on a winter day . . . . 57 4.19 Flexibility, grid load and DA price . . . . . . . . . . . . . . . . . . . . 58 4.20 Electrical loads with flexibility on a winter day . . . . . . . . . . . . . 59 xiii List of Tables 2.1 Electricity fees in Gothenburg for private houses from Göteborg Energi 15 3.1 Data of the BES in the HSB Living Lab . . . . . . . . . . . . . . . . 21 3.2 Data of the battery of a Polestar 2 in the standard range version . . . 23 3.3 Data for the estimation of the COP of the modeled HP. . . . . . . . . 28 3.4 Data of the HP and the district heating network in the HSB Living Lab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 3.5 Data of the model of the HSB Living Lab . . . . . . . . . . . . . . . 29 3.6 Specifications of the HWT in the HSB Living Lab . . . . . . . . . . . 31 4.1 Used PUTs of the controllable loads . . . . . . . . . . . . . . . . . . . 37 4.2 Used PUTs of the EVs . . . . . . . . . . . . . . . . . . . . . . . . . . 39 4.3 Reduction of costs on a summer day . . . . . . . . . . . . . . . . . . 43 4.4 Reduction of costs on a winter day . . . . . . . . . . . . . . . . . . . 51 4.5 Comparison of the provided flexibility on a summer and a winter day 60 4.6 Reduction of costs with the providing of flexibility . . . . . . . . . . . 60 xiv 1 Introduction The global community is showing heightened concern over the potential ramifica- tions of greenhouse gas emissions, recognizing a strong correlation between energy consumption and the escalating challenge of climate change [1, 2]. This mounting awareness is compounded by the upward trajectory of energy costs, driven by surg- ing demand and finite resources. Notably, the deregulation of the power sector in numerous areas has led to a considerable surge in electricity expenses [3]. In the pursuit of sustainable and efficient energy consumption, the integration of advanced technologies within buildings has become a paramount endeavor. The in- creasing demand for energy, coupled with the need for cost-effective and eco-friendly solutions, has led to the emergence of novel approaches to energy management [4]. This thesis delves into the development of an Energy Management System (EMS) tailored for a smart building on the campus of Chalmers University of Technology, the HSB Living Lab. The EMS does not only minimize energy costs but also of- fers flexibility in response to dynamic energy market conditions by shifting loads. Flexibility is calculated as the difference between the upper capacity limit and the net grid power (see equation 3.6) and is offered to the Distribution System Oper- ator (DSO) at specified hours. It is achieved by shifting loads and is financially compensated. The provision of flexibility is necessary for the DSO since the growing integration of renewable-based generation amplifies the demand for flexibility among system operators [5]. It is expected, that the amount of flexibility will increase especially in winter because of the combination of Heat Pump (HP), Hot Water Tank (HWT) and district heating [6, 7]. 1 1. Introduction 1.1 Background As the global population continues to grow, the consumption of energy increases strongly [8]. This has ushered in a renewed focus on optimizing energy usage to reduce both environmental impact and economic strain [9]. Households play a significant role in driving the transformation of global energy con- sumption towards a more sustainable future. The European Commission highlights that domestic energy usage accounted for 27 % of the final energy consumption in 2021, nearly one-third of the total energy consumption [10]. Smart buildings, equipped with advanced sensors, control systems, and communi- cation networks, have emerged as a promising solution. These buildings possess the capability to adapt their energy consumption patterns in real-time. Factors for adaption are e.g., occupancy, weather conditions, and energy pricing, thus fostering a more intelligent and responsive energy ecosystem [11]. 1.2 Aim and Goals The primary aim of this study is to develop an EMS for the HSB Living Lab that is based on the data delivered by numerous sensors of the building and reduces en- ergy costs while taking advantage of the flexibility inherent in these structures. By optimizing the operation of various energy-consuming elements within the building, such as battery storage, electric vehicles and controllable loads, the proposed system aims to balance comfort, cost and energy efficiency. The EMS development takes the following steps: First, the various components of the HSB Living Lab are modeled in Python. These components are integrated into the developed EMS to reduce energy costs. In a second step, the EMS is then ex- tended to additionally provide flexibility. 1.3 Structure of the Thesis This thesis is divided into six chapters. After this introduction, the necessary the- ory is presented in Chapter 2. Here, EMSs in general are discussed and presented 2 1. Introduction in more detail. It also explains how flexibility can be provided and additionally presents the energy market in Sweden. Chapter 3 explains the models used for the different applications that can be con- trolled in the HSB Living Lab, which subsequently are integrated in our EMS. It also discusses the optimization functions, firstly for cost reduction only, and then for additional provision of flexibility. Based on this, Chapter 4 presents the results of the developed EMS, which are generated using real data from the HSB Living Lab. In Chapter 5 we delve into a discussion of these results. Furthermore, an outlook on implications and future issues for research is provided. Chapter 6 gives a final conclusion of the thesis. 3 2 Theory 2.1 Energy Management Systems: State of the Art EMS have been developed by several authors with different goals and different com- ponents which are documented in the literature. A comparative analysis of the literature on EMS, focusing on modeling approaches and their impact on EMS operations and outcomes, can be found in [12]. Chal- lenges discussed include forecast uncertainty, device heterogeneity, multi-objective scheduling, computational limitations, timing considerations, and consumer well- being. Here, the aim is to enable readers to understand and to compare important considerations, approaches, nomenclature, and results in the EMS literature. As an example, [13] presents an optimization model for managing energy in a res- idential building with monthly power-based tariffs and variable electricity prices. The model consists of two stages: First, determining the expected peak demand and minimizing energy costs. The second stage involves real-time operation of flexi- ble energy sources and optimizing the use of Battery Energy Storage (BES) systems, Electric Vehicle (EV) charging, heating systems, and appliance scheduling. A simulation software to study EMS in smart grids is developed by [14]. It aids in validating and demonstrating energy management and optimization models for researchers and educators. Additionally, residential customers can utilize the plat- form to model and analyze household energy consumption profiles. A predictive EMS for a residential building is presented in [15]. It integrates a plug- in EV, a Photovoltaic (PV) array, and a HP. The system utilizes a stochastic model predictive control strategy to minimize electricity costs, reduce battery degradation 4 2. Theory costs, and to ensure that load demand, battery charging, and thermal comfort re- quirements are met. The real-time control adjusts decisions and forecast data based on realized stochastic parameters, thus minimizing the impact of the gap between forecasted and real data. In [16] a framework for energy management in smart buildings within integrated energy systems is presented. The framework incorporates a rolling time window approach for real-time decision-making and considers peak load tariffs. A case study on a Swedish multi-family residential building demonstrates the effectiveness of the model. 2.2 Residential Energy Management Systems Residential EMS optimize energy consumption and production patterns in house- holds by combining all elements concerning energy, possibly also interacting with energy [17]. Since residential users are generally unwilling to invest time in analyzing their consumption decisions and closely monitoring household devices to save money, EMS utilize smart technologies and algorithms like optimization techniques or arti- ficial intelligence to communicate with household devices and users, receive external information such as electricity prices, and improve energy scheduling. Among other things the goal can be to reduce operational costs, minimize energy wastage, and enhance user comfort [12]. The literature study [12] classifies the objectives of EMS as follows: Firstly, the reduction of all costs connected to the EMS. That is primarily the costs of the energy consumption, but also start-up costs for devices, as well as rewards and penalties for a load, either according to the desired profile, or not. Battery degradation is also an important factor [12]. The second goal aims at the well-being of the residents. It means that the use of an EMS should not force the users to change their lifestyle and therefore the comfort should not be reduced [12]. The third objective concerns profiling of the load. This includes reducing the peak demand of the utility or to reduce the grid dependency of the household. Loads 5 2. Theory include electric and heat energy and can for example be done by shifting or cutting of loads, peak shaving, target consumption and self-consumption [12]. The fourth objective according to the literature research of [12] refers to emissions. This usually relates to greenhouse gas emissions generated during electricity gener- ation, which should be reduced as much as possible for several reasons [1]. Energy from renewable sources should be used whenever possible since they produce less CO2 [18]. 2.3 HSB Living Lab In this thesis we use the data of the HSB Living Lab on the campus of Chalmers University of Technology. The HSB Living Lab is one of Sweden’s leading test beds for sustainable housing and has been established to investigate the area of demand side management [19]. This building consists of 29 apartments with a usable floor area of 1720 m2 and is primarily used by students and guest researchers [16]. Figure 2.1 shows a schematic diagram of the HSB Living Lab. Figure 2.1: Schematic diagram of the HSB Living Lab [20]. 6 2. Theory Solar panels have been installed on the roof and the facade of the building, which are connected to a BES. This BES can be charged using PV as well as the grid. There are also several controllable loads in the building, such as dishwasher, washing machine, dryer, and EV. To discover the impact of the behaviors of the residents approximately 2000 sensors are installed to collect building data [20]. In addition to the electrical components, there are several heating components. At- tached to the building are two HPs and three HWTs, to provide heat and hot water. Furthermore, the HSB Living Lab is attached to the district heating network of Gothenburg [20]. The developed EMS in this thesis models the following components which are part of the HSB Living Lab and will be explained in the following sections: - battery energy storage - electric vehicle - base load of the building - controllable loads  electric energy - heat pump - hot water tank - district heating  heat energy 2.4 Congestion Management Sweden is part of the Nordic Power Market, which covers the four Nordic countries Norway, Sweden, Finland and Denmark. In each country, a Transmission System Operator (TSO) is responsible for the grid [21]. The duties of a TSO encompass various responsibilities such as congestion manage- ment, procuring of regulation resources and ancillary services, tariffs and system planning, including investment planning. TSOs are responsible for managing the high-voltage transmission network, which is the backbone of the electricity grid. TSOs oversee the long-distance transmission of electricity from power plants to dis- tribution networks and large industrial consumers. As balancing group coordinators, the task of the TSO is to monitor and coordinate the schedules in order to keep the grid frequency stable at 50 Hz [21, 22]. In this thesis, only the congestion manage- ment at the distribution grid level is discussed. 7 2. Theory The so-called N-1 criterion is essential for transmission reliability. The electrical power supply system must be able to withstand the failure of a resource at any time without any restrictions on supply. In the event of a power plant failure, compliance with the N-1 criterion is ensured by the use of ancillary services; in the event of a line failure, it is ensured by the remaining network. The lines must therefore not be fully utilized during normal operation, as otherwise the remaining lines would be overloaded in the event of a line failure and the N-1 criterion could not be met. Consequently, a network congestion refers to the scenario in which a line is over- loaded in the event of a line failure [22, 23, 24]. The DSO operates the lower-voltage distribution network connected to end con- sumers, such as residential, commercial, and small industrial users. Their role involves managing the local distribution of electricity to consumers and handling power flow within their specific area [22]. DSOs in Sweden have the responsibility of ensuring the reliability and quality of electricity supply by actively managing, enhancing, and investing in the existing electricity distribution infrastructure. They function within the context of natural monopolies and operate under strict regula- tory oversight aimed at safeguarding consumers and controlling grid costs, which can constrain their capacity for innovation in comparison to businesses operating in more open-market conditions [25]. 2.4.1 Demand Side Flexibility With the increasing integration of renewable-based energy to the power grid, the need for flexibility in systems increases as well. Flexibility in the context of a power grid refers to its ability to adapt and respond to changes in electricity supply and demand while maintaining a stable and reliable electricity supply. It involves vari- ous measures and technologies that enable the grid to accommodate fluctuations in electricity generation and consumption from various sources, such as renewable en- ergy integration, up-/down-power regulation, voltage support and power congestion mitigation [26, 27]. Consumers, i.e., the users of the EMS, have a great impact on the demand side. Since economic drivers are central for most customers, their consumption behavior can be affected by incentive-based programs [28]. Psychological research shows that human behavior in the area of energy consumption is a complex phenomenon which 8 2. Theory is connected to a plethora of factors, e.g., organizational, social, and technical issues [29, 30]. Here, the focus is on economic drivers in household consumption. The Nordic and Swedish electricity systems, relying heavily on hydroelectric power, possess ample flexible production resources. As a result, demand side flexibility has been historically underutilized. With low market price volatility, customer incen- tives for flexible electricity use have been limited. However, a stable price difference between day and night, and weekends and weekdays, has provided some incentives, notably through time-differentiated tariffs offered by selected network companies [28]. When congestion is anticipated or observed in the distribution network, the DSO may announce specific hours or periods when the grid is expected to experience higher demand than the available capacity can handle. During the announced con- gestion hours, there is a window of opportunity for various participants, such as electricity consumers, generators, or even energy storage owners, to offer their flex- ibility services to the DSO. Flexibility in this context refers to the ability to adjust electricity consumption or generation in response to grid conditions. By offering flexibility, participants can help the DSO manage the congestion effectively. For ex- ample, consumers can reduce their electricity usage temporarily, or generators and energy storage owners can increase their output to support the grid during peak demand periods. As an interface to customers, the TSO transnetBW in Baden- Wuerttemberg, Germany, has launched the ”StromGedacht” app, which provides information in advance of a critical situation about when and how to reduce the load on the grid and thus make a contribution to grid stabilization [31]. Different demand sectors offer different flexibility potentials. In the commercial sec- tor this can be appliances in hotels and restaurants, refrigerators and freezers in supermarkets or commercial parking lots for EV. Potentials in the industrial sector include oil refinery plants and the metal industry. In the residential sector, a great potential exists through EMS which manage the electrical consumption through the managing of loads and the heating through the HPs. This will be further discussed in the following sections [27]. 9 2. Theory 2.4.1.1 Demand Side Flexibility: Electricity Figure 2.2 shows a schematic diagram of the flexibility dispatch. The base load, which includes electric appliances like lighting systems, elevators and audio/video devices cannot be controlled. Therefore, they cannot provide any flexibility. The same applies to PV, as their output depends on the weather only. In addition, there are loads that can be controlled. This can concern either the time component or the power component. In the case of the BES, the user cannot specify any restrictions in time or power, however, the EMS can control both. For an EV, the user can restrict the time, and the charging power and actual charging time are then determined by the EMS. The last category refers to household applications. These have a fixed power consumption once a program is selected, but the usage period can be set by the user. This last category is referred to as controllable loads in the following. The situation regarding the flexibility is different for controllable loads. Their con- sumption is constant, but the period of use is variable, so that flexibility can be achieved by shifting the use. For the EV as well as for the BES the time of charging can be shifted by the EMS similar to the controllable loads. In addition, however, the charging power can also be reduced and thus the peak consumption, which leads to peak shaving. Peak shaving is a demand-side management strategy used to reduce or ”shave” the peak electricity consumption during periods of high demand on the power grid. The goal of peak shaving is to flatten the electricity demand curve and avoid excessive peak loads, which can put a strain on the grid and increase the risk of power outages. Conversely, the charging power can of course also be increased, as long as the max- imum charging power is not reached, if too much electrical energy is available. If there is too little energy available, the BES can also feed in additional energy that can be used by other customers. This can also help to avoid congestion, because the energy may only have to be transported over shorter distances. 10 2. Theory Figure 2.2: Schematic diagram of the flexibility dispatch [26]. 2.4.1.2 Demand Side Flexibility: Heating The heating system of the residential building consists of three components: The district heating system, the HP and the HWT. The district heating network has no impact on the electrical grid; thus it can be used any time without changes in the flexibility. The HP on the other hand is directly connected to both, the heating system of the building and the power grid since a HP converts electrical energy to heating energy. In a residential building, the temperature must stay within the comfort bound. HPs offer flexibility by leveraging the temperature range between upper and lower indoor thresholds. During electricity market fluctuations, the EMS optimizes the operation of the HP to keep the indoor temperature close to the upper or lower threshold, en- suring efficient usage during power shortages or excess supply [27]. HWTs serve as cost-effective thermal storage solutions for residential buildings. By integrating heat controllers with thermal storage, they offer significant flexibility potential for upstream networks. During periods of low energy prices or renewable power surplus, the HWT stores heat energy. Later, it meets demand for space heat- ing and domestic hot water consumption during renewable power shortages or high 11 2. Theory electricity prices, providing a reliable and efficient solution for energy management [27]. The energy consumption of heating systems depends on the building’s physical char- acteristics, prevailing weather conditions and the different comfort level of the users. Buildings constructed with high-quality materials and good insulation demonstrate higher energy efficiency, making them less susceptible to weather variations. In con- trast, poorly insulated buildings experience greater sensitivity in heat energy con- sumption due to ambient conditions, which means they heat up or cool down faster. Therefore, the thermal properties of the building are an important factor [27]. In the next section, we describe the modeling of the thermal performance of a building. 2.5 Modeling the Thermal Performance of the Building For the thermal performance of buildings many models have been developed. As an example, [32] proposes the usage of a lumped parameter model for optimization problems. Advantages are that the model using an RC-network is simple, transpar- ent and that the computational demand is low [33]. This approach, known as the electrical analogy method [34], utilizes the concept of electric resistances and capac- itances to mimic the thermal resistances and capacitances of material layers. By representing these thermal properties through their electrical counterparts, a sim- plified multi-nodal model is obtained by combining and consolidating parameters [35]. The conductivity of materials is analogously interpreted as electric conductiv- ity, while the thermal mass is considered equivalent to electrical capacity [32]. The more nodes a model includes, the more accurate it is [36]. As seen in equation 2.1, the heat balance is modeled as a first order differential equation [35]. Cn · dTn dt = ∑ ∀i∈I Ti − Tn Ri +Qn (2.1) 12 2. Theory Cn and Tn are the thermal capacitance and temperature of node n, respectively. Qn is the heat applied to the node and Ri is the thermal resistance between i and n. The set I encompasses all nodes that are connected to node n. In Figure 2.3 the used lumped parameter model is shown, and equation 2.2 shows the corresponding heat balance as used in [37]. Tamb is the ambient temperature and Tin the temperature inside the building. Ctot · dT dt = dQ dt = −Tin − Tamb Req (2.2) [37] investigate the values of Req and Ctot for residential customers of Göteborg En- ergi and chose Req = 5.52 K/kWh. For the heat capacity Ctot, different values for different building shells (light, average, heavy) were calculated using the lumped parameter model. For an average, light and heavy building shell, they suggest a value for Ctot of 10.8 kWh/K, 4.3 kWh/K and 17.4 kWh/K, respectively. Since the HSB Living Lab is located in Gothenburg and has an average isolation, the same value for Req is used in this thesis. Ctot Tamb Tin Req Pheat Figure 2.3: Lumped parameter model with one node (own representation according to [36]). 13 2. Theory 2.6 Energy Market in Sweden 2.6.1 Electricity In Sweden, the electricity market operates under a deregulated system, where elec- tricity prices are determined by the forces of supply and demand. Electricity pro- ducers generate power, which is then purchased by electricity suppliers primarily through the electricity market Nord Pool. Network operators are responsible for the transmission and distribution of electricity to consumers. Ensuring a balanced electricity system is the task of balancing responsible parties, which include electric- ity producers, suppliers, and large consumers. Their responsibility is to maintain a constant equilibrium between electricity generation and consumption. Svenska kraftnät serves as the TSO and oversees the entire electricity system in Sweden, with a focus on grid security and coordination among market participants [38]. In the Nordic area, the day-ahead spot market implemented a zonal pricing ap- proach, also known as market splitting, right from its inception. The Nord Pool area is comprised of multiple price areas, each having a shared spot price within its respective area. To address capacity issues within these price areas, counter pur- chases or counter trading mechanisms are employed [21]. Currently, the price areas in the Nordic region align with the control areas of the system operators. System operators internally employ their own methods within their respective areas. In Sweden, for example, all internal capacity limits are re- solved through counter purchases [21]. In Sweden, as an end-use customer, it is possible to register for an hourly electricity- pricing scheme which is based on the hourly price of the nordpool spot, the nordic day-ahead electricity market [39]. Traditionally, consumers in Sweden paid a single integrated tariff for electricity, which covered both the cost of electricity supply and grid access. However, with the advent of deregulation, this paradigm has evolved significantly. Under the new framework, consumers now deal with separate entities for their electricity needs: the DSO responsible for grid access and maintenance and the electricity retailer who supplies the actual electricity [40]. 14 2. Theory In this thesis a Power-Based Network Tariff (PBT) is considered, as it is used by some Swedish distribution grid operators already and others consider to implement it in the future [41]. Most customers are billed under the Energy-Based Network Tariff (EBT), which includes charges based on their electricity consumption in kWh as well as an annual fee [41]. With a PBT, on the other hand, the network tariff is based on the cus- tomer’s peak demand. This could either be the monthly or the daily peak demand. Table 2.1 shows the electricity costs from Göteborg Energi. CEBT is the price for the EBT, CP BT is the price for the PBT. Cfix is the fixed fee for the electricity contract and Ctax is the price for the taxes on the electricity consumption [41]. Table 2.1: Electricity fees in Gothenburg for private houses from Göteborg Energi [42]. Costs [Unit] Value CEBT [öre/kWh] 25.5 CP BT [SEK/kWpeak] 1.21 Cfix [SEK/month] 174.5 Ctax [öre/kWh] 49 2.6.2 District Heating The district heating energy for the HSB Living Lab is provided by Göteborg Energi. Three components go into their price for district heating: the energy costs (about 60 %), the power costs (about 40 %) and the efficiency costs (about ± 5 %) [43]. 2.6.2.1 Energy Costs Energy consumption directly influences the amount of heat required to be produced and delivered. The energy share is determined by multiplying the monthly energy usage by the corresponding monthly energy price. In summer, a significant portion of heat is recovered within the district heating network, resulting in a lower overall 15 2. Theory energy price for the entire network. However, during the heating season, the re- covered heat proportion decreases, leading to higher energy prices due to increased reliance on alternative production methods. 2.6.2.2 Power Costs The power usage indicates the manner in which heat is utilized, specifically the evenness of the power draw. The power draw determines the necessary level of production readiness. Consequently, a consistent power draw results in lower costs, while an inconsistent power draw leads to higher costs. The power component is calculated based on the average value of the measured power draw. This calculation involves multiplying the average power of the facility by the variable power price. The resulting value is then added to the fixed power price. The price-determining average power is obtained by calculating the average of the three highest daily average values observed during the most recent rolling 12-month period. During the preparation of invoices, the average value of the three highest daily av- erage powers recorded within the past 12 months is computed. The daily average power is determined by dividing the energy consumption in kWh by 24 hours. 2.6.2.3 Efficiency Costs The efficiency of heat utilization in residential settings influences water circulation and determines the viable heat sources. One metric used to assess efficiency is the measurement of the return temperature in the district heating system. A lower re- turn temperature indicates higher efficiency. Each month, a comparison is made between the return temperature of the facility and the average return temperature of the district heating system. Based on this analysis, a rebate or charge is applied per MWh and the temperature of heat used. If a rebate is granted, it signifies that the return temperature is below the average return temperature of the district heating system. The magnitude of the rebate is 16 2. Theory determined by the extent to which your return temperature is lower than the aver- age, as well as the amount of energy consumed during the current month. 17 3 Methods The EMS developed for this thesis is implemented in Python, for a flowchart see Fig- ure 3.1. The scientific issue of this thesis is considered as an optimization problem which is modeled with Pyomo [44] and which is solved with the Gurobi Optimizer [45]. Calculations are performed on a Windows 10 laptop with an Intel® Core™ i7-7500U CPU @ 2.70 Ghz processor and 16 GB of RAM. The developed EMS always calculates the times when a device is running or charg- ing and discharging for the following day with a time resolution of five minutes. The electricity prices of the price area SE3 of the Nord Pool day-ahead market, which can be viewed online and are available in hourly resolution, are used for this pur- pose. They are determined after 12 noon of the previous day, so that the optimal distribution of energy consumption can be determined afterwards [46, 47]. Implementation in Python 8/30/2023 Master's Thesis Presentation ‐ Katharina Stumpf 15 Input Values (Preferred User Times, Program Selection,…) Modelled Devices Fixed Input Values (Temperature, Prices, PV Production, Base Loads,…) Battery Energy Storage Electric Vehicle Controllable Loads Heat Pump Hot Water Tank District HeatingBuilding (thermal)Grid Energy Balance Objective Function Output Figure 3.1: Flowchart of the implementation in Python. 18 3. Methods 3.1 Optimization A major objective of this thesis is to reduce the energy costs of the HSB Living Lab. In a first step we focus on the running and charging/discharging times of the different devices. In a second step, the provision of flexibility at times of the respective peak demands is added to the EMS. 3.1.1 Power and Heat Balance All modeled devices are linked through a power balance, which contains all the power devices and a heat balance which contains all heating values. The power balance and heat balance are shown in equation 3.1 and 3.2, respectively. PBES,discharg(t) + PP V (t) + PGrid(t) =PBES,charg(t) + PEV,1(t) + PEV,2(t) + PW M(t) + PDW (t) + PDY (t) + Pbase(t) + PHP (t) (3.1) Qbase(t) +Qb,d(t) +HT C(t) = QDH(t) +QHP (t) +HT D(t) (3.2) 3.1.2 Cost Reduction With respect to cost reduction, the objective function has been set to minimize the electricity and heating costs for the HSB Living Lab. Min CHSB = 24∑ t=1 PGrid(t) · (CDA(t) + CEBT + Ctax) + PGrid,peak · CP BT + Cfix,d +QDH(t) · CDH,EBT +QDH,peak · CDH,P BT (3.3) 3.1.3 Provision of Flexibility The second aim of the thesis is to determine the possible flexibility dispatch. The calculation is done as follows (c.f. [26]). To provide flexibility, a contract with the DSO is needed to determine the compen- sation for the providing of flexibility. That way, the costs for the HSB Living Lab can be reduced even more. 19 3. Methods Firstly, the energy balance is adjusted, to offer the possibility to export power to the grid. In our model, we assume that export and import cannot take place simul- taneously. The updated balance can be seen in equation 3.4. PBES,discharg(t) + PP V (t) + PGrid,im(t) = PBES,charg(t) + PEV,1(t) + PEV,2(t) +PW M(t) + PGrid,ex(t) + PDW (t) + PDY (t) + Pbase(t) + PHP (t) (3.4) We calculated the income for the exported power from the Day-Ahead Market (DA) price with a compensation of 0.08 SEK/kWh and a tax reduction of 0.6 SEK/kWh [48]. The assumed price for provided flexibility is based on the exported price. The main difference is that the highest value of the DA prices is used. Additionally, a factor n is introduced to change the revenue for the provision of the flexibility easily in order to highlight the compensation as an important factor in the calculation. The compensation for flexibility can be seen in equation 3.5. Cflex = max(CDA) · n+ 0.08 + 0.6, n ∈ [1, 5] (3.5) The times chosen for providing flexibility are the peak hours in winter and summer in Sweden, i.e., 12-15 o’clock in summer and 18-22 o’clock in winter [49]. The flexibility is the difference between the upper capacity limit PL,peak and the net grid power and can be calculated with equation 3.6. The upper capacity limit is a value that is determined so that DSO and the responsible operator for providing the flexibility can quantify the flexibility in a dependable approach, e.g., the power capacity at a grid connection node. Pflex(t) = PL,peak − (PGrid,im(t)− PGrid,ex(t)) (3.6) The updated objective function with the flexibility is shown in equation 3.7. 20 3. Methods Min CHSB = 24∑ t=1 PGrid,im(t) · (CDA(t) + CEBT + Ctax) + PGrid,peak · CP BT + Cfix,d − PGrid,ex(t) · Cex − Pflex(t) · Cflex +QDH(t) · CDH,EBT +QDH,peak · CDH,P BT (3.7) In the following sections, we present all modeled devices used in the objective func- tion. 3.2 Battery Energy Storage The modeling of the BES is done using the data given in Table 3.1 of the BES in the HSB Living Lab. It is specified that the State of Charge (SOC) of the BES must always be between 10 and 90 %, due to faster battery aging with full utilization of the battery capacity [50]. Table 3.1: Data of the BES in the HSB Living Lab (line 1-3: technical, line 4-5: defined). Parameter [Unit] Value PBES,max [kW] 3 EBES,max [kWh] 7.2 ηBES [%] 0.95 SOCBES,max [%] 0.9 SOCBES,min [%] 0.1 Neglecting self-discharge, which is less than 1% per month for lithium-ion batteries, the following constraints for charging and discharging of the BES are obtained [51]. As seen in equations 3.8 and 3.9, the variables for the charging and discharging power of the BES PBES,charg(t) and PBES,discharg(t) always needs to be smaller than the maximal possible power PBES,max. PBES,charg(t) ≤ PBES,max = 3 kW (3.8) 21 3. Methods PBES,discharg(t) ≤ PBES,max = 3 kW (3.9) Considering the equations 3.8 and 3.9, simultaneous charging and discharging of the BES would be possible but is not desired, so two binary variable uBS,charg and uBS,discharg are introduced and added to the constraints above to prevent this. uBES,charg ∈ {0; 1} (3.10) uBES,discharg ∈ {0; 1} (3.11) As seen in equation 3.12, the sum of the two binary variables always needs to be 1 or smaller, which is 0, in which case the BES would neither be charged nor discharged. uBES,charg(t) + uBES,discharg(t) ≤ 1 (3.12) The new constraints for charging and discharging of the battery using the binary variables can be seen in equations 3.13 and 3.14. PBES,charg(t) ≤ PBES,max · uBES,charg(t) (3.13) PBES,discharg(t) ≤ PBES,max · uBES,discharg(t) (3.14) In equation 3.15 the constraint for the change of the SOC for the first time step can be seen. It starts with an initial value for SOCBES,ini which is the SOC of the 0 o’clock of the day that is optimized. The time resolution is 5 minutes and in every 5 minutes of the day, the BES can be either charged or discharged as equation 3.16 shows. t = 0 : SOCBES(t) = SOCBES,ini + PBES,charg(t) · ηBES EBES,max · 12 − PBES,discharg(t) ηBES · EBES,max · 12 (3.15) 22 3. Methods t > 0 : SOCBES(t) = SOCBES(t− 1) + PBES,charg(t) · ηBES EBES,max · 12 − PBES,discharg(t) ηBES · EBES,max · 12 (3.16) The values PBES,charg(t) and PBES,discharg(t) will be later added to the overall energy balance to optimize the charging and discharging according to the optimization in the EMS. 3.3 Electric Vehicle It is assumed that the EVs charging at the HSB Living Lab are Polestar 2 in the standard range version. The battery data for this type of car can be seen in Table 3.2. This car was selected because the battery data corresponds to the typical battery data for this class of car. In total, two EVs can be charged simultaneously. As with the BES, the SOC is assumed to be in the range of 10 to 90 % to avoid too rapid aging of the battery [50]. The EVs are modeled like the BES with the difference, that it is assumed, that the battery of one EV is only charged and cannot be discharged. Table 3.2: Data of the battery of a Polestar 2 in the standard range version (line 1-3: technical [52], line 4-6: defined). Parameter [Unit] Value PEV,max,tech [kW] 11 EEV,max [kWh] 69 ηEV [%] 0.98 SOCEV,max [%] 0.9 SOCEV,min [%] 0.1 PEV,max [kW] 10 Furthermore, the Preferred User Time (PUT), which is equivalent to the time the EV is at the HSB Living Lab, is considered. Due to the close proximity of the HSB Living Lab to Chalmers University of Technology, it is assumed that the electric cars will only be charged during working hours. This corresponds to an assumed PUT in this thesis of 8 a.m. to 5 p.m. 23 3. Methods Like the charging of the BES the charging power of the EV PEV,charg always needs to be smaller than the maximal possible charging power PEV,max, see equation 3.17. PEV,charg(t) ≤ PEV,max = 10 kW (3.17) In equation 3.18 the constraint for the charging of the EV can be seen. The initial SOC of the EV is the value SOCEV,ini which is the SOC of the car after the arrival at the HSB Living Lab. The user of the EV can also choose a required SOCEV,chosen which the battery of the EV should have at the end of the PUT. The overall charging of the EV has to be the same value as the difference between the SOC at the arrival and the departure since any charging losses that occur are neglected. P UTEV,end·12−1∑ t=P UTEV,start·12 PEV,charg(t) · ηEV EEV,max · 12 = 17·12−1∑ t=8·12 PEV,charg(t) · ηEV EEV,max · 12 = SOCEV,chosen − SOCEV,ini (3.18) The results for PEV,charg(t) for both EV will be used for the overall energy balance. 3.4 PV and Base Load Due to the many measurement sensors that permanently record data in the HSB Living Lab, the PV production and base load data for the year 2022 are known and are used in this thesis. These data are therefore loaded into the EMS in five-minute resolution and then directly inserted into the energy balance. In Figure 3.2 the PV production and the load of the HSB Living Lab of a winter day (1/24/2022) and a summer day (7/24/2022) are shown. Obviously, the PV production in summer is many times higher than in winter. In contrast, the base load is higher in winter than in summer. 24 3. Methods 0 5 10 15 20 24 Time [h] 0 1 2 3 4 5 6 7 8 9 S ol ar p ro du ct io n [k W ] 1/24/2022 7/24/2022 (a) 0 5 10 15 20 24 Time [h] 6 8 10 12 14 16 18 20 Lo ad [k W ] 1/24/2022 7/24/2022 (b) Figure 3.2: PV generation (a) and base load (b) of the HSB Living Lab on 1/24/2022 and 7/24/2022, respectively. 3.5 Controllable Loads In this thesis, washing machines, dryer and dishwasher are considered as control- lable loads. Each device has different programs with different durations and power consumptions. The power consumption and duration of the four programs available for the washing machines are exemplary shown in the Figure 3.3. For the dryer and dishwasher, as for the washing machine, there are four different programs from which the user can choose. Furthermore, the user can choose the PUT = [Tstart, Tfinish] for each device in which the device should be running. Together with the runtime length of the respective program, referred to as Length of Service (LOS), this results in several options for the period during which the device actually runs. The modeling of the power de- mand of the controllable loads so that the EMS can determine the best starting time of the controllable load is done as suggested in [53]. The method is explained using a washing machine and can be applied to dryer and dishwasher in the same way. The amount of consumption scenarios of the washing machine SW M are calculated in equation 3.19. LOSp W M is the length of the respective program and ∆t is 5 minutes as always in this thesis. 25 3. Methods 0 5 10 15 20 25 30 35 40 45 Time ( t = 5 min) 0 500 1000 1500 2000 2500 3000 P ow er C on su m pt io n [W ] Program 1 Program 2 Program 3 Program 4 Figure 3.3: Power consumption of the different washing machine programs. SW M = (Tfinish,W M − Tstart,W M)− LOSp W M ∆t (3.19) The different consumption scenarios are put in a consumption matrix. For a time horizon of T = 24 h, which corresponds to one day, the size of the matrix is T ∆t × T ∆t = 288×288. During the time steps in the PUT the power consumption of the respective program p is inserted into the matrix. The consumption matrix of the washing machine can be seen in equation 3.20. 26 3. Methods PWMp t,s =  0 · · · 0 0 0 0 · · · 0 · · · 0 0 · · · 0 0 · · · 0 0 0 0 · · · 0 · · · 0 0 · · · 0 ... · · · ... ... ... ... · · · ... · · · ... ... · · · ... 0 · · · 0 0 0 0 · · · 0 · · · 0 0 · · · 0 0 · · · 0 pwp W M,1 0 0 · · · 0 · · · 0 0 · · · 0 0 · · · 0 pwp W M,2 pwp W M,1 0 · · · 0 · · · 0 0 · · · 0 0 · · · 0 ... pwp W M,2 pwp W M,1 · · · ... · · · 0 0 · · · 0 0 · · · 0 pwp W M,np ... pwp W M,2 · · · pwp W M,1 · · · 0 0 · · · 0 0 · · · 0 0 pwp W M,np ... · · · pwp W M,2 · · · 0 0 · · · 0 ... · · · ... 0 0 pwp W M,np · · · ... · · · ... ... · · · ... 0 · · · 0 ... 0 0 · · · pwp W M,np · · · 0 0 · · · 0 0 · · · 0 0 ... 0 · · · 0 · · · 0 0 · · · 0 0 · · · 0 0 0 ... · · · 0 · · · 0 0 · · · 0 0 · · · 0 0 0 0 · · · ... · · · 0 0 · · · 0 0 · · · 0 0 0 0 · · · 0 · · · 0 0 · · · 0  ︸ ︷︷ ︸ PUT of the washing machine (3.20) The power consumption of the washing machine can be calculated according to equation 3.21 using the consumption matrix and the binary variable bp W M,s. The variable bp W M,s has a value of “1” when the washing machine is running and a value of “0” when it is not. This value is put in the overall energy balance in the end. PW M(t) = SW M∑ s=1 PWMp t,s · bp W M,s (3.21) However, there are other constraints that affect the scheduling. First, the control- lable load must start and stop the program within the PUT. However, it must also not be interrupted in the process. This means that a program, as soon as it was started, must also be terminated after the LOS. This is insured by the help of equation 3.22. 27 3. Methods SW M∑ s=1+ Tstart,W M ∆t bp W M,s = 1 (3.22) In this thesis it is assumed that on a test day, one load of laundry is washed, which is then to be dried. Therefore, the dryer must not run until the washing process is finished, because the clothes are to be dried after washing only. Therefore, the start of the PUT of the dryer needs to be higher than the end of the PUT of the washing machine. 3.6 Heat Pump For the modeling of the HP we first need to estimate the Coefficient of Perfor- mance (COP) of the HP. Here, we use the technical data from the Energy Save company to assess the COP as a function of ambient temperature and the outlet hot water temperature. The function can be seen in equation 3.23 and the corre- sponding parameters are in Table 3.3. COP = 24∑ t=1 p00 + p10 ·Tamb(t) + p01 ·Tout + p20 ·Tamb(t)2 + p11 ·Tamb(t) ·Tout + p02 ·T 2 out (3.23) Table 3.3: Data for the estimation of the COP of the modeled HP. Parameter p00 p10 p01 p20 p02 p11 Value 8.909 0.2122 -0.1823 0.0009874 0.001055 -0.002603 The current ambient temperature Tamb can be imported through an API from [54] for the coordinates of the HSB Living Lab (57.688684 N, 11.977383 E). Since the EMS is tested on a summer and a winter day, measured temperature data will be used, provided by [55]. The outlet hot water temperature is given as 35 °C (see Table 3.4). It is specified, that the temperature in the building should be Tin = 21± 1.5 °C to preserve a comfortable temperature [41]. 28 3. Methods The HP power is calculated as shown in equation 3.24 with the HP heat QHP and the COP. The given values for the heat pump in the HSB Living Lab are shown in Table 3.4. PHP (t) = QHP (t) COP (t) (3.24) Table 3.4: Data of one HP (there are two) and the district heating network in the HSB Living Lab. Parameter [Unit] Value Tout [°C] 35 PHP,max [kW] 2.5 QHP,max [kWh] 7.5 QDH,max [kWh] 100 3.7 Heat Demand Equation 3.25 shows the calculation of the heat demand of the building in one time interval. The building heat demand is based on the required indoor temperature Tin, the ambient temperature Tamb and the thermal resistance Req of the building (compare Table 3.5). Qb,d(t) = Tin(t)− Tamb(t) Req ·∆t (3.25) Additionally, to the calculated heat demand for the space heating, data for a given base heat demand for tap water Qbase is used. This data consists of measured values from the HSB Living Lab and will be added to the heat balance. Table 3.5: Data of the model of the HSB Living Lab. † Parameter [Unit] Value Req [K/kWh] 5.52 Tin [°C] 21 ± 1.5 † According to [37] 29 3. Methods 3.8 Hot Water Tank The modeling of the HWT is done as suggested in [56]. It is assumed, that the HWT is well insulated and therefore has an efficiency of ηHW T = 0.98. For the specifications of the HWT refer to Table 3.6. The HWT can be divided into two distinct layers: the hot water layer (TH , VH) and the cooling water layer (TC , VC). Each layer maintains a constant temperature, corresponding to the temperatures of the respective water networks. The HWT operates by controlling the volume of hot or cold water. When the HWT is in heat production mode, it releases thermal energy, resulting in an increase in the supply water temperature. In this context, the HWT is referred to as a heat storage tank. On the other hand, when it operates for cooling purposes, the HWT absorbs thermal energy, leading to a higher temperature of the return water. In this case, it is called a cooling storage tank. The charging and discharging power of the HWT are calculated as shown in equation 3.26 and 3.27. HT C(t) = cw · ρw · VH(t) · (TH − TC) (3.26) HT D(t) = cw · ρw · VC(t) · (TC − TH) (3.27) The relationship between energy and power in HWT is given in equation 3.28. EHW T (t) = EHW T (t− 1) + ηHW T ·∆t · (HT C(t)−HT D(t)) (3.28) 30 3. Methods Table 3.6: Specifications of the HWT in the HSB Living Lab. Parameter [Unit] Value ηHW T [%] 98 TH [°C] 35 TC [°C] 27 Vtot [l] 1500 (3 * 500 l) cw [kJ/kWK] 4168 ρw [kg/m3] 1000 31 4 Results In the following we present the results, mainly to investigate whether the costs are reduced and flexibility is provided. In order to focus on extreme weather points, the EMS is tested on a summer and a winter day. The main difference between both test days is the ambient temperature and the PV production. Figure 4.1 shows the temperatures of the summer and the winter day. On the winter day the temperature ranges 2.8 °C and 4.3 °C, while on the summer day, the temperature ranges 17.6 °C and 19.8 °C. On both days, the temperature difference between day and night is relatively low with 1.5 °C and 2.2 °C, respectively. 0 6 12 18 23 Time [h] 2.5 5.0 7.5 10.0 12.5 15.0 17.5 20.0 Te m pe ra tu re [° C] Temperature winter day Temperature summer day Figure 4.1: Temperatures of a summer and a winter day. The PV production of the summer and the winter day can be seen in Figure 4.2. On the one hand, it shows that the PV production goes on for a significantly longer time 32 4. Results in summer than in winter. This is due to the significantly longer days in summer compared to winter in Gothenburg. In addition, the amount of PV production is significantly higher in summer than in winter. Thus, the value of peak production in summer is 11.3 kW, while it is 4.7 kW in winter. On the other hand, on both days, cloudiness occurs as the PV production fluctu- ates significantly. Especially in summer, a significant decrease in production can be seen from about time 145, which corresponds to about 12 o’clock due to the division into 5 min steps. In the afternoon there is still a small peak, but it reaches only 4 kW. 0 71 215 287150 Time [5 min] 0 2 4 6 8 10 Po we r [ kW ] PV winter day PV summer day 143 Figure 4.2: PV production on a summer and a winter day. 4.1 Results for a Summer Day In the following, the results for the EMS on a summer day for cost reduction only are shown (cf. equation 3.3). The summer day is characterized by a high PV production and lower heat demand due to moderate ambient temperatures. 33 4. Results 4.1.1 Battery Energy Storage As described in Chapter 3, the developed EMS is able to manage several devices. Figure 4.3 shows the SOC of the BES together with the DA price. The price is in a range from 0.56 SEK/kW at 0 o’clock to 1.52 SEK/kW at 19 o’clock. Until 3 o’clock (in the graph point of time 36) it is decreasing to a value of 0.38 SEK/kW and then goes up to a local maximum of 1.06 SEK/kW at 9 o’clock (108). Until 14 o’clock (168) the price is decreasing again to 0.52 SEK/kW. The global maximum 1.52 SEK/kW is reached at 19 o’clock (228). Afterwards the price is decreasing again to a global minimum of 0.29 SEK/kW at 23 o’clock (276). 0 71 215 287150 Time [5 min] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 St at e of C ha rg e [% ] 0.4 0.6 0.8 1.0 1.2 1.4 Pr ice [S EK /k W h] BES SOC DA price 143 Figure 4.3: SOC of the BES and the DA price on a summer day. At the beginning of the day, the SOC of the BES is equal to 10 %, the selected minimum allowable SOC. As described in Chapter 3, one goal of the EMS is to reduce the overall cost. Thus, if possible, the storage should be charged at times when electricity prices are favorable. Indeed, this can be seen very clearly at the beginning. As soon as the electricity price reaches its lowest value at 3 o’clock (in the graph point of time 36), the storage is charged to its maximum SOC. At the price at 2 o’clock (48) the storage is charged only for a short moment, because other- wise the time of the favorable prices is not sufficient to reach the desired SOC of 90 %. 34 4. Results Subsequently, the storage is not in use until the time of high electricity prices (108) and is then gradually discharged. As soon as it reaches the minimum value of 10 % SOC at time 200, it is charged again. However, this is only done until time 216 (18 o’clock), because then the DA price reaches approximately its maximum value. At time 228, with the highest current price of the day, the storage is discharged again. Compared to the whole day, the price of the time the BES is charging is not really cheap, but it significantly cheaper than in the hour afterwards when it is dis- charged. As a result, the charged energy can be used at the time of the highest DA prices and thus overall money is saved despite higher charging prices. Afterwards, charging is discontinued because electricity prices fall steadily and it is therefore not economically advantageous, based on this one day under consideration, to load the storage unit again. It is cheaper to draw the required electricity directly from the grid instead of from the storage. Since no rolling horizon is used for the optimiza- tion, the next day is not considered and it is economically most favorable to empty the storage at the end of the day which equals to the starting point of the next day. Figure 4.4 shows the BES charging power along with the DA price and PV produc- tion. Here, the BES does not seem to be charged by the electricity produced by the PV system, but with the energy from the power grid instead. At the times when the PV production is high, the storage is not charged, which can be seen very well since the PV production is high when the DA price takes expensive values. 35 4. Results 0 71 215 287150 Time [5 min] 0 2 4 6 8 10 Po we r [ kW ] 0.4 0.6 0.8 1.0 1.2 1.4 Pr ice [S EK /k W h] BES Pcharge PV DA price 143 Figure 4.4: Charging power of the BES with the DA price and the PV production on a summer day. 4.1.2 Base Load The base load is defined as the minimum amount of electricity or energy that a build- ing or power system continuously requires to operate its essential and non-variable systems. It includes the constant power demand needed to maintain essential ser- vices like lighting, heating, ventilation, refrigeration, and other critical functions. The base load typically remains relatively constant throughout the day and is es- sential for maintaining the building’s functionality and comfort. Figure 4.5 shows the HSB Living Lab’s base load (green) along with the BES charg- ing and discharging power (blue and orange, respectively) and the grid load (red). The BES is charged with the power from the grid only. In the period of the first charging of the BES, the grid power obviously is the sum of the base load and the charging load of the BES. The grid load is then reduced because the PV production (not shown in this graph) starts. In the period of recharging the storage, the grid load is approximately the sum of the base load and the charging load of the BES. During the subsequent discharge of the BES, the grid load is approximately equal to the difference between the base load and the discharge load of the BES. 36 4. Results 0 71 215 287150 Time [5 min] 0 2 4 6 8 10 12 14 16 Po we r [ kW ] BES Pcharge BES Pdischarge Base load Grid 143 Figure 4.5: Charging and discharging power of the BES with the base load and the power drawn from the grid on a summer day. 4.1.3 Controllable Loads Controllable loads in our context include washing machine, dryer and dishwasher (see Chapter 3.5). The use of controlled loads is shown in Figure 4.6. For each component, we see the actual period of use and the required power. For the PUT of the different devices refer to Table 4.1. Table 4.1: Used PUTs of the controllable loads. Device Start [h] End [h] Start [5 min] End [5 min] Washing machine 7 12 84 144 Dryer 12 15 144 180 Dishwasher 20 23 240 276 All controllable loads only exist once and only run once on the test day. The first load to run on this day is the washing machine. The PUT of this system is 7 to 12 o’clock, which in the graph corresponds to the period from 84 to 144. The washing machine actually runs from time 84 to 126, so it starts at the earliest possible time. Here, 37 4. Results the DA price in the possible period is cheapest at the beginning. It can therefore be assumed that the washing machine is fed from the grid and not from the PV system. 0 71 215 287150 Time [5 min] 0.0 0.5 1.0 1.5 2.0 2.5 3.0 Po we r [ kW ] 0.4 0.6 0.8 1.0 1.2 1.4 Pr ice [S EK /k W h] WM DY DW DA price 143 Figure 4.6: Consumption of the controllable loads with the DA price on a summer day. The PUT of the dryer is from time 144 to 180. Actually, the dryer runs from time 157 to 172. Thus, it runs rather at the end of the possible period. Within the period it starts at the beginning of the second lowest DA price and ends in the middle of the period in which the lowest DA price is valid. Since the period with the lowest price is not fully used, it can be assumed that at least part of the power comes from the BES or the PV system. The PUT of the dishwasher goes from time 240 to 276, which ends before the daily lowest DA price is reached. Within the possible time period, the dishwasher runs from time 251 to 274. It thus starts with the price of 21 o’clock, which is signifi- cantly lower than the price of 20 o’clock. In the graphs above, it can be seen that the storage is already completely discharged at time 251 and also the PV produc- tion is at 0. The dishwasher runs in the time where energy from the grid is cheapest. 38 4. Results 4.1.4 Electric Vehicles Figure 4.7 shows the graphs required to analyze the charging of the two EVs. Figure 4.7a and 4.7b show the charging power of EV 1 and EV 2 respectively. Figure 4.7c shows the charging and discharging power of the BES, as well as the PV production and grid power. Table 4.2 shows the PUT of the EVs, which is 8 a.m. to 5 p.m. for both cars, since it is assumed that the EVs charge only during working hours. In fact, the EVs are charged from time 96 to 200 and 96 to 202, respectively. Accordingly, the possible charging period is almost fully utilized. In Figure 4.7a and 4.7b, it can be seen that both the charging power and the times at which charging actually takes place vary over the charging period. In Figure 4.7c, it is noticeable that the grid power constantly equals the peak power (16.12 kW) during the charging process of the EV. Since the peak power is included in the price calculation of the electricity (compare Chapter 3.1.2), the peak power value obviously is optimal. Since the peak power is lower than the sum of the charging power of both EVs, it seems that both the PV production and the discharge power of the storage are used to charge the EVs. Table 4.2: Used PUTs of the EVs. Device Start [h] End [h] Start [5 min] End [5 min] ∆ SOC [%] EV 1 8 17 96 204 70 EV 2 8 17 96 204 70 Obviously, the BES is discharged when the PV production takes its lower values. Furthermore, in the time range from about 150 to 180, when the PV production is relatively low for a longer period of time, the charging power of the EV is signifi- cantly reduced or sometimes even completely interrupted (compare Figure 4.7a, time 163 to 170). Afterwards, approximately at time 180, when the PV production takes on higher values again, the EVs are charged again with a higher charging power. 39 4. Results At the same time, the BES is also discharged, so that this energy is apparently also used to charge the EVs. So, the BES is not charged again until the EVs are charged. This is also related to the pricing of the peak power. If the BES were charged at the same time as the EVs, the peak power would take on higher values, so the storage is only charged after the EVs. 40 4. Results 0 71 215 287150 Time [5 min] 0 2 4 6 8 10 Po we r [ kW ] EV 1 Pcharge 143 (a) Charging power of EV 1 0 71 215 287150 Time [5 min] 0 2 4 6 8 10 Po we r [ kW ] EV 2 Pcharge 143 (b) Charging power of EV 2 0 71 215 287150 Time [5 min] 0 2 4 6 8 10 12 14 16 Po we r [ kW ] BES Pdischarge BES Pcharge PV Grid 143 (c) BES charging & discharging, PV production and grid Figure 4.7: Charging of the EVs at the HSB Living Lab on a summer day. 41 4. Results 4.1.5 Heating Demand and Heating of the HSB Living Lab Figure 4.8a shows the outdoor temperature and the corresponding heat demand of the building which consists of space heating and hot water demand. The tempera- ture ranges from 17.6 °C to 19.8 °C. The heat demand of the building to maintain the room temperature at 21 ± 1.5 °C as well as the base heat demand for provid- ing hot water ranges from 5 kWh at night to 11 kW at midday. Most of the time, however, it varies between 6 and 7 kWh. This heat demand is only covered by the district heating in summer, since the HP is switched off in summer. This makes it possible to see the influence of HP on the provision of flexibility on the winter day. 0 71 215 287150 Time [5 min] 5 6 7 8 9 10 11 He at [k W ] 17.5 18.0 18.5 19.0 19.5 Te m pe ra tu re [° C] Qdemand Tamb 143 (a) Heat demand 0 71 215 287150 Time [5 min] 0 2 4 6 8 10 He at [k W ] QDH QHP 143 (b) Heat provided by district heating and HP Figure 4.8: Heat demand and heating of the HSB Living Lab on a summer day. 42 4. Results Figure 4.8b shows the heat output of the HP and the district heating. As mentioned above, the HP is deactivated, so the heat output is constant at 0. The heat output of the district heating has visually the same curve as the heat demand of the building. 4.1.6 Reduction of Costs In Table 4.3 the costs for the summer day with and without the EMS are shown. The implementation of the EMS leads to significantly reduced costs by 170.66 SEK which corresponds to a percentage reduction of 15.51 %. Table 4.3: Reduction of costs on a summer day. Without EMS With EMS Energy Costs [SEK] 1099.98 929.32 Costs Savings [SEK] – 170.66 Reduction [%] – 15.51 4.2 Results for a Winter Day The EMS is tested on a winter day as well. As for the summer day, the objective function 3.3 for cost reduction is considered first. The difference to the summer day are the lower ambient temperatures and the lower PV production. Additionally, the HP is running during winter, which is why the HWT is also considered. If only district heating is used, this makes no difference, as the district heating price is constant. 4.2.1 Battery Energy Storage As in the summer day, the first application considered, is the BES. Figure 4.9 shows the SOC of the BES and the DA price. The price first moves from 1.2 SEK/kWh at the beginning of the day to a global minimum of 1.0 SEK/kWh (2 o’clock, in the graph point of time 24). It then reaches the global maximum at 8 o’clock (96) with a price of 2.25 SEK/kWh, before it drops again and reaches a price of 1.2 SEK/kWh 43 4. Results at 15 o’clock (180). At 19 o’clock (228), the price is 2.2 SEK/kWh before it drops to just under 1.3 SEK/kWh at the end of the day. 0 71 215 287150 Time [5 min] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 St at e of C ha rg e [% ] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 Pr ice [S EK /k W h] BES SOC DA price 143 Figure 4.9: SOC of the BES and the DA price on a winter day. The BES has an initial SOC of 10 % in winter also. It can be seen that, as in the summer day, it is charged to 90 % (the fixed maximum charged energy) at the times of favorable DA prices at the beginning of the day. At 4 o’clock (48), the BES is fully charged and is not used until time 96. This is the time when the highest daily price applies. From then on, the BES is gradually fully discharged until it reaches the initial 10 % (the specified minimum charged energy) again at time 192. After that the BES will be charged again up to about 25 % from time 200. At this time, the DA price is higher than at the beginning of the day, but since it continues to rise afterwards, from a financial point of view it still makes sense to charge the storage. Of course, this is only valid as long as the energy is still needed on this day. At the end of the day, the BES will have a SOC of 10 % again, which corresponds to the initial status. Figure 4.10 shows the BES charging power along with the DA price and PV produc- tion. It can be seen generally, that the PV production is much shorter on the winter day compared to the summer day due to the lower number of sunshine hours. While in summer it goes from time 40 to 230 (compare figure 4.4), in winter it goes from 44 4. Results time 95 to 180. The peak power is with 4.5 kW significantly lower than in summer with 11 kW. 0 71 215 287150 Time [5 min] 0 1 2 3 4 Po we r [ kW ] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 Pr ice [S EK /k W h] BES Pcharge PV DA price 143 Figure 4.10: Charging power of the BES with the DA price and the PV production on a winter day. It can also be seen that, as in summer, the BES is not charged with the energy from PV production. The PV production takes place at times of high DA prices, when the BES is discharged, because a lot of energy is needed. 4.2.2 Base Load Figure 4.11 shows the HSB Living Lab’s base load (green) along with the BES charg- ing and discharging power (blue and orange, respectively) and the grid load (red). The BES is charged with the power from the grid only. In the period of the first charging of the BES, the grid power obviously is the sum of the base load and the charging load of the BES. 45 4. Results 0 71 215 287150 Time [5 min] 0 5 10 15 20 25 Po we r [ kW ] BES Pcharge BES Pdischarge Base load Grid 143 Figure 4.11: Charging and discharging power of the BES with the base load and the power drawn from the grid on a winter day. 4.2.3 Controllable Loads Figure 4.12 shows the period of use and the power required by the controllable loads. For PUTs of the different devices refer to Table 4.1, the same PUTs are used as for the summer day. The first load to run, even in winter, is the washing machine. The PUT is from time 84 to 144. In fact, the washing machine runs from time 84 to 126 and thus starts at the earliest possible time. The DA prices are basically high in the period of PUT. However, at the times of highest prices (the hour starting at time 96), the washing machine has relatively lower consumption, and the consumption peaks are before and after this hour with the daily highest DA prices. The dryer’s PUT is from time 144 to 180. It actually runs from time 149 to 164. Electricity prices are comparatively high during this period, but as can be seen in Figure 4.11, from time 100 to 200, grid power is consistently equal to peak grid power. So, in the end, it does not matter when exactly the dryer is running and 46 4. Results when the EVs are charged. During this period, it is important that the peak power is not increased, otherwise this would result in higher costs. The PUT of the dishwasher goes from time 240 to 276. This actually runs from time 251 to 274. It thus runs at the end of the possible period, which can be justified by the fact that the DA prices drop at the end of the day and it is therefore financially more advantageous to use the energy as late as possible. 0 71 215 287150 Time [5 min] 0.0 0.5 1.0 1.5 2.0 2.5 3.0 Po we r [ kW ] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 Pr ice [S EK /k W h] WM DY DW DA price 143 Figure 4.12: Consumption of the controllable loads with the DA price on a winter day. 4.2.4 Electric Vehicles The charging power of EVs is shown in Figure 4.13, where Figure 4.13a shows the power of EV1 and Figure 4.13b shows the power of EV2. Figure 4.13c shows the charging and discharging power of the BES as well as the PV production and the grid power. The PUT of the EVs is the same as on the summer day and goes from 8 a.m. to 5 p.m. (in the graph time 95 to 203). The EVs are actually charged from time 97 to 195 and 97 to 203 respectively, thus utilizing almost the entire possible charging time. The charging power varies for both EVs. In Figure 4.13c it can be seen that during the charging time of the EVs the grid power constantly assumes the peak 47 4. Results value of 24.01 kW. This value is obviously the lowest possible peak value of the grid power, since it is included in the calculation of the costs. It can also be seen that the charging peaks of the EVs are opposite. Since the PV production is relatively low, most of it has to be taken from the grid. Considering the pricing of the peak consumption, it makes sense to distribute the charging power as much as possible. During charging of the EVs, the BES is also completely discharged (compare Figure 4.9). Even before time 200, it has reached the lowest possible state of charge. It is not charged again until the charging process of the EVs is completed. This can also be explained by the pricing of the peak power. 48 4. Results 0 71 215 287150 Time [5 min] 0 2 4 6 8 10 Po we r [ kW ] EV 1 Pcharge 143 (a) Charging power of EV 1 0 71 215 287150 Time [5 min] 0 2 4 6 8 10 Po we r [ kW ] EV 2 Pcharge 143 (b) Charging power of EV 2 0 71 215 287150 Time [5 min] 0 5 10 15 20 25 Po we r [ kW ] BES Pdischarge BES Pcharge PV Grid 143 (c) BES charging & discharging, PV production and grid Figure 4.13: Charging of the EVs at the HSB Living Lab on a winter day. 49 4. Results 4.2.5 Heating Demand and Heating of the HSB Living Lab Figure 4.14a shows the heat demand of the HSB Living Lab. This consists of the heating demand and the hot water demand. The heat demand ranges from 9 kW to 36 kW. The outdoor temperatures are relatively constant at 2.8 to 4.3 °C. Figure 4.14b shows the heat generation composed of HP, district heating, and the HWT. The HWT cannot be loaded and unloaded at the same time and is half full at the beginning of the day. At the beginning of the day, the tank is then first filled up until more heat is needed from 6 to 7 o’clock and it becomes empty again. 0 71 215 287150 Time [5 min] 10 15 20 25 30 35 He at [k W ] 2.8 3.0 3.2 3.4 3.6 3.8 4.0 4.2 Te m pe ra tu re [° C] Qdemand Tamb 143 (a) Heat demand 0 71 215 287150 Time [5 min] 0 5 10 15 20 25 30 35 40 He at [k W ] QDH QHP HWT Qcharge HWT Qdischarge 143 (b) Heat provided by district heating and HP Figure 4.14: Heat demand and heating of the HSB Living Lab. 50 4. Results It can also be seen that outside the period from time 95 to 203 (which corresponds exactly to the PUT of the EVs), the HP provides most of the heat demand. It either provides all the heat demand or provides the maximum HP heat QHP and is additionally supported by district heating and HWT. In the period when the EV is charged, however, the HP is inactive. If it were running, then the peak demand drawn from the grid would be higher and therefore result in higher total costs than using the district heating and HWT. The HWT is mainly emptied during the pe- riod. We also see that the heat output of HP and district heating differs from the required heat output exactly when the HWT is filled or emptied. 4.2.6 Reduction of Costs In Table 4.4 the costs of the HSB Living Lab on the winter day with and without the developed EMS are shown. The total cost reduction is 221.83 SEK, which cor- responds to a percentage reduction of 9.72 %. Table 4.4: Reduction of costs on a winter day. Without EMS With EMS Energy Costs [SEK] 2282.28 2060.45 Costs Savings [SEK] – 221.83 Reduction [%] – 9.72 4.3 Flexibility Summer Day The results for the providing of flexibility on a summer day are shown in the fol- lowing section. As the objective function, equation 3.7 is used. Since the results are strongly depending on the offered price for the flexibility, a sensitivity analysis of the price for the flexibility is done first. 4.3.1 Sensitivity Analysis for Price of Flexibility A sensitivity analysis [57] is performed to examine the impact of the price received on the provision of flexibility. 51 4. Results The compensation for the flexibility is given in equation 3.5 in Chapter 3. On the summer day for n, the values 1 to 5 are investigated since the amount of offered flexibility changes within that change in the amount of compensation. Figure 4.15 shows the result of the sensitivity analysis. The left y-axis represents the provided flexibility and the right y-axis the overall costs for the HSB Living Lab for a day as well as the income through the providing of flexibility. 1 2 3 4 5 n * Price flexibility 85 90 95 100 105 110 115 Am ou nt o f F le xi bi lit y [k W h] 100 200 300 400 500 600 700 800 900 Co st s [ SE K] sum(P_flex) Income flex Costs HSB Figure 4.15: Sensitivity Analysis of the price for flexibility on a summer day. We see that both the amount of flexibility provided and the generated income in- creases, while the overall cost of the HSB Living Lab goes down. At a factor of n = 1 and n = 2, the price of provided flexibility is too low to shift loads, so the quantity of it is consistently small. Only above a factor of n = 2 is it financially advantageous to shift loads to provide flexibility. However, the amount of provided flexibility has reached its maximum at a factor of n = 4 and remains constant at the same value at n = 5. Nevertheless, by increasing the price of flexibility, the revenue at n = 5 is higher than at n = 4 and thus the total cost diminishes further. An even higher value for n would only increase the compensation, but the amount of flexibility offered would remain the same. 52 4. Results 4.3.2 Provision of Flexibility on a Summer Day The results for the heating on a summer day are the same with and without the providing of flexibility since the HP is not running in summer. Thus, the results for the heating are not presented again in this section but can be seen in Chapter 4.1.5. The other results are shown for a value in the flexibility price of n = 3 since at this value only a part of the possible flexibility is provided, and for a value of n = 5. With a value of n = 4 or 5, all shiftable loads would be shifted because of the high price for the flexibility. With a value of n = 3, some loads obviously are shifted, but not all, as shown in the following section. In Figure 4.16 the results of the electrical components and the flexibility are shown for a factor of n = 5 in the price. Except from the dryer, whose PUT is within the time of flexibility, all devices are shifted to the times before and after the providing of flexibility which is from time 144 (12 o’clock) until time 180 (15 o’clock). The BES is fully discharged during the time of flexibility. The available flexibility can be seen in Figure 4.16c. It represents the difference between the upper capacity limit PL,peak and the net grid power. Since no energy is exported to the grid, the net grid power is equivalent to the imported grid power PGrid,im. Due to the running dryer, a drop shows up in the flexibility during this time. In Figure 4.17 the results for the possible flexibility with a value of n = 3 are shown. Compared to the results with n = 5, the amount of provided flexibility is reduced after approximately a third of the time of provided flexibility. At this time, the price of electricity is low, so this is the worst time to shift loads with respect to financial considerations. It is also noticeable that, in contrast to the first variant, the BES is not completely discharged at the end of the flexibility period. It is completely discharged only around time 200 before it is subsequently charged again. At this point, higher elec- tricity prices prevail, so from a financial point of view, it makes sense to provide less flexibility and instead use the energy of the BES when electricity prices are higher. EVs are also partially charged during the flexibility period. This takes place less than without providing flexibility, but significantly more than when the flexibility price has a factor of n = 5. In the comparison of the two imported grid capacities 53 4. Results at different compensations for the offered flexibility, the imported grid capacity is significantly higher with a higher compensation for flexibility before and after the flexibility period than with the lower compensation. So, it makes sense that this energy is purchased from the grid only when the compensation for flexibility is cor- respondingly higher. 54 4. Results 0 71 215 287150 Time [5 min] 0 2 4 6 8 10 12 14 16 Po we r [ kW ] BES Pdischarge BES Pcharge Base Load PV 143 (a) BES charging and discharging, base load and PV 0 71 215 287150 Time [5 min] 0 2 4 6 8 10 Po we r [ kW ] EV Pcharge EV2 Pcharge WM DY DW 143 (b) Charging of EVs and controllable loads 0 71 215 287150 Time [5 min] 0 10 20 30 40 Po we r [ kW ] 0.4 0.6 0.8 1.0 1.2 1.4 Pr ice [S EK /k W h] Pflex PL, peak PGrid, im PGrid, ex DA price 143 (c) Flexibility, grid load and DA price Figure 4.16: Electrical loads with flexibility on a summer day with n = 5. 55 4. Results 0 71 215 287150 Time [5 min] 0 2 4 6 8 10 12 14 16 Po we r [ kW ] BES Pdischarge BES Pcharge Base Load PV 143 (a) BES charging and discharging, base load and PV 0 71 215 287150 Time [5 min] 0 2 4 6 8 10 Po we r [ kW ] EV Pcharge EV2 Pcharge WM DY DW 143 (b) Charging of EVs and controllable loads 0 71 215 287150 Time [5 min] 0 10 20 30 40 Po we r [ kW ] 0.4 0.6 0.8 1.0 1.2 1.4 Pr ice [S EK /k W h] Pflex PL, peak PGrid, im PGrid, ex DA price 143 (c) Flexibility, grid load and DA price Figure 4.17: Electrical loads with flexibility on a summer day with n = 3. 56 4. Results 4.4 Flexibility Dispatch Winter Day The results for the providing of flexibility on a winter day are discussed in the next section. The used objective function can be seen in equation 3.7. First, a sensitivity analysis is performed to investigate how the offered flexibility on winter day depends on the compensation. 4.4.1 Sensitivity Analysis for Price of Flexibility As for the summer day, a sensitivity analysis was performed for the winter day to examine the change in flexibility provided with increased compensation. As for the summer day, for n the values 1 to 5 were chosen. The result of the sensitivity analysis is shown in Figure 4.18. It can be seen that the flexibility provided is constant. Ob- viously, the entire flexibility possible is offered already at the lowest compensation. From this, it follows that the revenues increase linearly with an increased compen- sation and the total costs for the HSB Living Lab decrease linearly accordingly. 1 2 3 4 5 n * Price flexibility 140 142 144 146 148 150 152 154 Am ou nt o f F le xi bi lit y [k W h] 400 600 800 1000 1200 1400 1600 1800 Co st s [ SE K] sum(P_flex) Income flex Costs HSB Figure 4.18: Sensitivity Analysis of the price for flexibility on a winter day. 4.4.2 Provision of Flexibility on a Winter Day Since the flexibility provided does not change on the winter day with a change in compensation, it does not matter which results are considered since the change in 57 4. Results output is the same in each case. In Figure 4.19, the available flexibility is shown in blue. As with the summer day, this is the difference between upper capacity limit PL,peak and imported grid power PGrid,im. The time of the flexibility demand is set from 18 to 21 o’clock. Therefore, the avail- able flexibility is calculated only for this period. Figure 4.19 shows the power of the components controlled by the EMS. The only electrical component active in this area is the dishwasher. Due to the fixed PUT, it is not possible to shift its operating time to outside the flexibility call. Moreover, the HP is deactivated at the time of the flexibility call. So, in this scenario, it is deactivated in addition to the charging period of the EVs. Outside of these two periods, as much heat as possible continues to be provided by the HP. The required heat is provided only by the district heating and the HWT in the period of charging the EVs and in the period of demand for flexibility. The HWT is filled at the beginning of the day and then almost only emptied in both periods in order to require less district heating power. In the beginning of the day, the DA price is low and it is possible to cover the heat demand of the building and to refill the HWT with the HP, which is the cheapest option. 0 71 215 287150 Time [5 min] 0 10 20 30 40 50 Po we r [ kW ] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 Pr ice [S EK /k W h] Pflex PL, peak PGrid, im PGrid, ex DA price 143 Figure 4.19: Flexibility, grid load and DA price on a winter day. 58 4. Results 0 71 215 287150 Time [5 min] 0 5 10 15 20 Po we r [ kW ] BES Pdischarge BES Pcharge Base Load PV 143 (a) BES charging and discharging, base load and PV 0 71 215 287150 Time [5 min] 0 2 4 6 8 10 Po we r [ kW ] EV Pcharge EV2 Pcharge WM DY DW 143 (b) Charging of EVs and controllable loads 0 71 215 287150 Time [5 min] 0 10 20 30 40 He at [k W ] HP DH HWT Qcharge HWT Qdischarge 143 (c) HP, district heating and HWT charging and discharging Figure 4.20: Electrical loads with flexibility on a winter day. 59 4. Results 4.5 Differences Between a Summer and a Winter Day In this section, the variations in provided flexibility and associated cost savings be- tween the summer and the winter day are explored. In Table 4.5 the comparison of maximum and medium provided flexibility is shown. In winter, the amount of provided flexibility is generally higher than in summer. In summer, the amount of provided flexibility is changing with a change in compensa- tion while it is constant in winter. Table 4.5: Comparison of the provided flexibility on a summer and a winter day. max. provided flexibility medium provided flexibility Summer day 114.32 kWh 99.96 kWh Winter day 146.88 kWh 146.88 kWh Additionally, we analyze the potential cost reduction achieved through the utiliza- tion of flexibility resources. The results are outlined in Table 4.6, showcasing the cost differences under various scenarios: without the EMS, with the EMS with only cost reduction, and with the EMS with additional providing of flexibility (with n = 3). Table 4.6: Reduction of costs with the providing of flexibility. Without EMS With EMS With Flex. (n = 3) Summer Energy Costs [SEK] 1099.98 929.32 482.61 Winter Energy Costs [SEK] 2282.28 2060.45 979.73 Summer Costs Savings [SEK] – 170.66 617.37 Winter Costs Savings [SEK] – 221.83 1302.55 Summer Reduction [%] – 15.51 56.13 Winter Reduction [%] – 9.72 57.07 60 4. Results The introduction of an EMS results in notable cost savings, which are further en- hanced when flexibility is provided. The reduction percentages highlight the poten- tial for substantial savings during both seasons. When flexibility is provided, the percentage cost reduction for summer and winter is very high amounting to 56.13 % and 57.07 %, respectively. These are very close to each other, which makes a sig- nificant difference especially when comparing the use of the EMS without providing flexibility, as the reduction is much larger. When only reducing the cost, the cost reduction was significantly greater on the summer day than on the winter day. Both summer and winter energy costs can be significantly reduced through effective en- ergy management strategies. 61 5 Discussion In this chapter, we delve into the implications and insights derived from the results presented in the previous chapter. We analyze the effectiveness of the developed EMS in optimizing energy consumption, reducing costs, and providing flexibility, while also addressing the variations observed between a summer and a winter day. The results presented in Chapter 4 demonstrate the potential of the EMS in effec- tively managing various energy resources within the HSB Living Lab. By strate- gically controlling devices such as the BES, controllable loads, and the charging of EVs, the EMS successfully reduces energy costs and provides a significant level of flexibility to cope with demand fluctuations. The analysis of the system’s actions throughout the two test days in summer and winter, respectively, reveals some interesting patterns. During the summer day, the longer daylight hours and higher PV production contribute to a higher energy sur- plus available for optimization. The EMS optimally schedules the BES charging and discharging cycles to minimize costs and maximize self-consumption of solar energy. Additionally, the controllable loads and EV charging are intelligently managed to leverage low-cost periods, resulting in substantial cost savings. Notably, the intro- duction of flexibility provisioning further enhances the cost reduction potential. The sensitivity analysis underscores the direct correlation between the compensation for flexibility and the amount of flexibility provided. This implies that by setting an appropriate compensation rate, the HSB Living Lab can efficiently participate in demand response programs while benefiting financially. In contrast, the winter day presents its own set of challenges due to reduced daylight hours and lower PV production. Here, the EMS succeeds in adapting its strategies to efficiently utilize available energy resources. The active management of the BES and the optimization of controllable loads contribute to significant cost reductions. 62 5. Discussion Interestingly, in the case of the winter day, the sensitivity analysis suggests that the entire potential flexibility is offered even at lower compensation rates. By comparing the two seasons, the winter day displays a higher overall energy flexi- bility due to more complex consumption patterns as the heating systems comes into play. However, the summer day provides a greater opportunity for self-consumption of solar energy, resulting in lower energy import from the grid. These variations underline the importance of seasonal adaptation in the EMS strategies to maximize the benefits across different conditions. However, the levels of flexibility between summer and wint