本文整理汇总了Python中pvlib.modelchain.ModelChain.run_model方法的典型用法代码示例。如果您正苦于以下问题:Python ModelChain.run_model方法的具体用法?Python ModelChain.run_model怎么用?Python ModelChain.run_model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pvlib.modelchain.ModelChain
的用法示例。
在下文中一共展示了ModelChain.run_model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_infer_dc_model
# 需要导入模块: from pvlib.modelchain import ModelChain [as 别名]
# 或者: from pvlib.modelchain.ModelChain import run_model [as 别名]
def test_infer_dc_model(system, cec_dc_snl_ac_system, pvsyst_dc_snl_ac_system,
pvwatts_dc_pvwatts_ac_system, location, dc_model,
weather, mocker):
dc_systems = {'sapm': system,
'cec': cec_dc_snl_ac_system,
'desoto': cec_dc_snl_ac_system,
'pvsyst': pvsyst_dc_snl_ac_system,
'singlediode': cec_dc_snl_ac_system,
'pvwatts_dc': pvwatts_dc_pvwatts_ac_system}
dc_model_function = {'sapm': 'sapm',
'cec': 'calcparams_cec',
'desoto': 'calcparams_desoto',
'pvsyst': 'calcparams_pvsyst',
'singlediode': 'calcparams_desoto',
'pvwatts_dc': 'pvwatts_dc'}
system = dc_systems[dc_model]
# remove Adjust from model parameters for desoto, singlediode
if dc_model in ['desoto', 'singlediode']:
system.module_parameters.pop('Adjust')
m = mocker.spy(system, dc_model_function[dc_model])
mc = ModelChain(system, location,
aoi_model='no_loss', spectral_model='no_loss')
mc.run_model(weather.index, weather=weather)
assert m.call_count == 1
assert isinstance(mc.dc, (pd.Series, pd.DataFrame))
示例2: test_aoi_model_no_loss
# 需要导入模块: from pvlib.modelchain import ModelChain [as 别名]
# 或者: from pvlib.modelchain.ModelChain import run_model [as 别名]
def test_aoi_model_no_loss(system, location, weather):
mc = ModelChain(system, location, dc_model='sapm',
aoi_model='no_loss', spectral_model='no_loss')
mc.run_model(weather.index, weather=weather)
assert mc.aoi_modifier == 1.0
assert not mc.ac.empty
assert mc.ac[0] > 150 and mc.ac[0] < 200
assert mc.ac[1] < 1
示例3: test_ac_model_user_func
# 需要导入模块: from pvlib.modelchain import ModelChain [as 别名]
# 或者: from pvlib.modelchain.ModelChain import run_model [as 别名]
def test_ac_model_user_func(pvwatts_dc_pvwatts_ac_system, location, weather,
mocker):
m = mocker.spy(sys.modules[__name__], 'acdc')
mc = ModelChain(pvwatts_dc_pvwatts_ac_system, location, ac_model=acdc,
aoi_model='no_loss', spectral_model='no_loss')
mc.run_model(weather.index, weather=weather)
assert m.call_count == 1
assert_series_equal(mc.ac, mc.dc)
assert not mc.ac.empty
示例4: test_dc_model_user_func
# 需要导入模块: from pvlib.modelchain import ModelChain [as 别名]
# 或者: from pvlib.modelchain.ModelChain import run_model [as 别名]
def test_dc_model_user_func(pvwatts_dc_pvwatts_ac_system, location, weather,
mocker):
m = mocker.spy(sys.modules[__name__], 'poadc')
mc = ModelChain(pvwatts_dc_pvwatts_ac_system, location, dc_model=poadc,
aoi_model='no_loss', spectral_model='no_loss')
mc.run_model(weather.index, weather=weather)
assert m.call_count == 1
assert isinstance(mc.ac, (pd.Series, pd.DataFrame))
assert not mc.ac.empty
示例5: test_aoi_model_user_func
# 需要导入模块: from pvlib.modelchain import ModelChain [as 别名]
# 或者: from pvlib.modelchain.ModelChain import run_model [as 别名]
def test_aoi_model_user_func(system, location, weather, mocker):
m = mocker.spy(sys.modules[__name__], 'constant_aoi_loss')
mc = ModelChain(system, location, dc_model='sapm',
aoi_model=constant_aoi_loss, spectral_model='no_loss')
mc.run_model(weather.index, weather=weather)
assert m.call_count == 1
assert mc.aoi_modifier == 0.9
assert not mc.ac.empty
assert mc.ac[0] > 140 and mc.ac[0] < 200
assert mc.ac[1] < 1
示例6: test_aoi_models
# 需要导入模块: from pvlib.modelchain import ModelChain [as 别名]
# 或者: from pvlib.modelchain.ModelChain import run_model [as 别名]
def test_aoi_models(system, location, aoi_model, method, weather, mocker):
mc = ModelChain(system, location, dc_model='sapm',
aoi_model=aoi_model, spectral_model='no_loss')
m = mocker.spy(system, method)
mc.run_model(weather.index, weather=weather)
assert m.call_count == 1
assert isinstance(mc.ac, pd.Series)
assert not mc.ac.empty
assert mc.ac[0] > 150 and mc.ac[0] < 200
assert mc.ac[1] < 1
示例7: test_losses_models_no_loss
# 需要导入模块: from pvlib.modelchain import ModelChain [as 别名]
# 或者: from pvlib.modelchain.ModelChain import run_model [as 别名]
def test_losses_models_no_loss(pvwatts_dc_pvwatts_ac_system, location, weather,
mocker):
m = mocker.spy(pvsystem, 'pvwatts_losses')
mc = ModelChain(pvwatts_dc_pvwatts_ac_system, location, dc_model='pvwatts',
aoi_model='no_loss', spectral_model='no_loss',
losses_model='no_loss')
assert mc.losses_model == mc.no_extra_losses
mc.run_model(weather.index, weather=weather)
assert m.call_count == 0
assert mc.losses == 1
示例8: test_run_model_tracker
# 需要导入模块: from pvlib.modelchain import ModelChain [as 别名]
# 或者: from pvlib.modelchain.ModelChain import run_model [as 别名]
def test_run_model_tracker(system, location, weather, mocker):
system = SingleAxisTracker(module_parameters=system.module_parameters,
inverter_parameters=system.inverter_parameters)
mocker.spy(system, 'singleaxis')
mc = ModelChain(system, location)
mc.run_model(weather.index, weather=weather)
assert system.singleaxis.call_count == 1
assert (mc.tracking.columns == ['tracker_theta', 'aoi', 'surface_azimuth',
'surface_tilt']).all()
assert mc.ac[0] > 0
assert np.isnan(mc.ac[1])
示例9: test_losses_models_ext_def
# 需要导入模块: from pvlib.modelchain import ModelChain [as 别名]
# 或者: from pvlib.modelchain.ModelChain import run_model [as 别名]
def test_losses_models_ext_def(pvwatts_dc_pvwatts_ac_system, location, weather,
mocker):
m = mocker.spy(sys.modules[__name__], 'constant_losses')
mc = ModelChain(pvwatts_dc_pvwatts_ac_system, location, dc_model='pvwatts',
aoi_model='no_loss', spectral_model='no_loss',
losses_model=constant_losses)
mc.run_model(weather.index, weather=weather)
assert m.call_count == 1
assert isinstance(mc.ac, (pd.Series, pd.DataFrame))
assert mc.losses == 0.9
assert not mc.ac.empty
示例10: test_run_model_with_weather
# 需要导入模块: from pvlib.modelchain import ModelChain [as 别名]
# 或者: from pvlib.modelchain.ModelChain import run_model [as 别名]
def test_run_model_with_weather(system, location, weather, mocker):
mc = ModelChain(system, location)
m = mocker.spy(system, 'sapm_celltemp')
weather['wind_speed'] = 5
weather['temp_air'] = 10
mc.run_model(weather.index, weather=weather)
assert m.call_count == 1
# assert_called_once_with cannot be used with series, so need to use
# assert_series_equal on call_args
assert_series_equal(m.call_args[0][1], weather['wind_speed']) # wind
assert_series_equal(m.call_args[0][2], weather['temp_air']) # temp
assert not mc.ac.empty
示例11: test_weather_irradiance_input
# 需要导入模块: from pvlib.modelchain import ModelChain [as 别名]
# 或者: from pvlib.modelchain.ModelChain import run_model [as 别名]
def test_weather_irradiance_input(system, location):
"""Test will raise a warning and should be removed in future versions."""
mc = ModelChain(system, location)
times = pd.date_range('2012-06-01 12:00:00', periods=2, freq='H')
i = pd.DataFrame({'dni': [2, 3], 'dhi': [4, 6], 'ghi': [9, 5]}, index=times)
w = pd.DataFrame({'wind_speed': [11, 5], 'temp_air': [30, 32]}, index=times)
mc.run_model(times, irradiance=i, weather=w)
assert_series_equal(mc.weather['dni'],
pd.Series([2, 3], index=times, name='dni'))
assert_series_equal(mc.weather['wind_speed'],
pd.Series([11, 5], index=times, name='wind_speed'))
示例12: test_losses_models_pvwatts
# 需要导入模块: from pvlib.modelchain import ModelChain [as 别名]
# 或者: from pvlib.modelchain.ModelChain import run_model [as 别名]
def test_losses_models_pvwatts(pvwatts_dc_pvwatts_ac_system, location, weather,
mocker):
age = 1
pvwatts_dc_pvwatts_ac_system.losses_parameters = dict(age=age)
m = mocker.spy(pvsystem, 'pvwatts_losses')
mc = ModelChain(pvwatts_dc_pvwatts_ac_system, location, dc_model='pvwatts',
aoi_model='no_loss', spectral_model='no_loss',
losses_model='pvwatts')
mc.run_model(weather.index, weather=weather)
assert m.call_count == 1
m.assert_called_with(age=age)
assert isinstance(mc.ac, (pd.Series, pd.DataFrame))
assert not mc.ac.empty
示例13: test_ac_models
# 需要导入模块: from pvlib.modelchain import ModelChain [as 别名]
# 或者: from pvlib.modelchain.ModelChain import run_model [as 别名]
def test_ac_models(system, cec_dc_adr_ac_system, pvwatts_dc_pvwatts_ac_system,
location, ac_model, weather, mocker):
ac_systems = {'snlinverter': system, 'adrinverter': cec_dc_adr_ac_system,
'pvwatts': pvwatts_dc_pvwatts_ac_system}
system = ac_systems[ac_model]
mc = ModelChain(system, location, ac_model=ac_model,
aoi_model='no_loss', spectral_model='no_loss')
if ac_model == 'pvwatts':
ac_model += '_ac'
m = mocker.spy(system, ac_model)
mc.run_model(weather.index, weather=weather)
assert m.call_count == 1
assert isinstance(mc.ac, pd.Series)
assert not mc.ac.empty
assert mc.ac[1] < 1
示例14: test_run_model
# 需要导入模块: from pvlib.modelchain import ModelChain [as 别名]
# 或者: from pvlib.modelchain.ModelChain import run_model [as 别名]
def test_run_model(system, location):
mc = ModelChain(system, location)
times = pd.date_range('20160101 1200-0700', periods=2, freq='6H')
ac = mc.run_model(times).ac
expected = pd.Series(np.array([ 1.82033564e+02, -2.00000000e-02]),
index=times)
assert_series_equal(ac, expected, check_less_precise=2)
示例15: test_spectral_models
# 需要导入模块: from pvlib.modelchain import ModelChain [as 别名]
# 或者: from pvlib.modelchain.ModelChain import run_model [as 别名]
def test_spectral_models(system, location, spectral_model, expected):
mc = ModelChain(system, location, dc_model='sapm',
aoi_model='no_loss', spectral_model=spectral_model)
times = pd.date_range('20160101 1200-0700', periods=2, freq='6H')
ac = mc.run_model(times).ac
expected = pd.Series(np.array(expected), index=times)
assert_series_equal(ac, expected, check_less_precise=2)