• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python modelchain.ModelChain类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pvlib.modelchain.ModelChain的典型用法代码示例。如果您正苦于以下问题:Python ModelChain类的具体用法?Python ModelChain怎么用?Python ModelChain使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ModelChain类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_infer_dc_model

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))
开发者ID:mikofski,项目名称:pvlib-python,代码行数:25,代码来源:test_modelchain.py


示例2: test_run_model

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)
开发者ID:caskeep,项目名称:pvlib-python,代码行数:8,代码来源:test_modelchain.py


示例3: test_aoi_model_no_loss

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
开发者ID:mikofski,项目名称:pvlib-python,代码行数:8,代码来源:test_modelchain.py


示例4: test_spectral_models

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)
开发者ID:MLEEFS,项目名称:pvlib-python,代码行数:8,代码来源:test_modelchain.py


示例5: test_run_model_with_weather

def test_run_model_with_weather(system, location):
    mc = ModelChain(system, location)
    times = pd.date_range('20160101 1200-0700', periods=2, freq='6H')
    weather = pd.DataFrame({'wind_speed':5, 'temp_air':10}, index=times)
    ac = mc.run_model(times, weather=weather).ac

    expected = pd.Series(np.array([  1.99952400e+02,  -2.00000000e-02]),
                         index=times)
    assert_series_equal(ac, expected, check_less_precise=2)
开发者ID:caskeep,项目名称:pvlib-python,代码行数:9,代码来源:test_modelchain.py


示例6: test_ac_model_user_func

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
开发者ID:mikofski,项目名称:pvlib-python,代码行数:9,代码来源:test_modelchain.py


示例7: test_dc_model_user_func

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
开发者ID:mikofski,项目名称:pvlib-python,代码行数:9,代码来源:test_modelchain.py


示例8: test_run_model_with_irradiance

def test_run_model_with_irradiance(system, location):
    mc = ModelChain(system, location)
    times = pd.date_range('20160101 1200-0700', periods=2, freq='6H')
    irradiance = pd.DataFrame({'dni':900, 'ghi':600, 'dhi':150},
                              index=times)
    ac = mc.run_model(times, irradiance=irradiance).ac

    expected = pd.Series(np.array([  1.90054749e+02,  -2.00000000e-02]),
                         index=times)
    assert_series_equal(ac, expected)
开发者ID:caskeep,项目名称:pvlib-python,代码行数:10,代码来源:test_modelchain.py


示例9: test_spectral_models

def test_spectral_models(system, location, spectral_model):
    times = pd.date_range('20160101 1200-0700', periods=3, freq='6H')
    weather = pd.DataFrame(data=[0.3, 0.5, 1.0],
                           index=times,
                           columns=['precipitable_water'])
    mc = ModelChain(system, location, dc_model='sapm',
                    aoi_model='no_loss', spectral_model=spectral_model)
    spectral_modifier = mc.run_model(times=times,
                                     weather=weather).spectral_modifier
    assert isinstance(spectral_modifier, (pd.Series, float, int))
开发者ID:mikofski,项目名称:pvlib-python,代码行数:10,代码来源:test_modelchain.py


示例10: test_aoi_model_user_func

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
开发者ID:mikofski,项目名称:pvlib-python,代码行数:10,代码来源:test_modelchain.py


示例11: test_aoi_models

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
开发者ID:mikofski,项目名称:pvlib-python,代码行数:10,代码来源:test_modelchain.py


示例12: test_run_model_perez

def test_run_model_perez(system, location):
    mc = ModelChain(system, location, transposition_model='perez')
    times = pd.date_range('20160101 1200-0700', periods=2, freq='6H')
    irradiance = pd.DataFrame({'dni':900, 'ghi':600, 'dhi':150},
                              index=times)
    ac = mc.run_model(times, irradiance=irradiance).ac

    expected = pd.Series(np.array([  190.194545796,  -2.00000000e-02]),
                         index=times)
    assert_series_equal(ac, expected)
开发者ID:caskeep,项目名称:pvlib-python,代码行数:10,代码来源:test_modelchain.py


示例13: test_losses_models_no_loss

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
开发者ID:mikofski,项目名称:pvlib-python,代码行数:10,代码来源:test_modelchain.py


示例14: test_losses_models_ext_def

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
开发者ID:mikofski,项目名称:pvlib-python,代码行数:11,代码来源:test_modelchain.py


示例15: test_run_model_tracker

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])
开发者ID:mikofski,项目名称:pvlib-python,代码行数:11,代码来源:test_modelchain.py


示例16: test_ModelChain___repr__

def test_ModelChain___repr__(system, location):

    strategy = 'south_at_latitude_tilt'

    mc = ModelChain(system, location, orientation_strategy=strategy)

    assert mc.__repr__() == ('ModelChain for: PVSystem with tilt:32.2 and '+
    'azimuth: 180 with Module: None and Inverter: None '+
    'orientation_startegy: south_at_latitude_tilt clearsky_model: '+
    'ineichen transposition_model: haydavies solar_position_method: '+
    'nrel_numpy airmass_model: kastenyoung1989')
开发者ID:dpete2008,项目名称:Sandia,代码行数:11,代码来源:test_modelchain.py


示例17: test_run_model_with_weather

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
开发者ID:mikofski,项目名称:pvlib-python,代码行数:12,代码来源:test_modelchain.py


示例18: test_weather_irradiance_input

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'))
开发者ID:MLEEFS,项目名称:pvlib-python,代码行数:12,代码来源:test_modelchain.py


示例19: test_ModelChain___repr__

def test_ModelChain___repr__():
    system = PVSystem()
    location = Location(32.2, -111, altitude=700)
    strategy = 'south_at_latitude_tilt'

    mc = ModelChain(system, location, orientation_strategy=strategy)

    # the || accounts for the coercion of 'None' to None
    assert mc.__repr__() == ('ModelChain for: PVSystem with tilt:32.2 and '+
    'azimuth: 180 with Module: None and Inverter: None '+
    'orientation_startegy: south_at_latitude_tilt clearsky_model: '+
    'ineichentransposition_model: haydavies solar_position_method: '+
    'nrel_numpyairmass_model: kastenyoung1989')
开发者ID:JohannesOos,项目名称:pvlib-python,代码行数:13,代码来源:test_modelchain.py


示例20: test_losses_models_pvwatts

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
开发者ID:mikofski,项目名称:pvlib-python,代码行数:13,代码来源:test_modelchain.py



注:本文中的pvlib.modelchain.ModelChain类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python solarposition.get_solarposition函数代码示例发布时间:2022-05-25
下一篇:
Python location.Location类代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap