-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathlayout.py
342 lines (336 loc) · 12.9 KB
/
layout.py
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
import dash_html_components as html
import dash_core_components as dcc
from globals import SAMPLE_RELIABILITY_EXPONENTS,DEFAULT_PEAK_CAPACITY,DEFAULT_DAILY_LOAD,DEFAULT_SOLAR_DERATE,DEFAULT_BATTERY_LIFETIME,DEFAULT_CURRENCY,DEFAULT_BATTERY_COST,DEFAULT_SOLAR_COST,DEFAULT_CHARGE_CONTROLLER_COST,DEFAULT_CAPACITY_COST,DEFAULT_FIXED_COST,DEFAULT_OM_FACTOR,DEFAULT_TERM,DEFAULT_DISCOUNT_RATE,MAPBOX_TOKEN
from utilities import getReliabilityValue
from descriptionText import topText, guideText, researchersText
parameterSectionTechnicalItems=[
html.H3('Technical'),
html.Hr(),
html.Div(
#className='row col-sm-12',
children=[
html.Label('Target reliability (Fraction of Demand Served)'),
html.Div(children=[dcc.Slider(
id='sliderReliability',
min=SAMPLE_RELIABILITY_EXPONENTS[0],
max=SAMPLE_RELIABILITY_EXPONENTS[-1],
value=3,
step=1,
marks={str(r): '{:0.2f}'.format(getReliabilityValue(r)*100) for r in SAMPLE_RELIABILITY_EXPONENTS[::2]}
)],style={'padding-bottom':20,'padding-left':10,'padding-right':10}),
html.Div(id='dispReliabilityValue')
]
),
html.Div(
className='row',
children=[
html.Div(html.Label('Daily Load (kWh/day)'),className='col-lg-6'),
html.Div(dcc.Input(
id='inputDailyLoad',type='number',value=DEFAULT_DAILY_LOAD
),className='col-lg-6')
]
),
html.Div(
className='row',
children=[
html.Div(html.Label('Peak Capacity (kW)'),className='col-lg-6'),
html.Div(dcc.Input(
id='inputPeakCapacity',type='number',value=DEFAULT_PEAK_CAPACITY
),className='col-lg-6')
]
),
html.Div(
className='row',
children=[
html.Div(html.Label('Solar Derating (%)'),className='col-lg-6'),
html.Div(dcc.Input(
id='inputSolarDerate',type='number',value=DEFAULT_SOLAR_DERATE,
min=0,max=100
),className='col-lg-6')
]
),
html.Div(
className='row',
children=[
html.Div(html.Label('Battery Lifetime (yrs)'),className='col-lg-6'),
html.Div(dcc.Input(
id='inputBatteryLifetime',type='number',value=DEFAULT_BATTERY_LIFETIME
),className='col-lg-6')
]
),
html.Div(
className='row',
children=[
html.Div(html.Label('Daily load profile'),className='col-lg-6'),
html.Div(dcc.Dropdown(
id='inputLoadProfileName',
options=[
{'label': 'Constant', 'value': 'constant'},
{'label': 'Uganda Mini-grid', 'value': 'representative'},
{'label': 'Day Heavy', 'value': 'dayHeavy'},
{'label': 'Night Heavy', 'value': 'nightHeavy'},
{'label': 'Small India', 'value': 'smallIndia'},
{'label': 'Medium Households', 'value': 'mediumHouseholds'},
{'label': 'South African Grid Connected', 'value': 'saGrid'},
{'label': 'Zimbabwe', 'value': 'loadZim'},
{'label': 'Homes Plus Businesses', 'value': 'homeBusiness'},
{'label': 'Only Businesses', 'value': 'onlyBusinesses'}
],
value='constant'
),className='col-lg-6')
]
),
html.Div(
className='row',
children=[
dcc.Graph(
id='graphLoadProfiles',
figure={
'data': [],
'layout': {}
},
config={'displayModeBar': False}
)
]
)
]
parameterSectionEconomicItems=[
html.H3('Economic'),
html.Hr(),
html.Div(
className='row',
children=[
html.Div(html.Label('Currency'),className='col-lg-6'),
html.Div(dcc.Input(
id='inputCurrency',type='text',value=DEFAULT_CURRENCY
),className='col-lg-6')
]
),
html.Div(
className='row',
children=[
html.Div(html.Label(id='labelBatteryCost'),className='col-lg-6'),
html.Div(dcc.Input(
id='inputBatteryCost',type='number',value=DEFAULT_BATTERY_COST
),className='col-lg-6')
]
),
html.Div(
className='row',
children=[
html.Div(html.Label(id='labelSolarCost'),className='col-lg-6'),
html.Div(dcc.Input(
id='inputSolarCost',type='number',value=DEFAULT_SOLAR_COST
),className='col-lg-6')
]
),
html.Div(
className='row',
children=[
html.Div(html.Label(id='labelChargeControllerCost'),className='col-lg-6'),
html.Div(dcc.Input(
id='inputChargeControllerCost',type='number',
value=DEFAULT_CHARGE_CONTROLLER_COST
),className='col-lg-6')
]
),
html.Div(
className='row',
children=[
html.Div(html.Label(id='labelCapacityCost'),className='col-lg-6'),
html.Div(dcc.Input(
id='inputCapacityCost',type='number',value=DEFAULT_CAPACITY_COST
),className='col-lg-6')
]
),
html.Div(
className='row',
children=[
html.Div(html.Label(id='labelFixedCost'),className='col-lg-6'),
html.Div(dcc.Input(
id='inputFixedCost',type='number',value=DEFAULT_FIXED_COST
),className='col-lg-6')
]
),
html.Div(
className='row',
children=[
html.Div(html.Label('Operations and Maintenance Factor (% of total capital cost)'),className='col-lg-6'),
html.Div(dcc.Input(
id='inputOMFactor',type='number',value=DEFAULT_OM_FACTOR
),className='col-lg-6')
]
),
html.Div(
className='row',
children=[
html.Div(html.Label('Project Term (yrs)'),className='col-lg-6'),
html.Div(dcc.Input(
id='inputTerm',type='number',value=DEFAULT_TERM
),className='col-lg-6')
]
),
html.Div(
className='row',
children=[
html.Div(html.Label('Discount Rate (%)'),className='col-lg-6'),
html.Div(dcc.Input(
id='inputDiscountRate',type='number',value=DEFAULT_DISCOUNT_RATE,
min=0,max=100
),className='col-lg-6')
]
)
]
parameterSectionItems=[
html.H2('Parameters'),
html.Hr(),
html.Button(id='buttonUpdateMap', n_clicks=0, children='Update Graph', className="btn btn-primary"),
html.Hr(),
html.Div(
className='row',
children=[
html.Div(
children=parameterSectionTechnicalItems,
className="col-lg-6"
),
html.Div(
children=parameterSectionEconomicItems,
className="col-lg-6"
)
]
),
html.Hr(),
html.Button(id='buttonUpdateMap2', children='Update Map', className="btn btn-primary")
]
layout = html.Div(
className='container-fluid',
children=[
html.Div(
className='row col-xs-12',
children=[
html.H1('Estimated Cost of Electricity and Reliability for Decentralized Solar Power Systems in sub-Saharan Africa'),
html.H3('[Beta Version]'),
html.Hr()
]
),
html.Div(
className='row col-xs-12',
children=[
dcc.Markdown(topText),
html.Hr()
]
),
html.Div(
className='row',
children=[
html.Div(
className='col-lg-7 col-md-5',
children=parameterSectionItems
),
html.Div(
className='col-lg-5 col-md-7',
children=[
html.H2('Map of levelized cost of electricity (LCOE)'),
dcc.Graph(
id='map',
#animate=True,
figure = {
'data': []#,
# 'layout': {
# 'mapbox': {
# 'layers': [],
# 'accesstoken': MAPBOX_TOKEN,
# 'center': {
# 'lat': 0,
# 'lon': 20,
# },
# 'zoom': 2,
# 'pitch': 0
# }
# }
},
config = {
#'modeBarButtonsToAdd': ['zoom2d'],
'modeBarButtonsToRemove': ['toggleHover','sendDataToCloud']
}
),
html.A(
html.Button('Download Map Data as CSV',className='btn btn-primary'),
id='downloadLinkMap',
download="rawdata.csv",
href="",
target="_blank"
),
dcc.Graph(id='selectedDataReliabilityScaling'),
html.A(
html.Button(
'Download LCOE vs. Reliability as CSV',
className='btn btn-primary',
),
id="downloadLinkLCOE",
download="LCOEByReliability.csv",
href="",
target="_blank"
)
]
)
]
),
html.Hr(),
html.Div(
id='quickGuide',
className='row col-xs-12',
children=[
dcc.Markdown(guideText),
html.H3('Load Profiles'),
html.Div('We have provided a collection of sample average daily load profiles that result in different model outputs. Some are empirically measured and others are estimated or constructed, as described below:'),
html.Table(
[
html.Thead(html.Tr([
html.Th('Daily Load Profile'),
html.Th('Source'),
html.Th('Description')
])),
html.Tbody([html.Tr([
html.Td('Constant'),
html.Td('N/A'),
html.Td('Constant demand. Unrealistic but simple, and evenly distributes load between nighttime and daytime hours')
]),
html.Tr([
html.Td('Uganda Mini-grid'),
html.Td(html.A('New Sun Road, P.B.C', href='https://www.newsunroad.com', target='_blank')),
html.Td('Empirical demand from a village of 34 small business on an island in Lake Victoria, Uganda')
]),
html.Tr([
html.Td('Day Heavy'),
html.Td('N/A'),
html.Td('All demand during the hours of 06:00 and 18:00 to represent an extreme case of demand only during the day, which requires very little storage')
]),
html.Tr([
html.Td('Night Heavy'),
html.Td('N/A'),
html.Td('All demand during the hours of 18:00 and 06:00 to represent an extreme case of demand only during the night, which requires a large amount of energy storage.. Comparing this with Day Heavy gives some idea of the costs associated with storage and value of shifting load to the day')
]),
html.Tr([
html.Td('Small India'),
html.Td('[...]'),
html.Td('[...]')
])])
],
className='table table-striped table-bordered'
),
html.Hr()
]
),
html.Div(
id='people',
className='row col-xs-12',
children=dcc.Markdown(researchersText)
),
html.Hr(),
html.Div(
className='row col-xs-12',
children=dcc.Markdown('© Jonathan Lee, 2018')
)
]
)