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)
- build the mode - run the model - display and analyse the results @author: Sylvain Quoilin """ # 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)
from itertools import product import cPickle as pickle import logging import os os.chdir('..') # Import Dispa-SET import dispaset as ds # Define path to save results. Each run will be a pickled tuple: (inputs, results) path_to_save = r'./scenario_runs' # Load the configuration file config = ds.load_config_excel('ConfigFiles/ConfigCY.xlsx') # Define your different input files as a list. The number of total runs will be the product of the length of the defined lists. heat_demand_scen = [ './Database/Heat_demand/CY/Vassilikos_CCP2.csv', './Database/Heat_demand/CY/Vassilikos_CCP2.csv_80' ] power_scen = [ './Database/PowerPlants/##/2015.csv', './Database/PowerPlants/##/2015_heat.csv', ] cost_heat_slack_scen = [20.0, 51.0, 100.0] res_mod_scen = [0.8, 1.0, 1.2]