Exemple #1
0
def test_case33bw():
    net = pn.case33bw()
    pp.runpp(net)
    assert len(net.bus) == 33
    assert len(net.line) + len(net.trafo) == 37
    assert len(net.ext_grid) + len(net.gen) + len(net.sgen) == 1
    assert net.converged
 def reset(self):
     """
     reset the network
     """
     self.net = pn.case33bw()
     # sort the index
     self.net.load = self.net.load.sort_index()
     self.net.line = self.net.line.sort_index()
     pass
Exemple #3
0
def test_case33bw():
    net = pn.case33bw()
    assert net.converged
    pp.runpp(net, trafo_model='pi')
    assert len(net.bus) == 33
    assert len(net.line) + len(net.trafo) == 37
    n_gen = 1
    assert len(net.ext_grid) + len(net.gen) + len(net.sgen) == n_gen
    assert len(net.polynomial_cost) == n_gen
    assert net.converged
Exemple #4
0
 def reflash_net(self):
     """
     docstring
     """
     self.prim_net = pn.case33bw()
     # set the five tie-switches "in service"
     self.prim_net.line = self.prim_net.line.sort_index()
     for i in range(32, 37):
         self.prim_net.line["in_service"][i] = True
         pass
     pass
Exemple #5
0
    def __init__(self):
        """
        Create a standard model 
        - default case = case33BW 

        """

        self.prim_net = pn.case33bw()
        # set the five tie-switches "in service"
        self.prim_net.line = self.prim_net.line.sort_index()
        for i in range(32, 37):
            self.prim_net.line["in_service"][i] = True
            pass

        pass
 def __init__(self):
     """
     create IEEE33bw standard model
     """
     self.net = pn.case33bw()
     # sort the index
     self.net.load = self.net.load.sort_index()
     self.net.line = self.net.line.sort_index()
     self.net.bus = self.net.bus.sort_index()
     self.loss_total = 0.0
     self.voltage_bias = 0.0
     self.blackout_power = 0.0
     self.penalty_voltage = 0.5
     self.reward = 0.0
     self.sum_blackout = 0.0
     self.start_time = self.make_time()
     self.env_state_cache = np.array(40)
     pass
Exemple #7
0
def test_case33bw():
    net = pn.case33bw()
    assert net.converged
    pp.runpp(net, trafo_model='pi')
    _ppc_element_test(net, 33, 37, 1, True)
def test_case33bw():
    net = pn.case33bw()
    pp.runpp(net, trafo_mode="pi")
    assert net.converged
    _ppc_element_test(net, 33, 37, 1, True)
Exemple #9
0
""" Pandapower tutorial on Colormaps.
Date: 3/June/2021
"""
import pandapower as pp
import pandapower.networks as nw
import pandapower.plotting as plot
import matplotlib.pyplot as plt

# load network case
# net = nw.mv_oberrhein()
net=nw.case33bw()
# net = nw.create_synthetic_voltage_control_lv_network(network_class='rural_1')
# run pf
pp.runpp(net)

# creating a color function to get a linear a colormap with color centers green at 30%, yellow at 50% and red at 60%
# line loading
cmap_list_lines=[(20, "green"), (50, "yellow"), (60, "red")]
cmap_lines, norm_lines = plot.cmap_continuous(cmap_list_lines)
# create a collection for colouring each line according to a line color range.
lc = plot.create_line_collection(net, net.line.index, zorder=2, cmap=cmap_lines, norm=norm_lines, linewidths=2)
# create discrete map for node pu magnitude
cmap_list_nodes=[(0.975, "blue"), (1.0, "green"), (1.03, "red")]
cmap_nodes, norm_nodes = plot.cmap_continuous(cmap_list_nodes)
bc = plot.create_bus_collection(net, net.bus.index, size=0.07, zorder=2, cmap=cmap_nodes, norm=norm_nodes) #80 of mv obherreim and 0.07 for ieee
# tlc, tpc = plot.create_trafo_collection(net, net.trafo.index, color="g")
sc = plot.create_bus_collection(net, net.ext_grid.bus.values, patch_type="rect", size=.08, color="y", zorder=11)
# plot.draw_collections([lc, bc, sc], figsize=(8,6))
# plt.show()

net_generic = nw.case33bw()
def Load_Net_Pandapower(data_file, pp_case=None):
    # data_file -> File name which contains network data, if file name is none by default is load the CIGRE model
    if data_file == None:
        import pandapower.networks as pn

        if pp_case == None:
            net = pn.create_cigre_network_mv(with_der=False)
        elif pp_case == 'case33bw':
            net = pn.case33bw()

            load_name = []
            s_val = []
            for index, row in net.load.iterrows():
                load_name.append('load_' + str(row.bus))
                s_val.append(math.sqrt(row.p_mw**2 + row.q_mvar**2))

            net.load.name = load_name
            net.load.sn_mva = load_name

            line_name = []
            for index, row in net.line.iterrows():
                line_name.append('line_' + str(row.from_bus) + '_' +
                                 str(row.to_bus))

            net.line.name = line_name

        #index = net.switch.loc[net.switch['name'] == 'S1'].index[0]
        #net.switch.closed[index] = True                             # Is assumed that switch is closed by defaut
    else:
        # Import network data using excel
        data = pd.read_excel(open(data_file, 'rb'), sheet_name='DATA')
        # Create Network
        net = pp.create_empty_network(name=data.loc[0, 'Name'],
                                      f_hz=data.loc[0, 'f'],
                                      sn_mva=data.loc[0, 'sb_mva'])
        # # # # # # # # # # # # # # # # # # Load elements # # # # # # # # # # #
        # Buses
        net.bus = pd.read_excel(open(data_file, 'rb'), sheet_name='BUS')
        # Lines
        net.line = pd.read_excel(open(data_file, 'rb'), sheet_name='LINE')
        # Load
        net.load = pd.read_excel(open(data_file, 'rb'), sheet_name='LOAD')

        # External grid
        df = pd.read_excel(open(data_file, 'rb'), sheet_name='EXT_GRID')
        if not df.empty:
            net.ext_grid = df
        # Generators
        df = pd.read_excel(open(data_file, 'rb'), sheet_name='GEN')
        if not df.empty:
            net.gen = df
        # Static generators
        df = pd.read_excel(open(data_file, 'rb'), sheet_name='SGEN')
        if not df.empty:
            net.sgen = df
        # Transformers
        df = pd.read_excel(open(data_file, 'rb'), sheet_name='TRAFO')
        if not df.empty:
            net.trafo = df

        # 3 winding transformer
        df = pd.read_excel(open(data_file, 'rb'), sheet_name='TRAFO3W')
        if not df.empty:
            net.trafo3w = df

        # SWITCHES
        df = pd.read_excel(open(data_file, 'rb'), sheet_name='SWITCH')
        if not df.empty:
            net.switch = df

        # Shunt element
        df = pd.read_excel(open(data_file, 'rb'), sheet_name='SHUNT')
        if not df.empty:
            net.shunt = df
    # Return network
    return (net)