Hi Uwe,
I have given your questions some thought.
In the long-term, you wouldn't be happy to hardcode changes into your
PyPSA source code (like the ones you outlined). It would make updates
very tedious!
The difficulty you encounter is that custom components are not reflected
in the standard constraints (foremost the nodal balance constraint).
Admittedly, amending constraints used to be easier with pyomo, because
pyomo allowed to add terms to existing constraints. To my knowledge,
this is not supported in the nomopyomo version. Adding terms to the
objective is however rather simple; you can just call write_objective()
again with the additional terms.
Therefore, I would encourage you to use the fundamental PyPSA components
for as much as possible.
Amending component *attributes* (rather than completely new components)
requires much less individual adjustments. This might be attractive for
your cause. I think the vast majority of technologies could be modelled
this way.
Using custom attributes you can for example define links with multiple
inputs and/or outputs (see
https://pypsa.readthedocs.io/en/latest/components.html#link-with-multiple-outputs-or-inputs).
For an example use (methanation), see
https://github.com/PyPSA/pypsa-eur-sec/blob/master/scripts/prepare_sector_network.py#L631-L641.
You can then define custom constraints (using `extra_functionality`) not
for each custom component, but for subsets of the fundamental PyPSA
components (e.g. all links with a certain carrier). For an example see
https://github.com/PyPSA/pypsa-eur-sec/blob/master/scripts/solve_network.py#L122-L155.
Best wishes,
Fabian N
> --
> You received this message because you are subscribed to the Google
> Groups "pypsa" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
pypsa+un...@googlegroups.com
> <mailto:
pypsa+un...@googlegroups.com>.
> To view this discussion on the web, visit
>
https://groups.google.com/d/msgid/pypsa/91f122a7-917f-46c0-b246-b662bb1bd351%40googlegroups.com
> <
https://groups.google.com/d/msgid/pypsa/91f122a7-917f-46c0-b246-b662bb1bd351%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
Karlsruhe Institute of Technology (KIT)
Institute for Automation and Applied Informatics (IAI)
Fabian Neumann (he/him)
PhD Student in Energy System Modelling
Phone:
+49 721 608 25707 | Mobile:
+49 171 2943831 |
Group:
www.iai.kit.edu/english/esm.php | Personal: www.neumann.fyi |
Github: @fneum | Twitter: @fneum_
Learn about nearly-optimal power system models:
https://arxiv.org/abs/1910.01891
KIT Campus North, Building 445, Office 304
Hermann-von-Helmholtz-Platz 1
76344 Eggenstein-Leopoldshafen
KIT – The Research University in the Helmholtz Association