Variable efficiency depending on SoC



Hello everybody,

I was wondering if it is possible to model a variable Efficiency depending on the state of Charge of e.g. batteries. As I understand the code an array is being created that matches the amount of time slices and is then not looked at anymore (inflow_conversion_factor).

Is it possible to adress this Array during the runtime? How do I get access on the SoC from the prior period and most important, how do I tell it to the solver (assuming I stay in a LP-problem)?


Assuming that you use the perfect foresight approach your problem will not be linear if the charging efficiency depends on the state of charge.

You could loop over your problem and use the SoC from your previous run to calculate the efficiency for every time step. In simple problems this will converge in a few steps. Therefore it depends on the size and complexity of your model whether this is suitable for you.

Using the time step approach it is possible to calculate the efficiency for every time step during the run time but this will have some more implications you should be aware of.


On the other hand, if you are using recursive-dynamic optimization rather than forward-looking optimization (this terminology after Babiker et al 2009), then the algorithm is straightforward.

Assuming an object-oriented language (like python), maintain a state-of-charge (SoC) object attribute, degrade it if necessary across each timestep for “leakage”, and then calculate the efficiency prior to finalizing the contribution of the object (in this case, a battery bank) to the step-local optimization problem. The efficiency may be any explicit (and not necessarily linear) function of SoC.

By the way, is this an oemof model question? If so, you could indicate that in your post and also apply an oemof tag for others to search on. HTH Robbie.


Babiker, Mustafa, Angelo Gurgel, Sergey Paltsev, and John Reilly (2009). “Forward-looking versus recursive-dynamic modeling in climate policy analysis: a comparison”. Economic Modelling. 26 (6): 1341–1354. ISSN 0264-9993. doi:10.1016/j.econmod.2009.06.009.



Could you ellaborate on the implications? My current Status of mind is that I want to do that during the runtime depending on the SoC (for example).


This is an oemof related question, so thank you for the hint. I added the tag.

As far as I understand Oemof uses the Forward-looking optimization and I am unsure on how easily the other Approach can be adapted (I will take a closer look to the article you cited later today). I will try the Approach to pass a “variable object” to the solver when defining an efficiency, although I don’t think that the solph class will know how to handle that.

Thank you both so far - I didn’t see your answers before today, usually I answer way quicker.