forked from pvlib/pvlib-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
temperature.py
369 lines (286 loc) · 13.4 KB
/
temperature.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
"""
The ``temperature`` module contains functions for modeling temperature of
PV modules and cells.
"""
import numpy as np
class _IndexAttrMeta(type):
# __getitem__ only works on instances, not classes, so need to redefine
# type, which is what classes are made from
def __getitem__(cls, item):
# retrieve items by index like a dictionary
return getattr(cls, str(item).lower())
class TEMPERATURE_MODEL_PARAMETERS(metaclass=_IndexAttrMeta):
"""Dictionary of temperature parameters organized by model.
There are keys for each model at the top level. Currently there are two models,
``sapm`` for the Sandia Array Performance Model, and ``pvsyst``. Each model has
a dictionary of configurations with a dictionary of the model parameters
associated with it. Retrieve a parameters by indexing the model and
configuration by name.
Example
-------
Retrieve the open rack glass-polymer configuration for SAPM::
from pvlib.temperature import TEMPERATURE_MODEL_PARAMS
temp_parmas = TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_polymer']
"""
# NOTE: only Python-2 uses __metaclass__,
# Python-3 passes this to the class as an argument,
# see: https://docs.python.org/3/library/2to3.html#2to3fixer-metaclass
# __metaclass__ = _IndexAttrMeta
#: Sandia Array Performance Model
sapm = {
'open_rack_glass_glass': {'a': -3.47, 'b': -.0594, 'deltaT': 3},
'close_mount_glass_glass': {'a': -2.98, 'b': -.0471, 'deltaT': 1},
'open_rack_glass_polymer': {'a': -3.56, 'b': -.0750, 'deltaT': 3},
'insulated_back_glass_polymer': {'a': -2.81, 'b': -.0455, 'deltaT': 0}}
#: PVSyst model
pvsyst = {'freestanding': {'u_c': 29.0, 'u_v': 0},
'insulated': {'u_c': 15.0, 'u_v': 0}}
def _temperature_model_params(model, parameter_set):
try:
params = TEMPERATURE_MODEL_PARAMETERS[model]
return params[parameter_set]
except KeyError:
msg = ('{} is not a named set of parameters for the {} cell'
' temperature model.'
' See pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS'
' for names'.format(parameter_set, model))
raise KeyError(msg)
def sapm_cell(poa_global, temp_air, wind_speed, a, b, deltaT,
irrad_ref=1000):
r'''
Calculate cell temperature per the Sandia PV Array Performance Model.
See [1]_ for details on the Sandia Array Performance Model.
Parameters
----------
poa_global : numeric
Total incident irradiance [W/m^2].
temp_air : numeric
Ambient dry bulb temperature [C].
wind_speed : numeric
Wind speed at a height of 10 meters [m/s].
a : float
Parameter :math:`a` in :eq:`sapm1`.
b : float
Parameter :math:`b` in :eq:`sapm1`.
deltaT : float
Parameter :math:`\Delta T` in :eq:`sapm2` [C].
irrad_ref : float, default 1000
Reference irradiance, parameter :math:`E_{0}` in
:eq:`sapm2` [W/m^2].
Returns
-------
numeric, values in degrees C.
Notes
-----
The model for cell temperature :math:`T_{C}` is given by a pair of
equations (Eq. 11 and 12 in [1]_).
.. math::
:label: sapm1
T_{m} = E \times \exp (a + b \times WS) + T_{a}
.. math::
:label: sapm2
T_{C} = T_{m} + \frac{E}{E_{0}} \Delta T
The module back surface temperature :math:`T_{m}` is implemented in
:py:func:`~pvlib.temperature.sapm_module`.
Inputs to the model are plane-of-array irradiance :math:`E` (W/m2) and
ambient air temperature :math:`T_{a}` (C). Model parameters depend both on
the module construction and its mounting. Parameter sets are provided in
[1]_ for representative modules and mounting, and are coded for convenience
in ``pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS``.
+---------------+----------------+-------+---------+---------------------+
| Module | Mounting | a | b | :math:`\Delta T [C]`|
+===============+================+=======+=========+=====================+
| glass/glass | open rack | -3.47 | -0.0594 | 3 |
+---------------+----------------+-------+---------+---------------------+
| glass/glass | close roof | -2.98 | -0.0471 | 1 |
+---------------+----------------+-------+---------+---------------------+
| glass/polymer | open rack | -3.56 | -0.075 | 3 |
+---------------+----------------+-------+---------+---------------------+
| glass/polymer | insulated back | -2.81 | -0.0455 | 0 |
+---------------+----------------+-------+---------+---------------------+
References
----------
.. [1] King, D. et al, 2004, "Sandia Photovoltaic Array Performance
Model", SAND Report 3535, Sandia National Laboratories, Albuquerque,
NM.
Examples
--------
>>> from pvlib.temperature import sapm_cell, TEMPERATURE_MODEL_PARAMETERS
>>> params = TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_glass']
>>> sapm_cell(1000, 10, 0, **params)
44.11703066106086
'''
module_temperature = sapm_module(poa_global, temp_air, wind_speed,
a, b)
return module_temperature + (poa_global / irrad_ref) * deltaT
def sapm_module(poa_global, temp_air, wind_speed, a, b):
r'''
Calculate module back surface temperature per the Sandia PV Array
Performance Model.
See [1]_ for details on the Sandia Array Performance Model.
Parameters
----------
poa_global : numeric
Total incident irradiance [W/m^2].
temp_air : numeric
Ambient dry bulb temperature [C].
wind_speed : numeric
Wind speed at a height of 10 meters [m/s].
a : float
Parameter :math:`a` in :eq:`sapm1mod`.
b : float
Parameter :math:`b` in :eq:`sapm1mod`.
Returns
-------
numeric, values in degrees C.
Notes
-----
The model for module temperature :math:`T_{m}` is given by Eq. 11 in [1]_.
.. math::
:label: sapm1mod
T_{m} = E \times \exp (a + b \times WS) + T_{a}
Inputs to the model are plane-of-array irradiance :math:`E` (W/m2) and
ambient air temperature :math:`T_{a}` (C). Model outputs are surface
temperature at the back of the module :math:`T_{m}` and cell temperature
:math:`T_{C}`. Model parameters depend both on the module construction and
its mounting. Parameter sets are provided in [1]_ for representative
modules and mounting, and are coded for convenience in
``temperature.TEMPERATURE_MODEL_PARAMETERS``.
+---------------+----------------+-------+---------+---------------------+
| Module | Mounting | a | b | :math:`\Delta T [C]`|
+===============+================+=======+=========+=====================+
| glass/glass | open rack | -3.47 | -0.0594 | 3 |
+---------------+----------------+-------+---------+---------------------+
| glass/glass | close roof | -2.98 | -0.0471 | 1 |
+---------------+----------------+-------+---------+---------------------+
| glass/polymer | open rack | -3.56 | -0.075 | 3 |
+---------------+----------------+-------+---------+---------------------+
| glass/polymer | insulated back | -2.81 | -0.0455 | 0 |
+---------------+----------------+-------+---------+---------------------+
References
----------
.. [1] King, D. et al, 2004, "Sandia Photovoltaic Array Performance
Model", SAND Report 3535, Sandia National Laboratories, Albuquerque,
NM.
'''
return poa_global * np.exp(a + b * wind_speed) + temp_air
def pvsyst_cell(poa_global, temp_air, wind_speed=1.0, u_c=29.0, u_v=0.0,
eta_m=0.1, alpha_absorption=0.9):
r"""
Calculate cell temperature using an empirical heat loss factor model
as implemented in PVsyst.
Parameters
----------
poa_global : numeric
Total incident irradiance [W/m^2].
temp_air : numeric
Ambient dry bulb temperature [C].
wind_speed : numeric, default 1.0
Wind speed in m/s measured at the same height for which the wind loss
factor was determined. The default value 1.0 m/2 is the wind
speed at module height used to determine NOCT. [m/s]
u_c : float, default 29.0
Combined heat loss factor coefficient. The default value is
representative of freestanding modules with the rear surfaces exposed
to open air (e.g., rack mounted). Parameter :math:`U_{c}` in
:eq:`pvsyst` [W/(m^2 C)].
u_v : float, default 0.0
Combined heat loss factor influenced by wind. Parameter :math:`U_{v}`
in :eq:`pvsyst` [(W/m^2 C)(m/s)].
eta_m : numeric, default 0.1
Module external efficiency as a fraction, i.e., DC power / poa_global.
Parameter :math:`\eta_{m}` in :eq:`pvsyst`.
alpha_absorption : numeric, default 0.9
Absorption coefficient. Parameter :math:`\alpha` in :eq:`pvsyst`.
Returns
-------
numeric, values in degrees Celsius
Notes
-----
The Pvsyst model for cell temperature :math:`T_{C}` is given by
.. math::
:label: pvsyst
T_{C} = T_{a} + \frac{\alpha E (1 - \eta_{m})}{U_{c} + U_{v} \times WS}
Inputs to the model are plane-of-array irradiance :math:`E` (W/m2), ambient
air temperature :math:`T_{a}` (C) and wind speed :math:`WS` (m/s). Model
output is cell temperature :math:`T_{C}`. Model parameters depend both on
the module construction and its mounting. Parameters are provided in
[1]_ for open (freestanding) and close (insulated) mounting configurations,
, and are coded for convenience in
``temperature.TEMPERATURE_MODEL_PARAMETERS``. The heat loss factors
provided represent the combined effect of convection, radiation and
conduction, and their values are experimentally determined.
+--------------+---------------+---------------+
| Mounting | :math:`U_{c}` | :math:`U_{v}` |
+==============+===============+===============+
| freestanding | 29.0 | 0.0 |
+--------------+---------------+---------------+
| insulated | 15.0 | 0.0 |
+--------------+---------------+---------------+
References
----------
.. [1] "PVsyst 6 Help", Files.pvsyst.com, 2018. [Online]. Available:
http://files.pvsyst.com/help/index.html. [Accessed: 10- Dec- 2018].
.. [2] Faiman, D. (2008). "Assessing the outdoor operating temperature of
photovoltaic modules." Progress in Photovoltaics 16(4): 307-315.
Examples
--------
>>> from pvlib.temperature import pvsyst_cell, TEMPERATURE_MODEL_PARAMETERS
>>> params = TEMPERATURE_MODEL_PARAMETERS['pvsyst']['freestanding']
>>> pvsyst_cell(1000, 10, **params)
37.93103448275862
"""
total_loss_factor = u_c + u_v * wind_speed
heat_input = poa_global * alpha_absorption * (1 - eta_m)
temp_difference = heat_input / total_loss_factor
return temp_air + temp_difference
def faiman(poa_global, temp_air, wind_speed=1.0, u0=25.0, u1=6.84):
'''
Calculate cell or module temperature using the Faiman model. The Faiman
model uses an empirical heat loss factor model [1]_ and is adopted in the
IEC 61853 standards [2]_ and [3]_.
Usage of this model in the IEC 61853 standard does not distinguish
between cell and module temperature.
Parameters
----------
poa_global : numeric
Total incident irradiance [W/m^2].
temp_air : numeric
Ambient dry bulb temperature [C].
wind_speed : numeric, default 1.0
Wind speed in m/s measured at the same height for which the wind loss
factor was determined. The default value 1.0 m/s is the wind
speed at module height used to determine NOCT. [m/s]
u0 : numeric, default 25.0
Combined heat loss factor coefficient. The default value is one
determined by Faiman for 7 silicon modules. [W/(m^2 C)].
u1 : numeric, default 6.84
Combined heat loss factor influenced by wind. The default value is one
determined by Faiman for 7 silicon modules. [(W/m^2 C)(m/s)].
Returns
-------
numeric, values in degrees Celsius
Notes
-----
All arguments may be scalars or vectors. If multiple arguments
are vectors they must be the same length.
References
----------
.. [1] Faiman, D. (2008). "Assessing the outdoor operating temperature of
photovoltaic modules." Progress in Photovoltaics 16(4): 307-315.
.. [2] "IEC 61853-2 Photovoltaic (PV) module performance testing and energy
rating - Part 2: Spectral responsivity, incidence angle and module
operating temperature measurements". IEC, Geneva, 2018.
.. [3] "IEC 61853-3 Photovoltaic (PV) module performance testing and energy
rating - Part 3: Energy rating of PV modules". IEC, Geneva, 2018.
'''
# Contributed by Anton Driesse (@adriesse), PV Performance Labs. Dec., 2019
# The following lines may seem odd since u0 & u1 are probably scalar,
# but it serves an indirect and easy way of allowing lists and
# tuples for the other function arguments.
u0 = np.asanyarray(u0)
u1 = np.asanyarray(u1)
total_loss_factor = u0 + u1 * wind_speed
heat_input = poa_global
temp_difference = heat_input / total_loss_factor
return temp_air + temp_difference