Taking energy from battery or grid

Hello everyone,

I have a model representing 2 buildings (with a pv generation, storage and electrical load each). All the elements of one building are connected to one bus, and the elements of the second building are connected to another bus.

Also, both buses are interconnected to another intermediate bus through 4 blocks Transformer representing the input and output of each bus of the buildings.

On this intermediate bus are connected one Source and one Sink representig the electrical grid, which can operate apporting energy when the demand is not satisfied with the pv+storage or sending energy to the grid when there is an excess.

The idea of this system is to compensate the loads of both buildings with all the sources available and if it’s possible send to the grid the excedents and, when the sources are not capable of supply the load, take the energy necessary from the grid.

The doubts I have are how oemof discusses between taking energy from a battery or from the grid. All the simulations I’ve already done showed that the system always take the energy from the grid ignoring both batteries, unless I put the variable_costs on the blocks representing the grid.

Any help will be appreciated to solve this system that I’m studying.

If more info is needed I will provide with any problem.

Thak you so much!

1 Like

I think you are talking about oemof.solph (you should set the tag). By default solph will minimise the costs, so it will use the cheapest elements to satisfy the demand. If you do have a source without variable_costs you have energy for free and you can use this energy for everything. If there are two variants with the same cost the used component is “randomly selected”.

1 Like

Ok, thanks for your reply.
And now I have another question: it is possible to put the variable costs from a data series from a .csv file? I guess it will be possible, but I want to confirm it as I’m a begginer in oemof.solph.
And in which units I have to introduce the values of costs (€, c€)? I suppose it has to be introduced according the units of the Storage and the Source modelling the grid.
Thanks again!

You can use USD, EUR or any other unit as long as you use it consistently.

There are two typical ways to map data-sheets (e.g. csv) to your solph objects.

1 Like

Ok, understood. Thanks.

So, the units of the Source, Sink and Storage doesn’t matter whether they are kW or W as long as they are the same for all, I suppose. In accordance to them you select EUR/kWh or whatever, also considering the frequency of the timesteps (in this case should be hours).

Unit‑aware computing was discussed at an earlier openmod workshop in 2017:

Yes, as long as they are the same everywhere. The default time increment is one hour. If you have 15 minutes you have to use a time increment of 0.25 hours. If you use a time increment of 15 minutes the costs must be EUR/kWminutes :slight_smile:

Ok, thanks. And if I set a prix in the Storage block, it represents the costs of charging and discharging the batteries?

You can set variable costs for charging, variable cost for discharging and equivalent periodical cost for the investment.

I tried to set an array from my .csv into the variable_costs on the blocks representing the grid. I have a different prix for each timestep and if I execute de code, the result is an error like this:

‘str’ object has no attribute ‘is_variable_type’

The only case when the code works well is when I set a fixed prix on variable_costs (like 1, 5, 10 or whatever).

Any help is appreciated.
Thank you.

Could you provide a minimal example

Minimal example: About 5 time steps and the minimal number of components to show your problem. All data should be hard coded in your example.

Text and images licensed under CC BY 4.0Data licensed under CC0 1.0Code licensed under MITSite terms of serviceOpenmod mailing listOpenmod wiki.