-
Notifications
You must be signed in to change notification settings - Fork 4
/
string_length_calculator.py
2732 lines (2407 loc) · 106 KB
/
string_length_calculator.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
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
# -*- coding: utf-8 -*-
"""
This script builds a Dash web application for calculating string length for a
PV System. Specifically, it builds the layout that is called by index.py
Todd Karin
toddkarin
"""
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
from dash.exceptions import PreventUpdate
# import dash_table
import plotly.colors
import plotly.graph_objs as go
import plotly.figure_factory as ff
# import plotly.plotly as py
# from flask_caching import Cache
from dash.dependencies import Input, Output, State
import vocmax
import numpy as np
import pvlib
import nsrdbtools
import pandas as pd
# import uuid
# import os
import flask
import json
# import time
import datetime
import io
import pvtoolslib
import urllib
from app import app
# app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
# session_id = str(uuid.uuid4())
layout = dbc.Container([
html.Hr(),
html.Div([
html.H1("Solar Photovoltaic String Length Calculator"),
], style={
# 'background-color': 'lightblue',
'width': '100%',
'padding-left': '10px',
'padding-right': '10px',
'textAlign': 'center'}),
html.Hr(),
# html.Div(str(uuid.uuid4()), id='session-id', style={'display': 'none'}),
html.Div(id='click-data', style={'display': 'none'}),
html.H2('Overview'),
dcc.Markdown("""This tool determines the maximum string length for a
solar PV installation in a particular location. The method is in
accordance with National Electric Code (NEC) 690.7(A) standards.
**We would highly appreciate any feedback** (praise, bug reports,
suggestions, etc.). Please contact us at [email protected].
""".replace(' ', '')
),
dbc.Row([
dbc.Col([
dbc.Button("Show me more details",
id="details-button",
color='light',
n_clicks=0,
className="mb-3"),
], width=3)
], justify='start'),
dbc.Collapse(
dbc.Card(dbc.CardBody([
dcc.Markdown("""
### Summary
The calculation proceeds with the following steps:
- Load historical weather data for a location.
- Provide details on module and installation type
- Set maximum allowable string voltage
- Model Voc for user-specified module technology, installation
parameters and weather data.
- Analyze results, providing a standard value for string length.
### Weather Data
Weather data was sourced from the National Solar Radiation
Database (NSRDB) [1]. The data was sampled across the continental
US at approximately a 0.125 degree grid, and at a lower
resolution elsewhere. If a different weather data source is
desired, it is necessary to use the open source associated python
package [vocmax]( https://github.com/toddkarin/vocmax),
which performs the same calculation as this web tool. If the
particular weather data point is not on the map, please contact
us at {} and we will try to provide it.
### Simulation methods
The string voltage calculator uses the open source [PVLIB](
https://pvlib-python.readthedocs.io/en/latest/) library to
perform the calculation. The first step is to determine the
plane-of-array irradiance given the mounting configuration and
weather data. If the California energy Commission (CEC) lookup
table is used, the relevant module parameters are calculated
using the single diode model under the De Soto parameterization [
5]. The relevant module parameters are the open-circuit voltage
at reference conditions (Voco), the temperature coefficient of
the open circuit voltage in V/C (Bvoco), the number of cells in
series in each module (cells_in_series) and the diode ideality
factor (n_diode). Alternately, module parameters
from the datasheet can be entered manually.
The calculation conservatively assumes that all diffuse
irradiance is used (FD=1) and that there are no reflection losses
from the top cell (aoi_model='no_loss'). These two assumptions
cause a small increase in Voc and make the simulation more
conservative. Specific details on the exact calculation method
are described in [vocmax](https://github.com/toddkarin/vocmax).
The open circuit voltage is modeled using the equation:
Voc = Voco + cells_in_series·delta·log(E/E0) + Bvoc·(T-T0)
where delta = n_diode·k_B·T/q is the thermal voltage, Bvoc
= Bvoco + Mbvoc·(1-E/E0), Mbvoc is the coefficient of the
irradiance dependence of the temperature coefficient of open
circuit voltage, E is the plane-of-array irradiance, E0 = 1000
W/m^2 is the reference irradiance, T0 = 25 C is the reference
temperature, kB is the Boltzmann constant, T is the cell
temperature and q is the electron charge.
### National Electric Code Standards
The National Electric Code 2017 lists three different methods
for determining the maximum string length in Article 690.7:
- 690.7(A)(1) Instruction in listing or labeling of module: The
sum of the PV module-rated open-circuit voltage of the
series-connected modules corrected for the lowest expected
ambient temperature using the open-circuit voltage temperature
coefficients in accordance with the instructions included in the
listing or labeling of the module.
- 690.7(A)(2) Crystalline and multicrystalline modules: For
crystalline and multicrystalline silicon modules, the sum of the
PV module-rated open-circuit voltage of the series-connected
modules corrected for the lowest expected ambient temperature
using the correction factor provided in Table 690.7(A).
- 690.7(A)(3) PV systems of 100 kW or larger: For PV systems with
a generating capcity of 100 kW or greater, a documented and
stamped PV system design, using an industry standard method and
provided by a licensed professional electrical engineer, shall be
permitted.
This tool provides standard values for the trhee 690.7(A)
methods. For method 690.7(A)(3), the system is modeled using 18
years of NSRDB weather from the selected location and module
parameters.
### Who we are
We are a collection of national lab researchers funded under the
[Durable module materials consortium (DuraMAT)](https://www.duramat.org/).
""".format(pvtoolslib.contact_email).replace(' ', '')
),
dbc.Row([
dbc.Col(
html.Img(
src=app.get_asset_url('duramat_logo.png'),
style={'height': 50})
),
dbc.Col(
html.Img(
src=app.get_asset_url('pvlib_logo_horiz.png'),
style={'height': 50})
),
dbc.Col(
html.Img(
src=app.get_asset_url(
'LBL_Masterbrand_logo_with_Tagline-01.jpg'),
style={'height': 50})
)
], justify='center'
)
])), id="details-collapse"
),
# html.H2('Simulation Input'),
html.P(''),
html.H2('Step 1: Provide location of installation'),
dbc.Card([
dbc.CardHeader('Choose Location'),
dbc.CardBody([
dbc.Row([
dbc.Col([
dbc.Label('Latitude'),
dbc.Input(id='lat', value='37.88', type='text'),
dbc.Label('Longitude'),
dbc.Input(id='lon', value='-122.25', type='text'),
dbc.FormText(id='closest-message',
children='Closest point shown on map'),
html.P(''),
html.Div([
dbc.Button(id='get-weather', n_clicks=0,
children='Show nearest location on map'),
]),
html.Div(id='weather_data_download'),
], md=4),
dbc.Col([
html.Div(id='location-map', children=[dcc.Graph(id='map')]),
html.P(
'Either enter coordinates manually or click on point.')
], md=8)
]),
]),
]),
html.P(''),
html.H2('Step 2: Provide details on module and installation type'),
dbc.Card([
dbc.CardHeader('Module Parameters'),
dbc.CardBody([
dbc.Label("""To select module parameters from a library of common
modules, select 'Library Lookup'. Or select 'manual entry' to
enter the parameters manually.
"""),
dbc.Tabs([
dbc.Tab([
dbc.Card(
dbc.CardBody(
[
dcc.Markdown("""Module name (from CEC database).
"""),
dcc.Dropdown(
id='module_name',
options=pvtoolslib.cec_module_dropdown_list,
value=
pvtoolslib.cec_module_dropdown_list[0][
'value'],
style={'max-width': 500}
),
html.P(''),
dcc.Markdown("""Bifaciality
"""),
dcc.Dropdown(
id='lookup_is_bifacial',
options=[
{'label': 'Monofacial Module',
'value': 0},
{'label': 'Bifacial Module',
'value': 1},
],
value=0,
style={'max-width': 500}
),
dbc.FormText("""Select 'bifacial' if the
module is bifacial and is mounted so that the
backside receives irradiance.
"""),
html.P(''),
html.Div([
dbc.Label(
"""Module bifaciality coefficient"""),
dbc.Input(id='lookup_bifaciality',
value='0.7',
type='text',
style={'max-width': 200}),
dbc.FormText(
"""Efficiency of the backside of the module relative to the frontside."""),
html.P(''),
], id='lookup_bifaciality_div'),
html.Div(id='module_name_iv')
],
)
)
], tab_id='lookup', label='Library Lookup'),
dbc.Tab([
dbc.Card(
dbc.CardBody(
[
dcc.Markdown("""Manually set module parameters.
"""),
html.Details([
html.Summary(
"What about using PVsyst data from a PAN file?"),
html.Div([
dcc.Markdown("""In order to use a PAN
file from PVsyst, use the following
translation:
"""),
], style={'marginLeft': 50}
),
dbc.Table.from_dataframe(pd.DataFrame(
{'pvtools': ['Voco', 'Bvoco', 'Mbvoc',
'cells_in_series',
'n_diode',
'efficiency',
'Module bifaciality coefficient'],
'pvSyst': ['Voc', 'muVocSpec/1000',
'0',
'NCelS', 'Gamma',
'Imp*Vmp/Height/Width',
'BifacialityFactor']
}),
striped=False,
bordered=True,
hover=True,
index=False,
size='sm',
style={
'font-size': '0.8rem'}),
]),
dbc.Label("""Module name"""),
dbc.Input(id='module_name_manual',
value='Custom Module',
type='text',
style={'max-width': 200}),
dbc.FormText("""Module name for outfile"""),
html.P(''),
dbc.Label("""Voco"""),
dbc.Input(id='Voco', value='48.5', type='text',
style={'max-width': 200}),
dbc.FormText(vocmax.explain['Voco']),
html.P(''),
dbc.Label("""Bvoco"""),
dbc.Input(id='Bvoco', value='-0.163',
type='text',
style={'max-width': 200}),
dbc.FormText(vocmax.explain['Bvoco']),
html.P(''),
dbc.Label("""Mbvoc"""),
dbc.Input(id='Mbvoc', value='0', type='text',
style={'max-width': 200}),
dbc.FormText(vocmax.explain['Mbvoc']),
html.P(''),
dbc.Label("""cells_in_series"""),
dbc.Input(id='cells_in_series', value='72',
type='text',
style={'max-width': 200}),
dbc.FormText(vocmax.explain['cells_in_series']),
html.P(''),
dbc.Label("""n_diode"""),
dbc.Input(id='n_diode', value='1.05',
type='text',
style={'max-width': 200}),
dbc.FormText(vocmax.explain['n_diode'] +
'. Suggested values are 1.1 for mono-c-Si, 1.2 for multi-c-Si, and 1.4 for CdTe.'),
html.P(''),
dbc.Label("""efficiency"""),
dbc.Input(id='efficiency', value='0.17',
type='text',
style={'max-width': 200}),
dbc.FormText('Module efficiency, unitless'),
html.P(''),
dbc.Label("""FD"""),
dbc.Input(id='FD', value='1', type='text',
style={'max-width': 200}),
dbc.FormText(vocmax.explain['FD']),
html.P(''),
dcc.Markdown("""Bifaciality
"""),
dcc.Dropdown(
id='manual_is_bifacial',
options=[
{'label': 'Monofacial Module',
'value': 0},
{'label': 'Bifacial Module',
'value': 1},
],
value=0,
style={'max-width': 500}
),
dbc.FormText("""Select 'bifacial' if the
module is bifacial and is mounted so that the
backside receives irradiance.
"""),
html.P(''),
html.Div([
dbc.Label(
"""Module bifaciality coefficient"""),
dbc.Input(id='manual_bifaciality',
value='0.7',
type='text',
style={'max-width': 200}),
dbc.FormText(
"""Efficiency of the backside of the module relative to the frontside."""),
html.P(''),
], id='manual_bifaciality_div'),
# dbc.Button('Calculate module parameters',id='show_iv',n_clicks=0),
html.Div(id='manual_iv')
# dbc.Label("""AOI model. Loss model for
# angle-of-incidence losses. These occur due to
# reflection from surfaces above the cell.
#
# """),
# dcc.Dropdown(
# id='aoi_model',
# options=[
# {'label': 'ashrae',
# 'value': 'ashrae'},
# {'label': 'no_loss',
# 'value': 'no_loss'},
# ],
# value='ashrae',
# style={'max-width': 500}
# ),
# dbc.Label("""Ashrae IAM coefficient. 'b' coefficient
# describing incidence angle modifier losses. Typical
# value is 0.05.
#
# """),
# dbc.Input(id='ashrae_iam_param', value='0.05',
# type='text',
# style={'max-width': 200}),
]
)
)
], tab_id='manual', label='Manual Entry'),
], id='module_parameter_input_type', active_tab='lookup'),
])
]),
html.P(''),
dbc.Card([
dbc.CardHeader('Thermal model'),
dbc.CardBody([
html.P("""The thermal model parameters determine how the cell
temperature depends on ambient temperature, plane-of-array
irradiance and wind speed.
"""),
dbc.Tabs([
dbc.Tab([
dbc.Card(
dbc.CardBody(
[
dcc.Markdown('Racking Model'),
dcc.Dropdown(
id='racking_model',
options=[
{'label': 'open rack glass polymer',
'value': 'open_rack_glass_polymer'},
{'label': 'open rack glass glass',
'value': 'open_rack_glass_glass'},
{'label': 'close mount glass glass',
'value': 'close_mount_glass_glass'},
{
'label': 'insulated back glass polymer',
'value': 'insulated_back_glass_polymer'},
],
value='open_rack_glass_polymer',
style={'max-width': 500}
),
dbc.FormText("""Standard coefficents for
calculating temperature of cell based on
ambient temperature, plane of array
irradiance and wind speed.
""")
],
)
)
], tab_id='lookup', label='Default models'),
dbc.Tab([
dbc.Card(
dbc.CardBody(
[html.P(
['Enter thermal model parameters from the ',
html.A('Sandia array performance model',
href='https://prod-ng.sandia.gov/techlib-noauth/access-control.cgi/2004/043535.pdf',
target='_blank'),
'.'
]),
dbc.Label("""a
"""),
dbc.Input(id='a', value='-3.47', type='text',
style={'max-width': 200}),
dbc.FormText("""Empirically-determined coefficient
establishing the upper limit for module temperature
at low wind speeds and high solar irradiance
"""),
html.P(''),
dbc.Label("""b"""),
dbc.Input(id='b', value='-0.0594', type='text',
style={'max-width': 200}),
dbc.FormText(""" Empirically-determined coefficient
establishing the rate at which module temperature
drops as wind speed increases (s/m)
"""),
html.P(''),
dbc.Label("""DT"""),
dbc.Input(id='DT', value='3', type='text',
style={'max-width': 200}),
dbc.FormText("""Temperature difference between cell
and module at reference irradiance (C)
"""),
]
)
)
], tab_id='manual', label='Manual Entry')
], id='thermal_model_input_type', active_tab='lookup'),
html.P(''),
dcc.Markdown("""Open-Circuit Temperature Rise
"""),
dcc.Dropdown(
id='open_circuit_rise',
options=[
{'label': 'Open-circuit temperature rise included',
'value': 1},
{'label': 'Open-circuit temperature rise excluded',
'value': 0},
],
value=0,
style={'max-width': 500}
),
dbc.FormText("""Modules at open-circuit voltage are slightly
warmer than those at max-power point because at open-circuit
absorbed energy is not exported as electricity. However, for the
first few minutes of a shutdown the modules have not had time to
equilibrate to the higher temperature.
"""),
]),
]),
html.P(''),
dbc.Card([
dbc.CardHeader('Racking Type'),
dbc.CardBody([
dcc.Markdown("""Choose the mounting configuration of the array.
"""),
dbc.Tabs([
dbc.Tab([
dbc.Card(
dbc.CardBody(
[dbc.Label('Surface Tilt (degrees)'),
dbc.Input(id='surface_tilt', value='30',
type='text',
style={'max-width': 200}),
dbc.Label('Surface Azimuth (degrees)'),
dbc.Input(id='surface_azimuth', value='180',
type='text',
style={'max-width': 200}),
dbc.FormText("""For module face oriented due South use 180.
For module face oreinted due East use 90"""),
dbc.Label("""Ground albedo"""),
dbc.Input(id='fixed_tilt_albedo',
value='0.25',
type='text',
style={'max-width': 200}),
dbc.FormText("""Ground albedo is used to
calculate light reflected from the ground onto
front or backside of module.
"""),
html.Div([
dbc.Label("""Backside irradiance fraction"""),
dbc.Input(
id='fixed_tilt_backside_irradiance_fraction',
value='0.2',
type='text',
style={'max-width': 200}),
dbc.FormText("""Fraction of light falling on
back of a bifacial module relative to the front.
Unused if module is not bifacial.
"""),
],
id='fixed_tilt_backside_irradiance_fraction_div'),
],
)
)
], tab_id='fixed_tilt', label='Fixed Tilt'),
dbc.Tab([
dbc.Card(
dbc.CardBody(
[dbc.Label('Axis Tilt (degrees)'),
dbc.Input(id='axis_tilt', value='0', type='text',
style={'max-width': 200}),
dbc.FormText("""The tilt of the axis of rotation
(i.e, the y-axis defined by axis_azimuth) with
respect to horizontal, in decimal degrees."""),
dbc.Label('Axis Azimuth (degrees)'),
dbc.Input(id='axis_azimuth', value='0',
type='text',
style={'max-width': 200}),
dbc.FormText("""A value denoting the compass
direction along which the axis of rotation lies.
Measured in decimal degrees East of North."""),
dbc.Label('Max Angle (degrees)'),
dbc.Input(id='max_angle', value='90', type='text',
style={'max-width': 200}),
dbc.FormText("""A value denoting the maximum
rotation angle, in decimal degrees, of the
one-axis tracker from its horizontal position (
horizontal if axis_tilt = 0). A max_angle of 90
degrees allows the tracker to rotate to a
vertical position to point the panel towards a
horizon. max_angle of 180 degrees allows for
full rotation."""),
dbc.Label('Backtrack'),
dbc.RadioItems(
options=[
{"label": "True", "value": True},
{"label": "False", "value": False},
],
value=True,
id="backtrack",
),
dbc.FormText("""Controls whether the tracker has
the capability to ''backtrack'' to avoid
row-to-row shading. False denotes no backtrack
capability. True denotes backtrack
capability."""),
dbc.Label('Ground Coverage Ratio'),
dbc.Input(id='ground_coverage_ratio',
value='0.286',
type='text',
style={'max-width': 200}),
dbc.FormText("""A value denoting the ground
coverage ratio of a tracker system which
utilizes backtracking; i.e. the ratio between
the PV array surface area to total ground area.
A tracker system with modules 2 meters wide,
centered on the tracking axis, with 6 meters
between the tracking axes has a gcr of
2/6=0.333. If gcr is not provided, a gcr of 2/7
is default. gcr must be <=1"""),
dbc.Label("""Ground albedo"""),
dbc.Input(id='single_axis_albedo',
value='0.25',
type='text',
style={'max-width': 200}),
dbc.FormText("""Ground albedo is used to
calculate light reflected from the ground onto
front or backside of module.
"""),
html.Div([
dbc.Label("""Backside irradiance fraction"""),
dbc.Input(
id='single_axis_backside_irradiance_fraction',
value='0.2',
type='text',
style={'max-width': 200}),
dbc.FormText("""Fraction of light falling on
back of a bifacial module relative to the front.
Unused if module is not bifacial.
"""),
], 'single_axis_backside_irradiance_fraction_div')
]
)
)
], tab_id='single_axis_tracker', label='Single Axis Tracker')
], id='mount_type', active_tab='fixed_tilt'),
])
]),
html.P(''),
html.H2('Step 3: Provide Design Maximum String Voltage and Safety Factor'),
dbc.Card([
dbc.CardHeader(['String Voltage Limit']),
dbc.CardBody([
dcc.Markdown('String design voltage (V)'),
dbc.Input(id='string_design_voltage',
value='1500',
type='text',
style={'max-width': 200}),
dbc.FormText(
'Maximum string design voltage (Vdesign) for calculating string length, in Volts'),
])
]),
html.P(''),
dbc.Card([
# XX
dbc.CardHeader(['Safety factor']),
dbc.CardBody([
dcc.Markdown(
'Safety factor due to NSRDB weather uncertainty (%). Use look up button to get suggested value for current lat/lon.'),
dbc.Row([
dbc.Col([
dbc.Button(id='nsrdb_get_weather_data_uncertainty',
n_clicks=0,
children='Look up',
color="secondary")
], width='auto'),
dbc.Col([
dbc.Input(id='nsrdb_weather_data_safety_factor',
value='2.3',
type='text',
style={'max-width': 200}
),
], width='auto'),
], justify='start'),
dbc.FormText(id='nsrdb_safety_factor_inform',
children="""Safety factor due to NSRDB uncertainty is found
by comparing NSRDB and ASHRAE extreme yearly minimum dry bulb
temperatures for the location of interest. The temperature
difference is multiplied by the absolute value of the
temperature coefficient of open-circuit voltage in %/C
Alternately, can use a standard NSRDB weather uncertainty of
2.3 %.
""".replace(' ', '')),
html.P(''),
dcc.Markdown(
'Optional safety factor due to extreme cold temperatures, only consider including if using 690.7(A)(3)-P99.5 standard.'),
dbc.Row([
dbc.Col([
dbc.Button(id='get_extreme_cold_uncertainty',
n_clicks=0,
children='Look up',
color="secondary")
], width='auto'),
dbc.Col([
dbc.Input(id='extreme_cold_uncertainty',
value='0.0',
type='text',
style={'max-width': 200}
),
], width='auto'),
dbc.Col([
dcc.Dropdown(
id='extreme_cold_include',
options=[
{'label': 'Include',
'value': 1},
{'label': 'Exclude',
'value': 0},
],
value=0,
style={'max-width': 1000}
),
], width=2),
dbc.Col([
dcc.Loading(html.Div(
id='extreme_cold_safety_factor_loading_div'))
], width=1),
], justify='start'),
dbc.FormText(id='extreme_cold_safety_factor_inform'),
html.P(''),
dcc.Markdown(
'Additional additive safety factor.'),
dbc.Row([
dbc.Col([
dbc.Button(id='get_suggested_additional_safety_factor',
n_clicks=0,
children='Get Suggestion',
color="secondary")
], width='auto'),
dbc.Col([dbc.Input(id='additional_safety_factor',
value='1.6',
type='text',
style={'max-width': 200}
)
], width='auto'),
dbc.Col([
dcc.Loading(html.Div(
id='additional_safety_factor_loading_div'))
], width=1),
], justify='start'),
dbc.FormText(id='additional_safety_factor_inform',
children="""Additional safety factor in percent of
system Voc. Suggested value is 1.0% to account for
Voc manufacturing uncertainty plus 0.6% for wind
speed uncertainty. If the diode ideality factor is
unknown, add an additional 0.4%. """
),
html.P(''),
dcc.Markdown('Total safety factor, in percent.'),
dbc.Row([
dbc.Col([dbc.Input(id='safety_factor',
value='3.3',
type='text',
style={'max-width': 200}),
], width='auto'),
], justify='start'),
dbc.FormText(id='total_safety_factor_inform',
children='Safety factor as a percent of system Voc. Number of modules in string is chosen to satisfy Nstring*Vmax<(1-safety_factor)*Vdesign'),
])
]),
html.P(''),
html.H2('Final Step: Run Calculation'),
dbc.Card([
dbc.CardHeader('Calculation'),
dbc.CardBody([
html.P('Press "Calculate" to run Voc calculation (~10 seconds)'),
dbc.Button(id='submit-button',
n_clicks=0,
children='Calculate',
color="secondary"),
])
]),
# html.P(' '),
# html.A(dbc.Button(id='submit-button-with-download',
# n_clicks=0,
# children='Calculate and download data as csv'),
# href="/download_simulation_data/"),
# html.P(
# 'Select whether to generate csv for downloading data (summary csv is always generated):'),
# dbc.Checklist(id='generate-datafile',
# options=[
# {'label': 'Generate Download Datafile',
# 'value': 'generate-datafile'},
# ],
# values=[]
# ),
html.P(''),
html.H2('Results'),
# html.Div(id='load'),
dcc.Loading(html.Div(id='graphs')),
# dcc.Store(id='annotation-store'),
dcc.Store(id='results-store'),
# html.Div(id='voc-hist-results-store', style={'display': 'none'}),
# dbc.Button('Download results as csv',id='download_csv',n_clicks=0),
# html.Div(id='graphs'),
# html.Div([html.Div('Calculating...')], id='graphs'),
# html.A('Download data as csv file', id='download-data',style={'display':None}),
# dcc.Slider(
# min=0,
# max=9,
# marks={i: '{}'.format(i) for i in range(9)},
# value=5,
# ),
html.Div(id='voc_list'),
html.P(''),
html.H2('Frequently Asked Questions'),
html.Details([
html.Summary(
"What if I want to run the simulation myself? Where's the source code?"),
html.Div([
dcc.Markdown("""If you would like to run the calculation as a
python program, please visit the [github page for vocmax](
https://github.com/toddkarin/vocmax)
"""),
dcc.Markdown("""Additionally, if you would like to take a look at
the source code for this website, please visit the [github page
for pvtools]( https://github.com/toddkarin/pvtools)
""")
], style={'marginLeft': 50}
),
]),
html.Details([
html.Summary(
"Where can I find an index of parameters?"),
html.Div([
# dcc.Markdown("""Right here!"""),
dcc.Markdown('**' + p + '**: ' + vocmax.explain[p]) for p in
vocmax.explain
], style={'marginLeft': 50}
),
]),
html.Details([
html.Summary(
"Do you store any of my data?"),
html.Div([
dcc.Markdown("""We take your privacy seriously. We do not store
any metadata related to the simulation. For understanding the
usage of the app, we count the number of times the 'calculate'
button is pressed and also record whether default values were
used or not. We also count the number of unique users that use
the app. We specifically exclude logging any events that generate
identifiable metadata.
"""),
], style={'marginLeft': 50}
),
]),
html.Details([
html.Summary(
'Why is there a spike in the temperature histogram at 0 C?'),
html.Div("""In the NSRDB database, the temperature values are
interpolated from the NASA MERRA-2 dataset using a standard
temperature lapse rate [1]. The temperature data are then truncated
to an integer value, meaning all temperatures between -0.999 and
0.999 become 0 in the stored data. This only affects the calculation
result if the max Voc values occur at a temperature of 0 C. So,
for most locations, this rounding error has no effect on max Voc,
but in the worst case the rounding error results in a fractional
error in Voc of Bvoco*(1 C)/Voco, on the order of 0.3%.
""", style={'marginLeft': 50}),
]),
html.P(''),
html.H2('References'),
html.P("""
[1] M. Sengupta, Y. Xie, A. Lopez, A. Habte, G. Maclaurin, and J.
Shelby, “The national solar radiation data base (NSRDB),” Renewable
and Sustainable Energy Reviews, vol. 89, pp. 51–60, 2018.
"""),
html.P("""
[2] D. King, W. Boyson, and J. Kratochvill, “Photovoltaic array
performance model,” SAND2004-3535, 2004.
"""),
html.P("""[3] W. F. Holmgren, C. W. Hansen, and M. A. Mikofski, “pvlib
python: a python package for modeling solar energy systems,” Journal of
Open Source Software, vol. 3, no. 29, p. 884, 2018"""),
html.P("""[4] A. Dobos, “An Improved Coefficient Calculator for the
California Energy Commission 6 Parameter Photovoltaic Module Model”,
Journal of Solar Energy Engineering, vol 134, 2012.
"""),
html.P("""[5] W. De Soto et al., “Improvement and validation of a model
for photovoltaic array performance”, Solar Energy, vol 80, pp. 78-88, 2006.
"""),
html.H2('About'),
html.P("""Funding was primarily provided as part of the Durable Modules
Consortium (DuraMAT), an Energy Materials Network Consortium funded by
the U.S. Department of Energy, Office of Energy Efficiency and Renewable
Energy, Solar Energy Technologies Office. Lawrence Berkeley National
Laboratory is funded by the DOE under award DE-AC02-05CH11231 """),
html.P('PVTOOLS version ' + pvtoolslib.__version__),
html.P('vocmax version ' + vocmax.__version__),
html.P('Author: Todd Karin'),
html.P('Contact: ' + pvtoolslib.contact_email)
],
style={'columnCount': 1,
'maxWidth': 1000,
'align': 'center'})
#
# @app.callback(
# Output("nec-collapse", "is_open"),
# [Input("nec-button", "n_clicks")],
# [State("nec-collapse", "is_open")],
# )
# def toggle_collapse(n, is_open):
# if n:
# return not is_open
# return is_open
# @app.callback(
# Output("calculation_result", "children"),
# [Input("input", "value")],
# )
# def toggle_collapse(input):
# # Do really long calculation
# dash.dependencies.Update_Output(id='progress_bar',value=10)
# # Do some more calculations
# dash.dependencies.Update_Output(id='progress_bar', value=30)
# # And some more
# dash.dependencies.Update_Output(id='progress_bar', value=100)
# return result
@app.callback(
Output("details-collapse", "is_open"),
[Input("details-button", "n_clicks")],
[State("details-collapse", "is_open")],
)
def toggle_collapse(n, is_open):
if n: