-
Notifications
You must be signed in to change notification settings - Fork 0
/
heatPumpProfileAnalysis.html
9528 lines (7353 loc) · 455 KB
/
heatPumpProfileAnalysis.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="pandoc" />
<meta name="author" content="Carsten Dortans (xxx@otago.ac.nz)" />
<title>Technical Potential of Demand Response</title>
<script src="heatPumpProfileAnalysis_files/jquery-1.11.3/jquery.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="heatPumpProfileAnalysis_files/bootstrap-3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<script src="heatPumpProfileAnalysis_files/bootstrap-3.3.5/js/bootstrap.min.js"></script>
<script src="heatPumpProfileAnalysis_files/bootstrap-3.3.5/shim/html5shiv.min.js"></script>
<script src="heatPumpProfileAnalysis_files/bootstrap-3.3.5/shim/respond.min.js"></script>
<script src="heatPumpProfileAnalysis_files/jqueryui-1.11.4/jquery-ui.min.js"></script>
<link href="heatPumpProfileAnalysis_files/tocify-1.9.1/jquery.tocify.css" rel="stylesheet" />
<script src="heatPumpProfileAnalysis_files/tocify-1.9.1/jquery.tocify.js"></script>
<script src="heatPumpProfileAnalysis_files/navigation-1.1/tabsets.js"></script>
<link href="heatPumpProfileAnalysis_files/highlightjs-9.12.0/default.css" rel="stylesheet" />
<script src="heatPumpProfileAnalysis_files/highlightjs-9.12.0/highlight.js"></script>
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
pre:not([class]) {
background-color: white;
}
</style>
<script type="text/javascript">
if (window.hljs) {
hljs.configure({languages: []});
hljs.initHighlightingOnLoad();
if (document.readyState && document.readyState === "complete") {
window.setTimeout(function() { hljs.initHighlighting(); }, 0);
}
}
</script>
<style type="text/css">
h1 {
font-size: 34px;
}
h1.title {
font-size: 38px;
}
h2 {
font-size: 30px;
}
h3 {
font-size: 24px;
}
h4 {
font-size: 18px;
}
h5 {
font-size: 16px;
}
h6 {
font-size: 12px;
}
.table th:not([align]) {
text-align: left;
}
</style>
</head>
<body>
<style type = "text/css">
.main-container {
max-width: 940px;
margin-left: auto;
margin-right: auto;
}
code {
color: inherit;
background-color: rgba(0, 0, 0, 0.04);
}
img {
max-width:100%;
height: auto;
}
.tabbed-pane {
padding-top: 12px;
}
.html-widget {
margin-bottom: 20px;
}
button.code-folding-btn:focus {
outline: none;
}
</style>
<div class="container-fluid main-container">
<!-- tabsets -->
<script>
$(document).ready(function () {
window.buildTabsets("TOC");
});
</script>
<!-- code folding -->
<script>
$(document).ready(function () {
// move toc-ignore selectors from section div to header
$('div.section.toc-ignore')
.removeClass('toc-ignore')
.children('h1,h2,h3,h4,h5').addClass('toc-ignore');
// establish options
var options = {
selectors: "h1,h2",
theme: "bootstrap3",
context: '.toc-content',
hashGenerator: function (text) {
return text.replace(/[.\\/?&!#<>]/g, '').replace(/\s/g, '_').toLowerCase();
},
ignoreSelector: ".toc-ignore",
scrollTo: 0
};
options.showAndHide = true;
options.smoothScroll = true;
// tocify
var toc = $("#TOC").tocify(options).data("toc-tocify");
});
</script>
<style type="text/css">
#TOC {
margin: 25px 0px 20px 0px;
}
@media (max-width: 768px) {
#TOC {
position: relative;
width: 100%;
}
}
.toc-content {
padding-left: 30px;
padding-right: 40px;
}
div.main-container {
max-width: 1200px;
}
div.tocify {
width: 20%;
max-width: 260px;
max-height: 85%;
}
@media (min-width: 768px) and (max-width: 991px) {
div.tocify {
width: 25%;
}
}
@media (max-width: 767px) {
div.tocify {
width: 100%;
max-width: none;
}
}
.tocify ul, .tocify li {
line-height: 20px;
}
.tocify-subheader .tocify-item {
font-size: 0.90em;
padding-left: 25px;
text-indent: 0;
}
.tocify .list-group-item {
border-radius: 0px;
}
</style>
<!-- setup 3col/9col grid for toc_float and main content -->
<div class="row-fluid">
<div class="col-xs-12 col-sm-4 col-md-3">
<div id="TOC" class="tocify">
</div>
</div>
<div class="toc-content col-xs-12 col-sm-8 col-md-9">
<div class="fluid-row" id="header">
<h1 class="title toc-ignore">Technical Potential of Demand Response</h1>
<h3 class="subtitle"><em>Heat Pump Analysis</em></h3>
<h4 class="author"><em>Carsten Dortans (<a href="mailto:xxx@otago.ac.nz">xxx@otago.ac.nz</a>)</em></h4>
<h4 class="date"><em>Last run at: 2018-09-28 15:34:55</em></h4>
</div>
<div id="citation" class="section level1">
<h1><span class="header-section-number">1</span> Citation</h1>
<p>If you wish to use any of the material from this report please cite as:</p>
<ul>
<li>Dortans, C. (2018) Technical Potential of Demand Response: Heat Pump Analysis, <a href="http://www.otago.ac.nz/centre-sustainability/">Centre for Sustainability</a>, University of Otago: Dunedin, New Zealand.</li>
</ul>
<p>This work is (c) 2018 the University of Southampton.</p>
</div>
<div id="about" class="section level1">
<h1><span class="header-section-number">2</span> About</h1>
<div id="circulation" class="section level2">
<h2><span class="header-section-number">2.1</span> Circulation</h2>
<p>Report circulation:</p>
<ul>
<li>Restricted to: <a href="https://www.otago.ac.nz/centre-sustainability/research/energy/otago050285.html">NZ GREEN Grid</a> project partners and contractors.</li>
</ul>
</div>
<div id="purpose" class="section level2">
<h2><span class="header-section-number">2.2</span> Purpose</h2>
<p>This report is intended to:</p>
<ul>
<li>load and test GREEN Grid heat pump and hot water profiles.</li>
</ul>
</div>
<div id="requirements" class="section level2">
<h2><span class="header-section-number">2.3</span> Requirements:</h2>
<ul>
<li>test dataset stored at /Volumes/hum-csafe/Research Projects/GREEN Grid/cleanData/safe/gridSpy/1min/dataExtracts/</li>
</ul>
</div>
<div id="history" class="section level2">
<h2><span class="header-section-number">2.4</span> History</h2>
<p>Generally tracked via our git.soton <a href="https://git.soton.ac.uk/ba1e12/nzGREENGrid">repo</a>:</p>
<ul>
<li><a href="https://git.soton.ac.uk/ba1e12/nzGREENGrid/commits/master">history</a></li>
<li><a href="https://git.soton.ac.uk/ba1e12/nzGREENGrid/issues">issues</a></li>
</ul>
<p>Specific history of this code:</p>
<ul>
<li><a href="https://github.com/CfSOtago/GREENGrid/commits/master/analysis/demandResponse/" class="uri">https://github.com/CfSOtago/GREENGrid/commits/master/analysis/demandResponse/</a></li>
</ul>
</div>
<div id="support" class="section level2">
<h2><span class="header-section-number">2.5</span> Support</h2>
<p>This work was supported by:</p>
<ul>
<li>The <a href="https://www.otago.ac.nz/">University of Otago</a>;</li>
<li>The <a href="https://www.southampton.ac.uk/">University of Southampton</a>;</li>
<li>The New Zealand <a href="http://www.mbie.govt.nz/">Ministry of Business, Innovation and Employment (MBIE)</a> through the <a href="https://www.otago.ac.nz/centre-sustainability/research/energy/otago050285.html">NZ GREEN Grid</a> project;</li>
<li><a href="http://www.energy.soton.ac.uk/tag/spatialec/">SPATIALEC</a> - a <a href="http://ec.europa.eu/research/mariecurieactions/about-msca/actions/if/index_en.htm">Marie Skłodowska-Curie Global Fellowship</a> based at the University of Otago’s <a href="http://www.otago.ac.nz/centre-sustainability/staff/otago673896.html">Centre for Sustainability</a> (2017-2019) & the University of Southampton’s Sustainable Energy Research Group (2019-2020).</li>
</ul>
<p>We do not ‘support’ the code but if you notice a problem please check the <a href="https://github.com/CfSOtago/GREENGrid/issues">issues</a> on our <a href="https://github.com/CfSOtago/GREENGrid">repo</a> and if it doesn’t already exist, please open a new one.</p>
</div>
</div>
<div id="load-data-files" class="section level1">
<h1><span class="header-section-number">3</span> Load data files</h1>
<div id="heat-pump-profiles" class="section level2">
<h2><span class="header-section-number">3.1</span> Heat pump profiles</h2>
<p>This file is the pre-aggregated data for all heat pump circuits in the GREEN Grid data for April 2015 - March 2016 (check!)</p>
<pre class="r"><code>#ggParams$profilesFile <- paste0(ggParams$dataLoc, "Heat #Pump_2015-04-01_2016-03-31_observations.csv.gz")</code></pre>
<p>In this section we load and describe the data files from .</p>
<pre class="r"><code>#print(paste0("Trying to load: ", ggParams$profilesFile))
heatPumpProfileDT1 <- data.table::as.data.table(
readr::read_csv("/Volumes/hum-csafe/Research Projects/GREEN Grid/cleanData/safe/gridSpy/1min/dataExtracts/Heat Pump_2015-04-01_2016-03-31_observations.csv.gz",
col_types = cols(
hhID = col_character(),
linkID = col_character(),
r_dateTime = col_datetime(format = ""),
circuit = col_character(),
powerW = col_double() # <- crucial otherwise readr infers integers for some reason
)
)
)
#heatPumpProfileDT1 <- #data.table::as.data.table(readr::read_csv(ggParams$profilesFile))
heatPumpProfileDT <- heatPumpProfileDT1
heatPumpProfileDT <- heatPumpProfileDT[, year := lubridate::year(r_dateTime)]
heatPumpProfileDT <- heatPumpProfileDT[, obsHourMin := hms::as.hms(r_dateTime)]
heatPumpProfileDT <- heatPumpProfileDT[, month := lubridate::month(r_dateTime)]
heatPumpProfileDT <- heatPumpProfileDT[month == 12 | month == 1 | month == 2, season := "Summer"]
heatPumpProfileDT <- heatPumpProfileDT[month == 3 | month == 4 | month == 5, season := "Autumn"]
heatPumpProfileDT <- heatPumpProfileDT[month == 6 | month == 7 | month == 8, season := "Winter"]
heatPumpProfileDT <- heatPumpProfileDT[month == 9 | month == 10 | month == 11, season := "Spring"]
#Building daily average per season
#heatPumpProfileDT[ , 5][is.na(heatPumpProfileDT[ , 5] ) ] = 0
heatPumpProfileDT <- heatPumpProfileDT[, .(meanW = mean(powerW, na.rm = TRUE)), keyby = .(obsHourMin, season)]</code></pre>
<p>Describe using skim:</p>
<pre class="r"><code>skimr::skim(heatPumpProfileDT)</code></pre>
<pre><code>## Skim summary statistics
## n obs: 5760
## n variables: 3
##
## ── Variable type:character ────────────────────────────────────────────────────────────────────────────────────────────
## variable missing complete n min max empty n_unique
## season 0 5760 5760 6 6 0 4
##
## ── Variable type:difftime ─────────────────────────────────────────────────────────────────────────────────────────────
## variable missing complete n min max median n_unique
## obsHourMin 0 5760 5760 0 secs 86340 secs 43170 secs 1440
##
## ── Variable type:numeric ──────────────────────────────────────────────────────────────────────────────────────────────
## variable missing complete n mean sd p0 p25 p50 p75
## meanW 0 5760 5760 143.53 117.47 34.99 69.26 104.83 174.66
## p100 hist
## 613.89 ▇▃▂▁▁▁▁▁</code></pre>
<p>Draw a plot of GreenGrid heat pump profiles.</p>
<pre class="r"><code>myPlot <- ggplot2::ggplot(heatPumpProfileDT, aes(x = obsHourMin, colour = season)) +
geom_point(aes(y = meanW)) +
facet_grid(season ~ .)
myPlot</code></pre>
<div class="figure"><span id="fig:profilePlot"></span>
<img src="heatPumpProfileAnalysis_files/figure-html/profilePlot-1.png" alt="Heat pump profiles" />
<p class="caption">
Figure 3.1: Heat pump profiles
</p>
</div>
</div>
</div>
<div id="scaling" class="section level1">
<h1><span class="header-section-number">4</span> Scaling</h1>
<div id="scaling-method-1" class="section level2">
<h2><span class="header-section-number">4.1</span> Scaling method 1</h2>
<p>Now draw a plot of what woud happen if we scaled this up to all NZ households?</p>
<p>Figure <a href="#fig:scaledUpPlots">4.1</a></p>
<pre class="r"><code>nzHH <- 1549890
heatPumpProfileDT <- heatPumpProfileDT[, scaledMWmethod1 := (meanW * nzHH)/10^6]
myPlot <- ggplot2::ggplot(heatPumpProfileDT, aes(x = obsHourMin, colour = season)) +
geom_point(aes(y = scaledMWmethod1)) +
facet_grid(season ~ .)
myPlot</code></pre>
<div class="figure"><span id="fig:scaledUpPlots"></span>
<img src="heatPumpProfileAnalysis_files/figure-html/scaledUpPlots-1.png" alt="Mean Load Heat Pumps by Season" />
<p class="caption">
Figure 4.1: Mean Load Heat Pumps by Season
</p>
</div>
</div>
<div id="scaling-method-2" class="section level2">
<h2><span class="header-section-number">4.2</span> Scaling method 2</h2>
<p>Alternative calculation method: Assuming EECA data is correct for heat pump value, 1) generating the percentage of total load (peroftotal) while telling data.table to create a new column with the calculation of the percentage. We then multiplied EECA’s total GWh with the percentage</p>
<pre class="r"><code>totalGWH<-708
summeanW<-heatPumpProfileDT[,sum(meanW)]
heatPumpProfileDT <- heatPumpProfileDT[, EECApmMethod2 := (meanW / summeanW) * totalGWH]
myPlot <- ggplot2::ggplot(heatPumpProfileDT, aes(x = obsHourMin, colour = season)) +
geom_point(aes(y = EECApmMethod2)) +
facet_grid(season ~ .) +
labs(x='Time of Day', y='GWh')
myPlot</code></pre>
<p><img src="heatPumpProfileAnalysis_files/figure-html/new%20calc-1.png" /><!-- --></p>
</div>
</div>
<div id="aggregation-to-half-hours" class="section level1">
<h1><span class="header-section-number">5</span> Aggregation to half-hours</h1>
<p>So far we have used data at the 1 minute level. This makes for difficulties in comparison with standared electricity sector half-hourly tariff periods etc. This section takes each scaling method, aggregates to half-hours as appropriate and re-plots.</p>
<p>To do that we need to set a half-hour value from the observed time. We do this using truncate so that:</p>
<ul>
<li>13:18:00 -> 13:00:00</li>
<li>13:40:00 -> 13:30 etc</li>
</ul>
<blockquote>
<p>NB: This means any plots will be using the 1/2 hour value at the <em>start</em> of the period!</p>
</blockquote>
<pre class="r"><code># create a 'half hour' variable for aggregation
heatPumpProfileDT <- heatPumpProfileDT[, obsHalfHour := hms::trunc_hms(obsHourMin, 1800)] # <- this truncates the time to the previous half hour (hms works in seconds so 30 mins * 60 secs = 1800 secs). e.g. 13:18:00 -> 13:00:00 but 13:40:00 -> 13:30 etc
# This means any plots will be using the 1/2 hour value at the -> start <- of the period!
# check
head(heatPumpProfileDT)</code></pre>
<pre><code>## obsHourMin season meanW scaledMWmethod1 EECApmMethod2 obsHalfHour
## 1: 00:00:00 Autumn 64.40783 99.82505 0.05515844 00:00:00
## 2: 00:00:00 Spring 55.96022 86.73218 0.04792396 00:00:00
## 3: 00:00:00 Summer 59.26967 91.86146 0.05075815 00:00:00
## 4: 00:00:00 Winter 124.01313 192.20670 0.10620402 00:00:00
## 5: 00:01:00 Autumn 63.29641 98.10247 0.05420663 00:00:00
## 6: 00:01:00 Spring 55.18319 85.52787 0.04725852 00:00:00</code></pre>
<div id="method-1" class="section level2">
<h2><span class="header-section-number">5.1</span> Method 1</h2>
<pre class="r"><code># aggregate the scaled MW to half hours
# as it is MW we need to take the mean - taking the sum would not be meaningful
method1AggDT <- heatPumpProfileDT[, .(meanMW = mean(scaledMWmethod1)),
keyby = .(season, obsHalfHour)] # <- takes the mean for each category of half hour & season
#Change the order in facet_grid()
method1AggDT$season <- factor(method1AggDT$season, levels = c("Spring","Summer",
"Autumn", "Winter"))
myPlot <- ggplot2::ggplot(method1AggDT, aes(x = obsHalfHour, colour = season)) +
geom_point(aes(y = meanMW)) +
facet_grid(season ~ .) +
theme(text = element_text(family = "Cambria")) +
labs(x='Time of Day', y='Mean MW') +
scale_x_time(breaks = c(hms::as.hms("00:00:00"), hms::as.hms("04:00:00"), hms::as.hms("08:00:00"), hms::as.hms("12:00:00"), hms::as.hms("16:00:00"),
hms::as.hms("20:00:00")))
myPlot</code></pre>
<p><img src="heatPumpProfileAnalysis_files/figure-html/aggregateMethod1-1.png" /><!-- --></p>
</div>
<div id="method-2" class="section level2">
<h2><span class="header-section-number">5.2</span> Method 2</h2>
<p>Used the EECA total NZ number for heat pump energy consumption and converted it into GWh. Converted minute data into half-hour steps. To do :-)</p>
<blockquote>
<p>NB: should you aggregate this scaling method using mean or sum? Why? :-) –>Since we take the percentages of GWh we need to sum up</p>
</blockquote>
<pre class="r"><code># aggregate the percentage of GWh
method2AggDT <- heatPumpProfileDT[, .(GWh = sum(EECApmMethod2)),
keyby = .(season, obsHalfHour)] # <- takes the sum for each category of half hour & season
#Change the order in facet_grid()
method2AggDT$season <- factor(method2AggDT$season, levels = c("Spring","Summer",
"Autumn", "Winter"))
myPlot <- ggplot2::ggplot(method2AggDT, aes(x = obsHalfHour, colour=GWh)) +
geom_point(aes(y = GWh)) +
ggtitle("Total New Zealand half hour heat pump energy consumption by season for 2015") +
facet_grid(season ~ .) +
labs(x='Time of Day', y='GWh') +
theme(text = element_text(family = "Cambria")) +
scale_x_time(breaks = c(hms::as.hms("00:00:00"), hms::as.hms("04:00:00"), hms::as.hms("08:00:00"), hms::as.hms("12:00:00"), hms::as.hms("16:00:00"),
hms::as.hms("20:00:00"))) +
scale_colour_gradient(low= "green", high="red")
myPlot</code></pre>
<p><img src="heatPumpProfileAnalysis_files/figure-html/aggregateMethod2-1.png" /><!-- --></p>
</div>
</div>
<div id="branz-vs.eeca-comparison" class="section level1">
<h1><span class="header-section-number">6</span> BRANZ vs. EECA comparison</h1>
<pre class="r"><code>nzHHheatPumps <- 515015 #This is based on the BRANZ report of household ownership (House condition survey 2015) and 2013 census data
wToKw <- 1000
assumeDaysPerSeason <- 90
heatPumpProfileDT <- heatPumpProfileDT[, scaledGWh := (((meanW * nzHHheatPumps)/wToKw)*(1/60)*assumeDaysPerSeason)/1000/1000] # <- convert mean W to kWh for all NZ hhs, then assumes 90 days per season and calculate GWh
sumbranzGWh <- heatPumpProfileDT[, sum(scaledGWh)]
diffbranzeeca <- 1-(sumbranzGWh/totalGWH)
skimr::skim(sumbranzGWh)</code></pre>
<pre><code>##
## Skim summary statistics
##
## ── Variable type:numeric ──────────────────────────────────────────────────────────────────────────────────────────────
## variable missing complete n mean sd p0 p25 p50 p75
## sumbranzGWh 0 1 1 638.66 NA 638.66 638.66 638.66 638.66
## p100 hist
## 638.66 ▁▁▁▇▁▁▁▁</code></pre>
<pre class="r"><code>skimr::skim(totalGWH)</code></pre>
<pre><code>##
## Skim summary statistics
##
## ── Variable type:numeric ──────────────────────────────────────────────────────────────────────────────────────────────
## variable missing complete n mean sd p0 p25 p50 p75 p100 hist
## totalGWH 0 1 1 708 NA 708 708 708 708 708 ▁▁▁▇▁▁▁▁</code></pre>
<pre class="r"><code>skimr::skim(diffbranzeeca)</code></pre>
<pre><code>##
## Skim summary statistics
##
## ── Variable type:numeric ──────────────────────────────────────────────────────────────────────────────────────────────
## variable missing complete n mean sd p0 p25 p50 p75 p100
## diffbranzeeca 0 1 1 0.098 NA 0.098 0.098 0.098 0.098 0.098
## hist
## ▁▁▁▇▁▁▁▁</code></pre>
<p>Wee identify that BRANZ in comination with GREENGrid Grid Spy and 2013 household ownership census data represent a 9% lower total energy consumption for heat pumps than EECA calculates.</p>
<p>EECA total energy consumption by heat pumps for 2015 (totalGWH) <- 708GWh</p>
<p>BRANZ 40% of owner-occupied households and 25% of rentals own heat pumps. Energy consumption based on BRANZ proportion, Census 2013 and GREENGris Grid Spy data (sumbranzGWh) <- 638GWh</p>
</div>
<div id="yearly-consumption" class="section level1">
<h1><span class="header-section-number">7</span> Yearly consumption</h1>
<p>We need the original data for this, currently the data basis is for an average day in each season.</p>
<pre class="r"><code>heatPumpProfileDT <- heatPumpProfileDT[, obsHalfHour := hms::trunc_hms(obsHourMin, 1800)]</code></pre>
</div>
<div id="technical-potential-of-demand-response-scenarios-for-heat-pump-data" class="section level1">
<h1><span class="header-section-number">8</span> Technical potential of demand response: Scenarios for heat pump data</h1>
<p>We assume that peak time periods are prevalent from 6.00am-10.00am and from 4.00pm-8.00pm.</p>
<div id="load-curtailment-to-zero-sc1" class="section level2">
<h2><span class="header-section-number">8.1</span> Load curtailment to zero: SC1</h2>
<p>In this first scenario we assume that the laod during peak time periods is cut out of the consumption pattern.</p>
<div id="defining-peakoff-peak-periods" class="section level3">
<h3><span class="header-section-number">8.1.1</span> Defining peak/off-peak periods</h3>
<p>Steps: 1) Extracting peak time-periods from heat pump data 2) Building sum of GWh</p>
<pre class="r"><code>MPS <- hms::as.hms("06:00:00")
MPE <- hms::as.hms("10:00:00")
EPS <- hms::as.hms("17:00:00")
EPE <- hms::as.hms("21:00:00")
OP1S <- hms::as.hms("21:30:00")
OP1E <- hms::as.hms("23:30:00")
OP12S <- hms::as.hms("00:00:00")
OP12E <- hms::as.hms("05:30:00")
OP2S <- hms::as.hms("10:30:00")
OP2E <- hms::as.hms("16:30:00")
sc1data <- heatPumpProfileDT
sc1data[, c("medianW", "obsHourMin", "meanW", "nObs", "sdW",
"scaledMWmethod1", "EECApmMethod2"):=NULL] #Deleting unnecessary columns</code></pre>
<pre><code>## Warning in `[.data.table`(sc1data, , `:=`(c("medianW", "obsHourMin",
## "meanW", : Adding new column 'medianW' then assigning NULL (deleting it).</code></pre>
<pre><code>## Warning in `[.data.table`(sc1data, , `:=`(c("medianW", "obsHourMin",
## "meanW", : Adding new column 'nObs' then assigning NULL (deleting it).</code></pre>
<pre><code>## Warning in `[.data.table`(sc1data, , `:=`(c("medianW", "obsHourMin",
## "meanW", : Adding new column 'sdW' then assigning NULL (deleting it).</code></pre>
<pre class="r"><code>sc1data <- sc1data[, .(GWh = sum(scaledGWh)),
keyby = .(season, obsHalfHour)]
sc1data <- sc1data[, Period := "Not Peak"]
sc1data <- sc1data[obsHalfHour >= MPS &
obsHalfHour <= MPE,
Period := "Morning Peak"]
sc1data <- sc1data[obsHalfHour >= EPS &
obsHalfHour <= EPE,
Period := "Evening Peak"]
sc1data <- sc1data[obsHalfHour >= OP1S &
obsHalfHour <= OP1E,
Period := "Off Peak 1"]
sc1data <- sc1data[obsHalfHour >= OP12S &
obsHalfHour <= OP12E,
Period := "Off Peak 1"]
sc1data <- sc1data[obsHalfHour >= OP2S &
obsHalfHour <= OP2E,
Period := "Off Peak 2"]</code></pre>
</div>
<div id="visualising-periods" class="section level3">
<h3><span class="header-section-number">8.1.2</span> Visualising periods</h3>
<pre class="r"><code>#Change the order in facet_grid()
sc1data$season <- factor(sc1data$season, levels = c("Spring","Summer",
"Autumn", "Winter"))
myPlot <- ggplot2::ggplot(sc1data, aes(x = obsHalfHour, color=Period)) +
geom_point(aes(y=GWh), size=1, alpha = 1) +
theme(text = element_text(family = "Cambria")) +
ggtitle("Total heat pump energy consumption per day by time-period") +
facet_grid(season ~ .) +
labs(x='Time of Day', y='GWh') +
scale_color_discrete(breaks=c("Off Peak 1", "Morning Peak", "Off Peak 2",
"Evening Peak")) +
scale_color_discrete(breaks=c("Off Peak 1", "Morning Peak", "Off Peak 2",
"Evening Peak"))+
scale_x_time(breaks = c(hms::as.hms("00:00:00"), hms::as.hms("04:00:00"), hms::as.hms("08:00:00"), hms::as.hms("12:00:00"), hms::as.hms("16:00:00"),
hms::as.hms("20:00:00"))) </code></pre>
<pre><code>## Scale for 'colour' is already present. Adding another scale for
## 'colour', which will replace the existing scale.</code></pre>
<pre class="r"><code> #scale_colour_gradient(low= "green", high="red", guide = "colorbar")
myPlot</code></pre>
<p><img src="heatPumpProfileAnalysis_files/figure-html/visualising%20peak/off-peak-1.png" /><!-- --></p>
<pre class="r"><code>#ggsave("Total heat pump energy consumption by time-period for 2015.jpeg",
# dpi=600)</code></pre>
</div>
<div id="potential-load-curtailment-output-by-period-in-gwh" class="section level3">
<h3><span class="header-section-number">8.1.3</span> Potential load curtailment output by period in GWh</h3>
<pre class="r"><code>sc1data <- sc1data[, .(PotCur = sum(GWh)),
keyby = .(season, Period)]
sc1data</code></pre>
<pre><code>## season Period PotCur
## 1: Spring Evening Peak 40.78758
## 2: Spring Morning Peak 36.10921
## 3: Spring Off Peak 1 28.78128
## 4: Spring Off Peak 2 25.61482
## 5: Summer Evening Peak 27.80357
## 6: Summer Morning Peak 10.80551
## 7: Summer Off Peak 1 22.60697
## 8: Summer Off Peak 2 26.18007
## 9: Autumn Evening Peak 40.23145
## 10: Autumn Morning Peak 30.00890
## 11: Autumn Off Peak 1 29.61507
## 12: Autumn Off Peak 2 23.81100
## 13: Winter Evening Peak 102.90678
## 14: Winter Morning Peak 79.14425
## 15: Winter Off Peak 1 64.48189
## 16: Winter Off Peak 2 49.77366</code></pre>
</div>
<div id="visualising-curtailed-periods" class="section level3">
<h3><span class="header-section-number">8.1.4</span> Visualising curtailed periods</h3>
<pre class="r"><code>sc1data <- heatPumpProfileDT
sc1data[, c("medianW", "obsHourMin", "meanW", "nObs", "sdW",
"scaledMWmethod1", "EECApmMethod2"):=NULL] #Deleting unnecessary columns</code></pre>
<pre><code>## Warning in `[.data.table`(sc1data, , `:=`(c("medianW", "obsHourMin",
## "meanW", : Adding new column 'medianW' then assigning NULL (deleting it).</code></pre>
<pre><code>## Warning in `[.data.table`(sc1data, , `:=`(c("medianW", "obsHourMin",
## "meanW", : Adding new column 'obsHourMin' then assigning NULL (deleting
## it).</code></pre>
<pre><code>## Warning in `[.data.table`(sc1data, , `:=`(c("medianW", "obsHourMin",
## "meanW", : Adding new column 'meanW' then assigning NULL (deleting it).</code></pre>
<pre><code>## Warning in `[.data.table`(sc1data, , `:=`(c("medianW", "obsHourMin",
## "meanW", : Adding new column 'nObs' then assigning NULL (deleting it).</code></pre>
<pre><code>## Warning in `[.data.table`(sc1data, , `:=`(c("medianW", "obsHourMin",
## "meanW", : Adding new column 'sdW' then assigning NULL (deleting it).</code></pre>
<pre><code>## Warning in `[.data.table`(sc1data, , `:=`(c("medianW", "obsHourMin",
## "meanW", : Adding new column 'scaledMWmethod1' then assigning NULL
## (deleting it).</code></pre>
<pre><code>## Warning in `[.data.table`(sc1data, , `:=`(c("medianW", "obsHourMin",
## "meanW", : Adding new column 'EECApmMethod2' then assigning NULL (deleting
## it).</code></pre>
<pre class="r"><code>sc1data <- sc1data[, .(GWhs1 = sum(scaledGWh)),
keyby = .(season, obsHalfHour)]
sc1data <- sc1data[, Period := "Not Peak"]
sc1data <- sc1data[obsHalfHour >= MPS &
obsHalfHour <= MPE,
Period := "Morning Peak"]
sc1data <- sc1data[obsHalfHour >= EPS &
obsHalfHour <= EPE,
Period := "Evening Peak"]
sc1data <- sc1data[obsHalfHour >= OP1S &
obsHalfHour <= OP1E,
Period := "Off Peak 1"]
sc1data <- sc1data[obsHalfHour >= OP12S &
obsHalfHour <= OP12E,
Period := "Off Peak 1"]
sc1data <- sc1data[obsHalfHour >= OP2S &
obsHalfHour <= OP2E,
Period := "Off Peak 2"]
sc1data <- sc1data[, GWh:=GWhs1] # Creating new column GWh based on GWhs1
#sc1data <- sc1data[Period == "Evening Peak",
#GWh := 0]
sc1data <- sc1data[, GWh:= ifelse(Period == "Evening Peak", 0, GWh )] # If Period is Evening peak then make GWh zero
sc1data <- sc1data[, GWh:= ifelse(Period == "Morning Peak", 0, GWh )]
#Change the order in facet_grid()
sc1data$season <- factor(sc1data$season, levels = c("Spring","Summer",
"Autumn", "Winter"))
#setnames(sc1data, old=c("GWh"), new=c("MWh"))
myPlot <- ggplot2::ggplot(sc1data, aes(x = obsHalfHour, y = GWh, color=GWh)) +
geom_line(size=1) +
theme(text = element_text(family = "Cambria")) +
ggtitle("Total heat pump load curtailment in peak time-periods by season") +
facet_grid(season ~ .) +
labs(x='Time of Day', y='GWh') +
#scale_y_continuous(breaks = c(3, 6, 9, 12)) +
scale_x_time(breaks = c(hms::as.hms("00:00:00"), hms::as.hms("04:00:00"), hms::as.hms("08:00:00"), hms::as.hms("12:00:00"), hms::as.hms("16:00:00"),
hms::as.hms("20:00:00"))) +
scale_colour_gradient(low= "green", high="red", guide = "colorbar")
myPlot</code></pre>
<p><img src="heatPumpProfileAnalysis_files/figure-html/setting%20peak%20periods%20to%20zero-1.png" /><!-- --></p>
<pre class="r"><code>#ggsave("Total heat pump load curtailment in peak time-periods by season.jpeg",
# dpi=600) </code></pre>
</div>
</div>
<div id="load-curtailment-of-particular-amount-sc2" class="section level2">
<h2><span class="header-section-number">8.2</span> Load curtailment of particular amount: SC2</h2>
<div id="visualising-new-load-profile" class="section level3">
<h3><span class="header-section-number">8.2.1</span> Visualising new load profile</h3>
<pre class="r"><code>sc1data <- heatPumpProfileDT
sc1data[, c("medianW", "obsHourMin", "meanW", "nObs", "sdW",
"scaledMWmethod1", "EECApmMethod2"):=NULL] #Deleting unnecessary columns</code></pre>
<pre><code>## Warning in `[.data.table`(sc1data, , `:=`(c("medianW", "obsHourMin",
## "meanW", : Adding new column 'medianW' then assigning NULL (deleting it).</code></pre>
<pre><code>## Warning in `[.data.table`(sc1data, , `:=`(c("medianW", "obsHourMin",
## "meanW", : Adding new column 'obsHourMin' then assigning NULL (deleting
## it).</code></pre>
<pre><code>## Warning in `[.data.table`(sc1data, , `:=`(c("medianW", "obsHourMin",
## "meanW", : Adding new column 'meanW' then assigning NULL (deleting it).</code></pre>
<pre><code>## Warning in `[.data.table`(sc1data, , `:=`(c("medianW", "obsHourMin",
## "meanW", : Adding new column 'nObs' then assigning NULL (deleting it).</code></pre>
<pre><code>## Warning in `[.data.table`(sc1data, , `:=`(c("medianW", "obsHourMin",
## "meanW", : Adding new column 'sdW' then assigning NULL (deleting it).</code></pre>
<pre><code>## Warning in `[.data.table`(sc1data, , `:=`(c("medianW", "obsHourMin",
## "meanW", : Adding new column 'scaledMWmethod1' then assigning NULL
## (deleting it).</code></pre>
<pre><code>## Warning in `[.data.table`(sc1data, , `:=`(c("medianW", "obsHourMin",
## "meanW", : Adding new column 'EECApmMethod2' then assigning NULL (deleting
## it).</code></pre>
<pre class="r"><code>sc1data <- sc1data[, .(GWhs1 = sum(scaledGWh)),
keyby = .(season, obsHalfHour)]
sc1data <- sc1data[, Period := "Not Peak"]
sc1data <- sc1data[obsHalfHour >= MPS &
obsHalfHour <= MPE,
Period := "Morning Peak"]
sc1data <- sc1data[obsHalfHour >= EPS &
obsHalfHour <= EPE,
Period := "Evening Peak"]
sc1data <- sc1data[obsHalfHour >= OP1S &
obsHalfHour <= OP1E,
Period := "Off Peak 1"]
sc1data <- sc1data[obsHalfHour >= OP12S &
obsHalfHour <= OP12E,
Period := "Off Peak 1"]
sc1data <- sc1data[obsHalfHour >= OP2S &
obsHalfHour <= OP2E,
Period := "Off Peak 2"]
sc1data <- sc1data[, GWh:=GWhs1] # Creating new column GWh based on GWhs1
sc1data <- sc1data[, GWh:= ifelse(Period == "Evening Peak", 0.5*GWh, GWh )] # If Period is Evening peak then change the value of GWh by 50%
sc1data <- sc1data[, GWh:= ifelse(Period == "Morning Peak", GWh*0.5, GWh )]
#Change the order in facet_grid()
sc1data$season <- factor(sc1data$season, levels = c("Spring","Summer",
"Autumn", "Winter"))
#setnames(sc1data, old=c("GWh"), new=c("MWh"))
myPlot <- ggplot2::ggplot(sc1data, aes(x = obsHalfHour, y = GWh, color=GWh)) +
geom_line(size=1) +
theme(text = element_text(family = "Cambria")) +
ggtitle("Total heat pump load per curtailment in peak time-periods by season 50%") +
facet_grid(season ~ .) +
labs(x='Time of Day', y='GWh') +
scale_y_continuous(breaks = c(3, 6, 9, 12)) +
scale_x_time(breaks = c(hms::as.hms("00:00:00"), hms::as.hms("04:00:00"), hms::as.hms("08:00:00"), hms::as.hms("12:00:00"), hms::as.hms("16:00:00"),
hms::as.hms("20:00:00"))) +
scale_colour_gradient(low= "green", high="red", guide = "colorbar")
myPlot</code></pre>
<p><img src="heatPumpProfileAnalysis_files/figure-html/Curtail%20load%20based%20on%20percentage-1.png" /><!-- --></p>
<pre class="r"><code>#ggsave("Total heat pump 0.5 load curtailment in peak time-periods by season.jpeg",
# dpi=600) </code></pre>
</div>
<div id="potential-load-curtailment-based-on-percentage-curtailed" class="section level3">
<h3><span class="header-section-number">8.2.2</span> Potential load curtailment based on percentage curtailed</h3>
<pre class="r"><code>sc1data <- sc1data[, .(PotCur = sum(GWh)),
keyby = .(season, Period)]
sc1data</code></pre>
<pre><code>## season Period PotCur
## 1: Spring Evening Peak 20.393788
## 2: Spring Morning Peak 18.054604
## 3: Spring Off Peak 1 28.781280
## 4: Spring Off Peak 2 25.614817
## 5: Summer Evening Peak 13.901786
## 6: Summer Morning Peak 5.402753
## 7: Summer Off Peak 1 22.606967
## 8: Summer Off Peak 2 26.180072
## 9: Autumn Evening Peak 20.115726
## 10: Autumn Morning Peak 15.004450
## 11: Autumn Off Peak 1 29.615072
## 12: Autumn Off Peak 2 23.811002
## 13: Winter Evening Peak 51.453388
## 14: Winter Morning Peak 39.572127
## 15: Winter Off Peak 1 64.481887
## 16: Winter Off Peak 2 49.773665</code></pre>
</div>
</div>
<div id="load-shifting-to-prior-periods-sc3" class="section level2">
<h2><span class="header-section-number">8.3</span> Load shifting to prior periods: SC3</h2>
<pre class="r"><code>sc1data <- heatPumpProfileDT
sc1data[, c("medianW", "obsHourMin", "meanW", "nObs", "sdW",
"scaledMWmethod1", "EECApmMethod2"):=NULL] #Deleting unnecessary columns</code></pre>
<pre><code>## Warning in `[.data.table`(sc1data, , `:=`(c("medianW", "obsHourMin",
## "meanW", : Adding new column 'medianW' then assigning NULL (deleting it).</code></pre>
<pre><code>## Warning in `[.data.table`(sc1data, , `:=`(c("medianW", "obsHourMin",
## "meanW", : Adding new column 'obsHourMin' then assigning NULL (deleting
## it).</code></pre>
<pre><code>## Warning in `[.data.table`(sc1data, , `:=`(c("medianW", "obsHourMin",
## "meanW", : Adding new column 'meanW' then assigning NULL (deleting it).</code></pre>
<pre><code>## Warning in `[.data.table`(sc1data, , `:=`(c("medianW", "obsHourMin",
## "meanW", : Adding new column 'nObs' then assigning NULL (deleting it).</code></pre>
<pre><code>## Warning in `[.data.table`(sc1data, , `:=`(c("medianW", "obsHourMin",
## "meanW", : Adding new column 'sdW' then assigning NULL (deleting it).</code></pre>
<pre><code>## Warning in `[.data.table`(sc1data, , `:=`(c("medianW", "obsHourMin",
## "meanW", : Adding new column 'scaledMWmethod1' then assigning NULL
## (deleting it).</code></pre>
<pre><code>## Warning in `[.data.table`(sc1data, , `:=`(c("medianW", "obsHourMin",
## "meanW", : Adding new column 'EECApmMethod2' then assigning NULL (deleting
## it).</code></pre>
<pre class="r"><code>sc1data <- sc1data[, .(GWhs1 = sum(scaledGWh)),
keyby = .(season, obsHalfHour)]
#Defining peak and off-peak periods
sc1data <- sc1data[, Period := "Not Peak"]
sc1data <- sc1data[obsHalfHour >= MPS &
obsHalfHour <= MPE,
Period := "Morning Peak"]
sc1data <- sc1data[obsHalfHour >= EPS &
obsHalfHour <= EPE,
Period := "Evening Peak"]
sc1data <- sc1data[obsHalfHour >= OP1S &
obsHalfHour <= OP1E,
Period := "Off Peak 1"]
sc1data <- sc1data[obsHalfHour >= OP12S &
obsHalfHour <= OP12E,
Period := "Off Peak 1"]
sc1data <- sc1data[obsHalfHour >= OP2S &
obsHalfHour <= OP2E,
Period := "Off Peak 2"]
#Building the sum of each peak period by season
AuMP <- sc1data[season == "Autumn" & Period == "Morning Peak",
sum(GWhs1)]
WiMP <- sc1data[season == "Winter" & Period == "Morning Peak",
sum(GWhs1)]
SpMP <- sc1data[season == "Spring" & Period == "Morning Peak",
sum(GWhs1)]
SuMP <- sc1data[season == "Summer" & Period == "Morning Peak",
sum(GWhs1)]
AuEP <- sc1data[season == "Autumn" & Period == "Evening Peak",
sum(GWhs1)]
WiEP <- sc1data[season == "Winter" & Period == "Evening Peak",
sum(GWhs1)]
SpEP <- sc1data[season == "Spring" & Period == "Evening Peak",
sum(GWhs1)]
SuEP <- sc1data[season == "Summer" & Period == "Evening Peak",
sum(GWhs1)]
#Counting number of rows that will be associated to spread the Morning Peak
AuMPHalfHours <- nrow(sc1data[season == "Autumn" &
Period == "Off Peak 1"])
WiMPHalfHours <- nrow(sc1data[season == "Winter" &
Period == "Off Peak 1"])
SpMPHalfHours <- nrow(sc1data[season == "Spring" &
Period == "Off Peak 1"])
SuMPHalfHours <- nrow(sc1data[season == "Summer" &
Period == "Off Peak 1"])
#Counting number of rows that will be associated to spread the Evening Peak
AuEPHalfHours <- nrow(sc1data[season == "Autumn" &
Period == "Off Peak 2"])
WiEPHalfHours <- nrow(sc1data[season == "Winter" &
Period == "Off Peak 2"])
SpEPHalfHours <- nrow(sc1data[season == "Spring" &
Period == "Off Peak 2"])
SuEPHalfHours <- nrow(sc1data[season == "Summer" &
Period == "Off Peak 2"])
#Calculating the proportion that each row will take on to spread the GWhs
distGWhOP1Au <- AuMP/AuMPHalfHours
distGWhOP1Wi <- WiMP/WiMPHalfHours
distGWhOP1Sp <- SpMP/SpMPHalfHours
distGWhOP1Su <- SuMP/SuMPHalfHours
distGWhOP2Au <- AuEP/AuEPHalfHours
distGWhOP2Wi <- WiEP/WiEPHalfHours
distGWhOP2Sp <- SpEP/SpEPHalfHours
distGWhOP2Su <- SuEP/SuEPHalfHours
#Adding amount of spreaded peak consumption to off-peak periods
sc1data <- sc1data[season == "Autumn" &
Period == "Off Peak 1", GWhs3 :=
GWhs1 + distGWhOP1Au]
sc1data <- sc1data[season == "Winter" &
Period == "Off Peak 1", GWhs3 :=
GWhs1 + distGWhOP1Wi]
sc1data <- sc1data[season == "Spring" &
Period == "Off Peak 1", GWhs3 :=
GWhs1 + distGWhOP1Sp]
sc1data <- sc1data[season == "Summer" &
Period == "Off Peak 1", GWhs3 :=
GWhs1 + distGWhOP1Su]
sc1data <- sc1data[season == "Autumn" &
Period == "Off Peak 2", GWhs3 :=
GWhs1 + distGWhOP2Au]
sc1data <- sc1data[season == "Winter" &
Period == "Off Peak 2", GWhs3 :=
GWhs1 + distGWhOP2Wi]
sc1data <- sc1data[season == "Spring" &
Period == "Off Peak 2", GWhs3 :=
GWhs1 + distGWhOP2Sp]
sc1data <- sc1data[season == "Summer" &
Period == "Off Peak 2", GWhs3 :=
GWhs1 + distGWhOP2Su]
#Setting missing values in peak periods to NULL
sc1data <- sc1data[, GWhs3:= ifelse(Period =="Morning Peak",
0, GWhs3)]
sc1data <- sc1data[, GWhs3:= ifelse(Period =="Evening Peak",
0, GWhs3)]
#Renaming GWhs3 into GWh to depict the right text in the colorbar
setnames(sc1data, old=c("GWhs3"), new=c("GWh"))
#Visualising only shifted consumption
#myPlot <- ggplot2::ggplot(sc1data, aes(x = obsHalfHour, color=GWh)) +
#geom_line(aes(y=GWh), size=0.5) +
#theme(text = element_text(family = "Cambria")) +
#ggtitle("Total shifted New Zealand half hour heat pump energy consumption by season for 2015") +
#facet_grid(season ~ .) +
#labs(x='Time of Day', y='GWh') +
#scale_y_continuous(breaks = c(4, 8, 12, 16)) +
#scale_x_time(breaks = c(hms::as.hms("00:00:00"), hms::as.hms("03:00:00"), hms::as.hms("06:00:00"), hms::as.hms("09:00:00"), hms::as.hms("12:00:00"),
#hms::as.hms("15:00:00"), hms::as.hms("18:00:00"), hms::as.hms("21:00:00"))) +
#scale_colour_gradient(low= "green", high="red", guide = "colorbar")
#myPlot
#myPlot <- ggplot2::ggplot(sc1data, aes(x = obsHalfHour)) +
# geom_line(aes(y=GWh, color=GWh), size=0.5) +
#geom_line(aes(y=GWhs1, color=GWhs1), size=0.5) +
# theme(text = element_text(family = "Cambria")) +
# ggtitle("Original and shifted New Zealand half hour heat pump energy consumption by season for 2015") +
# facet_grid(season ~ .) +
# labs(x='Time of Day', y='GWh') +
# scale_y_continuous(breaks = c(4, 8, 12, 16)) +
# scale_x_time(breaks = c(hms::as.hms("00:00:00"), hms::as.hms("03:00:00"), hms::as.hms("06:00:00"), hms::as.hms("09:00:00"), hms::as.hms("12:00:00"),
# hms::as.hms("15:00:00"), hms::as.hms("18:00:00"), hms::as.hms("21:00:00"))) +
# scale_color_gradient(low= "green", high="red")
#myPlot
#Change the order in facet_grid()
sc1data$season <- factor(sc1data$season, levels = c("Spring","Summer",
"Autumn", "Winter"))
#Visualising shifted and original consumption with labels in different colours
myPlot <- ggplot2::ggplot(sc1data, aes(x = obsHalfHour)) +
geom_line(aes(y=GWh, color="red"), size=0.5) +
geom_line(aes(y=GWhs1, color="blue"), size=0.5) +
theme(text = element_text(family = "Cambria")) +
ggtitle("Original and shifted New Zealand per day half hour heat pump energy consumption by season for 2015") +
scale_colour_manual(name = element_blank(),
values =c('red'='red','blue'='blue'), labels = c('Original consumption',
'Shifted consumption')) +
facet_grid(season ~ .) +
labs(x='Time of Day', y='GWh') +
# scale_y_continuous(breaks = c(4, 8, 12, 16)) +
scale_x_time(breaks = c(hms::as.hms("00:00:00"), hms::as.hms("04:00:00"), hms::as.hms("08:00:00"), hms::as.hms("12:00:00"), hms::as.hms("16:00:00"),
hms::as.hms("20:00:00")))
#scale_color_gradient(low= "green", high="red")