def test_model_scenario(self): ip = os.path.join(self.base_path, "deflex", "2013", "deflex_2013_de02.xls") my_es = solph.EnergySystem(timeindex=self.date_time_index) main.model_scenario(xls_file=ip, name="test_02", rmap="de", year=2025, es=my_es) assert os.path.isfile( os.path.join(self.base_path, "deflex", "2013", "results_cbc", "test_02.esys"))
# NOTE: Large models will need up to 24 GB of RAM, so start with small models # and increase the size step by step. You can also use large models with less # time steps but you have to adapt the annual limits. # Now choose one example. We will start with a small one: file = "deflex_2014_de02_no-heat_csv" fn = os.path.join(path, file) # *** Long version *** # Create a scenario object sc = scenario.DeflexScenario() # Read the input data. Use the right method (csv/xlsx) for your file type. sc.read_csv(fn) # sc.read_xlsx(fn) # Create the LP model and solve it. sc.compute() # Dump the results to a sub-dir named "results_cbc". dump_file = file.replace("_csv", ".dflx") # dump_file = file.replace(".xlsx") dump_path = os.path.join(path, "results_cbc", dump_file) sc.dump(dump_path) # *** short version *** main.model_scenario(fn, file_type="csv")
from deflex import basic_scenario, main, scenario_tools from oemof.tools import logger import pandas as pd from my_reegis import results, upstream_analysis, reegis_plot from matplotlib import pyplot as plt import numpy as np 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']
def test_duplicate_input(): msg = "It is not allowed to define more than one input." with assert_raises_regexp(ValueError, msg): main.model_scenario(xls_file="something", csv_path="something")