How to use the pandapower.create_empty_network function in pandapower

To help you get started, we’ve selected a few pandapower examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github e2nIEE / pandapower / pandapower / networks / simple_pandapower_test_networks.py View on Github external
def simple_mv_open_ring_net():
    """
    This function creates a simple medium voltage open ring network with loads at every medium \
    voltage node.
    As an example this function is used in the topology and diagnostic docu.

    OUTPUT:
         **net** - Returns the required simple medium voltage open ring network

    EXAMPLE:
         import pandapower.networks as pn

         net_simple_open_ring = pn.simple_mv_open_ring_net()
    """

    net = pp.create_empty_network()

    pp.create_bus(net, name="110 kV bar", vn_kv=110, type='b')
    pp.create_bus(net, name="20 kV bar", vn_kv=20, type='b')
    pp.create_bus(net, name="bus 2", vn_kv=20, type='b')
    pp.create_bus(net, name="bus 3", vn_kv=20, type='b')
    pp.create_bus(net, name="bus 4", vn_kv=20, type='b')
    pp.create_bus(net, name="bus 5", vn_kv=20, type='b')
    pp.create_bus(net, name="bus 6", vn_kv=20, type='b')

    pp.create_ext_grid(net, 0, vm_pu=1)

    pp.create_line(net, name="line 0", from_bus=1, to_bus=2, length_km=1,
                   std_type="NA2XS2Y 1x185 RM/25 12/20 kV")
    pp.create_line(net, name="line 1", from_bus=2, to_bus=3, length_km=1,
                   std_type="NA2XS2Y 1x185 RM/25 12/20 kV")
    pp.create_line(net, name="line 2", from_bus=3, to_bus=4, length_km=1,
github PyPSA / PyPSA / test / test_pf_against_pandapower.py View on Github external
def test_pandapower_case():

    #more complicated examples like
    #net = pandapower.networks.example_simple()
    #can be used once the import of e.g. switches is perfected

    #create empty net
    net = pp.create_empty_network()

    #create buses
    b1 = pp.create_bus(net, vn_kv=20., name="Bus 1")
    b2 = pp.create_bus(net, vn_kv=0.4, name="Bus 2")
    b3 = pp.create_bus(net, vn_kv=0.4, name="Bus 3")

    #create bus elements
    pp.create_ext_grid(net, bus=b1, vm_pu=1.02, name="Grid Connection")
    pp.create_load(net, bus=b3, p_mw=0.1, q_mvar=0.05, name="Load")

    #create branch elements
    tid = pp.create_transformer(net, hv_bus=b1, lv_bus=b2, std_type="0.4 MVA 20/0.4 kV",
                                                            name="Trafo")
    pp.create_line(net, from_bus=b2, to_bus=b3, length_km=0.1, name="Line",
                                  std_type="NAYY 4x50 SE")
github e2nIEE / pandapower / pandapower / networks / simple_pandapower_test_networks.py View on Github external
def panda_four_load_branch():
    """
    This function creates a simple six bus system with four radial low voltage nodes connected to \
    a medium voltage slack bus. At every low voltage node the same load is connected.

    OUTPUT:
         **net** - Returns the required four load system

    EXAMPLE:
         import pandapower.networks as pn

         net_four_load = pn.panda_four_load_branch()
    """
    pd_net = pp.create_empty_network()

    busnr1 = pp.create_bus(pd_net, name="bus1", vn_kv=10.)
    busnr2 = pp.create_bus(pd_net, name="bus2", vn_kv=.4)
    busnr3 = pp.create_bus(pd_net, name="bus3", vn_kv=.4)
    busnr4 = pp.create_bus(pd_net, name="bus4", vn_kv=.4)
    busnr5 = pp.create_bus(pd_net, name="bus5", vn_kv=.4)
    busnr6 = pp.create_bus(pd_net, name="bus6", vn_kv=.4)

    pp.create_ext_grid(pd_net, busnr1)

    pp.create_transformer(pd_net, busnr1, busnr2, std_type="0.25 MVA 10/0.4 kV")

    pp.create_line(pd_net,  busnr2, busnr3, name="line1", length_km=0.05,
                   std_type="NAYY 4x120 SE")
    pp.create_line(pd_net, busnr3, busnr4, name="line2", length_km=0.05,
                   std_type="NAYY 4x120 SE")
github e2nIEE / pandapower / pandapower / networks / create_examples.py View on Github external
def example_multivoltage():
    """
    Returns the multivoltage example network from the pandapower tutorials.

    OUTPUT:
        net - multivoltage example network

    EXAMPLE:

    >>> import pandapower.networks
    >>> net = pandapower.networks.example_multivoltage()

    """
    net = pp.create_empty_network()

    # --- Busses

    # HV
    # Double busbar
    pp.create_bus(net, name='Double Busbar 1', vn_kv=380, type='b')
    pp.create_bus(net, name='Double Busbar 2', vn_kv=380, type='b')

    for i in range(10):
        pp.create_bus(net, name='Bus DB T%s' % i, vn_kv=380, type='n')

    for i in range(1, 5):
        pp.create_bus(net, name='Bus DB %s' % i, vn_kv=380, type='n')

    # Single busbar
    pp.create_bus(net, name='Single Busbar', vn_kv=110, type='b')
github e2nIEE / simbench / simbench / converter / csv_pp_converter.py View on Github external
"vkr_hv_percent", "vkr_mv_percent", "vkr_lv_percent",
                    "pfe_kw", "i0_percent", "shift_mv_degree", "shift_lv_degree"],
        "dcline": ["p_mw", "loss_percent", "loss_mw", "vm_from_pu", "vm_to_pu"]}
    for elm in type_params.keys():
        elms_without_type = net[elm][pd.isnull(net[elm].std_type)]
        uni_dupl_dict = get_unique_duplicated_dict(elms_without_type, subset=type_params[elm])
        for uni, dupl in uni_dupl_dict.items():
            new_typename = net[elm].name.loc[uni] + '_type'
            net[elm].std_type.loc[[uni]+dupl] = new_typename
            if elm in ["line", "trafo", "trafo3w"]:
                pp.create_std_type(net, dict(net[elm].loc[uni, type_params[elm]].T), new_typename,
                                   element=elm, overwrite=False)

    # --- determine line, trafo and trafo3w typenames to be converted,
    # --- considering export_pp_std_types. changes net.std_types dicts into dataframes
    dummy_net = pp.create_empty_network()
    pp_elms_with_type = ["line", "trafo", "trafo3w"]
    for elm in pp_elms_with_type:
        if export_pp_std_types:
            typenames2convert = set(net.std_types[elm].keys())
        else:
            pp_typenames = set(dummy_net.std_types[elm].keys())
            unused_pp_typenames = pp_typenames - set(net[elm].std_type.unique())
            typenames2convert = set(net.std_types[elm].keys()) - unused_pp_typenames
        net.std_types[elm] = pd.DataFrame(net.std_types[elm]).T.loc[typenames2convert].reset_index()
        net.std_types[elm].rename(columns={"index": "std_type"}, inplace=True)

    convert_line_type_acronym(net)
github e2nIEE / pandapower / doc / getting_started / pandapower_3bus_system.py View on Github external
# -*- coding: utf-8 -*-

# Copyright (c) 2016 by University of Kassel and Fraunhofer Institute for Wind Energy and Energy
# System Technology (IWES), Kassel. All rights reserved. Use of this source code is governed by a 
# BSD-style license that can be found in the LICENSE file.

import pandapower as pp
import pandas as pd
pd.set_option('display.width', 1500)
pd.set_option('display.precision', 4)

#initialize datastructure
net = pp.create_empty_network()

#create_buses
b1 = pp.create_bus(net, vn_kv=20., name="Bus 1")
b2 = pp.create_bus(net, vn_kv=0.4, name="Bus 2")
b3 = pp.create_bus(net, vn_kv=0.4, name="Bus 3")

#create slack
pp.create_ext_grid(net, bus=b1, vm_pu=1.02, name="Grid Connection")

#create_load
pp.create_load(net, bus=b3, p_kw=100, q_kvar=50, name="Load")

tid = pp.create_transformer(net, hv_bus=b1, lv_bus=b2, std_type="0.4 MVA 20/0.4 kV")
#tid = pp.create_transformer_from_parameters(net,
#                                            hv_bus=b1,
#                                            lv_bus=b2,
github e2nIEE / pandapower / pandapower / networks / dickert_lv_networks.py View on Github external
**trafo_type_data** (dict, None) - if 'trafo_type_name' is not in pandapower standard \
            types, the data of this new trafo types must be given here in pandapower trafo type way

    OUTPUT:

        **net** (pandapowerNet) - Returns the required dickert lv network

    EXAMPLE:

        import pandapower.networks as pn

        net = pn.create_dickert_lv_network()
    """
    # --- create network
    net = pp.create_empty_network(name='dickert_lv_network with' + feeders_range +
                                  '-range feeders, ' + linetype + 'and ' + customer +
                                  'customers in ' + case + 'case')
    # assumptions
    mv_vn_kv = 20
    lv_vn_kv = 0.4

    # create mv connection
    mv_bus = pp.create_bus(net, mv_vn_kv, name='mv bus')
    busbar_index = pp.create_bus(net, lv_vn_kv, name='busbar')
    pp.create_ext_grid(net, mv_bus)
    if trafo_type_name not in net.std_types['trafo'].keys():
        pp.create_std_type(net, trafo_type_data, name=trafo_type_name, element="trafo")
    pp.create_transformer(net, mv_bus, busbar_index, std_type=trafo_type_name)

    # create feeders
    create_dickert_lv_feeders(net=net, busbar_index=busbar_index, feeders_range=feeders_range,
github e2nIEE / pandapower / doc / std_types / save_pp_std_types.py View on Github external
# -*- coding: utf-8 -*-
"""
Created on Fri Jul  1 13:40:07 2016

@author: thurner
"""
import pandapower as pp

net = pp.create_empty_network()

linetypes = pp.available_std_types(net, "line")
columns = [c for c in net.line.columns if c in linetypes.columns] + ["q_mm2", "alpha"]
linetypes = linetypes.reindex(columns, axis=1)
linetypes.to_csv("linetypes.csv", sep=";")

trafotypes = pp.available_std_types(net, "trafo")
trafotypes = trafotypes.reindex([c for c in net.trafo.columns if c in trafotypes.columns], axis=1)
trafotypes.to_csv("trafotypes.csv", sep=";")

trafo3wtypes = pp.available_std_types(net, "trafo3w")
trafo3wtypes = trafo3wtypes.reindex([c for c in net.trafo3w.columns if c in trafo3wtypes.columns], axis=1)
trafo3wtypes.to_csv("trafo3wtypes.csv", sep=";")
github e2nIEE / pandapower / pandapower / networks / kerber_networks.py View on Github external
def _create_empty_network_with_transformer(trafotype, V_OS=10., V_US=0.4):
    """
    Creates a Network with transformer and infeeder. The reference bus on the \
    high-voltage side is called "Trafostation_OS". The bus on the low-voltage \
    side is called "main_busbar".
    The voltage levels can be set manually and the transformer parameter can \
    be set with "ti"
    """
    pd_net = pp.create_empty_network()
    NFA2X4x70 = {"c_nf_per_km": 0, "r_ohm_per_km": 0.443, "x_ohm_per_km": 0.069, "max_i_ka": 0.270,
                 "type": "ol", "q_mm2": 70}
    NAYY4x50 = {"c_nf_per_km": 670, "r_ohm_per_km": 0.6417, "x_ohm_per_km": 0.084823,
                "max_i_ka": 0.141, "type": "cs", "q_mm2": 50}
    NAYY4x150 = {"c_nf_per_km": 830, "r_ohm_per_km": 0.2067, "x_ohm_per_km": 0.08042478,
                 "max_i_ka": 0.275, "type": "cs", "q_mm2": 150}
    NAYY4x185 = {"c_nf_per_km": 830, "r_ohm_per_km": 0.165, "x_ohm_per_km": 0.08042478,
                 "max_i_ka": 0.313, "type": "cs", "q_mm2": 185}
    NYY4x35 = {"c_nf_per_km": 0, "r_ohm_per_km": 0.5240284, "x_ohm_per_km": 0.08513716,
               "max_i_ka": 0.156, "type": "cs", "q_mm2": 35}
    pp.create_std_type(net=pd_net, data=NFA2X4x70, name="NFA2X 4x70", element="line")
    pp.create_std_type(net=pd_net, data=NAYY4x50, name="NAYY 4x50", element="line")
    pp.create_std_type(net=pd_net, data=NAYY4x150, name="NAYY 4x150", element="line")
    pp.create_std_type(net=pd_net, data=NAYY4x185, name="NAYY 4x185", element="line")
    pp.create_std_type(net=pd_net, data=NYY4x35, name="NYY 4x35", element="line")
    T100kVA = {"sn_mva": 0.100, "vn_hv_kv": 10, "vn_lv_kv": 0.4, "vk_percent": 4,
github e2nIEE / pandapower / pandapower / networks / random_pandapower_networks.py View on Github external
**p** (float) - probability that the currently created bus is connected to any of the already created \
             buses and not to the last created bus

    RETURN:

         **net** - Returns the random empyt grid

    EXAMPLE:

         import pandapower.networks as pn

         net = pn.networksrandom_empty_grid(5, 0)
    """
    linetypes = ["NAYY 4x120 SE", "NAYY 4x150 SE", "NA2XS2Y 1x95 RM/25 12/20 kV"]
    net = pp.create_empty_network()
    cb = pp.create_bus(net, name="slack", vn_kv=20.)
    pp.create_ext_grid(net, cb)
    for i in list(range(num_buses)):
        bidx = pp.create_bus(net, name="bus %s" % (i+1), vn_kv=20)
        pp.create_line(net, cb, bidx, random.uniform(0.1, 2.),
                       name="line %s" % i, std_type=random.choice(linetypes))
        cb = bidx if random.random() > p or i == 0 else random.randint(0, i)
    return net