Ejemplo n.º 1
0
import logging

logger.define_logging(logfile='oemof.log',
                      screen_level=logging.INFO,
                      file_level=logging.DEBUG)

# Rechne NEP 1-Knoten-Szenario
#main.model_scenario('/home/dbeier/reegis/scenarios/deflex/2014/deflex_2014_de02_NEP.xls', name="NEP2030", rmap="de02", year=2014)

main.model_scenario('/home/dbeier/reegis/scenarios/deflex/2014/deflex_2014_de02.xls')
#main.model_scenario('/home/dbeier/reegis/scenarios/deflex/2014/deflex_2014_de21_no-heat_no-reg-merit.xls')


#scenario_tools.DeflexScenario()
path= '/home/dbeier/reegis/scenarios/deflex/2014/results_cbc/NEP2030.esys'
de02_NEP = results.load_es(path)
results_obj = de02_NEP.results['main']

# Auswertung
cost_em = upstream_analysis.get_emissions_and_costs(de02_NEP,with_chp=True)
vlh = results.fullloadhours(de02_NEP)
mrbb = results.get_multiregion_bus_balance(de02_NEP)

# Extrahiere relevante Größen
demand = mrbb.DE01['out']['demand']['electricity']['all']
transformer = mrbb.DE01['in']['trsf']
ee_single =  mrbb.DE01['in']['source']['ee']
ee_single["bioenergy"] = transformer["pp"]["bioenergy"] + transformer["chp"]["bioenergy"]
ee_single["offshore"] = mrbb.DE02['in']['source']['ee']['wind']
residual_load = demand - ee_single.sum(axis=1)
excess = mrbb.DE01['out']['excess']+mrbb.DE02['out']['excess']
Ejemplo n.º 2
0
        os.makedirs(res_path, exist_ok=True)
        inc_fac_str = str(int(inc_fac * 100))
        out_file = os.path.join(res_path, name + '_' + inc_fac_str + '.esys')
        sc.dump_es(out_file)

# Schritt 4: Analyse der Ergebnisse
# Laden des dumps
# Festlegen von EE-Anteil, Jahr und Geometrie zum Laden der Ergebnisse
ee, year, geom = 200, 2014, 'de21'
inc_ee = '_' + str(ee)
name = '{0}_{1}_{2}'.format('deflex', year, geom)
path = os.path.join('/home/dbeier/reegis/scenarios/deflex', str(year))
res_path = os.path.join(path, 'results_cbc', 'DB', name + inc_ee + '.esys')

# Lade gelöstes Energiesystem der Wahl in den Workspace
sc_calc = results.load_es(res_path)
#sc_calc = results.load_es('/home/dbeier/reegis/scenarios/deflex/2014/results_cbc/deflex_2014_de02.esys')

# Market Clearing Prices und Emissionen des Systems
cost_em_param = results.fetch_cost_emission(sc_calc, with_chp=True)
cost_em = upstream_analysis.get_emissions_and_costs(sc_calc, with_chp=True)

# Plotte MCP und Emissionen
cost_em.mcp[1000:2000].plot()
plt.title('Market Clearing Prices')
plt.ylabel('€/MWh')
plt.show()
cost_em.emission[1000:2000].plot()
plt.title('Mittlere Emissionen')
plt.ylabel('g/kWh_el')
plt.show()
Ejemplo n.º 3
0
# Auswertung von DE02-Szenarien
# Laden mehrere Szenarien über "fetch_scenarios"
# de02_scens = results.fetch_scenarios('/home/dbeier/reegis/scenarios/deflex/2014/results_cbc/DB', sc_filter={'map':'de02'})
# de02_scens.sort()

#de17_scens = results.fetch_scenarios('/home/dbeier/reegis/scenarios/deflex/2014/results_cbc/DB', sc_filter={'map':'de17'})
#de17_scens.sort()

de21_scens = results.fetch_scenarios(
    '/home/dbeier/reegis/scenarios/deflex/2014/results_cbc/DB',
    sc_filter={'map': 'de21'})
de21_scens.sort()

scens_dict = {}
for i in range(0, len(de21_scens)):
    tmp = results.load_es(de21_scens[i])
    key = de21_scens[i][-8:-5]
    scens_dict[key] = tmp

scens = [x for x in scens_dict.keys()]

# Jahresdauerlinie der Strompreise / Emissionen im Vergleich

erg_em, erg_mcp, em_total, new_df, em_mean = pd.DataFrame(), pd.DataFrame(
), pd.DataFrame(), pd.DataFrame(), pd.DataFrame()

for n in scens:
    cost_em = upstream_analysis.get_emissions_and_costs(scens_dict.get(n),
                                                        with_chp=True)
    #tmp_em, tmp_mcp= cost_em.emission.sort_values(ascending=False), cost_em.mcp.sort_values(ascending=False)
    erg_em[n] = cost_em.emission
Ejemplo n.º 4
0
from my_reegis import reegis_plot
from my_reegis import upstream_analysis
from my_reegis import plots_de21
from matplotlib import pyplot as plt
#import PyQt5
#matplotlib.use('Qt5Agg')

# Ini-Dateien von deflex/reegis auslesen, da script außerhalb der Repos ist
cfg.init(paths=[
    os.path.dirname(deflex.__file__),
    os.path.dirname(my_reegis.__file__)
])

# Ergebnis-Energieystem laden
de21_2014 = results.load_es(
    '/home/dbeier/reegis/scenarios/deflex/2014/results_cbc/deflex_2014_de21.esys'
)
de02_2014 = results.load_es(
    '/home/dbeier/reegis/scenarios/deflex/2014/results_cbc/deflex_2014_de02.esys'
)
#de17_2014 = results.load_es('/home/dbeier/reegis/scenarios/deflex/2014/results_cbc/deflex_2014_de17.esys')
#de02_2013 = results.load_es('/home/dbeier/reegis/scenarios/deflex/2013/results_cbc/deflex_2013_de02.esys')
results_obj = de21_2014.results['main']

# Results

# Kosten und Emissionen des Gesamtsystems
cost_em = upstream_analysis.get_emissions_and_costs(de02_2014, with_chp=True)

# Vollaststunden je Erzeugungseinheit
vlh = results.fullloadhours(de02_2014)
Ejemplo n.º 5
0
def prepare_deflex_for_comparison(path_to_results):
    # Load energy system from results
    de_dispatch = results.load_es(path_to_results)
    results_obj = de_dispatch.results['main']

    # Auswertung
    cost_em = upstream_analysis.get_emissions_and_costs(de_dispatch,
                                                        with_chp=True)
    vlh = results.fullloadhours(de_dispatch)
    mrbb = results.get_multiregion_bus_balance(de_dispatch)

    # Extrahiere relevante Größen
    demand = mrbb.DE01['out']['demand']['electricity']['all']
    transformer = mrbb.DE01['in']['trsf']
    generation = pd.DataFrame(index=transformer.index)
    ee_single = mrbb.DE01['in']['source']['ee']
    generation["Biomass"] = transformer["pp"]["bioenergy"] + transformer[
        "chp"]["bioenergy"]
    generation[
        "Wind"] = ee_single["wind"] + mrbb.DE02['in']['source']['ee']['wind']
    generation["Hydro"] = ee_single["hydro"]
    generation["PV"] = ee_single["solar"]
    generation["Nuclear"] = transformer["pp"]["nuclear"]
    #generation["Nuclear"] = mrbb.DE01['in']['source']['ee']['geothermal']
    generation["Hard Coal"] = transformer["chp"]["hard_coal"] + transformer[
        "pp"]["hard_coal"]
    generation["Lignite"] = transformer["chp"]["lignite"] + transformer["pp"][
        "lignite"]
    generation["Natural Gas"] = transformer["chp"][
        "natural_gas"] + transformer["pp"]["natural_gas"]
    generation["Others"]=transformer["chp"]["other"]+transformer["pp"]["other"] + transformer["chp"]["oil"] + \
                         transformer["pp"]["oil"] + mrbb.DE01['in']['source']['ee']['geothermal']
    generation["Pump"] = mrbb.DE01["out"]["storage"]

    # Emissionszeitreihe
    em_per_technology = results.fetch_cost_emission(de_dispatch, with_chp=True)
    em_mix = pd.DataFrame()
    em_mix[
        "hardcoal_chp"] = transformer["chp"]["hard_coal"] * em_per_technology[
            "emission"]["hard_coal"]["DE01"]["chp"]
    em_mix["hardcoal_pp"] = transformer["pp"]["hard_coal"] * em_per_technology[
        "emission"]["hard_coal"]["DE01"]["pp"]
    em_mix["lignite_chp"] = transformer["chp"]["lignite"] * em_per_technology[
        "emission"]["lignite"]["DE01"]["chp"]
    em_mix["lignite_pp"] = transformer["pp"]["lignite"] * em_per_technology[
        "emission"]["lignite"]["DE01"]["pp"]
    em_mix["natural_gas_chp"] = transformer["chp"]["natural_gas"] * \
                                em_per_technology["emission"]["natural_gas"]["DE01"]["chp"]
    em_mix["natural_gas_pp"] = transformer["pp"][
        "natural_gas"] * em_per_technology["emission"]["natural_gas"]["DE01"][
            "pp"]
    em_mix["oil_chp"] = transformer["chp"]["oil"] * em_per_technology[
        "emission"]["oil"]["DE01"]["chp"]
    em_mix["oil_pp"] = transformer["pp"]["oil"] * em_per_technology[
        "emission"]["oil"]["DE01"]["pp"]
    em_mix["other_chp"] = transformer["chp"]["other"] * em_per_technology[
        "emission"]["other"]["DE01"]["chp"]
    em_mix["other_pp"] = transformer["pp"]["other"] * em_per_technology[
        "emission"]["other"]["DE01"]["pp"]

    em_factor_deflex = em_mix.sum(axis=1) / demand
    p_spot_deflex = cost_em["mcp"]

    return generation, p_spot_deflex, em_factor_deflex