Skip to content

move celltemp functions to temperature.py, expose celltemp.pvsyst in ModelChain #682

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 111 commits into from
Sep 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
d121ee4
move celltemp functions to celltemp.py, fix docstring for pvsystem.PV…
cwhanse Mar 29, 2019
c7ef419
formatting
cwhanse Mar 29, 2019
2d807eb
formatting
cwhanse Mar 29, 2019
f475120
initial commit fit_cec_using_sam
cwhanse May 3, 2019
7454e4d
outline ivcurves
cwhanse May 3, 2019
9c5e1a9
use nrel-pysam
cwhanse May 6, 2019
593f355
remove sam_dir
cwhanse May 7, 2019
4ab1fed
add Sandia single curve fit
cwhanse May 7, 2019
8a8890f
complete function
cwhanse May 9, 2019
b72b0b4
add test, move code to ivtools.py
cwhanse May 10, 2019
921aea8
remove single files
cwhanse May 10, 2019
4f4ad0f
Merge branch 'master' of https://github.com/pvlib/pvlib-python into i…
cwhanse May 13, 2019
e9b60be
Merge branch 'ivtools' of https://github.com/cwhanse/pvlib-python
May 14, 2019
986f72c
Merge branch 'master' of https://github.com/pvlib/pvlib-python into c…
cwhanse Jul 11, 2019
3371830
fix mock
cwhanse Jul 12, 2019
3baa037
add celltemp.pvsyst as a ModelChain option, change order of arguments…
cwhanse Jul 12, 2019
eb3c996
lint
cwhanse Jul 12, 2019
62adf2a
argument order fixes
cwhanse Jul 15, 2019
791926d
another argument order fix
cwhanse Jul 15, 2019
3095907
another argument order fix, change model_params to model in celltemp.…
cwhanse Jul 15, 2019
abeccd3
more model_params to model cleanup
cwhanse Jul 15, 2019
71ee15b
pare back modelchain test
cwhanse Jul 15, 2019
d925b5a
put test back in to hit ModelChain.pvsyst_temp
cwhanse Jul 15, 2019
e1987bb
output dataframe from celltemp.pvsyst
cwhanse Jul 15, 2019
8d91be3
cleanup tests with pvsyst output as dataframe
cwhanse Jul 15, 2019
58725c8
fix dataframe creation in celltemp.pvsyst
cwhanse Jul 15, 2019
b2bd4eb
fix type checking
cwhanse Jul 15, 2019
0ad5d42
fix test condition
cwhanse Jul 15, 2019
8bfc568
update api, whatsnew
cwhanse Jul 15, 2019
8d640a6
comment responses
cwhanse Jul 18, 2019
9f58994
change arguments for celltemp.sapm
cwhanse Jul 24, 2019
4ddb1cd
fix conflict
cwhanse Jul 24, 2019
dd0658a
fix kwarg error
cwhanse Jul 24, 2019
c8c89d7
update whatsnew
cwhanse Jul 24, 2019
e55cc31
Merge branch 'master' of https://github.com/pvlib/pvlib-python into c…
cwhanse Jul 24, 2019
507d524
test fixes, table formatting
cwhanse Jul 24, 2019
fad7c7c
docstring fixes
cwhanse Jul 25, 2019
a9153fa
edits to celltemp.pvsyst
cwhanse Jul 25, 2019
60f370b
add PVsystem properties, move PVsystem tests back to test_pvsystem.py
cwhanse Jul 25, 2019
fc80867
start working on ModelChain
cwhanse Jul 25, 2019
19571c9
fix ModelChain tests
cwhanse Jul 25, 2019
6283a56
modelchain fixes
cwhanse Jul 25, 2019
719b9b8
modelchain test fixes
cwhanse Jul 25, 2019
c527075
modelchain test fixes
cwhanse Jul 26, 2019
411c0dc
more modelchain test fixes
cwhanse Jul 26, 2019
0d0349a
add infer_temp_model
cwhanse Jul 26, 2019
520c106
lint, test fixes
cwhanse Jul 26, 2019
69a212f
yet more modelchain test fixes
cwhanse Jul 26, 2019
683dd9c
update whatsnew, improve coverage
cwhanse Jul 26, 2019
d1244df
fix deprecated test
cwhanse Jul 26, 2019
ed2f2c4
merge upstream
cwhanse Jul 27, 2019
488c3dd
fix import
cwhanse Jul 27, 2019
82c47c0
one more MC test fix
cwhanse Jul 27, 2019
2a540ce
rename functions, change output type
cwhanse Jul 30, 2019
90fea75
Merge branch 'celltemp' of https://github.com/cwhanse/pvlib-python in…
cwhanse Jul 30, 2019
dfd939e
change argument names, add parameter_set lookup
cwhanse Jul 31, 2019
4169e93
fix function names
cwhanse Jul 31, 2019
7706431
fix function names more
cwhanse Jul 31, 2019
aaeda87
update modelchain and tests
cwhanse Jul 31, 2019
21ccba3
more test fixes
cwhanse Jul 31, 2019
0233bb3
test fixes
cwhanse Jul 31, 2019
a5fb7d6
lint
cwhanse Jul 31, 2019
bb09909
Merge branch 'master' of https://github.com/pvlib/pvlib-python into c…
cwhanse Aug 1, 2019
14bddba
lint, merge master
cwhanse Aug 1, 2019
f3aa875
lint, remove pvwatts_dc_pvwatts_ac_system fixture from test_modelchai…
cwhanse Aug 1, 2019
7825d42
rename from celltemp to temperature
cwhanse Aug 1, 2019
8b52ea0
lint, rename test_celltemp.py
cwhanse Aug 1, 2019
9c2d5d3
cleanup docstrings
cwhanse Aug 2, 2019
33f4f57
add invalid test for infer_temp_model
cwhanse Aug 19, 2019
c9ea10e
Merge branch 'master' of https://github.com/pvlib/pvlib-python
Aug 21, 2019
da8e98e
Merge branch 'celltemp' of https://github.com/cwhanse/pvlib-python in…
Aug 21, 2019
a14deb2
review comments
Aug 21, 2019
7cea61c
remove unrelated code
cwhanse Aug 22, 2019
d18ee63
handle deprecated attributes and functions
cwhanse Aug 23, 2019
79f6d02
test fixes
cwhanse Aug 23, 2019
d996014
fix documentation
wholmgren Aug 23, 2019
a8b4ec9
Merge remote-tracking branch 'cwhanse/celltemp' into celltemp
wholmgren Aug 23, 2019
4d58361
fix infer_temp_model naming, whatsnew
wholmgren Aug 23, 2019
62ed9dc
test fixes and docstring edits
cwhanse Aug 23, 2019
7818459
Merge branch 'celltemp' into celltemp
cwhanse Aug 23, 2019
b067f8e
Merge pull request #5 from wholmgren/celltemp
cwhanse Aug 23, 2019
4a60c37
handle ModelChain deprecated behavior, test type input of _translate …
cwhanse Aug 24, 2019
9eae773
test fixes
cwhanse Aug 25, 2019
919562a
fix tests
cwhanse Aug 25, 2019
e120bde
another test fix
cwhanse Aug 25, 2019
b2b959b
pop unused kwarg
cwhanse Aug 25, 2019
fd6a97d
improve test coverage
cwhanse Aug 26, 2019
6a9d03f
test fixes
cwhanse Aug 26, 2019
04eb5a4
add UserWarning
cwhanse Aug 26, 2019
ddb84ae
improve warnings
cwhanse Aug 26, 2019
8b9ce93
use property setter
cwhanse Aug 26, 2019
0ba33ae
test fixes
cwhanse Aug 26, 2019
0aaa9fc
yet another code fix trying to distinguish kwargs from attribute of s…
cwhanse Aug 26, 2019
4753857
still struggling with tests
cwhanse Aug 27, 2019
fcd7a5d
reset system between ModelChain init
cwhanse Aug 27, 2019
4be420e
infer parameters from racking, module_type
cwhanse Aug 29, 2019
1ff9476
merge master, add temperature model fixture
cwhanse Aug 29, 2019
7271b00
add the missing colon
cwhanse Aug 30, 2019
17cfd2a
delete vestigial lines
cwhanse Aug 30, 2019
5762abe
test fixes
cwhanse Aug 30, 2019
0c24bbb
fix tests, reformat whatsnew section
cwhanse Aug 30, 2019
ae64e04
test fix
cwhanse Aug 30, 2019
7226983
better handling of deprecated behavior, add consistency check tempera…
cwhanse Aug 30, 2019
8aa4530
fix method check
cwhanse Aug 30, 2019
07c5da7
missing .
cwhanse Aug 30, 2019
abd9c7a
update tests
cwhanse Aug 31, 2019
d59b016
remove duplicate test value, clarify TODO comment
cwhanse Aug 31, 2019
34cedaf
consistent import of tools
cwhanse Sep 5, 2019
4aaf318
insert blank line
cwhanse Sep 5, 2019
f2e0de0
remove parameter_set arg from PVSystem methods
cwhanse Sep 5, 2019
6a13830
lint
cwhanse Sep 5, 2019
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
35 changes: 24 additions & 11 deletions docs/sphinx/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,16 @@ AOI modifiers
pvsystem.ashraeiam
pvsystem.sapm_aoi_loss

PV temperature models
---------------------

.. autosummary::
:toctree: generated/

temperature.sapm_cell
temperature.sapm_module
temperature.pvsyst_cell

Single diode models
-------------------

Expand Down Expand Up @@ -258,29 +268,31 @@ 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
temperature.sapm_cell

PVWatts model
Pvsyst model
-------------

Functions relevant for the Pvsyst model.

.. autosummary::
:toctree: generated/

pvsystem.pvwatts_dc
pvsystem.pvwatts_ac
pvsystem.pvwatts_losses
pvsystem.pvwatts_losses
temperature.pvsyst_cell

PVsyst model
------------
PVWatts model
-------------

.. autosummary::
:toctree: generated/

pvsystem.pvsyst_celltemp
pvsystem.pvwatts_dc
pvsystem.pvwatts_ac
pvsystem.pvwatts_losses
pvsystem.pvwatts_losses

Other
-----
Expand Down Expand Up @@ -472,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 @@ -500,6 +512,7 @@ ModelChain model definitions.
modelchain.ModelChain.sapm_spectral_loss
modelchain.ModelChain.no_spectral_loss
modelchain.ModelChain.sapm_temp
modelchain.ModelChain.pvsyst_temp
modelchain.ModelChain.pvwatts_losses
modelchain.ModelChain.no_extra_losses

Expand All @@ -516,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
Loading