本文整理汇总了Python中pvlib.modelchain.ModelChain类的典型用法代码示例。如果您正苦于以下问题:Python ModelChain类的具体用法?Python ModelChain怎么用?Python ModelChain使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModelChain类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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))
示例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)
示例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
示例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)
示例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)
示例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
示例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
示例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)
示例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))
示例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
示例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
示例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)
示例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
示例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
示例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])