def test_case30_compare_classical_wls_opt_wls(): net = nw.case30() pp.runpp(net) add_virtual_meas_from_loadflow(net) try: success = estimate(net, init='flat', algorithm="opt", estimator='wls') assert success except: # if failed give it a warm start net, ppc, eppci = pp2eppci(net) estimation_wls = WLSAlgorithm(1e-3, 3) estimation_opt = OptAlgorithm(1e-6, 1000) eppci = estimation_wls.estimate(eppci) eppci = estimation_opt.estimate(eppci, estimator="wls") assert estimation_opt.successful net = eppci2pp(net, ppc, eppci) net_wls = deepcopy(net) estimate(net_wls) assert np.allclose(net_wls.res_bus_est.vm_pu, net.res_bus_est.vm_pu, atol=1e-2) assert np.allclose(net_wls.res_bus_est.va_degree, net.res_bus_est.va_degree, atol=1e-2)
def test_case30(): net = pn.case30() assert net.converged pp.runpp(net, trafo_model='pi') assert len(net.bus) == 30 assert len(net.line) + len(net.trafo) == 41 assert len(net.ext_grid) + len(net.gen) + len(net.sgen) == 6 assert net.converged
def test_recycle_case30(): net = nw.case30() pp.runpp(net) add_virtual_meas_from_loadflow(net) se = StateEstimation(net, recycle=True) se.estimate() assert np.allclose(net.res_bus.vm_pu, net.res_bus_est.vm_pu, atol=1e-2) assert np.allclose(net.res_bus.va_degree, net.res_bus_est.va_degree, atol=5e-1) # Run SE again net.load.p_mw -= 10 pp.runpp(net) add_virtual_meas_from_loadflow(net) assert se.estimate() assert np.allclose(net.res_bus.vm_pu, net.res_bus_est.vm_pu, atol=1e-2) assert np.allclose(net.res_bus.va_degree, net.res_bus_est.va_degree, atol=1)
def test_case30_data(self): net = pn.case30() self.converter.set_sn_mva( net.sn_mva) # TODO raise an error if not set ! self.converter.set_f_hz(net.f_hz) line_r, line_x, line_h = self.converter.get_line_param( net.line["r_ohm_per_km"].values * net.line["length_km"].values, net.line["x_ohm_per_km"].values * net.line["length_km"].values, net.line["c_nf_per_km"].values * net.line["length_km"].values, net.line["g_us_per_km"].values * net.line["length_km"].values, net.bus.loc[net.line["from_bus"]]["vn_kv"], net.bus.loc[net.line["to_bus"]]["vn_kv"]) res_r = np.array([ 0.0002, 0.0005, 0., 0., 0., 0., 0., 0., 0.0012, 0.0007, 0.0009, 0.0022, 0.0006, 0.0008, 0.0011, 0.0006, 0.0003, 0.0009, 0.0003, 0.0003, 0.0007, 0.0001, 0.001, 0.0001, 0.0012, 0.0013, 0.0019, 0.0025, 0.0011, 0., 0.0022, 0.0032, 0.0024, 0.0006, 0.0005, 0.0002, 0.0006, 0.0001, 0.0005, 0.0003, 0.0001 ]) res_x = np.array([ 0.0006, 0.0019, 0.0021, 0.0056, 0.0021, 0.0011, 0.0026, 0.0014, 0.0026, 0.0013, 0.002, 0.002, 0.0017, 0.0019, 0.0022, 0.0013, 0.0007, 0.0021, 0.0008, 0.0007, 0.0015, 0.0002, 0.002, 0.0004, 0.0018, 0.0027, 0.0033, 0.0038, 0.0021, 0.004, 0.0042, 0.006, 0.0045, 0.002, 0.002, 0.0006, 0.0018, 0.0004, 0.0012, 0.0008, 0.0004 ]) res_h = np.array([ 3. + 0.j, 2. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 2. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 0. + 0.j, 2. + 0.j, 2. + 0.j, 1. + 0.j, 2. + 0.j, 0. + 0.j, 1. + 0.j, 1. + 0.j, 0. + 0.j ]) self.assert_equal(line_r, res_r) self.assert_equal(line_x, res_x) self.assert_equal(line_h, res_h)
def test_case30(): net = pn.case30() assert net.converged _ppc_element_test(net, 30, 41, 6, True)
# Copyright (c) 2020, RTE (https://www.rte-france.com) # See AUTHORS.txt # This Source Code Form is subject to the terms of the Mozilla Public License, version 2.0. # If a copy of the Mozilla Public License, version 2.0 was not distributed with this file, # you can obtain one at http://mozilla.org/MPL/2.0/. # SPDX-License-Identifier: MPL-2.0 # This file is part of PyKLU2Grid, PyKLU2Grid a implements a c++ backend targeting the Grid2Op platform. import pandapower as pp import pandapower.networks as pn grid = pn.case30() grid = pn.case118() pp.runpp(grid, numba=False)
# grid1 = pn.case9241pegase() # grid2 = pn.case9241pegase() # grid1 = pn.case1888rte() # grid2 = pn.case1888rte() # without trafo, ordering issue nor shunt, no parrallel line grid1 = pn.case5() grid2 = pn.case5() # without trafo, ordering issue, nor shunt, no parrallel line grid1 = pn.case6ww() grid2 = pn.case6ww() # # without trafo, but ordering issue and shunt, no parrallel line grid1 = pn.case30() grid2 = pn.case30() # # with trafo, ordering issue, and shunt, no parrallel line grid1 = pn.case14() grid2 = pn.case14() # # with trafo, ordering issue, and shunt, with parrallel line grid1 = pn.case118() grid2 = pn.case118() nb_iteration = 1 # number of powerflow run nb_max_newton_it = 10 # maximum number of iteration for the solver ### code begins here powerflow_time_pp = 0