Skip to content

Commit

Permalink
fix some CI issues
Browse files Browse the repository at this point in the history
  • Loading branch information
BDonnot committed Apr 2, 2024
1 parent 7672689 commit 6881f2a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Change Log
--------------------
- [FIXED] CI was broken after migration to artifact v4, set it back to v3
(and make the names of the folder clearer)
- [FIXED] CI when using latest pandapower version (2.14)
- [IMPROVED] remove some compilation warnings for clang

[0.8.1] 2024-03-26
Expand Down
10 changes: 7 additions & 3 deletions lightsim2grid/tests/test_SameResPP.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,13 @@ def _aux_test(self, pn_net):
try:
baseMVA, bus, gen, branch, ref, pv, pq, on, gbus, _, refgen = _get_pf_variables_from_ppci(ppci)
except ValueError:
# change in pandapower 2.12
baseMVA, bus, gen, branch, svc, tcsc, ref, pv, pq, on, gbus, V0, ref_gens = _get_pf_variables_from_ppci(ppci)

try:
# change in pandapower 2.12
baseMVA, bus, gen, branch, svc, tcsc, ref, pv, pq, on, gbus, V0, ref_gens = _get_pf_variables_from_ppci(ppci)
except ValueError:
# change in pandapower 2.14
baseMVA, bus, gen, branch, svc, tcsc, ssc, ref, pv, pq, on, gbus, V0, ref_gens = _get_pf_variables_from_ppci(ppci)

Va0 = bus[:, VA] * (np.pi / 180.)
try:
B, Bf, Pbusinj, Pfinj = makeBdc(bus, branch)
Expand Down
4 changes: 2 additions & 2 deletions lightsim2grid/tests/test_dist_slack_jacobian.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def setUp(self) -> None:
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=FutureWarning)
self.net = pp.from_json("./dist_slack_test.json")
pp.runpp(self.net, lightsim2grid=False, numba=True, distributed_slack=True)
pp.runpp(self.net, lightsim2grid=False, numba=True, distributed_slack=True, init="flat")

def test_jacobian_dist_slack(self):
"""that's the grid described in the issue
Expand Down Expand Up @@ -52,7 +52,7 @@ def test_jacobian_single_slack(self):
"""that's the grid described in the issue
https://github.com/e2nIEE/pandapower/pull/1455
"""
pp.runpp(self.net, lightsim2grid=False, numba=True, distributed_slack=False)
pp.runpp(self.net, lightsim2grid=False, numba=True, distributed_slack=False, init="flat")
options = {"max_iteration": 10, "tolerance_mva": 1e-8, "distributed_slack": False}
V, converged, iterations, J, Vm_it, Va_it = newtonpf_new(self.net._ppc["internal"]["Ybus"],
self.net._ppc["internal"]["Sbus"],
Expand Down
8 changes: 5 additions & 3 deletions lightsim2grid/tests/test_fdpf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def get_solving_method(self):
return FDPFMethod.XB

def get_algo_pp(self):
# return "fdxb" if self.fdpf_meth == FDPFMethod.XB else "fdbx" # in theory
return "fdbx" if self.fdpf_meth == FDPFMethod.XB else "fdxb" # but.... https://github.com/e2nIEE/pandapower/issues/2142
return "fdxb" if self.fdpf_meth == FDPFMethod.XB else "fdbx" # in theory
# return "fdbx" if self.fdpf_meth == FDPFMethod.XB else "fdxb" # but.... https://github.com/e2nIEE/pandapower/issues/2142

def get_network(self):
return pn.case14()
Expand Down Expand Up @@ -82,7 +82,7 @@ def _aux_get_Bp_Bpp(self):
# convert pandapower net to ppc
ppc, ppci = _pd2ppc(self.net)
self.net["_ppc"] = ppc
baseMVA, bus, gen, branch, svc, tcsc, ref, pv, pq, *_, gbus, V0, ref_gens = _get_pf_variables_from_ppci(ppci)
baseMVA, bus, gen, branch, svc, tcsc, ssc, ref, pv, pq, on, gbus, V0, ref_gens = _get_pf_variables_from_ppci(ppci)
pp_Bp, pp_Bpp = makeB(baseMVA, bus, np.real(branch), self.alg)
return pp_Bp, pp_Bpp, pv, pq, V0

Expand Down Expand Up @@ -113,6 +113,8 @@ def test_Bp_Bpp_solver(self):
pp_Bpp = grid_Bpp[np.array([pq]).T, pq].tocsc()

# check they match
# NB: if pandapower change signature of `_get_pf_variables_from_ppci`
# you might get weird error here
assert np.abs(pp_Bp - ls_Bp).max() <= self.tol, f"error in Bp: max {np.abs(pp_Bp - ls_Bp).max():.2f}"
assert np.abs(pp_Bpp - ls_Bpp).max() <= self.tol, f"error in Bpp: max {np.abs(pp_Bpp - ls_Bpp).max():.2f}"

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@
"test": [
"grid2op>=1.6.4",
"numba",
"pandapower>=2.8.0",
"pandapower>=2.14.0", # interface changed for pandapower, not backward compatible
"packaging",
"pypowsybl"
]
Expand Down

0 comments on commit 6881f2a

Please sign in to comment.