forked from iswelindus/iswelindus.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.html
1469 lines (1380 loc) · 43.1 KB
/
model.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" />
<title>Model</title>
<script src="site_libs/jquery-1.11.3/jquery.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/cosmo.min.css" rel="stylesheet" />
<script src="site_libs/bootstrap-3.3.5/js/bootstrap.min.js"></script>
<script src="site_libs/bootstrap-3.3.5/shim/html5shiv.min.js"></script>
<script src="site_libs/bootstrap-3.3.5/shim/respond.min.js"></script>
<script src="site_libs/jqueryui-1.11.4/jquery-ui.min.js"></script>
<link href="site_libs/tocify-1.9.1/jquery.tocify.css" rel="stylesheet" />
<script src="site_libs/tocify-1.9.1/jquery.tocify.js"></script>
<script src="site_libs/navigation-1.1/tabsets.js"></script>
<link href="site_libs/highlightjs-9.12.0/textmate.css" rel="stylesheet" />
<script src="site_libs/highlightjs-9.12.0/highlight.js"></script>
<link href="site_libs/font-awesome-4.5.0/css/font-awesome.min.css" rel="stylesheet" />
<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>
<link rel="stylesheet" href="styles.css" type="text/css" />
</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;
}
button.code-folding-btn:focus {
outline: none;
}
</style>
<style type="text/css">
/* padding for bootstrap navbar */
body {
padding-top: 51px;
padding-bottom: 40px;
}
/* offset scroll position for anchor links (for fixed navbar) */
.section h1 {
padding-top: 56px;
margin-top: -56px;
}
.section h2 {
padding-top: 56px;
margin-top: -56px;
}
.section h3 {
padding-top: 56px;
margin-top: -56px;
}
.section h4 {
padding-top: 56px;
margin-top: -56px;
}
.section h5 {
padding-top: 56px;
margin-top: -56px;
}
.section h6 {
padding-top: 56px;
margin-top: -56px;
}
</style>
<script>
// manage active state of menu based on current page
$(document).ready(function () {
// active menu anchor
href = window.location.pathname
href = href.substr(href.lastIndexOf('/') + 1)
if (href === "")
href = "index.html";
var menuAnchor = $('a[href="' + href + '"]');
// mark it active
menuAnchor.parent().addClass('active');
// if it's got a parent navbar menu mark it active as well
menuAnchor.closest('li.dropdown').addClass('active');
});
</script>
<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,h3",
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="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">IS-WEL Indus</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
<a href="index.html">Overview</a>
</li>
<li>
<a href="sdgs.html">SDGs</a>
</li>
<li>
<a href="issues.html">Issues</a>
</li>
<li>
<a href="policy.html">Policy</a>
</li>
<li>
<a href="emergingtechs.html">Emerging Techs</a>
</li>
<li>
<a href="data.html">Data</a>
</li>
<li>
<a href="model.html">Model</a>
</li>
<li>
<a href="baseline.html">Baseline</a>
</li>
<li>
<a href="pathways.html">Pathways</a>
</li>
<li>
<a href="analysis.html">Analysis</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="library.html">
<span class="fa fa-book"></span>
Library
</a>
</li>
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
<div class="fluid-row" id="header">
<h1 class="title toc-ignore">Model</h1>
</div>
<div id="messageix-guides" class="section level1">
<h1>MESSAGEix Guides</h1>
<p>The following user guides are available for the MESSAGEix framework and related models:</p>
<ul>
<li>
MESSAGEix IIASA private github repository: <a href="https://github.com/iiasa/message_ix" class="uri">https://github.com/iiasa/message_ix</a>
</li>
<li>
MESSAGEix User guide (available from within IIASA network): <a href="http://ienecat:8787/message_ix_doc/" class="uri">http://ienecat:8787/message_ix_doc/</a>
</li>
<li>
MESSAGEix Documentation – Available on IIASA pdrive: <a href="https://portal.iiasa.ac.at/dana/fb/smb/wfb.cgi?t=p&v=resource_1304000562.324190.2&si=0&ri=0&pi=0&sb=name&so=asc&dir=is-wel%5Cindus%5Cmodel\Guides">pdrive\is-wel\indus\model\Guides\MESSAGEixDocumentation</a>
</li>
<li>
MESSAGEV Math formulation – Available on IIASA pdrive:<a href="https://portal.iiasa.ac.at/dana/fb/smb/wfb.cgi?t=p&v=resource_1304000562.324190.2&si=0&ri=0&pi=0&sb=name&so=asc&dir=is-wel%5Cindus%5Cmodel\Guides">pdrive\is-wel\indus\model\Guides\MESSAGEVMathFormulation</a>
</li>
</div>
<div id="framework" class="section level1">
<h1>Framework</h1>
<p>The MESSAGEix Indus basin model is run using R to read input data from various formats including .txt, .csv, .xls, .xlsx and .gdx files. R then interacts with GAMS to run the model code. These basic connections are shown in Figure 1. Figure 2 shows all the folders and files which are used to run the model. Figure 3 gives a summary of how the model is run using these different files.</p>
<p id="figcap">
Figure 1: ISWEL Indus Basin model software
</p>
<center>
<div id="fig">
<div class="figure">
<img src="figures/f_model_software.PNG" />
</div>
</div>
</center>
<p><br><br></p>
<p id="figcap">
Figure 2: ISWEL Indus Basin model folders and files
</p>
<center>
<div id="fig">
<div class="figure">
<img src="figures/f_model_folders.PNG" />
</div>
</div>
</center>
<p><br><br></p>
<p id="figcap">
Figure 3: Summary of ISWEL Indus Basin model run
</p>
<center>
<div id="fig">
<div class="figure">
<img src="figures/f_model_run.PNG" />
</div>
</div>
</center>
<p><br><br></p>
</div>
<div id="resources-flows" class="section level1">
<h1>Resources flows</h1>
<p>The MESSAGEix model tracks flows of commodities from insitu or local availability through different processes to a final exogenous demand. The list of sets, parameters, variables and equations are detailed in the subsequent sections. In this section a small example is used to explain how these work in the model. Figure 4 shows how the demand for 0.1 units of lighting in spatial unit Node A is met using electrcitiy produced by a coal power plant also in Node A. The coal needed for this production is transported from Node B where the coal is assumed to be available. In addition to raw coal, the power plant also required water for cooling, which is extracted from surface water SW and then purified onsite to the required quality. Because the water extraction and purification processes consume energy, overall additional energy is needed. The additional energy needs in turn also feedback to the water system, until a balance is met.</p>
<p><br><br></p>
<p id="figcap">
Figure 4: Example of water and energy resource flows from extraction to final use
</p>
<center>
<div id="fig">
<div class="figure">
<img src="figures/f_model_resourceflowExample.PNG" />
</div>
</div>
</center>
<p><br><br></p>
<p>For each technology an “input”" parameter defines the amount of commodity of a certain level that goes into the technology and then an “output”" parameter defines the amount of commodity of a certain level which is subsequently produced. These parameters are used to define the efficiency of the processes as well as spatial and temporal transfers. The overall goal of the model is to meet the demand for a commodity of a certain level for each node and time period defined by the parameter “demand”. The table below shows the “input” and “output” parameters defined for different commodities of different levels for each technology process from the example from Figure 4. The column labelled “Activity” is the optimal activity of each technology. As seen in the table for the technology “Coal trans” we can use different “Nodes” to define processes which transfer a commodity by taking inputs at one node and producing an output at another node. Furthermore, the energy technologies defined here all have an efficiency of 100% i.e. they take in a commodity of 1 unit and produce a commodity of 1 unit without any losses. Efficiencies can be defined by making the inputs greater than the outputs. With this efficiency, in theory, the demand for 0.1 units of lighting would be met with 0.1 units of electricty, produced from 0.1 units of coal. However, because of the feedbacks with the water system and the corresponding requirements the energy demands of the whole system are slightly higher.</p>
<p><br><br></p>
<p id="figcap">
Table: Water and energy input and output parameters for commodity flows through different technology processes for the example from Figure 4
</p>
<center>
<div id="fig">
<div class="figure">
<img src="figures/t_model_resourceflowInputOutput.PNG" />
</div>
</div>
</center>
<p><br><br></p>
<p>A simplified form of the commodity balance equation can be defined as shown in the equation below where the variable “ACT”, dictates how many units of “output” and “input” are processed for each commodity and level. The table that follows then shows how the balance is met for all the commodity transformations and levels from the example from Figure 4. Some commodity levels are excluded from the demand balance such as “insitu” resource volumes or resources which are released back into the environment such as “untreated” waste water. Insitu volumes are excluded because they are constrained in another equation based on the amount of resources available. Releases to the environment are excluded because they do not constrain the system. Any requirements for environmental flows are defined explicitly as a demand.</p>
<p><br><br></p>
<center>
<div id="box">
<p>input*ACT - output*ACT + demand = 0</p>
</div>
</center>
<p><br><br></p>
<p id="figcap">
Table: Water and energy commodity balance for the example from Figure 4
</p>
<center>
<div id="fig">
<div class="figure">
<img src="figures/t_model_resourceflowBalance.PNG" />
</div>
</div>
</center>
<p><br><br></p>
</div>
<div id="indus-basin-chosen-tecs-comods" class="section level1">
<h1>Indus Basin chosen tecs & comods</h1>
<p><strong>Figure 5</strong> below shows the chosen commodities and technologies for the Indus Basin model. The energy technologies are based on local capacity and classifications made by the IEA in their <a href="https://www.iea.org/statistics/statisticssearch/report/?country=Pakistan&product=electricityandheat">energy statistics reports for Pakistan</a>. Water technologies and commodities are based on previous models at IIASA and local data availability. At this stage the supply of products is classified in simplified groups which can later be further disaggregated to represent more detailed end-user technologies.</p>
<p><br><br></p>
<p id="figcap">
Figure 5: Chosen technologies and commodities for Indus Basin model
</p>
<center>
<div id="fig">
<div class="figure">
<img src="figures/f_model_indusTecsComs.PNG" />
</div>
</div>
</center>
<p><br><br></p>
</div>
<div id="example-run-demo-data-only" class="section level1">
<h1>Example run (Demo data only)</h1>
<p>In this section the model is used to run a small example using a few actual PIDs (Polygon IDs) from the Indus Basin as shown in <strong>Figure 6</strong> below. PIDs 2229 and 2239 from Pakistan, 2249 from India and 2251 from Afghanistan are chosen.</p>
<p><br><br></p>
<p id="figcap">
Figure 6: Chosen PIDs in the Indus basin for example run
</p>
<center>
<div id="fig">
<div class="figure">
<img src="figures/f_model_egrun_SelectedPIDs.PNG" />
</div>
</div>
</center>
<p><br><br></p>
<p>The conceptual framework of the demands and infrastructure considered is shown in <strong>Figure 7</strong>. It assumed that there is a demand for urban electricity in PID 2229 and a demand for Industrial electricity in PID 2251 in Afghanistan. There is a single coal power plant as well as a water processing plant located in PID 2229. Raw coal for the power plant is onnly available in PID 2249 while water is only available in PID 2239. Water extraction will also need additional energy in PID 2239 and the coal power plant in PID 2229 also requires water for power plant cooling.</p>
<p><br><br></p>
<p id="figcap">
Figure 7: Conceptual framework of infrastructure and demands
</p>
<center>
<div id="fig">
<div class="figure">
<img src="figures/f_model_egrun_conceptualflows.PNG" />
</div>
</div>
</center>
<p><br><br></p>
<p>The following figures and paragraphs describe how the conceptual example from above is setup in the model. All inputs are managed in the <strong>aaaModelNew.xls</strong> excel file. <strong>Figure 8</strong> shows how the chosen PIDs are assigned in the model in the set “node” in the “sets” tab. The corresponding countries also need to be assigned in the set “map_spatial_hierarchy”.</p>
<p><br><br></p>
<p id="figcap">
Figure 8: Assigning spatial units in set “node” in “sets” tab in aaaModelNew.xls
</p>
<center>
<div id="fig">
<div class="figure">
<img src="figures/f_model_egrun_setstab.PNG" />
</div>
</div>
</center>
<p><br><br></p>
<p><strong>Figure 9</strong> shows an example of how different technology characteristics are defined using GAMS parameters in the “param_tec” tab. The figure shows the assignment of investment costs <strong>(inv_cost)</strong> for each technology, node and year. For this example to keep matters simple all technologies have been assigned the same cost for all nodes and years. This can of course be updated to reflect any differences in costs across borders and to account for forecasts in costs across years.</p>
<p><br><br></p>
<p id="figcap">
Figure 9: Assigning technology parameters in “param_tec” tab in aaaModelNew.xls
</p>
<center>
<div id="fig">
<div class="figure">
<img src="figures/f_model_egrun_paramTectab.PNG" />
</div>
</div>
</center>
<p><br><br></p>
<p>A separate tab (“param_tecInOut”) in the excel sheet is reserved for assigning the flow of commodities through each technologies in the parameters <strong>input</strong> and <strong>output</strong>. <strong>Figure 10</strong> shows an example of these key parameters. Any technology can take in multiple inputs and produce different outputs. This allows the MESSAGE model to easily track flows of resource across sectors. For example if we zoom into the figure here we can see that the coal power plant <strong>e_conv_cntrl_ppl_coal</strong> located in PID 2229 take in both water and electrcitiy as an input and then outputs electrcity. Furthermore in this figure we can see that how transmission technologies are defined for each pair of spatial units.</p>
<p><br><br></p>
<p id="figcap">
Figure 10: Assigning flows of commodities through technology parameters in “param_tecInOut” tab in aaaModelNew.xls
</p>
<center>
<div id="fig">
<div class="figure">
<img src="figures/f_model_egrun_paramTecInOuttab.PNG" />
</div>
</div>
</center>
<p><br><br></p>
<p><strong>Figure 11</strong> shows how resource availability and existing stocks of commodities are defined for each PID in the model, in the tab “param_res”.</p>
<p><br><br></p>
<p id="figcap">
Figure 11: Assigning resource availability per spatial units for each commodity “param_res” tab in aaaModelNew.xls
</p>
<center>
<div id="fig">
<div class="figure">
<img src="figures/f_model_egrun_paramRestab.PNG" />
</div>
</div>
</center>
<p><br><br></p>
<p><strong>Figure 12</strong> shows how exogenous demands for different commodities are defined in the model for spatial unit and year. In the current example as seen in the conceptual diagram in <strong>Figure 7</strong> a demand for urban electrcity is defined in PID 2229 and a demand for industrial electricity is defined in PID 2251. The greyed out country names are added for information.</p>
<p><br><br></p>
<p id="figcap">
Figure 12: Assigning demands per spatial unit and commodity in “param_res” tab in aaaModelNew.xls
</p>
<center>
<div id="fig">
<div class="figure">
<img src="figures/f_model_egrun_paramDemtab.PNG" />
</div>
</div>
</center>
<p><br><br></p>
<p>After the model has been setup as shown in the preceeding figures it can then be run either directly from GAMS or using R as a front end. <strong>Figure 13</strong> shows the GAMS project file <strong>message_project.gpr</strong> which contains the different GAMS runs. The model is run using the <strong>MESSAGE_masterExcel.gms</strong> file which reads the input excel sheet <strong>aaaModelNew.xls</strong> as well as calls all the other MESSAGE model gams files located in different folders. After the model runs the gdx file <strong>MSGOutput_Indus.gdx</strong> can be opened from the <strong>output</strong> folder. <strong>Figure 14</strong> shows a snapshot of the gdx file showing the variable ACT which shows the activity of each technology for each PID and vintage.</p>
<p><br><br></p>
<p id="figcap">
Figure 13: GAMS message_project.gpr
</p>
<center>
<div id="fig">
<div class="figure">
<img src="figures/f_model_egrun_GAMSprj.PNG" />
</div>
</div>
</center>
<p><br><br></p>
<p id="figcap">
Figure 14: GAMS MSGOutput_Indus.gdx file
</p>
<center>
<div id="fig">
<div class="figure">
<img src="figures/f_model_egrun_GAMSoutGDX.PNG" />
</div>
</div>
</center>
<p><br><br></p>
<p><strong>Figure 15</strong> shows an alternative way to run the model using R by opening the <strong>MESSAGEX.Rproj</strong> project folder which contains the <strong>MESSAGEX_Run.R</strong> file which is a front end which calls the GAMS files from before. R can be used to directly read the gdx output file and then process the results to create corresponding outputs.</p>
<p><br><br></p>
<p id="figcap">
Figure 15: RStudio project alternative
</p>
<center>
<div id="fig">
<div class="figure">
<img src="figures/f_model_egrun_RProj.PNG" />
</div>
</div>
</center>
<p><br><br></p>
<p><strong>Figure 16</strong> shows the conceptual framework with an overlay representing the model output for commodity flows across each technology. As can be seen in the current example there are no losses and total mass balance is maintained. In order to meet the total demand of 0.2 electricty units (0.1 urban electricty in PID 2229 and 0.1 industrial electricity in PID 2251) 0.25 units needed to be produced. This was because additional electricity was needed for the water purification unit as well as for the water extraction in PID 2239. The water was needed to cool the coal power plant in PID 2229. The example shows how the model can track the feedback across the sectors.</p>
<p><br><br></p>
<p id="figcap">
Figure 16: Model resource flow outputs overlay on conceptual figure
</p>
<center>
<div id="fig">
<div class="figure">
<img src="figures/f_model_egrun_conceptualflowsResults.PNG" />
</div>
</div>
</center>
<p><br><br></p>
<p><strong>Figure 17</strong> shows an example of outputs from an R script which reads the variable ACT, representing activity for each technology from the gdx file and can process it into figure for each PID and year. From the figure we can see the maximum activity is in PID 2229 which contains the coal powerplant, the water purification unit and the urban demand. PID 2239 has some activity related to water extraction involving water pumping and canal transfers and some electricty usage for the water processes. PID 2249 shows activity related to extracting and transporting raw coal and PID 2251 has activity related to electricty distribution and final supply of electricty to industries.</p>
<p><br><br></p>
<p id="figcap">
Figure 17: Model outputs for Variable ACT per PID and tec
</p>
<center>
<div id="fig">
<div class="figure">
<img src="figures/f_model_egrun_modelResultsChart.PNG" />
</div>
</div>
</center>
</div>
<div id="sets" class="section level1">
<h1>Sets</h1>
<div id="base-sets" class="section level2">
<h2>Base sets</h2>
<table>
<colgroup>
<col width="50%" />
<col width="50%" />
</colgroup>
<thead>
<tr class="header">
<th>Sets</th>
<th>Label</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>year_all</td>
<td>years (over entire model horizon)</td>
</tr>
<tr class="even">
<td>year</td>
<td>years included in a model instance (for myopic or rolling-horizon optimization)</td>
</tr>
<tr class="odd">
<td>vintage</td>
<td>alias for year_all</td>
</tr>
<tr class="even">
<td>time</td>
<td>subannual time periods (seasons - days - hours)</td>
</tr>
<tr class="odd">
<td>time2</td>
<td>alias for time</td>
</tr>
<tr class="even">
<td>node</td>
<td>world - regions - countries - grid cells</td>
</tr>
<tr class="odd">
<td>location</td>
<td>alias for node</td>
</tr>
<tr class="even">
<td>commodity</td>
<td>resources - electricity - water - land availability - etc.</td>
</tr>
<tr class="odd">
<td>grade</td>
<td>grades of extraction of raw materials</td>
</tr>
<tr class="even">
<td>level</td>
<td>commodity states eg. primary, final, treated</td>
</tr>
<tr class="odd">
<td>level_resource(level)</td>
<td>subset of ‘level’ for initial extraction of resources to exclude from commodity balance</td>
</tr>
<tr class="even">
<td>tec</td>
<td>technologies</td>
</tr>
<tr class="odd">
<td>mode</td>
<td>modes of operation</td>
</tr>
<tr class="even">
<td>emission</td>
<td>greenhouse gases - pollutants - etc.</td>
</tr>
<tr class="odd">
<td>lvl_spatial</td>
<td>hierarchical levels of spatial resolution</td>
</tr>
<tr class="even">
<td>lvl_temporal</td>
<td>hierarchical levels of temporal resolution</td>
</tr>
<tr class="odd">
<td>relation</td>
<td>generic user-defined relations (included as legacy from MESSAGE V)</td>
</tr>
</tbody>
</table>
</div>
<div id="category-type-sets" class="section level2">
<h2>Category type sets</h2>
<table>
<colgroup>
<col width="50%" />
<col width="50%" />
</colgroup>
<thead>
<tr class="header">
<th>Sets</th>
<th>Label</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>type_year</td>
<td>types of year aggregations</td>
</tr>
<tr class="even">
<td>type_tec</td>
<td>types of technologies</td>
</tr>
<tr class="odd">
<td>cat_tec(type_tec,tec)</td>
<td>mapping of technologies to respective categories</td>
</tr>
<tr class="even">
<td>cat_year(type_year,year_all)</td>
<td>mapping of years to respective categories</td>
</tr>
<tr class="odd">
<td>type_emission</td>
<td>types of emission aggregations</td>
</tr>
<tr class="even">
<td>cat_emission(type_emission,emission)</td>
<td>mapping of emissions to respective categories</td>
</tr>
</tbody>
</table>
</div>
<div id="mapping-sets" class="section level2">
<h2>Mapping sets</h2>
<table>
<colgroup>
<col width="50%" />
<col width="50%" />
</colgroup>
<thead>
<tr class="header">
<th>Sets</th>
<th>Label</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>map_spatial_hierarchy(lvl_spatial,node,node)</td>
<td>mapping of spatial resolution to nodes (last index is ‘parent’)</td>
</tr>
<tr class="even">
<td>map_temporal_hierarchy(lvl_temporal,time,time)</td>
<td>mapping of temporal resolution to time (last index is ‘parent’)</td>
</tr>
<tr class="odd">
<td>map_node(node,location)</td>
<td>mapping of nodes across hierarchy levels (location is in node)</td>
</tr>
<tr class="even">
<td>map_time(time,time2)</td>
<td>mapping of time periods across hierarchy levels (time2 is in time)</td>
</tr>
<tr class="odd">
<td>map_commodity(node,commodity,level,year_all,time)</td>
<td>mapping of commodity-level to node and time</td>
</tr>
<tr class="even">
<td>map_tec(node,tec,year_all)</td>
<td>mapping of technology to node and years</td>
</tr>
<tr class="odd">
<td>map_tec_time(node,tec,year_all,time)</td>
<td>mapping of technology to temporal dissagregation (time)</td>
</tr>
<tr class="even">
<td>map_tec_mode(node,tec,year_all,mode)</td>
<td>mapping of technology to modes</td>
</tr>
<tr class="odd">
<td>map_resource(node,commodity,grade,year_all)</td>
<td>mapping of resources and grades to node over time</td>
</tr>
<tr class="even">
<td>map_stocks(node,commodity,level,year_all)</td>
<td>mapping of commodity-level to node and time</td>
</tr>
<tr class="odd">
<td>map_relation(relation,node,year_all)</td>
<td>mapping of generic relations to nodes and years</td>
</tr>
</tbody>
</table>
</div>
<div id="sets-with-flags-for-bounds" class="section level2">
<h2>Sets with flags for bounds</h2>
<table>
<colgroup>
<col width="50%" />
<col width="50%" />
</colgroup>
<thead>
<tr class="header">
<th>Sets</th>
<th>Label</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>is_bound_new_capacity_up(node,tec,year_all)</td>
<td>flag whether upper bound exists for new capacity</td>
</tr>
<tr class="even">
<td>is_bound_activity_up(node,tec,year_all,mode,time)</td>
<td>flag whether upper bound exists for a technology activity</td>
</tr>
<tr class="odd">
<td>is_dynamic_activity_up(node,tec,year_all,time)</td>
<td>flag whether upper dynamic constraint exists for a technology (activity)</td>
</tr>
<tr class="even">
<td>is_bound_extraction_up(node,commodity,grade,year_all)</td>
<td>flag whether upper bound exists for extraction of commodity</td>
</tr>
<tr class="odd">
<td>is_bound_new_capacity_lo(node,tec,year_all)</td>
<td>flag whether lower bound exists for new capacity</td>
</tr>
<tr class="even">
<td>is_bound_total_capacity_up(node,tec,year_all)</td>
<td>flag whether upper bound exists for total installed capacity</td>
</tr>
<tr class="odd">
<td>is_bound_total_capacity_lo(node,tec,year_all)</td>
<td>flag whether lower bound exists for total installed capacity</td>
</tr>
<tr class="even">
<td>is_dynamic_new_capacity_up(node,tec,year_all)</td>
<td>flag whether upper dynamic constraint exists for new capacity (investment)</td>
</tr>
<tr class="odd">
<td>is_dynamic_new_capacity_lo(node,tec,year_all)</td>
<td>flag whether lower dynamic constraint exists for new capacity (investment)</td>
</tr>
<tr class="even">
<td>is_dynamic_activity_lo(node,tec,year_all,time)</td>
<td>flag whether lower dynamic constraint exists for a technology (activity)</td>
</tr>
<tr class="odd">
<td>is_relation_upper(relation,node,year_all)</td>
<td>flag whether upper bounds exists for generic relation</td>
</tr>
<tr class="even">
<td>is_relation_lower(relation,node,year_all)</td>
<td>flag whether lower bounds exists for generic relation</td>
</tr>
<tr class="odd">
<td>is_bound_emission(node,type_emission,type_tec,type_year)</td>
<td>flag whether emissions bound exists</td>
</tr>
<tr class="even">
<td>is_fixed_extraction(node,commodity,grade,year_all)</td>
<td>flag whether extraction variable is fixed</td>
</tr>
<tr class="odd">
<td>is_fixed_stock(node,commodity,level,year_all)</td>
<td>flag whether stock variableis fixed</td>
</tr>
<tr class="even">
<td>is_fixed_new_capacity(node,tec,year_all)</td>
<td>flag whether new capacity variableis fixed</td>
</tr>
<tr class="odd">
<td>is_fixed_capacity(node,tec,vintage,year_all)</td>
<td>flag whether maintained capacity variableis fixed</td>
</tr>
<tr class="even">
<td>is_fixed_activity(node,tec,vintage,year_all,mode,time)</td>
<td>flag whether activity variableis fixed</td>
</tr>
</tbody>
</table>
</div>
<div id="water-energy-nexus-sets" class="section level2">
<h2>Water energy nexus sets</h2>
<table>
<thead>
<tr class="header">
<th>Sets</th>
<th>Label</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>pp_cooltech</td>
<td>Power plant cooling technologies</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="scalars" class="section level1">
<h1>Scalars</h1>
<div id="general-scalars" class="section level2">
<h2>General Scalars</h2>
<table>
<thead>
<tr class="header">
<th>Scalars</th>
<th>Label</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>s_beta</td>
<td>used for param demand calc</td>
</tr>
<tr class="even">
<td>s_elec_demand_per_year</td>
<td>GWa 55209 for 8760 # from IEA statistics</td>
</tr>
<tr class="odd">
<td>s_light_demand_per_year</td>
<td>GWa 6134 for 8760 # from IEA statistics</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="parameters" class="section level1">
<h1>Parameters</h1>
<div id="general-parameters" class="section level2">
<h2>General parameters</h2>
<table>
<thead>
<tr class="header">
<th>Parameters</th>
<th>Label</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>duration_period(year_all)</td>
<td>duration of one multi-year period (in years)</td>
</tr>
<tr class="even">
<td>duration_time(time)</td>
<td>duration of one time slice (relative to 1)</td>
</tr>
</tbody>
</table>
</div>
<div id="economic-parameters" class="section level2">
<h2>Economic parameters</h2>
<table>
<thead>
<tr class="header">
<th>Parameters</th>
<th>Label</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>interestrate(year_all)</td>
<td>Area_km2</td>
</tr>
<tr class="even">
<td>p_GDP(year_all)</td>
<td>GDP</td>
</tr>
</tbody>
</table>
</div>
<div id="resource-and-commodity-parameters" class="section level2">
<h2>Resource and commodity parameters</h2>
<table>
<colgroup>
<col width="50%" />
<col width="50%" />
</colgroup>