Git Product home page Git Product logo

pandamodels.jl's People

Contributors

aaltayara avatar github-actions[bot] avatar lvzhibai avatar mmajidi137 avatar zhengliu1119 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pandamodels.jl's Issues

develop mode issue in pandapower

` File "C:\Users\zliu\pandapower\pandapower\opf\run_powermodels.py", line 77, in _call_pandamodels
Pkg.develop("PandaModels")

RuntimeError: <PyCall.jlwrap (in a Julia function called from Python)
JULIA: package PandaModels [2dbab86a] has the same name or UUID as the active project
Stacktrace:
[1] pkgerror(msg::String)
@ Pkg.Types C:\Users\zliu\AppData\Local\Programs\Julia-1.7.0\share\julia\stdlib\v1.7\Pkg\src\Types.jl:68
[2] develop(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; shared::Bool, preserve::Pkg.Types.PreserveLevel, platform::Base.BinaryPlatforms.Platform, kwargs::Base.Pairs{Symbol, IOStream, Tuple{Symbol}, NamedTuple{(:io,), Tuple{IOStream}}})
@ Pkg.API C:\Users\zliu\AppData\Local\Programs\Julia-1.7.0\share\julia\stdlib\v1.7\Pkg\src\API.jl:208
[3] develop(pkgs::Vector{Pkg.Types.PackageSpec}; io::IOStream, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Pkg.API C:\Users\zliu\AppData\Local\Programs\Julia-1.7.0\share\julia\stdlib\v1.7\Pkg\src\API.jl:149
[4] develop(pkgs::Vector{Pkg.Types.PackageSpec})
@ Pkg.API C:\Users\zliu\AppData\Local\Programs\Julia-1.7.0\share\julia\stdlib\v1.7\Pkg\src\API.jl:144
[5] #develop#15
@ C:\Users\zliu\AppData\Local\Programs\Julia-1.7.0\share\julia\stdlib\v1.7\Pkg\src\API.jl:142 [inlined]
[6] develop
@ C:\Users\zliu\AppData\Local\Programs\Julia-1.7.0\share\julia\stdlib\v1.7\Pkg\src\API.jl:142 [inlined]
[7] #develop#14
@ C:\Users\zliu\AppData\Local\Programs\Julia-1.7.0\share\julia\stdlib\v1.7\Pkg\src\API.jl:141 [inlined]
[8] develop(pkg::String)
@ Pkg.API C:\Users\zliu\AppData\Local\Programs\Julia-1.7.0\share\julia\stdlib\v1.7\Pkg\src\API.jl:141
[9] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Base .\essentials.jl:716
[10] invokelatest(::Any, ::Any, ::Vararg{Any})
@ Base .\essentials.jl:714
[11] pyjlwrap_call(f::Function, args::Ptr{PyCall.PyObject_struct}, kw_::Ptr{PyCall.PyObject_struct})
@ PyCall C:\Users\zliu.julia\packages\PyCall\3fwVL\src\callback.jl:28
[12] pyjlwrap_call(self_::Ptr{PyCall.PyObject_struct}, args_::Ptr{PyCall.PyObject_struct}, kw_::Ptr{PyCall.PyObject_struct})
@ PyCall C:\Users\zliu.julia\packages\PyCall\3fwVL\src\callback.jl:44>`

tried gurobi solver for opf - error at the start

Hi! I have installed Gurobi as an additional solver according to the instructions provided in https://pandapower.readthedocs.io/en/develop/opf/powermodels.html#additional-solvers.

When trying to perform the first basic test 'pp.runpm_ac_opf(net, pm_model="ACPPowerModel", pm_solver="gurobi")', I get the following error:

**_File "C:\Users...l\AppData\Local\Temp\ipykernel_1508\1602319788.py", line 1, in <cell line: 1>
pp.runpm_ac_opf(net, pm_model="ACPPowerModel", pm_solver="gurobi")

File "C:\Users...\development\work_env_spyder\lib\site-packages\pandapower\runpm.py", line 134, in runpm_ac_opf
_runpm(net, delete_buffer_file=delete_buffer_file, pm_file_path=pm_file_path, pdm_dev_mode=pdm_dev_mode)

File "C:\Users...\development\work_env_spyder\lib\site-packages\pandapower\opf\run_powermodels.py", line 34, in _runpm
result_pm = _call_pandamodels(buffer_file, net._options["julia_file"], pdm_dev_mode)

File "C:\Users...\development\work_env_spyder\lib\site-packages\pandapower\opf\run_powermodels.py", line 88, in _call_pandamodels
result_pm = Main.eval(julia_file + "(buffer_file)")

File "C:\Users...\development\work_env_spyder\lib\site-packages\julia\core.py", line 621, in eval
ans = self._call(src)

File "C:\Users...\development\work_env_spyder\lib\site-packages\julia\core.py", line 549, in _call
self.check_exception(src)

File "C:\Users...\development\work_env_spyder\lib\site-packages\julia\core.py", line 603, in check_exception
raise JuliaError(u'Exception '{}' occurred while calling julia code:\n{}'

JuliaError: Exception 'UndefVarError: Gurobi not defined' occurred while calling julia code:
run_powermodels_opf(buffer_file)_**

Thanks in advance for the help!

Running issue with Mac and Linux

Hi,

I ran the example (semi-definite relaxation of AC-OPF) on my Mac (M2) and Linux Mint (Ubuntu 20.04), respectively. However, I got the same running problem.

The version of python, julia, pyjulia, and pandapwer are listed as follows:
Python==3.10
Julia==1.6.7
Pyjulia==0.6.1
Pandapower==2.13.2

I can make sure that the PATH of julia and python interpreter are set correctly. My python script name is pandamodel_test.py, where I have the following codes:

import pandapower as pp
import pandapower.networks as nw
net = nw.example_simple()
pp.runpm(net, pm_model="SDPWRMPowerModel", pm_solver="ipopt", pm_nl_solver="juniper")

I first ran $python pandamodel_test.py. However, the log information says "Currently, PyJulia does not fully
support such Python interpreter" and suggests me to use the command $python-jl PATH/TO/YOUR/SCRIPT.py. I followed its suggestion and run $python-jl pandamodel_test.py. Then, I got the error.

The log history is shown as follows:

(base) myName@myName-MacBook-Air pandapowerVVO % python pandamodel_test.py  
no costs are given - overall generated power is minimized
Traceback (most recent call last):
  File "/Users/myName/PycharmProjects/pandapowerVVO/pandamodel_test.py", line 5, in <module>
    pp.runpm(net, pm_model="SDPWRMPowerModel", pm_solver="ipopt", pm_nl_solver="juniper")
  File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/pandapower/runpm.py", line 103, in runpm
    _runpm(net, delete_buffer_file=delete_buffer_file, pm_file_path=pm_file_path, pdm_dev_mode=pdm_dev_mode)
  File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/pandapower/opf/run_pandamodels.py", line 35, in _runpm
    result_pm = _call_pandamodels(buffer_file, net._options["julia_file"], pdm_dev_mode)
  File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/pandapower/opf/run_pandamodels.py", line 58, in _call_pandamodels
    from julia import Main
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 672, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 632, in _load_backward_compatible
  File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/julia/core.py", line 247, in load_module
    JuliaMainModule(self, fullname))
  File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/julia/core.py", line 149, in __init__
    self._julia = loader.julia
  File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/julia/core.py", line 239, in julia
    self.__class__.julia = julia = Julia()
  File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/julia/core.py", line 489, in __init__
    raise UnsupportedPythonError(jlinfo)
julia.core.UnsupportedPythonError: It seems your Julia and PyJulia setup are not supported.

Julia executable:
    julia
Python interpreter and libpython used by PyCall.jl:
    /Users/myName/.julia/conda/3/x86_64/bin/python
    /Users/myName/.julia/conda/3/x86_64/lib/libpython3.10.dylib
Python interpreter used to import PyJulia and its libpython.
    /Users/myName/.julia/conda/3/x86_64/bin/python
    /Users/myName/.julia/conda/3/x86_64/lib/libpython3.10.dylib

Your Python interpreter "/Users/myName/.julia/conda/3/x86_64/bin/python"
is statically linked to libpython.  Currently, PyJulia does not fully
support such Python interpreter.

The easiest workaround is to pass `compiled_modules=False` to `Julia`
constructor.  To do so, first *reboot* your Python REPL (if this happened
inside an interactive session) and then evaluate:

    >>> from julia.api import Julia
    >>> jl = Julia(compiled_modules=False)

Another workaround is to run your Python script with `python-jl`
command bundled in PyJulia.  You can simply do:

    $ python-jl PATH/TO/YOUR/SCRIPT.py

See `python-jl --help` for more information.

For more information, see:

    https://pyjulia.readthedocs.io/en/latest/troubleshooting.html


(base) myName@myName-MacBook-Air pandapowerVVO % python-jl pandamodel_test.py
no costs are given - overall generated power is minimized
[info | PowerModels]: Suppressing information and warning messages for the rest of this session.  Use the Memento package for more fine-grained control of logging.
Traceback (most recent call last):
  File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/julia/pseudo_python_cli.py", line 308, in main
    python(**vars(ns))
  File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/julia/pseudo_python_cli.py", line 59, in python
    scope = runpy.run_path(script, run_name="__main__")
  File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/runpy.py", line 289, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/runpy.py", line 96, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "pandamodel_test.py", line 5, in <module>
    pp.runpm(net, pm_model="SDPWRMPowerModel", pm_solver="ipopt", pm_nl_solver="juniper")
  File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/pandapower/runpm.py", line 103, in runpm
    _runpm(net, delete_buffer_file=delete_buffer_file, pm_file_path=pm_file_path, pdm_dev_mode=pdm_dev_mode)
  File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/pandapower/opf/run_pandamodels.py", line 35, in _runpm
    result_pm = _call_pandamodels(buffer_file, net._options["julia_file"], pdm_dev_mode)
  File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/pandapower/opf/run_pandamodels.py", line 99, in _call_pandamodels
    result_pm = Main.eval(julia_file + "(buffer_file)")
  File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/julia/core.py", line 627, in eval
    ans = self._call(src)
  File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/julia/core.py", line 555, in _call
    self.check_exception(src)
  File "/Users/myName/.julia/conda/3/x86_64/lib/python3.10/site-packages/julia/core.py", line 609, in check_exception
    raise JuliaError(u'Exception \'{}\' occurred while calling julia code:\n{}'
julia.core.JuliaError: Exception 'MathOptInterface.UnsupportedConstraint{MathOptInterface.VectorAffineFunction{Float64}, MathOptInterface.SecondOrderCone}: `MathOptInterface.VectorAffineFunction{Float64}`-in-`MathOptInterface.SecondOrderCone` constraint is not supported by the model.' occurred while calling julia code:
run_powermodels_opf(buffer_file)

I wish I can get you feedback since I have been strugelling in this issue for some days. I also wish to get your suggestion for the version of python, julia, pyjulia, and pandapwer, which you used in your devlopment.

Thank you!

Problem with installing Panda Power

Hello everyone,

I struggle to install PandaModels. I followed the instructions available. I think julia should be installed correctly since ] test PowerModels works. Whenever I try to run code in Spyder I get a windows fatal error. I tried to reinstall and looked for solutions, but wasn't successful. I would appreciate any ideas on how to solve the issue.

import julia.PowerModels

Windows fatal exception: code 0xc0000139

Main thread:
Current thread 0x00000178 (most recent call first):
File "C:\Users\koica07\anaconda3\Lib\site-packages\julia\libjulia.py", line 332 in init_julia
File "C:\Users\koica07\anaconda3\Lib\site-packages\julia\core.py", line 497 in init
File "C:\Users\koica07\anaconda3\Lib\site-packages\julia\core.py", line 242 in julia
File "C:\Users\koica07\anaconda3\Lib\site-packages\julia\core.py", line 254 in create_module
File "", line 573 in module_from_spec
File "", line 676 in _load_unlocked
File "", line 1147 in _find_and_load_unlocked
File "", line 1176 in _find_and_load
File "C:\Users\koica07\AppData\Local\Temp\ipykernel_19700\1033055077.py", line 1 in

Edit: sorry I just realized I wrote Panda Power in the title, it should be PandaModels of course.
Also import julia works fine, but everything with pandamodels leads to the error. I already checked that the path variable leads to the julia directory. Also earlier I got an error like this:
"could not load library "libcurl-4.dll
after rebuilding the pycall package and making sure that this file is linked in the system variable PATH this part of the error did not appear anymore.

[Security] Workflow documentation.yaml is using vulnerable action actions/checkout

The workflow documentation.yaml is referencing action actions/checkout using references v1. However this reference is missing the commit a6747255bd19d7a757dbdda8c654a9f84db19839 which may contain fix to the some vulnerability.
The vulnerability fix that is missing by actions version could be related to:
(1) CVE fix
(2) upgrade of vulnerable dependency
(3) fix to secret leak and others.
Please consider to update the reference to the action.

tag v0.6.0

added code and test for storage optimization

PowerModels minimum version too low

The minimum version specifier for the dependency PowerModels in Project.toml is too low (v0.18).

Problem Description

With v0.19.2, PowerModels introduced a breaking API change and renamed functions starting with run_* to solve_*. See this PowerModels Issue and Pull Request. And also the difference between v0.19.1 and v0.19.2 Here.

This change was correctly incorporated in PandaModels. See e.g. 9e5069e. However, the minimum required version did not update accordingly and allows PowerModels offering the old convention of run_*.

Solution

As a solution idea, the Project.toml should list something like PowerModels = ">= 0.19.2"

OPF marginal prices

Discussed in #106

Originally posted by Toelloev February 15, 2023
Hi!
When I'm running optimal power flow with pandapower in python using PandaModels, marginal prices are not retrieved.

Running pp.runpm_ac_opf(net) on the example network from the tutorial (https://github.com/e2nIEE/pandapower/blob/develop/tutorials/pandamodels_opf.ipynb), lam_p and lam_q in net.res_bus are assigned a value of 0.

Using the pypower tool, pp.runopp(net), on the same network, we get the same results, but the marginal prices are included in net.res_bus:

image

Can marginal price retrieval be included in PandaModels?

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

pytest collector

@lvzhibai @friederikemeier inorder to run pandapower test in PdM test,the pytest reports only in the kernel, we need to collect the number of failed tests from the pandapower test. How could it possible to get the number of failures from pytest?

using Test
using PyCall
using PandaModels
py"""
from pandapower import pp_dir
import os
import pytest
test_dir=os.path.join(pp_dir, "test")
sta = pytest.main([test_dir])
"""
@testset "PandaModels.jl" begin
   status = py"sta.value"
   @test status == 0
end

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.