def create_case14_PV_Wind_Storage():
    """
    creates IEEE 14 node network fitted for providing cranking power to 
    islanded areas i.e. storage units are treated as slack nodes
    
    Return
    ------
    pp IEEE 14 node network
    """

    net = nw.case14()
    for gen in net.gen.index:
        net["gen"].drop(gen, inplace=True)

    net["shunt"].drop(0, inplace=True)

    pp.create_storage(net, 2, p_mw=-10, max_e_mwh=10, soc_percent=1)
    pp.create_gen(net, 2, p_mw=0, slack=True, type="bat")

    pp.create_storage(net, 12, p_mw=-10, max_e_mwh=10, soc_percent=1)
    pp.create_gen(net, 12, p_mw=0, slack=True, type="bat")

    pp.create_sgen(net, 7, p_mw=200, type="solar")
    pp.create_sgen(net, 10, p_mw=200, type="solar")

    pp.create_sgen(net, 11, p_mw=200, type="wind")
    pp.create_sgen(net, 13, p_mw=200, type="wind")

    return net
Exemplo n.º 2
0
def test_pmu_case14():
    net = nw.case14()

    pp.runpp(net)
    add_virtual_pmu_meas_from_loadflow(net)

    run_se_lp_verify(net)
Exemplo n.º 3
0
class MyTestCase(unittest.TestCase):
    def setUp(self) -> None:
        self.tol = 1e-4  # results are equal if they match up to tol

    def test_case14(self):
        case = pn.case14()
        self._aux_test(case)
def test_case14():
    net = pn.case14()
    assert net.converged
    pp.runpp(net, trafo_model='pi')
    assert len(net.bus) == 14
    assert len(net.line) + len(net.trafo) == 20
    assert len(net.ext_grid) + len(net.gen) + len(net.sgen) == 5
    assert net.converged
Exemplo n.º 5
0
def test_irwls_shgm():
    net = nw.case14()
    pp.runpp(net)
    add_virtual_meas_from_loadflow(net, p_std_dev=0.01, q_std_dev=0.01)
    success = estimate(net, algorithm="irwls", estimator="shgm",
                       a=3, maximum_iterations=50)
    assert success
    assert np.allclose(net.res_bus.vm_pu, net.res_bus_est.vm_pu, 1e-2)
    assert np.allclose(net.res_bus.va_degree, net.res_bus_est.va_degree, 1e-2)
Exemplo n.º 6
0
def test_lp_lav():
    net = nw.case14()
    pp.runpp(net)
    add_virtual_meas_from_loadflow(net, p_std_dev=0.01, q_std_dev=0.01)

    estimate(net, algorithm="lp")

    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-2)
Exemplo n.º 7
0
def test_pmu_case14():
    net = nw.case14()

    pp.runpp(net)
    add_virtual_pmu_meas_from_loadflow(net)

    estimate(net, algorithm="lp", maximum_iterations=20)

    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=1e-1)
Exemplo n.º 8
0
def test_irwls_comp_wls():
    # it should be the same since wls will not update weight matrix
    net = nw.case14()
    pp.runpp(net)
    add_virtual_meas_from_loadflow(net)

    success = estimate(net, init='flat', algorithm="irwls", estimator='wls')
    assert success

    net_wls = deepcopy(net)
    estimate(net_wls)
    assert np.allclose(net_wls.res_bus_est.vm_pu, net.res_bus_est.vm_pu, 1e-6)
    assert np.allclose(net_wls.res_bus_est.va_degree, net.res_bus_est.va_degree, 1e-6)
Exemplo n.º 9
0
def test_shgm_ps():
    # we need an random eppci object to initialize estimator
    net = nw.case14()
    pp.runpp(net)
    add_virtual_meas_from_loadflow(net)
    _, _, eppci = pp2eppci(net)

    # Using the example from Mili's paper
    H = np.array([[10, -10], [1, 0], [-1, 0], [0, -1], [0, 1], [11, -10],
                  [-1, -1]])
    estm = SHGMEstimatorIRWLS(eppci, a=3)
    ps_estm = estm._ps(H)
    assert np.allclose(ps_estm,
                       np.array([8.39, 0.84, 0.84, 0.84, 0.84, 8.82, 1.68]),
                       atol=0.005)
Exemplo n.º 10
0
    def __init__(self, system: str, tap_step=0.00625) -> None:

        self.system = system

        if system == "14":
            from pandapower.networks import case14

            self.network = case14()
        elif system == "30":
            from pandapower.networks import case_ieee30

            self.network = case_ieee30()
        elif system == "57":
            from pandapower.networks import case57

            self.network = case57()

        self.tap_step = tap_step
        self.get_network_parameters()

        return
Exemplo n.º 11
0
def test_case14():
    net = pn.case14()
    assert net.converged
    _ppc_element_test(net, 14, 20, 5, True)
Exemplo n.º 12
0
import numpy as np
import time
import copy
import pandapower as pp
from pandapower.networks import case14, case_ieee30
import matplotlib.pyplot as plt

rede = case14()
pp.runpp(rede, algorithm='nr', numba=True)
'''--------------------------------------------- Funções auxiliares ---------------------------------------------------'''


def discreto_superior(vetor_x, lista_discretos):
    '''
    Função que retorna o valor discreto superior de 'lista_discretos' mais próximo de todos os valores x de 'vetor_x' 

    Inputs:
        -> vetor_x = vetor (numpy array) contendo os valores que deseja-se obter o número discreto mais próximos
        -> lista_discretos = lista (python list) que contém o conjunto de valores discretos que cada variável x admite
    
    Ouputs:
        -> x_sup = vetor (numpy array) contendo os valores discretos superiores de 'lista_discretos' mais próximo 
           dos valores de 'vetor_x'
    '''
    #Vetor de saída da função. Possui o mesmo formato (shape) que vetor_x
    x_sup = np.zeros(vetor_x.shape)

    #Cópia de 'vetor_x'. Esta cópia é feita para evitar erros de alocamento dinâmico de memória.
    vetor = np.copy(vetor_x)

    #Garante que a lista seja uma array numpy e armazena o resultado na variável 'lista'
Exemplo n.º 13
0
case_name = "/home/benjamin/data_grid2op/l2rpn_case14_sandbox/grid.json"
nb_sub = 14

# local files
# case_name = "test_case6495rte.json"
# nb_sub = 6495
# case_name = "test_case2848rte.json"
# nb_sub = 2848
# case_name = "test_case118.json"
# nb_sub = 118
# case_name = "test_case14.json"
# nb_sub = 14
tol = 1e-4  # results are equal if they match up to tol

good_working_case = pn.case118()
good_working_case = pn.case14()

#### test if it works
print(f"Basic check for {case_name}")
real_init_file = pp.from_json(case_name)
backend = LightSimBackend()
backend.load_grid(case_name)
pp_net = backend.init_pp_backend._grid
# first i deactivate all slack bus in pp that are connected but not handled in ls
pp_net.ext_grid["in_service"].loc[:] = False
pp_net.ext_grid["in_service"].iloc[0] = True
conv = backend.runpf()
conv_pp = backend.init_pp_backend.runpf()

if not conv_pp:
    print(
Exemplo n.º 14
0
# 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
powerflow_time_cpp = 0
sucees_cpp = False
sucees_pp = False
timers_cpp = np.zeros(7)