Hello everyone,
I am working on simulating and optimizing an energy system using oemof. My system includes various components such as a grid connection, PV panels, a battery storage system, a gas boiler, a CHP unit, and an air-source heat pump. I am encountering an issue where the calculated energy shares for some sources exceed 100%. This happens only when add heat pump to my energy system.
Here is a brief overview of my setup:
- Electricity sources: Grid, PV, Battery, CHP
- Heat sources: Gas boiler, Buffer storage, CHP, Heat pump
I calculate the energy shares by summing the energy flows from each source to the respective demand (electricity or heat) and then dividing by the total demand.
Here is a snippet of my code for calculating the shares:
# Adding the relevant columns from the read data
data = pd.DataFrame({
‘demand_th’: heat_demand_data[‘demand_th’],
‘demand_el’: electricity_demand_data[‘demand_el’],
‘pv’: pv_data[‘electricity’]
})
#Calculate electricity demand for the heat pump
data[‘heat_pump_el_demand’] = data[‘demand_th’] / cop
# Update the electricity demand to include the heat pump demand
data[‘demand_el’] += data[‘heat_pump_el_demand’]
Total electricity demand
E_demand = electricity_bus[‘sequences’][(‘el_bus’, ‘E_demand’), ‘flow’].sum()
#Total electricity generation (including all sources)
E_generation = electricity_bus[‘sequences’][(‘grid’, ‘el_bus’), ‘flow’].sum() +
electricity_bus[‘sequences’][(‘pv’, ‘el_bus’), ‘flow’].sum() +
electricity_bus[‘sequences’][(‘battery’, ‘el_bus’), ‘flow’].sum() +
electricity_bus[‘sequences’][(‘CHP’, ‘el_bus’), ‘flow’].sum()
# Calculate shares
PV_share = (electricity_bus[‘sequences’][(‘pv’, ‘el_bus’), ‘flow’].sum()) / E_demand * 100
Excess = (electricity_bus[‘sequences’][(‘el_bus’, ‘excess_bel’), ‘flow’].sum()) / E_demand * 100
Grid_share = (electricity_bus[‘sequences’][(‘grid’, ‘el_bus’), ‘flow’].sum()) / E_demand * 100
Battery_share = (electricity_bus[‘sequences’][(‘battery’, ‘el_bus’), ‘flow’].sum()) / E_demand * 100
CHP_el_share = (electricity_bus[‘sequences’][(‘CHP’, ‘el_bus’), ‘flow’].sum()) / E_demand * 100
Einspeisung_share = (electricity_bus[‘sequences’][(‘el_bus’, ‘einspeisung’), ‘flow’].sum()) / E_demand * 100
Print shares
print(‘-----Electricity-----’)
print(f’Grid share = {Grid_share:.2f} %‘)
print(f’PV share = {PV_share:.2f} %’)
print(f’Battery share = {Battery_share:.2f} %‘)
print(f’CHP_el share = {CHP_el_share:.2f} %’)
print(f’Einspeisung share = {Einspeisung_share:.2f} %‘)
print(f’Excess share = {Excess:.2f} %’)
#####################################################################
#%Add Heat generations here
#####################################################################
print(‘-----Heat------’)
H_demand = (heat_bus[‘sequences’][(‘th_bus’, ‘H_demand’), ‘flow’].sum())
H_generation = heat_bus[‘sequences’][(‘gas_boiler’, ‘th_bus’), ‘flow’].sum() +
heat_bus[‘sequences’][(‘Buffer_storage’, ‘th_bus’), ‘flow’].sum() +
heat_bus[‘sequences’][(‘CHP’, ‘th_bus’), ‘flow’].sum() +
heat_bus[‘sequences’][(‘heat_pump’, ‘th_bus’), ‘flow’].sum()
######### print Heat shares here #########
Gas_share = (heat_bus[‘sequences’][(‘gas_boiler’, ‘th_bus’), ‘flow’].sum()) / H_demand * 100
Buffer_share = (heat_bus[‘sequences’][(‘Buffer_storage’, ‘th_bus’), ‘flow’].sum()) / H_demand * 100
CHP_th_share = (heat_bus[‘sequences’][(‘CHP’, ‘th_bus’), ‘flow’].sum()) / H_demand * 100
Air_Heat_Pump_share = (heat_bus[‘sequences’][(‘heat_pump’, ‘th_bus’), ‘flow’].sum()) / H_demand * 100
print(‘Gas share = ’ + str(round(Gas_share, 2)) + ’ %’)
print(‘Buffer share = ’ + str(round(Buffer_share, 2)) + ’ %’)
print(‘CHP_th share = ’ + str(round(CHP_th_share, 2)) + ’ %’)
print(‘Air Heat Pump share = ’ + str(round(Air_Heat_Pump_share, 2)) + ’ %’)
CHP_share = CHP_el_share + CHP_th_share
print(‘Total CHP share = ’ + str(round(CHP_share, 2)) + ’ %’)
Despite ensuring that my flows are not double-counted and my demand and supply are balanced, some energy shares exceed 100%.
Questions:
- What might be causing the energy shares to exceed 100% in my calculations?
- How can I accurately calculate energy shares to ensure they correctly represent the portion of demand met by each source without exceeding 100%?
- Are there any common pitfalls or mistakes to watch out for when calculating energy shares in oemof?
I followed these steps to set up my energy system model in oemof:
Set up the energy system: Defined buses, sources, sinks, and converters including a grid connection, PV panels, a battery storage system, a gas boiler, a CHP unit, and an air-source heat pump.
Added time series data: Incorporated time series data for heat and electricity demand, as well as PV generation.
Updated electricity demand: Added the electricity demand for the heat pump to the total electricity demand.
Optimized the model: Used the solph.Model to optimize the system and calculate energy flows.
Calculated energy shares: Summed the energy flows from each source to the respective demand and divided by the total demand.
Despite ensuring that my flows are not double-counted and my demand and supply are balanced, some energy shares exceed 100%. Here are the printed results:
-----Electricity-----
Grid share = 103.88 %
PV share = 178.79 %
Battery share = 0.61 %
CHP_el share = 0.00 %
Einspeisung share = 115.6 %
Excess share = 0.00 %
-----Heat------
Gas share = 0.27 %
Buffer share = 12.94 %
CHP_th share = 0.0 %
Air Heat Pump share = 101.38 %
Total CHP share = 0.0 %
I expected the total shares for each demand type (electricity and heat) to be 100% or less.
Any insights or suggestions would be greatly appreciated.
Thank you