Hi,
I am trying to model an extremely simple case, but cannot find out how to do so.
I want to model a electrical storage (battery), that is simply connected to the grid. Using a variable price timeseries (day ahead prices), I simply want to create an optimized schedule of when to charge and discharge the battery. So - it would incur positiv grid prices for taking the energy and negativ prices (of the same series) for feeding into the grid. I set the storage to 90% “efficiency” like in some of the simple oemof examples. The battery should charge with “low” prices and discharge with “higher” prices and thereby generate income, quite a common approach I would think
I have tried
- 1 electrical bus with source and sink and storage
- 1 bus with source plus one bus with sink and storage connected to both
All I can ever get is “unbounded”/infeasible from the solver. Adding an additional “excess” sink to either or both of the busses does not make a difference.
What is the correct way to model this? Maybe someone can provide those few lines of code that should be necessary to make this work.
Sorry to ask, quite embarrasing that I cannot get this to work but I also could not find any examples for “grid storage” or similar online or in this forum
Code tried:
def make_energy_system(demanddf):
energysystem = solph.EnergySystem(timeindex=demanddf.index, infer_last_interval=False)
b_el = solph.buses.Bus(label='Strom')
b_el_out = solph.buses.Bus(label='Stromeinsp')
energysystem.add(b_el, b_el_out)
energysystem.add(cmp.Sink(label="excess_bel", inputs={b_el: solph.flows.Flow()})) # tested with both/none/either
energysystem.add(cmp.Sink(label="excess_belout", inputs={b_el_out: solph.flows.Flow()})) # tested with both/none/either
el_Netzeinsp = solph.components.Sink(label='Strom Netzeinsp.', inputs={b_el_out: solph.flows.Flow(
variable_costs=demanddf["DA FC"]*-1)}
)
el_Netzbezug = solph.components.Source(label='Strom Netzbezug', outputs={b_el: solph.flows.Flow(
variable_costs=demanddf["DA FC"])})
energysystem.add(el_Netzeinsp, el_Netzbezug)
storage = cmp.GenericStorage(
nominal_storage_capacity=10077997,
label="storage",
inputs={b_el: Flow(nominal_value=10077997 / 6)},
outputs={
b_el_out: Flow(nominal_value=10077997 / 6, variable_costs=0.001)
},
loss_rate=0.00,
initial_storage_level=None,
inflow_conversion_factor=1,
outflow_conversion_factor=0.9,
)
energysystem.add(storage)
return energysystem