# Add the root folder of Dispa-SET to the path so that the library can be loaded: import sys, os sys.path.append(os.path.abspath('..')) # Import Dispa-SET import dispaset as ds # Load the configuration file config = ds.load_config_excel('../ConfigFiles/ConfigEU.xlsx') # Limit the simulation period (for testing purposes, comment the line to run the whole year) config['StartDate'] = (2016, 1, 1, 0, 0, 0) config['StopDate'] = (2016, 1, 7, 0, 0, 0) # Build the simulation environment: SimData = ds.build_simulation(config) # Solve using GAMS: _ = ds.solve_GAMS(config['SimulationDirectory'], config['GAMS_folder']) # Load the simulation results: inputs, results = ds.get_sim_results(config['SimulationDirectory'], cache=False) # Generate country-specific plots ds.plot_country(inputs, results) # Bar plot with the installed capacities in all countries: cap = ds.plot_country_capacities(inputs) # Bar plot with the energy balances in all countries:
import datetime as dt from dispaset.postprocessing import postprocessing as post import importlib importlib.reload(post) import dispaset as ds import matplotlib.pyplot as plt from matplotlib.pyplot import * import seaborn as sns import matplotlib.dates as mdates import pickle import time as tm import logging import shutil import json shutil.copy('input_data/ConfigGCC2.xlsx', 'Simulations/ConfigGCC2.xlsx') # Load the configuration file config = ds.load_config_excel('Simulations/ConfigGCC2.xlsx') # Build the simulation environment: SimData, FuelPrices, FuelPrices2 = ds.build_simulation( config, LocalSubsidyMultiplier=1, ExportCostMultiplier=1) r = ds.solve_GAMS(config['SimulationDirectory'], config['GAMS_folder']) path = 'Simulations/simulation_GCC' inputs, results = ds.get_sim_results(path=path, cache=True) with open('output_data/results.json', 'w') as fp: json.dump(str(results), fp)
def test_build(config, tmpdir): # Using temp dir to ensure that each time a new directory is used config['SimulationDirectory'] = tmpdir SimData = ds.build_simulation(config) assert isinstance(SimData, dict) #how to test if sucessful build?
@author: Sylvain Quoilin """ # Change directory to the root folder of Dispa-SET: import sys, os sys.path.append(os.path.abspath('..')) # Import Dispa-SET import dispaset as ds # Load the configuration file config = ds.load_config('../ConfigFiles/Config_Mid_Term_Scheduling.xlsx') ## Build simulation data with new profiles SimData = ds.build_simulation(config, mts_plot=True) #Solve using GAMS: #r = ds.solve_GAMS(config['SimulationDirectory'], config['GAMS_folder']) # Load the simulation results: #inputs,results = ds.get_sim_results(config['SimulationDirectory'],cache=False) # Generate country-specific plots #ds.plot_zone(inputs,results,z='DE') # Bar plot with the installed capacities in all countries: #cap = ds.plot_zone_capacities(inputs) # Bar plot with the energy balances in all countries: #ds.plot_energy_zone_fuel(inputs,results,ds.get_indicators_powerplant(inputs,results))
@author: Sylvain Quoilin """ # Change directory to the root folder of Dispa-SET: import sys,os sys.path.append(os.path.abspath('..')) # Import Dispa-SET import dispaset as ds # Load the configuration file config = ds.load_config('../ConfigFiles/Config_Mid_Term_Scheduling.xlsx') ## Build simulation data with new profiles SimData = ds.build_simulation(config,mts_plot=True,MTSTimeStep=24) #Solve using GAMS: r = ds.solve_GAMS(config['SimulationDirectory'], config['GAMS_folder']) # Load the simulation results: inputs,results = ds.get_sim_results(config['SimulationDirectory'],cache=False) # Generate country-specific plots ds.plot_zone(inputs,results,z='DE') # Bar plot with the installed capacities in all countries: cap = ds.plot_zone_capacities(inputs) # Bar plot with the energy balances in all countries: ds.plot_energy_zone_fuel(inputs,results,ds.get_indicators_powerplant(inputs,results))