8000 Add noct_sam cell temperature model to PVSystem, ModelChain by cwhanse · Pull Request #1195 · pvlib/pvlib-python · GitHub
[go: up one dir, main page]

Skip to content

Add noct_sam cell temperature model to PVSystem, ModelChain #1195

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 15 commits into from
Mar 15, 2021
Merged
Prev Previous commit
Next Next commit
mimic ModelChain tests to noct_sam
  • Loading branch information
cwhanse committed Mar 13, 2021
commit 5608f9af160efb83420c8a1915faa1e03a063110
39 changes: 36 additions & 3 deletions pvlib/tests/test_modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,19 @@ def pvwatts_dc_pvwatts_ac_fuentes_temp_system():
return system



@pytest.fixture(scope="function")
def pvwatts_dc_pvwatts_ac_noct_sam_temp_system():
module_parameters = {'pdc0': 220, 'gamma_pdc': -0.003}
temp_model_params = {'noct': 45, 'eta_m_ref': 0.2}
inverter_parameters = {'pdc0': 220, 'eta_inv_nom': 0.95}
system = PVSystem(surface_tilt=32.2, surface_azimuth=180,
module_parameters=module_parameters,
temperature_model_parameters=temp_model_params,
inverter_parameters=inverter_parameters)
return system


@pytest.fixture(scope="function")
def system_no_aoi(cec_module_cs5p_220m, sapm_temperature_cs5p_220m,
cec_inverter_parameters):
Expand Down Expand Up @@ -693,6 +706,23 @@ def test_run_model_with_weather_fuentes_temp(sapm_dc_snl_ac_system, location,
assert not mc.results.ac.empty


def test_run_model_with_weather_noct_temp_temp(sapm_dc_snl_ac_system, location,
weather, mocker):
weather['wind_speed'] = 5
weather['temp_air'] = 10
sapm_dc_snl_ac_system.temperature_model_parameters = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1196 will need to update for this one too

'noct': 45, 'eta_m_ref': 0.2
}
mc = ModelChain(sapm_dc_snl_ac_system, location)
mc.temperature_model = 'noct_sam'
m_noct_sam = mocker.spy(sapm_dc_snl_ac_system, 'noct_sam_celltemp')
mc.run_model(weather)
assert m_noct_sam.call_count == 1
assert_series_equal(m_noct_sam.call_args[0][1], weather['temp_air'])
assert_series_equal(m_noct_sam.call_args[0][2], weather['wind_speed'])
assert not mc.results.ac.empty


def test_run_model_tracker(sapm_dc_snl_ac_system, location, weather, mocker):
system = SingleAxisTracker(
module_parameters=sapm_dc_snl_ac_system.module_parameters,
Expand Down Expand Up @@ -907,7 +937,9 @@ def test__prepare_temperature_arrays_weather(sapm_dc_snl_ac_system_same_arrays,
({'u0': 25.0, 'u1': 6.84},
ModelChain.faiman_temp),
({'noct_installed': 45},
ModelChain.fuentes_temp)])
ModelChain.fuentes_temp),
({'noct': 45, 'eta_m_ref': 0.2},
ModelChain.noct_sam_temp)])
def test_temperature_models_arrays_multi_weather(
temp_params, temp_model,
sapm_dc_snl_ac_system_same_arrays,
Expand Down Expand Up @@ -1256,7 +1288,7 @@ def test_infer_spectral_model(location, sapm_dc_snl_ac_system,


@pytest.mark.parametrize('temp_model', [
'sapm_temp', 'faiman_temp', 'pvsyst_temp', 'fuentes_temp'])
'sapm_temp', 'faiman_temp', 'pvsyst_temp', 'fuentes_temp', 'noct_sam'])
def test_infer_temp_model(location, sapm_dc_snl_ac_system,
pvwatts_dc_pvwatts_ac_pvsyst_temp_system,
pvwatts_dc_pvwatts_ac_faiman_temp_system,
Expand All @@ -1265,7 +1297,8 @@ def test_infer_temp_model(location, sapm_dc_snl_ac_system,
dc_systems = {'sapm_temp': sapm_dc_snl_ac_system,
'pvsyst_temp': pvwatts_dc_pvwatts_ac_pvsyst_temp_system,
'faiman_temp': pvwatts_dc_pvwatts_ac_faiman_temp_system,
'fuentes_temp': pvwatts_dc_pvwatts_ac_fuentes_temp_system}
'fuentes_temp': pvwatts_dc_pvwatts_ac_fuentes_temp_system,
'noct_sam_temp': pvwatts_dc_pvwatts_ac_noct_sam_temp_system}
system = dc_systems[temp_model]
mc = ModelChain(system, location, aoi_model='physical',
spectral_model='no_loss')
Expand Down
0