openego / eTraGo

Optimization of flexibility options for transmission grids based on PyPSA
GNU Affero General Public License v3.0
30 stars 13 forks source link

Implement sclopf #710

Closed ClaraBuettner closed 4 months ago

ClaraBuettner commented 5 months ago

Solves #381

I created a new feature branch and did not used the old one because it was very outdated and also included several features that were already in dev.

ClaraBuettner commented 5 months ago

Current status: The basic execution of the SCLOPF is working and is already included in etrago.optimize(). There are still some things to do:

Currently, the iterative sclopf always uses pyomo. It would be nice to allow using linopy, but that might not be part of this PR.

ClaraBuettner commented 4 months ago

I installed eTraGo using this branch in a fresh virtual environment and when I try to run it (using eGon2035) I got this error message:

File ~/env/etrago_pr_710/lib/python3.10/site-packages/spyder_kernels/py3compat.py:356 in compat_exec exec(code, globals, locals)

File ~/git/eTraGo/etrago/appl.py:770 etrago = run_etrago(args, json_path=None)

File ~/git/eTraGo/etrago/appl.py:678 in run_etrago etrago.build_network_from_db()

File ~/git/eTraGo/etrago/tools/network.py:377 in build_network_from_db self.scenario = NetworkScenario(

File ~/git/eTraGo/etrago/tools/io.py:129 in init self.configure_timeindex()

File ~/git/eTraGo/etrago/tools/io.py:159 in configure_timeindex tr = saio.as_pandas(

File ~/env/etrago_pr_710/lib/python3.10/site-packages/saio.py:181 in as_pandas df = pd.read_sql_query(query.statement, query.session.bind,

File ~/env/etrago_pr_710/lib/python3.10/site-packages/pandas/io/sql.py:526 in read_sql_query return pandas_sql.read_query(

File ~/env/etrago_pr_710/lib/python3.10/site-packages/pandas/io/sql.py:2739 in read_query cursor = self.execute(sql, params)

File ~/env/etrago_pr_710/lib/python3.10/site-packages/pandas/io/sql.py:2671 in execute raise TypeError("Query must be a string unless using sqlalchemy.")

TypeError: Query must be a string unless using sqlalchemy.

Do you have any idea why could it happen?

I have the same problem on dev when I create a new environment. So I guess this is not related to the changes on this branch. The reason might be a new package version or sth. like that.