-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsnow.py
215 lines (180 loc) · 6.9 KB
/
snow.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
import numpy as np
def apply_mask(mask, azimuth, elevation):
"""
Used to determine whether a given (azimuth, elevation) pair is above or
below a horizon profile
Parameters
----------
mask : pd.Series
Series with int index of 0 - 360 (represents azimuth) and float values
(represents elevation [deg] of horizon profile)
azimuth : numeric
Solar azimuth angle [deg]
elevation : numeric
Solar elevation angle [deg]
Returns
-------
out : bool or NaN
"""
if np.isnan(azimuth) == False:
if elevation > mask[int(np.floor(azimuth))]:
out = False
else:
out = True
else:
out = np.nan
return out
def get_irradiance_sapm(temp_cell, i_mp, imp0, c0, c1, alpha_imp,
irrad_ref=1000, temp_ref=25):
"""
Model effective irradiance from current at maximum power and cell
temperature.
Solves Eqn. 2 from [1]_.
Parameters
----------
temp_cell : array
Temperature of cells inside module. [degrees C]
i_mp : array
Maximum power current at the resolution of a single module. [A]
imp0 : float
Short-circuit current at reference condition. [A]
c0, c1 : float
Empirically determined coefficients relating ``i_mp`` to effective
irradiance.
alpha_imp : float
Normalized temperature coefficient for short-circuit current. [1/°C]
temp_ref : float
Reference cell temperature. [degrees C]
Returns
-------
effective_irradiance : array
Effective irradiance. [W/m2]
References
----------
.. [1] D. L. King, E.E. Boyson, and J.A. Kratochvil, "Photovoltaic Array
Performance Model", SAND2004-3535, Sandia National Laboratories,
Albuquerque, NM, 2004.
"""
a = imp0*c1*(1 + alpha_imp*(temp_cell - temp_ref))
b = imp0*c0*(1 + alpha_imp*(temp_cell - temp_ref))
c = -i_mp
discriminant = np.square(b) - 4*a*c
effective_irradiance = (-b + np.sqrt(discriminant))/(2*a) * irrad_ref
return effective_irradiance
def get_irradiance_imp(i_mp, imp0, irrad_ref=1000):
"""
Model effective irradiance from maximum power current.
Assumes a linear relationship between effective irradiance and maximum
power current, i.e., Eqn. 8 from [1]_.
Parameters
----------
i_mp : array
Maximum power current at the resolution of a single module. [A]
imp0 : float
Short-circuit current at reference condition. [A]
Returns
-------
effective_irradiance : array
Effective irradiance. [W/m2]
References
----------
.. [1] C. F. Abe, J. B. Dias, G. Notton, G. A. Faggianelli, G. Pigelet, and
D. Ouvrard, David, "Estimation of the effective irradiance and bifacial
gain for PV arrays using the maximum power current", IEEE Journal of
Photovoltaics, 2022, pp. 432-441. :doi:`10.1109/JPHOTOV.2023.3242117`
"""
return i_mp / imp0 * irrad_ref
def get_transmission(measured_e_e, modeled_e_e, i_mp):
"""
Estimate transmittance as the ratio of modeled effective irradiance to
measured irradiance.
Measured irradiance should be in the array's plane and represent snow-free
conditions. When possible, the irradiance should be adjusted for
reflections and spectral content. For example, the measured irradiance
could be obtained with a heated plane-of-array pyranometer.
Parameters
----------
measured_e_e : array
Plane-of-array irradiance absent the effect of snow. [W/m2]
modeled_e_e : array
Effective irradiance modeled from measured current at maximum power.
[W/m2]
i_mp : array
Maximum power current at the resolution of a single module. [A]
Returns
-------
T : array
Effective transmission. [unitless]
References
----------
.. [1] E. C. Cooper, J. L. Braid and L. Burnham, "Identifying the
Electrical Signature of Snow in Photovoltaic Inverter Data," 2023 IEEE
50th Photovoltaic Specialists Conference (PVSC), San Juan, PR, USA,
2023, pp. 1-5. :doi:`10.1109/PVSC48320.2023.10360065`
"""
T = modeled_e_e/measured_e_e
T[T.isna()] = np.nan
T[i_mp == 0] = 0
T[T < 0] = np.nan
T[T > 1] = 1
return T
def categorize(vmp_ratio, transmission, voltage, min_dcv,
threshold_vratio, threshold_transmission):
"""
Categorizes electrical behavior into a snow-related mode.
Modes are defined in [1]_:
* Mode 0: system is covered with enough opaque snow that the system is
offline due to voltage below the inverter's turn-on voltage.
* Mode 1: system is online and covered with non-uniform snow, such that
both operating voltage and current are decreased by the presence of snow.
* Mode 2: system is online and covered with opaque snow, such that
operating voltage is decreased by the presence of snow, but transmission
is consistent with snow-free conditions.
* Mode 3: system is online and covered with light-transmissive snow, such
that transmission is decreased but voltage is consistent with all
system substrings being online.
* Mode 4: transmisison and voltage are consistent with snow-free
conditions.
Parameters
----------
vratio : float
Ratio between measured voltage and voltage modeled using
calculated values of transmission. [dimensionless]
transmission : float
Fraction of plane-of-array irradiance that can reach the array's cells
through the snow cover. [dimensionless]
voltage : float
[V]
min_dcv : float
The lower voltage bound on the inverter's maximum power point
tracking (MPPT) algorithm. [V]
threshold_vratio : float
The lower bound for vratio that is representative of snow-free
conditions. Determined empirically. Depends on system configuration and
site conditions. [unitless]
threshold_transmission : float
The lower bound on transmission that is found under snow-free
conditions, determined empirically. [unitless]
Returns
-------
mode : int
.. [1] E. C. Cooper, J. L. Braid and L. M. Burnham, "Identifying the
Electrical Signature of Snow in Photovoltaic Inverter Data," 2023 IEEE
50th Photovoltaic Specialists Conference (PVSC), San Juan, PR, USA,
2023, pp. 1-5, :doi:`10.1109/PVSC48320.2023.10360065`.
"""
if np.isnan(vmp_ratio) or np.isnan(transmission):
return np.nan
elif voltage < min_dcv:
return 0
elif vmp_ratio < threshold_vratio:
if transmission < threshold_transmission:
return 1
elif transmission > threshold_transmission:
return 2
elif vmp_ratio > threshold_vratio:
if transmission < threshold_transmission:
return 3
elif transmission > threshold_transmission:
return 4
return np.nan