def test__temperature_model_params(): params = temperature._temperature_model_params('sapm', 'open_rack_glass_glass') assert params == temperature.TEMPERATURE_MODEL_PARAMETERS['sapm'][ 'open_rack_glass_glass'] with pytest.raises(KeyError): temperature._temperature_model_params('sapm', 'not_a_parameter_set')
def test_run_model_with_weather(system, location, weather, mocker): weather['wind_speed'] = 5 weather['temp_air'] = 10 # test with sapm cell temperature model system.racking_model = 'open_rack' system.module_type = 'glass_glass' mc = ModelChain(system, location) mc.temperature_model = 'sapm' m_sapm = mocker.spy(system, 'sapm_celltemp') mc.run_model(weather) assert m_sapm.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_sapm.call_args[0][1], weather['temp_air']) # temp assert_series_equal(m_sapm.call_args[0][2], weather['wind_speed']) # wind assert not mc.ac.empty # test with pvsyst cell temperature model system.racking_model = 'freestanding' system.temperature_model_parameters = \ temperature._temperature_model_params('pvsyst', 'freestanding') mc = ModelChain(system, location) mc.temperature_model = 'pvsyst' m_pvsyst = mocker.spy(system, 'pvsyst_celltemp') mc.run_model(weather) assert m_pvsyst.call_count == 1 assert_series_equal(m_pvsyst.call_args[0][1], weather['temp_air']) assert_series_equal(m_pvsyst.call_args[0][2], weather['wind_speed']) assert not mc.ac.empty
def test_run_model_with_weather_pvsyst_temp(sapm_dc_snl_ac_system, location, weather, mocker): # test with pvsyst cell temperature model weather['wind_speed'] = 5 weather['temp_air'] = 10 sapm_dc_snl_ac_system.racking_model = 'freestanding' sapm_dc_snl_ac_system.temperature_model_parameters = \ temperature._temperature_model_params('pvsyst', 'freestanding') mc = ModelChain(sapm_dc_snl_ac_system, location) mc.temperature_model = 'pvsyst' m_pvsyst = mocker.spy(sapm_dc_snl_ac_system, 'pvsyst_celltemp') mc.run_model(weather) assert m_pvsyst.call_count == 1 assert_series_equal(m_pvsyst.call_args[0][1], weather['temp_air']) assert_series_equal(m_pvsyst.call_args[0][2], weather['wind_speed']) assert not mc.ac.empty