Scheduling of Heat Pumps Using Genetic Algorithms

0 downloads 0 Views 5MB Size Report
COPmax can be derived from the Carnot e ciency of a heat engine which is the ...... maximum number of generations is set manually and due to the fact that the ...
Institut für Angewandte Informatik und Formale Beschreibungsverfahren

Scheduling of Heat Pumps Using Genetic Algorithms Bachelorarbeit von Fabian Neumann

an der KIT-Fakultät für Wirtschaftswissenschaften In dem Studiengang Wirtschaftsingenieurwesen

eingereicht am 14. Juli 2016 beim Institut für Angewandte Informatik und Formale Beschreibungsverfahren des Karlsruher Instituts für Technologie

Referent: Prof. Dr. Hartmut Schmeck Betreuer: Dipl.-Wirt.-Ing. Sebastian Steuer

KIT – Die Forschungsuniversität in der Helmholtz-Gemeinschaft

Ich versichere wahrheitsgemäß, die Arbeit selbstständig verfasst, alle benutzten Hilfsmittel vollständig und genau angegeben und alles kenntlich gemacht zu haben, was aus Arbeiten anderer unverändert oder mit Abänderungen entnommen wurde sowie die Satzung des KIT zur Sicherung guter wissenschaftlicher Praxis in der jeweils gültigen Fassung beachtet zu haben. Karlsruhe, July 12, 2016

.................................... (Fabian Neumann)

Abstract The increasing share of renewable energy implicates challenges to the power grid. Due to the volatility of its generation, the probability of intermittent electricity deficiency or excess rises. As a stable power grid requires a balanced demand and supply of power, one smart reaction to the resulting challenges is to schedule electric bulk consumers in single households to times where electric energy is available in abundance. Especially heat pumps in connection with thermal storages that can consume electric power when demand is low and allow for a deferred usage of the stored energy by buffering, bear significant potential for intelligent demand-side management. In this thesis a genetic algorithm is implemented that optimises the schedule of a heat pump over a specified horizon such that operation costs are minimised while thermal demands are satisfied at any given moment. It is assumed that the demand for flexible device operation resulting from a highly fluctuating supply side is expressed by dynamic electricity prices. High prices prompt a reduction of electricity use while low prices ask for more consumption of electricity. In particular, this work considers the trade-off between the flexible employment of heat pumps and a loss in efficiency due to overheating in the considered heat storages by modelling a variable coefficient of performance. With regards to the application of the genetic algorithm to the heat pump scheduling problem, an optimal set of operators and parameters is sought besides developing a suitable genotype representation and fitness evaluation function. Moreover, in order to enhance performance heuristic approaches are incorporated into the algorithm using problem-specific knowledge. The final parametrisation was evaluated regarding its robustness towards varying price profiles and uncertainty in thermal energy demand. The operating costs after optimisation were compared to the operation costs of a heatdriven heat pump control. The results of this work reveal that the extent of savings depends on the spreading of the price signal which therefore constitutes a major option to further incentivise demand-side management.

i

Zusammenfassung Der steigende Anteil erneuerbarer Energien an der Energieerzeugung stellt das Stromversorgungsnetz vor neue Herausforderungen. Durch die damit zunehmende Volatilität der Stromproduktion erhöht sich die Häufigkeit zwischenzeitlichen Stromüberschusses oder -mangels. Da ein stabiles Stromnetz zu jedem Zeitpunkt ein Gleichgewicht zwischen Stromnachfrage und -angebot erfordert, besteht eine mögliche Reaktion auf die daraus entstehenden Herausforderungen darin, die Betriebszeiten elektrischer Großverbraucher eines einzelnen Haushalts auf Momente zusätzlicher Stromverfügbarkeit zu verschieben. Speziell Wärmepumpen in Verbindung mit thermischen Speichern, die elektrische Energie in nachfrageschwachen Zeiten aufnehmen können und eine verzögerte Verwendung durch Pufferspeicherung in thermischer Form ermöglichen, bergen beträchtliches Potenzial für eine intelligente Nachfragesteuerung. In dieser Arbeit wurde ein genetischer Algorithmus implementiert, welcher die Betriebszeiten einer Wärmepumpe über einen gewissen Optimierungshorizont hinweg optimiert, sodass die Betriebskosten unter der Bedingung, dass Heiz- und Warmwasserbedarf jederzeit gedeckt werden, minimiert werden. Es wird angenommen, dass die Nachfrage nach Flexibilität durch variable Strompreise angezeigt wird. Während hohe Preise zu einer Reduzierung des Stromverbrauchs anhalten, fordern niedrige Preise zu einem erhöhten Konsum auf. Die vorliegende Arbeit betrachtet besonders die Abwägung zwischen einem flexiblen Einsatz von Wärmepumpen und einem Effizienzverlust durch überheizte Pufferspeicher, indem ein variabler Leistungskoeffizient modelliert wird. Hinsichtlich der Anwendung des genetischen Algorithmus auf das Optimierungsproblem wurde ein möglichst guter Parametersatz inklusive geeigneter Operatoren gesucht. Um die Leistung des Algorithmus zu verbessern, wurden zudem heuristische Ansätze in den Ablauf integriert. Darüber hinaus wurde die finale Parametrisierung auf Robustheit gegenüber variierenden Preissignalen und Unsicherheiten des Wärmebedarfs untersucht. Die Betriebskosten nach der Optimierung wurden mit den Betriebskosten eines wärmegeführten Hystereseansatzes als Wärmepumpensteuerung verglichen. Die Ergebnisse dieser Arbeit zeigen, dass die Höhe der Einsparungen von der Spreizung des Preissignals abhängen und diese damit einen wichtigen Anreiz für die Anschaffung von Nachfragesteuerungsgeräten darstellt.

iii

Contents Abstract

i

Zusammenfassung

iii

1. Introduction

1

1.1. Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2. Goal Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3. Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2. Scenario and Approach

5

2.1. Scenario . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.1. Heat Pumps with Two Storages . . . . . . . . . . . . . . . 2.1.2. Thermal Load Profile . . . . . . . . . . . . . . . . . . . . . 2.1.3. Electricity Markets and Tariffs . . . . . . . . . . . . . . . . 2.2. Definition of the Optimisation Problem . . . . . . . . . . . . . . . 2.3. Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4. Evolutionary Algorithms . . . . . . . . . . . . . . . . . . . . . . . 2.4.1. Suitability . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4.2. Functioning Principles . . . . . . . . . . . . . . . . . . . . 2.4.3. Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4.4. General Approach to Designing Evolutionary Algorithms

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

3. Design and Implementation

3.1. Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.1. Simulation Environment . . . . . . . . . . . . . . . . . . 3.1.2. Architecture of jMetal Library . . . . . . . . . . . . . . . 3.2. Genotype-Phenotype Translation . . . . . . . . . . . . . . . . . 3.3. Fitness Evaluation and Constraint Handling . . . . . . . . . . . 3.3.1. Feasibility Preservation by Reparation . . . . . . . . . . 3.3.2. Bias Against Infeasible Individuals by Penalty Functions 3.4. Initial Populations . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.1. Arbitrary Solutions . . . . . . . . . . . . . . . . . . . . . 3.4.2. Demand-sensitive Arbitrary Solutions . . . . . . . . . . 3.4.3. Efficiency Solutions . . . . . . . . . . . . . . . . . . . . . 3.4.4. Pricelist-generated Solutions . . . . . . . . . . . . . . . 3.5. Base Configuration . . . . . . . . . . . . . . . . . . . . . . . . . 3.6. Operators of the Genetic Algorithm . . . . . . . . . . . . . . . . 3.6.1. Survival Selection . . . . . . . . . . . . . . . . . . . . . .

1 3 4

5 5 7 8 11 16 18 18 19 20 21 23

. . . . . . . . . . . . . . .

23 23 24 25 27 27 27 29 29 29 30 30 32 32 32

v

Contents

3.6.2. Parent Selection . . . 3.6.3. Crossover . . . . . . 3.6.4. Mutation . . . . . . . 3.7. Termination Conditions . . . 3.8. Performance Enhancements 3.8.1. Duplicate Testing . . 3.8.2. Local Search . . . . . 3.8.3. Parallelism . . . . . . 3.8.4. Improved Evaluation

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

4. Evaluation

47

4.1. Evaluation Criteria and Reference Cases . . . . . . . . . . 4.2. Characteristics of Optimisation . . . . . . . . . . . . . . . 4.2.1. Impact of Different Initial Solution Sets . . . . . . . 4.2.2. Comparison to NSGA-II . . . . . . . . . . . . . . . 4.2.3. Impact of Back Boundary Temperature Constraints 4.2.4. Solution Behaviour . . . . . . . . . . . . . . . . . . 4.2.5. Resulting Temperature Curves . . . . . . . . . . . 4.2.6. Comparison to Heat-Driven Default Operation . . 4.3. Robustness Towards External Factors . . . . . . . . . . . . 4.3.1. Impact of Price Profile . . . . . . . . . . . . . . . . 4.3.2. Impact of Price Spreads . . . . . . . . . . . . . . . 4.3.3. Impact of Uncertain Thermal Energy Demand . . . 4.4. Moving Optimisation Horizons . . . . . . . . . . . . . . . . 4.5. Extensibility by Further Devices . . . . . . . . . . . . . . . 4.6. Potential Analysis . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

5. Conclusion

A. Appendix

vi

Heating Demand Regression Functions and Statistics Used Computer System . . . . . . . . . . . . . . . . . Illustration of Schedules After x Generations . . . . . Parameter Overview . . . . . . . . . . . . . . . . . . .

47 49 49 49 50 52 52 55 56 56 60 61 65 65 66 69

5.1. Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2. Outlook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

A.1. A.2. A.3. A.4.

34 37 38 40 41 41 42 44 45

69 70 79

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

79 80 81 83

List of Figures 1.1. End energy consumption divided into application fields in Germany in 2014 [Stat16] [Bund16] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1. 2.2. 2.3. 2.4. 2.5. 2.6. 2.7. 2.8. 2.9. 2.10.

3.1. 3.2. 3.3. 3.4. 3.5. 3.6. 3.7. 3.8. 3.9. 3.10. 3.11. 3.12. 3.13. 3.14. 3.15. 3.16. 3.17. 3.18.

Basic construction of a simple heat pump . . . . . . . . . . . . . . . . . . Heat Pump System Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . Annual demand for heating (a) and hot water (b) . . . . . . . . . . . . . . The principle of a merit order . . . . . . . . . . . . . . . . . . . . . . . . Composition of electricity price in May 2016 [BDEW16] . . . . . . . . . EPEX Intraday Auction on 1 April 2015 (CET) with spread (s = 5.0) and price addition (q = 240 e/MWh) . . . . . . . . . . . . . . . . . . . . . . . Regression functions of considered physical heat pump model . . . . . . Non-exclusive overview of optimisation methods . . . . . . . . . . . . . Schematic illustration of an evolutionary cycle (adapted from [Weic15]) . General approach to designing evolutionary algorithms (adapted from [Weic15]) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Simulation environment of the genetic algorithm (UML) . . . . . . . . . Basic architecture of jMetal library [DuNe11] . . . . . . . . . . . . . . . . Depth of inheritance and extensions made to jMetal in this work (UML) . Exemplary initial solution created by the efficiency-based approach . . . Exemplary initial solution created by the pricelist-based approach . . . . Illustration of fitness-based (top) and age-based (bottom) survival selection Evaluation of survival selection methods . . . . . . . . . . . . . . . . . . Exemplary selection probabilities for (a) near-convergence population (b) diverse population (c) ranking selection . . . . . . . . . . . . . . . . . . . Evaluation of different approaches to parent selection . . . . . . . . . . . Schematic illustration of crossover operators . . . . . . . . . . . . . . . . Evaluation of parametrised crossover operators . . . . . . . . . . . . . . Evaluation of the impact of different mutation rates and methods (0.52% = 1bit / 192bits) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Schematic illustration of termination conditions . . . . . . . . . . . . . . Evaluation of termination modes . . . . . . . . . . . . . . . . . . . . . . . Evaluation of duplicate testing . . . . . . . . . . . . . . . . . . . . . . . . Computation time of different local search approaches in GA . . . . . . . Average simulated costs of different local search approaches in GA . . . Simulated Costs and computation time of different uses of parallelism . .

4.1. Heat-driven heat pump default operation (hysteresis of 4 ◦C at day 6) . . 4.2. Annual simulated costs of reference cases . . . . . . . . . . . . . . . . . .

2 6 7 8 10 10 11 13 19 20 22 24 24 25 31 31 33 34 36 36 38 38 39 40 41 42 43 43 45 48 49

vii

List of Figures

4.3. Performance of different initial solution sets in comparison to reference cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.4. Comparison of genetic algorithm to NSGA-II . . . . . . . . . . . . . . . . 4.5. Influence of back boundary values ξ . . . . . . . . . . . . . . . . . . . . . 4.6. Exemplary optimisation behaviour with local search at day 89 . . . . . . 4.7. Temperature curve of optimised schedule at the 91st day (pricelist initialisation) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.8. Temperature curve of optimised schedule at the 6th day (pricelist-generated initialisation) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.9. Temperature curve of optimised schedule at the 6th day (efficiency-based initialisation) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.10. Comparison between optimisation built on efficiency-based and pricelistgenerated initial populations . . . . . . . . . . . . . . . . . . . . . . . . . 4.11. Comparison (on average) between optimised and default heat pump operation 4.12. Comparison (on a daily basis) between optimised and default heat pump operation via simulated costs (1), thermal energy generation (2), electric energy consumption (3) and relative runtime (4) . . . . . . . . . . . . . . 4.13. Absolute savings by optimisation compared to default heat pump operation 4.14. Synthetically created price time series . . . . . . . . . . . . . . . . . . . . 4.15. Impact of price signals on savings by optimisation . . . . . . . . . . . . . 4.16. Comparison between default and optimised operation at flat prices concerning simulated costs and relative runtime at day 15 . . . . . . . . . . . 4.17. Comparison between temperature curves resulting from default and optimised operation at flat prices and day 15 . . . . . . . . . . . . . . . . . . 4.18. Effect of optimisation granularity (red: no operation, green: operation) . . 4.19. Impact of price spreads on savings by optimisation . . . . . . . . . . . . 4.20. Selected regression functions of heating demand according to outdoor temperature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.21. Outdoor temperature / demand combinations of predicted, corrected and actual heating demand . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.22. Illustration of predicted and actual heating demand from January to May 4.23. Illustration of predicted and actual hot water demand for week 1 of 2015 4.24. Impact of uncertain thermal demand on performance of genetic algorithm 4.25. Impact of a moving optimisation horizon on the performance of the developed genetic algorithm (notation: [realised time, overlapping time]) . . . . 4.26. Sensitivities of annual costs, thermal energy generation, electric energy consumption after optimisation (solid lines) according to price spread and comparison to heat-driven default operation (dotted lines) . . . . . . . . A.1. Best schedule of cycle 5 after 0, 100, 200, 300 and 400 generations (pricelist initialisation) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.2. Best schedule of cycle 9 after 0, 100, 200, 300 and 400 generations (pricelist initialisation) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

viii

50 51 51 52 53 54 54 54 55

57 58 58 58 59 59 60 60 63 63 63 64 64 65

68

81 82

List of Tables 2.1. Electricity tariffs of municipal utilities in southwest Germany in June 2016 [Stad16a] [Stad16b] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2. Operation modes of the heat pump system . . . . . . . . . . . . . . . . . 2.3. Nomenclature of variables and constants in problem formulation . . . . 2.4. Overview of related work . . . . . . . . . . . . . . . . . . . . . . . . . . .

9 12 15 18

3.1. 3.2. 3.3. 3.4. 3.5. 3.6. 3.7. 3.8. 3.9. 3.10.

. . . . . . . . . .

25 26 32 33 37 38 39 41 44 45

4.1. Shifting probabilities for actual hot water demand . . . . . . . . . . . . . 4.2. Summary of best savings attained with different setups at price spread s = 5.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

62 66

A.1. A.2. A.3. A.4. A.5. A.6. A.7. A.8.

79 80 83 84 84 84 84 84

Genotype structure of heat pump schedule . . . . . . . . . . . . . . An exemplary genotype and its corresponding schedule . . . . . . . Base configuration of the genetic algorithm . . . . . . . . . . . . . . Adaptations to base configuration regarding survival selection . . . Adaptations to base configuration regarding parent selection . . . . Adaptations to base configuration regarding crossover . . . . . . . Adaptations to base configuration regarding mutation . . . . . . . . Adaptations to base configuration regarding the termination mode Adaptations to base configuration regarding local search . . . . . . Adaptations to base configuration regarding parallelism . . . . . . .

Regression functions and statistics Used computer system . . . . . . General parameters . . . . . . . . Penalty type parameters . . . . . Crossover type parameters . . . . Mutation type parameters . . . . Selection type parameters . . . . . Local search type parameters . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . . . .

. . . . . . . .

. . . . . . . . . .

. . . . . . . .

. . . . . . . .

ix

1. Introduction 1.1. Motivation In Germany the increasing significance of renewable energy sources can be ascribed to the Renewable Energy Act (EEG) of 2000. The German government has set its sights high by aiming at a coverage of more than 50% of electricity consumption in Germany from renewable energies by 2030 and even 80% by 2050 [Fede12]. Likewise the European Union has devoted itself to a more sustainable energy policy. In 2010, the 20-20-20 commitments were adopted, which besides a 20% cut in greenhouse gas emissions based on 1990 levels and a 20% improvement in energy efficiency also stipulate a share of 20% of EU energy to come from renewables until 2020 [Euro10]. Four years later, these targets have been reconfirmed and extended to 2030, now aiming at a growth of the share of renewable energy and an increase of energy efficiency by 27% each compared to 1990 levels [Eur014]. Reading through the national and supra-national policies it becomes apparent that future energy systems will utilise two major principles: the efficient use of energy by consumers and the use of renewable energy sources. The increasing share of renewable energy implicates challenges to the power grid as the power generation from e.g. wind turbines and photovoltaic (PV) systems are to a vast extent weather-dependent and are unable follow the demand for electricity. Due to the volatility of its generation, the probability of intermittent electricity deficiency or excess rises. However, in order to maintain a stable power grid supply and demand have to coincide exactly. Today it can be commonly observed that primarily wind turbines but also PV-systems are shut down deliberately in order not to imperil grid stability. The volume of unused energy by feed-in management trebled in 2014 compared to 2013 levels to 1.581 GWh [BuBu15]. To prevent the limitation of renewable energy sources in times of energy surplus, more energy storage capacities are required that can consume electric power when the demand is low and allow for a deferred usage of the stored energy. Moreover, intelligent demand-side management is an essential part of an answer to the challenges of fluctuating energy sources. The main mechanism of this method is that by shifting loads the demand is fit to the current power supply. This contributes to a reduced energy consumption in expensive peak-hours and improves the security of supply. In the course of the energy transition, the coupling of power and heat supply gains in importance due to the inexpensive storability of heat. Heat pumps are flexible power consumers and are therefore a powerful tool to provide such a link between electric power and heat. In connection with thermal storages the load of heat pumps can be shifted without infringing upon the fulfilment of heating or hot water demand of a household.

1

1. Introduction

Household Appliances 15%

Hot Water 12%

Lighting 2% Heating 27%

Private Households

Overall Germany

630 TWh

2402 TWh

Hot Water 5% Heating 71%

Other 68%

Figure 1.1.: End energy consumption divided into application fields in Germany in 2014 [Stat16] [Bund16]

The data of Figure 1.1 underlines the potential of shifting the loads of residential heat generation. Heating and hot water demand approximately account for one third of Germany’s overall end energy consumption. In private households heat-related consumption is even responsible for more than 80% of the total end energy consumption. Heating with electricity was once considered ecologically unreasonable, yet today’s heat pumps are highly efficient and renewable power generation makes electricity environmentally benign. Due to the fact that heat pumps use environmental heat as main heat source, they can generate about 4 kW of thermal energy for each 1 kW of consumed electricity. This has also led the European Union to acknowledge heat pumps as a renewable energy source [EuEu09]. The extent to which heat pumps will be used in the future in order to satisfy heating and hot water demands in the domestic sector, is further fuelled by the target of the European Union that only nearly zero energy buildings should be built after 2020 [EuEu10]. While the yearly sales figures of heat pumps in Germany have stagnated between 55.000 and 60.000 from 2011 to 2015, a two-scenario prognosis of the Bundesverband Wärmepumpe e.V. predicts rising annual sales numbers evolving around 90.000 and 203.000 units by 2030 with a market share of up to 27% [BWP15]. In order to utilise the full potential of heat pumps and to incentivise demand-side management the creation of a suitable market is essential. In the future, time-variable pricing could be used to reflect power supply and demand. Thus, a temporary power surplus would result in low prices while a power shortage would induce high prices. Variable price signals will therefore lead the heat pump’s control unit to shift its flexible loads to off-peak times to minimise its costs. Particularly, automatic control units instead of the individual inhabitant’s behaviour are promising because that way the inhabitant saves money and contributes to the energy transition despite the fact that no additional control effort and no loss of comfort is imposed.

2

1.2. Goal Setting

In short, heat pumps can raise the share of renewable energies in the heating sector in a twofold manner: first, they allow for the use of environmental heat to a large extent, and second, they facilitate the integration of renewable energy sources into the power grid by employing load transfers and minimising the shut-down times of renewables.

1.2. Goal Setting The goal of this thesis is to implement a genetic algorithm that optimises the schedule of a heat pump over a specified horizon such that operation costs are minimised. It is assumed that the demand for flexible device operation resulting from a fluctuating supply side is expressed by dynamic electricity prices. High prices prompt a reduction of electricity use while low prices ask for more consumption of electricity. While flexible generation is shifted from times of lower prices to more expensive periods, flexible consumption is shifted in reverse. Particularly, this work shall consider the trade-off between flexible employment of heat pumps and a loss in efficiency due to overheating in the considered heat storages that serve as buffer capacities by modelling a variable coefficient of performance. With regards to the application of the genetic algorithm, beneficial operators, configurations and parameter sets are sought. Moreover, it is analysed how problem-specific knowledge can be included into the genetic algorithm and to what extent these heuristics enhance the algorithms performance. In summary, this work will address the following research questions: 1. What does a genetic algorithm which optimises the schedule of a single heat pump according to its variable operation costs such that it exploits its load-shifting potential considering the trade-off between efficiency and flexibility look like? 2. More precisely, what adjustment options exist that bear the capability of enhancing its performance? 3. What is the potential of the optimisation of heat pump schedules with regards to cost savings?

3

1. Introduction

1.3. Outline Having motivated the topic of heat pump scheduling and having defined the research questions of this work in Chapter 1, this thesis consists of four further parts which are outlined in the following. Chapter 2 explains the foundations of the considered scenario and the pursued approach. It includes an illustration of the main functioning principles of a heat pump system with multiple thermal storages and introduces the considered load profile as well as essential mechanisms of the electricity market. Furthermore, the optimisation problem for scheduling is defined, related work is presented, and the suitability and working principles of evolutionary algorithms are discussed. In Chapter 3 the genetic algorithm is designed and parametrised. It consists of a description of the simulation environment and libraries in use. Before this chapter turns to the initialisation of the genetic algorithm and the choice followed by parametrisation of operators, the fundamental genotype-pheontype translation and fitness evaluation is introduced. In conclusion, performance enhancements such as duplicate testing, local search, and parallelism are evaluated. Subsequently, the resulting configured genetic algorithm is evaluated in detail in Chapter 4 in comparison to a heat-driven heat pump operation as reference case. Besides analysing resulting schedules, particular focus is put on the examination of the algorithm’s robustness towards external factors such as varying price profiles and uncertainty in thermal energy demand due to prognoses. Moreover, extensibility by further devices and the optimisation method’s potential is discussed. Finally, Chapter 5 provides a summary of the results and answers obtained regarding the research questions set as well as an outlook on further research on the topic of heat pump scheduling.

4

2. Scenario and Approach 2.1. Scenario Before defining an optimisation problem on heat pump scheduling, it is helpful to shed light on the scenario at hand. First, the fundamental functioning principles of heat pumps are explained and the setup that lays the foundation of the problem formulation will be illustrated. The second part is dedicated to an evaluation of the characteristics of the used thermal load profile. The third part covers the future development of electricity markets in order to incentivise demand-side management to the customer. After an analysis of current tariff structures of local municipalities, a demonstration of the merit order as general price-building mechanism is performed in order to understand trade at the EPEX 1 spot market. It is then further evaluated how the current composition of electricity tariffs curtail the potential of demand-side management and why a dynamic design of grid charges and the EEG 2 reallocation charge could help tap the full potential of time-variable price signals.

2.1.1. Heat Pumps with Two Storages The invention of the heat pump technology can be dated back to the early 19th century when in 1824 Frenchman Nicolas Carnot originally published a work on the basic principles of heat pumps titled Réflexions sur la puissance motrice du feu et sur les machines propres à développer cette puissance 3 [CaOs92]. A heat pump transfers thermal energy from a low temperature heat source such as environmental heat into a high temperature heat sink by using electric energy to increase the temperature level and thereby the exergy of the transferred heat. This is necessary as according to the second law of thermodynamics heat from a colder environment can only be added to a warmer system if it is raised above the temperature level of the receiving system apriori [BaKa12]. As shown in Figure 2.1, a heat pump consists of a compressor, an expansion valve, one heat exchanger each at the heat source and the heat sink and a refrigerant within the circuit [Boni09]. The evaporator serves as low-temperature heat exchanger at the heat source where the refrigerant enters in liquid form and absorbs the environmental heat by evaporation. The resulting vapour is then forwarded to the compressor. The compressor avails itself of the Joule-Thomson effect by raising the refrigerant’s temperature by an increase in pressure such that the temperature matches the condensation temperature required by the 1 EPEX

= European Power Exchange SE (www.epexspot.com) = Erneuerbare Energien Gesetz (Renewable Energy Act) 3 Reflections on the Motive Power of Fire and on Machines Fitted to Develop that Power 2 EEG

5

2. Scenario and Approach

Heat Distribution High Temperature

Condenser Interior Heat Exchanger

Expansion Valve

Heat Pump

Compressor

Evaporator Exterior Heat Exchanger

Heat Source Low Temperature

Figure 2.1.: Basic construction of a simple heat pump

condenser. The condenser as high-temperature heat exchanger releases the heat carried by the vapour to the heat sink by condensation and then lets the refrigerant leave as liquid. Before the cycle starts anew on its return to the evaporator, the pressure is reduced with the aid of the expansion valve causing a temperature drop. The electric energy is added to the system during compression. A heat pump’s performance is usually characterised by its coefficient of performance (COP) which is the ratio of provided heat Q to the work consumed by the compressor W : Q (2.1) W It is important to note that the COP depends on the current operating point of the heat pump and does not suit well as an overall efficiency rating. Setting the COP in relation to the highest theoretically possible COP returns a better estimate of the heat pump’s quality. COPmax can be derived from the Carnot efficiency of a heat engine which is the highest efficiency of converting heat to mechanical energy and results from the second law of thermodynamics [Wu07]. It is given by COP =

ηCarnot =

Thiдh − Tlow Thiдh

(2.2)

where Thiдh and Tlow are the temperatures set in relation to each other. As the ideal heat pump process is a reversed Carnot heat engine cycle [Wu07], the maximum coefficient of performance is limited by the inversed Carnot efficiency given by the temperatures of the heat sink Tsink and the heat source Tsource :

6

2.1. Scenario

Buffer Tank (Heating) extraction

charges recirculation

power supply

Heating Demand

Heat Pump

Power Grid extraction

charges

Hot Water Demand Buffer Tank (Hot Water)

Figure 2.2.: Heat Pump System Setup

COPmax =

1 ηCarnot

=

Tsink Tsink − Tsource

(2.3)

Therefore, the COP of a heat pump can be improved by reducing the temperature gap at which the system works. As the temperature of the heat source remains exogenous, only the temperature of the sink remains to improve the efficiency of the system. In order to define a quality rating for heat pumps taking into account deviations of real heat pump cycles from idealised heat pump cycles one takes the quotient of their respective COPs and obtains: ηHP =

COP COPmax

(2.4)

Throughout this thesis the optimal scheduling of heat pumps will be examined on the basis of the system setup depicted in Figure 2.2. It consists of a heat pump connected to the power grid and two thermal storages to satisfy the heating and hot water demand. Two storages are used for modelling because the required heating and hot water circuit temperatures differ. However, in reality a combined water tank could be used.

2.1.2. Thermal Load Profile Figure 2.3 illustrates the annual demand for heating and hot water of a single household. The data is derived from a measurement of a real heat pump operation and was further processed by smoothing operations in order to remove the time behaviour of the supplyside and rather display the demand-side. This time series will serve as input for the schedule optimisation. In the course of the potential analysis in Section 4.6, a further adaptation of the hot water demand is made later on.

7

Energy (kWh)

2. Scenario and Approach

6 5 4 3 2 1 0 0

730

1460

2190

2920

3650

4380

5110

5840

6570

7300

8030

Energy (kWh)

(a)

8760

Time (hours) 6 5 4 3 2 1 0

0

730

1460

2190

2920

3650

4380

5110

5840

6570

7300

(b)

8030

8760

Time (hours)

Figure 2.3.: Annual demand for heating (a) and hot water (b)

With an annual demand for heating of 11616.4 kWh and 2420.9 kWh for hot water supply, the total thermal energy demand of the observed household adds up to 14037.3 kWh. Taking into consideration that on average the total thermal energy demand accounts for 83% of the total end energy consumption (cf. Figure 1.1) the total electricity demand is estimated to be around 2875.1 kWh. According to [BuSt16], this number would correspond to a single-family home with a two-person household or a flat in a multi-family home with up to 4 inhabitants. On closer examination of the annual demand of thermal energy a few differences stand out. Whilst the hot water demand remains stable throughout the year, considerable seasonal variance of the heating demand can be recognised. In cold late January and early February heating demand reaches its climax, whereas it drops to zero during the warm summer months. Looking at the daily thermal energy demand, it also becomes apparent that hot water demand drops at night, but the heating demand does make if any only little distinction between night and day.

2.1.3. Electricity Markets and Tariffs Dynamically adjusted, time-varying electricity prices as incentive for stimulating demandside management are not yet very common at present time. A magnitude of energy providers offer their end-customers single-rate or two-rate tariffs. The latter normally includes a lower price during off-peak at night in return for a higher price during on-peak periods during daytimes. In fact, night-time prices can be significantly lower than the single-rate tariff, whereas only slight to no lift in prices can be noticed at daytime. For instance, at night the Stadtwerke Karlsruhe, a local municipal utility, offers a price reduction of 6 ct/kWh, whereas it just raises the day-tariff by 0.36 ct/kWh. The Stadtwerke Walldorf, another municipal utility, does not increase the on-peak price at all. Yet the discount during off-peak is lower (cf. Table 2.1). Furthermore, many municipal utilities provide special heat pump tariff schemes that offer a discount in return for the right to disable the heat pump during peak load. Thereby, the energy provider purchases the opportunity to use the heat device as means of load management whilst the forced deactivation of the heat pump only marginally impairs the customer’s comfort if a buffer storage is used. The scale of the discount generally depends

8

2.1. Scenario

Municipal Utility

Tariff classic

Walldorf

classic duo

on-peak off-peak

StromWärme classic BasisStrom A BasisStrom B Karlsruhe WP Eco WP Spar

on-peak off-peak on-peak off-peak on-peak off-peak

Rate (ct/kWh)

Basic Rate (e/a)

25.87 25.87 23.98 20.69

65.00 75.16

26.30 26.66 20.29 23.95 19.55 22.76 18.36

103.56 132.84

89.56

59.28 59.28

Table 2.1.: Electricity tariffs of municipal utilities in southwest Germany in June 2016 [Stad16a] [Stad16b]

on the duration of allowed suspension periods. For example, the tariff WP Spar offered by the Stadtwerke Karlsruhe is 5.5% cheaper than the tariff WP Eco as it allows for one more hour of deactivation. The exact interruption slots are predefined. In contrast to the fix or off/on-peak tariffs in the end customer market, wholesale electricity prices are built via so-called merit orders. A merit order determines the employment sequence of power plants. Operators place a bid usually according to their marginal costs of operation. Starting with the lowest marginal costs bids are accepted in ascending order until the overall demand for electricity is covered. The price of the last accepted bid determines the market clearing price, which can be interpreted as the marginal costs of the ultimate power plant granted operation. In Figure 2.4 price and amount of electricity can be retrieved from the intersection of power demand and merit order curve. As the market entry for renewable energy is guaranteed by law [Deut14] and free of marginal costs, it is sold with priority, which shifts the merit order curve to the right when more renewable energy is available. This is also shown in Figure 2.4. In consequence, assuming a relatively price-inelastic demand, the electricity price drops from p1 to p2 . This is known as the merit order effect. Of course, a price change can have multiple causes apart from volatile availability of renewable energy. For instance unexpected power plant outages, variable demand and changing oil, gas or CO2 -certificate prices also influence the intersection of demand and supply curves. The merit order principle is applied on the day-ahead market of the European Power Exchange (EPEX). EPEX operates the electricity markets for Germany, France, Austria and Switzerland. It provides a market place where market participants submit their orders to buy or sell electricity. The role of EPEX consists in transparently matching these orders. On the day-ahead market single-contract orders (1 hour) or block orders (multiple hours) from the order book are traded each noon for the upcoming day.

9

Costs, Price [€]

2. Scenario and Approach

power demand increased availability of renewable energy

oil

natural gas

p1 hard coal

p2 lignite nuclear

renewables

m1 m2

Amount of Electricity [MWh]

Figure 2.4.: The principle of a merit order generation and supply

grid charge

EEG reallocation charge

concession fee

electricity tax

CHP surcharge

Other

VAT

ct/kWh

6,15

7,06

6,35

1,66

2,05 0,45 0,42

4,59

Figure 2.5.: Composition of electricity price in May 2016 [BDEW16]

However, the rising number of weather-dependent producers and the subsequently emerging issue of short-termed coordination of the physical fulfilment of contracts, press for a broadening of intraday trade at spot markets. That is because the quality of forecasts increases the shorter its horizon is and because such markets enable the utilisation of flexible energy consumption and, hence, could unburden the operating reserve. In that regard EPEX also operates an intraday auction which unlike the day-ahead market trades orders continuously on the basis of 15-minute contracts. The resulting price excellently reflects the current market conditions. In order to unfold the control effect of time-variable pricing, its accessibility to customers or control agents is essential. Yet, wholesale prices are charged significant and mostly constant charges and fees. The problem with constant charges and fees is that they distort the characteristics of the spot market price and reduce the signal function for demand-side management [JRG+ 15]. In Figure 2.5 it can be seen that the price of generation and supply is only a fraction of the final electricity price. Equally, the grid charge and EEG reallocation charge contribute to the price. One approach to turn the premiums from a barrier into a driver of demand-side management is to couple the grid and EEG reallocation charge to the flexible price signal using a multiplicative factor. This way the absolute difference of prices is increased and the price signal is amplified. Hence, control agents are further incentivised to act market-compliant [JRG+ 15]. In Figure 2.6 such a price spread is shown.

10

2.2. Definition of the Optimisation Problem

EPEX Price

EPEX Spread

EPEX Spread + Price Addition

Mean

500

Price (€/MWh)

400 300 200 100 0 -100 -200

-300

Time [h]

Figure 2.6.: EPEX Intraday Auction on 1 April 2015 (CET) with spread (s = 5.0) and price addition (q = 240 e/MWh) Moreover, in order to bill the customers according to time-variable electricity prices, the essential technical infrastructure has to be provided. The prerequisites can be accomplished by additional communication capabilities and smart meters. To simulate a price signal with variable supplements, the optimisation of the heat pump schedule in this thesis uses a price signal from the EPEX intraday auction from 2015 that is spread around its mean p¯ by the factor s and includes a constant price addition of q. ¯ · s + p¯ + q pused = (pmarket − p)

(2.5)

If not specified differently s = 5 and q = 24 ct/kWh as it is assumed that efficiency losses by optimisation are only compensable at high price spreads.

2.2. Definition of the Optimisation Problem The following problem formulation and model was given and its development is not part of this thesis. It will be run once per optimisation cycle. An overall optimisation of 1 year with an optimisation horizon H opt of 24 hours with no overlapping will for example result in 365 cycles. The optimisation horizon H opt is subdivided into a number of slots N slots based on a predefined time slot duration ∆t. H opt 24 h = = 96 ∆t 0.25 h The size and values of all used time series such as demands, prices and outside temperature have to be adapted to this configuration. The considered heat pump system provides three different operation modes. It can either charge the hot water storage, the heating storage or remain turned off. In the problem formulation this is handled with the aid of two binary variables. As illustrated in Table 2.2, βt states whether the heat pump is running in slot t or not whilst ωt is the indicator that the heat pump charges the heating storage. If the heat pump is running but ωt = 0, the hot water storage is charged. ∆t = 0.25 h ⇒ N slots =

11

2. Scenario and Approach βt

ωt

1 − ωt

Operation Mode

0 0 1 1

0 1 0 1

1 0 1 0

Heat pump is turned off Heat pump is turned off Heat pump is charging hot water storage (HW) Heat pump is charging heating storage (HE)

Table 2.2.: Operation modes of the heat pump system

All variables and constants used in the following optimisation problem are compiled in Table 2.3. The objective of the optimisation problem is to minimise the costs c under the restriction that the temperature bounds of each storage are observed at any time. minimise c =

slots NX

t=1

subject to

  sym wtHW + wtHE · Pt HW ϑtHW − Tmin ≥0

(2.6)

HE ϑtHE − Tmin ≥0 HW Tmax − ϑtHW ≥ 0 HE Tmax − ϑtHE ≥ 0

∀t ∈ {1 . . . N slots }

Of course, this problem formulation is not yet complete. It still requires a translation of the operation mode given by the combination of βt and ωt to the temperature dependant electric energy consumption wt and thermal generation qt . Furthermore, the storages’ temperature changes have to be calculated from the thermal generation for each slot. In order to model the heat pump behaviour considering a temperature dependant coefficient of performance a dynamic simulation approach as explained in [Fass15] is used. The model consists of a regression analysis of stationary measured characteristic curves of a high-efficiency air-to-water heat pump. The characteristic curves depicted in Figure 2.7 examine the thermal energy generation and electric energy consumption as a function of the outside temperature Ttoutside and the storage temperature ϑt and yield   el el HW wtHW = βt · (1 − ωt ) ·∆t C 0el + C vap · Ttoutside + C cond · ϑt−1   el el HE wtHE = βt · ωt ·∆t C 0el + C vap · Ttoutside + C cond · ϑt−1   th th HW qtHW = βt · (1 − ωt ) ·∆t C 0th + C vap · Ttoutside + C cond · ϑt−1   th th HE qtHE = βt · ωt ·∆t C 0th + C vap · Ttoutside + C cond · ϑt−1 |{z} | {z } schedule

∀t ∈ {1 . . . N slots }

regression function

(2.7) where each C ij denotes a regression coefficients with i ∈ {thermal (th), electrical (el)} and j ∈ {constant (0), vaporizer (vap), condenser (cond)}. With qt one can now calculate the individual storage’s state of charge st (SoC). Unlike the SoC in the context of battery storages it is not given as a percentage value, but as a

12

2.2. Definition of the Optimisation Problem

Figure 2.7.: Regression functions of considered physical heat pump model

measure in kW h. It contains information on how much energy is stored in the storage above its minimum temperature. Its progression predominantly depends on the thermal generation qt and the demand Dt . Furthermore, it is subject to static and variable losses L 0 and L var due to heat transition through the storage hull. The loss factors are constant given that the system setup remains the same.   HW HW stHW = 1 − LHW − LHW − DtHW var · st−1 + qt 0   (2.8) HE HE HE HE slots stHE = 1 − LHE · s + q − L − D ∀t ∈ {1 . . . N } var t t t−1 0 The static losses L 0 are determined by the surface of the storage envelope Aenv , the heat transition coefficient of the storage hull h hull and the gap between ambient temperature Tambient and minimum storage temperature Tmin .   HW HW LHW = ∆t · A · h · T − T hull ambient env 0 min   (2.9) HE HE HE L 0 = ∆t · Aenv · h hull · Tmin − Tambient The variable loss factor L var finds the ratio of heat lost through the storage hull and the heat stored in the storage: LHW var LHE var

∆t · AHW env · h hull = H 2 Cap O · M HW ∆t · AHE env · h hull = H Cap 2 O · M HE

(2.10)

Using the state of charge st it is possible to find the temperature of the heat storage. The specific heat capacity of water Cap H2 0 relates the change in thermal energy to the resulting temperature change per unit mass M. Thus, the temperature is given by: ϑtHW ϑtHE

stHW HW = + Tmin H 0 HW 2 Cap · M stHE HE = + Tmin Cap H2 0 · M HE

(2.11) ∀t ∈ {1 . . . N

slots

}

13

2. Scenario and Approach

For the final slot of the optimisation horizon it may be necessary to introduce a higher minimum temperature restriction in order to increase flexibility of consumption or to ensure the solubility at the start of the subsequent horizon. It is not required when overlapping optimisation horizons are used. This bound enters the problem formulation in the following way, where ξ represents a percentage value of the state of charge:   HW HW HW ϑ NHW slots ≥ Tmin + ξ · Tmax − Tmin   (2.12) HE HE HE ϑ NHEslots ≥ Tmin + ξ · Tmax − Tmin Table 2.3 provides an overview of the symbols used in the problem formulation and, moreover, lists the values used throughout this work if not specified differently and its corresponding units. In contrast to a heat-driven hysteresis approach, the storages are allowed to overheat so as to provide the necessary buffer capacity. Therefore, ϑtHW ∈ [36, 60]

14

and ϑtHE ∈ [28, 50]

(2.13)

2.2. Definition of the Optimisation Problem

Symbol

Description

Values

Units

{0,1} {0,1} R+ R+ R+ R+ R+ R+ R R

kW h kW h kW h kW h kW h kW h ◦C ◦C

96 {N+ ∩ [1, N slots ]} 0.25 time series time series time series time series 18 36 60 28 50 1.4591 0.0227 0.0194 9.9654 0.2163 -0.0958 7.751E-4 0.0081 7.751E-4 0.0081 500 500 4.18 / 3600 0.0003 6 6 2 2 20

h kW h kW h e / kW h ◦C ◦C ◦C ◦C ◦C ◦C kW kW / ◦C kW / ◦C kW kW / ◦C kW / ◦C kW h kW h kg kg kW h / (kg K) kW / (m2 K) m2 m2 kW h kW h %

Variables βt ωt wtHW wtHE qtHW qtHE stHW stHE ϑtHW ϑtHE

Heat pump is running Heat pump is charging heating storage Electric energy hot water Electric energy heating Thermal energy hot water Thermal energy heating SOC hot water SOC heating Hot water temperature Heating temperature Constants

N slots t ∆t DtHW DtHE sym Pt Ttoutside Tambient HW Tmin HW Tmax HW Tmin HW Tmax C 0el el C vap el C cond C 0th th C vap th C cond HW L var LHW 0 LHE var LHE 0 M HW M HE Cap H2 O h hull AHW env AHE env s 0HW s 0HE ξ

Number of slots in optimization horizon time step / slot Time slot duration Hot water demand Heating demand Symmetric electric price Outside temperature Ambient temperature at heat storages Minimum hot water storage temperature Maximum hot water storage temperature Minimum heating storage temperature Maximum heating storage temperature Electrical power constant Electrical power factor vaporizer Electrical power factor condenser Thermal power constant Thermal power factor vaporizer Thermal power factor condenser Loss factor at hot water storage Static loss at hot water storage Loss factor at heating storage Static loss at heating storage Storage mass hot water Storage mass heating Specific heat capacity of fluid water Heat transition coefficient of storage hull Surface of hot water storage envelope Surface of heating storage envelope Initial state of charge hot water (cycle 0) Initial state of charge heating (cycle 0) Back boundary state of charge

Table 2.3.: Nomenclature of variables and constants in problem formulation 15

2. Scenario and Approach

2.3. Related Work The potential of demand-side management through heat pumps has already been examined by several papers in the past few years. They significantly differ among each other in their system setup and their level of detail on the technical implementation of the scheduling. Moreover, achieved savings are difficult to compare because the characteristics of the used price signals do not coincide. Especially if local photovoltaic devices are considered savings turn out relatively high. An orientation of related work is compiled in Table 2.4. In [ArHP13] the merits of thermal energy storages coupled with heat pumps with radiators or underfloor heating distribution systems are analysed. Using a dwelling in Northern Ireland (UK) as a reference scenario and a three-stage electricity tariff for low, normal and peak electricity demand each, the trend of the room temperature under different, but predefined operating schedules is observed. An optimisation of the schedule does not take place. Instead, the regular schedule is compared to an adapted schedule that simply switches off the heat pump during peak load for 3 hours. The demand was reflected by a set target room temperature. It was shown that, whilst reducing overall cost, using underfloor heating, room comfort could be maintained throughout the shut down time whereas this could not be shown for radiators which typically possess a lower thermal mass. The authors therefore conclude that it is beneficial to install thermal energy storages to improve the house’s temperature control. The paper [MPMC11] examines the load shifting potential of heat pump control in single family households exposed to time-varying electricity prices. A heating system was modelled with the simulation tool Dymola4 in the modelling language Modelica5 with a fixed coefficient of performance thus neglecting efficiency changes. The dynamic tariff scheme is derived from the EPEX spot market and stabilised over slots of 3 h. The used scheduling algorithm is not further specified. In comparison to a heat-driven heat pump operation a significant cost reduction was reached with price-based scheduling. However, due to a resulting lower average temperature and higher volatility these economical savings are associated with a loss in comfort. Other than [MPMC11] and [ArHP13], the building heating energy model presented in [ScST15] incorporates a variable COP. Based on a time-variable price signal from the GME6 , the schedule resolution is set to 1 h. The proposed control strategies force the heat pump to run, when the price falls below a threshold, and disable the heat pump, when the price rises beyond another threshold. The thresholds are set on an absolute or a relative basis. If the price is in between the two thresholds, the heat pump receives a neutral signal and operates heat-driven. Another control strategy based on the level of electricity generation from photovoltaic is presented by the authors. As already mentioned above, the savings of the latter were 2-3 times higher than those of the other two control methods. 4 Dymola

= Dynamic Modeling Laboratory (www.3ds.com/products-services/catia/products/dymola) = language to model complex physical systems (www.modelica.org) 6 GME = Gestore del Mercato Elettrico, Italian Power Exchange (www.mercatoelettrico.org) 5 Modelica

16

2.3. Related Work In [KMW+ 13] a model predictive control approach is used to minimise the cost of house heating. The authors especially focus on the trade-off between comfort losses and financial savings. They ask the question of "how much discomfort must [one] allow to achieve considerable economical savings" as they assume that inhabitants are willing to forgo flexibility by allowing the room temperature to vary within certain limits for a given compensation. Therefore, a model is built from a Danish single-family household including a heat pump with assumed fixed COP coupled with a floor heating system. A receding horizon control algorithm schedules the heat pump operation with a sampling rate of 1 h minimising the temperature deviation from the user-specified set point as well as the cost of electricity based on spot prices. Varying the trade-off parameters the authors show that compared to conventional control approaches, economical savings can be achieved during winter by allowing slightly higher variations in the indoor temperature. The paper [FaLW15] suggests a heuristic predictive optimisation scheme for scheduling heat pumps according to an inciting variable tariff that does not require numerical optimisation and thus alleviates computational effort. In contrast to [KMW+ 13], the authors focus on the trade-off between efficiency losses by overheating a heat storage that serves as buffer capacity and economical savings. As the required temperature levels for the domestic hot water circuit and heating circuit differ and consequently the inside of the thermal storage is maintained at different temperatures, the the presented method differentiates between two storages. According to a price prediction and thermal demand prognoses for domestic hot water as well as heating, operation costs are minimised observing set temperature bounds. Additionally, a local photovoltaic system is considered. The proposed method operates on two-levels with a moving operation horizon. A long-term optimisation of 24 h length divided into slots for each quarter of an hour develops a schedule according to the estimated demands starting with the cheapest slots. Subsequently, a short-term optimisation of 1 h length guarantees the adherence to the minimum temperature bound. The COP is updated each hour only after the short-term optimisation. The authors evaluate the impact of various time series characteristics of the price signal and prediction errors of demand forecasts. It is shown that with a rising thermal demand the relative reduction potential declines due to rising indispensable runtimes. The authors note that oversizing the heat pump power might be a suitable countermeasure to maintain the shift potential. Depending on the demand different cost reductions could be reached compared to a standard hysteresis control. In [LHS+ 14] an evolutionary algorithm is presented to shift loads of the heat pump according to multiple incentives like time-variable prices, a load limitation signal and a prediction for local power generation from photovoltaic panels. Similar to [FaLW15], a higher degree of freedom is reached by allowing for overheating of a sole heat storage. Unlike [KMW+ 13], the aim is to find an optimal schedule such that it does not bate the residents’ comfort. The authors use a sliding optimisation window of 6 hours divided into hourly slots. Within this optimisation window the COP is considered to be constant. Yet, a new optimisation round considering an updated COP is triggered after 1 hour. Based on the predicted demand, the state of the heat storage and the current COP, the required runtime is calculated. Following, the evolutionary algorithm not only allocates the runtime

17

2. Scenario and Approach

Paper [ArHP13] [MPMC11] [ScST15] [KMW+ 13] [FaLW15] [LHS+ 14]

COP

Prices

Resolution

Storages

Approach

3 h (price) 1 h (price) 1h 1 h, 0.25 h 1 h, 0.25 h

0 to 1 2 1 0 2 1

predefined schedule not specified price thresholds MPC8 heuristic genetic algorithm

fix 3-stage tariff fix modified EPEX variable GME fix Nord Pool7 hourly prediction 6h load, price, PV

Table 2.4.: Overview of related work

to each slot but also aligns the solutions such that on/off cycles are reduced. If necessary a reparation method of forced starts and stops is applied to stay within specified temperature limits. An advantage of the presented method is that it can be integrated into the OSH (organic smart home) environment, a holistic scheduling approach developed in [Alle13]. It was found out that the optimisation induced longer runtimes due to a lower COP at higher temperatures. Yet, the algorithm could reduce average costs achieving a trade-off between efficiency and flexibility. Contrary to [ArHP13] and [MPMC11] this work will concentrate on the trade-off between efficiency and flexibility. In that regard it will consider a variable coefficient of performance even throughout the optimisation horizon. It will also not allow comfort losses for the purpose of load shifting. The incentivising signal will solely be based on a derivation from EPEX spot prices. More specifically it will neither consider a linkage to domestic photovoltaic panels nor load limitation signals as done in [LHS+ 14]. However, it will pick up the idea of using a genetic algorithm to find cost-saving heat pump schedules. Thereby, similar to [FaLW15], not only one single heat storage but one for domestic hot water and heating demand each constitute the buffer capacities. In contrast however, this work considers the variable coefficient of performance already during the optimisation at a more exact resolution in order to prevent an increase in operation costs when the price profile exhibits low variance.

2.4. Evolutionary Algorithms 2.4.1. Suitability It is beyond question that a broad variety of optimisation methods exists to solve mathematically formulated problems. A non-exclusive overview of the classification of various optimisation methods is illustrated in Figure 2.8. Besides exact methods and classical heuristics, there is also a multitude of optimisation methods that draw inspiration from natural processes. One branch of these nature-inspired methods are evolutionary algorithms which as their name suggests mimic the behaviour of Darwinian evolution 7 Nord 8 MPC

18

Pool Spot Market (www.nordpoolspot.com) = Model Predictive Control

2.4. Evolutionary Algorithms

optimization methods

exact methods

Branch & Bound

simulated annealing

evolution strategies

heuristics

nature-inspired optimisation

evolutionary algorithms

evolutionary programming

classical heuristics

artificial neural networks

genetic algorithms

swarm intelligence

ant colony

Greedy

particle swarm

Figure 2.8.: Non-exclusive overview of optimisation methods

[Darw59]. Pioneers of evolutionary computing have identified evolutionary processes as powerful problem solvers and developed a style of computing solutions from it based on trial and error [Holl01]. Generally, evolutionary algorithms qualify best for complex problems that are only to be solved with extensive computational effort. Although they can also not guarantee high-quality solutions in decent computation time, they are often good at finding satisfactory or sometimes even excellent solutions quickly. One obstacle for the application of many exact optimisation methods is that they require a linear problem formulation. On the other side, gradient-based heuristics such as a greedy algorithm may only yield local optima. The problem of heat pump scheduling formulated in Section 2.2 suits particularly well for the optimisation with genetic algorithms due to the large number of decision variables throughout the optimisation horizon and their easy encodability. Especially the binary decision variables as well as variable efficiency increase the complexity of the optimisation problem which make other optimisation schemes less suitable.

2.4.2. Functioning Principles In the evolutionary metaphor, the problem to solve would correspond to the environment where individuals mirroring different solutions to the problem, thrive. It is the evolutionary algorithm’s task to maintain a population of a certain number of individuals over several generations. Ideally, good traits of individuals are propagated via their offsprings whereas individuals with poor traits rather become extinct thus raising the overall fitness of the population . First of all, it is essential to build a bridge between the original problem context and the problem solving space. In genetic algorithms the genotype consists of bit-strings of specified length that mimic genes encoding the individuals phenotypic properties. Consequently, a fitness value defining the quality of a solution candidate can be derived from the phenotype [Weic15]. Given an initialised population that has already been evaluated with regards to its fitness, the evolutionary cycle as shown in Figure 2.9 is triggered. The parent selection arranges pairs of individuals designated to procreate. By tendency, a certain range of good candidates is chosen to seed the next generation by recombination where children are created by parents exchanging their information. Before the offsprings’ fitness is evaluated, they are exposed to mutation which slightly modifies them arbitrarily. The subsequent survival

19

2. Scenario and Approach Initialisation Termination Condition yes

Fitness Evaluation

no

Output

Parent Selection

Survival Selection

Recombination

Fitness Evaluation

Mutation

Figure 2.9.: Schematic illustration of an evolutionary cycle (adapted from [Weic15])

selection decides on which individuals will subsist in the next generation. Offspring and parents compete for their persistence based on their fitness as the selection operator will favour those individuals that perform outstandingly well. This cycle is reiterated as long as a predefined termination condition is not reached. The most common signal used is a maximum number of evaluations [EiSm03]. Ideally, the best individual of the final solution yields an excellent solution to which the algorithm was applied. Moreover, it is worth noting that many components of the evolutionary algorithm are stochastic in nature. For instance, fitter individuals have a higher chance of getting selected as a parent, the position where the genotypes of two parents are recombined is determined randomly as well as the position of mutation [Weic15].

2.4.3. Challenges An evolutionary algorithm typically consists of two consecutive parts: exploration and exploitation. Exploration ensures that multiple valleys of the fitness function are investigated in order to enhance the probability of finding the global minimum. Recombination and mutation are such diversity preserving operators. In contrast, exploitation focusses on finding the valley floor. It is represented by the selection operators which put pressure on the population to grade up its overall fitness. The balance between those two parts is of utmost importance in order to prevent premature convergence or a sole random search without selective pressure. It will pose a challenge to the genetic algorithm applied to the heat pump scheduling problem to find such a trade-off to yield near-global optima. Normally, genetic algorithms are developed as a general optimisation scheme that are not adapted to specific problem formulations. According to the No-Free-Lunch Theorem all stochastic algorithms have the same performance when averaged over all discrete problems [EiSm03]. Often standard algorithms deliver good solutions only to a limited extent. Therefore, this thesis incorporates problem-specific knowledge into the operation of the developed genetic algorithm in order to retrieve the highest savings possible. In principle the possible design decisions are staggering as they are reaching from selection, crossover and mutation operators to reproduction schemes, population size,

20

2.4. Evolutionary Algorithms

neighbourhood relations, fitness functions and the incorporation of problem-specific heuristics. For this reason a guideline to developing evolutionary algorithms is presented in 2.4.4.

2.4.4. General Approach to Designing Evolutionary Algorithms The general process of designing evolutionary problems is illustrated in Figure 2.10. It is an analysis-based approach [Weic15] and, of course, rather a guideline than an obligation to adhere to this process. Initially, the problem should be formally described including the phenotypic search space as well as the objective function and corresponding constraints. Moreover, an initial description of the problem specific knowledge can help to enhance the evolutionary algorithm, e.g. by the incorporation of heuristics. Next, a suitability test is lined up to estimate the evolutionary algorithms’ chances of success. A comprehensive literature research yields information on previous approaches to similar problems both with evolutionary algorithms and alternative optimisation methods. Also a statement on the problem complexity can give an indication of the method’s suitability. If the suitability test is not passed, the approach is discarded. However, in case the suitability testing is passed, a genotypic representation of the search space should be defined. Thereupon, several evolutionary algorithms with various operators may be designed and implemented which also have to be parametrised afterwards. An analysis of the search dynamic indicates whether the solution quality is satisfactory or not. As soon as the design and parameter proposals have reached a satisfactory level, they may be checked against each other. Ideally, a convincing configuration is finally chosen.

21

2. Scenario and Approach

START

Problem formulation

Phenotypic search space

Suitability testing

Literature research

Objective function

Description of problem specific knowledge

Conditions for alternative optimisation methods

Promising?

Statement on problem complexity

[no]

END

[yes]

Genotypic representation

Design & Implementation

Design & Implementation

Design & Implementation

Parametrisation

Parametrisation

Parametrisation

[no]

[no]

[no]

Analysis of search dynamic

Analysis of search dynamic

Analysis of search dynamic

Satisfying?

Satisfying?

Satisfying?

[yes]

[yes]

Comparison of alternative designs and parametrisations

END

Figure 2.10.: General approach to designing evolutionary algorithms (adapted from [Weic15]) 22

3. Design and Implementation This chapter deals with the design and the implementation of the genetic algorithm which solves the heat pump scheduling problem. For the most part it adheres to the statements made in Section 2.4.4. First, the provided framework including the simulation environment as well as the employed library jMetal is explained. Subsequently, the encoding of the phenotypic schedule into the genotype and its fitness evaluation is introduced. Furthermore, different methods of creating initial solution sets and designing the operators of the evolutionary cycle are examined and evaluated. Additionally, a presentation of termination conditions and possible performance enhancements such as duplicate testing, local search and parallelism is included.

3.1. Framework 3.1.1. Simulation Environment The simulation environment of the heat pump system, in which the genetic algorithm of this thesis is embedded, was provided. Nonetheless, a short explanation of its setup is given briefly. Initially, a Main-class triggers an Evaluation for the total number of optimisation cycles. Major evaluation parameters concerning e.g. the number of cycles and information on the used market are retrieved from EvaParameters. The evaluation consists of two consecutive parts that are repeated for each cycle. Each newly started optimisation cycle’s initial states are defined by the final states of the previous cycle. The first part consists of the optimisation that tries to find an optimal schedule given the heating and hot water demand and a price signal according to the problem formulation. In the subsequent second part a HeatPumpDeviceController performs a simulation. The controller operates according to a hysteresis control at a granularity of 1 min which is overwritten by the optimised schedule. The controller implicitly guarantees the adherence to minimum operation times if no schedule is provided and is furthermore capable of preventing temperature violations that result in consequence of invalid schedules caused by forecasting errors or failed optimisation processes. The class HeatPumpDefaultOperationOptimizer provides an opportunity to commit an empty schedule to the controller leading to a heat-driven hysteresis mode of the heat pump. However, as pointed out, the main purpose of the optimisation module is to initialise a scheduling algorithm ahead of the simulation. The class EARunner is responsible for the initialisation of the optimisation environment of the genetic algorithm by setting all relevant parameters and forwarding the required

23

3. Design and Implementation

EvaParameters singleDeviceOptEva

HeatPumpDefaultOperationOptimizer singleDeviceOptEva.optimizationModule.defaultOperation

Main

HeatPumpDeviceController singleDeviceOptEva.deviceModule.simpleHeatPump

Evaluation

singleDeviceOptEva

DeviceController

singleDeviceOptEva

HeatPumpOperationMode

singleDeviceOptEva.deviceInterface

Translator

singleDeviceOptEva.deviceModule.simpleHeatPump

EARunner

singleDeviceOptEva.optimizationModule.evolutionary

singleDeviceOptEva.optimizationModule.evolutionary

BinarySolutionType

HeatPumpProblem

jmetal.encodings.solutionType

singleDeviceOptEva.optimizationModule.evolutionary

HeatPumpAlgorithm

HeatPumpRepairFactory

singleDeviceOptEva.optimizationModule.evolutionary

singleDeviceOptEva.optimizationModule.evolutionary

HeatPumpFitnessEvaluator HeatPumpLocalSearch

singleDeviceOptEva.optimizationModule.evolutionary

MultithreadedEvaluator

singleDeviceOptEva.optimizationModule.evolutionary

jmetal.util.parallel

SwitchVariation singleDeviceOptEva.optimizationModule.evolutionary

Figure 3.1.: Simulation environment of the genetic algorithm (UML) manages 1…*

Operator

uses

SolutionSet *

Algorithm solves

Problem determines

Solution has

1…*

SolutionType

Variable defines

Figure 3.2.: Basic architecture of jMetal library [DuNe11]

optimisation inputs. A graphical illustration of the dependencies between above-mentioned classes is shown in Figure 3.1.

3.1.2. Architecture of jMetal Library To build the core of the applied genetic algorithm the library jMetal was used. jMetal is an object-oriented framework for multi-objective optimisation using metaheuristics. It was chosen because it is easily extendable due to an inheritance hierarchy for operators. The fundamental classes used are depicted in Figure 3.2. An Algorithm tries to solve a problem by managing a SolutionSet. A SolutionSet consists of multiple instances of the class Solution which in the evolutionary context correspond to the individuals of a population. Besides its fitness values a Solution is composed of variables of a certain kind (e.g. Binary) defined by the SolutionType. The SolutionType in turn is determined by the Problem. Objects that inherit from the class Problem need to implement methods for evaluating objective functions and constraints. In order for the algorithm to run, operators are required. Any operation altering or generating new solutions inherits from the superclass Operator. Basic operators such as binary tournament selection, bitflip mutation and single-point crossovers

24

3.2. Genotype-Phenotype Translation

BitFlipMutation

HeatPumpMutation

jmetal.operators.mutation

singleDeviceOptEva.optimizationModule.evolutionary

Mutation

SinglePointCrossover

jmetal.operators.mutation

jmetal.operators.crossover

Algorithm

NPointCrossover

jmetal.core

singleDeviceOptEva.optimizationModule.evolutionary

Operator

Crossover

jmetal.core

jmetal.operators.crossover

UniformCrossover singleDeviceOptEva.optimizationModule.evolutionary

ShuffleCrossover singleDeviceOptEva.optimizationModule.evolutionary

PseudoRandom jmetal.util

Selection jmetal.operators.selection

BinaryTournament jmetal.operators.selection

TruncationSelection

RandomSelection

singleDeviceOptEva.optimizationModule.evolutionary

jmetal.operators.selection

TournamentSelection

RankingSelection

singleDeviceOptEva.optimizationModule.evolutionary

singleDeviceOptEva.optimizationModule.evolutionary

FitnessProportionateSelection singleDeviceOptEva.optimizationModule.evolutionary

Figure 3.3.: Depth of inheritance and extensions made to jMetal in this work (UML)

are already provided by the framework. Figure 3.3 outlines the extensions made with regards to mutation, crossover and selection operators. Work of this thesis is tagged by the subscript optimizationModule.evoluationary. Moreover, a set of standard nature-inspired algorithms is implemented in jMetal. Particularly, the NSGAII will be used in this work for comparison later on. In addition, jMetal offers a variety of utilities such as the generation of pseudo-random numbers using a Mersenne Twister. As evolutionary algorithms include many stochastic operators, this feature is of eminent helpfulness.

3.2. Genotype-Phenotype Translation The genotypic representation of the schedule is an essential part of the design of genetic algorithms. It determines which type of operators can be applied and therefore also strongly affect the solution behaviour. Here, a bit-string representation was chosen that mirrors the binary variables βt and ωt of the problem formulation in Section 2.2 for each slot t. As a reminder, βt tells whether the heat pump is running in slot t and ωt signals when the heat pump is set to charge the heating storage. Thus, the genotype forms as follows: slot bit genotype

1 0 β1

2 1 ω1

2 β2

3 ω2

... ... ...

N slots 2· − 2 2 · N slots − 1 β N slots ω N slots N slots

Table 3.1.: Genotype structure of heat pump schedule

25

3. Design and Implementation

An exemplary genotype and its corresponding transformation into a heat pump schedule is given in Table 3.2. It is worth noting that by default 00 and 01 both give the heat pump a signal not to operate (OFF) while 10 triggers a charging process for the hot water storage (HW) and 11 means that the heat pump is charging the heating storage (HE). genotype schedule

10 HW

00 OFF

11 HE

00 OFF

01 OFF

00 OFF

··· ···

11 HE

11 HE

10 HW

Table 3.2.: An exemplary genotype and its corresponding schedule The Translator calculates the thermal and electrical energy, state of charge and storage temperatures for each slot of the optimisation horizon. These result from the schedule proposed by the currently considered solution. The calculation is based on the problem formulation given in Section 2.2 and given required inputs. According to Equation 2.6, the value of the objective function is determined by the simulated electrical power consumption and the given price signal. As not all proposed schedules yield feasible solutions without violations of temperature bounds, a constraint analysis has to be performed additionally. The constraint analysis of the Translator finds two metrics for the cumulated temperature bound violations within one optimisation horizon H opt . First, the number of temperature constraint violations Vcount within H opt is counted. Let `t and ht denote the indicators whether a minimum or maximum restriction is violated in slot t given by  1 ∀t ∈ {1 . . . N slots } : `t =  0   1 ht =  0 

ϑt < Tmin else ϑt > Tmax else

(3.1)

Then Vcount =

slots NX

`tHW + `tHE + htHW + htHE

(3.2)

t=1

A second measure focussing on the severity of too high or too low temperatures, namely the sum of all temperature violations Vtemp in ◦C, is calculated in the following way: Vtemp =

slots NX

HW HE max{0,Tmin − ϑtHW } + max{0,Tmin − ϑtHE }

t=1 HW HE + max{0, ϑtHW − Tmax } + max{0, ϑtHE − Tmax }

The costs c as well as Vtemp and Vcount are stored in the Solution.

26

(3.3)

3.3. Fitness Evaluation and Constraint Handling

3.3. Fitness Evaluation and Constraint Handling The heat pump scheduling problem is subject to hard constraints. Therefore, the following section addresses two means of handling constraints within the genetic algorithm. Section 3.3.1 sheds light on direct constraint handling by means of preserving feasibility by repairing infeasible solutions. Subsequently, Section 3.3.2 explains how an adaptation of the fitness values via penalty functions can help drag the solving process into the right direction.

3.3.1. Feasibility Preservation by Reparation Reparation is one way of receiving feasible solutions throughout the optimisation process. In doing so, infeasible solutions are generally moved to the closest point in the feasible space. One can further differentiate the Baldwinian approach from the Lamarckian approach [Weic15]. The Lamarckian approach assumes that individuals develop their traits during their lifetime and that this information is coded in the genotype. Hence, repaired feasible solutions replace their infeasible pendants in the population. In contrast, the Baldwinian approach assumes that characteristics gained during an individuals lifetime only propagate via selection advantages. Thus, solutions are only repaired for evaluation purposes while the genotype remains unchanged. In this work the repaired schedules are used according to the Lamarckian approach. It is important to note that reparation potentially poses a barrier to crossing the infeasible regions of the search space and might reduce the diversity of the population [EiSm03]. The solutions of the heat pump scheduling problem can be repaired by forcing a start of the heat pump prior to slots with a minimum temperature restriction and forcing a stop of operation when maximum temperature limits are exceeded. The reparation that was implemented is performed consecutively for each heat storage individually. A randomly initialised boolean decides the initial storage for which the reparation is run and is switched afterwards for the next reparation process. As long as a maximum number of reparation cycles is not reached, the schedule is adjusted with regards to the respective storage. Initially, the first temperature violation is searched for and information on whether a maximum or minimum temperature bound is broken and on the position of occurrence is given. If a minimum temperature violation is detected, the heat pump is scheduled to run in the first prior slot where it is not yet operating. If a maximum temperature violation is found, the heat pump is forced to shut down in the exact slot. If reparation is applied, all solutions are repaired by default. An alternative approach would be to introduce a reparation threshold in combination with a penalty function such that only solutions with a low number of temperature violations are repaired in order to reduce computation time. As the number of reparation steps is limited due to computational effort it cannot be guaranteed that feasible solutions are obtained.

3.3.2. Bias Against Infeasible Individuals by Penalty Functions The fitness function F (x ) states how well a solution x performs with regards to the problem definition. It is the sole quality measure assigned to the genotype. An intuitive way of

27

3. Design and Implementation

defining a fitness function in the heat pump scheduling problem would be to equate it with the calculated total costs of electricity consumption c (x ). F (x ) = c (x )

(3.4)

As the heat pump scheduling problem seeks to minimise costs, the genetic algorithm is designed to correspondingly minimise the fitness value. Here, one may note that any minimisation problem can be transferred into a maximisation problem by forming the inverse of its objective function. By introducing penalty terms to the fitness function, the vital question of how to compare two infeasible solutions with each other or a feasible solution to an infeasible one is answered. The challenge of designing such penalty terms is to find a balance between the exploration of the whole solution space and reaching feasible solutions. This balance is especially important as according to [EiSm03] the optimum of a problem often lies very near to the boundary between the feasible and infeasible search space. This statement also seems to be valid for the heat pump scheduling problem as it by tendency tries to keep the heat storages at lowest permitted temperatures for efficiency reasons while optimising if it is not currently building a buffer. There are various ways of forming penalty terms. With Vtemp from Equation 3.3 serving as measure for the severity of violation, the simplest penalty term is characterised by a static addition of Vtemp multiplied by a factor R. This can be dynamised by coupling the penalty factor R to the current generation д. This way, the penalty increases the further the optimisation has progressed. More adjustments can be made with the exponents a and b. The resulting fitness functions are given by

static penalty: dynamic penalty: log penalty:

F (x ) = c (x ) + R · Vtemp (x ) F (x ) = c (x ) + (R · д)a · Vtemp (x )b

R ∈ R+ a, b, R ∈ R+ , д ∈ N+ (3.5)

F (x ) = c (x ) + R · loga (д) · Vtemp (x )b a, b, R ∈ R+ , д ∈ N+

The common problem of the above-mentioned penalty functions is that they require the user to specify a number of parameters but the impact on the solution behaviour of these is unknown by the user. The parametrisation would then be subject to extensive parameter search or based on rules of thumb [Shuk16]. An alternative is the parameter-free fitness evaluation which assumes that any feasible solution is better than any infeasible one.

parameter-free penalty:

 c (x ) F (x ) =  c max + Vtemp (x ) 

if Vcount (x ) = 0 if Vcount (x ) > 0

(3.6)

Yet, for the heat pump scheduling problem the worst feasible solution possible is generally unknown. Therefore, c max is adapted in the following to the worst feasible solution found to date. In the following this penalising method is employed if not specified differently.

28

3.4. Initial Populations

3.4. Initial Populations The initialisation of the initial solution set is kept simple in most genetic algorithms. However, it is possible to use problem-specific knowledge to start with better solutions. An issue of building solutions by heuristics can be to provide the algorithm with sufficient diversity for the evaluation to prosper [EiSm03]. Another aspect that has to be considered is whether intelligent initialisation is worth the computational effort as evolutionary algorithms are characterised by rapid initial progress and decrease in the improvement rate later on. This section will deal with the creation of arbitrary solutions and domain-specific methods such as demand-sensitive arbitrary, efficiency-based and pricelist-generated initial solutions.

3.4.1. Arbitrary Solutions Arbitrary solutions are created by allocating the same probability to each of the three possible operation modes of the heat pump for each slot t ∈ {1 . . . N slots }. As the sequences 00 and 01 both represent the same operation mode, namely that the heat pump is turned off, they are assigned half the probability of the operation mode. 1 6 (3.7) 1 slots P(βt = 1, ωt = 0) = P(βt = 1, ωt = 1) = ∀t ∈ {1 . . . N } 3 This method of creating initial solutions is the one considered that requires the least computational effort. However, the given probabilities bias the initial schedule towards running two thirds of the slots within the optimisation horizon. P(βt = 0, ωt = 0) = P(βt = 0, ωt = 1) =

3.4.2. Demand-sensitive Arbitrary Solutions A way to test the influence of this bias on the solution behaviour is to compare it to a demand-sensitive adaptation meaning that the presumed heat demand for each storage determines the estimated number of slots for the respective operation mode in the schedule. Therefore, the estimated total heat demand of the optimisation horizon Λ is calculated. Λ

HW

=

slots NX

t=1

DtHW

and

Λ

HE

=

slots NX

DtHE

(3.8)

t=1

Moreover, an estimate of the potential thermal power generation qˆ is made based on the average predicted outside temperature throughout the optimisation horizon T¯ outside and the storage’s initial temperature ϑ 0 , thus assuming a constant coefficient of performance.   th th qˆHW = ∆t C 0th + C vap · T¯ outside + C cond · ϑ 0HW   (3.9) th th qˆHE = ∆t C 0th + C vap · T¯ outside + C cond · ϑ 0HE From Λ and qˆ one can subsequently predict the total number of slots n calc in which the heat pump has to charge one of the two storages.

29

3. Design and Implementation

nHW calc =

ΛHW qˆHW

and

nHE calc =

ΛHE qˆHE

(3.10)

In order to find a random schedule from the given information, a slot i that is not yet scheduled for heat pump operation is drawn at random. The share of the remaining slots to run n rem compared to the total remaining number of slots of all storages determines the probability of selecting a specific storage at the drawn slot i.

P(βi = 1, ωi = 0) =

n HW rem HW n rem + nHE rem

and

P(βi = 1, ωi = 1) =

n HE rem HW n rem + n HE rem

(3.11)

Starting with n rem = n calc , the remaining number of slots to run is decremented by one after each change made to the charging schedule of the respective storage. The process is reiterated until n rem = 0 for all storages.

3.4.3. Efficiency Solutions For building an efficiency-based starting population, an empty schedule in which the heat pump is turned off throughout the whole optimisation horizon is repaired by forced starts once the temperature drops below the minimum temperature. The idea is to keep the temperatures in the storages as low as possible. Hence, this method provides solutions close to exploiting the maximum coefficient of performance of the system. As a diverse initial solution set is an essential requirement of the genetic algorithm, a discrete stochastic distribution is integrated into the method causing that forced starts are potentially preponed. Let i denote the first slot where – independent from the storage – a temperature restriction is violated. Then the probabilities for the reparation to start, now according to the particular storage where the temperature violation is detected, is given by P(i − r 0 ) = 0.6

P(i − 1 − r 1 ) = 0.3

P(i − 2 − r 2 ) = 0.1

Naturally, such shifts are omitted if i reaches the beginning of the optimisation horizon. The numbers r 0 , r 1 and r 2 represent the distance to the next previous slot from the shifted position in which the heat pump is not yet operating. This way, it is prevented that slots where the heat pump already runs are overwritten. This becomes particularly relevant when the minimum temperature violations of heating and hot water storage coincide. The reparation process explained above is repeated until a feasible solution is found. In short, this way of building solutions is based on efficiency but does not consider any information on the current electricity tariff. An exemplary initial solution created this way is depicted in Figure 3.4.

3.4.4. Pricelist-generated Solutions Unlike the efficiency-based method, the solutions generated by price sorting do not yield feasible solutions in general. Pricelist-generated solutions solely focus on the price signal and the expected demand, but do not concern about temperature bound violations. They

30

3.4. Initial Populations Schedule (20-NO, 22.5-HW, 25-HE)

Temperature (HW)

Temperature (HE)

Minimum (HW)

Minimum (HE)

Temperature [°C] / Schedule

40

35

30

25

20

15 0

5

10

15

20

25

30

35

40

45 50 Slot

55

60

65

70

75

80

85

90

Figure 3.4.: Exemplary initial solution created by the efficiency-based approach

Schedule (20-NO, 22.5-HW, 25-HE) Minimum T. (HE)

Temperature (HW) Maximum T. (HW)

Temperature (HE) Maximum T. (HE)

Minimum T. (HW) Price

65

40

60 30 55

Temperature [°C]

45

10

40 0

35 30

Price [ct\kWh]

20

50

-10

25 -20 20 15

-30 0

5

10

15

20

25

30

35

40

45

50

55

60

65

70

75

80

85

90

95

Slot

Figure 3.5.: Exemplary initial solution created by the pricelist-based approach

are created by scheduling heat pump operations in the cheapest slot of the price time series according to the the expected necessary number of slots n calc to run. The estimate for the total numbers of slots n calc in which the heat pump has to charge each storage is calculated exactly as it is done in Section 3.4.2. Then, starting with the cheapest electricity prices of the optimisation horizon, slots are chosen in the ascending order of their tariffs. Which storage is charged in the chosen slot is determined as is shown in Equation 3.11. Finally, the creation process of a solution terminates once n rem = 0 holds for both storages. In order to create more variable solutions, the cheapest slot is skipped with a probability of 5% and sorted behind all slots of the list where the heat pump does not yet operate. Figure 3.5 shows an exemplary pricelist generated solution. The choice of the initialisation method is postponed to the evaluation in Chapter 4. In the following the initial solution sets are built exclusively arbitrarily. The main reason for this is that a far reaching impact on the solution quality throughout a full year is expected. However, for parametrisation only the initial 4 months were considered.

31

3. Design and Implementation

3.5. Base Configuration For testing purposes throughout this chapter a base configuration is defined. Findings from the following sections might advise changes and extensions to this parameter set. Therefore, adaptations are noted as final remarks of each section. The test layout will consider the optimisation of 115 cycles with a 24h optimisation horizon split into slots of 15 minutes length. Parameter

Values

Price signal

intraday auction (s = 5, q = 24 ct/kWh) Population size 100 Offsprings / generation 100 Initial population arbitrary Penalty parameter-free Termination 400 generations Parent selection binary tournament Crossover single-point crossover Mutation bitflip mutation Mutation rate 3/192 = 1.56% Survival selection fitness-based Random seed 702839760670341

Reference Section 2.1.3 rule of thumb [Shuk16] cf. population size TournamentSelection NPointCrossover jMetal -

Table 3.3.: Base configuration of the genetic algorithm

3.6. Operators of the Genetic Algorithm Having introduced the prerequisites of running the evolutionary cycle by defining the genotype-phenotype translation and the fitness evaluation as well as finding ways of creating an initial solution set to the heat pump scheduling problem, this section now turns to the actual operators of the evolutionary cycle that was shown in Figure 2.9 on page 20. In particular, characteristics and various ways of designing survival selection, parent selection, the crossover and the mutation are examined. Moreover, a satisfactory choice and parametrisation of operators is searched for each component of the evolutionary cycle.

3.6.1. Survival Selection Along with the parent selection the survival selection mechanism introduces the drag for fitness improvements to the genetic algorithm. At the end of each generational cycle parents and their offspring compete for survival in the population that just offers a constant number of spots. The survival selection is responsible for deciding which individuals will subsist and which will perish. Contrary to the parent selection it is a deterministic

32

3.6. Operators of the Genetic Algorithm fitness

keep

discard

age

keep

discard

worst

best

sorted individuals

2 original population

1

0

offspring max. population size

sorted individuals

Figure 3.6.: Illustration of fitness-based (top) and age-based (bottom) survival selection

method. Furthermore, one can distinguish between age-based replacement and fitnessbased replacement [EiSm03]. Using age-based survival selection, the old generation is completely replaced by the offspring it created regardless of fitness values and provided that population size and number of newly generated individuals match. If this is not the case, the individuals of the original population are replaced by their children in descending order according to their age. This way it is possible and even common that the best solution found to date ceases to exist despite its high fitness. Yet, it is assumed that highly fit individuals propagate their traits via their offsprings although they themselves do not persist in the population. A more pressuring approach is the fitness-based selection. This methods works by eliminating the worst individuals of an overfull population of parents and offspring until the maximum population size is reached. Thereby, the fittest individuals are guaranteed to survive. According to [EiSm03], despite very rapid improvements of the population’s fitness this method of survival selection may induce premature convergence by concentrating too much on the fittest individuals. A schematic illustration of both survival selection methods is provided in Figure 3.6. A test was run based on the base configuration defined in Section 3.5 in order to compare the performance of age-based and fitness-based survival selection. The resulting average simulated costs are shown in Figure 3.7. It can be seen that a fitness-based approach performs many times better than the age-based approach. Hence, the base configuration is not updated.

Parameter

Values

Reference

Survival selection

fitness-based

-

Table 3.4.: Adaptations to base configuration regarding survival selection

33

3. Design and Implementation

age-based

560,51

fitness-based

468,87

400

420

440

460 480 500 520 Average Simulated Costs [ct]

540

560

580

Figure 3.7.: Evaluation of survival selection methods

3.6.2. Parent Selection The parent selection is another driver for the progress of the genetic algorithm. Its responsibility is to find relatively fit pairs of individuals that will procreate. Other than the deterministic survival selection, the search process for parents is probabilistic. It is essential to the preservation of diversity, and thus the search for a global optimum, that also low-ranking individuals possess a small chance of being selected as parents. This section presents three selection methods in notable variants, namely tournament, fitness-proportional and rank-based selection. Tournament Selection

Tournament selection equals a form of competition. An amount of k individuals is arbitrarily selected from the current population. Consequently, the individuals are sorted according to their fitness and the best is chosen as first parent. Equally, the second parent is found. The most commonly used tournament is a binary tournament where k = 2. In [SoWh05] it was shown that a high tournament size k can result in an undesired loss in diversity. For this reason only tournaments with k ∈ {2, 3, 4} are compared in this work. Fitness-Proportional Selection

In principle, fitness-proportional selection determines the chance for selection of an individual by relating its fitness to the sum of all fitness values in the population. However, as the heat pump scheduling problem seeks to minimise fitness by definition the inverse fitness has to be considered when finding the selection probabilities. Let ui = fi−1 be the inverse fitness of the individual ranked at the i-th position of the sorted population and µ denote the population size, then its selection probability is given by: f −1 = Pµ i −1 j=1 u j j=1 f j

ui P(i) = Pµ

However, with this approach inordinately performing individuals gain extreme selection probabilities causing rash convergence. In case most individuals possess similar fitness values like it is common close to the termination of the algorithm, the selection pressure is lost as all individuals are attributed with similar selection probabilities. Windowing is one approach to address this issue by retrieving selection probabilities from the fitness differentials. This is done by subtracting the minimum inverse fitness u min from all ui yielding:

34

3.6. Operators of the Genetic Algorithm

ui0 = ui − u min



u0 P(i) = Pµ i

(3.12)

0 j=1 u j

Likewise, the sigma scaling approach presented in [EiSm03] attempts to stabilise the selection pressure throughout the evolutionary cycles despite decreasing fitness gaps between individuals of a population. The standard deviation σu of the inverse fitness values in the population is used to adapt the selection probabilities by ui00

= max{ui − (u¯ − α · σu ), 0}



ui00

P(i) = Pµ

00 j=1 u j

(3.13)

where normally α = 2 and u¯ denotes the mean of all fitness values. The effect of scaling methods is illustrated in Figure 3.8. Whilst the selection probabilities do not differ between scaled and unscaled probabilities in a diverse population (b), it is notable that the use of scaling helps to maintain similar selection pressure in a population close to convergence (a) whereas unscaled probabilities lose their driving force. One major drawback with regards to the heat pump scheduling problem is due to the fact that – although uncommon – negative fitness values are possible. Despite their outstanding performance their selection probability would be zero and would distort the sum of fitness values as well. Ranking Selection

Ranking selection is another method to preserve a constant selection pressure throughout the run of the genetic algorithm. Contrary to fitness-proportional methods it allocates selection probabilities according to the rank of the individual rather than its actual fitness value. Thus, the same rank in the population belongs to the exact same selection probability in each cycle. In this work the ranking selection probabilities were formed linearly, but naturally other types of distributions such as an exponential layout can be derived from the rank. Let the fittest individual be assigned with rank µ, whilst the unfittest individual receives rank 1, and let s ∈ (1, 2] be a parameter that defines the selection pressure. Then the linear selection probability of an individual of rank i is given by: P(i) =

2 − s 2i (s − 1) + µ µ (µ − 1)

(3.14)

The impact of the parameter s on the selection probabilities based on the rank is shown in Figure 3.8 (c). Whilst s = 1 yields the same selection probabilities for all ranks, the selection pressure reaches its climax if s = 2. In order to find the most suitable method and parameter set for the heat pump scheduling problem, another test based on the base configuration was run. The results can be retrieved from Figure 3.9. It is notable that except for the unscaled fitness-proportional parent selection, the selection methods yielded similar costs. This underlines the importance of maintaining a constant selection pressure throughout the optimisation. The lowest average simulated costs could be achieved using a tertiary tournament selection. Therefore, the base configuration is updated by replacing the binary tournament selection.

35

3. Design and Implementation

Sigma Scaling

No Scaling

42

44

46

48

50

52

54

56

58

Windowing

Sigma Scaling

0,14 0,13 0,12 0,11 0,1 0,09 0,08 0,07 0,06 0,05 0,04 0,03 0,02 0,01 0

s = 1.0

Selection Probability

Windowing

Selection Probability

Selection Probability

No Scaling 0,14 0,13 0,12 0,11 0,1 0,09 0,08 0,07 0,06 0,05 0,04 0,03 0,02 0,01 0

0

10

20

Fitness

30

40

50

60

70

80

90 100

s = 1.5

s = 2.0

0,14 0,13 0,12 0,11 0,1 0,09 0,08 0,07 0,06 0,05 0,04 0,03 0,02 0,01 0 0

2

4

6

Fitness

8

10

12

14

Rank

Figure 3.8.: Exemplary selection probabilities for (a) near-convergence population (b) diverse population (c) ranking selection

Ranking (s=2.0)

468,93

Ranking (s=1.5)

469,82

Fitness-proportional (sigma-scaling)

468,79

Fitness-proportional (windowing)

467,98

Fitness-proportional (no scaling)

473,45

Tournament (k=4)

469,39

Tournament (k=3)

467,25

Tournament (k=2)

469,36

450

454

458 462 466 470 Average Simulated Costs [ct]

474

Figure 3.9.: Evaluation of different approaches to parent selection

36

478

3.6. Operators of the Genetic Algorithm

Parameter

Values

Reference

Parent selection

tertiary tournament (k = 3)

TournamentSelection

Table 3.5.: Adaptations to base configuration regarding parent selection

3.6.3. Crossover Once two parents are selected to create two children, the crossover operator is executed. The crossover’s task is to form new individuals by recombining the genotypes of the parents. Besides mutation it is one of the two variation operators in the genetic algorithm. While the n-point crossover is the most common recombination operator, this section also deals with the uniform and the shuffle crossover for testing purposes. n -Point Crossover The systematics of an n-point crossover can be best explained via a single-point crossover. This recombination method is performed by cutting the two parents’ genotypes into two tails at a single randomly drawn position. The tails are then recombined such that bow and stern of the offspring originate from different individuals. The n-point crossover constitutes the natural extension to the single-point crossover employing multiple instead of one crossover points. An illustration of both is given in Figure 3.10. With regards to the heat pump scheduling problem, the n-point crossover has the eminent tendency to keep genes that are located close to each other together. One presumed disadvantage of this recombination method however is its positional bias stating that if n is odd genes at opposite ends of the genotype are rather kept together in the new offspring [EiSm03]. Uniform Crossover

The uniform crossover operator constitutes another recombination method that seeks to eliminate positional bias [EsCS89]. As sketched in Figure 3.10, for each bit individually it is randomly decided from which parent it should inherit. As with regards to the heat pump scheduling problem such proceeding would rather derange the schedule than transport useful information, the crossover is adapted such that the slots of two bits length instead of one bit is the smallest recombination unit. However, a disadvantage of uniform crossover is its distributional bias as it by tendency transmits 50% of genes from each parent [EiSm03]. Moreover, it is assumed that it does not suit the heat pump scheduling problem as well as the n-point crossover due to the fact that sequences of slots also carry useful information. To investigate whether the positional bias of the n-point crossover introduces any negative or even beneficial characteristics to the genetic algorithm, a shuffle crossover is implemented which embeds an n-point crossover. It consists of three steps: shuffle, crossover, unshuffle. The shuffling operator randomly but equally permutates the two bitstrings of the parents in order to reduce the positional bias of the crossover operator. After the crossover the resulting bitstrings are unshuffled again according to the given permutation [EsCS89]. Shuffle Crossover

37

3. Design and Implementation

child 1

single-point crossover

child 2

Crossover Point 1 child 1

n-point crossover

child 2 CP1

CP2

CP3 child 1

uniform crossover

child 2

Figure 3.10.: Schematic illustration of crossover operators Shuffle (7-point)

471,59

9-point crossover

469,02

8-point crossover

467,34

7-point crossover

466,88

6-point crossover

467,05

5-point crossover

467,84

4-point crossover

467,61

3-point crossover

467,7

2-point crossover

469,15

1-point crossover

469,36

556.67

Uniform 460

462

464

466 468 Average Simulated Costs [ct]

470

472

474

Figure 3.11.: Evaluation of parametrised crossover operators

The test results depicted in Figure 3.11 on different crossover operators and parameters show that similar results are obtained with different numbers of crossover points. With 466.34 ct the 7-point crossover reached the lowest average simulated costs. As expected the uniform crossover rocketed the scale by far and was proven unsuitable for the heat pump scheduling problem. Moreover, it could be shown via the shuffle crossover that the positional bias of the n-point crossover does not harm the solution quality but is rather beneficial. Thus, the base configuration is extended by a 7-point crossover. Parameter

Values

Reference

Crossover

7-point crossover

NPointCrossover

Table 3.6.: Adaptations to base configuration regarding crossover

3.6.4. Mutation The mutation operator is the second variation operator of the genetic algorithm. It is responsible for causing random changes to keep up diversity within the population and

38

3.6. Operators of the Genetic Algorithm

Heat Pump (4.69%)

466,81

Heat Pump (4.17%)

465,72

Heat Pump (3.65%)

466,44

Heat Pump (3.13%)

466,61

Heat Pump (2.60%)

467,86

Heat Pump (2.08%)

469,41

Heat Pump (1.56%)

471,62

Heat Pump (1.04%)

479,91

Bitflip (2.60%)

475,17

Bitflip (2.08%)

470,12

Bitflip (1.56%)

467,91

Bitflip (1.04%)

468,56

Bitflip (0.52%)

475,58

454

458

462

466 470 Average Simulated Costs [ct]

474

478

482

Figure 3.12.: Evaluation of the impact of different mutation rates and methods (0.52% = 1bit / 192bits)

exploring new regions of the search space. The mutation rate defines a probability at which a gene is subject to mutation. The expected number of changes is usually set around 1-5 genes per genotype depending on its length. The Bitflip Mutation is the default mutation operator provided by the jMetal package. It flips a bit of the genotype at a given probability. The Heat Pump Mutation is an adaptation of the bitflip mutation to the heat pump scheduling problem. Instead of flipping one random bit, a slot’s operation mode is switched to one of the two other operation modes. For example, if the heat pump is not running in the randomly selected slot the mutation causes that the heat pump is scheduled to either charge the heating or the hot water storage. The two mutation methods are tested with various mutation probabilities using the current base configuration. The results are displayed in Figure 3.12. A mutation probability of 0.52% corresponds to the expectation value that one bit is flipped in the genotype with 192 bits. The minimum average simulated costs of the bitflip mutation were reached at a mutation rate of 1.56%. The heat pump specific mutation showed a consistent decline of costs up until a mutation rate of 4.17% achieving lower costs than the best bitflip mutation run. Consequently, the base configuration is updated with the heat pump mutation as operator.

Parameter

Values

Reference

Mutation Mutation rate

heat pump mutation 8/192 = 4.17%

HeatPumpMutation -

Table 3.7.: Adaptations to base configuration regarding mutation

39

fitness

3. Design and Implementation

worst fitness in population

max. computation time best fitness in population

satisfactory gap

last improvement

max. number of generations

generation

Figure 3.13.: Schematic illustration of termination conditions

3.7. Termination Conditions As the global optimum of the heat pump scheduling problem is generally unknown, the genetic algorithm requires a termination condition that stops the algorithm some time regardless of its performance. There are several ways of defining such termination conditions. The easiest way would be to allocate a maximum computation time to the optimisation process, but the final solution quality then depends on the technical system on which the algorithm runs. A more general limit is given by allowing the evolutionary cycle to be run for a maximum number of generations only. Yet, this condition does not consider any information on the current state of the solution set. For instance, as the maximum number of generations is set manually and due to the fact that the population will converge regarding its fitness values, the algorithm could terminate too quickly while improvements are still found or it could terminate too late such that computation time is wasted without significant refinement. Therefore, two further options which try to address this issue are implemented. The first option uses the gap between the worst and the best individual’s fitness value as measure for the progress of the algorithm. Once the gap drops below a predetermined satisfactory level, the optimisation terminates. The second option prompts a termination if the last significant improvement of the population’s best individual dates back a preset number of generations. Improvements within a given percental threshold are not deemed significant. The test results of different termination conditions are depicted in Figure 3.14. It is important to note that the best choice of the termination conditions strongly depends on the preferences of the user. By means of severe conditions, solutions can be obtained quickly but with a potentially substantial lack of solution quality. This holds equally for termination signals issued by a maximum number of generations or satisfactory gap reached as wells as a lack of improvements for the last generations. In the following, this work will foremost concentrate on finding the best solution quality. Thus, the base configuration is not updated for now.

40

3.8. Performance Enhancements

Parameter

Values

Mode

Termination mode

400

maximum number of generations

Table 3.8.: Adaptations to base configuration regarding the termination mode 492

4000 490,23

488

3500 3000

480

479,54

2499

2500

477,26

476

475,39

1984

472,97 2000

473,76

472 1409

1458

470,12

468

1670

1596

1500 1126

465,72

464

Computation Time [ms]

Average Simulated Costs [ct]

484

1000

643

460

500

456

0

Figure 3.14.: Evaluation of termination modes

3.8. Performance Enhancements Several approaches that could potentially enhance the performance of the genetic algorithm are analysed in this section. The aim is not only to improve the solution quality but also the speed at which they are found. The trade-off has to be carefully considered and depends as already stated in Section 3.7 on the user preferences. Beginning with duplicate testing, this section additionally deals with the application of local search and introduces parallelism into the genetic algorithm. Finally, it is examined if the time consuming evaluation of new solutions can be accelerated.

3.8.1. Duplicate Testing Testing for duplicates when adding the offsprings into the population can help to prevent premature convergence due to well performing clones of individuals that could otherwise take over the population. Therefore, in this approach only offsprings whose genotype does not yet exist in the population is added before survival selection takes place. Also duplicates within the offspring population are considered. The Hamming distance h(b1 , b2 ) between two bitstrings b1 and b2 , which counts the number of positions where b1 and b2

41

3. Design and Implementation

10000 8466

467

7500

466,71

466

5000 465,95 2456

465

2500

464

Computation Time [ms]

Average Simulated Costs [ct]

468

0 Test for duplicates (false)

Test for duplicates (true)

Figure 3.15.: Evaluation of duplicate testing

differ, is used to identify duplicates. Two solutions are duplicates if their corresponding bitstrings b1 and b2 result in h(b1 , b2 ) = 0. However, this would not yet find all duplicates according to the schedule as the bit sequence 00 and 01 result in the same schedule but are not identified as such by the Hamming distance in the genotype. Therefore, a bijective mapping between phenotype and genotype has to be ensured, meaning that one genotype corresponds to exactly one heat pump schedule. This is achieved by excluding the bit sequence 01 in the creation process of initial solutions, reparation and mutation by replacing it with the bit sequence 00. Moreover, the crossover may only cut between slots of two bits length but not within slots. A test was run to examine the performance enhancement of duplicate testing the results of which can be seen in Figure 3.15. In order to control the impact of the adaptations made to the creation of the initial solution set, mutation and crossover by excluding the sequence 01, a run without duplicate testing was performed exhibiting a minor rise in costs. The subsequent run with duplicate testing resulted in almost no improvement whilst almost quadrupling the computation time.

3.8.2. Local Search The incorporation of a local search algorithm into the genetic algorithm can potentially improve the solution quality as well on cost of a little extra computational effort. It is characterised by a search for a better solution x + in the genotypic neigbourhood of the solution x. A local search operator varies the solution slightly and evaluates the result. If a better individual is found, it replaces the original individual. If no better individual is found, the change by the local search operator is discarded. This process is repeated for a given maximum number of rounds n local . In this work, two local search operators were implemented. The first is a simple heat pump mutation and the second is a mutation based on switching 3 slots by exclusive permutation around a randomly drawn position implemented in SwitchMutation.

42

3.8. Performance Enhancements

No local search

2499

Simulated Annealing (n_local=20, n_gen=20, α=0.97, θ_0=1.0)

2622

Simulated Annealing (n_local=20, n_gen=20, α=0.99, θ_0=1.0)

2654

Threshold (n_local=20, n_gen=20, α=0.97, θ_0=0.5)

3194

Threshold (n_local=20, n_gen=20, α=0.99, θ_0=0.5)

2848

Hillclimbing (n_local=20, n_gen=10)

3962

Hillclimbing (n_local=40, n_gen=20)

4045

Hillclimbing (n_local=30, n_gen=20)

3324

Hillclimbing (n_local=20, n_gen=20)

2623

2000

2500

3000 3500 Computation Time [ms]

4000

4500

Figure 3.16.: Computation time of different local search approaches in GA No local search

465,72

Simulated Annealing (n_local=20, n_gen=20, α=0.97, θ_0=1.0)

460,14

Simulated Annealing (n_local=20, n_gen=20, α=0.99, θ_0=1.0)

459,71

Threshold (n_local=20, n_gen=20, α=0.97, θ_0=0.5)

459,9

Threshold (n_local=20, n_gen=20, α=0.99, θ_0=0.5)

459,46

Hillclimbing (n_local=20, n_gen=10)

460,06

Hillclimbing (n_local=40, n_gen=20)

459,53

Hillclimbing (n_local=30, n_gen=20)

459,62

Hillclimbing (n_local=20, n_gen=20)

460,14

456

457

458

459 460 461 462 463 Average Simulated Costs [ct]

464

465

466

Figure 3.17.: Average simulated costs of different local search approaches in GA

The acceptance mode of mutated solutions of the above-mentioned kind is known as hillclimbing (or here: inverse hillclimbing) as only improving mutations are adopted. However, in searching for global optima it can be helpful to accept slightly worse individuals x − in early rounds of the local search. For instance, simulated annealing provides an acceptance mode that accepts all x + and some x − by a given probability. Simulated annealing is inspired by the physical cooling process of materials from which it derives its probability of acceptance. Based on a preset cooling plan given by a progression of temperatures (θ j )j∈N with θ j ∈ R and limj→∞ θ j = 0, the probability of acceptance is [Weic15]: ! |F (x ) − F (x − )| − Pj (accept x ) = exp (3.15) θj A non-probabilistic alternative is to use such a cooling plan as a hard threshold of the maximum allowed deterioration in local search round j [Weic15]. The progression of cooling plan temperatures (θ j )j∈{1...nlocal } is usually given by θ j+1 = θ j · α

(3.16)

where the initial temperature θ 0 and the parameter α ∈ [0.8, 0.99] are manually chosen. Also here, tests were conducted to find out whether local search can enhance the solution quality of the genetic algorithm. The results are depicted in Figure 3.16 and 3.17. As local

43

3. Design and Implementation

search is generally extremely time consuming, tests were restricted to performing a local search only once after a specified number of generations n gen . First of all, it could be shown that the switching mutation could provide better results than the heat pump mutation, such that all subsequent tests were build up on SwitchMutation, but also that all local search approaches could show improvements. The difference between the acceptance modes and parameter sets is marginal. With 459.46 ct and a computation time of 2848 ms the threshold mode of acceptance had the best results with α = 0.99 and θ 0 = 0.5. Particularly, it could reduce costs compared to the corresponding run without local search by 1.34%. Therefore, local search with a threshold as acceptance mode is used in the evaluation in Chapter 4.

Parameter

Values

Mode

Local search n local = 20, n gen = 20, α = 0.99 and θ 0 = 0.5 threshold Table 3.9.: Adaptations to base configuration regarding local search

3.8.3. Parallelism Until now, the genetic algorithm operates with one thread only. In order to also use the capacity of further available processors, three approaches are presented in this section. For instance, one could evaluate the solution set in parallel as its solutions’ evaluations do not interdepend. The library jMetal provides a class MultithreadedEvaluator that allows for performing the evaluation in parallel. As the genotype-phenotype translation is one of the most time consuming parts of the algorithm, parallel evaluation seems promising. When running the genetic algorithm with varying random seeds it can be recognised that the solution quality of individual cycles features a variance while the mean simulated costs over all cycles remain stable. In order to utilise this variance for a better solution quality, one could run the genetic algorithm on each available processor with different random seeds and retrieve the best solution of each cycle. Likewise, one could run different configurations of the genetic algorithm on each processor in parallel and subsequently exploit the respective cycle’s best solution. When using parallel configurations or seeds it is not recommended to use parallel evaluation as well. The incorporation of parallelism into the genetic algorithm was tested using the base configuration with four available threads. Figure 3.18 shows the resulting computation time and the achieved average simulated costs. Parallel evaluation was able to decrease the computation time by 17.2% while, of course, yielding the same costs. The parallel run of four genetic algorithms could lower costs by 0.68-1.12%. Particularly, parallel configurations could improve solution quality by using the four different initial solution set creation methods. Yet, this improvement in costs resulted in an increase in computation time approximately by factor 3.5. Therefore, local search was picked in favour of running parallel configurations such that only the evaluation is conducted in parallel.

44

3.8. Performance Enhancements

Parameter

Values

Mode

Parallelism

-

parallel evaluation

Table 3.10.: Adaptations to base configuration regarding parallelism Computation Time [ms]

Simulated Costs [ct]

Costs [ct]

466

6000 465,72

465,72

4151

4278

464

4000 462,56

462

460

5000

3000 460,51

1495

2000

1238

458

1000

456

Computation Time [ms]

468

0

Not parallel

Parallel evaluation

Parallel seeds

Parallel configurations

Figure 3.18.: Simulated Costs and computation time of different uses of parallelism

3.8.4. Improved Evaluation Children can potentially be very similar to their parents. This trait can be utilised by taking parts of the calculations made for the evaluation of the parents to perform the evaluation for their children. Every child receives a reference to its parent’s evaluation from which it inherits its first sequence of slots. Subsequently, the position of the first slot where child and respective parent differ is determined by the minimum of the earliest crossover point and the earliest mutation position. Until this point, the evaluation of parent and child coincide and can thus be transferred directly from parent to child. This way the evaluation should be faster the further this position advances into the optimisation horizon as it omits parts of the calculation. A test however did not result in the anticipated acceleration.

45

4. Evaluation Having found a suitable configuration and parametrisation of the developed genetic algorithm, this section turns towards the evaluation of the algorithm’s performance in comparison to two reference cases: hysteresis-based operation as unoptimised reference case and price-sorting solution as naïve optimisation approach. Therefore, the evaluation criteria are defined initially. The first part of this chapter deals with the main characteristics of the performed optimisation and its corresponding heat pump schedules. Different initialisation methods and back boundary temperature constraints are applied. Moreover, a comparison to a genetic standard algorithm is conducted before shedding light on the solution behaviour and on the question of to what extent the buffer storage is utilised. Finally, it is examined how well the developed evolutionary algorithm performs in comparison to the reference cases. The second part of this chapter subsequently deals with the robustness of the evolutionary algorithm towards external factors, namely, the price profiles and spreads as well as uncertainty of demand. Finally the extensibility by further devices is qualitatively discussed and a potential analysis is conducted.

4.1. Evaluation Criteria and Reference Cases For examining the performance of the genetic algorithm in comparison to standard approaches, costs and computation time constitute the main evaluation criteria. With regards to the costs one may differentiate between the optimised costs calculated from the problem formulation and the actual simulated costs which result from the processing of the optimised schedule by the device controller. The latter could be more expressive as it remedies potential invalid sections of the optimised schedule. The comparison of both indicates the magnitude of corrections necessary by the device controller. Moreover, storage temperatures, relative runtimes, electric energy consumption and thermal energy generation serve as secondary criteria in order to examine the dynamics of the optimisation. The evaluation in this section was performed using the final configuration and inputs of the genetic algorithm of Chapter 3 except for the fact that optimisation was conducted for a full year (365 days) instead of only 115 days. Besides achieving a higher quantity of data, this way it is additionally possible to analyse the behaviour of the optimisation at days without heating demand. Exact information on the machine the evaluation tests were run on is provided in Table A.2 in the appendix. Two reference cases were considered under equal conditions in order to classify the achievements of the genetic algorithm. The hysteresis approach represents the most efficient method to control a heat pump and is the default control method today. In con-

47

4. Evaluation

Storage Temperature (HW)

Storage Temperature (HE)

Lower Hysteresis Temperature (HW)

Upper Hysteresis Temperature (HW)

Lower Hysteresis Temperature (HW)

Upper Hysteresis Temperature (HW)

42

Temperature [°C]

40 38 36 34 32 30

28 26 1

6

11

16

21

26

31

36

41

46 51 Slot [15 min]

56

61

66

71

76

81

86

91

96

Figure 4.1.: Heat-driven heat pump default operation (hysteresis of 4 ◦C at day 6)

trast to the approach of this work it does not consider any price signals but is purely heat driven. Thereby, the heat pump is set to charge a buffer storage as soon as a predefined minimum temperature (lower hysteresis temperature) is reached and is turned off when the maximum temperature (upper hysteresis temperature) is hit. Typically the temperature range is only a few degrees. In the following a hysteresis of 4 ◦C was considered. Figure 4.1 shows the resulting temperature curves of the heating and the hot water storage at the sixth day. The green line depicts the temperature of the heating storage while the blue line illustrates the temperature of the hot water storage. They are surrounded by their respective upper and lower hysteresis temperatures in grey. Naturally, the decrease of temperatures depends on the thermal demand and losses. For example, the hot water storage temperature drops only insignificantly from slots 1 to 37 due to thermal losses and a lack of hot water demand at night. Otherwise, the temperature swings between lower and upper hysteresis temperatures in a triangular shape. Particularly noteworthy is the fact that the hysteresis has to observe two thermal storages in this case. For this reason, it is possible that a charging process of one storage is stopped prematurely in order to avoid temperature drops below the lower hysteresis temperature of the other heat storage. In Figure 4.1 this was the case near slots 52, 53, 58 and 74. With regards to the implementation this control method is triggered by submitting an empty schedule to the device controller, which then operates the heat pump at a granularity of 1 minute according to the hysteresis mode described above. The hysteresis-based operation represents the most efficient way to operate a heat pump when minimum operation times are taken into account. The minimum operation time is implicitly given by the average heating duration between lower and upper hysteresis temperature. Thus, accelerated device attrition is prevented by prohibiting too short on/off cycles. The second reference case for evaluation is formed by submitting an unoptimised pricelist-generated solution as it was explained in Section 3.4.4 to the device controller. After exploiting the slots of minimal electricity prices, the device controller repairs the naturally expected invalid slots such that a feasible schedule is obtained. The resulting annual simulated costs of both reference cases are shown in Figure 4.2. Whilst the default operation (hysteresis) could reach annual costs of 1079 e, the reference optimisation built by price-sortin could reduce the annual costs to 1058 e on average by 2.00% .

48

4.2. Characteristics of Optimisation

Pricelist (reference optimisation)

1058

Default Operation (no optimisation)

1079

700

800

900 1000 Annual Simulated Costs [€]

1100

Figure 4.2.: Annual simulated costs of reference cases

4.2. Characteristics of Optimisation 4.2.1. Impact of Different Initial Solution Sets Until now, exclusively arbitrary initial solution sets were used while parametrising the implemented genetic algorithm. However, in Section 3.4 three further ways of initialising a population were presented: demand-sensitive, efficiency-based and pricelist-generated initialisation. Their choice was postponed due to its expected far reaching impact on the solution quality throughout a full year. The evaluation results of different initial populations in comparison to the reference cases are displayed in Figure 4.3. First of all, it becomes apparent that either way a significant improvement in comparison to the default operation could be realised. Furthermore, the computation times (blue) of different initialisation methods do barely vary such that no trade-off between costs and computation time has to be considered. As the annual simulated costs (green line) outrun the annual optimised costs (orange line) in the range of