-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlayout.py
728 lines (660 loc) · 25.5 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
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
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import numpy as np
import plotly.graph_objs as go
from dash.dependencies import Input, Output
import base64
# Import backend simulation
from sim_storage import storage_calc
from sim_water_lighting import water_price, greenhouse_transmissivity
from sim_water_lighting import amb_light, deficiency, Light_Sel, TOU_ON, Ambient_Switching
from sim_final_profiles import final_day_profile
"""
Notes:
Current this version uses dummy data to plot monthly energy savings and peaks
"""
app = dash.Dash(external_stylesheets=[dbc.themes.MINTY])
# Insert greenhouse structure picture
GREENHOUSE_PIC = 'figures/footprint_greenhouse.png'
test_base64 = base64.b64encode(open(GREENHOUSE_PIC, 'rb').read()).decode('ascii')
# Control Panel 1: Greenhouse Structure
controls1 = dbc.Card(
[
dbc.FormGroup(
[
dbc.Label("Greenhouse Structure"),
dcc.Dropdown(
id="structure-dropdown",
options=[
{'label': 'A-frame', 'value': 'A-frame'},
{'label': 'Quonset', 'value': 'Quonset'}
],
value="A-frame",
),
]
),
dbc.FormGroup(
[
dbc.Label("Length A"),
dbc.Input(id="length-A", type="number", placeholder="Enter length"),
]
),
dbc.FormGroup(
[
dbc.Label("Length B"),
dbc.Input(id="length-B", type="number", placeholder="Enter length"),
]
),
dbc.FormGroup(
[
dbc.Label("Length C"),
dbc.Input(id="length-C", type="number", placeholder="Enter length"),
]
),
dbc.FormGroup(
[
dbc.Label("Length D"),
dbc.Input(id="length-D", type="number", placeholder="Enter length"),
]
),
dbc.FormGroup(
[
dbc.Label("Length E"),
dbc.Input(id="length-E", type="number", placeholder="Enter length"),
]
),
],
body=True,
color='light'
)
# Control Panel 2: crop, lighting, photo period start, end
controls2 = dbc.Card(
[
# Crop Type
dbc.FormGroup(
[
dbc.Label("Crop Type"),
dcc.Dropdown(
id="crop-dropdown",
options=[
{'label': 'Tomato', 'value': 'Tomato'},
{'label': 'Pepper', 'value': 'Pepper'},
{'label': 'Cucumber', 'value': 'Cucumber'},
{'label': 'Cannabis', 'value': 'Cannabis'}
],
value="Tomato",
),
]
),
# Photoperiod Start Time
dbc.FormGroup(
[
dbc.Label("Photoperiod Start Time"),
dcc.Dropdown(
id="photoperiod-start-dropdown",
options=[
{'label': '1 AM', 'value': 1},
{'label': '2 AM', 'value': 2},
{'label': '3 AM', 'value': 3},
{'label': '4 AM', 'value': 4},
{'label': '5 AM', 'value': 5},
{'label': '6 AM', 'value': 6},
{'label': '7 AM', 'value': 7},
{'label': '8 AM', 'value': 8},
{'label': '9 AM', 'value': 9},
{'label': '10 AM', 'value': 10},
{'label': '11 AM', 'value': 11},
{'label': '12 PM', 'value': 12},
],
value=6,
),
]
),
# Photoperiod End Time
dbc.FormGroup(
[
dbc.Label("Photoperiod End Time"),
dcc.Dropdown(
id="photoperiod-end-dropdown",
options=[
{'label': '1 PM', 'value': 13},
{'label': '2 PM', 'value': 14},
{'label': '3 PM', 'value': 15},
{'label': '4 PM', 'value': 16},
{'label': '5 PM', 'value': 17},
{'label': '6 PM', 'value': 18},
{'label': '7 PM', 'value': 19},
{'label': '8 PM', 'value': 20},
{'label': '9 PM', 'value': 21},
{'label': '10 PM', 'value': 22},
{'label': '11 PM', 'value': 23},
{'label': '12 AM', 'value': 24},
],
value=18,
),
]
),
],
body=True,
color='light'
)
# Control Panel 3: heating fuel, heater, wall material, window material
controls3 = dbc.Card(
[
# Heating Fuel Type
dbc.FormGroup(
[
dbc.Label("Heating Fuel Type"),
dcc.Dropdown(
id="fuel-dropdown",
options=[
{'label': 'Natural Gas', 'value': 'Natural Gas'},
{'label': 'Oil 2', 'value': 'Oil 2'},
{'label': 'Oil 4', 'value': 'Oil 4'},
{'label': 'Propane', 'value': 'Propane'},
{'label': 'Electricity', 'value': 'Electricity'},
{'label': 'Butane', 'value': 'Butane'},
{'label': 'Kerosene', 'value': 'Kerosene'},
],
value="Natural Gas",
),
]
),
# Wall Material (The model assumed a fixed wall and window ratio)
dbc.FormGroup(
[
dbc.Label("Material (Conduction)"),
dcc.Dropdown(
id="material-conduction-dropdown",
options=[
{'label': 'Corrugated Polycarbonate', 'value': 'Corrugated Polycarbonate'},
{'label': 'Glass', 'value': 'Glass'},
{'label': 'Glass - Double Layer', 'value': 'Glass - Double Layer'},
{'label': 'Fiber Glass', 'value': 'Fiber Glass'},
{'label': 'Polyethylene', 'value': 'Polyethylene'},
{'label': 'Polyethylene - Double Layer', 'value': 'Polyethylene - Double Layer'},
{'label': 'Polycarbonate Bi-Wall', 'value': 'Polycarbonate Bi-Wall'},
{'label': 'Polycarbonate Tri-Wall', 'value': 'Polycarbonate Tri-Wall'},
{'label': 'Acrylic Bi-Wall', 'value': 'Acrylic Bi-Wall'},
{'label': 'IR Film', 'value': 'IR Film'},
{'label': 'IR Film - Double Layer', 'value': 'IR Film - Double Layer'},
{'label': 'Concrete Block', 'value': 'Concrete Block'},
{'label': 'Concrete Poured', 'value': 'Concrete Poured'},
{'label': 'Concrete Insulated', 'value': 'Concrete Insulated'},
{'label': 'Solid Insulation Foam', 'value': 'Solid Insulation Foam'},
],
value="Glass",
),
]
),
# Window Material (The model assumed a fixed wall and window ratio)
dbc.FormGroup(
[
dbc.Label("Material (Convection)"),
dcc.Dropdown(
id="material-convection-dropdown",
options=[
{'label': 'Mobile Air Curtain', 'value': 'Mobile Air Curtain'},
{'label': 'Stationary Air Curtain', 'value': 'Stationary Air Curtain'},
{'label': 'White Spun Bonded Polyolefin Film', 'value': 'White Spun Bonded Polyolefin Film'},
{'label': 'Grey Spun Bonded Polyolefin Film', 'value': 'Grey Spun Bonded Polyolefin Film'},
{'label': 'Clear Polyethylene', 'value': 'Clear Polyethylene'},
{'label': 'Black Polyethylene', 'value': 'Black Polyethylene'},
{'label': 'Grey Spun Bonded Polyolefin Film (Heavy)', 'value': 'Grey Spun Bonded Polyolefin Film (Heavy)'},
{'label': 'Aluminum - Clear Vinyl Fabric', 'value': 'Aluminum - Clear Vinyl Fabric'},
{'label': 'Aluminized Fabric', 'value': 'Aluminized Fabric'},
{'label': 'Aluminum - Black Vinyl Fabric', 'value': 'Aluminum - Black Vinyl Fabric'},
{'label': 'Double Layer Spun Bonded Polyester', 'value': 'Double Layer Spun Bonded Polyester'},
],
value="Clear Polyethylene",
),
]
),
],
body=True,
color='light'
)
# Control Panel 4: Energy Storage Related
controls4 = dbc.Card(
[
# Energy Storage Type
dbc.FormGroup(
[
dbc.Label("Energy Storage Type"),
dcc.Dropdown(
id="energy-storage-type-dropdown",
options=[
{'label': 'Lithium Ion Batteries', 'value': 'Lithium Ion'},
{'label': 'Lead Acid Batteries', 'value': 'Lead Acid'},
{'label': 'Alkaline Batteries', 'value': 'Alkaline'},
{'label': 'Compressed Air', 'value': 'Compressed Air'},
{'label': 'Nickel Cadmium Batteries', 'value': 'Nickel Cadmium'},
],
value="Lithium Ion",
),
]
),
# Energy Storage Calculation Method
dbc.FormGroup(
[
dbc.Label("Optimisation Objective for Energy Storage Calculations"),
dcc.Dropdown(
id="optimisation-dropdown",
options=[
{'label': 'Minimize Cost', 'value': 'cost'},
{'label': 'Flatten Electricity Peak', 'value': 'profile'}
],
value='cost',
),
],
),
# Energy Storage Power Specification
dbc.FormGroup(
[
dbc.Label("Power Capacity (kW)"),
dbc.Input(id="power-capacity", type="number", placeholder="Enter Power Capacity"),
]
),
# Energy Storage Energy Specification
dbc.FormGroup(
[
dbc.Label("Energy Capacity (kWh)"),
dbc.Input(id="energy-capacity", type="number", placeholder="Enter Energy Capacity"),
],
),
],
body=True,
color='light',
)
# Display info for lighting, photoperiod and water
lighting_card = dbc.Card(
dbc.CardBody([
html.H4("Lighting Recommendation", className="card-title"),
html.H4(),
html.H5("None", className="card-subtitle", id = 'light-choice'),
html.H4(),
html.H5("None", className="card-subtitle", id = 'light-upfront-cost'),
html.H4(),
html.H5("None", className="card-subtitle", id = 'light-fixture-est'),
html.H4(),
html.H5("None", className="card-subtitle", id = 'hourly-elec-consumption'),
html.H4(),
html.H5("None", className="card-subtitle", id = 'light-annual-cost'),
html.H4(),
html.H5("None", className="card-subtitle", id = 'light-energy-savings'),
]),
color="primary",
inverse=True
)
water_card = dbc.Card(
dbc.CardBody([
html.H4("PPFD", className="card-title"),
html.H4(),
html.H5("None", className="card-subtitle", id = 'light-max-PPFD'),
html.H4(),
html.H5("None", className="card-subtitle", id = 'light-min-PPFD'),
html.Br(),
html.H4("Water Usage", className="card-title"),
html.H4(),
html.H5("None", className="card-subtitle", id = 'water-consumption'),
html.H4(),
html.H5("None", className="card-subtitle", id = 'water-cost'),
]),
color="primary",
inverse=True
)
# Create months for slider
month_array = np.arange(1, 13, 1)
# Define website layout
app.layout = dbc.Container(
[
html.H1("OK Bloomer"),
html.H2("A Decision Support Tool for Greenhouse Design"),
html.Hr(),
html.H2("User Inputs:"),
dbc.Row(
[
dbc.Col(controls2, md=2),
dbc.Col(controls3, md=2),
dbc.Col(controls4, md=3),
dbc.Col(controls1, md=2),
dbc.Col(html.Img(src='data:image/png;base64,{}'.format(test_base64)), md=2),
],
),
html.Hr(),
html.H2("Simulation Outputs:"),
dbc.Row(
[
dbc.Col(id='lighting_card', children=[lighting_card], md=6),
dbc.Col(id='water_card', children=[water_card], md=6)
]
),
html.H2(),
#html.H3("Energy Storage"),
# Output graphs
# Electricity and energy profiles
dbc.Row(
[
dbc.Col([dcc.Graph(id="daily-energy-demand"),
dcc.Slider(
id='month-slider',
min=month_array.min(),
max=month_array.max(),
value=month_array.min(),
marks={str(month): str(month) for month in month_array},
step=None)
], md=6),
dbc.Col(dcc.Graph(id="monthly-electricity-peaks"), md=6),
],
align="center",
),
# Energy storage calculations
dbc.Row(
[
dbc.Col(dcc.Graph(id="monthly-electricity-savings"), md=6),
dbc.Col(dcc.Graph(id="monthly-GHG-emission"), md=6)
],
align="center",
),
],
fluid=True,
)
# Callback functions
@app.callback(
[Output('hourly-elec-consumption', 'children'),
Output('light-annual-cost', 'children'),
Output('light-energy-savings', 'children'),
Output('light-choice', 'children'),
Output('light-upfront-cost', 'children'),
Output('light-fixture-est', 'children'),
Output('light-max-PPFD', 'children'),
Output('light-min-PPFD', 'children'),
Output('water-consumption', 'children'),
Output('water-cost', 'children')],
[Input('structure-dropdown', 'value'),
Input('length-A', 'value'),
Input('length-B', 'value'),
Input('length-C', 'value'),
Input('length-D', 'value'),
Input('length-E', 'value'),
Input('crop-dropdown', 'value'),
Input('photoperiod-start-dropdown', 'value'),
Input('photoperiod-end-dropdown', 'value'),
Input('material-conduction-dropdown', 'value'),
])
def display_single_values(structure_type, a, b, c, d, e, crop_type, photo_start, photo_end, window_material):
# Wait for users to reach
if structure_type is None:
structure_type = 'A-frame'
if a is None:
a = 10
if b is None:
b = 10
if c is None:
c = 10
if d is None:
d = 10
if e is None:
e = 10
if crop_type is None:
crop_type = 'Tomato'
if photo_start is None:
photo_start = 6
if photo_end is None:
photo_end = 19
if window_material is None:
window_material = 'Glass'
# Calculate surface area
if structure_type == 'A-frame':
area = np.round(2*(a*c + b*c + e*b + a*d), 2)
elif structure_type == 'Quonset':
area = np.round((a*b)*np.pi/2 + (np.power(a,2))*np.pi/4, 2)
# Function calls to backend
plant_num, cost_min, cost_max, wmin_req, wmax_req = water_price(area, crop_type)
water_consumption = 'Daily water requirement: {} - {}L'.format(wmin_req, wmax_req) # return water_consumption
water_cost = water_cost = 'Daily water cost: ${} - ${}'.format(cost_min, cost_max)
trans = greenhouse_transmissivity(window_material)
array, PPFD_max, PPFD_avg = amb_light(trans)
photo = photo_end - photo_start
crop_PPFDmin, crop_PPFDmax = deficiency(array, crop_type, photo)
max_PPFD = 'Maximum PPFD Requirement: {} Micromols/m\u00b2/s'.format(crop_PPFDmax)
min_PPFD = 'Minimum PPFD Requirement: {} Micromols/m\u00b2/s'.format(crop_PPFDmin)
final_pick, light_num, upfront_cost, consumption_kwh = Light_Sel(crop_PPFDmin, crop_PPFDmax, photo, plant_num)
light_choice = 'Recommended light choice: {}'.format(final_pick)
light_upfront_cost = "Estmated upfront cost: ${}".format(int(upfront_cost))
fixtures_est = 'Estimated fixtures: {}'.format(int(light_num))
hourly_elec_consumption = 'Total hourly electricity consumption: {} kWh'.format(np.round(consumption_kwh, 2))
sum_year, win_year, total_annualcost, kwh_year = TOU_ON(photo_start, photo_end, consumption_kwh, photo)
light_annual_cost = 'Annual lighting electricity cost: ${}'.format(np.round(total_annualcost, 2))
energy_savings = Ambient_Switching(crop_PPFDmin, trans, consumption_kwh)
light_energy_savings = 'Energy savings if light are stragically shut off: {} kWh'.format(np.round(energy_savings, 2))
return hourly_elec_consumption, light_annual_cost, light_energy_savings, light_choice, light_upfront_cost, fixtures_est, max_PPFD, min_PPFD, water_consumption, water_cost
# Big Boi
@app.callback(
[Output('daily-energy-demand', 'figure'),
Output('monthly-electricity-savings', 'figure'),
Output('monthly-electricity-peaks', 'figure'),
Output('monthly-GHG-emission', 'figure')],
[Input('month-slider', 'value'),
Input('structure-dropdown', 'value'),
Input('length-A', 'value'),
Input('length-B', 'value'),
Input('length-C', 'value'),
Input('length-D', 'value'),
Input('length-E', 'value'),
Input('crop-dropdown', 'value'),
Input('photoperiod-start-dropdown', 'value'),
Input('photoperiod-end-dropdown', 'value'),
Input('fuel-dropdown', 'value'),
Input('material-conduction-dropdown', 'value'),
Input('material-convection-dropdown', 'value'),
Input('energy-storage-type-dropdown', 'value'),
Input('optimisation-dropdown', 'value'),
Input('power-capacity', 'value'),
Input('energy-capacity', 'value')
])
def update_graph(month_slider, structure_type, a, b, c, d, e, crop_type, photo_start, photo_end, fuel_type, material_cond, material_conv, storage_type, optimisation_type, power_capacity, energy_capacity):
# Wait for users to input values
if structure_type is None:
structure_type = 'A-frame'
if a is None:
a = 10
if b is None:
b = 10
if c is None:
c = 10
if d is None:
d = 10
if e is None:
e = 10
if crop_type is None:
crop_type = 'Tomato'
if photo_start is None:
photo_start = 6
if photo_end is None:
photo_end = 19
if fuel_type is None:
fuel_type = 'Natural Gas'
if material_cond is None:
material_cond = 'Glass'
if material_conv is None:
material_conv = 'Clear Polyethylene'
if (storage_type is None):
storage_type = 'Lithium Ion'
if (optimisation_type is None):
optimisation_type = 'cost'
if (power_capacity is None):
power_capacity = 100.
if (energy_capacity is None):
energy_capacity = 300.
# Calculate surface area
if structure_type == 'A-frame':
area = np.round(2*(a*c + b*c + e*b + a*d), 2)
volume = a*b*c + a*d/2*b
elif structure_type == 'Quonset':
area = np.round((a*b)*np.pi/2 + (np.power(a,2))*np.pi/4, 2)
volume = (np.pi*np.power((a/2), 2)*b)/2
photo = photo_end - photo_start
# Repeat Josh's calculation section to get lighting
plant_num, cost_min, cost_max, wmin_req, wmax_req = water_price(area, crop_type)
trans = greenhouse_transmissivity(material_cond)
array, PPFD_max, PPFD_avg = amb_light(trans)
crop_PPFDmin, crop_PPFDmax = deficiency(array, crop_type, photo)
final_pick, light_num, upfront_cost, consumption_kwh = Light_Sel(crop_PPFDmin, crop_PPFDmax, photo, plant_num)
# Need the consumption_kwh to plug into big boi
# Now call the big boi!
# Assume a factor
factor = 0.3
days, monthly_emissions = final_day_profile(crop_type, area, volume, photo_start, photo_end,
fuel_type, material_cond, material_conv, consumption_kwh, factor)
# Use days and monthly_emissions to plot!
# Get data from days to plot!
monthly_peak_without_storage = np.zeros(12)
for month in days.keys():
monthly_peak_without_storage[month-1] = days[month]['Total Electricity (kWh)'].max()
# Pass the big boi to storage calculations
dummy_days = dict()
# Append dummy data to dictionary
for month in days.keys():
dummy_days[month] = pd.DataFrame(np.asarray(days[month]['Total Electricity (kWh)']), columns=['Total Electricity (kW)'])
dummy_days[month]['Electricity Prices ($/kWh)'] = days[month]['Electricity Price (c/kWh)']/100
dummy_days[month] = dummy_days[month].fillna(0) # Fill nan with zeros
monthly_savings, monthly_peaks, days_storage = storage_calc(storage_type, optimisation_type,
power_capacity, energy_capacity, dummy_days)
# Get electricity peaks per month for storage option
monthly_peak_with_storage = np.zeros(12)
for month in days_storage.keys():
monthly_peak_with_storage[month-1] = days_storage[month]['Final Electricity (kW)'].max()
# Create numpy arrays to plot the months
month_array = np.arange(1, 13, 1)
day_array = np.arange(1, 25, 1)
# Convert cents to $
monthly_savings = monthly_savings/100
# return graphs
daily_energy_demand_graph = {
'data': [
dict(
x=day_array,
y=days[int(month_slider)]['Total Electricity (kWh)'],
mode='lines+markers',
marker={
'size': 15,
'opacity': 0.5,
'line': {'width': 0.5, 'color': 'white'},
'color': 'blue'
},
name='without energy storage'),
dict(
x=day_array,
y=days_storage[int(month_slider)]['Final Electricity (kW)'],
mode='lines+markers',
marker={
'size': 15,
'opacity': 0.5,
'line': {'width': 0.5, 'color': 'white'},
'color': 'green'
},
name='with energy storage')
],
'layout': dict(
xaxis={
'title': "Hour"
},
yaxis={
'title': 'Energy Demand (kWh)'
},
title='Daily Energy Demand Profile',
hovermode='closest'
)
}
monthly_saving_graph = {
'data': [dict(
x=month_array,
y=monthly_savings,
mode='lines+markers',
marker={
'size': 15,
'opacity': 0.5,
'line': {'width': 0.5, 'color': 'white'},
'color': 'green'
}
)],
'layout': dict(
xaxis={
'title': "Month"
},
yaxis={
'title': 'Electricity Savings ($)'
},
title='Monthly Electricity Cost Savings with Energy Storage',
hovermode='closest'
)
}
# monthly_peak_without_storage
# monthly_peaks not used here for storage
monthly_peak_graph = {
'data': [
dict(
x=month_array,
y=monthly_peak_with_storage,
mode='lines+markers',
marker={
'size': 15,
'opacity': 0.5,
'line': {'width': 0.5, 'color': 'white'},
'color': 'green'
},
name='with storage'),
dict(
x=month_array,
y=monthly_peak_without_storage,
mode='lines+markers',
marker={
'size': 15,
'opacity': 0.5,
'line': {'width': 0.5, 'color': 'white'},
'color': 'blue'
},
name='without storage')
],
'layout': dict(
xaxis={
'title': "Month"
},
yaxis={
'title': 'Electricity Peaks (kW)'
},
title='Monthly Electricity Peaks',
hovermode='closest'
)
}
# Monthly GHG Emission graph
monthly_GHG_graph = {
'data': [dict(
x=month_array,
y=monthly_emissions,
mode='lines+markers',
marker={
'size': 15,
'opacity': 0.5,
'line': {'width': 0.5, 'color': 'white'},
'color': 'green'
}
)],
'layout': dict(
xaxis={
'title': "Month"
},
yaxis={
'title': 'GHG Emissions (gCO2e)'
},
title='Monthly GHG Emissions',
hovermode='closest'
)
}
return daily_energy_demand_graph, monthly_saving_graph, monthly_peak_graph, monthly_GHG_graph
if __name__ == "__main__":
app.run_server(debug=True)