Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy...

121
Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607 Business Information Management Coach: Prof. Wolfgang Ketter Co-reader: Dr. Yashar Ghiassi-Farrokhfal Submission date: 04.07.2017

Transcript of Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy...

Page 1: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

Master thesis

Understanding the temporal mismatch between energy demand

and energy supply from renewable sources

By Julia Dahm

Student number: 460607

Business Information Management

Coach: Prof. Wolfgang Ketter

Co-reader: Dr. Yashar Ghiassi-Farrokhfal

Submission date: 04.07.2017

Page 2: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

1

Preface

The copyright of the master thesis rests with the author. The author is responsible for its

contents. RSM is only responsible for the educational coaching and cannot be held liable for

the content.

Page 3: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

2

Executive Summary

In light of a large desire for a more sustainable energy production, the increased use of

renewable energy sources becomes an important goal worldwide. One of the main obstacles to

this goal thereby constitutes the fact that energy supply and demand have to be tightly balanced

at all times for the electricity grid to function. In the traditional grid structure, this balance has

mainly been achieved through adjusting energy generation to meet demand. With an increased

share of renewable energy in the energy generation mix this cannot long stay the primary

solution anymore though because of the intermittent nature of renewable energy sources.

Energy generation with solar photovoltaic systems, for example, is dependent on solar radiation

which can change abruptly due to cloud cover. At the same time, also energy demand can vary

instantly whenever an electric device is switched on or off. However, neither energy generation

from renewables nor energy demand are completely random, but both do follow certain

underlying patterns caused by local climate and social practices. It is important to note that

these underlying patterns are not the same everywhere but that the factors that they depend

upon may differ from one setting to another. Many different suggestions exist concerning how

to balance energy supply and demand, such as using demand-response management or

employing energy storage. Yet, none of these solutions can be fit to all applications. What is

needed therefore is a method to analyze the underlying patterns in the temporal mismatch

between energy supply and demand to examine which balancing mechanisms can be suitable

in a specific setting. This thesis provides such a method based on a decomposition of historical

energy generation and consumption data using Fourier analysis. Building on the patterns found,

it is discussed how this decomposition can provide the ground to find suitable energy storage

technologies to balance energy supply and demand. The proposed methods are applied to real

data of 50 households in Austin, Texas, that generate their own energy through solar

photovoltaic systems.

Page 4: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

3

Table of Contents

Preface ....................................................................................................................................... 1

Executive Summary .................................................................................................................. 2

List of tables .............................................................................................................................. 5

List of figures ............................................................................................................................ 5

1 Introduction ............................................................................................................................ 7

2 Literature review .................................................................................................................. 10

2.1 The volatility of renewable energy sources ................................................................... 10

2.1.1 Solar photovoltaics (PV) ......................................................................................... 11

2.1.2 Wind ....................................................................................................................... 11

2.2 The mismatch of energy supply and demand ................................................................ 11

2.3 Different possibilities for balancing supply and demand .............................................. 12

2.3.1 Using less-variable energy sources ......................................................................... 14

2.3.2 Interconnecting generators ...................................................................................... 14

2.3.3 Over-sizing generation capacity ............................................................................. 15

2.3.4 Using demand-response management .................................................................... 15

2.3.5 Using intelligent electricity brokers ........................................................................ 16

2.3.6 Storing energy ......................................................................................................... 16

3 Research question ................................................................................................................ 17

4 The method .......................................................................................................................... 19

4.1 Data input ...................................................................................................................... 19

4.2 The variable of interest: the difference between energy generation and demand ......... 19

4.3 Conversion to the frequency domain ............................................................................. 21

4.4 Extraction of a trend and periodic components ............................................................. 22

4.4.1 Extraction of the trend ............................................................................................ 22

4.4.2 Extraction of the seasonal components ................................................................... 22

4.5 Examination of the decomposed components ............................................................... 24

4.5 Assignment of electric energy storage components to the seasonalities found ............. 26

4.5 Validation of suitability of EES’ determined energy capacities ................................... 31

5 Application of the method to real data ................................................................................. 33

5.1 Scenario ......................................................................................................................... 33

5.2 The data ......................................................................................................................... 33

Page 5: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

4

5.3 Preparation of the data for analysis: .............................................................................. 34

5.4 Exploratory examination of the data in the time domain .............................................. 38

5.4.1 Energy consumption ............................................................................................... 38

5.4.2 Energy generation ................................................................................................... 40

5.4.3 Mismatch between energy generation and consumption ........................................ 42

5.5 Transformation of the data into the frequency domain: ................................................ 44

5.6 Splitting the data into a trend, seasonal components and an intermittent component ... 46

5.6.1 The trend ................................................................................................................. 46

5.6.2 The seasonal component with yearly periodicity ................................................... 47

5.6.3 The seasonal component with daily periodicity ..................................................... 48

5.6.4 The ‘intermittent’ rest ............................................................................................. 53

5.7 Assignment of electric energy storage for the 50 households ....................................... 54

5.7.1 Assignment of electric energy storage to the daily energy demand/supply mismatch

......................................................................................................................................... 54

5.7.2 Assignment of electric energy storage to the yearly energy demand/supply

mismatch .......................................................................................................................... 59

5.7.3 Discussion of alternative possibilities to ensure energy is provided at the times it is

demanded ......................................................................................................................... 59

6 Conclusion ........................................................................................................................... 61

6.1 Managerial implications ................................................................................................ 62

6.2 Limitations and future research ..................................................................................... 63

Reference list .......................................................................................................................... 65

Appendix A: Overview of variables ....................................................................................... 69

Appendix B: R Code ............................................................................................................... 70

Page 6: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

5

List of tables

Table 1: Official season start dates ......................................................................................... 23

Table 2: Dates of DST change contained in the data set ......................................................... 48

Table 3: Comparison between base scenario and scenario in which an EES in introduced to

balance out daily energy supply/demand mismatch ................................................................ 57

List of figures

Figure 1: Conceptual model .................................................................................................... 14

Figure 2: Decomposing balance power ................................................................................... 20

Figure 3: Example plot of a seasonal component of balance power ....................................... 25

Figure 4: Example plot of the trend and yearly periodicity combined ................................... 26

Figure 5: Primary and secondary influence factors on what constitutes a suitable EES ........ 26

Figure 6: The circular influence between energy generation patterns, suitable EES and the

required scaling-up of generation capacity ............................................................................. 29

Figure 7: Simulation of several EESs combined..................................................................... 32

Figure 8: Energy consumption 𝑈𝑡 over the full four-year horizon ......................................... 34

Figure 9: Energy consumption outlier on August 10th 2014 ................................................... 35

Figure 10: Energy generation outlier on August 10th 2014 ..................................................... 36

Figure 11: Energy consumption Ut after removal of outlier values on August 10th 2014 ...... 36

Figure 12: Energy consumption outlier on October 20th 2015 ................................................ 37

Figure 13: Energy consumption Ut after removal of outlier values on October 20th 2015 ..... 38

Figure 14: Energy consumption Ut over four weeks .............................................................. 39

Figure 15: Energy consumption Ut over a typical day ............................................................ 39

Figure 16: Energy consumption Gt over the full four-year horizon ........................................ 40

Figure 17: Energy generation Gt over seven days .................................................................. 41

Figure 18: Energy generation Gt over a typical day ............................................................... 41

Figure 19: Mismatch Bt between energy generation and consumption over the full four-year

horizon .................................................................................................................................... 43

Figure 20: Mismatch between energy generation and consumption over four weeks ............ 43

Figure 21: Mismatch Bt between energy generation and consumption over a typical day .... 44

Figure 22: Mismatch between energy generation and consumption in the frequency domain

................................................................................................................................................. 45

Figure 23: Long-term trend component Tt .............................................................................. 46

Page 7: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

6

Figure 24: Yearly seasonal component St,yearly ..................................................................... 47

Figure 25: The sum of the yearly seasonal component St,yearly and the long-term trend

component Tt ........................................................................................................................... 48

Figure 26: Mismatch between energy generation and consumption in spring time in the

frequency domain .................................................................................................................... 49

Figure 27: Daily seasonal component St,daily,spring ................................................................ 50

Figure 28: Daily seasonal component St,daily,summer ............................................................. 50

Figure 29: Daily seasonal component St,daily,fall1 ................................................................... 51

Figure 30: Daily seasonal component St,daily,fall2 ................................................................... 51

Figure 31: Daily seasonal component St,daily,winter1 .............................................................. 52

Figure 32: Daily seasonal component St,daily,winter2 .............................................................. 52

Figure 33: ‘Intermittent’ rest It over full four-year horizon .................................................... 53

Figure 34: ‘Intermittent’ rest It over one week ....................................................................... 54

Figure 35: Residual balance power (Rt ∗ 60) ......................................................................... 58

Figure 36: Residual balance power (Rt ∗ 60) in the frequency domain ................................. 58

Page 8: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

7

1 Introduction

The functioning of our modern society critically depends on the steady availability of energy.

Worldwide energy consumption doubled from 1973 to 2014 and is expected to increase by

another 12% to 30% until 2040, depending on the underlying scenario. Energy from fossil fuels

thereby constitutes around 81% of current total energy production worldwide while energy

from nuclear plants adds another 5% (International Energy Agency, 2016). Both kinds of

energy source are criticized for being harmful for the environment, and fossil fuels only exist

in limited supplies. Their continued use of the current magnitude thus is incompatible with a

generally accepted definition of sustainable development as being “development that meets the

needs of the present without compromising the ability of future generations to meet their own

needs” (WCED 1987, p. 43). The United Nations Sustainable Development Goals (SDGs)

therefore incorporate goal number 7: “Ensure access to affordable, reliable, sustainable and

modern energy for all” (United Nations General Assembly, 2015, p.21). Besides, energy plays

an essential role for the attainment of most of the other SDGs, from eradicating poverty to

countering climate change (United Nations, 2016, p. 11). In light of the latter, the European

Union (EU) has set a roadmap to reduce greenhouse gas emissions by at least 40% until 2030

and at least 80% until 2050 as compared to 1990 levels (European Commission, 2011).

Numerous ideas exist on how to achieve the policy goals for sustainable energy development.

Generally, they belong to one of the two “twin pillars”: energy efficiency and renewable energy

(Prindle & Eldridge, 2007). Increased energy efficiency means providing the same service with

reduced energy consumption or providing increased service with unchanged use of energy.

Information systems (IS) scholars like Watson, Boudreau, & Chen (2010) advocate research

along this avenue, suggesting the establishment of the IS subfield of energy informatics aimed

at reducing CO2 emissions through the reduction of energy consumption.

However, the effectiveness of measures to increase energy efficiency is not undisputable as

improved efficiency could lead to a so-called ‘rebound effect’. The rebound effect occurs when

energy savings that were expected from increased energy efficiency are smaller than simple

engineering calculations would suggest. Examples of the rebound effect would be when a car

owner changes to a more fuel efficient vehicle, with the lower gasoline bills leading him to

either drive more frequently and further (direct rebound effect) or to use the savings to go on

vacation by plane (indirect rebound effect), both of which would not lead to the desired

Page 9: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

8

reduction in energy consumption (Sorrell, 2009). A recent study has estimated the average

value for the rebound effect within EU-27 countries to lie between 73.62% and 81.16% with

seven countries even exhibiting backfire – a rebound effect of more than 100% (Freire-

González, 2017). This means that, on the one hand, policies to reduce the rebound effect are

necessary to make sure improved energy efficiency measures are effective. On the other hand,

while heightened energy efficiency might contribute to a reduction in the growth of energy

demand, it will likely not lead to an overall reduction in energy consumption, so that the second

one of the twin pillars, transitioning to renewable energy sources, is essential to the success of

sustainable energy.

The EU has set the goal for renewable energy sources to contribute at least 27% of energy

production by 2030 (European Commission, 2011). As a consequence, energy markets are

currently transitioning from centrally managed traditional systems of energy production to a

decentralized renewable energy landscape of interdependent markets. However, these

transitions are not without risk as it is extremely difficult, if not entirely impossible, to predict

the effect that changes in such complex systems as the energy markets have on the economy

(Bichler, Gupta, & Ketter, 2010). In fact, this inability of well-predicting the effects of potential

solutions is only one of the characteristics that make the challenge of sustainable energy

development so inherently complex. It is exactly this inherent complexity that must make us

regard the sustainable energy challenge as a wicked problem (Ketter, Peters, Collins, & Gupta,

2015).

We must therefore understand that the sustainable energy challenge cannot simply be ‘solved’.

For wicked problems there exist no definitive problem formulations, so that there neither can

be a ‘true’ nor a ‘false’ solution, but possible re-solutions can only be judged as worse or as

better in light of a vast number of factors, ranging, in the case of sustainable energy, from

market design over capacity reserves to reliability control along the supply chain of electricity.

At the same time, whichever re-solution is implemented will be consequential for many and

over a long time. Wicked problems do not have a fixed set of possible solutions, but a vast

number of potential re-solutions can be conceived. Which of them should be pursued thereby

is a matter of judgment (Rittel & Webber, 1973; Bichler et al., 2010).

Considering the desirability of transitioning to a more decentralized landscape of renewable

energy sources as given, several sub-challenges become apparent. These include the efficient

Page 10: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

9

allocation of electricity among all consumers connected to the electricity grid, considerations

of grid topology, regulation, privacy, and of course the laws of physics, as well as ensuring

real-time grid control (Ketter, Peters, Collins, & Gupta, 2015). To the last challenge pertains

one very salient obstacle: the temporal mismatch of energy production and energy demand due

to the intermittency of renewable energy sources (Walker, 2014). For the proper functioning

of the electricity grid, this mismatch has to be overcome; supply and demand have to be tightly

balanced. To this end, many conceivable re-solutions exist both on the supply and the demand

side. On the supply side, intermittency could potentially be reduced by interconnecting

geographically dispersed generators, or by using energy sources like hydroelectricity that do

not exhibit short-term variability to fill intra-day gaps in demand and supply. Also intelligent

electricity broker agents incentivized to balance supply and demand could be deployed. On the

demand side, demand-response management could be introduced using intelligent electric

devices that can react to changes in energy prices and shift consumption to times when

relatively more energy is generated. Besides, energy storage could be employed on both the

supply and demand side to make energy available at the times it is needed (Delucchi &

Jacobson, 2011; Ketter, Peters, Collins, & Gupta, 2016). While all of these ideas could

potentially present a re-resolution of the real-time grid control challenge, it seems likely that a

combination of various methods will be needed.

It also seems very likely that this problem of the energy supply and demand mismatch will not

be solved by a single research group (Ketter et al., 2016) or by a single research discipline for

that matter, but that the involvement of many different perspectives is desirable. The

perspective that IS research can offer thereby lies in regarding the problem as “a lack of

information to enable and motivate economic and behaviorally driven solutions” (Watson et

al., 2010). Vast amounts of data are already being collected around the world to measure energy

production and consumption and the future of the internet of things will only lead to more data

being generated every day. Scholars from the IS field can thus play a part in contributing to the

re-solution of the sustainable energy challenge by finding ways to make use of all this data. IS

can be utilized for environmental sustainability and in this context be defined as “IS-enabled

organizational practices and processes that improve environmental and economic

performance” (Melville, 2010, p.2).

This thesis paper takes the IS research perspective to contribute to the challenge of how to

balance energy supply and demand in a decentralized renewable energy setting. The “lack of

Page 11: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

10

information” that this paper would like to help overcome is how it can be examined what kind

of patterns underlie the temporal mismatch of energy generation and demand. Understanding

the patterns underlying this mismatch can help to identify feasible options to bridge the gaps

between production and demand. This thesis suggests a method to decompose and analyze the

supply/demand mismatch using Fourier analysis. It proceeds as follows: Section 2 examines

background literature about the mismatch of energy production from renewables and energy

demand. Specifically, the volatility of energy generation from solar photovoltaics and from

wind, and different suggested methods to balance supply and demand are discussed. Section 3

derives and formulates the research questions about how the temporal mismatch between

energy generation and demand can be examined, and about how suitable energy storage can be

found for the identified patterns in the mismatch data. Section 4 provides the methods to answer

the research questions. It describes which data input is required for the analysis, and it explains

how to use Fourier analysis to identify underlying patterns in the data, what these patterns

reveal and how to fit energy storage to the determined patterns. Formulas are provided and

explained. Section 5 applies the methods from section 4 to real data of 50 households in Austin,

Texas that produce their own energy from solar photovoltaics. Section 6 provides a conclusion.

It encompasses managerial implications, as well as limitations and suggestions for future

research. An overview of all relevant variables and the R code used for section 5 of this thesis

can be found in the respective appendices.

2 Literature review

2.1 The volatility of renewable energy sources

One of the large challenges for using renewable energy sources as our primary sources of

energy supply lies in their inherent variability and intermittency. All of the natural sources from

which renewable energy is gained vary over different time frames in their availability.

Depending on the source, changes in availability range from variation between generations,

over seasonal variations, up to changes on a minute-by-minute level, whereby geothermal

energy and energy from biomass have relatively large natural cycles while wind and solar are

extremely volatile (International Energy Agency, 2005). The volatility of the latter two, least

predictable sources of renewable energy is elaborated in more detail below.

Page 12: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

11

2.1.1 Solar photovoltaics (PV)

As solar PV generates energy from sunlight, the amount generated depends – next to the

efficiency of the solar panels – on (a) the intensity of sunshine and (b) the angle at which the

sunrays reach the solar PV cells. Energy production of solar PV cells therefore falls into three

volatility dimensions: First, apart from near-equatorial regions, solar energy exhibits a seasonal

variation with a peak during summer. Second, there is a diurnal pattern from dawn to dusk

with a peak mid-day. Third, changes in local weather, e.g. the movement of clouds, lead to

constant fluctuation of energy production on a very short-term, intra-hour basis (International

Energy Agency, 2005).

2.1.2 Wind

Wind turbines work by producing energy from wind power. The potential for energy

production therefore depends on the wind speed which must lie in between certain boundaries

for the wind turbines to be operational. Depending on the region, fluctuation in energy

production can be higher or lower, but they generally exhibit a seasonal pattern with a

production peak in either winter or summer. Also diurnal and hourly changes can be noticed

as wind speeds change, while fluctuations on time scales smaller than that are usually

insignificant in comparison to overall installed capacity (International Energy Agency, 2005).

2.2 The mismatch of energy supply and demand

The described natural volatility in energy supply through renewable energy sources is not

concurrent with the, also volatile, energy demand of consumers. As described by Walker

(2014), energy demand does not generally follow production, but instead is an outcome of the

social practices of people and organizations. This leads Walker to classify three categories of

temporal dynamic of energy demand: change, rhythm and synchronicity which are explained

below.

Change refers to the development of energy demand over long time spans of decades or more

as a consequence of changes in social practices. An example would be that most students

nowadays take their notes and do their homework on computers that constantly need electricity,

instead of using pen and paper as it was the case for previous generations.

Rhythm, on the other hand, is concerned with shorter-term dynamics in the form of repetition

resulting from the routines with which social practices are performed. These routines take the

Page 13: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

12

form of daily patterns, like sleeping at night, weekly patterns like working Monday to Friday,

and seasonal rhythms like going on holidays during summer. Household energy demand

consequently results from an overlay of the energy consumption patterns emerging from

different social practices. This energy demand varies from household to household as, for

example, working people exhibit other social habits and resulting energy consumption than

elderly people who are mostly staying at home. At the same time, organizations, transport

infrastructure, etc. also exhibit patterns of energy demand over different time scales, for

example, due to working hours or operating times. All of these social practices and resulting

energy demand patterns aggregated thereby lead to the emergent rhythmic load profiles

observable in electricity grids (Walker, 2014).

Lastly, synchronicity refers to the relationships between rhythms. There exist social

synchronization as well as natural-social synchronization of rhythms. The former is evident in

the synchronicity of social practices within one society such as relatively similar meal-eating

times, that, on the other hand, may well differ from one society to another. The latter results

from social practices being adapted to natural conditions: For example, electric lighting is

needed mostly when there is no natural sunlight, and air conditioning is used predominantly

during hot summer months. These aggregated patterns of the synchronization of social

practices that require energy lead to certain peak load times. For example, during a weekday,

peak energy demand typically occurs during morning and evening hours (Walker, 2014).

Energy demand thus results from the interwoven social practices exhibited by the relevant

consumers, while the possibility for energy production from renewable resources depends on

the current availability of those resources. For there to not occur any failures in the electricity

grid, energy demand and supply have to be the same though. This means that for the functioning

of the electricity grid there is one essential task: the reliable balancing of supply and demand.

2.3 Different possibilities for balancing supply and demand

With the traditional, centrally managed grid structure it has been possible so far to balance

energy supply and demand mainly by adjusting energy generation in order to meet demand

(Ketter, Collins, & Reddy, 2013). However, as we are moving towards more renewable energy

production, where a distributed system of small generators produces variable output, the

traditional manner of grid control will have to give way to new solutions (Jansen et al., 2005,

as cited in Gottwalt et al., 2011). This problem is illustrated in the conceptual model of figure

Page 14: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

13

1. ‘Balance energy’ therein stands for the temporal mismatch between energy generation and

demand; it is the difference between energy production and energy demand over time.

Whenever more energy is generated than demanded, balance energy is positive – there is a

temporary energy surplus; whenever less energy is generated than demanded, balance energy

is negative – there exists a temporal energy deficit. For the electricity grid to function, balance

energy should be close to zero at all times. What balance energy looks like, depends on both

the patterns of energy generation and the patterns of energy demand. Increased energy

generation increases balance energy, while increased demand rather leads to an energy deficit.

Energy generation patterns thereby depend on the local climate and current weather which in

turn is, at least partially, influenced by time. Time of the year, of the week etc. also influence

the patterns of energy demand through the activities that consumers pursue as explained in

section 2.2. Many different suggestions exist for how to reliably satisfy energy demand with

the electricity grid of the future. These include using less-variable energy sources to bridge

short-term gaps between demand and generation of more variable renewables, interconnecting

dispersed generators, over-sizing generation capacity, using demand-response management,

using intelligent electricity brokers incentivized to balance supply and demand, as well as

different forms of storing energy (Delucchi & Jacobson, 2011; Ketter, Peters, Collins, & Gupta,

2016). To provide the reader with an overview, these different ideas are elaborated below.

Page 15: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

14

Figure 1: Conceptual model of the energy supply/demand mismatch and potential mitigation

mechanisms

2.3.1 Using less-variable energy sources

As explained above, in the current electricity grid, unforeseeable short-term fluctuations in

energy demand are mainly met by regulating production up or down. In the same manner – by

regulating the output production of a less-variable energy source – short-term gaps between

energy demand and energy production from intermittent sources can be bridged. For this to

work, the generator to be regulated must be easily adjustable and regularly operate below full

capacity. Gap-filling resources exist in the form of fossil fuels, like natural gas, but also

hydroelectric power can be adjusted quickly and is employed for that purpose (Delucchi &

Jacobson, 2011). However, without extremely large transmission lines, hydropower will not be

available everywhere to a sufficient extent.

2.3.2 Interconnecting generators

Several generators can be interconnected using transmission lines. One idea is to interconnect

geographically dispersed generators because the variabilities that generators exhibit are likely

to differ from site to site: A cloud shading a solar PV panel in one area is not shading a panel

Measures to balance supply and demand

Generation

capacity

Time (of year,

week, day, …)

Weather Climate

Energy generation

patterns

Energy demand

patterns

Balance

energy

Demand

management

EES

+

+ -

Type of

energy source

Interconnection

between

generators

Intelligent

electricity

brokers

Habits and

customs

Activities

Page 16: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

15

in a different geographic area at the same time, but might pass over the second panel later.

Because of this, the aggregation of the output of several dispersed generators smoothes out the

variabilities of individual generators. Another idea lies in interconnecting different generators

whose energy production depends on different inputs, e.g. connecting solar PV generators with

wind generators: When there is less sun shining, there might be more wind blowing and the

other way around, so that an aggregation of the output could average out individual generators’

volatilities. The success of reducing variability in this manner has been shown by scholars like

Lavania, Rao, & Subrahmanian (2012) and Mills & Wiser (2010). As the described effect of

reducing volatility increases the more widely dispersed generators are interconnected,

suggestions exist to build so-called ‘supergrids’, grids with extremely large transmission

distances. However, with very large-scale weather events such as superstorms even wide areas

interconnected by supergrids might suffer at the same time from the same deficits in energy

generation. Besides, even without very large-scale weather events, it is unclear how large

supergrids would really have to be in order to gain the desired benefit at the lowest possible

cost (Delucchi & Jacobson, 2011).

2.3.3 Over-sizing generation capacity

If the system of renewable, intermittent energy generators is designed to have a peak capacity

much larger than regular energy demand, this reduces the times in which production cannot

meet demand. Excess energy generated at times where demand is lower than production can

then be stored in some form for use at later times. Storage could take the form of batteries that

release energy to the grid when production cannot meet demand. Alternatively, hydrogen could

be produced as an energy carrier to provide energy, e.g. for transportation purposes (Delucchi

& Jacobson, 2011). Of course, the benefit of any over-sizing of capacity must be carefully

weighed against the increased production cost of generators and needed energy storage.

2.3.4 Using demand-response management

While traditionally, the electricity grid relies on adjusting energy production to meet demand,

the idea behind demand-response management (DRM) is to instead adjust demand to match

supply. As explained in section 2.2, energy demand is a reflection of the social practices of

people and organizations. Therefore, managing energy demand really means changing the

patterns of the underlying activities responsible for this demand (Walker, 2014). This could be

achieved by deploying “smart” household appliances that would react to variable electricity

prices by shifting loads over time. However, it has to be noted that there are only certain

Page 17: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

16

appliances that lend themselves to load shifting. It is well imaginable that a washing machine

could start a few hours later than the point of loading it, whereas most consumers would not

want to sit in the dark to shift their consumption of electric lighting to a later point in time.

Additionally, Gottwalt et al. (2011) find that for an individual household, the proactive

replacement of existing appliances will not likely pay off financially. Nevertheless, smart

appliances have the potential to turn a large part of residential loads flexible. They might

therefore still be an idea worth pursuing, e.g. through subsidizing the purchase of smart

household appliances or through employing add-ons that can turn existing devices into smart

ones.

2.3.5 Using intelligent electricity brokers

In a scenario where demand-response management is pursued through the use of variable

pricing schemes, it becomes quite complex to well predict demand in order to plan for

production. Additionally, the electricity grid of the future will likely be fed to a significant

amount by many decentralized small generators using intermittent sources whose production

as well is very complex to predict. Intelligent electricity brokers in the form of automated

trading agents could be deployed to take on this challenging task of effectively balancing

supply and demand (Peters, Ketter, Saar-Tsechansky, & Collins, 2013). They could be owned

by commercial or public utilities, by energy retailers, or by cooperatives. The goal of the

brokers would be to generate a profit by buying energy from producers and selling it to

consumers. For that they have to well predict energy supply and demand, also trying to

influence these by the prices offered while continuously learning, all in face of market

competition (Ketter, Collins, Reddy, & Weerdt, 2012). An environment in which the possible

development of such smart electricity agents is studied, is the trading agent competition Power

TAC (Ketter et al., 2013).

2.3.6 Storing energy

While intelligent electricity brokers in combination with demand-response management could

potentially significantly reduce the mismatch between energy supply and demand, it is unlikely

that they will function completely without additional balancing capacity. Using a less-variable

energy source to provide the needed fill-in power or over-sizing generation capacity will

involve a lot of capacity sitting idle for long parts of the day. For these ideas to function it must

also be ensured that the transmission and distribution infrastructure is equipped to handle the

requirements for peak power transfers. At times aside of peak demand, also this infrastructure

Page 18: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

17

is then used much below capacity. The interconnection of dispersed generators as well brings

new requirements to the transmission system, requiring large additional capital investments.

Thus, while all of these suggestions could certainly contribute to the re-solution of the energy

supply/demand mismatch problem, they will likely not re-solve it on their own entirely.

Instead, electric energy storage may play a decisive role in the renewable energy challenge as

well (Beaudin et al., 2010; Delucchi & Jacobson, 2011).

Electric energy storage (EES) can take many different forms. The most prevalent form

worldwide is pumped hydroelectric storage (PHS) (Dunn, Kamath, & Tarascon, 2011). PHS

works by pumping water from a lower-level reservoir to a higher-level reservoir, storing energy

as potential energy. Other possibilities for storing energy are compressed air energy storage

(CAES), flywheels, superconducting magnetic energy storage (SMES), capacitors, and many

different types of batteries. CAES stores energy by compressing air typically using existing

sites, such as an abandoned mine. Flywheels consist of a mass that can rotate in order to store

energy as rotational energy. A SEMS unit can store energy in a magnetic field. Capacitors and

supercapacitors consist of two metal plates separated by a dielectric. They work by

accumulating positive charges on one plate and negative charges on the other plate. Lastly,

batteries exist in many varieties, but generally work by storing energy as chemical energy

through a reversible chemical reaction (Beaudin et al., 2010).

A main obstacle to the widespread adoption of EES for balancing energy supply and demand,

are the large costs still associated with them (Dunn et al., 2011). However, recent news suggest

that prices could fall significantly, to half of current prices, by 2020 already, turning EES into

a viable balancing option (D’Aprile, Newman, & Pinner, 2016; Clean Technica, 2015).

3 Research question

As explained in the introduction, for problems as complicated as balancing energy supply and

demand there exists no one optimal solution of what measures to deploy. All of the described

opportunities for re-solution depend on many factors: Does the entire electricity grid of a

country have to be balanced or are we considering a small off-grid application? Is the system

functioning with renewable energy sources only? If yes, with which mix? What are the local

weather conditions? What does existing infrastructure look like – to which kind of re-solutions

does it lend itself? What are the costs involved in implementing different balancing methods?

Page 19: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

18

Are there political or economic reasons favoring one method over the other? For judging which

method is more or less suitable these manifold factors have to be taken into account.

Sovacool (2008) finds that utilities and system operators in the United States generally perceive

energy production from renewables as too unpredictable to be viable on a large scale, while

renewable energy researchers do believe this variability to be manageable. He comes to the

conclusion that “the current ‘technical’ barriers to large-scale integration of wind, solar, and

other renewables may not be technical at all, and more about the social, political, and practical

inertia of the traditional electricity generation system” (Sovacool, 2008, p. 295).

This paper aims to contribute to the question of how (un)predictable the temporal mismatch

between energy supply and demand is and which re-solutions to balance supply and demand

are sensible in light of local supply and demand factors. As explained in section 2.2, the

temporal dynamic of energy demand may well differ from one society to another – from one

specific set of consumers to another – depending on the social practices of the consumers under

examination. At the same time, as explained in section 2.1, the patterns to be found in the

production of energy from renewable sources depend on what kind of generators are used as

well as on the local climate conditions and weather events. This complexity yields my first

research question:

RQ1: How can the temporal mismatch between energy generation and energy

demand be examined to find underlying patterns?

If underlying patterns can be found, this can provide a sensible basis for deciding which supply-

demand balancing mechanisms are fit for application in the specific scenario under

consideration. Of all the potential re-solutions described, EES is likely to play an important

part in matching supply and demand in a setting with high renewable energy penetration. Also,

it is theoretically imaginable that different forms of EES together could be used as a stand-

alone solution to bridge the gaps between supply and demand. This could then be used as a

(cost) benchmark to compare other potential re-solutions to. In order to create this benchmark

scenario, it has to be known what kind of EES technologies with which technical characteristics

could be employed to bridge the gaps between energy generation and demand in the specific

setting under examination. My second research question thus is:

RQ2: How can energy storage be fit to the patterns found in the energy supply-

demand mismatch to balance out this mismatch?

Page 20: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

19

4 The method

This part aims to answer RQ1 and RQ2 by suggesting suitable methods. These are applied to

a real-life data set in section 5.

4.1 Data input

To examine the temporal mismatch between the volatility of energy generation and the

volatility of energy demand, data on both generation and demand is needed. Which precise

input data is required, depends on the specific application for which the examination is

conducted. The method to be proposed in this thesis paper to examine this mismatch is neutral

towards where the data comes from (i.e. from which energy generators, from only households

or also organizations, real or hypothetical). However, it is important that production and

demand data ‘belong together’. For example, one might be interested in the possibility for an

energy producer and energy consumers in a region to set up a microgrid – and what kind of

EES or other balancing mechanisms they would need to bridge their mismatches in production

and demand. Then, historical energy generation and consumption data from these involved

parties would be needed. The data from the different sources that shall be considered together

should have the same time resolution and should have been collected over the same time frame.

As the quality of the data is concerned, in order to get precise results using the suggested

method (to avoid aliasing in the Fourier analysis), the data should have a time resolution of at

least the reciprocal of twice the highest frequency contained in it, e.g. to detect a daily pattern,

the data must contain at least two data points per one-day period. At the same time, the input

data set should ideally be a multi-year dataset in order to find long seasonality patterns.

4.2 The variable of interest: the difference between energy generation and demand

As explained in section 2.1, the energy production data will exhibit some patterns of supply

over various timescales, like seasonal and diurnal patterns. As discussed in section 2.2, the

energy demand data will exhibit patterns over similar timescales as well. Taken together, even

if over the total time frame considered, energy production equals energy demand, both do not

line up in time, however, as they depend on different underlying causes. Nevertheless, because

both data sets exhibit certain patterns, also the mismatch between production and demand will

follow certain patterns over time. This mismatch can thereby be depicted as the difference

between energy generation, as measured by the average power 𝐺𝑡 that is delivered during the

Page 21: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

20

time interval starting at time t, and energy demand, as measured by the average power 𝐷𝑡

consumed during the time interval starting at t, and shall be denoted 𝐵𝑡 for ‘balance power’:

𝐵𝑡 = 𝐺𝑡 − 𝐷𝑡 , with ∑ 𝐺𝑡 = ∑ 𝐷𝑡 (1)

The goal is to decompose 𝐵𝑡 into its underlying patterns, so that these can be further examined.

This decomposition thus shall result into an additive model:

𝐵𝑡 = 𝑇𝑡 + 𝑆𝑡,1 + … + 𝑆𝑡,𝑚 + 𝐼𝑡 (2)

where 𝑇𝑡 is the long-term trend , 𝑆𝑡,𝑠 (s = 1..m or alternatively s = yearly..daily) show the

average seasonality over the corresponding time and 𝐼𝑡 is the intermittent rest. (𝐵𝑡 could also

stand for ‘balance energy’ as the data can be converted from the average power

supplied/demanded over each interval to the energy supplied/demanded over the interval by

multiplying the average power values by the corresponding time interval of measurement.) The

method for decomposing 𝐵𝑡 into its components is illustrated in figure 2 and further explained

in the following sections.

Figure 2: Decomposing balance power with the help of the Discrete Fourier Transform (DFT) and the

Inverse Discrete Fourier Transform (IDFT)

DFT

IDFT

Energy generation

data

Energy demand

data

Balance

energy

Trend

dif

fere

nce

Time domain Frequency domain

Frequency spectrum

of balance energy

Apply filters

Seasonal components

‘Intermittent’ rest

Page 22: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

21

4.3 Conversion to the frequency domain

The patterns of mismatch that underlie the specific dataset under consideration can be obtained

by converting the ‘mismatch data’, i.e. 𝐵𝑡, from the time domain to the frequency domain using

the Discrete Fourier Transform:

𝑋𝑘 =1

𝑁∗ ∑ 𝐵𝑛 ∗ 𝑒−2𝜋𝑖𝑘𝑛/𝑁𝑁−1

𝑛=0 (3)

𝑋𝑘 are the discrete Fourier coefficients at frequency k – each a complex number describing

the amplitude and phase of a sinusoid with frequency k – that indicate how much of the signal

is contained at frequency k. 𝐵𝑛 are the balance power values, whereby N is the length of the

time series, so that n = 0 corresponds to the first data point in the time series and n = N - 1 to

the last one.

Before the data is converted to the frequency domain, it should be cut to an appropriate length

and suitable start and end points. To get a good picture of the contained frequencies, the total

time frame of the observation (N * t) should be a multiple of the largest expected periodicity

which likely is a year. Additionally, if possible, it is helpful if the time series starts and ends at

a time of zero-energy generation as this can reduce the amount of frequency content that will

be detected at a period of N * t and the corresponding higher harmonics.

The total time frame of the observation, N * t, also plays a role for the achieved frequency

resolution: The frequencies k are spaced 1 (𝑡 ∗ 𝑁)⁄ apart. The frequency bandwidth, on the

other hand, depends on the sampling rate, i.e. the resolution of the balance power data. It

stretches from 1 𝑊⁄ where 𝑊 stands for the total time length over which the data is recorded

to 𝑁 (2 ∗ 𝑊)⁄ because the considered data only contains real values and thus only the first half

of the DFT-coefficients are meaningful.

In the frequency domain, it will then be possible to see how much of the production-demand

mismatch is attributable to which frequency, respectively periodicity. To this end, the absolute

values of the DFT coefficients, which equal the amplitudes of the corresponding sinusoids, can

be plotted against their frequencies. The resulting frequency spectrum can be examined for

high amplitude values which indicate an underlying periodicity.

Page 23: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

22

4.4 Extraction of a trend and periodic components

The mismatch data can be split into a long-term trend and the different periodicities found in

the dataset (as well as an “intermittent” rest) with the help of filters that only let certain

frequencies pass. To implement these filters, all Fourier coefficients are multiplied by a 0 or a

1 before they are collectively back-transformed into the time domain: Fourier coefficients

corresponding to a frequency that shall pass the filter are multiplied by a 1, all others are

multiplied by a 0. These filtered Fourier coefficients then constitute the input to the inverse

Discrete Fourier Transform with which the data is back-transformed into the time domain:

𝐵𝑛,𝑓𝑖𝑙𝑡𝑒𝑟𝑒𝑑 = ∑ (𝑋𝑘 ∗ 𝐹𝑘) ∗ 𝑒2𝜋𝑖𝑘𝑛/𝑁𝑁−1𝑘=0 (4)

whereby Fk constitutes the filter-vector.

4.4.1 Extraction of the trend

As there is no reason to expect a seasonal component with a period > 1 year1, the Fourier

coefficients corresponding to periods > 1 year can be regarded as corresponding to the

underlying long-term trend or fluctuations in the dataset. Thus, for extracting the long-term

trend 𝑇𝑡, only these DFT-coefficients are passed back into the time domain.

𝑇𝑡 = 𝑇𝑛 = ∑ (𝑋𝑘 ∗ 𝐹𝑘,𝑡𝑟𝑒𝑛𝑑) ∗ 𝑒2𝜋𝑖𝑘𝑛/𝑁𝑁−1𝑘=0 (4.1)

4.4.2 Extraction of the seasonal components

To extract the different seasonal components 𝑆𝑡,𝑠, the frequency spectrum is visually inspected

for high-amplitude values, different from the random fluctuations. The expectation is that

seasonal components corresponding to the seasonality of energy generation from the renewable

source and corresponding to the seasonality of human activity are found. These could likely be

yearly, weekly and daily seasonalities. To further examine these seasonal components, they are

individually back-transformed into the time domain by only letting the DFT coefficient

corresponding to the underlying period and its significant higher harmonics pass through the

inverse DFT.

𝑆𝑡,𝑦𝑒𝑎𝑟𝑙𝑦 = 𝑆𝑛,𝑦𝑒𝑎𝑟𝑙𝑦 = ∑ (𝑋𝑘 ∗ 𝐹𝑘,𝑦𝑒𝑎𝑟𝑙𝑦) ∗ 𝑒2𝜋𝑖𝑘𝑛/𝑁 𝑁−1𝑘=0 (4.2)

1 Currently available datasets generally contain a maximum of a few years of data. If instead many years of data

were available it could also be conceivable that longer-scale periodicities than of one year could be found.

Generally, those DFT-coefficients should be regarded as showing the long-term that correspond to periods

longer than that of the longest-term seasonality found.

Page 24: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

23

For seasonal components with a period < 1 year, it is important to note that the periodic pattern

changes over the course of the year, e.g. the amplitude corresponding to a daily seasonal

component is expected to change going from summer to winter. Thus, a better picture of these

periodic components can be obtained when the DFT is applied to different parts separately. A

natural option to split the dataset for this is by season, so that the balance power time series is

divided into different parts, each only containing one season. The split can be made at the

official start dates of the seasons (see table 1).

Season Start Date

Spring March 20

Summer June 21

Fall September 23

Winter December 22

Table 1: Official season start dates

On top of that, fall and winter data should be further divided as they contain the day of daylight

saving time (DST) change. When the DST change occurs, which happens at a different data

each year, energy generation from a natural resource is not affected but energy consumption is

shifted by one hour relative to energy generation if people conduct their activities, like going

to work, at the same times of the day as they did before the DST change. Therefore, fall and

winter data should be split into two time series each that contain only the data up until the day

before, respectively from the day after the DST change occurred in the particular year.

𝐵𝑡,𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 = 𝐵𝑡 − 𝑇𝑡 − 𝑆𝑡,𝑦𝑒𝑎𝑟𝑙𝑦 (5)

𝐵𝑡,𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 = {𝐵𝑡,𝑆𝑝𝑟𝑖𝑛𝑔, 𝐵𝑡,𝑆𝑢𝑚𝑚𝑒𝑟 , 𝐵𝑡,𝐹𝑎𝑙𝑙1, 𝐵𝑡,𝐹𝑎𝑙𝑙2, 𝐵𝑡,𝑊𝑖𝑛𝑡𝑒𝑟1, 𝐵𝑡,𝑊𝑖𝑛𝑡𝑒𝑟2} (6)

𝐵𝑡,𝑠𝑝𝑟𝑖𝑛𝑔 = {𝐵𝑡,𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟| 𝑀𝑎𝑟𝑐ℎ 20 ≤ 𝑡 ≤ 𝐽𝑢𝑛𝑒 20} (7)

𝐵𝑡,𝑠𝑢𝑚𝑚𝑒𝑟 = {𝐵𝑡,𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟| 𝐽𝑢𝑛𝑒 21 ≤ 𝑡 ≤ 𝑆𝑒𝑝𝑡𝑒𝑚𝑏𝑒𝑟 22} (8)

𝐵𝑡,𝑓𝑎𝑙𝑙1 = {𝐵𝑡,𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟| 𝑆𝑒𝑝𝑡𝑒𝑚𝑏𝑒𝑟 22 ≤ 𝑡 < 𝐵𝑒𝑔𝑖𝑛𝑛 𝐷𝑎𝑦 𝑜𝑓 𝐷𝑆𝑇 𝑐ℎ𝑎𝑛𝑔𝑒} (9)

𝐵𝑡,𝑓𝑎𝑙𝑙2 = {𝐵𝑡,𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟| 𝐸𝑛𝑑 𝐷𝑎𝑦 𝑜𝑓 𝐷𝑆𝑇 𝑐ℎ𝑎𝑛𝑔𝑒 < 𝑡 ≤ 𝐷𝑒𝑐𝑒𝑚𝑏𝑒𝑟 21} (10)

𝐵𝑡,𝑤𝑖𝑛𝑡𝑒𝑟1 = {𝐵𝑡,𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟| 𝐷𝑒𝑐𝑒𝑚𝑏𝑒𝑟 22 ≤ 𝑡 < 𝐵𝑒𝑔𝑖𝑛𝑛 𝐷𝑎𝑦 𝑜𝑓 𝐷𝑆𝑇 𝑐ℎ𝑎𝑛𝑔𝑒} (11)

Page 25: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

24

𝐵𝑡,𝑤𝑖𝑛𝑡𝑒𝑟2 = {𝐵𝑡,𝑟𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟| 𝐸𝑛𝑑 𝐷𝑎𝑦 𝑜𝑓 𝐷𝑆𝑇 𝑐ℎ𝑎𝑛𝑔𝑒 < 𝑡 ≤ 𝑀𝑎𝑟𝑐ℎ 19} (12)

These individual time series are separately transformed to the frequency domain using the DFT

as in (3), where they are examined, appropriate filters are applied and the seasonal components

are extracted based on (4):

𝑆𝑡,𝑠,𝑠𝑝𝑟𝑖𝑛𝑔 = 𝑆𝑛,𝑠,𝑠𝑝𝑟𝑖𝑛𝑔 = ∑ (𝑋𝑘,𝑠𝑝𝑟𝑖𝑛𝑔 ∗ 𝐹𝑘,𝑠,𝑠𝑝𝑟𝑖𝑛𝑔) ∗ 𝑒2𝜋𝑖𝑘𝑛/𝑁𝑠𝑝𝑟𝑖𝑛𝑔 𝑁𝑠𝑝𝑟𝑖𝑛𝑔−1

𝑘=0 (4.3)

whereby 𝑋𝑛,𝑠𝑝𝑟𝑖𝑛𝑔 are the DFT-coefficients of the spring time series, 𝑁𝑠𝑝𝑟𝑖𝑛𝑔 is the number of

data points in this spring time series and 𝐹𝑘,𝑠,𝑠𝑝𝑟𝑖𝑛𝑔 is the appropriate filter. 𝐹𝑘,𝑠,𝑠𝑝𝑟𝑖𝑛𝑔 should

not only let the base frequency and significant higher harmonics but also the zero-frequency

component pass back into the time domain as it is not necessarily null when different parts of

the year are examined separately. The periodicities in the other parts of the year (summer, fall,

winter) are computed analogously to (4.3).

4.5 Examination of the decomposed components

The identified seasonal components 𝑆𝑡,𝑠 represent the patterns of temporal mismatch between

energy supply and demand; they show how balance power alternates between positive and

negative values over the corresponding periods. Figure 3 sketches an example of what a plot

of 𝑆𝑡,𝑠 could look like. Where 𝑆𝑡,𝑠 is positive, it indicates that over the related time horizon

more energy is generated than consumed; where 𝑆𝑡,𝑠 is negative, the opposite applies. The

integral between two adjacent zero-crossings ix thereby shows how much energy is – on

average over the corresponding time frame – supplied (or demanded) at the wrong time:

𝐸𝑆𝑡,𝑠, 𝑖𝑥= ∑ 𝑆𝑡,𝑠

𝑖𝑥+1𝑖𝑥

∗ 𝑡 (13)

This is the amount of energy that should be shifted by a suitable balancing mechanism. The

time that passes between ix and ix+1 indicates how far in time energy demand or supply has to

be shifted.

Page 26: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

25

Figure 3: Example plot of a seasonal component of balance power

As a result of the way in which the trend is computed, 𝑇𝑡 can be understood as showing which

years have produced relatively more or less energy surpluses or deficits. See figure 4 for an

example of what the impact of 𝑇𝑡 on 𝑆𝑡,𝑦𝑒𝑎𝑟𝑙𝑦 could be. If 𝑇𝑡 is substantially different from

zero, this means that it will not be enough to only shift energy supply and/or demand from one

part of the year to another but that energy generation capacity would likely have to be scaled

up for the producers and consumers under consideration to function as self-sufficient system.

Lastly, subtracting 𝑇𝑡 and 𝑆𝑡,𝑠 from 𝐵𝑡 results in the ‘intermittent’ rest 𝐼𝑡. This rest describes

the part of balance power that is the deviation from the predictably-periodic. Whatever balance

mechanisms will be chosen to eliminate the temporal mismatch between energy supply and

demand must be able to accommodate these rapid, non-periodic fluctuations in balance power.

i1 i2 i3

𝐸𝑖1

+

𝐸𝑖2

Page 27: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

26

Figure 4: Example plot of the trend and yearly periodicity combined. Note that in year 2 not as much

energy is produced as demanded.

4.5 Assignment of electric energy storage components to the seasonalities found

Figure 5: Primary and secondary influence factors on what constitutes a suitable EES. Loosely based

on Luo et al. (2015) and Beaudin et al. (2010).

Year 1 Year 2 Year 3

𝐸𝑖1

+ 𝐸𝑖3

+

𝐸𝑖2

𝐸𝑖5

+

𝐸𝑖4

− 𝐸𝑖6

− i1 i2 i3 i4 i5 i6

Page 28: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

27

Many factors play a role in determining which EES are suitable for application in different

scenarios (also see figure 5): Location and scope of the scenario determine whether EES can

come into consideration that require certain sites for installation, as is the case with PHS and

CAES. These factors also impact the allowable size of the EES which is largely determined by

the technology’s energy density (measured in energy/volume) and power density

(power/volume). Moreover, the scope of the scenario has an influence on the required power

rating of the EES. Also political interests as well as environmental considerations can play a

role in determining whether a certain EES is desirable: For example the installation of PHS

often comes with high environmental costs attached. Besides, the specific application under

consideration determines whether restrictions apply towards the allowable weight of the EES

which depends on its specific energy (energy/mass) and specific power (power/mass). Capital

cost as well as operating and maintenance cost influence the viability of introducing a specific

EES, for which also considerations about its lifetime (in time and in number of cycles) play a

role. Additionally, the application for which the EES is to be used influences its acceptable

response time and, importantly, for how long it must be able to store the energy which in turn

is associated with the EES’s self-discharge. The patterns of the mismatch between energy

supply and demand which are identified by the seasonal components 𝑆𝑡,𝑠 determine the

necessary energy capacities of the EES.

Where 𝐵𝑡 is positive, it indicates that more energy is generated than consumed; where 𝐵𝑡 is

negative, the opposite applies. Whenever more energy is generated than consumed, it can be

stored into an EES – when not enough energy is generated to satisfy demand, energy can then

be released again from the EES. The seasonal components 𝑆𝑡,𝑠 thereby indicate how much

energy has to be stored/released over the corresponding time frames indicated by their

periodicities. The values of 𝐵𝑡 indicate the power with which the EES is charged or discharged

at any time. The necessary power rating 𝑃 is therefore not directly visible in the graphs of 𝑆𝑡,𝑠

as the concrete power measurements can and do deviate from the underlying patterns. Instead,

it is determined by:

𝑃 = max 𝐵𝑡 (14)

This, however, does not take into account that the balance-power pattern changes if 𝐺𝑡 is scaled

up to accommodate an energy loss associated with storing the energy. Consequently, what (14)

provides is a first estimate of the necessary power rating of the EES.

Page 29: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

28

The necessary duration 𝐿 over which the EES must be able to store the energy can be

approximated by

𝐿 = 𝑖𝑥+1 − 𝑖𝑥 (15)

provided that two adjacent positive and negative integrals of 𝑆𝑡,𝑠 are about the same size and

the distance between ix and ix+1 is roughly also equal to L.

The EES’s required energy capacity 𝐶 is then given by the largest integral area between the

curve and the x-axis. This does not yet take into account energy loss through storage or any

long-term trend.

𝐶𝑆𝑡,𝑠= max 𝐸𝑆𝑡,𝑠, 𝑖𝑥

, (16)

where i is the time at which 𝑆𝑡,𝑠 changes sign.

As explained in 4.5, if a long-term trend 𝑇𝑡 exists, it has an impact on the underlying periodicity

with the largest period which in this discussion is 𝑆𝑡,𝑦𝑒𝑎𝑟𝑙𝑦: In some years generally more

energy is generated and in others less or in some years more energy is consumed and in others

less (see figure 4). To take this into account, the required energy capacity of the EES for the

seasonal component with the largest period 𝐸𝑆1,𝑇𝑡 (not taking into account loss through storage)

should be calculated using (17): For each three adjacent zero crossings 𝑖𝑥, 𝑖𝑥+1 and 𝑖𝑥+2, there

exists a pair of energy surplus 𝐸𝑗+ and energy deficit 𝐸𝑗

−. For each pair, the smaller value should

be found as it does not make sense to store more energy than will be consumed or to oversize

the EES component so that enough energy could be stored for the following demand while not

enough energy is generated though. Out of these smaller values, the maximum identifies a good

first estimate of the required energy capacity to take into account the long-term trend 𝑇𝑡:

𝐶𝑆𝑡,1,𝑇𝑡= max(min𝑖𝑥:𝑖𝑥+2

(𝐸+, |𝐸−|)) , min𝑖𝑥:𝑖𝑥+2∈ {𝐸+, |𝐸−|} (17)

Considering the specific scenario in which the EES shall be deployed, its location and scope,

a pre-selection of potentially useful EES can be made. Based on (14) and (15), the balance

power data 𝐵𝑡 and the seasonal components 𝑆𝑡,𝑠 can then provide the required power rating and

the necessary suitable storage duration of the EES components that shall accommodate the

different underlying periodicities 𝑆𝑡,𝑠 as well as a longer-term trend 𝑇𝑡 found in the data. Using

(16) and (17) a first estimate of the required energy capacities for the EES corresponding to the

different periodicities can be obtained. It is not possible to directly obtain the required energy

Page 30: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

29

capacities as they depend on the necessary scaling up of generation capacity due to the trend

and due to energy loss through storage. Energy loss through storage consists of energy loss

through charging and discharging the EES as well as its self-discharge – and these EES

characteristics in turn depend on the specific EES chosen. This circular relation can be traced

in figure 6: The first estimates of the required energy capacities obtained from (16) and (17)

must be used to find EES that seem suitable and based on these EES’ cycle efficiency and self-

discharge rates, the required energy capacities have to be recalculated – which then requires a

check if the obtained required energy capacities still fit to the EES technologies chosen.

Figure 6: The circular influence between energy generation patterns, suitable EES and the required

scaling-up of generation capacity

Based on the first estimate of the energy capacity C, its precise required value can be

determined algorithmically using a simulation of the charging and discharging of the EES.

Let’s say one wants to find an EES that is suitable for the seasonal component with the shortest

period. A first estimate of the required energy capacity for an average day’s mismatch between

energy supply and demand is obtained. Based on this first estimate of the required energy

capacity and the other described factors, a suitable type of EES is determined. This type of EES

has a self-discharge rate of 𝑑𝑖𝑠𝑠𝑒𝑙𝑓 per time period t and a cycle efficiency 𝑒𝑓𝑓𝑐𝑦𝑐𝑙𝑒.

1) Energy generation

patterns

2) Balance energy patterns

3) Required chracteristics of

EES

4) Suitable type of EES

5) Energy loss through storage

6) Required scaling-up of generation

capacity

Page 31: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

30

Based on the assumption that the charge efficiency is equal to the discharge efficiency, they

can be computed as: 𝑒𝑓𝑓𝑐ℎ𝑎𝑟𝑔𝑒 = 𝑒𝑓𝑓𝑑𝑖𝑠𝑐ℎ𝑎𝑟𝑔𝑒 = √𝑒𝑓𝑓𝑐𝑦𝑐𝑙𝑒. For the simulation of the EES,

the variable 𝐴𝑡 is introduced as the charge state of the EES at the end of every time interval t.

At time t+1, 𝐴𝑡 is thus reduced by the factor 𝑑𝑖𝑠𝑠𝑒𝑙𝑓. Cycle efficiency is taken into account by

reducing the charging and discharging amounts correspondingly: When charging the EES, not

the entire energy surplus must be charged into the EES components but this amount is reduced

by the factor 𝑒𝑓𝑓𝑐ℎ𝑎𝑟𝑔𝑒. For discharging, the EES component cannot provide the full energy of

its current charge level; instead the energy it can provide is reduced by the factor 𝑒𝑓𝑓𝑑𝑖𝑠𝑐ℎ𝑎𝑟𝑔𝑒.

The following formula incorporates this concept through the use of the variable 𝑐_𝑑

(charge/discharge).

𝐴𝑡 = {

𝐴𝑡−1 ∗ 𝑑𝑖𝑠𝑠𝑒𝑙𝑓 + 𝑐_𝑑, 0 ≤ 𝐴𝑡−1 ∗ 𝑑𝑖𝑠𝑠𝑒𝑙𝑓 + 𝑐_𝑑 ≤ 𝐶

0 , 𝐴𝑡−1 ∗ 𝑑𝑖𝑠𝑠𝑒𝑙𝑓 + 𝑐_𝑑 < 0

𝐶 , 𝐶 < 𝐴𝑡−1 ∗ 𝑑𝑖𝑠𝑠𝑒𝑙𝑓 + 𝑐_𝑑

with 𝑐_𝑑 = {𝐵𝑒𝑛𝑒𝑟,𝑡 ∗ 𝑒𝑓𝑓𝑐ℎ𝑎𝑟𝑔𝑒 , 𝐵𝑒𝑛𝑒𝑟,𝑡 ≥ 0

𝐵𝑒𝑛𝑒𝑟,𝑡/𝑒𝑓𝑓𝑑𝑖𝑠𝑐ℎ𝑎𝑟𝑔𝑒 , 𝐵𝑒𝑛𝑒𝑟,𝑡 < 0 (18)

where 𝐵𝑒𝑛𝑒𝑟,𝑡 stands for balance energy instead of balance power and expresses the energy

surplus/deficit in every time interval t. It can be computed by multiplying 𝐵𝑡, standing for the

average power during t, by t. Based on this, the residual balance energy 𝑅𝑡 can be computed as

the remaining mismatch between supply and demand after using the EES of capacity C. It

reflects the surplus energy that does not fit into the EES (when 𝑅𝑡 is positive) and the energy

deficit that cannot be accommodated by the EES (when 𝑅𝑡 is negative). This is the energy

supply/demand mismatch for which other balancing mechanism, e.g. further EES with a

different suitable storage duration could be used.

𝑅𝑡 = {

0 , 0 ≤ 𝐴𝑡−1 ∗ 𝑑𝑖𝑠𝑠𝑒𝑙𝑓 + 𝑐_𝑑 ≤ 𝐶

𝐴𝑡−1 ∗ 𝑑𝑖𝑠𝑠𝑒𝑙𝑓 + 𝑐_𝑑 ∗ 𝑒𝑓𝑓𝑑𝑖𝑠𝑐ℎ𝑎𝑟𝑔𝑒 , 𝐴𝑡−1 ∗ 𝑑𝑖𝑠𝑠𝑒𝑙𝑓 + 𝑐_𝑑 < 0

(𝐴𝑡−1 ∗ 𝑑𝑖𝑠𝑠𝑒𝑙𝑓 + 𝑐_𝑑 − 𝐶)/𝑒𝑓𝑓𝑐ℎ𝑎𝑟𝑔𝑒 , 𝐶 < 𝐴𝑡−1 ∗ 𝑑𝑖𝑠𝑠𝑒𝑙𝑓 + 𝑐_𝑑

(19)

If this simulation was run only once with the original estimate of energy capacity, the energy

loss through self-discharge, charging and discharging the EES would be reflected in a residual

balance energy whose negative side would be far larger than its positive side. To avoid this,

energy generation capacity and thereby energy generation 𝐺𝑡 has to be scaled up by a factor s:

𝐺𝑡,𝑠𝑐𝑎𝑙𝑒𝑑 𝑓𝑜𝑟 𝑙𝑜𝑠𝑠 = 𝐺𝑡 ∗ 𝑠 (20)

Page 32: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

31

whereby s has to be chosen based on the objective that one pursues. Based on s, the energy

capacity C also has to be recalculated. Thereby, also charge efficiency should be taken into

account, which means that the recalculated energy capacity can be reduced by the factor

𝑒𝑓𝑓𝑐ℎ𝑎𝑟𝑔𝑒 because some energy that is intended for storage is already lost in the process of

storing. If one wants to determine the energy capacity for the EES for only a certain seasonal

component found, one should choose s, so that the remaining balance energy averages out to

zero as much as possible – so that other balancing mechanisms can be investigated separately:

arg min 𝑠

∑ 𝑅𝑡

subject to ∑ 𝑅𝑡 ≥ 0 (21)

If the objective is, instead, to find an EES for the last remaining periodicity and the energy

producers and consumers together should be able to function as a self-sufficient system

afterwards, the objective function should be chosen in a way that 𝑅𝑡 is positive at all times, so

that no time occurs when more energy is demanded than can be supplied by the combination

of energy generation and discharging the EESs. In this case:

arg min 𝑠

𝑅𝑡

subject to 𝑅𝑡 ≥ 0 (22)

4.5 Validation of suitability of EES’ determined energy capacities

When the required characteristics of the EES components have been identified, it is possible to

validate the determined energy capacities. To this end, the charging and discharging of the

individual EES components can be simulated together (see figure 7) in an analogous fashion

to the simulation of the individual EES: At any time t, if 𝐵𝑡 > 0, there exists an energy surplus

as more energy is generated than consumed. This surplus energy can be charged into the EES

components. For the simulation, first the EES component corresponding to the shortest

periodicity is charged and whenever it is fully charged, the EES component corresponding to

the next shortest periodicity is charged. In the situation that all EES components are fully

charged and 𝐵𝑡 > 0, this surplus energy could be, for example, sold to the grid. In the opposite

situation, at any time t where 𝐵𝑡 < 0, there exists an energy deficit as more energy is demanded

than generated. This is the time when the EES components should discharge to provide the

demanded energy. For the simulation, again, first the EES component corresponding to the

Page 33: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

32

shortest periodicity is discharged and whenever it is empty, the EES component corresponding

to the next shortest periodicity is discharged.

Figure 7: Simulation of several EESs combined: steps to follow for every time interval t

Discharge EES components by corresponding

rate of self-discharge

Does the surplus

energy completely

fit into the EES?

YES

NO

YES

Release energy from EES

corresponding to smallest

period until demand is

satisfied or EES empty

YES

Do not buy or

sell energy

Buy needed

energy

NO

NO YES

Release energy from EES

corresponding to next

smallest period until demand

is satisfied or EES empty

YES

NO

Sell surplus

energy

Charge EES corresponding

to next smallest period until

surplus is stored or EES is

fully charged

Charge EES corresponding

to smallest period until

surplus is stored or EES is

fully charged

Is energy demand

satisfied?

Is more energy

generated than

demanded?

Do more EES

components exist? Do more EES

components exist?

Page 34: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

33

5 Application of the method to real data

5.1 Scenario

50 households in Austin, Texas, are already producing their own energy through solar PV

systems installed on their roofs. However, they currently do not produce enough energy to

completely satisfy their demand through their own generation. Also, their solar PV systems do

not always generate energy just at the times when they need it. In the following scenario, the

50 households want to become independent from the electricity grid. They are therefore

interested in what kind of EES could be recommendable for them to store energy when more

is produced than needed and to release energy when demand is higher than generation.

Moreover, they need to know by how much they have to scale up their generation capacity to

produce enough energy for their own needs and to take into account the loss of energy resulting

from storage.

5.2 The data

The data used to apply the described methodology in practice and to examine the scenarios

outlined above was downloaded from Pecan Street Inc. Dataport (2017). It consists of energy

production data, energy consumption data and associated time stamps of 50 households in

Austin, Texas, which produce energy through solar photovoltaic systems installed at their

homes. More precisely, over a time horizon of four years – from January 11th 2013 00:00 to

January 10th 2017 23:59 – the dataset provides this production and consumption data in the

form of the total average real power of all households over one-minute intervals in kW,

whereby the time stamps indicate the starting time of each measurement interval. Energy

consumption thereby is only partly served by solar production; the remainder is drawn from

the electricity grid.

Average power measurements related to the solar PV energy production shall be denoted 𝐺𝑡

for “generation” in the one-minute time interval starting at time t. Average power

measurements related to the consumption of energy shall be denoted 𝑈𝑡 for “use” in the one-

minute time interval starting at time t which serves as a proxy for energy demand. (Demand

might differ from actual consumption if at some point during the measurement not enough

energy could be provided via solar production and the electricity grid.) If 𝑂𝑡 is the average

power drawn from the electricity grid in the one-minute time interval starting at time t, then:

𝑈𝑡 = 𝐺𝑡 + 𝑂𝑡

Page 35: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

34

5.3 Preparation of the data for analysis:

For the data to provide a good picture of what the patterns of energy supply and demand

mismatch look like, energy consumption data should approximate actual energy demand as

much as possible. Plotting all energy consumption data against time (see figure 8), two outliers

become apparent where energy consumption falls below the regular base level visible in the

plot (as marked by the red, dotted line). These two outliers shall be examined further by

zooming into the relevant parts of the data.

Figure 8: Energy consumption 𝑈𝑡 over the full four-year horizon

Data source: Pecan Street Inc. Dataport (2017)

Figure 9 shows that for about a one-hour period in August 2014, energy consumption falls to

almost zero, while figure 10 shows that the same applies to energy generation in this time

frame. For some reason, the examined households seem to not have been able to buy energy

from the electricity grid over this time horizon where solar energy generation fell so sharply.

As it is generally plausible that energy generation might have fallen sharply due to sudden bad

weather, the generation data is not to be changed. However, for further data analysis, it shall

be assumed that energy demand in this time frame did not fall so abruptly and that consumers

would have liked to purchase energy from the grid. Outlier values in the consumption data are

thus replaced by average values around them:

𝒖𝑜𝑢𝑡𝑙𝑖𝑒𝑟𝑠 = {𝑈𝑛| 𝑛𝑓𝑖𝑟𝑠𝑡 𝑜𝑢𝑡𝑙𝑖𝑒𝑟 ≤ 𝑛 ≤ 𝑛𝑙𝑎𝑠𝑡 𝑜𝑢𝑡𝑙𝑖𝑒𝑟}

Page 36: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

35

𝑁𝑜𝑢𝑡𝑙𝑖𝑒𝑟𝑠 = 𝑛𝑙𝑎𝑠𝑡 𝑜𝑢𝑡𝑙𝑖𝑒𝑟 − 𝑛𝑓𝑖𝑟𝑠𝑡 𝑜𝑢𝑡𝑙𝑖𝑒𝑟

𝒖𝑏𝑒𝑓𝑜𝑟𝑒 𝑜𝑢𝑡𝑙𝑖𝑒𝑟𝑠 = {𝑈𝑛| (𝑛𝑓𝑖𝑟𝑠𝑡 𝑜𝑢𝑡𝑙𝑖𝑒𝑟 − 𝑁𝑜𝑢𝑡𝑙𝑖𝑒𝑟𝑠) ≤ 𝑛 ≤ (𝑛𝑓𝑖𝑟𝑠𝑡 𝑜𝑢𝑡𝑙𝑖𝑒𝑟 − 1)}

𝒖𝑎𝑓𝑡𝑒𝑟 𝑜𝑢𝑡𝑙𝑖𝑒𝑟𝑠 = {𝑈𝑛| (𝑛𝑙𝑎𝑠𝑡 𝑜𝑢𝑡𝑙𝑖𝑒𝑟 + 1) ≤ 𝑛 ≤ (𝑛𝑙𝑎𝑠𝑡 𝑜𝑢𝑡𝑙𝑖𝑒𝑟 + 𝑁𝑜𝑢𝑡𝑙𝑖𝑒𝑟𝑠)}

𝒖𝑟𝑒𝑝𝑙𝑎𝑐𝑒𝑚𝑒𝑛𝑡 = 𝒖𝑏𝑒𝑓𝑜𝑟𝑒 𝑜𝑢𝑡𝑙𝑖𝑒𝑟𝑠 ⊙ 𝒖𝑎𝑓𝑡𝑒𝑟 𝑜𝑢𝑡𝑙𝑖𝑒𝑟𝑠

𝑈𝑛 are the power consumption values, whereby n stands for the nth value in the time series,

𝑛𝑓𝑖𝑟𝑠𝑡 𝑜𝑢𝑡𝑙𝑖𝑒𝑟 stands for the first value that is exceptionally low and 𝑛𝑙𝑎𝑠𝑡 𝑜𝑢𝑡𝑙𝑖𝑒𝑟 stands for the

last in this series of exceptionally low values. ⊙ shall denote element-wise multiplication of

the two vectors. 𝒖𝑜𝑢𝑡𝑙𝑖𝑒𝑟𝑠 is thus replaced in the data set by 𝒖𝑟𝑒𝑝𝑙𝑎𝑐𝑒𝑚𝑒𝑛𝑡. Figure 11 shows the

consumption data of August 10th 2014 after the outliers have been replaced.

Figure 9: Energy consumption outlier on August 10th 2014

Data source: Pecan Street Inc. Dataport (2017)

Page 37: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

36

Figure 10: Energy generation outlier on August 10th 2014

Data source: Pecan Street Inc. Dataport (2017)

Figure 11: Energy consumption 𝑈𝑡 after removal of outlier values on August 10th 2014

Data source: Pecan Street Inc. Dataport (2017)

Page 38: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

37

The energy consumption outlier in October 2015 occurs during the night when no energy is

generated by the solar PV systems (see figure 12). The data also do not seem as extraordinary

in context of the surrounding values as do the values from August 10th 2014. However, as it is

unclear whether energy demand really was as low as the energy consumption data of October

20th 2015 suggests or whether there has been a problem with energy supply from the grid, also

here these outlier values are replaced with an average of the surrounding values as illustrated

by the formulas on pages 34-35. For analyzing the patterns of balance power, increasing energy

consumption (demand) values means rather erring on the save side when it comes to planning

required energy storage capacities. Figure 13 shows the consumption data of October 20th 2015

after the outliers have been replaced.

Figure 12: Energy consumption outlier on October 20th 2015

Data source: Pecan Street Inc. Dataport (2017)

Page 39: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

38

Figure 13: Energy consumption 𝑈𝑡 after removal of outlier values on October 20th 2015

Data source: Pecan Street Inc. Dataport (2017)

5.4 Exploratory examination of the data in the time domain

Figures 8-21 provide a general picture of the data in the time domain. It becomes apparent that

different periodicities do exists but that they are difficult to make out precisely in the time

domain.

5.4.1 Energy consumption

On average, each household in the dataset demands around 28kWh per day – while the actual

data deviates from this average though. Patterns in actual consumption are expected that reflect

the patterns of human activity. Therefore, patterns to be found could reflect the time of year,

day of the week as well as time of day. Also a long-term trend could be visible if, for example,

residents buy and use more electrical devices and thus consume more energy over time.

Figure 8 clearly shows that there is a yearly pattern in energy consumption: The residents of

the examined households consume much more energy in summer than in winter. This might be

due especially to the high use of air conditioning in the hot Austin summer months. A trend,

however, cannot be recognized just by the eye.

Page 40: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

39

Figure 14 appears to exhibit also a below-yearly periodicity, but it is hard to determine

from the data plot. Besides, there definitely is a strong random component visible in figure 15

as residents switch on and off electronic devices at different exact times each day.

Figure 14: Energy consumption 𝑈𝑡 over four weeks; data source: Pecan Street Inc. Dataport (2017)

Figure 15: Energy consumption 𝑈𝑡 over a typical day; data source: Pecan Street Inc. Dataport (2017)

Page 41: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

40

5.4.2 Energy generation

It is expected that the data related to energy production exhibits a yearly pattern as more energy

should be generated by the solar PV systems during summer than during winter. Also a daily

pattern is expected as there cannot be any energy production during the night, when the sun is

not shining, and production should peak during the day when the PV system receives the most

solar radiation. Besides that, a lot of variability in the data is expected due to the intermittent

nature of solar PV energy production, especially due to varying cloud cover. A long-term trend

could possibly appear in the data if, for example, the number of sunny days in a year increases

over time.

Figure 16 might support the expectation of a yearly pattern, although it is hard to make a proper

judgment just from the data plot. It is also difficult to see what the underlying trend is, even

though it is clear that not all years are the same. However, figure 17 clearly supports the

expectation of there being a daily pattern that emerges despite the intermittent nature of energy

generation from solar PV. The intermittent component is clearly visible in figures 17-18.

Figure 16: Energy generation 𝐺𝑡 over the full four-year horizon

Data source: Pecan Street Inc. Dataport (2017)

Page 42: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

41

Figure 17: Energy generation 𝐺𝑡 over seven days: clear diurnal pattern

Data source: Pecan Street Inc. Dataport (2017)

Figure 18: Energy generation 𝐺𝑡 over a typical day: intermittency due to changing solar radiation

received by solar PV systems

Data source: Pecan Street Inc. Dataport (2017)

Page 43: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

42

5.4.3 Mismatch between energy generation and consumption

The variable of interest is the difference between energy production and consumption in any

one-minute time interval. Currently, this difference is expressed in the data by 𝑂𝑡, however

calculating ∑ 𝑈𝑡 and ∑ 𝐺𝑡 reveals that ∑ 𝑈𝑡 > ∑ 𝐺𝑡. In the scenario of interest 50 households

want to form their own micro grid and thus no longer rely on the electricity grid. This means

that the households combined must produce enough energy from their solar PV systems to

satisfy their consumption needs. Gt shall therefore be scaled up to equal Ut over the four-year

time horizon:

𝐺𝑡,𝑆𝑐𝑎𝑙𝑒𝑑 = 𝐺𝑡 ∗ ∑ 𝑈𝑡 / ∑ 𝐺𝑡

This scaling-up relies on the assumption that no energy is lost while shifting its availability

from the time of generation to the time of consumption. Depending on the balancing

mechanism, this assumption must be relaxed later as, for example, the storage of energy is

associated with a loss of energy due to a charge and discharge efficiency below 100% as well

as a certain self-discharge over the storage duration. For real-life application, also a buffer

should be included in the production capacity to allow for a future upward trend in energy

consumption.

The variable of interest thus no longer is equal to 𝑂𝑡 but shall be expressed by the balance

power, being the average power over the one-minute interval starting at time t that constitutes

a surplus of production over consumption (if it carries a positive sign) or the power that is

missing to satisfy consumption needs (if it carries a negative sign):

𝐵𝑡 = 𝐺𝑡,𝑆𝑐𝑎𝑙𝑒𝑑 − 𝑈𝑡

𝐵𝑡 can reveal the percentage of energy demand that is supplied at the time when it is needed,

which is 1 − |∑ 𝐵𝑡𝐵𝑡≤0 | ∑ 𝑈𝑡⁄ ≈ 41%. This means that ~59% of energy demand cannot be met

by using only the households solar PV systems – even after scaling up generation capacity, so

that total generation over the four years equals total consumption over the same time.

Examining 𝐵𝑡 can bring to light how this mismatch between energy generation and demand

manifests itself in time. As the balance power is a linear combination of the two underlying

variables 𝐺𝑡,𝑠𝑐𝑎𝑙𝑒𝑑 and 𝑈𝑡, it should exhibit all patterns that result from the periodicity of

production as well as consumption and from possible underlying trends. Figure 19 clearly

Page 44: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

43

shows that there exists a yearly pattern, while a daily pattern with many irregularities is visible

in figures 20-21. Figure 20 does not exhibit any clearly visible weekly pattern.

Figure 19: Mismatch 𝐵𝑡 between energy generation and consumption over the full four-year horizon

Data source: Pecan Street Inc. Dataport (2017)

Figure 20: Mismatch between energy generation and consumption over four weeks

Data source: Pecan Street Inc. Dataport (2017)

Page 45: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

44

Figure 21: Mismatch 𝐵𝑡 between energy generation and consumption over a typical day

Data source: Pecan Street Inc. Dataport (2017)

5.5 Transformation of the data into the frequency domain:

To examine the underlying periodicities of the data more systematically the balance power data

𝐵𝑡 is transformed into the frequency domain using (3). The achieved frequency resolution is

1 (𝑡 ∗ 𝑁) = 1 (60 sec ∗ 60 ∗ 24 ∗ 365.25 ∗ 4 )⁄⁄ ≈ 7.922 ∗ 10−9 Hz. The frequency band

stretches from 1 𝑊⁄ = 1 (60 sec ∗ 60 ∗ 24 ∗ 365.25 ∗ 4)⁄ ≈ 7.922 ∗ 10−9 Hz corresponding

to a period of four years, to 𝑁 (2 ∗ 𝑊)⁄ = (60 ∗ 24 ∗ 365.25 ∗ 4) (2 ∗⁄ 60 sec ∗ 60 ∗ 24 ∗

365.25 ∗ 4) = 1 2 ∗ 60 sec⁄ = 0.0083 Hz, corresponding to a period of two minutes.

Figure 22 shows the absolute values of the DFT coefficients, which equal the amplitudes of the

corresponding sinusoids, against the frequencies plotted on a logarithmic scale for clarity. In

the plot, it becomes apparent that the balance power data contains a yearly pattern as evidenced

by the high amplitude values at the frequency corresponding to a one-year period and its higher

harmonics, as well as a daily patterns as evidenced by high amplitude values at the frequency

corresponding to a one-day period and its higher harmonics. For the one-day seasonality, many

noticeable DFT-coefficients occur in the plot that occur at frequencies around 1/day and the

corresponding higher harmonics. This is the case because, as explained in section 4.4.2, the

daily pattern does not stay the same throughout the course of a year but the amplitudes are

Page 46: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

45

expected to change with the seasons and also the DST changes are expected to have an impact

on the pattern in balance power. The spectrum in figure 22 therefore only constitutes the basis

for finding the long-term trend and yearly seasonal component, while the daily components are

found in section 5.6.3 after dividing the year in several subsections.

Figure 22: Mismatch between energy generation and consumption in the frequency domain

Data source: Pecan Street Inc. Dataport (2017)

1-day

period

1/2-day

period

1-year

period

1/2-year

period

1/3-day

period 1/4-day

period

1/3-year

period 1/4-year

period

Page 47: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

46

5.6 Splitting the data into a trend, seasonal components and an intermittent component

The balance power data is split into a trend, a component with yearly seasonality, a component

with daily seasonality and an “intermittent rest” with the help of filters that only let certain

DFT-coefficients pass back into the time domain as in (4).

5.6.1 The trend

DFT-coefficients corresponding to frequencies > 1 year are passed back into the time domain

as in (4.1) to yield the long-term trend component 𝑇𝑡 depicted in figure 23.

Figure 23: Long-term trend component 𝑇𝑡 extracted from the balance power data 𝐵𝑡

Data source: Pecan Street Inc. Dataport (2017)

Page 48: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

47

5.6.2 The seasonal component with yearly periodicity

To extract the yearly seasonality 𝑆𝑡,𝑦𝑒𝑎𝑟𝑙𝑦 from the balance power data, the DFT coefficient

corresponding to a one-year, half-year, third-year and quarter-year period are back-transformed

into the time domain using (4.2). The result is visible in figure 24.

Figure 24: Yearly seasonal component 𝑆𝑡,𝑦𝑒𝑎𝑟𝑙𝑦 extracted from the balance power data 𝐵𝑡

Data source: Pecan Street Inc. Dataport (2017)

As explained in section 4.5, the trend can be understood as showing which years have produced

relatively more or less energy surpluses or deficits. It is therefore interesting to see these

surpluses by adding up 𝑇𝑡 + 𝑆𝑡,𝑦𝑒𝑎𝑟𝑙𝑦 as depicted in figure 25 where the negative and positive

integrals are computed as in (13). The largest negative integral is visible in the summer - fall

season of 2016. The largest positive integral is visible in the first half of 2013. Even if energy

generation or consumption can be shifted in time, it will hardly be possible to shift either over

a four year time horizon. This therefore indicates that generation capacity might have to be

scaled up even further to take into account unfavorable combinations of a season in which

relatively little surplus is produced, followed by a season in which a high deficit occurs.

Page 49: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

48

Figure 25: The sum of the yearly seasonal component 𝑆𝑡,𝑦𝑒𝑎𝑟𝑙𝑦 and the long-term trend component 𝑇𝑡

shows how the overall energy surplus and deficit vary from year to year

Data source: Pecan Street Inc. Dataport (2017)

5.6.3 The seasonal component with daily periodicity

As explained in section 4.4.2, the spectrum of the balance power data as used so far does not

serve well to extract the underlying daily periodicity as this daily periodicity changes over the

course of the year; the corresponding amplitudes are expected to change. A better picture of

the daily periodicity can thus be obtained when the different seasons in the year are examined

separately. To this end, the balance power time series is divided into six different parts as in

(5) - (12). The days of daylight saving time changes needed for the splits are depicted in table

2. These individual time series can then separately be transformed to and examined in the

frequency domain using the DFT as described in section 4.4.2.

Year DST Start

(clock is turned forward)

DST End

(clock is turned backward)

2013 March 10, 2am November 3, 2am

2014 March 9, 2am November 2, 2am

2015 March 8, 2am November 1, 2am

2016 March 13, 2am November 6, 2am

Table 2: Dates of DST change contained in the data set (Thorsen, n.d.)

77.1

MWh

-45.1

MWh

5.3 MWh

-4.1 MWh

57.5

MWh

-47.6

MWh

5.7 MWh

-6.2 MWh

31.4

MWh

-71.6

MWh

8.6 MWh

-0.4 MWh

58.9

MWh

-73.7

MWh

4.0 MWh

-1.7 MWh

Page 50: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

49

Transforming 𝐵𝑡,𝑠𝑝𝑟𝑖𝑛𝑔 into the frequency domain yields the spectrum displayed in figure 26.

As expected, it is much cleaner than the spectrum in figure 22. The periodic component that

results from (4.3) is depicted in figure 27. Repeating the same procedure with the data that

corresponds to the other seasons, leads to the plots in figures 28-32.

Figure 26: Mismatch between energy generation and consumption in spring time in the frequency

domain

Data source: Pecan Street Inc. Dataport (2017)

1-day

period

1/2-day

period

1/3-day

period 1/4-day

period

Page 51: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

50

Figure 27: Daily seasonal component 𝑆𝑡,𝑑𝑎𝑖𝑙𝑦,𝑠𝑝𝑟𝑖𝑛𝑔 extracted from the balance power data 𝐵𝑡,𝑠𝑝𝑟𝑖𝑛𝑔

Data source: Pecan Street Inc. Dataport (2017)

Figure 28: Daily seasonal component 𝑆𝑡,𝑑𝑎𝑖𝑙𝑦,𝑠𝑢𝑚𝑚𝑒𝑟 extracted from the balance power data 𝐵𝑡,𝑠𝑢𝑚𝑚𝑒𝑟

Data source: Pecan Street Inc. Dataport (2017)

811.8

kWh

- 811.3

kWh

856.5

kWh

- 857.6

kWh

Page 52: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

51

Figure 29: Daily seasonal component 𝑆𝑡,𝑑𝑎𝑖𝑙𝑦,𝑓𝑎𝑙𝑙1 extracted from the balance power data 𝐵𝑡,𝑓𝑎𝑙𝑙1

Data source: Pecan Street Inc. Dataport (2017)

Figure 30: Daily seasonal component 𝑆𝑡,𝑑𝑎𝑖𝑙𝑦,𝑓𝑎𝑙𝑙2 extracted from the balance power data 𝐵𝑡,𝑓𝑎𝑙𝑙2

Data source: Pecan Street Inc. Dataport (2017)

821.2

kWh

- 819.1

kWh

594.2

kWh

- 580.3

kWh

Page 53: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

52

Figure 31: Daily seasonal component 𝑆𝑡,𝑑𝑎𝑖𝑙𝑦,𝑤𝑖𝑛𝑡𝑒𝑟1 extracted from the balance power data 𝐵𝑡,𝑤𝑖𝑛𝑡𝑒𝑟1

Data source: Pecan Street Inc. Dataport (2017)

Figure 32: Daily seasonal component 𝑆𝑡,𝑑𝑎𝑖𝑙𝑦,𝑤𝑖𝑛𝑡𝑒𝑟2 extracted from the balance power data 𝐵𝑡,𝑤𝑖𝑛𝑡𝑒𝑟2

Data source: Pecan Street Inc. Dataport (2017)

736.6

kWh

- 761.4

kWh

967.6

kWh

- 812.3

kWh

Page 54: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

53

Examining these daily periodicities of the different seasons separately manifests that even after

subtracting the average energy surplus (or deficit) of the season by eliminating the yearly

periodicity, the mismatch between energy supply and demand differs quite substantially from

one season to the next. For example, even after removing the yearly periodicity, in late fall

around 590 kWh are supplied (or demanded) during the wrong part of the day, while in summer

this amounts to around 857 kWh. This means that to balance out the daily demand/supply

mismatch, decisions have to be made concerning whether the biggest or rather the average

daily mismatch should be addressed.

5.6.4 The ‘intermittent’ rest

Even after accounting for the yearly and daily periodicities found in the data as well as for the

long-term trend, quite substantial amounts of non-periodic behavior 𝐼𝑡 remain as can be seen

in figure 33. This plot results from using the relation in (2) as 𝐼𝑡 = 𝐵𝑡 − 𝑇𝑡 − 𝑆𝑡,𝑦𝑒𝑎𝑟𝑙𝑦 −

𝑆𝑡,𝑑𝑎𝑖𝑙𝑦. It shows that, in fact, balance power could deviate up to around 200 kW in either

direction from what the underlying periodicities suggest it should be.

Figure 33: ‘Intermittent’ rest 𝐼𝑡 extracted from the balance power data 𝐵𝑡 over full four-year horizon

Data source: Pecan Street Inc. Dataport (2017)

Page 55: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

54

Zooming into one week (see figure 34), one can see this random behavior as a deviation from

the daily periodicity: On some days, more than average is produced (or less consumed), on

other days it is the other way around. Generally, these deviations from the periodic behavior

are relatively low during the night as they only reflect the non-periodic consumption behavior

because generation for solar PV at this time is constantly zero. During the day, balance power

can deviate strongly. Whichever balancing mechanisms are chosen to balance energy supply

and demand, will not only have to balance out the underlying periodic mismatch, but must also

be able to cope with the non-periodic “intermittent” mismatch.

Figure 34: ‘Intermittent’ rest 𝐼𝑡 extracted from the balance power data 𝐵𝑡 over one week

Data source: Pecan Street Inc. Dataport (2017)

5.7 Assignment of electric energy storage for the 50 households

In order to assign electric energy storage to the energy demand/supply mismatch data, it is a

natural option to first start with EES for the daily seasonality found as this application of EES

is best explored.

5.7.1 Assignment of electric energy storage to the daily energy demand/supply mismatch

Based on (14), a first estimate of the required power rating of the EES is 333 kW. Based on

(15) and the plots of the daily periodicities, the necessary suitable energy storage duration

Page 56: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

55

should be at least half a day. Using (16), one could take a weighted average of the necessary

energy capacities for the different daily periodicities in the different seasons. As the plots of

these daily periodicities reveal though, there is generally one half of the day that produces an

energy surplus and another half that produces an energy deficit. An even better first estimate

of the required energy storage for the daily periodicity can thus be obtained by simply

computing the daily average of the sum of all energy surpluses:

𝐶𝑑𝑎𝑖𝑙𝑦,𝑓𝑖𝑟𝑠𝑡 𝑒𝑠𝑡𝑖𝑚𝑎𝑡𝑒 = (∑𝐵𝑡

60)𝐵𝑡>0 (

𝑁

60∗24)⁄ = 828 kWh

where 𝐵𝑡/60 is the energy surplus or deficit in kWh in every one-minute time interval and the

condition 𝐵𝑡 > 0 means that only surpluses are summed up. 𝑁/(60 ∗ 24) is the number of

days contained in the time series.

Next to the suitable storage duration, the required power rating and energy capacity, section

4.5 discussed other factors to take into consideration (also see figure 5). Out of these, for the

scenario under consideration, two are especially important. These are maturity as the

households need to install an EES technology that is already commercialized and not still in

the development/demonstration stage, and allowable size because 50 households is a rather

small-scale application and the EES cannot be allowed to take on the size of the entire

neighborhood. The size of the EES depends on its energy density and power density which

makes these two very important characteristics.

Luo et al. (2015) provide a recent comparison of electrical energy storage technologies and

their characteristics. The tabular overview on pages 525-527 of their paper characterized

potential EES amongst others by energy density, power density, specific energy, specific

power, power rating, rated energy capacity, daily self-discharge, lifetime, cycle efficiency,

response time, suitable storage duration, cost and maturity. Facts and figures about EES

mentioned in this paragraph are taken from this tabular overview. The EES that fall into the

maturity categories of early commercialization to mature are PHS, CAES, lead-acid batteries,

sodium-sulfur (NaS) batteries, Nickel-cadmium (NiCd) batteries, vanadium redox flow

batteries (VRB) and SMES. Out of these, lead-acid batteries, NaS and NiCd have the highest

energy densities (around 50-300 Wh/l) and suitable power densities (around 10-600 W/l). With

an energy density of 300 Wh/l, an 828 kWh EES takes up a volume of 2760 liters or 2.76 m3;

with an energy density of 50 Wh/l, an 828 kWh EES takes up a volume of 16,560 liters or

16.56m3. These limits could roughly be imaginable as the limits for the storage size that an

Page 57: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

56

EES could take up for 50 households. Because all factors cannot be taken into consideration

here, for the purpose of further analysis, lead-acid batteries shall be used as they have the lowest

capital cost of the three. They can have a rated energy capacity between 1 kWh and 40 MWh

and a power rating below 8 MW and are thus suitable for the application under consideration.

Their daily self-discharge lies between 0.1 and 0.3% – so to calculate on the safe side, 0.3%

are used in the analysis. A daily self-discharge 𝑑𝑖𝑠𝑠𝑒𝑙𝑓,𝑑𝑎𝑦 of 0.3% means that of the energy

that is loaded into the EES in the time interval t 99.7% remains one day later. To express the

self-discharge in the simulation, it has to be broken down to a self-discharge on a minute-by-

minute level. What remains of the energy that is loaded into the EES at time t after one minute

passes is (1 − 𝑑𝑖𝑠𝑠𝑒𝑙𝑓,𝑑𝑎𝑦)1 (60∗24)⁄ . The cycle efficiency of a lead-acid battery could lie

anywhere between 63-90% and 𝑒𝑓𝑓𝑐𝑦𝑐𝑙𝑒 = 70% shall function as a reasonable estimate for the

analysis.

Based on 𝑑𝑖𝑠𝑠𝑒𝑙𝑓,𝑑𝑎𝑦 and 𝑒𝑓𝑓𝑐𝑦𝑐𝑙𝑒 and using (18) - (21) the required scaling factor s for scaling

up energy generation capacity is determined to be 1.1589. Average energy generation per

household and year therewith increases from 10,253.23 kWh to 11,882.47 kWh. The required

energy capacity after taking into account energy loss through storage and scaling up energy

generation capacity is determined to be 865 kWh – roughly 5% more than the original estimate

of 828 kWh. The required power rating increases by 17% from 333 kW to 390 kW. The residual

balance energy 𝑅𝑡 reveals the percentage of energy demand that is supplied at the time when it

is needed when energy generation capacity is scaled up and the EES for the daily periodicity

is employed: 1 − |∑ 𝑅𝑡𝑅𝑡≤0 | ∑ 𝑈𝑡⁄ ≈ 79%, which represents a large improvement compared to

the original 41% of energy demand that could be met at the right time without energy storage.

Table 3 provides an overview of how the scenario of scaling up energy generation capacity and

introducing an EES for the average daily periodicity compares to the base scenario.

Page 58: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

57

Only solar PV system

More solar panels +

EES to serve average

daily periodicity

Energy demand per year and

household (in kWh)

10,253.23 10,253.23

Energy generation per year and

household (in kWh)

10,253.23 11882.47

Scaling factor with which energy

generation capacity is scaled up

compared to base level

Base level = 1 1.1589

Energy capacity of EES (in kWh) 0 865

Percentage of energy demand that can

be served by considered technologies

41% 79%

Table 3: Comparison between base scenario and scenario in which an EES in introduced to balance

out daily energy supply/demand mismatch

Plotting the residual balance power (𝑅𝑡 ∗ 60) in figure 35 shows how the energy

supply/demand mismatch is thinned out when the EES is employed as compared to the original

plot in figure 19. Nevertheless, a strong yearly mismatch is still visible and also a daily

mismatch remains as the EES was sized to accommodate the mismatch of an average day and

not that of the time of year with the highest mismatch. This can also be seen in the frequency

domain as portrayed by the frequency spectrum in figure 36: The DFT-coefficients pertaining

to the daily periodicity are a lot smaller in amplitude than in the original plot in figure 22 as

they represent the mismatch deviation from the average daily mismatch. As expected, the DFT-

coefficients pertaining to the yearly periodicity and the trend are not affected by introducing

the EES for the daily periodicity.

Page 59: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

58

Figure 35: Residual balance power (𝑅𝑡 ∗ 60)

Data source: Pecan Street Inc. Dataport (2017)

Figure 36: Residual balance power (𝑅𝑡 ∗ 60) in the frequency domain: the DFT-coefficients

corresponding to trend and yearly seasonality have not changed as compared to figure 22

Data source: Pecan Street Inc. Dataport (2017)

Page 60: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

59

5.7.2 Assignment of electric energy storage to the yearly energy demand/supply mismatch

Based on figure 25 and (17)-(20) as well as (22), one can determine the required energy

capacity for an EES component to balance out the yearly periodicity. It would mainly charge

during the first half of the year and discharge during the second half but would also charge and

discharge at other times when the EES assigned to the mismatch of an average day is not

sufficient to balance supply and demand. Based on figure 25 and (15), the EES must be able to

store the energy for almost half a year and (14) determines the minimum required power rating

to be 390 kW. Based on (17), a first estimate of the required energy capacity of the EES is 58.9

MWh. With an energy capacity estimate of that magnitude, the foremost concern for finding

an EES to balance out the yearly periodicity becomes storage size. As touched upon in section

5.7.1, out of the available technologies, NaS has the highest energy density with up to 300

Wh/l. With that energy density, an EES with an energy capacity of 58.9 MWh takes up 196,333

liters or ~196m3 – the size of roughly six standard 20-ft ocean containers (Inchcape Shipping

Services, n.d.). Realistically, for a residential application in which only 50 households get

together to become self-sufficient, this is too large – so that it does not make sense to assign an

EES to the yearly periodicity. When other technologies, such as the production of solar fuel or

the use of hydrogen fuel cells becomes viable, the picture might change, as these can potentially

store energy in much smaller space.

5.7.3 Discussion of alternative possibilities to ensure energy is provided at the times it is

demanded

Considering the fact that it is not practically feasible to introduce an EES to balance out the

yearly energy supply/demand mismatch in the examined neighborhood application, the

question arises which other possibilities exist to ensure demand is met at the right times.

Potential solutions should provide for the yearly periodicity and trend as depicted in figure 25.

This section considers the alternatives that exist, instead of using EES, to balance out the trend

and yearly mismatch pattern. It builds on the discussion of different balancing mechanisms in

section 2.3.

The first mechanism to balance energy supply and demand discussed in section 2.3 is to use a

less-variable energy source that can be regulated up or down, for example hydropower. This

mechanism is (a) very site-dependent and (b) mostly relevant for large-scale applications. It is

thus not suitable for the 50-household scenario under consideration.

Page 61: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

60

The second introduced balancing mechanism consists in the interconnection of generators. This

could take the form of either interconnecting geographically dispersed generators or

interconnecting different generators whose energy production depends on different inputs. In

the studied scenario, the first option would mean to connect more households with their solar

PV panels together to form a microgrid. This would likely make the mismatch patterns more

predictable as the ‘intermittent rest’ would average out more with more households

interconnected but it would not eliminate the underlying seasonalities: Households close

enough together to form a microgrid would still all exhibit very similar yearly energy

generation patterns and probably similar energy consumption patterns as well. The second

option, on the other hand, would mean to interconnect the considered households with other

energy consumers that obtain their energy from, e.g., wind generation. This could be a

promising possibility. Whether it would actually work or not depends on the energy

supply/demand mismatch pattern of the potential partners in the formation of the microgrid: It

depends on their consumption patterns as well as on the patterns with which wind generators

can provide energy in the specific region. Therefore, potential partners would have to be

identified and their supply/demand mismatch patterns would have to be studied to find out

whether they provide a good, complementary match to the patterns that the examined

households exhibit.

The third possibility consists in oversizing generation capacity, which would mean to further

scale up the households’ solar PV production capacity by installing more solar PV panels on

their rooftops. Whether this is actually feasible depends on the available space for further

installations. In the pursuit of this path, the goal would be to scale up energy generation, so that

the trend + yearly periodicity would be greater than or equal to null at all times. Daily patterns

in the energy supply/demand mismatch would then still be balanced with an EES. It is not

possible to overcome this mismatch solely by scaling up generation capacity because there are

always times, i.e. night times, in which no energy can be produced with solar PV panels. With

this option, the households would also have to decide what to do with the sizable quantities of

surplus energy generated.

The last two discussed balancing mechanisms are the use of demand-response management

and the use of intelligent electricity brokers. The idea behind demand-response management

lies in shifting loads to another time depending on the availability of energy. It is thus adequate

only for short-term shifts of demand and could be used to flatten out the curve of the

Page 62: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

61

‘intermittent rest’, for example if it is desirable to charge and discharge EES with a steady rate

– but it does not help in shifting energy demand to another season. The use of intelligent

electricity brokers could make sense for the large-scale balancing of supply and demand with

many decentralized generators and consumers when these agents actually have the possibility

to influence production and demand to a certain extent. They are therefore not a suitable

balancing possibility for the examined scenario either. What could be an idea worth

considering, however, is to alter the general underlying patterns of energy demand –

independent of energy generation in a specific moment but fitting to the determined patterns in

the energy supply/demand mismatch. For this, the dominant causes of the occurring yearly

patterns in energy demand would have to be determined and changed. In the examined

scenario, one might find, for example, that a large part of the mismatch results from a high use

of air conditioning in summer and could be reduced by improving insulation of the houses.

6 Conclusion

While the transition to a more sustainable renewable energy landscape is well underway and

renewable energy becomes an increasingly large proportion of the energy generation mix, the

challenge of balancing demand and supply is a salient hurdle. Due to the intermittent nature of

renewable energy sources, the traditional way of managing the grid by adjusting energy

generation output can no longer stay the primary solution. Many different suggestions exist as

to what could constitute a potential alternative. These include such diverse measures as

interconnecting geographically dispersed generators, using demand-response management and

intelligent electricity brokers, over-sizing generation capacity, and storing energy. One premise

of this thesis is that none of these suggestions can provide a solution for all applications. Not

only does the generation of energy depend on local climate factors but also energy demand

differs from region to region and depends on the practices of the very consumers involved.

What is of decisive interest for balancing energy supply and demand thus is the difference

between both – i.e. the energy surplus, respectively deficit in any time interval. Although the

precise surplus or deficit might not be predictable for any given moment, there do exist regular

underlying patterns arising from patterns in local weather and from patterns with which energy

consumers conduct their activities. If these underlying patterns in balance energy can be found

and separated from the unpredictable ‘intermittent’ deviation for a pool of energy producers

Page 63: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

62

and consumers, this provides a valuable foundation for deciding which mechanisms to balance

supply and demand are suitable in the specific scenario.

Based on the discussed considerations, two research questions are derived. The first one

pertains to the question of how the temporal mismatch between energy supply and demand can

be examined in order to find the underlying patterns. The second one builds on the identified

patterns and asks how energy storage, as a potential balancing mechanism, can be fit to them.

Part 4 of this thesis provides a method to answer both research questions. The method to

identify underlying patterns in balance energy thereby depends on Fourier analysis: The data

are transformed to the frequency domain using the Discrete Fourier Transform where they are

examined for Fourier coefficients with amplitudes that are significantly different from the

underlying noise. These should be Fourier coefficients corresponding to the periods over which

energy demand and/or supply oscillates, for example a year or a day, and their higher

harmonics. Individual seasonal components are then singled out of the data by applying filters

that only let certain DFT-coefficients pass and back-transforming the data into the time domain.

Like this, a trend and the different underlying patterns can be identified. Subtracting these from

the original data also reveal the non-periodic ‘intermittent’ rest. To decide which energy

storage is suitable to balance out energy supply and demand in the examined scenario a large

amount of factors play a role. The patterns of the mismatch between energy supply and demand

thereby influence the necessary suitable storage duration and the required energy capacity of

the energy storage: A first indication of the necessary suitable storage duration can be given by

the time between two zero-crossings of the curve that describes a seasonal pattern; the required

energy capacity can initially be estimated by an integral between the curve and the x-axis. Both

estimations must be adjusted, however, to take into account the energy loss through self-

discharge of the energy storage and through an imperfect charge and discharge efficiency. The

described methods of part 4 are then applied for demonstration purposes to real data in part 5

of the thesis.

6.1 Managerial implications

Balancing energy supply and demand is imperative in any application in which energy is

generated and consumed. Where the responsibility and incentives for this lie – whether with

the producer or consumer – can be different from scenario to scenario. In any situation,

however, decisions must be made as to which balancing mechanisms are most suitable to the

application at hand. Thereby, it is important to keep in mind that no one solution will be suitable

Page 64: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

63

for all applications. Today, massive amounts of data are being collected already about the

generation and consumption of energy, and this trend will only progress in the future. All these

data can be brought to use by examining the temporal mismatch between energy supply and

demand using the described method. Underlying periodic patterns can be identified and it is

possible to see what part of the mismatch follows these easily predictable patterns and what

part is random. This decomposition can provide the basis to identify suitable mechanisms to

balance energy supply and demand: It tells the analyst how much energy demand or supply

generally has to be shifted over which time horizon and what part must be balanced on a

flexible ad-hoc basis. This thesis exemplarily describes how to use the identified patterns to

examine the appropriateness of potential energy storage technologies.

6.2 Limitations and future research

In line with the scope of the thesis, several simplifying assumptions were made and therefore

limitations of the results exist. Relaxing these yields several avenues for future research. These

limitations and suggestions for future research are outlined below – first the ones that pertain

to the determination of patterns in the temporal mismatch between energy supply and demand,

and then the ones that apply to the identification of suitable balancing mechanisms, in particular

energy storage.

First, the data on which the examination is based naturally is historical data. If one wants to

install mechanisms to balance energy supply and demand these will have to work in the future

though. To make the conclusions of which balancing mechanisms to employ more robust, it

could be interesting to create a forecast model to first forecast future energy supply and demand

and then base the further analysis on these forecasted data. Second, the determination of

periodicities in this work relies on visual inspection of the spectrum by the analyst. For future

research, it might be helpful to employ a more robust method that determines which peaks in

the spectrum are statistically significantly different from the underlying noise. Third, section

4.4.2 explains that for seasonal components with a period < 1 year, the periodic pattern changes

over the course of the year. It is therefore suggested to divide the data into several parts, each

containing only one season. This division is quite arbitrary, however, and it might be interesting

to examine whether other or more divisions of the year could lead to more precise results.

With regard to the identification of suitable energy storage, two simplifying assumptions have

been made for the simulation of the charging and discharging: First, the only imperfections of

Page 65: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

64

the energy storage technologies considered are the energy loss through self-discharge and

through an imperfect cycle efficiency. Other considerations, as towards a suitable depth of

discharge are disregarded. Seconds, the simulation explained in section 4.5 assumes that always

the energy storage component corresponding to the smallest periodicity is charged or

discharged before other components come into use – and that these other components would

also be available in principal to charge or discharge in the period where the opposite is generally

expected. For future research, more work could be dedicated to making the simulation of the

charging and discharging of the energy storage more realistic. Besides, in the applied part 5 of

the thesis, for the selection of suitable energy storage technologies costs and other factors have

only been taken into account very superficially. Thereby, it has also been assumed that energy

production capacity can be scaled up by an arbitrary factor which might not be the case in

reality where solar PV panels might only be available in certain sizes. For real-life application,

these considerations would have to be taken into account.

Overall, the methods described in this thesis provide a ground for a first estimate of what

mechanisms to balance energy supply and demand could be suitable in a specific application.

Only the use of energy storage has been examined in more detail and for real-life data. In the

future it would be interesting to see which other mechanisms can make sense – in the same but

also in a wide variety of other scenarios.

Page 66: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

65

Reference list

Beaudin, M., Zareipour, H., Schellenberglabe, A., & Rosehart, W. (2010). Energy storage for

mitigating the variability of renewable electricity sources: An updated review. Energy

for Sustainable Development, 14(4), 302–314. doi:10.1016/j.esd.2010.09.007

Bichler, M., Gupta, A., & Ketter, W. (2010). Designing smart markets. Information Systems

Research, 21(4), 688–699. doi: 10.1287/isre.1100.0316

Clean Technica. (2015, March 4). Energy Storage Could Reach Big Breakthrough Price

Within 5 Years. Retrieved January 27, 2017 from Clean Technica. Power:

https://cleantechnica.com/2015/03/04/energy-storage-could-reach-cost-holy-grail-

within-5-years/

D’Aprile, P., Newman, J., & Pinner, D. (2016, August). The new economics of energy

storage. Retrieved January 27, 2017 from McKinsey & Company: Sustainability and

resource productivity: http://www.mckinsey.com/business-functions/sustainability-and-

resource-productivity/our-insights/the-new-economics-of-energy-storage#0

Delucchi, M. A., & Jacobson, M. Z. (2011). Providing all global energy with wind, water,

and solar power, Part II: Reliability, system and transmission costs, and policies.

Energy Policy, 39(3), 1170–1190. doi: 10.1016/j.enpol.2010.11.045

Dunn, B., Kamath, H., & Tarascon, J.-M. (2011). Electrical Energy Storage for the Grid: A

Battery of Choices. Science, 334(6058), 928–935. doi: 10.1126/science.1212741

European Commission. (2011). The roadmap for transforming the EU into a competitive,

low-carbon economy by 2050. Retrieved from

https://ec.europa.eu/clima/sites/clima/files/2050_roadmap_en.pdf

Freire-González, J. (2017). Evidence of direct and indirect rebound effect in households in

EU-27 countries. Energy Policy, 102, 270–276. doi: 10.1016/j.enpol.2016.12.002

Gottwalt, S., Ketter, W., Block, C., Collins, J., & Weinhardt, C. (2011). Demand side

management - A simulation of household behavior under variable prices. Energy

Policy, 39(12), 8163–8174. doi: 10.1016/j.enpol.2011.10.016

Inchcape Shipping Services. (n.d.). Container Dimensions. Retrieved from http://www.iss-

shipping.com/cargo/cargo_library_container.asp.

Page 67: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

66

International Energy Agency. (2005). Variability of wind power and other renewables:

Management options and strategies. Paris: International Energy Agency.

International Energy Agency. (2016). Key world energy statistics 2016. Retrieved from

https://www.iea.org/publications/freepublications/publication/KeyWorld2016.pdf

Ketter, W., Collins, J., & Reddy, P. (2013). Power TAC: A competitive economic simulation

of the smart grid. Energy Economics, 39(5), 262–270.

http://doi.org/10.1016/j.eneco.2013.04.015

Ketter, W., Collins, J., Reddy, P & Weerdt, M. (2012). The 2012 Power Trading Agent

Competition (ERIM Report Series Reference No. ERS-2012-010-LIS). Retrieved from

SSRN: https://ssrn.com/abstract=2144644).

Ketter, W., Peters, M., Collins, J., & Gupta, A. (2015). Competitive Benchmarking: An IS

Research Approach to Address Wicked Problems with Big Data and Analytics. MIS

Quarterly (ERIM Report Series Reference No. ERS-2015-015-LIS). Retrieved from

https://ssrn.com/abstract=2700333

Ketter, W., Peters, M., Collins, J., & Gupta, A. (2016). A multiagent competitive gaming

platform to address societal challenges. MIS Quarterly, 40(2), 447–460. Retrieved from

http://misq.org/a-multiagent-competitive-gaming-platform-to-address-societal-

challenges.html

Lavania, C., Rao, S., & Subrahmanian, E. (2012). Reducing variation in solar energy supply

through frequency domain analysis. IEEE Systems Journal, 6(2), 196–204. doi:

10.1109/JSYST.2011.2162796

Luo, X., Wang, J., Dooner, M., & Clarke, J. (2015). Overview of current development in

electrical energy storage technologies and the application potential in power system

operation. Applied Energy, 137, 511–536. doi: 10.1016/j.apenergy.2014.09.081

Melville, N. P. (2010). Information systems innovation for environmental sustainability. MIS

Quarterly, 34(1), 1–21. Retrieved from http://dl.acm.org/citation.cfm?id=2017449

Mills, A., & Wiser, R. (2010). Implications of Wide-Area Geographic Diversity for Short-

Term Variability of Solar Power (Report No. LBNL-3884E). Retrieved from

https://emp.lbl.gov/publications/implications-wide-area-geographic

Page 68: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

67

Pecan Street Inc. Dataport. (2017). Electricity_egauge_minutes [Data file]. Retrieved from

https://dataport.cloud/

Peters, M., Ketter, W., Saar-Tsechansky, M., & Collins, J. (2013). A reinforcement learning

approach to autonomous decision-making in smart electricity markets. Machine

Learning, 92(1), 5–39. doi: 10.1007/s10994-013-5340-0

Prindle, B., & Eldridge, M. (2007). The Twin Pillars of Sustainable Energy : Synergies

between Energy Efficiency and Renewable Energy Technology and Policy (Report No.

E074). Retrieved from ACEEE: http://aceee.org/research-report/e074.

Rittel, H. W. J., & Webber, M. M. (1973). Dilemmas in a General Theory of Planning

Dilemmas in a General Theory of Planning. Policy Sciences, 4(2), 155–169. doi:

10.1007/BF01405730

Sorrell, S. (2009). Jevons’ Paradox revisited: The evidence for backfire from improved

energy efficiency. Energy Policy, 37(4), 1456–1469. doi: 10.1016/j.enpol.2008.12.003

Sovacool, B. K. (2009). The intermittency of wind, solar, and renewable electricity

generators: Technical barrier or rhetorical excuse? Utilities Policy, 17(3–4), 288–296.

doi: 10.1016/j.jup.2008.07.001

Thorsen, S. (n.d.). Clock Changes in Austin, Texas, US. Retrieved from

https://www.timeanddate.com/time/change/usa/austin

United Nations, Economic and Social Council (2016). Progress towards the Sustainable

Development Goals. Report of the Secretary-General, E/2016/75. Retrieved from

http://undocs.org/E/2016/75

United Nations, General Assembly. (2015). Transforming our world: The 2030 agenda for

sustainable development, A/RES/70/1. Retrieved from: http://undocs.org/A/RES/70/1

Walker, G. (2014). Energy Research & Social Science The dynamics of energy demand:

Change, rhythm and synchronicity. Energy Research & Social Science, 1, 49–55. doi:

10.1016/j.erss.2014.03.012

Page 69: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

68

Watson, R. T., Boudreau, M.-C., & Chen, A. J. (2010). Information Systems and

Environmentally Sustainable Development: Energy Informatics and New Directions for

the IS Community. MIS Quarterly, 34(1), 23–38. Retrieved from

https://www.researchgate.net/publication/220260282_Information_Systems_and_Envir

onmentally_Sustainable_Development_Energy_Informatics_and_New_Directions_for_

the_IS_Community

Page 70: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

69

Appendix A: Overview of variables

Variable Explanation

𝐺𝑡 Average power with which energy is generated during time interval t

𝐷𝑡 Average power demand during time interval t

𝐵𝑡 Balance power; 𝐺𝑡 − 𝐷𝑡

𝑇𝑡 Long-term trend of balance power

𝑆𝑡,𝑠 Underlying seasonalities of balance power

𝐼𝑡 ‘Intermittent’ rest; 𝐵𝑡 − 𝑇𝑡 − 𝑆𝑡,1 − … − 𝑆𝑡,𝑚

𝑋𝑘 Discrete Fourier coefficient at frequency k

𝑁 Data points contained in the time series 𝐵𝑡

𝐵𝑛 𝐵𝑡, indexed by number of data point not by time interval

𝐹𝑘 Filter vector

𝐸𝑆𝑡,𝑠, 𝑖𝑥 Integral between two adjacent zero-crossings ix of the time series 𝑆𝑡,𝑠

𝑃 Required power rating

𝐿 Necessary duration over which the EES must be able to store the energy

𝐶 Required energy capacity

𝑑𝑖𝑠𝑠𝑒𝑙𝑓 Self-discharge rate of EES

𝑒𝑓𝑓𝑐ℎ𝑎𝑟𝑔𝑒 Charge efficiency

𝑒𝑓𝑓𝑑𝑖𝑠𝑐ℎ𝑎𝑟𝑔𝑒 Discharge efficiency

𝑒𝑓𝑓𝑐𝑦𝑐𝑙𝑒 Cycle efficiency

𝐴𝑡 Charge state of the EES at the end of time interval t

𝑐_𝑑 When positive, amount by which the charge state of the EES increases;

when negative, the amount of energy the EES provides

𝑅𝑡 Residual balance energy after use of EES

𝑠 Scaling factor to scale up energy generation capacity

Page 71: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

70

Appendix B: R Code

#------------------------------------------------------------------------------------------------------------------------------------ #Preparation #------------------------------------------------------------------------------------------------------------------------------------

#set working directory to correct address setwd("~/Directory of choice")

#set language for plots Sys.setlocale("LC_TIME", "English")

#import "readr" package library(readr)

#read dataset into R, using the correct time zone df.data <- read_csv("~/Uni/Master/Master Thesis/Pecan street/Data_time_gen_use_50 homes.csv", locale = locale(tz = "US/Central"))

#only data from four years needed N <- 60*24*365.25*4 df.data <- df.data[1:N, ] #import "ggplot2" package library("ggplot2") #update theme for better readability theme_update(plot.title = element_text(size=18, face="bold"), axis.text.x = element_text(size=13), axis.text.y = element_text(size=13), axis.title.x = element_text(size=15), axis.title.y = element_text(size=15)) #create date/time variables to specify timeframes for data plots and computations apr.first <- as.POSIXct(strptime("2014-04-01 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) apr.second <- as.POSIXct(strptime("2014-04-02 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) apr.third <- as.POSIXct(strptime("2014-04-03 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) apr.third.end <- as.POSIXct(strptime("2014-04-03 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) apr.fourth <- as.POSIXct(strptime("2014-04-04 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) apr.fourth.end <- as.POSIXct(strptime("2014-04-04 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) apr.seventh.end <- as.POSIXct(strptime("2014-04-07 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) apr.twentyninth.end <- as.POSIXct(strptime("2014-04-29 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) apr.fourth.12pm <- as.POSIXct(strptime("2014-04-04 12:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) apr.fourth.2pm <- as.POSIXct(strptime("2014-04-04 14:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/C

Page 72: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

71

entral")) beg.2013 <- as.POSIXct(strptime("2013-01-01 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.2013 <- as.POSIXct(strptime("2013-12-31 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) beg.2014 <- as.POSIXct(strptime("2014-01-01 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.2014 <- as.POSIXct(strptime("2014-12-31 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) beg.2015 <- as.POSIXct(strptime("2015-01-01 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.2015 <- as.POSIXct(strptime("2015-12-31 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) beg.2016 <- as.POSIXct(strptime("2016-01-01 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.2016 <- as.POSIXct(strptime("2016-12-31 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central"))

Page 73: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

72

#------------------------------------------------------------------------------------------------------------------------------------#Examination of data in the time domain #------------------------------------------------------------------------------------------------------------------------------------

#Plot energy consumption data over various time horizons to get a picture #plot power consumption data over all four years qplot(df.data$localminute, df.data$use, main = "Energy consumption", xlab = "Time", ylab = expression('Av. real power over 1min intervals in kW, '* U[t]), geom = "line")

#------------------------------------------------------------------------------------------------------------------------------------#Outlier removal #------------------------------------------------------------------------------------------------------------------------------------

#zoom in to outliers which(df.data$use < 13) #around index 830373 and index 1457371:

## [1] 830373 830374 830375 830376 830377 830378 830379 830380 ## [9] 830381 830382 830383 830384 830385 830386 830387 830388 ## [17] 830389 830390 830391 830392 830393 830394 830395 830396 ## [25] 830397 830398 830399 830400 830401 830402 830403 830404 ## [33] 830405 830406 830407 830408 830409 830410 830411 830412 ## [41] 830413 830414 830415 830416 830417 830418 830419 830420 ## [49] 1457371 1457372 1457373 1457374 1457375 1457376 1457377 1457378 ## [57] 1457379

Page 74: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

73

qplot(df.data$localminute[829653:831093], df.data$use[829653:831093], main = "Energy consumption", xlab = "Time", ylab = expression('Av. real power over 1min intervals in kW, '* U[t]), geom = "line")

qplot(df.data$localminute[829653:831093], df.data$gen[829653:831093], main = "Energy generation", xlab = "Time", ylab = expression('Av. real power over 1min intervals in kW, '* G[t]), geom = "line")

Page 75: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

74

qplot(df.data$localminute[1456651:1458091], df.data$use[1456651:1458091], main = "Energy consumption", xlab = "Time", ylab = expression('Av. real power over 1min intervals in kW, '* U[t]), geom = "line")

#replace outliers by average values around that time: df.data$use[830360:830440]

## [1] 178.360 179.561 178.189 184.337 182.891 178.703 179.894 164.917 ## [9] 153.890 151.786 57.725 13.259 13.606 10.766 10.530 5.719 ## [17] 5.297 5.281 5.556 6.027 6.116 6.046 4.592 2.872 ## [25] 2.641 4.262 5.009 5.131 5.138 5.038 5.025 4.998 ## [33] 4.994 4.959 5.081 5.073 5.956 6.763 5.254 5.173 ## [41] 5.045 5.050 5.004 5.182 5.171 5.140 5.140 5.131 ## [49] 5.076 4.944 4.967 7.814 6.023 7.202 5.254 6.282 ## [57] 5.063 5.319 5.570 7.435 9.754 16.307 20.653 29.175 ## [65] 34.030 38.844 45.510 57.576 65.207 82.366 91.313 110.590 ## [73] 153.977 161.253 173.847 179.146 179.489 186.978 182.526 184.652 ## [81] 189.533

df.data$use[830370:830431] <- (df.data$use[830308:830369] + df.data$use[830432:830493]) / 2

Page 76: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

75

qplot(df.data$localminute[829653:831093], df.data$use[829653:831093], main = "Energy consumption after outlier removal", xlab = "Time", ylab = expression('Av. real power over 1min intervals in kW, '* U[t]), geom = "line")

df.data$use[1457360:1457390]

## [1] 26.010 28.438 23.748 23.204 22.515 28.694 25.646 28.551 25.744 26.091 ## [11] 15.215 8.668 9.190 9.765 10.396 8.928 9.114 9.368 9.258 12.555 ## [21] 14.072 14.716 17.118 18.672 18.320 22.731 26.123 25.284 25.716 25.498 ## [31] 24.355

df.data$use[1457370:1457385] <- (df.data$use[1457354:1457369] + df.data$use[1457386:1457401]) / 2 qplot(df.data$localminute[1456651:1458091], df.data$use[1456651:1458091], main = "Energy consumption after outlier removal", xlab = "Time", ylab = expression('Av. real power over 1min intervals in kW, '* U[t]), geom = "line")

Page 77: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

76

#------------------------------------------------------------------------------------------------------------------------------------#Examination of consumption data in the time domain #------------------------------------------------------------------------------------------------------------------------------------

#plot energy consumption data over four weeks qplot(df.data$localminute[df.data$localminute >= apr.second & df.data$localminute <= apr.twentyninth.end], df.data$use[df.data$localminute >= apr.second & df.data$localminute <= apr.twentyninth.end], main = "Energy consumption", xlab = "Time", ylab = expression('Av. real power over 1min intervals in kW, '* U[t]), geom = "line")

#plot energy consumption data over seven days qplot(df.data$localminute[df.data$localminute >= apr.first & df.data$localminute <= apr.seventh.end], df.data$use[df.data$localminute >= apr.first & df.data$localminute <= apr.seventh.end], main = "Energy consumption", xlab = "Time", ylab = expression('Av. real power over 1min intervals in kW, '* U[t]), geom = "line")

Page 78: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

77

#plot energy consumption data over one day qplot(df.data$localminute[df.data$localminute >= apr.third & df.data$localminute <= apr.third.end], df.data$use[df.data$localminute >= apr.third & df.data$localminute <= apr.third.end], main = "Energy consumption", xlab = "Time", ylab = expression('Av. real power over 1min intervals in kW, '* U[t]), geom = "line")

#------------------------------------------------------------------------------------------------------------------------------------#Examination of generation data in the time domain #------------------------------------------------------------------------------------------------------------------------------------

#Plot energy generation data over various time horizons to get a picture #plot energy generation data over all four years qplot(df.data$localminute, df.data$gen, main = "Energy generation", xlab = "Time", ylab = expression('Av. real power over 1min intervals in kW, '* G[t]), geom = "line")

Page 79: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

78

#plot energy generation data over seven days qplot(df.data$localminute[df.data$localminute >= apr.first & df.data$localminute <= apr.seventh.end], df.data$gen[df.data$localminute >= apr.first & df.data$localminute <= apr.seventh.end], main = "Energy generation", xlab = "Time", ylab = expression('Av. real power over 1min intervals in kW, '* G[t]), geom = "line")

#plot energy generation data over one day qplot(df.data$localminute[df.data$localminute >= apr.third & df.data$localminute <= apr.third.end], df.data$gen[df.data$localminute >= apr.third & df.data$localminute <= apr.third.end], main = "Energy generation", xlab = "Time", ylab = expression('Av. real power over 1min intervals in kW, '* G[t]), geom = "line")

Page 80: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

79

#plot energy generation data over two hours qplot(df.data$localminute[df.data$localminute >= apr.fourth.12pm & df.data$localminute <= apr.fourth.2pm], df.data$gen[df.data$localminute >= apr.fourth.12pm & df.data$localminute <= apr.fourth.2pm], main = "Energy generation", xlab = "Time", ylab = expression('Av. real power over 1min intervals in kW, '* G[t]), geom = "line")

#------------------------------------------------------------------------------------------------------------------------------------#Scale up generation data #------------------------------------------------------------------------------------------------------------------------------------

#create a new column of scaled up, hypothetical generation data in the data frame #(so that total generation equals total consumption over the entire four years) #--> scale up gen so that use-gen averages to 0 df.data$gen_scaled <- df.data$gen * sum(df.data$use)/sum(df.data$gen) #create a new column of 'hypothetical generation minus consumption' data in the data frame df.data$gen_scaled_minus_use <- df.data$gen_scaled - df.data$use mean(df.data$gen_scaled_minus_use) #almost 0:

## [1] 1.219566e-15

sum(df.data$gen_scaled_minus_use) #almost 0:

## [1] 8.742212e-09

Page 81: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

80

#On average, how much energy (in kWh) does each household demand per day? sum(df.data$use)/60/50/4/365.25

## [1] 28.07182

#On average, how much energy (in kWh) does each household demand per year? sum(df.data$use)/60/50/4

## [1] 10253.23

#On average, per year, how much energy (in kWh) cannot be provided when needed? abs(sum(df.data$gen_scaled_minus_use[df.data$gen_scaled_minus_use > 0])) / 60 / 4

## [1] 302334.5

#What percentage of energy demand cannot be met at the right time by the solar PV system? abs(sum(df.data$gen_scaled_minus_use[df.data$gen_scaled_minus_use < 0])) / sum(df.data$use)

## [1] 0.5897352

#------------------------------------------------------------------------------------------------------------------------------------#Examination of mismatch data in the time domain #------------------------------------------------------------------------------------------------------------------------------------

#Plot balance power data over various horizons to get a picture #plot balance power data over all four years qplot(df.data$localminute, df.data$gen_scaled_minus_use, main = "Balance power", xlab = "Time", ylab = expression('Av. real power over 1min intervals in kW, '* B[t]), geom = "line")

Page 82: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

81

#plot balance power data over four weeks qplot(df.data$localminute[df.data$localminute >= apr.second & df.data$localminute <= apr.twentyninth.end], df.data$gen_scaled_minus_use[df.data$localminute >= apr.second & df.data$localminute <= apr.twentyninth.end], main = "Balance power", xlab = "Time", ylab = expression('Av. real power over 1min intervals in kW, '* B[t]), geom = "line")

#plot balance power data over seven days qplot(df.data$localminute[df.data$localminute >= apr.first & df.data$localminute <= apr.seventh.end], df.data$gen_scaled_minus_use[df.data$localminute >= apr.first & df.data$localminute <= apr.seventh.end], main = "Balance power", xlab = "Time", ylab = expression('Av. real power over 1min intervals in kW, '* B[t]), geom = "line")

Page 83: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

82

#plot balance power data over one day qplot(df.data$localminute[df.data$localminute >= apr.fourth & df.data$localminute <= apr.fourth.end], df.data$gen_scaled_minus_use[df.data$localminute >= apr.fourth & df.data$localminute <= apr.fourth.end], main = "Balance power", xlab = "Time", ylab = expression('Av. real power over 1min intervals in kW, '* B[t]), geom = "line")

#------------------------------------------------------------------------------------------------------------------------------------#Examination of mismatch data in the frequency domain #------------------------------------------------------------------------------------------------------------------------------------

#FFT - Examine data in the frequency domain to find underlying patterns #-------------------------------------------------------------- #Compute the DFT of the gen_scaled_minus_use data, using the FFT algorithm. #Divide by input number to scale down, so that absolute values of DFT coefficients #are equal to the amplitudes of the corresponding sinusoids. gen.scaled.minus.use.FFT <- fft(df.data$gen_scaled_minus_use)/N freq <- seq(from = 0, to =1-(1/N), by = 1/N) #Put frequencies, DFT coefficients and absolute values of DFT coefficients #into a dataframe # data in the 'frequencies' column is given in 1/min, data in the 'freq_hz' column is given in 1/sec=Hz df.DFT <- data.frame(frequencies = freq, freq_hz = freq/60, DFT = gen.scaled.minus.use.FFT, abs_DFT = abs(gen.scaled.minus.use.FFT)) #Only the first half of the frequencies are meaningful as the input data #consists of real values. df.DFT <- df.DFT[1:(N / 2 + 1), ] #the DC component is basically 0: df.DFT$abs_DFT[df.DFT$frequencies==0]

## [1] 4.127622e-15

Page 84: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

83

#add columns that reflect the periods corresponding to the frequencies #period = 1/frequency df.DFT$period_in_min <- 1/df.DFT$frequencies df.DFT$period_in_hours <- df.DFT$period_in_min/60 df.DFT$period_in_days <- df.DFT$period_in_hours/24 df.DFT$period_in_years <- df.DFT$period_in_days/365.25 #plot absolute values of the DFT coefficients against frequencies to get an overview of the spectrum qplot(df.DFT$freq_hz, df.DFT$abs_DFT, main = "DFT", xlab = "Frequency in Hz", ylab = "Absolute values DFT") + scale_x_log10(labels=function(n){format(n, scientific = FALSE)})

#------------------------------------------------------------------------------------------------------------------------------------#Find the long-term trend #------------------------------------------------------------------------------------------------------------------------------------

#Create a filter to only single out DFT coefficients that correspond to a period > 1 year filter.long.term <- rep(0, length(df.DFT$DFT)) filter.long.term[2:(length(df.DFT$period_in_years[df.DFT$period_in_years > 1]))] <- 1 filter.long.term <- c(filter.long.term, rev(filter.long.term[2:(length(filter.long.term) - 1)])) df.data$trend <- Re(fft(gen.scaled.minus.use.FFT * filter.long.term, inverse = TRUE)) #plot trend

Page 85: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

84

qplot(df.data$localminute, df.data$trend, main = "Balance power: long-term trend", xlab = "Time", ylab = "Av. real power over 1min intervals in kW\nGeneration - Consumption", geom = "line")

#------------------------------------------------------------------------------------------------------------------------------------#Find the yearly periodicity #------------------------------------------------------------------------------------------------------------------------------------

#Create a function to find suitable filter #data.points: how many data points are contained in one period, #e.g. one data point every minute, periodicity 1 day -> data.points = 60*24 = 1440 #nr.coeff: how many Fourier coefficients should be used for constructing the pattern in the time domain #ts.length: length of the time series that was DFT-transformed filter.fcn <- function(data.points, nr.coeff, ts.length){ filter <- rep(0, ts.length / 2 + 1) p <- ts.length / data.points filter.1.pos <- rep(0, nr.coeff) for(i in 1:nr.coeff){ filter[1 + i * p] <- 1 } filter <- c(filter, rev(filter[2:(length(filter) - 1)])) filter }

Page 86: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

85

#Create a filter to single out yearly periodicity filter.yearly.component <- filter.fcn(data.points = 60*24*365.25, nr.coeff = 4, ts.length = N) #also include zero frequency DFT filter.yearly.component[1] <- 1 #Find yearly periodicity df.data$yearly_component <- Re(fft(gen.scaled.minus.use.FFT * filter.yearly.component, inverse = TRUE)) #plot yearly periodicity qplot(df.data$localminute, df.data$yearly_component, main = "Balance power: yearly periodicity", xlab = "Time", ylab = "Av. real power over 1min intervals in kW\nGeneration - Consumption", geom = "line")

Page 87: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

86

#------------------------------------------------------------------------------------------------------------------------------------#Examine trend plus yearly periodicity combined #------------------------------------------------------------------------------------------------------------------------------------

df.data$trend_plus_yearly <- df.data$trend + df.data$yearly_component #plot sum of yearly periodicty and trend of balance power qplot(df.data$localminute, df.data$trend_plus_yearly, main = "Balance power: trend + yearly periodicity", xlab = "Time", ylab = "Av. real power over 1min intervals in kW\nGeneration - Consumption", geom = "line") + geom_hline(yintercept = 0)

#Find zero-crossings to determine amount of energy supplied/demanded at unsuitable time updown <- c(0, diff(sign(df.data$trend_plus_yearly))) ix <- which(updown != 0) ix

## [1] 205202 388249 452305 513112 721893 912513 976803 1048457 ## [9] 1225428 1439128 1520810 1547972 1761681 1973399 2033550 2078985

#For each two adjacent zero-crossings, determine the total energy surplus/deficit between them integrals <- rep(NA, length(ix) + 1 ) s <- 1 for (i in 1:(length(ix))){ integrals[i] <- sum(df.data$trend_plus_yearly[s:(ix[i]-1)]) s <- ix[i] } integrals[length(ix) + 1] <- sum(df.data$trend_plus_yearly[s:length(df.data$trend_plus_yearly)]) round(integrals/60/1000, digits = 1)

## [1] 77.1 -45.1 5.3 -4.1 57.4 -47.8 5.6 -6.2 31.4 -71.6 8.6 ## [12] -0.4 58.9 -73.7 4.0 -1.7 2.0

Page 88: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

87

#------------------------------------------------------------------------------------------------------------------------------------#Examination of daily periodicity according to different seasons #------------------------------------------------------------------------------------------------------------------------------------

df.data$remainder <- df.data$gen_scaled_minus_use - df.data$trend_plus_yearly #Begin fall: September 23 #Begin winter: December 22 #Begin spring: March 20 #Begin Summer: June 21 #------------------------------------------------------------------------------------------------------------------------------------#Spring data #------------------------------------------------------------------------------------------------------------------------------------

#Begin spring: March 20 #Begin Summer: June 21 start.spring.2013 <- as.POSIXct(strptime("2013-03-20 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.spring.2013 <- as.POSIXct(strptime("2013-06-20 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) start.spring.2014 <- as.POSIXct(strptime("2014-03-20 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.spring.2014 <- as.POSIXct(strptime("2014-06-20 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) start.spring.2015 <- as.POSIXct(strptime("2015-03-20 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.spring.2015 <- as.POSIXct(strptime("2015-06-20 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) start.spring.2016 <- as.POSIXct(strptime("2016-03-20 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.spring.2016 <- as.POSIXct(strptime("2016-06-20 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) df.spring.data <- data.frame(localminute = df.data$localminute[df.data$localminute >= start.spring.2013 & df.data$localminute <= end.spring.2013 | df.data$localminute >= start.spring.2014 & df.data$localminute <= end.spring.2014 | df.data$localminute >= start.spring.2015 & df.data$localminute <= end.spring.2015 | df.data$localminute >= start.spring.2016 & df.data$localminute <= end.spring.2016], gen_scaled_minus_use = df.data$remainder[df.data$localminute >= start.spring.2013 & df.data$localminute <= end.spring.2013 | df.data$localminute >= start.spring.2014 & df.data$localminute <= end.spring.2014 | df.data$localminute >= start.spring.2015 & df.data$localminute <= end.spring.2015 | df.data$localminute >= start.spring.2016 & df.data$localminute <= end.spring.2016]) N.spring <- length(df.spring.data$gen_scaled_minus_use) fft.spring <- fft(df.spring.data$gen_scaled_minus_use)/N.spring freq.spring <- seq(from = 0, to = 1-(1/N.spring), by = 1/N.spring)

Page 89: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

88

#Put frequencies, DFT coefficients and absolute values of DFT coefficients into a dataframe #Data in the 'frequencies' column is given in 1/min, data in the 'freq_hz' column is given in 1/sec=Hz df.DFT.spring <- data.frame(frequencies = freq.spring, freq_hz = freq.spring/60, DFT = fft.spring, abs_DFT = abs(fft.spring)) #Only the first half of the frequencies are meaningful as the input data consists of real values. df.DFT.spring <- df.DFT.spring[1:(N.spring/2 + 1), ] #add columns that reflect the periods corresponding the frequencies #period = 1/frequency df.DFT.spring$period_in_min <- 1/df.DFT.spring$frequencies df.DFT.spring$period_in_hours <- df.DFT.spring$period_in_min/60 df.DFT.spring$period_in_days <- df.DFT.spring$period_in_hours/24 df.DFT.spring$period_in_years <- df.DFT.spring$period_in_days/365.25 #plot absolute values of the DFT coefficients against frequencies to get an overview of the spectrum qplot(df.DFT.spring$freq_hz, df.DFT.spring$abs_DFT, main = "DFT: spring", xlab = "Frequency in Hz", ylab = "Absolute values DFT") + scale_x_log10(labels = function(n){format(n, scientific = FALSE)})

#sort data frame by absolute values of DFT coefficients #to get better overview of large amplitudes df.DFT.spring <- df.DFT.spring[order(df.DFT.spring$abs_DFT, decreasing = TRUE), ] View(df.DFT.spring) #sort back data frame to order by frequency df.DFT.spring <- df.DFT.spring[order(df.DFT.spring$frequencies), ] #Create a filter to single out daily periodicity #include base frequency and three harmonics filter.daily.component.spring <- filter.fcn(data.points = 60*24, nr.coeff = 4, ts.length = N.spring)

#also include zero frequency DFT filter.daily.component.spring[1] <- 1

Page 90: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

89

#Find daily periodicity df.spring.data$daily_component <- Re(fft(fft.spring * filter.daily.component.spring, inverse = TRUE)) #plot daily periodicity spring2013.week1 <- as.POSIXct(strptime("2013-03-27 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) qplot(df.spring.data$localminute[df.spring.data$localminute >= start.spring.2013 & df.spring.data$localminute <= spring2013.week1], df.spring.data$daily_component[df.spring.data$localminute >= start.spring.2013 & df.spring.data$localminute <= spring2013.week1], main = "Daily periodicity: spring", xlab = "Time", ylab = "Av. real power over 1min intervals in kW\nGeneration - Consumption", geom = "line") + geom_hline(yintercept = 0)

#positive and negative integral (kWh) spring2013.day1.end <- as.POSIXct(strptime("2013-03-20 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) sum(df.spring.data$daily_component[df.spring.data$localminute >= start.spring.2013 & df.spring.data$localminute <= spring2013.day1.end & df.spring.data$daily_component < 0])/60

## [1] -811.8192

sum(df.spring.data$daily_component[df.spring.data$localminute >= start.spring.2013 & df.spring.data$localminute <= spring2013.day1.end & df.spring.data$daily_component > 0])/60

## [1] 811.2533

Page 91: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

90

#------------------------------------------------------------------------------------------------------------------------------------#Summer data #------------------------------------------------------------------------------------------------------------------------------------

#Begin Summer: June 21 #Begin fall: September 23 start.summer.2013 <- as.POSIXct(strptime("2013-06-21 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.summer.2013 <- as.POSIXct(strptime("2013-09-22 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) start.summer.2014 <- as.POSIXct(strptime("2014-06-21 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.summer.2014 <- as.POSIXct(strptime("2014-09-22 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) start.summer.2015 <- as.POSIXct(strptime("2015-06-21 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.summer.2015 <- as.POSIXct(strptime("2015-09-22 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) start.summer.2016 <- as.POSIXct(strptime("2016-06-21 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.summer.2016 <- as.POSIXct(strptime("2016-09-22 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) df.summer.data <- data.frame(localminute = df.data$localminute[df.data$localminute >= start.summer.2013 & df.data$localminute <= end.summer.2013 | df.data$localminute >= start.summer.2014 & df.data$localminute <= end.summer.2014 | df.data$localminute >= start.summer.2015 & df.data$localminute <= end.summer.2015 | df.data$localminute >= start.summer.2016 & df.data$localminute <= end.summer.2016], gen_scaled_minus_use = df.data$remainder[df.data$localminute >= start.summer.2013 & df.data$localminute <= end.summer.2013 | df.data$localminute >= start.summer.2014 & df.data$localminute <= end.summer.2014 | df.data$localminute >= start.summer.2015 & df.data$localminute <= end.summer.2015 | df.data$localminute >= start.summer.2016 & df.data$localminute <= end.summer.2016]) N.summer <- length(df.summer.data$gen_scaled_minus_use) fft.summer <- fft(df.summer.data$gen_scaled_minus_use)/N.summer freq.summer <- seq(from = 0, to = 1-(1/N.summer), by = 1/N.summer) #Put frequencies, DFT coefficients and absolute values of DFT coefficients #into a dataframe # data in the 'frequencies' column is given in 1/min, data in the 'freq_hz' column is given in 1/sec=Hz df.DFT.summer <- data.frame(frequencies = freq.summer, freq_hz = freq.summer/60, DFT = fft.summer, abs_DFT = abs(fft.summer)) #Only the first half of the frequencies are meaningful as the input data #consists of real values. df.DFT.summer <- df.DFT.summer[1:(N.summer/2 + 1), ]

Page 92: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

91

#add columns that reflect the periods corresponding the frequencies #period = 1/frequency df.DFT.summer$period_in_min <- 1/df.DFT.summer$frequencies df.DFT.summer$period_in_hours <- df.DFT.summer$period_in_min/60 df.DFT.summer$period_in_days <- df.DFT.summer$period_in_hours/24 df.DFT.summer$period_in_years <- df.DFT.summer$period_in_days/365.25 #plot absolute values of the DFT coefficients against frequencies #to get an overview of the spectrum qplot(df.DFT.summer$freq_hz, df.DFT.summer$abs_DFT, main = "DFT: Summer", xlab = "Frequency in Hz", ylab = "Absolute values DFT") + scale_x_log10(labels = function(n){format(n, scientific = FALSE)})

#Create a filter to single out daily periodicity #include base frequency and three harmonics filter.daily.component.summer <- filter.fcn(data.points = 60*24, nr.coeff = 4, ts.length = N.summer) #also include zero frequency DFT filter.daily.component.summer[1] <- 1 #Find daily periodicity df.summer.data$daily_component <- Re(fft(fft.summer * filter.daily.component.summer, inverse = TRUE)) #plot daily periodicity summer2013.week1 <- as.POSIXct(strptime("2013-06-28 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) qplot(df.summer.data$localminute[df.summer.data$localminute >= start.summer.2013 & df.summer.data$localminute <= summer2013.week1], df.summer.data$daily_component[df.summer.data$localminute >= start.summer.2013 & df.summer.data$localminute <= summer2013.week1], main = "Daily periodicity: Summer", xlab = "Time", ylab = "Av. real power over 1min intervals in kW\nGeneration - Consumption", geom = "line") + geom_hline(yintercept = 0)

Page 93: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

92

#positive and negative integral (kWh) Summer2013.day1.end <- as.POSIXct(strptime("2013-06-21 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) sum(df.summer.data$daily_component[df.summer.data$localminute >= start.summer.2013 & df.summer.data$localminute <= Summer2013.day1.end & df.summer.data$daily_component < 0])/60

## [1] -857.5962

sum(df.summer.data$daily_component[df.summer.data$localminute >= start.summer.2013 & df.summer.data$localminute <= Summer2013.day1.end & df.summer.data$daily_component > 0])/60

## [1] 856.4514

Page 94: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

93

#------------------------------------------------------------------------------------------------------------------------------------#Fall data - before DST change #------------------------------------------------------------------------------------------------------------------------------------

#Begin fall: September 23 #Begin winter: December 22 #Daylight saving time changes: #2013 3. november, 02:00 #2014 2. november, 02:00 #2015 1. november, 02:00 #2016 6. november, 02:00 start.fall.1.2013 <- as.POSIXct(strptime("2013-09-23 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.fall.1.2013 <- as.POSIXct(strptime("2013-11-02 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) start.fall.1.2014 <- as.POSIXct(strptime("2014-09-23 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.fall.1.2014 <- as.POSIXct(strptime("2014-11-01 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) start.fall.1.2015 <- as.POSIXct(strptime("2015-09-23 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.fall.1.2015 <- as.POSIXct(strptime("2015-10-31 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) start.fall.1.2016 <- as.POSIXct(strptime("2016-09-23 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.fall.1.2016 <- as.POSIXct(strptime("2016-11-05 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) df.fall.1.data <- data.frame(localminute = df.data$localminute[df.data$localminute >= start.fall.1.2013 & df.data$localminute <= end.fall.1.2013 | df.data$localminute >= start.fall.1.2014 & df.data$localminute <= end.fall.1.2014 | df.data$localminute >= start.fall.1.2015 & df.data$localminute <= end.fall.1.2015 | df.data$localminute >= start.fall.1.2016 & df.data$localminute <= end.fall.1.2016], gen_scaled_minus_use = df.data$remainder[df.data$localminute >= start.fall.1.2013 & df.data$localminute <= end.fall.1.2013 | df.data$localminute >= start.fall.1.2014 & df.data$localminute <= end.fall.1.2014 | df.data$localminute >= start.fall.1.2015 & df.data$localminute <= end.fall.1.2015 | df.data$localminute >= start.fall.1.2016 & df.data$localminute <= end.fall.1.2016]) N.fall.1 <- length(df.fall.1.data$gen_scaled_minus_use) fft.fall.1 <- fft(df.fall.1.data$gen_scaled_minus_use)/N.fall.1 freq.fall.1 <- seq(from = 0, to = 1-(1/N.fall.1), by = 1/N.fall.1) #Put frequencies, DFT coefficients and absolute values of DFT coefficients #into a dataframe # data in the 'frequencies' column is given in 1/min, data in the 'freq_hz' column is given in 1/sec=Hz df.DFT.fall.1 <- data.frame(frequencies = freq.fall.1, freq_hz = freq.fall.1/60, DFT = fft.fall.1, abs_DFT = abs(fft.fall.1))

Page 95: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

94

#Only the first half of the frequencies are meaningful as the input data #consists of real values. df.DFT.fall.1 <- df.DFT.fall.1[1:(N.fall.1/2 + 1), ] #add columns that reflect the periods corresponding the frequencies #period = 1/frequency df.DFT.fall.1$period_in_min <- 1/df.DFT.fall.1$frequencies df.DFT.fall.1$period_in_hours <- df.DFT.fall.1$period_in_min/60 df.DFT.fall.1$period_in_days <- df.DFT.fall.1$period_in_hours/24 df.DFT.fall.1$period_in_years <- df.DFT.fall.1$period_in_days/365.25 #plot absolute values of the DFT coefficients against frequencies #to get an overview of the spectrum qplot(df.DFT.fall.1$freq_hz, df.DFT.fall.1$abs_DFT, main = "DFT: fall before DST change", xlab = "Frequency in Hz", ylab = "Absolute values DFT") + scale_x_log10(labels = function(n){format(n, scientific = FALSE)})

#sort data frame by absolute values of DFT coefficients #to get better overview of large amplitudes df.DFT.fall.1 <- df.DFT.fall.1[order(df.DFT.fall.1$abs_DFT, decreasing = TRUE), ] View(df.DFT.fall.1) #sort back data frame to order by frequency df.DFT.fall.1 <- df.DFT.fall.1[order(df.DFT.fall.1$frequencies), ]

Page 96: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

95

#Create a filter to single out daily periodicity #include base frequency and eight harmonics filter.daily.component.fall.1 <- filter.fcn(data.points = 60*24, nr.coeff = 9, ts.length = N.fall.1) #also include zero frequency DFT filter.daily.component.fall.1[1] <- 1 #Find daily periodicity df.fall.1.data$daily_component <- Re(fft(fft.fall.1 * filter.daily.component.fall.1, inverse = TRUE)) #plot daily periodicity fall.1.2013.week1 <- as.POSIXct(strptime("2013-09-30 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) qplot(df.fall.1.data$localminute[df.fall.1.data$localminute >= start.fall.1.2013 & df.fall.1.data$localminute <= fall.1.2013.week1], df.fall.1.data$daily_component[df.fall.1.data$localminute >= start.fall.1.2013 & df.fall.1.data$localminute <= fall.1.2013.week1], main = "Daily periodicity: fall before DST change", xlab = "Time", ylab = "Av. real power over 1min intervals in kW\nGeneration - Consumption", geom = "line") + geom_hline(yintercept = 0)

#positive and negative integral (kWh) fall.1.2013.day1.end <- as.POSIXct(strptime("2013-09-23 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) sum(df.fall.1.data$daily_component[df.fall.1.data$localminute >= start.fall.1.2013 & df.fall.1.data$localminute <= fall.1.2013.day1.end & df.fall.1.data$daily_component < 0])/60

## [1] -819.0943

Page 97: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

96

sum(df.fall.1.data$daily_component[df.fall.1.data$localminute >= start.fall.1.2013 & df.fall.1.data$localminute <= fall.1.2013.day1.end & df.fall.1.data$daily_component > 0])/60

## [1] 821.2005

#------------------------------------------------------------------------------------------------------------------------------------#Fall data - after DST change #------------------------------------------------------------------------------------------------------------------------------------

#Begin fall: September 23 #Begin winter: December 22 #Daylight saving time changes: #2013 3. november, 02:00 #2014 2. november, 02:00 #2015 1. november, 02:00 #2016 6. november, 02:00 start.fall.2.2013 <- as.POSIXct(strptime("2013-11-04 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.fall.2.2013 <- as.POSIXct(strptime("2013-12-21 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) start.fall.2.2014 <- as.POSIXct(strptime("2014-11-03 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.fall.2.2014 <- as.POSIXct(strptime("2014-12-21 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) start.fall.2.2015 <- as.POSIXct(strptime("2015-11-02 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.fall.2.2015 <- as.POSIXct(strptime("2015-12-21 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) start.fall.2.2016 <- as.POSIXct(strptime("2016-11-07 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.fall.2.2016 <- as.POSIXct(strptime("2016-12-21 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) df.fall.2.data <- data.frame(localminute = df.data$localminute[df.data$localminute >= start.fall.2.2013 & df.data$localminute <= end.fall.2.2013 | df.data$localminute >= start.fall.2.2014 & df.data$localminute <= end.fall.2.2014 | df.data$localminute >= start.fall.2.2015 & df.data$localminute <= end.fall.2.2015 | df.data$localminute >= start.fall.2.2016 & df.data$localminute <= end.fall.2.2016], gen_scaled_minus_use = df.data$remainder[df.data$localminute >= start.fall.2.2013 & df.data$localminute <= end.fall.2.2013 | df.data$localminute >= start.fall.2.2014 & df.data$localminute <= end.fall.2.2014 | df.data$localminute >= start.fall.2.2015 & df.data$localminute <= end.fall.2.2015 | df.data$localminute >= start.fall.2.2016 & df.data$localminute <= end.fall.2.2016]) N.fall.2 <- length(df.fall.2.data$gen_scaled_minus_use)

Page 98: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

97

fft.fall.2 <- fft(df.fall.2.data$gen_scaled_minus_use)/N.fall.2 freq.fall.2 <- seq(from = 0, to = 1-(1/N.fall.2), by = 1/N.fall.2) #Put frequencies, DFT coefficients and absolute values of DFT coefficients #into a dataframe # data in the 'frequencies' column is given in 1/min, data in the 'freq_hz' column is given in 1/sec=Hz df.DFT.fall.2 <- data.frame(frequencies = freq.fall.2, freq_hz = freq.fall.2/60, DFT = fft.fall.2, abs_DFT = abs(fft.fall.2)) #Only the first half of the frequencies are meaningful as the input data #consists of real values. df.DFT.fall.2 <- df.DFT.fall.2[1:(N.fall.2/2 + 1), ] #add columns that reflect the periods corresponding the frequencies #period = 1/frequency df.DFT.fall.2$period_in_min <- 1/df.DFT.fall.2$frequencies df.DFT.fall.2$period_in_hours <- df.DFT.fall.2$period_in_min/60 df.DFT.fall.2$period_in_days <- df.DFT.fall.2$period_in_hours/24 df.DFT.fall.2$period_in_years <- df.DFT.fall.2$period_in_days/365.25 #plot absolute values of the DFT coefficients against frequencies #to get an overview of the spectrum qplot(df.DFT.fall.2$freq_hz, df.DFT.fall.2$abs_DFT, main = "DFT: fall after DST change", xlab = "Frequency in Hz", ylab = "Absolute values DFT") + scale_x_log10(labels = function(n){format(n, scientific = FALSE)})

Page 99: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

98

#Create a filter to single out daily periodicity #include base frequency and eight harmonics filter.daily.component.fall.2 <- filter.fcn(data.points = 60*24, nr.coeff = 9, ts.length = N.fall.2) #also include zero frequency DFT filter.daily.component.fall.2[1] <- 1 #Find daily periodicity df.fall.2.data$daily_component <- Re(fft(fft.fall.2 * filter.daily.component.fall.2, inverse = TRUE)) #plot daily periodicity fall.2.2013.week1 <- as.POSIXct(strptime("2013-11-11 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) qplot(df.fall.2.data$localminute[df.fall.2.data$localminute >= start.fall.2.2013 & df.fall.2.data$localminute <= fall.2.2013.week1], df.fall.2.data$daily_component[df.fall.2.data$localminute >= start.fall.2.2013 & df.fall.2.data$localminute <= fall.2.2013.week1], main = "Daily periodicity: fall after DST change", xlab = "Time", ylab = "Av. real power over 1min intervals in kW\nGeneration - Consumption", geom = "line") + geom_hline(yintercept = 0)

#positive and negative integral (kWh) fall.2.2013.day1.end <- as.POSIXct(strptime("2013-11-04 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) sum(df.fall.2.data$daily_component[df.fall.2.data$localminute >= start.fall.2.2013 & df.fall.2.data$localminute <= fall.2.2013.day1.end & df.fall.2.data$daily_component < 0])/60

## [1] -580.346

Page 100: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

99

sum(df.fall.2.data$daily_component[df.fall.2.data$localminute >= start.fall.2.2013 & df.fall.2.data$localminute <= fall.2.2013.day1.end & df.fall.2.data$daily_component > 0])/60

## [1] 594.2481

#------------------------------------------------------------------------------------------------------------------------------------#Winter data - before DST change #------------------------------------------------------------------------------------------------------------------------------------

#Begin winter: December 22 #Begin spring: march 20 #2013 10. März, 02:00 #2014 9. März, 02:00 #2015 8. März, 02:00 #2016 13. März, 02:00 end.winter.1.2013 <- as.POSIXct(strptime("2013-03-09 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) start.winter.1.2013 <- as.POSIXct(strptime("2013-12-22 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.winter.1.2014 <- as.POSIXct(strptime("2014-03-08 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) start.winter.1.2014 <- as.POSIXct(strptime("2014-12-22 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.winter.1.2015 <- as.POSIXct(strptime("2015-03-07 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) start.winter.1.2015 <- as.POSIXct(strptime("2015-12-22 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.winter.1.2016 <- as.POSIXct(strptime("2016-03-12 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) start.winter.1.2016 <- as.POSIXct(strptime("2016-12-22 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) df.winter.1.data <- data.frame(localminute = df.data$localminute[df.data$localminute <= end.winter.1.2013 | df.data$localminute >= start.winter.1.2013 & df.data$localminute <= end.winter.1.2014 | df.data$localminute >= start.winter.1.2014 & df.data$localminute <= end.winter.1.2015 | df.data$localminute >= start.winter.1.2015 & df.data$localminute <= end.winter.1.2016 | df.data$localminute >= start.winter.1.2016], gen_scaled_minus_use = df.data$remainder[df.data$localminute <= end.winter.1.2013 | df.data$localminute >= start.winter.1.2013 & df.data$localminute <= end.winter.1.2014 | df.data$localminute >= start.winter.1.2014 & df.data$localminute <= end.winter.1.2015 | df.data$localminute >= start.winter.1.2015 & df.data$localminute <= end.winter.1.2016 | df.data$localminute >= start.winter.1.2016]) N.winter.1 <- length(df.winter.1.data$gen_scaled_minus_use)

Page 101: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

100

fft.winter.1 <- fft(df.winter.1.data$gen_scaled_minus_use)/N.winter.1 freq.winter.1 <- seq(from = 0, to = 1-(1/N.winter.1), by = 1/N.winter.1)

#Put frequencies, DFT coefficients and absolute values of DFT coefficients #into a dataframe # data in the 'frequencies' column is given in 1/min, data in the 'freq_hz' column is given in 1/sec=Hz df.DFT.winter.1 <- data.frame(frequencies = freq.winter.1, freq_hz = freq.winter.1/60, DFT = fft.winter.1, abs_DFT = abs(fft.winter.1)) #Only the first half of the frequencies are meaningful as the input data #consists of real values. df.DFT.winter.1 <- df.DFT.winter.1[1:(N.winter.1/2 + 1), ] #add columns that reflect the periods corresponding the frequencies #period = 1/frequency df.DFT.winter.1$period_in_min <- 1/df.DFT.winter.1$frequencies df.DFT.winter.1$period_in_hours <- df.DFT.winter.1$period_in_min/60 df.DFT.winter.1$period_in_days <- df.DFT.winter.1$period_in_hours/24 df.DFT.winter.1$period_in_years <- df.DFT.winter.1$period_in_days/365.25 #plot absolute values of the DFT coefficients against frequencies #to get an overview of the spectrum qplot(df.DFT.winter.1$freq_hz, df.DFT.winter.1$abs_DFT, main = "DFT: winter before DST change", xlab = "Frequency in Hz", ylab = "Absolute values DFT") + scale_x_log10(labels = function(n){format(n, scientific = FALSE)})

Page 102: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

101

#Create a filter to single out daily periodicity #include base frequency and eight harmonics filter.daily.component.winter.1 <- filter.fcn(data.points = 60*24, nr.coeff = 9, ts.length = N.winter.1) #also include zero frequency DFT filter.daily.component.winter.1[1] <- 1 #Find daily periodicity df.winter.1.data$daily_component <- Re(fft(fft.winter.1 * filter.daily.component.winter.1, inverse = TRUE)) #plot daily periodicity winter.1.2013.week1 <- as.POSIXct(strptime("2013-12-29 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) qplot(df.winter.1.data$localminute[df.winter.1.data$localminute >= start.winter.1.2013 & df.winter.1.data$localminute <= winter.1.2013.week1], df.winter.1.data$daily_component[df.winter.1.data$localminute >= start.winter.1.2013 & df.winter.1.data$localminute <= winter.1.2013.week1], main = "Daily periodicity: winter before DST change", xlab = "Time", ylab = "Av. real power over 1min intervals in kW\nGeneration - Consumption", geom = "line") + geom_hline(yintercept = 0)

#positive and negative integral (kWh) winter.1.2013.day1.end <- as.POSIXct(strptime("2013-12-22 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) sum(df.winter.1.data$daily_component[df.winter.1.data$localminute >= start.winter.1.2013 & df.winter.1.data$localminute <= winter.1.2013.day1.end & df.winter.1.data$daily_component < 0])/60

## [1] -761.3613

Page 103: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

102

sum(df.winter.1.data$daily_component[df.winter.1.data$localminute >= start.winter.1.2013 & df.winter.1.data$localminute <= winter.1.2013.day1.end & df.winter.1.data$daily_component > 0])/60

## [1] 736.6389

#------------------------------------------------------------------------------------------------------------------------------------#Winter data - after DST change #------------------------------------------------------------------------------------------------------------------------------------

#Begin winter: December 22 #Begin spring: March 20 #2013 March 10th, 02:00 #2014 March 9th, 02:00 #2015 March 8th, 02:00 #2016 March 13th, 02:00 start.winter.2.2013 <- as.POSIXct(strptime("2013-03-11 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.winter.2.2013 <- as.POSIXct(strptime("2013-03-19 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) start.winter.2.2014 <- as.POSIXct(strptime("2014-03-10 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.winter.2.2014 <- as.POSIXct(strptime("2014-03-19 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) start.winter.2.2015 <- as.POSIXct(strptime("2015-03-09 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.winter.2.2015 <- as.POSIXct(strptime("2015-03-19 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) start.winter.2.2016 <- as.POSIXct(strptime("2016-03-14 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) end.winter.2.2016 <- as.POSIXct(strptime("2016-03-19 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central"))

df.winter.2.data <- data.frame(localminute = df.data$localminute[df.data$localminute >= start.winter.2.2013 & df.data$localminute <= end.winter.2.2013 | df.data$localminute >= start.winter.2.2014 & df.data$localminute <= end.winter.2.2014 | df.data$localminute >= start.winter.2.2015 & df.data$localminute <= end.winter.2.2015 | df.data$localminute >= start.winter.2.2016 & df.data$localminute <= end.winter.2.2016], gen_scaled_minus_use = df.data$remainder[df.data$localminute >= start.winter.2.2013 & df.data$localminute <= end.winter.2.2013 | df.data$localminute >= start.winter.2.2014 & df.data$localminute <= end.winter.2.2014 | df.data$localminute >= start.winter.2.2015 & df.data$localminute <= end.winter.2.2015 | df.data$localminute >= start.winter.2.2016 & df.data$localminute <= end.winter.2.2016]) N.winter.2 <- length(df.winter.2.data$gen_scaled_minus_use)

Page 104: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

103

fft.winter.2 <- fft(df.winter.2.data$gen_scaled_minus_use)/N.winter.2 freq.winter.2 <- seq(from = 0, to = 1-(1/N.winter.2), by = 1/N.winter.2) #Put frequencies, DFT coefficients and absolute values of DFT coefficients #into a dataframe # data in the 'frequencies' column is given in 1/min, data in the 'freq_hz' column is given in 1/sec=Hz df.DFT.winter.2 <- data.frame(frequencies = freq.winter.2, freq_hz = freq.winter.2/60, DFT = fft.winter.2, abs_DFT = abs(fft.winter.2)) #Only the first half of the frequencies are meaningful as the input data #consists of real values. df.DFT.winter.2 <- df.DFT.winter.2[1:(N.winter.2/2 + 1), ] #add columns that reflect the periods corresponding the frequencies #period = 1/frequency df.DFT.winter.2$period_in_min <- 1/df.DFT.winter.2$frequencies df.DFT.winter.2$period_in_hours <- df.DFT.winter.2$period_in_min/60 df.DFT.winter.2$period_in_days <- df.DFT.winter.2$period_in_hours/24 df.DFT.winter.2$period_in_years <- df.DFT.winter.2$period_in_days/365.25 plot absolute values of the DFT coefficients against frequencies #to get an overview of the spectrum qplot(df.DFT.winter.2$freq_hz, df.DFT.winter.2$abs_DFT, main = "DFT: winter after DST change", xlab = "Frequency in Hz", ylab = "Absolute values DFT") + scale_x_log10(labels = function(n){format(n, scientific = FALSE)})

Page 105: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

104

#Create a filter to single out daily periodicity #include base frequency and four harmonics filter.daily.component.winter.2 <- filter.fcn(data.points = 60*24, nr.coeff = 5, ts.length = N.winter.2) #also include zero frequency DFT filter.daily.component.winter.2[1] <- 1 #Find daily periodicity df.winter.2.data$daily_component <- Re(fft(fft.winter.2 * filter.daily.component.winter.2, inverse = TRUE))

#plot daily periodicity winter.2.2013.week1 <- as.POSIXct(strptime("2013-03-18 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central"))

qplot(df.winter.2.data$localminute[df.winter.2.data$localminute >= start.winter.2.2013 & df.winter.2.data$localminute <= winter.2.2013.week1], df.winter.2.data$daily_component[df.winter.2.data$localminute >= start.winter.2.2013 & df.winter.2.data$localminute <= winter.2.2013.week1], main = "Daily periodicity: winter after DST change", xlab = "Time", ylab = "Av. real power over 1min intervals in kW\nGeneration - Consumption", geom = "line") + geom_hline(yintercept = 0)

Page 106: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

105

#positive and negative integral (kWh) winter.2.2013.day1.end <- as.POSIXct(strptime("2013-03-11 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) sum(df.winter.2.data$daily_component[df.winter.2.data$localminute >= start.winter.2.2013 & df.winter.2.data$localminute <= winter.2.2013.day1.end & df.winter.2.data$daily_component < 0])/60

## [1] -812.3334

sum(df.winter.2.data$daily_component[df.winter.2.data$localminute >= start.winter.2.2013 & df.winter.2.data$localminute <= winter.2.2013.day1.end & df.winter.2.data$daily_component > 0])/60

## [1] 967.579

#------------------------------------------------------------------------------------------------------------------------------------#Putting the daily periodicities of the different seasons together #------------------------------------------------------------------------------------------------------------------------------------

df.data$daily_component <- NA #spring data df.data$daily_component[df.data$localminute >= start.spring.2013 & df.data$localminute <= end.spring.2013 | df.data$localminute >= start.spring.2014 & df.data$localminute <= end.spring.2014 | df.data$localminute >= start.spring.2015 & df.data$localminute <= end.spring.2015 | df.data$localminute >= start.spring.2016 & df.data$localminute <= end.spring.2016] <- df.spring.data$daily_component #summer data df.data$daily_component[df.data$localminute >= start.summer.2013 & df.data$localminute <= end.summer.2013 | df.data$localminute >= start.summer.2014 & df.data$localminute <= end.summer.2014 | df.data$localminute >= start.summer.2015 & df.data$localminute <= end.summer.2015 | df.data$localminute >= start.summer.2016 & df.data$localminute <= end.summer.2016] <- df.summer.data$daily_component #fall data df.data$daily_component[df.data$localminute >= start.fall.1.2013 & df.data$localminute <= end.fall.1.2013 | df.data$localminute >= start.fall.1.2014 & df.data$localminute <= end.fall.1.2014 | df.data$localminute >= start.fall.1.2015 & df.data$localminute <= end.fall.1.2015 | df.data$localminute >= start.fall.1.2016 & df.data$localminute <= end.fall.1.2016] <- df.fall.1.data$daily_component

Page 107: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

106

df.data$daily_component[df.data$localminute >= start.fall.2.2013 & df.data$localminute <= end.fall.2.2013 | df.data$localminute >= start.fall.2.2014 & df.data$localminute <= end.fall.2.2014 | df.data$localminute >= start.fall.2.2015 & df.data$localminute <= end.fall.2.2015 | df.data$localminute >= start.fall.2.2016 & df.data$localminute <= end.fall.2.2016] <- df.fall.2.data$daily_component #winter data df.data$daily_component[df.data$localminute <= end.winter.1.2013 | df.data$localminute >= start.winter.1.2013 & df.data$localminute <= end.winter.1.2014 | df.data$localminute >= start.winter.1.2014 & df.data$localminute <= end.winter.1.2015 | df.data$localminute >= start.winter.1.2015 & df.data$localminute <= end.winter.1.2016 | df.data$localminute >= start.winter.1.2016] <- df.winter.1.data$daily_component df.data$daily_component[df.data$localminute >= start.winter.2.2013 & df.data$localminute <= end.winter.2.2013 | df.data$localminute >= start.winter.2.2014 & df.data$localminute <= end.winter.2.2014 | df.data$localminute >= start.winter.2.2015 & df.data$localminute <= end.winter.2.2015 | df.data$localminute >= start.winter.2.2016 & df.data$localminute <= end.winter.2.2016] <- df.winter.2.data$daily_component

#-> eight days are missing, those that contain the DST changes length(df.data$daily_component[is.na(df.data$daily_component)])/60/24

## [1] 8

#Days of DST change: #2013: March 10th, 02:00; November 3rd, 02:00 #2014: March 9th, 02:00; November 2ndr, 02:00 #2015: March 8th, 02:00; November 1st, 02:00 #2016: March 13th, 02:00; November 6th, 02:00 #In March, the clock is set one hour forward -> time stamps from 2am to 2.59 am are missing #For March DST change: Assign every minute the average of the daily component #of the day before and after, omit the missing hour for averaging

Page 108: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

107

#Create a function to calculate the values for the day of the march DST change: #l1 be the start of the day before, l2 be the last time stamp before the missing hour, #l3 be the first time stamp after the missing hour, l4 be the end of the day before #analogously u1 to u4 correspond to time stamps of the day after the DST change assign.march.DST.day <- function(l1, l2, l3, l4, u1, u2, u3, u4){ ((df.data$daily_component[df.data$localminute >= l1 & df.data$localminute <= l2 | df.data$localminute >= l3 & df.data$localminute <= l4]) + (df.data$daily_component[df.data$localminute >= u1 & df.data$localminute <= u2 | df.data$localminute >= u3 & df.data$localminute <= u4]))/2 } #2013 #relevant dates in 2013 mar.9.2013 <- as.POSIXct(strptime("2013-03-09 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) mar.9.1_59am.2013 <- as.POSIXct(strptime("2013-03-09 01:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) mar.9.3am.2013 <- as.POSIXct(strptime("2013-03-09 03:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) mar.9.end.2013 <- as.POSIXct(strptime("2013-03-09 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) mar.11.2013 <- as.POSIXct(strptime("2013-03-11 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) mar.11.1_59am.2013 <- as.POSIXct(strptime("2013-03-11 01:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) mar.11.3am.2013 <- as.POSIXct(strptime("2013-03-11 03:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) mar.11.end.2013 <- as.POSIXct(strptime("2013-03-11 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) #Calculate values for March 10th, 2013 march.DST.day <- assign.march.DST.day(mar.9.2013, mar.9.1_59am.2013, mar.9.3am.2013, mar.9.end.2013, mar.11.2013, mar.11.1_59am.2013, mar.11.3am.2013, mar.11.end.2013)

Page 109: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

108

#plot qplot(df.data$localminute[df.data$localminute > mar.9.end.2013 & df.data$localminute < mar.11.2013], march.DST.day, main = "Daily periodicity", xlab = "Time", ylab = "Av. real power over 1min intervals in kW\nGeneration - Consumption", geom = "line")

#Assign values to df.data$daily_component df.data$daily_component[df.data$localminute > mar.9.end.2013 & df.data$localminute < mar.11.2013] <- march.DST.day #Values are the same for all DST change days in March #-> assign these values to the other DST change days in March as well #2014 #2014 DST change: 9. März mar.8.end.2014 <- as.POSIXct(strptime("2014-03-08 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) mar.10.2014 <- as.POSIXct(strptime("2014-03-10 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) df.data$daily_component[df.data$localminute > mar.8.end.2014 & df.data$localminute < mar.10.2014] <- march.DST.day #2015

Page 110: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

109

#2015 DST change: 8. März mar.7.end.2015 <- as.POSIXct(strptime("2015-03-07 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) mar.9.2015 <- as.POSIXct(strptime("2015-03-09 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) df.data$daily_component[df.data$localminute > mar.7.end.2015 & df.data$localminute < mar.9.2015] <- march.DST.day #2016 #2016 DST change: 13. März mar.12.end.2016 <- as.POSIXct(strptime("2016-03-12 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) mar.14.2016 <- as.POSIXct(strptime("2016-03-14 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) df.data$daily_component[df.data$localminute > mar.12.end.2016 & df.data$localminute < mar.14.2016] <- march.DST.day #In November, the clock is set one hour backward -> time stamps from 1am to 1.59am exist twice #For November DST change: Assign every minute the average of the daily component of the day before and after, #assign every minute in the extra hour the average value of the minutes in the hour before and after

#Create a function to calculate the values for the day of the november DST change: #l1 be the start of the day before, l2 be the time stamp one hour prior to the extra hour, #l3 be the time stamp just before the extra hour, l4 be the time stamp just after the extra hour, #l5 be the time stamp one hour after the extra hour, l6 be the end of the day before #analogously u1 to u6 correspond to time stamps of the day after the DST change assign.nov.DST.day <- function(l1, l2, l3, l4, l5, l6, u1, u2, u3, u4, u5, u6){ c((df.data$daily_component[df.data$localminute >= l1 & df.data$localminute <= l3] + df.data$daily_component[df.data$localminute >= u1 & df.data$localminute <= u3])/2, (df.data$daily_component[df.data$localminute >= l2 & df.data$localminute <= l3] + df.data$daily_component[df.data$localminute >= l4 & df.data$localminute <= l5] + df.data$daily_component[df.data$localminute >= u2 & df.data$localminute <= u3] + df.data$daily_component[df.data$localminute >= u4 & df.data$localminute <= u5])/4, (df.data$daily_component[df.data$localminute >= l4 & df.data$localminute <= l6] + df.data$daily_component[df.data$localminute >= u4 & df.data$localminute <= u6])/2) } #relevant dates in 2013 #2013 DST change: November 3rd nov.2.2013 <- as.POSIXct(strptime("2013-11-02 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) nov.2.1am.2013 <- as.POSIXct(strptime("2013-11-02 01:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) nov.2.1_59am.2013 <- as.POSIXct(strptime("2013-11-02 01:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central"))

Page 111: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

110

nov.2.2am.2013 <- as.POSIXct(strptime("2013-11-02 02:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) nov.2.2_59am.2013 <- as.POSIXct(strptime("2013-11-02 02:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) nov.2.end.2013 <- as.POSIXct(strptime("2013-11-02 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) nov.4.2013 <- as.POSIXct(strptime("2013-11-04 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) nov.4.1am.2013 <- as.POSIXct(strptime("2013-11-04 01:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) nov.4.1_59am.2013 <- as.POSIXct(strptime("2013-11-04 01:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) nov.4.2am.2013 <- as.POSIXct(strptime("2013-11-04 02:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) nov.4.2_59am.2013 <- as.POSIXct(strptime("2013-11-04 02:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) nov.4.end.2013 <- as.POSIXct(strptime("2013-11-04 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) #Calculate values for November 3rd, 2013 nov.DST.day <- assign.nov.DST.day(nov.2.2013, nov.2.1am.2013, nov.2.1_59am.2013, nov.2.2am.2013, nov.2.2_59am.2013, nov.2.end.2013, nov.4.2013, nov.4.1am.2013, nov.4.1_59am.2013, nov.4.2am.2013, nov.4.2_59am.2013, nov.4.end.2013) #plot qplot(df.data$localminute[df.data$localminute > nov.2.end.2013 & df.data$localminute < nov.4.2013], nov.DST.day, main = "Daily periodicity", xlab = "Time", ylab = "Av. real power over 1min intervals in kW\nGeneration - Consumption", geom = "line")

Page 112: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

111

#Assign values to df.data$daily_component df.data$daily_component[df.data$localminute > nov.2.end.2013 & df.data$localminute < nov.4.2013] <- nov.DST.day #Values are the same for all DST change days in November #-> assign these values to the other DST change days in november as well #2014 #2014 DST change: November 2nd nov.1.end.2014 <- as.POSIXct(strptime("2014-11-01 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) nov.3.2014 <- as.POSIXct(strptime("2014-11-03 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) df.data$daily_component[df.data$localminute > nov.1.end.2014 & df.data$localminute < nov.3.2014] <- nov.DST.day

#2015 #2015 DST change: November 1st oct.31.end.2015 <- as.POSIXct(strptime("2015-10-31 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) nov.2.2015 <- as.POSIXct(strptime("2015-11-02 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) df.data$daily_component[df.data$localminute > oct.31.end.2015 & df.data$localminute < nov.2.2015] <- nov.DST.day #2016 #2016 DST change: November 6th nov.5.end.2016 <- as.POSIXct(strptime("2016-11-05 23:59:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) nov.7.2016 <- as.POSIXct(strptime("2016-11-07 00:00:00", "%Y-%m-%d %H:%M:%S", tz = "US/Central")) df.data$daily_component[df.data$localminute > nov.5.end.2016 & df.data$localminute < nov.7.2016] <- nov.DST.day

Page 113: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

112

#------------------------------------------------------------------------------------------------------------------------------------#Find the rest after eliminating trend, yearly and daily periodicities #------------------------------------------------------------------------------------------------------------------------------------

intermittent <- df.data$remainder - df.data$daily_component #plot qplot(df.data$localminute, intermittent, main = "Non-periodic part of balance power", xlab = "Time", ylab = "Av. real power over 1min intervals in kW\nGeneration - Consumption", geom = "line")

qplot(df.data$localminute[1:(7*1440)], intermittent[1:(7*1440)], main = "Non-periodic part of balance power", xlab = "Time", ylab = "Av. real power over 1min intervals in kW\nGeneration - Consumption", geom = "line")

Page 114: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

113

#------------------------------------------------------------------------------------------------------------------------------------#Find suitable energy storage #------------------------------------------------------------------------------------------------------------------------------------

#first estimate suitable storage for daily periodicity: #required power rating: max(abs(df.data$gen_scaled_minus_use)) #332.9994 kW

## [1] 332.9994

#first estimate of required energy capacity: ener.cap.d <- sum(df.data$gen_scaled_minus_use[df.data$gen_scaled_minus_use > 0]) / 60 / (N/1440) #--> suitable storage could be lead-acid batteries # --> daily self-discharge: ~0.3% # --> cycle efficiency: ~70% #daily self-discharge: selfdischarge.d <- 0.003 #what remains after a minute of self-discharge: remain.after.selfdischarge.d <- (1 - selfdischarge.d)^(1/(60*24)) #cycle efficiency: cycle.eff.d <- 0.7 #assumption: charge efficiency = discharge efficiency: sqrt.cycle.eff.d <- sqrt(cycle.eff.d) 100/cycle.eff.d/(1 - selfdischarge.d)

## [1] 143.287

#--> 44% more energy must be generated than will be consumed per charge-discharge cycle #Create a vector to hold the state of charge of the EES component for daily periodicity #at the end of every one-minute time interval charge.d <- rep(NA, length(df.data$gen_scaled_minus_use)) #Create a vector to hold the residual energy surplus/deficit #in every one-minute time interval after implementing EES residual.balance.energy <- rep(NA, length(df.data$gen_scaled_minus_use))

Page 115: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

114

#How much must energy generation be scaled up to accommodate loss through storage?

#set reasonable boundaries: #not scaling up lower.bound <- 1 #doubling production capacity upper.bound <- 2 while(TRUE){ #create a vector of scaled up generation data scalingfactor <- (lower.bound + upper.bound) / 2 gen_scaled2 <- df.data$gen_scaled * scalingfactor #Create a vector that holds the energy surplus/deficit #in every one-minute time interval balance.energy <- (gen_scaled2 - df.data$use) / 60 #recalculate required energy capacity ener.cap.d <- sum(balance.energy[balance.energy > 0]) / (N/1440) * sqrt.cycle.eff.d

#assumed charge level before t1 is 0 #Determine charge level at t1 and how much residual energy surplus/deficit there is if(balance.energy[1] > 0){ charge.d[1] <- balance.energy[1] * sqrt.cycle.eff.d residual.balance.energy[1] <- 0 }else { charge.d[1] <- 0 residual.balance.energy[1] <- balance.energy[1] } #Determine the charge level of the EES #and how much energy remains as a surplus/deficit in every one-minute interval #over the course of the four years for(i in 2:N){ current.balance <- balance.energy[i] current.charge.d <- charge.d[i - 1] * remain.after.selfdischarge.d charge.d[i] <- current.charge.d + ifelse(current.balance > 0, current.balance * sqrt.cycle.eff.d, current.balance / sqrt.cycle.eff.d) overcharge.EES.d <- charge.d[i] - ener.cap.d if(overcharge.EES.d > 0){ charge.d[i] <- ener.cap.d residual.balance.energy[i] <- overcharge.EES.d / sqrt.cycle.eff.d }else if(charge.d[i] < 0){ residual.balance.energy[i] <- charge.d[i] * sqrt.cycle.eff.d

Page 116: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

115

charge.d[i] <- 0 }else{ residual.balance.energy[i] <- 0 } } if(sum(residual.balance.energy) > 0){ upper.bound <- scalingfactor } else { lower.bound <- scalingfactor } #residual balance energy should sum up to close to zero so that another #balancing mechnism (an EES with another suitable storage duration) #can be assigned if(sum(residual.balance.energy) > 0 && sum(residual.balance.energy) < 1){ break } }

scalingfactor

## [1] 1.1589

sum(residual.balance.energy)

## [1] 0.305146

#required energy capacity (in kWh): ener.cap.d

## [1] 864.8737

#required power capacity (in kW): max(abs(balance.energy * 60))

## [1] 390.6145

#On average, how much energy (in kWh) is produced per year and household #before scaling up generation capacity to accomdodate energy loss? sum(df.data$gen_scaled)/60/50/4

## [1] 10253.23

#On average, how much energy (in kWh) is produced per year and household #after scaling up generation capacity to accomdodate energy loss? sum(gen_scaled2)/60/50/4

## [1] 11882.47

Page 117: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

116

#On average, per year, how much energy (in kWh) cannot be provided when needed #after using EES for daily periodicity? abs(sum(residual.balance.energy[residual.balance.energy < 0])) / 4

## [1] 107384.4

#(reduced from 302334.5 kWh) #What percentage of energy demand cannot be met at the right time #by the solar PV system and EES combined? abs(sum(residual.balance.energy[residual.balance.energy < 0])) / (sum(df.data$use) / 60)

## [1] 0.2094645

#plot charge state of the EES over one week qplot(df.data$localminute[(7*1440):(14*1440)], charge.d[(7*1440):(14*1440)], main = "Charge state EES", xlab = "Time", ylab = "Charge state in kWh", geom = "line")

Page 118: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

117

df.data$residual <- residual.balance.energy * 60 #plot residual balance power over all four years qplot(df.data$localminute, df.data$residual, main = "Residual balance power", xlab = "Time", ylab = "Av. real power over 1min intervals in kW", geom = "line")

#------------------------------------------------------------------------------------------------------------------------------------#Examination of residual data in the frequency domain to find remaining patterns #------------------------------------------------------------------------------------------------------------------------------------

#Compute the DFT of the residual data, using the FFT algorithm. #Divide by input number to scale down, so that absolute values of DFT coefficients #are equal to the amplitudes of the corresponding sinusoids. residual.FFT <- fft(df.data$residual)/N #Put frequencies, DFT coefficients and absolute values of DFT coefficients #into a dataframe # data in the 'frequencies' column is given in 1/min, data in the 'freq_hz' column is given in 1/sec=Hz df.DFT.residual <- data.frame(frequencies = freq, freq_hz = freq/60, DFT = residual.FFT, abs_DFT = abs(residual.FFT)) #Only the first half of the frequencies are meaningful as the input data #consists of real values. df.DFT.residual <- df.DFT.residual[1:(N / 2 + 1), ]

Page 119: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

118

#add columns that reflect the periods corresponding to the frequencies #period = 1/frequency df.DFT.residual$period_in_min <- 1/df.DFT.residual$frequencies df.DFT.residual$period_in_hours <- df.DFT.residual$period_in_min/60 df.DFT.residual$period_in_days <- df.DFT.residual$period_in_hours/24 df.DFT.residual$period_in_years <- df.DFT.residual$period_in_days/365.25 #plot absolute values of the DFT coefficients against frequencies #to get an overview of the spectrum qplot(df.DFT.residual$freq_hz, df.DFT.residual$abs_DFT, main = "DFT: Residual balance power", xlab = "Frequency in Hz", ylab = "Absolute values DFT") + scale_x_log10(labels=function(n){format(n, scientific = FALSE)})

#------------------------------------------------------------------------------------------------------------------------------------#Find the long-term trend in the residual data #------------------------------------------------------------------------------------------------------------------------------------

#Create a filter to only single out DFT coefficients that correspond to a period > 1 year filter.long.term.residual <- rep(0, length(df.DFT.residual$DFT)) filter.long.term.residual[2:(length(df.DFT.residual$period_in_years[df.DFT.residual$period_in_years > 1]))] <- 1 filter.long.term.residual <- c(filter.long.term.residual, rev(filter.long.term.residual[2:(length(filter.long.term.residual) - 1)])) trend.residual <- Re(fft(residual.FFT * filter.long.term.residual, inverse = TRUE))

Page 120: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

119

#plot trend qplot(df.data$localminute, trend.residual, main = "Balance power: long-term trend", xlab = "Time", ylab = "Av. real power over 1min intervals in kW\nGeneration - Consumption", geom = "line")

#------------------------------------------------------------------------------------------------------------------------------------#Find the yearly periodicity in the residual data #------------------------------------------------------------------------------------------------------------------------------------

#Create a filter to single out yearly periodicity filter.yearly.component.residual <- filter.fcn(data.points = 60*24*365.25, nr.coeff = 4, ts.length = N) #also include zero frequency DFT filter.yearly.component.residual[1] <- 1 #Find yearly periodicity yearly.component.residual <- Re(fft(residual.FFT * filter.yearly.component.residual, inverse = TRUE))

Page 121: Master thesis · 2018. 8. 2. · Master thesis Understanding the temporal mismatch between energy demand and energy supply from renewable sources By Julia Dahm Student number: 460607

120

#plot yearly periodicity qplot(df.data$localminute, yearly.component.residual, main = "Balance power: yearly periodicity", xlab = "Time", ylab = "Av. real power over 1min intervals in kW\nGeneration - Consumption", geom = "line")