コード例 #1
0
ファイル: feedin_tests.py プロジェクト: jnnr/reegis
def feedin_pvlib_test():
    fn = os.path.join(os.path.dirname(__file__), os.pardir, 'tests', 'data',
                      'test_coastdat_weather.csv')
    coastdat_id = '1126088'
    weather = pd.read_csv(fn, header=[0, 1], index_col=[0],
                          parse_dates=True)[coastdat_id]
    c = coastdat.fetch_data_coordinates_by_id(coastdat_id)
    location = pvlib.location.Location(**getattr(c, '_asdict')())
    pv_weather = coastdat.adapt_coastdat_weather_to_pvlib(weather, location)

    sandia_modules = pvlib.pvsystem.retrieve_sam('sandiamod')
    sapm_inverters = pvlib.pvsystem.retrieve_sam('sandiainverter')
    pv = {
        'pv_set_name': 'M_LG290G3__I_ABB_MICRO_025_US208',
        'module_name': 'LG_LG290N1C_G3__2013_',
        'module_key': 'LG290G3',
        'inverter_name': 'ABB__MICRO_0_25_I_OUTD_US_208_208V__CEC_2014_',
        'surface_azimuth': 180,
        'surface_tilt': 35,
        'albedo': 0.2
    }
    pv['module_parameters'] = sandia_modules[pv['module_name']]
    pv['inverter_parameters'] = sapm_inverters[pv['inverter_name']]
    pv['p_peak'] = pv['module_parameters'].Impo * pv['module_parameters'].Vmpo

    eq_(int(feedin.feedin_pvlib(location, pv, pv_weather).sum()), 1025)
    eq_(int(feedin.feedin_pvlib(location, pv, pv_weather).sum()), 1025)
コード例 #2
0
def test_feedin_pv_sets():
    fn = os.path.join(
        os.path.dirname(__file__),
        os.pardir,
        "tests",
        "data",
        "test_coastdat_weather.csv",
    )
    pv_sets = feedin.create_pvlib_sets()
    coastdat_id = "1126088"
    weather = pd.read_csv(
        fn,
        header=[0, 1],
        index_col=[0],
        date_parser=lambda idx: pd.to_datetime(idx, utc=True),
    )[coastdat_id]
    c = coastdat.fetch_data_coordinates_by_id(coastdat_id)
    location = pvlib.location.Location(**getattr(c, "_asdict")())
    pv_weather = coastdat.adapt_coastdat_weather_to_pvlib(weather, location)
    s1 = pd.Series()
    for pv_key, pv_set in pv_sets.items():
        s1[pv_key] = int((feedin.feedin_pv_sets(pv_weather, location,
                                                pv_set).sum().mean()))
    s2 = pd.Series({
        "M_STP280S__I_GEPVb_5000_NA_240": 550,
        "M_BP2150S__I_P235HV_240": 725,
        "M_SF160S___I_ABB_MICRO_025_US208": 797,
        "M_LG290G3__I_ABB_MICRO_025_US208": 815,
    })
    pd.testing.assert_series_equal(s1.sort_index(), s2.sort_index())
コード例 #3
0
ファイル: feedin_tests.py プロジェクト: jnnr/reegis
def feedin_pv_sets_tests():
    fn = os.path.join(os.path.dirname(__file__), os.pardir, 'tests', 'data',
                      'test_coastdat_weather.csv')
    pv_sets = feedin.create_pvlib_sets()
    coastdat_id = '1126088'
    weather = pd.read_csv(fn, header=[0, 1], index_col=[0],
                          parse_dates=True)[coastdat_id]
    c = coastdat.fetch_data_coordinates_by_id(coastdat_id)
    location = pvlib.location.Location(**getattr(c, '_asdict')())
    pv_weather = coastdat.adapt_coastdat_weather_to_pvlib(weather, location)
    s1 = pd.Series()
    for pv_key, pv_set in pv_sets.items():
        s1[pv_key] = int((feedin.feedin_pv_sets(pv_weather, location,
                                                pv_set).sum().mean()))
    s2 = pd.Series({
        'M_STP280S__I_GEPVb_5000_NA_240': 798,
        'M_BP2150S__I_P235HV_240': 722,
        'M_SF160S___I_ABB_MICRO_025_US208': 801,
        'M_LG290G3__I_ABB_MICRO_025_US208': 817
    })
    pd.testing.assert_series_equal(s1.sort_index(), s2.sort_index())
コード例 #4
0
def test_feedin_pvlib():
    fn = os.path.join(
        os.path.dirname(__file__),
        os.pardir,
        "tests",
        "data",
        "test_coastdat_weather.csv",
    )
    coastdat_id = "1126088"
    weather = pd.read_csv(
        fn,
        header=[0, 1],
        index_col=[0],
        date_parser=lambda idx: pd.to_datetime(idx, utc=True),
    )[coastdat_id]
    c = coastdat.fetch_data_coordinates_by_id(coastdat_id)
    location = pvlib.location.Location(**getattr(c, "_asdict")())
    pv_weather = coastdat.adapt_coastdat_weather_to_pvlib(weather, location)

    sandia_modules = pvlib.pvsystem.retrieve_sam("sandiamod")
    sapm_inverters = pvlib.pvsystem.retrieve_sam("sandiainverter")
    pv = {}
    for k, v in cfg.get_dict("solar_set3").items():
        if isinstance(v, str):
            pv[k] = v.split(",")[0]
        else:
            pv[k] = v
        try:
            pv[k] = float(pv[k])
        except ValueError:
            pass
    pv["module_parameters"] = sandia_modules[pv["module_name"]]
    pv["inverter_parameters"] = sapm_inverters[pv["inverter_name"]]
    pv["p_peak"] = pv["module_parameters"].Impo * pv["module_parameters"].Vmpo

    assert int(feedin.feedin_pvlib(location, pv, pv_weather).sum()) == 899
コード例 #5
0
ファイル: feedin_tests.py プロジェクト: jnettels/reegis
def feedin_pvlib_test():
    fn = os.path.join(
        os.path.dirname(__file__),
        os.pardir,
        "tests",
        "data",
        "test_coastdat_weather.csv",
    )
    coastdat_id = "1126088"
    weather = pd.read_csv(
        fn,
        header=[0, 1],
        index_col=[0],
        date_parser=lambda idx: pd.to_datetime(idx, utc=True),
    )[coastdat_id]
    c = coastdat.fetch_data_coordinates_by_id(coastdat_id)
    location = pvlib.location.Location(**getattr(c, "_asdict")())
    pv_weather = coastdat.adapt_coastdat_weather_to_pvlib(weather, location)

    sandia_modules = pvlib.pvsystem.retrieve_sam("sandiamod")
    sapm_inverters = pvlib.pvsystem.retrieve_sam("sandiainverter")
    pv = {
        "pv_set_name": "M_LG290G3__I_ABB_MICRO_025_US208",
        "module_name": "LG_LG290N1C_G3__2013_",
        "module_key": "LG290G3",
        "inverter_name": "ABB__MICRO_0_25_I_OUTD_US_208_208V__CEC_2014_",
        "surface_azimuth": 180,
        "surface_tilt": 35,
        "albedo": 0.2,
    }
    pv["module_parameters"] = sandia_modules[pv["module_name"]]
    pv["inverter_parameters"] = sapm_inverters[pv["inverter_name"]]
    pv["p_peak"] = pv["module_parameters"].Impo * pv["module_parameters"].Vmpo

    eq_(int(feedin.feedin_pvlib(location, pv, pv_weather).sum()), 1025)
    eq_(int(feedin.feedin_pvlib(location, pv, pv_weather).sum()), 1025)