Refactoring to make EOS more generally applicable #187
Replies: 1 comment
-
When creating a proof of concept for a prediction submodule I recognized some things to be handy in the new structure: An utilities submodule for concepts/ functions used or to be used over the complete code base. What I needed that could be useful for other code parts, and that centralizes maintenenace for these utilities:
A submodule for configuration that provides a mixin class so that all classes get easy access to the configuration with the concept of a priority of configuration data:
A server submodule that is part of the akkudoktoreos package (not in an extra package). In the end my proposal for the submodule/ directory structure is:
I would like to use this structure to go on with the proof of concept prediction submodule. Any comments welcome. |
Beta Was this translation helpful? Give feedback.
-
Over the past weeks there were many changes, but the project largely remained tailored to one specific setup.
I would like to propose changing how loads, parameters and the optimization problem are set up, such that it becomes easier to customize the involved devices and parameters.
Step 1: Understand what is important to move the project forward
Is the current goal to make EOS an "enterprise product" with documentation, strong type hints, full test coverage, state of the art dev tooling, self-describing REST API and so on?
That would certainly be nice for Andreas, but hardly useful for anybody else.
Instead, I would personally prefer an EOS that can be customized to different energy setups.
Large or small, with a battery or without, with or without (non-)smart household loads and so on.
To achieve this, we need to change how the setup (aka the optimization problem) is defined.
Step 2: Separate components, simulation and optimization
Let's start by mapping components/tasks in EOS to see if we can find patterns by which we might organize the code.
In words:
We can now try to morph the Python codebase to reflect this separation of concerns too.
I have opened PR #188 to do this.
Step 3: Increase abstraction level of model components
Right now
optimization_problem
andEnergieManagementSystem
knowPVAkku
,Haushaltsgeraet
andWechselrichter
by name. Oddly enough they don't know aboutHeatpump
andeauto = PVAkku(...)
.Looks like an organically grown design, which is fair enough for a prototype.
Looking at the mindmap above, however, we can cluster these system components and call them
Load
,LoadModel
,LoadProfile
or whatever.From load profiles to a energy system model
What do load profiles have in common?
power
trajectory (positive or negative)state_of_charge
,skip_penalty
)on_power
)state_of_charge
)charge_start
,charge_duration
)temperature
orpv_max_power
)With this, our
EnergySystem
model is simply a container that sums the load profiles in all aspects:The other EOS components no longer have to know any details!
They only care about the abstract properties of a
LoadProfile
:free_parameters
simulate(params, forecasts) -> power, cost, states
Refactoring for abstraction
The current load model implementations are stateful and do not share a common superclass.
Some have a
.reset()
method,Haushaltsgeraet
already has a.get_lastkurve()
but other than that they are quite ... individual.I would recommend to start by defining the structural protocols needed by
EnergyManagementSystem
and other components.For example:
This would enable more abstract initialization of the energy system model:
Enough thinking about this for today.
I'm curious what people think about this proposal.
Beta Was this translation helpful? Give feedback.
All reactions