Dear OEMOF and Openmod community,
I am making a simple model that simulates a load that can only be charged by a battery that is attached to a PV source. My goal is to charge the battery whenever there is PV available. The bus of the PV source and battery can also provide to the grid in case of overproduction. For some reason, even when I set the variable costs of the battery significantly lower than the grid, the results of the model (oemof components provided below) still prioritize supply to the grid.
Any ideas on why this happens or how to solve this are very welcome!
# create EV bus
bev = buses.Bus(label="EV_bus")
# create electricity bus
bel = buses.Bus(label="electricity_bus")
# create grid
bgrid = buses.Bus(label = "grid")
# adding the buses to the energy system
energysystem.add(bev, bel, bgrid)
# create excess component for the electricity bus to allow overproduction
grid_excess = cmp.Sink(label="excess_grid", inputs={bgrid: flows.Flow(variable_costs = 10)})
energysystem.add(grid_excess)
# create converter object in order to include costs to grid
energysystem.add(
cmp.Link(
label="main_el_bus_to_grid",
inputs={bel: flows.Flow(),bgrid: flows.Flow()},
outputs={bgrid: flows.Flow(), bel: flows.Flow()},
conversion_factors={(bel,bgrid): 0.5}
)
)
energysystem.add(
cmp.Source(
label="pv",
outputs={bel: flows.Flow(fix=data["Production"], nominal_value=1)},
)
)
#generate data for EV demand and required storage for battery
data_EV = data_generation.generate_dataset(power = 15000 , machine_type = 'Light Barn Mover')
data_EV = data_EV[0:len(data)]
array_data_EV = data_EV['Load']
array_data_req_storage_EV = data_EV['Required Storage Content']
# create sink object representing the EV demand
# nominal_value is set to 1 because demand_el is not a normalised series
energysystem.add(
cmp.Sink(
label="demand",
inputs={bev: flows.Flow(fix=array_data_EV, nominal_value=1)},
)
)
storage = cmp.GenericStorage(
nominal_storage_capacity=100779,
label="storage",
inputs={bel: flows.Flow()},
outputs={
bev: flows.Flow()
},
loss_rate=0.00,
initial_storage_level=0.1,
# min_storage_level = array_data_req_storage_EV,
inflow_conversion_factor=1,
outflow_conversion_factor=1,
balanced = False
)
energysystem.add(storage)
The obj function in the LP file reads (for three time steps)
min
objective:
+0.8333333333333333 flow(grid_excess_bel_0_0)
+0.8333333333333333 flow(grid_excess_bel_0_1)
I have included figures to clarify. They show the two demand peaks and that the battery is only supplied when the peaks are there. But by default, the model supplies to the grid sink instead of charging the battery.