Example #1
0
def test__prepare_temperature(sapm_dc_snl_ac_system, location, weather,
                              total_irrad):
    data = weather.copy()
    data[['poa_global', 'poa_diffuse', 'poa_direct']] = total_irrad
    mc = ModelChain(sapm_dc_snl_ac_system, location, aoi_model='no_loss',
                    spectral_model='no_loss')
    # prepare_temperature expects mc.total_irrad and mc.weather to be set
    mc._assign_weather(data)
    mc._assign_total_irrad(data)
    mc._prepare_temperature(data)
    expected = pd.Series([48.928025, 38.080016], index=data.index)
    assert_series_equal(mc.cell_temperature, expected)
    data['module_temperature'] = [40., 30.]
    mc._prepare_temperature(data)
    expected = pd.Series([42.4, 31.5], index=data.index)
    assert_series_equal(mc.cell_temperature, expected)
    data['cell_temperature'] = [50., 35.]
    mc._prepare_temperature(data)
    assert_series_equal(mc.cell_temperature, data['cell_temperature'])