Skip to content

Commit b067f8e

Browse files
authored
Merge pull request #5 from wholmgren/celltemp
mostly documentation updates
2 parents 62ed9dc + 7818459 commit b067f8e

File tree

8 files changed

+116
-58
lines changed

8 files changed

+116
-58
lines changed

docs/sphinx/source/api.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ Functions relevant for the SAPM model.
268268

269269
pvsystem.sapm
270270
pvsystem.sapm_effective_irradiance
271-
pvsystem.sapm_celltemp
272271
pvsystem.sapm_spectral_loss
273272
pvsystem.sapm_aoi_loss
274273
pvsystem.snlinverter
@@ -485,7 +484,7 @@ ModelChain properties that are aliases for your specific modeling functions.
485484
modelchain.ModelChain.ac_model
486485
modelchain.ModelChain.aoi_model
487486
modelchain.ModelChain.spectral_model
488-
modelchain.ModelChain.temp_model
487+
modelchain.ModelChain.temperature_model
489488
modelchain.ModelChain.losses_model
490489
modelchain.ModelChain.effective_irradiance_model
491490

@@ -530,7 +529,7 @@ on the information in the associated :py:class:`~pvsystem.PVSystem` object.
530529
modelchain.ModelChain.infer_ac_model
531530
modelchain.ModelChain.infer_aoi_model
532531
modelchain.ModelChain.infer_spectral_model
533-
modelchain.ModelChain.infer_temp_model
532+
modelchain.ModelChain.infer_temperature_model
534533
modelchain.ModelChain.infer_losses_model
535534

536535
Functions

docs/sphinx/source/clearsky.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ returns a :py:class:`pandas.DataFrame`.
6868

6969
In [1]: tus = Location(32.2, -111, 'US/Arizona', 700, 'Tucson')
7070

71-
In [1]: times = pd.DatetimeIndex(start='2016-07-01', end='2016-07-04', freq='1min', tz=tus.tz)
71+
In [1]: times = pd.date_range(start='2016-07-01', end='2016-07-04', freq='1min', tz=tus.tz)
7272

7373
In [1]: cs = tus.get_clearsky(times) # ineichen with climatology table by default
7474

@@ -168,7 +168,7 @@ varies from 300 m to 1500 m.
168168

169169
.. ipython::
170170

171-
In [1]: times = pd.DatetimeIndex(start='2015-01-01', end='2016-01-01', freq='1D')
171+
In [1]: times = pd.date_range(start='2015-01-01', end='2016-01-01', freq='1D')
172172

173173
In [1]: sites = [(32, -111, 'Tucson1'), (32.2, -110.9, 'Tucson2'),
174174
...: (33.5, -112.1, 'Phoenix'), (35.1, -106.6, 'Albuquerque')]
@@ -608,7 +608,7 @@ GHI data. We first generate and plot the clear sky and measured data.
608608
609609
abq = Location(35.04, -106.62, altitude=1619)
610610
611-
times = pd.DatetimeIndex(start='2012-04-01 10:30:00', tz='Etc/GMT+7', periods=30, freq='1min')
611+
times = pd.date_range(start='2012-04-01 10:30:00', tz='Etc/GMT+7', periods=30, freq='1min')
612612
613613
cs = abq.get_clearsky(times)
614614

docs/sphinx/source/forecasts.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -440,19 +440,18 @@ for details.
440440
.. ipython:: python
441441
442442
from pvlib.pvsystem import PVSystem, retrieve_sam
443+
from pvlib.temperature import TEMPERATURE_MODEL_PARAMETERS
443444
from pvlib.tracking import SingleAxisTracker
444445
from pvlib.modelchain import ModelChain
445446
446447
sandia_modules = retrieve_sam('sandiamod')
447448
cec_inverters = retrieve_sam('cecinverter')
448449
module = sandia_modules['Canadian_Solar_CS5P_220M___2009_']
449450
inverter = cec_inverters['SMA_America__SC630CP_US_315V__CEC_2012_']
451+
temperature_model_parameters = TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_glass']
450452
451453
# model a big tracker for more fun
452-
system = SingleAxisTracker(module_parameters=module,
453-
inverter_parameters=inverter,
454-
modules_per_string=15,
455-
strings_per_inverter=300)
454+
system = SingleAxisTracker(module_parameters=module, inverter_parameters=inverter, temperature_model_parameters=temperature_model_parameters, modules_per_string=15, strings_per_inverter=300)
456455
457456
# fx is a common abbreviation for forecast
458457
fx_model = GFS()
@@ -480,9 +479,9 @@ Here's the forecast plane of array irradiance...
480479

481480
.. ipython:: python
482481
483-
mc.temps.plot();
482+
mc.cell_temperature.plot();
484483
@savefig pv_temps.png width=6in
485-
plt.ylabel('Temperature (C)');
484+
plt.ylabel('Cell Temperature (C)');
486485
@suppress
487486
plt.close();
488487

docs/sphinx/source/introexamples.rst

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ configuration at a handful of sites listed below.
3030
import pandas as pd
3131
import matplotlib.pyplot as plt
3232
33-
naive_times = pd.DatetimeIndex(start='2015', end='2016', freq='1h')
33+
naive_times = pd.date_range(start='2015', end='2016', freq='1h')
3434
3535
# very approximate
3636
# latitude, longitude, name, altitude, timezone
@@ -46,6 +46,7 @@ configuration at a handful of sites listed below.
4646
sapm_inverters = pvlib.pvsystem.retrieve_sam('cecinverter')
4747
module = sandia_modules['Canadian_Solar_CS5P_220M___2009_']
4848
inverter = sapm_inverters['ABB__MICRO_0_25_I_OUTD_US_208_208V__CEC_2014_']
49+
temperature_model_parameters = pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_glass']
4950
5051
# specify constant ambient air temp and wind for simplicity
5152
temp_air = 20
@@ -88,12 +89,13 @@ to accomplish our system modeling goal:
8889
cs['dni'], cs['ghi'], cs['dhi'],
8990
dni_extra=dni_extra,
9091
model='haydavies')
91-
temps = pvlib.pvsystem.sapm_celltemp(total_irrad['poa_global'],
92-
wind_speed, temp_air)
92+
tcell = pvlib.temperature.sapm_cell(total_irrad['poa_global'],
93+
temp_air, wind_speed,
94+
**temperature_model_parameters)
9395
effective_irradiance = pvlib.pvsystem.sapm_effective_irradiance(
9496
total_irrad['poa_direct'], total_irrad['poa_diffuse'],
9597
am_abs, aoi, module)
96-
dc = pvlib.pvsystem.sapm(effective_irradiance, temps['temp_cell'], module)
98+
dc = pvlib.pvsystem.sapm(effective_irradiance, tcell, module)
9799
ac = pvlib.pvsystem.snlinverter(dc['v_mp'], dc['p_mp'], inverter)
98100
annual_energy = ac.sum()
99101
energies[name] = annual_energy
@@ -149,7 +151,8 @@ by examining the parameters defined for the module.
149151
from pvlib.modelchain import ModelChain
150152
151153
system = PVSystem(module_parameters=module,
152-
inverter_parameters=inverter)
154+
inverter_parameters=inverter,
155+
temperature_model_parameters=temperature_model_parameters)
153156
154157
energies = {}
155158
for latitude, longitude, name, altitude, timezone in coordinates:
@@ -214,6 +217,7 @@ modeling goal:
214217
for latitude, longitude, name, altitude, timezone in coordinates:
215218
localized_system = LocalizedPVSystem(module_parameters=module,
216219
inverter_parameters=inverter,
220+
temperature_model_parameters=temperature_model_parameters,
217221
surface_tilt=latitude,
218222
surface_azimuth=180,
219223
latitude=latitude,
@@ -229,15 +233,15 @@ modeling goal:
229233
clearsky['dni'],
230234
clearsky['ghi'],
231235
clearsky['dhi'])
232-
temps = localized_system.sapm_celltemp(total_irrad['poa_global'],
233-
wind_speed, temp_air)
236+
tcell = localized_system.sapm_celltemp(total_irrad['poa_global'],
237+
temp_air, wind_speed)
234238
aoi = localized_system.get_aoi(solar_position['apparent_zenith'],
235239
solar_position['azimuth'])
236240
airmass = localized_system.get_airmass(solar_position=solar_position)
237241
effective_irradiance = localized_system.sapm_effective_irradiance(
238242
total_irrad['poa_direct'], total_irrad['poa_diffuse'],
239243
airmass['airmass_absolute'], aoi)
240-
dc = localized_system.sapm(effective_irradiance, temps['temp_cell'])
244+
dc = localized_system.sapm(effective_irradiance, tcell)
241245
ac = localized_system.snlinverter(dc['v_mp'], dc['p_mp'])
242246
annual_energy = ac.sum()
243247
energies[name] = annual_energy

docs/sphinx/source/modelchain.rst

Lines changed: 47 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ objects, module data, and inverter data.
4545
from pvlib.pvsystem import PVSystem
4646
from pvlib.location import Location
4747
from pvlib.modelchain import ModelChain
48+
from pvlib.temperature import TEMPERATURE_MODEL_PARAMETERS
49+
temperature_model_parameters = TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_glass']
4850
4951
# load some module and inverter specifications
5052
sandia_modules = pvlib.pvsystem.retrieve_sam('SandiaMod')
@@ -61,7 +63,8 @@ object.
6163
location = Location(latitude=32.2, longitude=-110.9)
6264
system = PVSystem(surface_tilt=20, surface_azimuth=200,
6365
module_parameters=sandia_module,
64-
inverter_parameters=cec_inverter)
66+
inverter_parameters=cec_inverter,
67+
temperature_model_parameters=temperature_model_parameters)
6568
mc = ModelChain(system, location)
6669
6770
Printing a ModelChain object will display its models.
@@ -87,6 +90,10 @@ examples are shown below.
8790
8891
mc.aoi
8992
93+
.. ipython:: python
94+
95+
mc.cell_temperature
96+
9097
.. ipython:: python
9198
9299
mc.dc
@@ -141,8 +148,11 @@ model, AC model, AOI loss model, and spectral loss model.
141148

142149
.. ipython:: python
143150
144-
sapm_system = PVSystem(module_parameters=sandia_module, inverter_parameters=cec_inverter)
145-
mc = ModelChain(system, location)
151+
sapm_system = PVSystem(
152+
module_parameters=sandia_module,
153+
inverter_parameters=cec_inverter,
154+
temperature_model_parameters=temperature_model_parameters)
155+
mc = ModelChain(sapm_system, location)
146156
print(mc)
147157
148158
.. ipython:: python
@@ -160,7 +170,10 @@ information to determine which of those models to choose.
160170

161171
.. ipython:: python
162172
163-
pvwatts_system = PVSystem(module_parameters={'pdc0': 240, 'gamma_pdc': -0.004})
173+
pvwatts_system = PVSystem(
174+
module_parameters={'pdc0': 240, 'gamma_pdc': -0.004},
175+
inverter_parameters={'pdc0': 240},
176+
temperature_model_parameters=temperature_model_parameters)
164177
mc = ModelChain(pvwatts_system, location,
165178
aoi_model='physical', spectral_model='no_loss')
166179
print(mc)
@@ -176,8 +189,11 @@ functions for a PVSystem that contains SAPM-specific parameters.
176189

177190
.. ipython:: python
178191
179-
sapm_system = PVSystem(module_parameters=sandia_module, inverter_parameters=cec_inverter)
180-
mc = ModelChain(system, location, aoi_model='physical', spectral_model='no_loss')
192+
sapm_system = PVSystem(
193+
module_parameters=sandia_module,
194+
inverter_parameters=cec_inverter,
195+
temperature_model_parameters=temperature_model_parameters)
196+
mc = ModelChain(sapm_system, location, aoi_model='physical', spectral_model='no_loss')
181197
print(mc)
182198
183199
.. ipython:: python
@@ -264,21 +280,24 @@ the ModelChain.pvwatts_dc method is shown below. Its only argument is
264280
265281
The ModelChain.pvwatts_dc method calls the pvwatts_dc method of the
266282
PVSystem object that we supplied using data that is stored in its own
267-
``effective_irradiance`` and ``temps`` attributes. Then it assigns the
283+
``effective_irradiance`` and ``cell_temperature`` attributes. Then it assigns the
268284
result to the ``dc`` attribute of the ModelChain object. The code below
269285
shows a simple example of this.
270286

271287
.. ipython:: python
272288
273289
# make the objects
274-
pvwatts_system = PVSystem(module_parameters={'pdc0': 240, 'gamma_pdc': -0.004})
290+
pvwatts_system = PVSystem(
291+
module_parameters={'pdc0': 240, 'gamma_pdc': -0.004},
292+
inverter_parameters={'pdc0': 240},
293+
temperature_model_parameters=temperature_model_parameters)
275294
mc = ModelChain(pvwatts_system, location,
276295
aoi_model='no_loss', spectral_model='no_loss')
277296
278297
# manually assign data to the attributes that ModelChain.pvwatts_dc will need.
279298
# for standard workflows, run_model would assign these attributes.
280299
mc.effective_irradiance = pd.Series(1000, index=[pd.Timestamp('20170401 1200-0700')])
281-
mc.temps = pd.DataFrame({'temp_cell': 50, 'temp_module': 50}, index=[pd.Timestamp('20170401 1200-0700')])
300+
mc.cell_temperature = pd.Series(50, index=[pd.Timestamp('20170401 1200-0700')])
282301
283302
# run ModelChain.pvwatts_dc and look at the result
284303
mc.pvwatts_dc();
@@ -304,13 +323,16 @@ PVSystem.scale_voltage_current_power method.
304323
.. ipython:: python
305324
306325
# make the objects
307-
sapm_system = PVSystem(module_parameters=sandia_module, inverter_parameters=cec_inverter)
326+
sapm_system = PVSystem(
327+
module_parameters=sandia_module,
328+
inverter_parameters=cec_inverter,
329+
temperature_model_parameters=temperature_model_parameters)
308330
mc = ModelChain(sapm_system, location)
309331
310332
# manually assign data to the attributes that ModelChain.sapm will need.
311333
# for standard workflows, run_model would assign these attributes.
312334
mc.effective_irradiance = pd.Series(1000, index=[pd.Timestamp('20170401 1200-0700')])
313-
mc.temps = pd.DataFrame({'temp_cell': 50, 'temp_module': 50}, index=[pd.Timestamp('20170401 1200-0700')])
335+
mc.cell_temperature = pd.Series(50, index=[pd.Timestamp('20170401 1200-0700')])
314336
315337
# run ModelChain.sapm and look at the result
316338
mc.sapm();
@@ -333,7 +355,10 @@ section.
333355

334356
.. ipython:: python
335357
336-
pvwatts_system = PVSystem(module_parameters={'pdc0': 240, 'gamma_pdc': -0.004})
358+
pvwatts_system = PVSystem(
359+
module_parameters={'pdc0': 240, 'gamma_pdc': -0.004},
360+
inverter_parameters={'pdc0': 240},
361+
temperature_model_parameters=temperature_model_parameters)
337362
mc = ModelChain(pvwatts_system, location,
338363
aoi_model='no_loss', spectral_model='no_loss')
339364
mc.dc_model.__func__
@@ -403,18 +428,26 @@ function if you wanted to.
403428
return mc
404429
405430
406-
def pvusa_ac_mc_wrapper(mc):
431+
def pvusa_ac_mc(mc):
407432
# keep it simple
408433
mc.ac = mc.dc
409434
return mc
410435
436+
437+
def no_loss_temperature(mc):
438+
# keep it simple
439+
mc.cell_temperature = mc.weather['temp_air']
440+
return mc
441+
442+
411443
.. ipython:: python
412444
413445
module_parameters = {'a': 0.2, 'b': 0.00001, 'c': 0.001, 'd': -0.00005}
414446
pvusa_system = PVSystem(module_parameters=module_parameters)
415447
416448
mc = ModelChain(pvusa_system, location,
417-
dc_model=pvusa_mc_wrapper, ac_model=pvusa_ac_mc_wrapper,
449+
dc_model=pvusa_mc_wrapper, ac_model=pvusa_ac_mc,
450+
temperature_model=no_loss_temperature,
418451
aoi_model='no_loss', spectral_model='no_loss')
419452
420453
A ModelChain object uses Python’s functools.partial function to assign

docs/sphinx/source/whatsnew/v0.7.0.rst

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. _whatsnew_0700:
22

33
v0.7.0 (MONTH DAY, YEAR)
4-
---------------------
4+
------------------------
55

66
This is a major release that drops support for Python 2 and Python 3.4. We
77
recommend all users of v0.6.3 upgrade to this release after checking API
@@ -12,9 +12,8 @@ compatibility notes.
1212

1313
API Changes
1414
~~~~~~~~~~~
15-
* Changes to functions and methods for cell temperature models:
16-
(:issue:`678')
17-
- Moved functions for cell temperature and constant
15+
* Changes to functions and methods for cell temperature models (:issue:`678`):
16+
- Moved functions for cell temperature and constant
1817
`TEMP_MODEL_PARAMS` from `pvsystem.py` to `temperature.py`.
1918
- Renamed `pvsystem.sapm_celltemp` and `pvsystem.pvsyst_celltemp`
2019
to `temperature.sapm_cell` and `temperature.pvsyst_cell`.
@@ -28,23 +27,32 @@ API Changes
2827
`temperature.pvsyst_cell`. These functions now require model-specific parameters.
2928
- Added the argument `irrad_ref`, default value 1000, to `temperature.sapm_cell`.
3029
- Renamed `pvsystem.TEMP_MODEL_PARAMS` to `temperature.TEMPERATURE_MODEL_PARAMETERS`.
31-
- `temperature.TEMPERATURE_MODEL_PARAMETERS` uses dict rather than tuple for a parameter set.
30+
- `temperature.TEMPERATURE_MODEL_PARAMETERS` uses dict rather than
31+
tuple for a parameter set.
3232
- Parameter set names for `temperature.TEMPERATURE_MODEL_PARAMETERS` have changed.
33-
- Parameter sets for the SAPM cell temperature model named 'open_rack_polymer_thinfilm_steel' and '22x_concentrator_tracker' are considered obsolete and have been removed.
33+
- Parameter sets for the SAPM cell temperature model named
34+
'open_rack_polymer_thinfilm_steel' and '22x_concentrator_tracker'
35+
are considered obsolete and have been removed.
36+
- `temperature.TEMPERATURE_MODEL_PARAMETERS` uses dict rather than tuple for a parameter set.
3437
- Added attribute `PVSystem.module_type` (str) to record module
3538
front and back materials, default is `glass_polymer`.
3639
- Added attribute `PVSystem.temperature_model_parameters` (dict)
3740
to contain temperature model parameters.
3841
- Changed meaning of `PVSystem.racking_model` to describe racking
3942
only, e.g., default is `open_rack`.
40-
- In `PVSystem.sapm_celltemp` and `PVSystem.pvsyst_celltemp`, changed kwarg `model` to `parameter_set`. `parameter_set` expects a str which is a valid key for `temperature.TEMPERATURE_MODEL_PARAMETERS` for the corresponding temperature model.
43+
- In `PVSystem.sapm_celltemp` and `PVSystem.pvsyst_celltemp`,
44+
changed kwarg `model` to `parameter_set`. `parameter_set` expects
45+
a str which is a valid key for
46+
`temperature.TEMPERATURE_MODEL_PARAMETERS` for the corresponding
47+
temperature model.
4148
- `ModelChain.temp_model` renamed to `ModelChain.temperature_model`.
4249
- `ModelChain.temps` attribute renamed to `ModelChain.cell_temperature`, and its datatype is now `numeric` rather than `DataFrame`.
43-
- Implemented `pvsyst` as an option for `ModelChain.temperature_model`.
4450
- `ModelChain.temperature_model` now defaults to `None`. The temperature
45-
model can be inferred from
46-
`PVSystem.temperature_model_parameters`.
47-
- `modelchain.basic_chain` has a new required argument `temperature_model_parameters`.
51+
model can be inferred from `PVSystem.temperature_model_parameters`.
52+
- Implemented `pvsyst` as an option for `ModelChain.temperature_model`.
53+
- `modelchain.basic_chain` has a new required argument
54+
`temperature_model_parameters`.
55+
4856

4957
Enhancements
5058
~~~~~~~~~~~~

0 commit comments

Comments
 (0)