Skip to content

mostly documentation updates #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions docs/sphinx/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ Functions relevant for the SAPM model.

pvsystem.sapm
pvsystem.sapm_effective_irradiance
pvsystem.sapm_celltemp
pvsystem.sapm_spectral_loss
pvsystem.sapm_aoi_loss
pvsystem.snlinverter
Expand Down Expand Up @@ -485,7 +484,7 @@ ModelChain properties that are aliases for your specific modeling functions.
modelchain.ModelChain.ac_model
modelchain.ModelChain.aoi_model
modelchain.ModelChain.spectral_model
modelchain.ModelChain.temp_model
modelchain.ModelChain.temperature_model
modelchain.ModelChain.losses_model
modelchain.ModelChain.effective_irradiance_model

Expand Down Expand Up @@ -530,7 +529,7 @@ on the information in the associated :py:class:`~pvsystem.PVSystem` object.
modelchain.ModelChain.infer_ac_model
modelchain.ModelChain.infer_aoi_model
modelchain.ModelChain.infer_spectral_model
modelchain.ModelChain.infer_temp_model
modelchain.ModelChain.infer_temperature_model
modelchain.ModelChain.infer_losses_model

Functions
Expand Down
6 changes: 3 additions & 3 deletions docs/sphinx/source/clearsky.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ returns a :py:class:`pandas.DataFrame`.

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

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

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

Expand Down Expand Up @@ -168,7 +168,7 @@ varies from 300 m to 1500 m.

.. ipython::

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

In [1]: sites = [(32, -111, 'Tucson1'), (32.2, -110.9, 'Tucson2'),
...: (33.5, -112.1, 'Phoenix'), (35.1, -106.6, 'Albuquerque')]
Expand Down Expand Up @@ -608,7 +608,7 @@ GHI data. We first generate and plot the clear sky and measured data.

abq = Location(35.04, -106.62, altitude=1619)

times = pd.DatetimeIndex(start='2012-04-01 10:30:00', tz='Etc/GMT+7', periods=30, freq='1min')
times = pd.date_range(start='2012-04-01 10:30:00', tz='Etc/GMT+7', periods=30, freq='1min')

cs = abq.get_clearsky(times)

Expand Down
11 changes: 5 additions & 6 deletions docs/sphinx/source/forecasts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -440,19 +440,18 @@ for details.
.. ipython:: python

from pvlib.pvsystem import PVSystem, retrieve_sam
from pvlib.temperature import TEMPERATURE_MODEL_PARAMETERS
from pvlib.tracking import SingleAxisTracker
from pvlib.modelchain import ModelChain

sandia_modules = retrieve_sam('sandiamod')
cec_inverters = retrieve_sam('cecinverter')
module = sandia_modules['Canadian_Solar_CS5P_220M___2009_']
inverter = cec_inverters['SMA_America__SC630CP_US_315V__CEC_2012_']
temperature_model_parameters = TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_glass']

# model a big tracker for more fun
system = SingleAxisTracker(module_parameters=module,
inverter_parameters=inverter,
modules_per_string=15,
strings_per_inverter=300)
system = SingleAxisTracker(module_parameters=module, inverter_parameters=inverter, temperature_model_parameters=temperature_model_parameters, modules_per_string=15, strings_per_inverter=300)

# fx is a common abbreviation for forecast
fx_model = GFS()
Expand Down Expand Up @@ -480,9 +479,9 @@ Here's the forecast plane of array irradiance...

.. ipython:: python

mc.temps.plot();
mc.cell_temperature.plot();
@savefig pv_temps.png width=6in
plt.ylabel('Temperature (C)');
plt.ylabel('Cell Temperature (C)');
@suppress
plt.close();

Expand Down
20 changes: 12 additions & 8 deletions docs/sphinx/source/introexamples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ configuration at a handful of sites listed below.
import pandas as pd
import matplotlib.pyplot as plt

naive_times = pd.DatetimeIndex(start='2015', end='2016', freq='1h')
naive_times = pd.date_range(start='2015', end='2016', freq='1h')

# very approximate
# latitude, longitude, name, altitude, timezone
Expand All @@ -46,6 +46,7 @@ configuration at a handful of sites listed below.
sapm_inverters = pvlib.pvsystem.retrieve_sam('cecinverter')
module = sandia_modules['Canadian_Solar_CS5P_220M___2009_']
inverter = sapm_inverters['ABB__MICRO_0_25_I_OUTD_US_208_208V__CEC_2014_']
temperature_model_parameters = pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_glass']

# specify constant ambient air temp and wind for simplicity
temp_air = 20
Expand Down Expand Up @@ -88,12 +89,13 @@ to accomplish our system modeling goal:
cs['dni'], cs['ghi'], cs['dhi'],
dni_extra=dni_extra,
model='haydavies')
temps = pvlib.pvsystem.sapm_celltemp(total_irrad['poa_global'],
wind_speed, temp_air)
tcell = pvlib.temperature.sapm_cell(total_irrad['poa_global'],
temp_air, wind_speed,
**temperature_model_parameters)
effective_irradiance = pvlib.pvsystem.sapm_effective_irradiance(
total_irrad['poa_direct'], total_irrad['poa_diffuse'],
am_abs, aoi, module)
dc = pvlib.pvsystem.sapm(effective_irradiance, temps['temp_cell'], module)
dc = pvlib.pvsystem.sapm(effective_irradiance, tcell, module)
ac = pvlib.pvsystem.snlinverter(dc['v_mp'], dc['p_mp'], inverter)
annual_energy = ac.sum()
energies[name] = annual_energy
Expand Down Expand Up @@ -149,7 +151,8 @@ by examining the parameters defined for the module.
from pvlib.modelchain import ModelChain

system = PVSystem(module_parameters=module,
inverter_parameters=inverter)
inverter_parameters=inverter,
temperature_model_parameters=temperature_model_parameters)

energies = {}
for latitude, longitude, name, altitude, timezone in coordinates:
Expand Down Expand Up @@ -214,6 +217,7 @@ modeling goal:
for latitude, longitude, name, altitude, timezone in coordinates:
localized_system = LocalizedPVSystem(module_parameters=module,
inverter_parameters=inverter,
temperature_model_parameters=temperature_model_parameters,
surface_tilt=latitude,
surface_azimuth=180,
latitude=latitude,
Expand All @@ -229,15 +233,15 @@ modeling goal:
clearsky['dni'],
clearsky['ghi'],
clearsky['dhi'])
temps = localized_system.sapm_celltemp(total_irrad['poa_global'],
wind_speed, temp_air)
tcell = localized_system.sapm_celltemp(total_irrad['poa_global'],
temp_air, wind_speed)
aoi = localized_system.get_aoi(solar_position['apparent_zenith'],
solar_position['azimuth'])
airmass = localized_system.get_airmass(solar_position=solar_position)
effective_irradiance = localized_system.sapm_effective_irradiance(
total_irrad['poa_direct'], total_irrad['poa_diffuse'],
airmass['airmass_absolute'], aoi)
dc = localized_system.sapm(effective_irradiance, temps['temp_cell'])
dc = localized_system.sapm(effective_irradiance, tcell)
ac = localized_system.snlinverter(dc['v_mp'], dc['p_mp'])
annual_energy = ac.sum()
energies[name] = annual_energy
Expand Down
61 changes: 47 additions & 14 deletions docs/sphinx/source/modelchain.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ objects, module data, and inverter data.
from pvlib.pvsystem import PVSystem
from pvlib.location import Location
from pvlib.modelchain import ModelChain
from pvlib.temperature import TEMPERATURE_MODEL_PARAMETERS
temperature_model_parameters = TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_glass']

# load some module and inverter specifications
sandia_modules = pvlib.pvsystem.retrieve_sam('SandiaMod')
Expand All @@ -61,7 +63,8 @@ object.
location = Location(latitude=32.2, longitude=-110.9)
system = PVSystem(surface_tilt=20, surface_azimuth=200,
module_parameters=sandia_module,
inverter_parameters=cec_inverter)
inverter_parameters=cec_inverter,
temperature_model_parameters=temperature_model_parameters)
mc = ModelChain(system, location)

Printing a ModelChain object will display its models.
Expand All @@ -87,6 +90,10 @@ examples are shown below.

mc.aoi

.. ipython:: python

mc.cell_temperature

.. ipython:: python

mc.dc
Expand Down Expand Up @@ -141,8 +148,11 @@ model, AC model, AOI loss model, and spectral loss model.

.. ipython:: python

sapm_system = PVSystem(module_parameters=sandia_module, inverter_parameters=cec_inverter)
mc = ModelChain(system, location)
sapm_system = PVSystem(
module_parameters=sandia_module,
inverter_parameters=cec_inverter,
temperature_model_parameters=temperature_model_parameters)
mc = ModelChain(sapm_system, location)
print(mc)

.. ipython:: python
Expand All @@ -160,7 +170,10 @@ information to determine which of those models to choose.

.. ipython:: python

pvwatts_system = PVSystem(module_parameters={'pdc0': 240, 'gamma_pdc': -0.004})
pvwatts_system = PVSystem(
module_parameters={'pdc0': 240, 'gamma_pdc': -0.004},
inverter_parameters={'pdc0': 240},
temperature_model_parameters=temperature_model_parameters)
mc = ModelChain(pvwatts_system, location,
aoi_model='physical', spectral_model='no_loss')
print(mc)
Expand All @@ -176,8 +189,11 @@ functions for a PVSystem that contains SAPM-specific parameters.

.. ipython:: python

sapm_system = PVSystem(module_parameters=sandia_module, inverter_parameters=cec_inverter)
mc = ModelChain(system, location, aoi_model='physical', spectral_model='no_loss')
sapm_system = PVSystem(
module_parameters=sandia_module,
inverter_parameters=cec_inverter,
temperature_model_parameters=temperature_model_parameters)
mc = ModelChain(sapm_system, location, aoi_model='physical', spectral_model='no_loss')
print(mc)

.. ipython:: python
Expand Down Expand Up @@ -264,21 +280,24 @@ the ModelChain.pvwatts_dc method is shown below. Its only argument is

The ModelChain.pvwatts_dc method calls the pvwatts_dc method of the
PVSystem object that we supplied using data that is stored in its own
``effective_irradiance`` and ``temps`` attributes. Then it assigns the
``effective_irradiance`` and ``cell_temperature`` attributes. Then it assigns the
result to the ``dc`` attribute of the ModelChain object. The code below
shows a simple example of this.

.. ipython:: python

# make the objects
pvwatts_system = PVSystem(module_parameters={'pdc0': 240, 'gamma_pdc': -0.004})
pvwatts_system = PVSystem(
module_parameters={'pdc0': 240, 'gamma_pdc': -0.004},
inverter_parameters={'pdc0': 240},
temperature_model_parameters=temperature_model_parameters)
mc = ModelChain(pvwatts_system, location,
aoi_model='no_loss', spectral_model='no_loss')

# manually assign data to the attributes that ModelChain.pvwatts_dc will need.
# for standard workflows, run_model would assign these attributes.
mc.effective_irradiance = pd.Series(1000, index=[pd.Timestamp('20170401 1200-0700')])
mc.temps = pd.DataFrame({'temp_cell': 50, 'temp_module': 50}, index=[pd.Timestamp('20170401 1200-0700')])
mc.cell_temperature = pd.Series(50, index=[pd.Timestamp('20170401 1200-0700')])

# run ModelChain.pvwatts_dc and look at the result
mc.pvwatts_dc();
Expand All @@ -304,13 +323,16 @@ PVSystem.scale_voltage_current_power method.
.. ipython:: python

# make the objects
sapm_system = PVSystem(module_parameters=sandia_module, inverter_parameters=cec_inverter)
sapm_system = PVSystem(
module_parameters=sandia_module,
inverter_parameters=cec_inverter,
temperature_model_parameters=temperature_model_parameters)
mc = ModelChain(sapm_system, location)

# manually assign data to the attributes that ModelChain.sapm will need.
# for standard workflows, run_model would assign these attributes.
mc.effective_irradiance = pd.Series(1000, index=[pd.Timestamp('20170401 1200-0700')])
mc.temps = pd.DataFrame({'temp_cell': 50, 'temp_module': 50}, index=[pd.Timestamp('20170401 1200-0700')])
mc.cell_temperature = pd.Series(50, index=[pd.Timestamp('20170401 1200-0700')])

# run ModelChain.sapm and look at the result
mc.sapm();
Expand All @@ -333,7 +355,10 @@ section.

.. ipython:: python

pvwatts_system = PVSystem(module_parameters={'pdc0': 240, 'gamma_pdc': -0.004})
pvwatts_system = PVSystem(
module_parameters={'pdc0': 240, 'gamma_pdc': -0.004},
inverter_parameters={'pdc0': 240},
temperature_model_parameters=temperature_model_parameters)
mc = ModelChain(pvwatts_system, location,
aoi_model='no_loss', spectral_model='no_loss')
mc.dc_model.__func__
Expand Down Expand Up @@ -403,18 +428,26 @@ function if you wanted to.
return mc


def pvusa_ac_mc_wrapper(mc):
def pvusa_ac_mc(mc):
# keep it simple
mc.ac = mc.dc
return mc


def no_loss_temperature(mc):
# keep it simple
mc.cell_temperature = mc.weather['temp_air']
return mc


.. ipython:: python

module_parameters = {'a': 0.2, 'b': 0.00001, 'c': 0.001, 'd': -0.00005}
pvusa_system = PVSystem(module_parameters=module_parameters)

mc = ModelChain(pvusa_system, location,
dc_model=pvusa_mc_wrapper, ac_model=pvusa_ac_mc_wrapper,
dc_model=pvusa_mc_wrapper, ac_model=pvusa_ac_mc,
temperature_model=no_loss_temperature,
aoi_model='no_loss', spectral_model='no_loss')

A ModelChain object uses Python’s functools.partial function to assign
Expand Down
30 changes: 19 additions & 11 deletions docs/sphinx/source/whatsnew/v0.7.0.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _whatsnew_0700:

v0.7.0 (MONTH DAY, YEAR)
---------------------
------------------------

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

API Changes
~~~~~~~~~~~
* Changes to functions and methods for cell temperature models:
(:issue:`678')
- Moved functions for cell temperature and constant
* Changes to functions and methods for cell temperature models (:issue:`678`):
- Moved functions for cell temperature and constant
`TEMP_MODEL_PARAMS` from `pvsystem.py` to `temperature.py`.
- Renamed `pvsystem.sapm_celltemp` and `pvsystem.pvsyst_celltemp`
to `temperature.sapm_cell` and `temperature.pvsyst_cell`.
Expand All @@ -28,23 +27,32 @@ API Changes
`temperature.pvsyst_cell`. These functions now require model-specific parameters.
- Added the argument `irrad_ref`, default value 1000, to `temperature.sapm_cell`.
- Renamed `pvsystem.TEMP_MODEL_PARAMS` to `temperature.TEMPERATURE_MODEL_PARAMETERS`.
- `temperature.TEMPERATURE_MODEL_PARAMETERS` uses dict rather than tuple for a parameter set.
- `temperature.TEMPERATURE_MODEL_PARAMETERS` uses dict rather than
tuple for a parameter set.
- Parameter set names for `temperature.TEMPERATURE_MODEL_PARAMETERS` have changed.
- 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.
- 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.
- `temperature.TEMPERATURE_MODEL_PARAMETERS` uses dict rather than tuple for a parameter set.
- Added attribute `PVSystem.module_type` (str) to record module
front and back materials, default is `glass_polymer`.
- Added attribute `PVSystem.temperature_model_parameters` (dict)
to contain temperature model parameters.
- Changed meaning of `PVSystem.racking_model` to describe racking
only, e.g., default is `open_rack`.
- 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.
- 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.
- `ModelChain.temp_model` renamed to `ModelChain.temperature_model`.
- `ModelChain.temps` attribute renamed to `ModelChain.cell_temperature`, and its datatype is now `numeric` rather than `DataFrame`.
- Implemented `pvsyst` as an option for `ModelChain.temperature_model`.
- `ModelChain.temperature_model` now defaults to `None`. The temperature
model can be inferred from
`PVSystem.temperature_model_parameters`.
- `modelchain.basic_chain` has a new required argument `temperature_model_parameters`.
model can be inferred from `PVSystem.temperature_model_parameters`.
- Implemented `pvsyst` as an option for `ModelChain.temperature_model`.
- `modelchain.basic_chain` has a new required argument
`temperature_model_parameters`.


Enhancements
~~~~~~~~~~~~
Expand Down
Loading