Hello, I am using oemof to model a building with a photovoltaic (PV) system, a heat pump for heating demand, and electrical and thermal storage for excess energy. However, the storage is being filled with imported energy from the grid continuously, leading to an overuse of grid power. How can I prioritize the use of PV production to charge the storage and ensure that grid imports are only used to cover the demand when necessary, without overcharging the storage from the grid?
Hi @Amira.h,
Thanks for reaching out. Actually, solph (I assume you mean that by saying oemof), optimises the costs of operation under the given constraints. Thus, it is importing energy for the storage that is either needed or somehow cost effective in your problem formulation.
To dig into this, it might help to render your energy system graph using the following snippet:
import networkx as nx
from oemof.network.graph import create_nx_graph
graph = create_nx_graph(energy_system)
nx.draw(graph, with_labels=True, font_size=8)
Note that this can be done before creating the solph model that is then to be optimised/solved. So, when using Jupyter Notebooks, it is a good last check before you start your optimisation.
Cheers,
Patrik
Hello, thank you for fast reply. I have few questions: my system contains multiple buildings that share PV-generated electricity , heat pumps , E-boilers and storage. The model runs on a 15-minute time step. 1) Are grid import costs: units in €/kW or €/kWh ?
2) how to include grid export prices? selling to the grid?
Thanks in advance !
Hello Amira,
-
the units depend on the user, if you provide nominal values in kW, then the flow will be in kWh. That being said, this is the case if the timesteps are hourly, I am not sure if one need to adapt with a factor 4 in your case, I unfortunately don’t have experience with this but I would be interested by the answer
-
I do it by adding a sink for feedin with negative
variable_costs
to the bus the grid import source is connected to
Is it possible with oemof/solph to add an operation constraint that the battery charging power at each instant should be ≤ pv production excess (i.e. pv production - local consumption). This would be a linear constraint.
Otherwise, I have seen a MILP rule for forbidding grid exports from the storage in the 2024 article doi.org/10.1016/j.renene.2024.120186 “Optimal sizing and energy management of a microgrid: A joint MILP approach for minimization of energy cost and carbon emission” by F. Agha Kassab et al. from UTC, Compiègne. However, I only quickly read through that part.
The easiest way to do so is by using multiple buses. If you want to interpret that as a physical thing rather than just a constraint, imagine the following setup:
| -> Inverter -> AC <-> Grid
PV -> DC |
|<-> Battery
About the other questions:
- You define energy costs, not costs for power.
- You can define negative costs to have revenues.