Skip to content

Commit

Permalink
Exogenous reserves should now be OK. Also included in test config file.
Browse files Browse the repository at this point in the history
  • Loading branch information
squoilin committed Feb 14, 2020
1 parent d7c2651 commit 87014ec
Show file tree
Hide file tree
Showing 5 changed files with 8,788 additions and 4 deletions.
Binary file modified ConfigFiles/ConfigTest.xlsx
Binary file not shown.
5 changes: 2 additions & 3 deletions dispaset/preprocessing/build.py
Expand Up @@ -10,7 +10,7 @@

from .data_check import check_units, check_sto, check_AvailabilityFactors, check_heat_demand, \
check_temperatures, check_clustering, isStorage, check_chp, check_p2h, check_df, check_MinMaxFlows, \
check_FlexibleDemand
check_FlexibleDemand, check_reserves
from .data_handler import NodeBasedTable, load_time_series, UnitBasedTable, merge_series, define_parameter
from .utils import select_units, interconnections, clustering, EfficiencyTimeSeries, incidence_matrix, pd_timestep

Expand Down Expand Up @@ -189,6 +189,7 @@ def build_single_run(config, profiles=None):
check_heat_demand(plants,HeatDemand)
check_temperatures(plants,Temperatures)
check_FlexibleDemand(ShareOfFlexibleDemand)
check_reserves(Reserve2D,Reserve2U,Load)

# Fuel prices:
fuels = ['PriceOfNuclear', 'PriceOfBlackCoal', 'PriceOfGas', 'PriceOfFuelOil', 'PriceOfBiomass', 'PriceOfCO2', 'PriceOfLignite', 'PriceOfPeat']
Expand Down Expand Up @@ -307,12 +308,10 @@ def build_single_run(config, profiles=None):
reserve_2U_tot[z] = Reserve2U[z]
else:
reserve_2U_tot[z] = np.sqrt(10 * PeakLoad[z] + 150 ** 2) - 150
logging.warning('No 2U reserve requirement data has been found for zone ' + z + '. Using the standard formula')
if z in Reserve2D:
reserve_2D_tot[z] = Reserve2D[z]
else:
reserve_2D_tot[z] = 0.5 * reserve_2U_tot[z]
logging.warning('No 2D reserve requirement data has been found for zone ' + z + '. Using the standard formula')


# %% Store all times series and format
Expand Down
24 changes: 24 additions & 0 deletions dispaset/preprocessing/data_check.py
Expand Up @@ -485,6 +485,30 @@ def check_heat_demand(plants,data):
return True


def check_reserves(Reserve2D,Reserve2U,Load):
'''
Function that checks the validity of the reserve requirement time series
'''
for z in Load.columns:
if z in Reserve2U:
if (Reserve2U[z] < 0).any():
logging.critical('The reserve 2U table contains negative values for zone ' + z)
sys.exit(1)
if (Load[z] - Reserve2U[z] < 0).any():
logging.critical('The reserve 2U table contains negative values higher than demand for zone ' + z)
sys.exit(1)
else:
logging.warning('No 2U reserve requirement data has been found for zone ' + z + '. Using the standard formula')
if z in Reserve2D:
if (Reserve2D[z] < 0).any():
logging.critical('The reserve 2D table contains negative values for zone ' + z)
sys.exit(1)
if (Load[z] - Reserve2D[z] < 0).any():
logging.critical('The reserve 2D table contains negative values higher than demand for zone ' + z)
sys.exit(1)
else:
logging.warning('No 2D reserve requirement data has been found for zone ' + z + '. Using the standard formula')


def check_temperatures(plants,Temperatures):
'''
Expand Down
2 changes: 1 addition & 1 deletion dispaset/preprocessing/data_handler.py
Expand Up @@ -389,7 +389,7 @@ def load_config_excel(ConfigFile,AbsPath=True):
'PriceOfFuelOil':183,'PriceOfBiomass':184, 'PriceOfCO2':166,
'ReservoirLevels':133, 'PriceOfLignite':185, 'PriceOfPeat':186,
'HeatDemand':134,'CostHeatSlack':165,'CostLoadShedding':168,'ShareOfFlexibleDemand':125,
'Temperatures':135,'PriceTransmission':169,'Reserve2U':161,'Reserve2D':160}
'Temperatures':135,'PriceTransmission':169,'Reserve2U':160,'Reserve2D':161}
modifiers= {'Demand':274,'Wind':275,'Solar':276,'Storage':277}
default = {'ReservoirLevelInitial':101,'ReservoirLevelFinal':102,'PriceOfNuclear':180,'PriceOfBlackCoal':181,
'PriceOfGas':182,'PriceOfFuelOil':183,'PriceOfBiomass':184,'PriceOfCO2':166,'PriceOfLignite':185,
Expand Down

0 comments on commit 87014ec

Please sign in to comment.