Dear all,
I am currently working on a model for my bachelor thesis in which I want to optimize a combined cycle heat and power plant (CCHP) with a thermal energy storage, a power to heat component (PtH) and a heat only boiler.
To do this I want to include variable electricity prices. I have the prices in €/MWh for every hour of the year, which is also the time step and period of my model.
However I don’t know how to link the variable costs of the power to heat component as well as the CCHP to the electricity prices in my csv_file.
Also, I want to include different taxes and fees depending on three cases:
- the CCHP produces power: it earns the electricity price of the respective hour
- the PtH module uses the power created by the CCHP, in this case electricity tax has to be paid
- the PtH module uses power from the grid, in this case the costs are the momentary power price, electricity tax and electricity fees
It seems as if to achieve this I also have to create several electricity buses.
My code looks like this so far. Note that I tried to include the electricity prices by calling my csv file (‘data’) just as you would if you include the “actual_value”. It didn’t work…
I also added a thermal energy storage and a heat only boiler. All components, including the cchp are subject to optimization. The values for capex and variable costs aren’t included here as I don’t want to make the post even longer…
other abbreviations:
SS: Stromsteuer (electricity tax)
NE: Netzentgelde (electricity fees)
filename = os.path.join(os.path.dirname(__file__), 'price_dhn.csv')
data = pd.read_csv(filename, sep=";")
### adding buses for electricity, gas and thermal energy
B_el_1 = solph.Bus(label= 'B_el_1', balanced =True)
B_el_2 = solph.Bus(label= 'B_el_2', balanced = True)
B_gas = solph.Bus(label ='gas_grid', balanced =True)
B_th = solph.Bus(label = 'bus_th', balanced = True)
logging.info('Busses Created')
### add gas source as well as electricity and thermal sinks
gas_import = solph.Source(
label='import_natural_gas',
outputs={B_gas: solph.Flow(
variable_costs= gas_price)})
grid_sink = solph.Sink(
label= 'grid_sink',
outputs = {B_el_1: solph.Flow()} )
grid_source = solph.Source(
label= 'grid_source',
outputs = {B_el_2: solph.Flow()})
thermal_demand = solph.Sink(
label ='thermal_demand', inputs ={B_th: solph.Flow(
actual_value =data['dhn_demand_n'], nominal_value = 823.3, fixed = True)})
logging.info('Sources / Sinks created')
# an excess and a shortage variable can help to avoid infeasible problems; does this
# make sense here?
#excess = solph.Sink(label='excess_el', inputs={B_el_1: Flow()})
# create both gas power plant and gas boiler
cchp = solph.components.GenericCHP(
label = 'cchp',
fuel_input = {B_gas: solph.Flow()},
electrical_output={B_el_1: solph.Flow(
#P_max_woDH=[400],
#P_min_woDH=[100],
variable_costs = - data['el_price']
Eta_el_max_woDH=[0.525],
Eta_el_min_woDH=[0.444])},
heat_output={B_th: solph.Flow(
#Q_CW_min=[300]
)},
Beta=[0.122], back_pressure=False,
investment = solph.Investment(ep_costs=epc_CCHP))
# Add HOB
HOB = solph.Transformer(label= 'HOB', inputs = {B_gas: solph.Flow(variable_costs = var_costs_HOB)},
outputs = {B_th: solph.Flow()},
conversion_factors = {B_gas: 0.95},
investment = solph.Investment(ep_costs=epc_HOB))
# add thermal energy storage
TES = solph.components.GenericStorage(
label='TES',
inputs={B_th: solph.Flow()},
outputs={B_th: solph.Flow()},
capacity_loss=0.02,
inflow_conversion_factor=0.98, outflow_conversion_factor=0.95,
investment = solph.Investment(ep_costs = epc_TES))
# Add power to heat
PtH = solph.Transformer (label = 'PtH',
inputs = {{B_el_1: solph.Flow(variable_costs = SS)},
{B_el_2: solph.Flow(variable_costs = data['el_price']+SS +NE)}},
outputs = {B_th : solph.Flow()},
investment = solph.Investment(ep_costs = epc_PtH) )
# add everything to energysystem
system.add(B_el_1, B_el_2, B_gas, B_th, gas_import, thermal_demand, grid_sink, grid_source
,cchp, HOB, TES, PtH)
Thank you for your help much appreciated
Best
Philipp