New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce nomopyomo #99
Conversation
disable test for python 2.7
This already looks super nice! I just added "docstrings in |
I'm fine with dropping Python 2.7 support in future versions. This discussion already came up in #79 . Obviously, we should make this clear in release notes and documentation. Additionally, we should keep a documentation version of the last Python 2.7 support version of PyPSA in https://pypsa.readthedocs.io. |
Thanks! And yes. Could you help me there? Perhaps with the documention part, always missing the patience to do it properly. Considering the docstrings, most of the function in linopt already have it already.
|
Sure, I can do that. WIP will be here: https://pypsa.readthedocs.io/en/nomopyomo/ |
Great! I've just integrated the code into the solve_network of PyPSA-Eur-Sec. It mostly works, but pne thing that breaks is the test of |
done :) |
Brilliant, thank you! Just running a test for it now. |
Total memory usage (PyPSA+gurobi) is 10% lower with new integer storing of variable and constraint references! Good result! |
I seem to be having the problem that the results are not saved in the netCDF correctly - could it be that the reading out of results with the new integer scheme is broken? |
BTW My changes to the PyPSA-Eur-Sec solving script (very similar to PyPSA-Eur) you can find here: |
I'm wondering, could you try the following snippet:
It works fine for me. The only thing that happens is the order of the generators which is sorted alphabetically afterwards and was aligned to |
aah, sorry about that, overlooked it |
No worries. One thing we may have to deal with later, is that some large problems don't solve with "ok", but with "warning", which is why @coroa wrote this exception: |
Hey, I'm just finalising the implementation of nomopyomo in PyPSA-Eur. I'm having a problem when adding a line volume constraint to the problem which already has a CO2 constraint. E.g. take the AC-DC example from PyPSA/examples and add before LOPF:
This results in an error:
Any ideas? |
Could you try setting
instead where the error happens (387 in linopt)? I think it worked for me |
That works for the AC-DC example! I'll try it on PyPSA-Eur now. |
There was no error building problem for PyPSA-Eur now. Just waiting for it to solve. Did the error make sense, i.e. did you understand why it was going wrong? |
I'm not very sure why specifically this works now. Before it had to do with changing adding multiple values at the same time, like df = pd.DataFrame(1, index=['a'], columns=[0])
df.loc[['b']] = 2 which breaks (I did not know this before). Now, what happens is rewriting the whole dataframe which is more stable. |
PyPSA-Eur-Sec is now all working for arbitrary line volumes: |
@nworbmot this sounds good! Perhaps to little things:
|
Thanks @FabianHofmann for all your hard work on this! By far the biggest pull request we've ever had! |
Introduce optimization without usage of pyomo, based on nomopyomo which is way faster and memory efficient for especially large networks.
What happened so far:
New Modules
Ordinary features of lopf without pyomo:
Additional features
linop{t,f}.py
Other changes
determine_network_topology now includes find_slackbus and find_cycles
add new lopf to tests in
skip python2.7 test in travis file. I had to much python3 code syntax, and didn't see the nessecity to rewrite it as so many package give up on python2 support. But perhaps you have a different view.
The network.lopf function got a new argument as proposed in #96, so it becomes possible now to call