inputDataAdjustments.gms 9.44 KB
Newer Older
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
$ontext
Supplementary tool for backbone energy building model
We read inputData.gdx and write inputDataAdjusted<x>.gdx, e.g. inputDataAdjusted1.gdx

inputDataAdjusted1.gdx
- New lower and upper temperature limits
- Elspot prices 2013

2021-12-28 Toni Lastusilta (VTT)
$offtext

* Create elspot_prices_2013.gdx from elspot-prices_2013_hourly_eur_TL_v1.xlsx
$if 1==0 $call gams input/elspot_price_xls2gdx.gms

*Use backbone definition of sets and parameters
$if not set input_dir $setglobal input_dir 'input'
$if not set output_dir $setglobal output_dir 'output'
$if not set input_file_gdx $setglobal input_file_gdx 'inputData.gdx'
$if not set input_excel_index $setglobal input_excel_index 'INDEX'
$if not set input_excel_checkdate $setglobal input_excel_checkdate ''
* Activate end of line comments and set comment character to '//'
$oneolcom
$eolcom //
$onempty   // Allow empty data definitions
* === Definitions, sets, parameters and input data=============================
$include 'inc/1a_definitions.gms'   // Definitions for possible model settings
$include 'inc/1b_sets.gms'          // Set definitions used by the models
$include 'inc/1c_parameters.gms'    // Parameter definitions used by the models


*Read data from inputData.gdx
$onmultiR
$gdxIn input\inputData.gdx
$load grid node unit unittype unitUnittype effLevelGroupUnit
$offmulti
$load ts_influx p_gnBoundaryPropertiesForStates p_gnu_io p_gn p_unit p_gnn p_s_discountFactor
$gdxin

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
* Adding exogenous commodity electricity prices : ts_priceElspot
Set
  tsIso Time-stamp in ISO8601 format
;
Parameters
 elspotIsoBB(t,tsIso)     "Elspot Prices_2013 (EUR/MWh) with backbone timestamp and ISO date"
 ts_priceElspotNP(t)      "Elspot NordPool Prices_2013 (EUR/MWh)"
 ts_priceElspot(t)        "Elspot Prices_2013 inc. tarifs and taxes (EUR/MWh)"
 ts_priceElspot_backup(t) "Elspot Prices_2013 inc. tarifs and taxes (backup) (EUR/MWh)"
;
$gdxIn input\elspot_prices_2013.gdx
$load tsIso elspotIsoBB ts_priceElspotNP=elspotBB
$gdxin
* Add taxes Shk snt/kWh  veroluokka I : 2,253 snt/kWh --> 22,53 /MWh
* https://www.vero.fi/yritykset-ja-yhteisot/verot-ja-maksut/valmisteverotus/sahkovero/verotaulukot/
* Considering Lumo tarif:  Margin call: 0,24 snt/kWh + Basic fee 1,90 /month
* Ignoring basic fee: 0,24 snt/kWh --> 2,4 /MWh
* https://www.sahkon-kilpailutus.fi/en/market-electricity-price/
ts_priceElspot(t)$ts_priceElspotNP(t)=ts_priceElspotNP(t) + 22.53 + 2.4 ;
ts_priceElspot_backup(t)=ts_priceElspot(t);


*Settings
Parameter p_price_el_select "Use flat price 1 EUR/MWh (set 0). Use elspot price (set 1)" /1/;

if(0=p_price_el_select,
     ts_priceElspot(t)=1$ts_priceElspot(t);
   elseif 1=p_price_el_select,
     ts_priceElspot(t)=ts_priceElspot(t);
   else
     abort "Error, invalid value for p_price_el_select, set 0 or 1";
);

72
* Modify Input (optional)
73
Parameters
74
75
76
  modify_input      "Modify input (0=no, 1=yes: to set new limits)"                     / 1      /
  c2k               "Convert celcius to kelvin degrees"                                 / 275.15 /
;
77
display unit;
78
Sets
Toni's avatar
Toni committed
79
 dir   "Direction: lo ,reference ,up"           / lo, ref, up/
80
 place "Measurement place in building"          / interior_air_and_furniture, internal_mass, envelope_mass, DHWT  /
Toni's avatar
Toni committed
81
82
 node_building                                  / IDA_ESBO_DH1, IDA_ESBO_DH2, IDA_ESBO_AB  /
 node_building_interior_air_and_furniture(node) / "IDA_ESBO_DH1.interior_air_and_furniture", "IDA_ESBO_DH2.interior_air_and_furniture", "IDA_ESBO_AB.interior_air_and_furniture" /
83
84
85
86
87
88
89
90
 node_building_internal_mass(node)              / "IDA_ESBO_DH1.internal_mass", "IDA_ESBO_DH2.internal_mass", "IDA_ESBO_AB.internal_mass" /
 node_building_envelope_mass(node)              / "IDA_ESBO_DH1.envelope_mass", "IDA_ESBO_DH2.envelope_mass", "IDA_ESBO_AB.envelope_mass" /
 node_building_DHWT(node)                       / "IDA_ESBO_DH1.DHWT1000", "IDA_ESBO_DH2.DHWT1000", "IDA_ESBO_AB.DHWT1000" /
 node_building2node(node_building,node)         /
  IDA_ESBO_DH1.("IDA_ESBO_DH1.interior_air_and_furniture", "IDA_ESBO_DH1.internal_mass", "IDA_ESBO_DH1.envelope_mass" ,"IDA_ESBO_DH1.DHWT1000")
  IDA_ESBO_DH2.("IDA_ESBO_DH2.interior_air_and_furniture", "IDA_ESBO_DH2.internal_mass", "IDA_ESBO_DH2.envelope_mass" ,"IDA_ESBO_DH2.DHWT1000")
  IDA_ESBO_AB .("IDA_ESBO_AB.interior_air_and_furniture" , "IDA_ESBO_AB.internal_mass" , "IDA_ESBO_AB.envelope_mass"  ,"IDA_ESBO_AB.DHWT1000")
 /
91
92
93
94
 unit_heat(unit) /
 "IDA_ESBO_DH1.ideal_heating", "IDA_ESBO_DH2.ideal_heating", "IDA_ESBO_AB.ideal_heating"
 /
 unit_cool(unit) /
95
96
97
98
99
 "IDA_ESBO_DH1.ideal_cooling", "IDA_ESBO_DH2.ideal_cooling", "IDA_ESBO_AB.ideal_cooling"
 /
 unit_DHW(unit)                                 /
 "IDA_ESBO_DH1.ideal_DHW", "IDA_ESBO_DH2.ideal_DHW", "IDA_ESBO_AB.ideal_DHW"
 /
100
101
102
103
 unit_heat_and_cool(unit)                       /
 "IDA_ESBO_DH1.ideal_heating", "IDA_ESBO_DH2.ideal_heating", "IDA_ESBO_AB.ideal_heating",
 "IDA_ESBO_DH1.ideal_cooling", "IDA_ESBO_DH2.ideal_cooling", "IDA_ESBO_AB.ideal_cooling"
 /
104
105
106
107
108
109
 node_building2unit(node_building,unit)         /
 IDA_ESBO_DH1.("IDA_ESBO_DH1.ideal_heating","IDA_ESBO_DH1.ideal_cooling","IDA_ESBO_DH1.ideal_DHW")
 IDA_ESBO_DH2.("IDA_ESBO_DH2.ideal_heating","IDA_ESBO_DH2.ideal_cooling","IDA_ESBO_DH2.ideal_DHW")
 IDA_ESBO_AB .("IDA_ESBO_AB.ideal_heating" ,"IDA_ESBO_AB.ideal_cooling" ,"IDA_ESBO_AB.ideal_DHW")
 /
;
Toni's avatar
Toni committed
110
111
112
113
114
Table
  temp(place,dir)   "Limit temperatures in Celcius"
                             lo      ref        up
interior_air_and_furniture   20      20         24
internal_mass                20      20         24
115
envelope_mass                -90     20         50
116
DHWT                         60      60         80
117
118
;

Toni's avatar
Toni committed
119
120
121
122
123
124
Parameter building_squares (node_building) Building square meters /
"IDA_ESBO_DH1"  135.56
"IDA_ESBO_DH2"  145.33
"IDA_ESBO_AB"  1608.19
/;

125
126
if(modify_input=1,
* Defintion: p_gnBoundaryPropertiesForStates(grid,node,param_gnBoundaryTypes,param_gnBoundaryProperties)
Toni's avatar
Toni committed
127
  display grid,node,node_building_DHWT,node_building_envelope_mass,node_building_interior_air_and_furniture,node_building_internal_mass,param_gnBoundaryTypes,param_gnBoundaryProperties,p_gnBoundaryPropertiesForStates;
128
129
* Set temperature (Celcius) limits for building_interior_air_and_furniture in Celcius
  p_gnBoundaryPropertiesForStates('building',node_building_interior_air_and_furniture,'downwardLimit','constant') = c2k + temp('interior_air_and_furniture' ,'lo');
130
131
  p_gnBoundaryPropertiesForStates('building',node_building_interior_air_and_furniture,'reference','constant')     = c2k + temp('interior_air_and_furniture' ,'ref');
  p_gnBoundaryPropertiesForStates('building',node_building_interior_air_and_furniture,'upwardLimit','constant')   = c2k + temp('interior_air_and_furniture' ,'up');
132
133
* Set temperature (Celcius) limits for building_internal_mass in Celcius
  p_gnBoundaryPropertiesForStates('building',node_building_internal_mass,'downwardLimit','constant') = c2k + temp('internal_mass','lo');
134
135
  p_gnBoundaryPropertiesForStates('building',node_building_internal_mass,'reference','constant')     = c2k + temp('internal_mass','ref');
  p_gnBoundaryPropertiesForStates('building',node_building_internal_mass,'upwardLimit','constant')   = c2k + temp('internal_mass','up');
136
137
* Set temperature limits for building_envelope_mass in Celcius
  p_gnBoundaryPropertiesForStates('building',node_building_envelope_mass,'downwardLimit','constant') = c2k + temp('envelope_mass' ,'lo ');
138
139
  p_gnBoundaryPropertiesForStates('building',node_building_envelope_mass,'reference','constant')     = c2k + temp('envelope_mass' ,'ref');
  p_gnBoundaryPropertiesForStates('building',node_building_envelope_mass,'upwardLimit','constant')   = c2k + temp('envelope_mass' ,'up');;
Toni's avatar
Toni committed
140
141
* Set temperature limits for Domestic Hot Water Tank (DHWT)
  p_gn(grid, node_building_DHWT, 'boundStart') = 1;
142
  p_gnBoundaryPropertiesForStates('building',node_building_DHWT,'reference','useConstant')  = 1;
Toni's avatar
Toni committed
143
  p_gnBoundaryPropertiesForStates('building',node_building_DHWT,'downwardLimit','constant') = c2k + temp('DHWT' ,'lo');
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
  p_gnBoundaryPropertiesForStates('building',node_building_DHWT,'reference','constant')     = c2k + temp('DHWT' ,'ref');
  p_gnBoundaryPropertiesForStates('building',node_building_DHWT,'upwardLimit','constant')   = c2k + temp('DHWT' ,'up');
* Set electricity price with ts_node modifier
  p_gnBoundaryPropertiesForStates('elec', 'link_node', 'balancePenalty', 'useTimeSeries') = 1 ;
  p_gnBoundaryPropertiesForStates('elec', 'link_node', 'balancePenalty', 'useConstant')   = 0 ;
  p_gnBoundaryPropertiesForStates('elec', 'link_node', 'balancePenalty', 'constant')      = 0 ;
  ts_node(grid, node, 'balancePenalty', f, t) = 1E9;
  ts_node('elec', 'link_node', 'balancePenalty', f, t) = ts_priceElspot(t);
$ontext
  POSSIBLE BUG
  See 1e_inputs.gms lines:
gn_state(grid, node)${  gn_stateSlack(grid, node)
                        or p_gn(grid, node, 'energyStoredPerUnitOfState')
                        or sum((stateLimits, useConstantOrTimeSeries), p_gnBoundaryPropertiesForStates(grid, node, stateLimits, useConstantOrTimeSeries))
                        or sum(useConstantOrTimeSeries, p_gnBoundaryPropertiesForStates(grid, node, 'reference', useConstantOrTimeSeries))
                        }
    = yes;

   Issue: Using 'balancePenalty' does not affect gn_state !
$offtext
* Work around
  p_gnBoundaryPropertiesForStates('elec', 'link_node','upwardLimit','useTimeSeries') = 1E50;
166
167
) ;

168
169
170
171
172
* Adding temperature data
Parameter
  temp_out(t) "Outside temperature (C)";
execute_load "input\ambient_temp_2012.gdx" temp_out;

173
174
175
* Write input with domains at execution time to take in consideration modifications
execute_unloaddi "input\inputDataAdjusted1.gdx";