Skip to content

Commit

Permalink
commons.py does not need to be a function
Browse files Browse the repository at this point in the history
  • Loading branch information
kavvkon committed Sep 7, 2018
1 parent 6f657cc commit f394188
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 40 deletions.
60 changes: 26 additions & 34 deletions DispaSET/common.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,33 @@
# -*- coding: utf-8 -*-
"""
This file defines the global variables to be used in Dispa-SET such as fluids, technologies, etc.
@author: 'Sylvain Quoilin'
This file defines a dictionary with global variables to be used in Dispa-SET such as fluids, technologies, etc.
"""
import itertools

def commonvars():
'''
Function providing a dictionary with the common variable definitions
to be used in Dispa-SET
'''
commons={}
# Timestep
commons['TimeStep'] = '1h'
commons={}
# Timestep
commons['TimeStep'] = '1h'

# DispaSET technologies:
commons['Technologies'] = ['COMC', 'GTUR', 'HDAM', 'HROR', 'HPHS', 'ICEN', 'PHOT', 'STUR', 'WTOF', 'WTON', 'CAES', 'BATS',
'BEVS', 'THMS', 'P2GS']
# List of renewable technologies:
commons['tech_renewables'] = ['WTON', 'WTOF', 'PHOT', 'HROR']
# List of storage technologies:
commons['tech_storage'] = ['HDAM', 'HPHS', 'BATS', 'BEVS', 'CAES', 'THMS']
# List of CHP types:
commons['types_CHP'] = ['extraction','back-pressure', 'p2h']
# DispaSET fuels:
commons['Fuels'] = ['BIO', 'GAS', 'HRD', 'LIG', 'NUC', 'OIL', 'PEA', 'SUN', 'WAT', 'WIN', 'WST', 'OTH', 'GEO']
# Ordered list of fuels for plotting (the first ones are negative):
commons['MeritOrder'] = ['Storage','FlowOut','GEO','NUC', 'LIG', 'HRD', 'BIO', 'GAS', 'OIL', 'PEA', 'WST', 'OTH', 'SUN', 'WIN', 'FlowIn', 'WAT']
# Colors associated with each fuel:
commons['colors'] = {'NUC': 'orange', 'LIG': 'brown', 'HRD': 'grey', 'BIO': 'darkgreen', 'GAS': 'lightcoral',
'OIL': 'chocolate','PEA':'green', 'WST': 'dodgerblue', 'OTH':'grey', 'SUN': 'yellow', 'WIN': 'red', 'FlowIn': 'green', 'WAT': 'blue',
'Storage': 'blue','FlowOut': 'green','GEO':'grey'}
# Hatches associated with each fuel (random):
hatches = itertools.cycle(['x', '//', '\\', '/'])
commons['hatches'] = {}
for x in commons['colors']:
commons['hatches'][x] = next(hatches)
# DispaSET technologies:
commons['Technologies'] = ['COMC', 'GTUR', 'HDAM', 'HROR', 'HPHS', 'ICEN', 'PHOT', 'STUR', 'WTOF', 'WTON', 'CAES', 'BATS',
'BEVS', 'THMS', 'P2GS']
# List of renewable technologies:
commons['tech_renewables'] = ['WTON', 'WTOF', 'PHOT', 'HROR']
# List of storage technologies:
commons['tech_storage'] = ['HDAM', 'HPHS', 'BATS', 'BEVS', 'CAES', 'THMS']
# List of CHP types:
commons['types_CHP'] = ['extraction','back-pressure', 'p2h']
# DispaSET fuels:
commons['Fuels'] = ['BIO', 'GAS', 'HRD', 'LIG', 'NUC', 'OIL', 'PEA', 'SUN', 'WAT', 'WIN', 'WST', 'OTH', 'GEO']
# Ordered list of fuels for plotting (the first ones are negative):
commons['MeritOrder'] = ['Storage','FlowOut','GEO','NUC', 'LIG', 'HRD', 'BIO', 'GAS', 'OIL', 'PEA', 'WST', 'OTH', 'SUN', 'WIN', 'FlowIn', 'WAT']
# Colors associated with each fuel:
commons['colors'] = {'NUC': 'orange', 'LIG': 'brown', 'HRD': 'grey', 'BIO': 'darkgreen', 'GAS': 'lightcoral',
'OIL': 'chocolate','PEA':'green', 'WST': 'dodgerblue', 'OTH':'grey', 'SUN': 'yellow', 'WIN': 'red', 'FlowIn': 'green', 'WAT': 'blue',
'Storage': 'blue','FlowOut': 'green','GEO':'grey'}
# Hatches associated with each fuel (random):
hatches = itertools.cycle(['x', '//', '\\', '/'])
commons['hatches'] = {}
for x in commons['colors']:
commons['hatches'][x] = next(hatches)

return commons
4 changes: 2 additions & 2 deletions DispaSET/postprocessing/postprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

from ..misc.gdx_handler import gdx_to_list, gdx_to_dataframe, get_gams_path
from ..misc.str_handler import shrink_to_64, clean_strings
from ..common import commonvars
from ..common import commons

# get color definitions:
commons= commonvars()


def GAMSstatus(statustype,num):
'''
Expand Down
5 changes: 1 addition & 4 deletions DispaSET/preprocessing/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from .data_handler import UnitBasedTable,NodeBasedTable,merge_series, define_parameter, write_to_excel, load_csv

from ..misc.gdx_handler import write_variables
from ..common import commonvars
from ..common import commons # Load fuel types, technologies, timestep, etc:

GMS_FOLDER = os.path.join(os.path.dirname(__file__), '..', 'GAMS')

Expand Down Expand Up @@ -61,9 +61,6 @@ def build_simulation(config):
y_end, m_end, d_end, _, _, _ = config['StopDate']
config['StopDate'] = (y_end, m_end, d_end, 23, 59, 00) # updating stopdate to the end of the day

# Load fuel types, technologies, timestep, etc:
commons = commonvars()

# Indexes of the simualtion:
idx_std = pd.DatetimeIndex(start=pd.datetime(*config['StartDate']), end=pd.datetime(*config['StopDate']),
freq=commons['TimeStep'])
Expand Down

0 comments on commit f394188

Please sign in to comment.