openego / eTraGo

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

Error if lpfile path is set #34

Closed wolfbunke closed 7 years ago

wolfbunke commented 7 years ago

I tried to use the attribute 'lpfile': in order to save my results but following Error appeared:

...
INFO:pypsa.pf:Slack bus for sub-network 0 is 25569
INFO:pypsa.opf:Performed preliminary steps
INFO:pypsa.opf:Building pyomo model using `angles` formulation
INFO:pypsa.opf:Solving model using gurobi
INFO:pypsa.opf:Optimization successful
Traceback (most recent call last):
  File "k_means_testing.py", line 136, in <module>
    network = etrago(args)
  File "k_means_testing.py", line 128, in etrago
    True})
  File "/eTraGo/lib/python3.5/site-packages/pyomo/core/base/block.py", line 1646, in write
    io_options)
TypeError: __call__() takes from 1 to 3 positional arguments but 5 were given

I took a look into the etrago() function:

# write lpfile to path
     if not args['lpfile'] == False:
         network.model.write(args['lpfile'], io_options={'symbolic_solver_labels':
                                                      True})

For me, It seems to be an Error in the network class ->from egopowerflow.tools.io import NetworkScenario, or?

Any ideas, how to solve this error?

lukasol commented 7 years ago

Could you provide the line where you specified the line "lpfile"?

ulfmueller commented 7 years ago

I just talked to @wolfbunke . The problem is that you have to specify the file name at the end of the path. That solved the problem.

ulfmueller commented 7 years ago

updated the commentary see: 94e15c85e6b01088da7705cc146e1af984c3c043

wolfbunke commented 7 years ago

yes, thx!