Hi Lauren,
the mapping is done in pyomo internally, and you are right it's a bit
tricky to interpret the lp files. This could work:
```
import pypsa
from pyomo.core import ComponentUID
n = pypsa.Network("
some_network.nc")
pypsa.opf.network_lopf_build_model(n, **kwargs)
_, smap_id = n.model.write("test.lp")
symbol_map = n.model.solutions.symbol_map[smap_id]
mapping = {}
for symbol, var_weakref in symbol_map.bySymbol.items():
mapping[symbol] = ComponentUID(var_weakref())
pypsa.opf.network_lopf_prepare_solver(n, **kwargs)
pypsa.opf.network_lopf_solve(n, **kwargs)
```
The dictionary `mapping` will contain the translation.
Probably there is a more elegant way. I'd be glad if someone could tell me.
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/24efc843-d5d1-4aaf-8afa-ba3cb954a19b%40googlegroups.com
> <
https://groups.google.com/d/msgid/pypsa/24efc843-d5d1-4aaf-8afa-ba3cb954a19b%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