def mv_oberrhein(scenario="load", cosphi_load=0.98, cosphi_pv=1.0, include_substations=False): """ Loads the Oberrhein network, a generic 20 kV network serviced by two 25 MVA HV/MV transformer stations. The network supplies 141 HV/MV substations and 6 MV loads through four MV feeders. The network layout is meshed, but the network is operated as a radial network with 6 open sectioning points. The network can be loaded with two different worst case scenarios for load and generation, which are defined by scaling factors for loads / generators as well as tap positions of the HV/MV transformers. These worst case scenarios are a good starting point for working with this network, but you are of course free to parametrize the network for your use case. The network also includes geographical information of lines and buses for plotting. OPTIONAL: **scenario** - (str, "load"): defines the scaling for load and generation - "load": high load scenario, load = 0.6 / sgen = 0, trafo taps [-2, -3] - "generation": high feed-in scenario: load = 0.1, generation = 0.8, trafo taps [0, 0] **cosphi_load** - (str, 0.98): cosine(phi) of the loads **cosphi_sgen** - (str, 1.0): cosine(phi) of the static generators **include_substations** - (bool, False): if True, the transformers of the MV/LV level are modelled, otherwise the loads representing the LV networks are connected directly to the MV node RETURN: **net** - pandapower network EXAMPLE: >>> import pandapower.networks >>> net = pandapower.networks.mv_oberrhein("generation") """ if include_substations: net = pp.from_pickle(os.path.join(_get_networks_path(), "mv_oberrhein_substations.p")) else: net = pp.from_pickle(os.path.join(_get_networks_path(), "mv_oberrhein.p")) net.load.q_kvar = np.tan(np.arccos(cosphi_load)) * net.load.p_kw net.sgen.q_kvar = np.tan(np.arccos(cosphi_pv)) * net.sgen.p_kw hv_trafos = net.trafo[net.trafo.sn_kva > 1e3].index if scenario == "load": net.load.scaling = 0.6 net.sgen.scaling = 0 net.trafo.tp_pos.loc[hv_trafos] = [-2, -3] elif scenario == "generation": net.load.scaling = 0.1 net.sgen.scaling = 0.8 net.trafo.tp_pos.loc[hv_trafos] = [0, 0] else: raise ValueError("Unknown scenario %s - chose 'load' or 'generation'"%scenario) pp.runpp(net) return net
def create_test_network2(): """Creates a simple pandapower test network """ net = pp.from_pickle(os.path.join(pp.pp_dir, "test", "loadflow", "testgrid.p")) # net = pp.file_io.from_pickle("testgrid.p") return net
def init(self, currentCommunicationPoint): """ Initialize the FMU (definition of input/output variables and parameters, enforce step size). """ ### SAVE START TIME self._t_start = currentCommunicationPoint ### LOAD PANDAPOWER NETWORK FROM FILE ### for file in os.listdir(os.getcwd()): # search for first file with ending '.p' if file.endswith('.p'): self.net = pp.from_pickle(file) # load net from pickle file if not hasattr(self, 'net'): raise RuntimeError('Loading pandapower network from file failed') ### DEFINE INPUTS OF FMU ### self._initialize_fmi_inputs() ### LOADING PROFILES ### self._load_profiles() ### RUN INITIAL POWERFLOW ### pp.runpp(self.net) # run one powerflow to initialize the results dataframes used by the next powerflow as init ### WRITE HEADER TO RESULT FILE ### df_results = get_pp_results(self.net, 0.0).iloc[ 0:0] # create empty dataframe for results with valid column names df_results.to_csv(self.net.result_file)
def printPFResults(fname,v): net = pp.from_pickle(fname) #print net pp.runpp(net) #print("\nBus Flows\n-----------------\n") busflow = net.res_bus #print (net.res_bus) #print("\nLine Flows\n----------------\n") lineflows = net.res_line #print (net.res_line) #print("\nLoad Measurements\n------------------\n") loadmeasures = net.res_load #print (net.res_load) #os.system("mkdir Output") f = open('Output/output.txt','w') net.res_load.to_csv(f,sep=' ', index=False, header=False) if v == 1: print("\nBus Flows\n-----------------\n") print (net.res_bus) print("\nLine Flows\n----------------\n") print (net.res_line) print("\nLoad Measurements\n------------------\n") print (net.res_load) return net.res_load
def printPFResults(fname): xyz = pp.from_pickle(fname) #print xyz pp.runpp(xyz) print("\nBus Flows\n-----------------\n") print xyz.res_bus print("\nLine Flows\n----------------\n") print xyz.res_line print("\nLoad Measurements\n------------------\n") #print xyz.res_load print xyz.line.index try: import seaborn colors = seaborn.color_palette() except: colors = ["b", "g", "r", "c", "y"] #plot.fuse_geodata(xyz) #plot.simple_plot(xyz, bus_size=0.7) cmap_list = [(20, "green"), (50, "yellow"), (60, "red")] cmap, norm = plot.cmap_continous(cmap_list) plot.create_generic_coordinates(xyz, respect_switches=True) lc = plot.create_line_collection(xyz, xyz.line.index, zorder=1, cmap=cmap, norm=norm, linewidths=2) plot.draw_collections([lc], figsize=(8, 6))
def case6515rte(ref_bus_idx=6171): """ This case accurately represents the size and complexity of French very high voltage and high \ voltage transmission network. The data is provided by `MATPOWER \ <http://www.pserc.cornell.edu/matpower/>`_. The data origin is the paper `C. Josz, S. Fliscounakis, J. Maenght, P. Panciatici, AC power \ flow data in MATPOWER and QCQP format: iTesla, RTE snapshots, and PEGASE \ <https://arxiv.org/abs/1603.01533>`_, 2016. OPTIONAL: **ref_bus_idx** - Since the MATPOWER case provides a reference bus without connected \ generator, because a distributed slack is assumed, to convert the data to pandapower, \ another bus has been assumed as reference bus. Via 'ref_bus_idx' the User can choose a \ reference bus, which should have a generator connected to. Please be aware that by \ changing the reference bus to another bus than the proposed default value, maybe a \ powerflow does not converge anymore! OUTPUT: **net** - Returns the required ieee network case6515rte EXAMPLE: import pandapower.networks as pn net = pn.case6515rte() """ case6515rte = pp.from_pickle( os.path.join(_get_cases_path(), "case6515rte.p")) if ref_bus_idx != 6171: # change reference bus _change_ref_bus(case6515rte, ref_bus_idx, ext_grid_p=-2850.78e3) return case6515rte
def create_test_network2(): """Creates a simple pandapower test network """ folder = os.path.abspath(os.path.dirname(pandapower.test.__file__)) net = pp.from_pickle(os.path.join(folder, "loadflow", "testgrid.p")) # net = pp.file_io.from_pickle("testgrid.p") return net
def create_test_network2(): """Creates a simple pandapower test network """ net = pp.from_pickle( os.path.abspath(os.path.dirname(pandapower.test.__file__)) + "\\testgrid.p") # net = pp.file_io.from_pickle("testgrid.p") return net
def test_trafo_asym(): nw_dir = os.path.abspath(os.path.join(pp.pp_dir, "test/loadflow")) for trafo_vector_group in ["YNyn", "Dyn", "Yzn"]: net = pp.from_pickle(nw_dir + '/runpp_3ph Validation.p') net['trafo'].vector_group = trafo_vector_group runpp_3ph_with_consistency_checks(net) assert net['converged'] check_results(net, trafo_vector_group, get_PF_Results(trafo_vector_group))
def meshed_grid(): net = pp.from_pickle( os.path.join(pp.pp_dir, "test", "shortcircuit", "sc_test_meshed_grid.p")) bid = pp.create_bus(net, vn_kv=10.) pp.create_switch(net, net.ext_grid.bus.iloc[0], bid, et="b") net.ext_grid.bus.iloc[0] = bid pp.create_bus(net, vn_kv=0.4, in_service=False) return net
def meshed_grid(): folder = os.path.abspath(os.path.dirname(pp.__file__)) net = pp.from_pickle( os.path.join(folder, "test", "shortcircuit", "sc_test_meshed_grid.p")) bid = pp.create_bus(net, vn_kv=10.) pp.create_switch(net, net.ext_grid.bus.iloc[0], bid, et="b") net.ext_grid.bus.iloc[0] = bid pp.create_bus(net, vn_kv=0.4, in_service=False) return net
def get_testgrids(name, filename): """ This function return the ppc (or pp net) which is saved in ppc_testgrids.p to validate the from_ppc function via validate_from_ppc. """ pp_path = pp_path = os.path.split(pp.__file__)[0] folder = os.path.join(pp_path, 'test', 'converter') if name == "case2_2_by_code": return pp.from_pickle(os.path.join(folder, name + ".p")) else: ppcs = pickle.load(open(os.path.join(folder, filename), "rb")) return ppcs[name]
def deploiement_EV_freqreg(net, dic_param_trajets, profil_mob, dic_nblois, dic_tranchlois, dic_parklois, dic_dureelois, dic_retourdom, df_freq, taux_penet=0.30, p_evse_mw=0.01, k_flotte=False): try: if k_flotte == True: raise UserWarning("") net_flotte = pp.from_pickle( os.path.join("construction_reseau", "data", "flotte.p")) net.storage = net_flotte.storage.copy() for control in net_flotte.controller.iterrows(): control[1].controller.net = net net_flotte.controller['name'] = net_flotte.controller.controller.apply( lambda x: str(x)) net.controller = pd.concat([ net.controller, net_flotte.controller[ net_flotte.controller.name.str.contains('EV')].drop(['name'], axis=1) ], ignore_index=True) except UserWarning: print("Calcul de la flotte...") nb_ev_fin = 0 for x in net.load.itertuples(): bus = x[2] p_noeud = x[3] nb_ev_max = int(p_noeud / 0.02) for i in range(nb_ev_max): if rand() <= taux_penet: per = init_personne(dic_param_trajets, profil_mob, dic_nblois, dic_tranchlois, dic_parklois, dic_dureelois, dic_retourdom) if rand() <= 0.2: def_EV_QReg(net, bus, per.creer_df(), per) else: def_EV(net, bus, pd.concat([per.creer_df(), df_freq], axis=1), per) nb_ev_fin += 1 pp.to_pickle(net, os.path.join("construction_reseau", "data", "flotte.p")) print(nb_ev_fin)
def case3120sp(): """ This case represents the Polish 400, 220 and 110 kV networks during summer 2008 morning peak conditions. The data was provided by Roman Korab <*****@*****.**> and to pandapower converted from `MATPOWER <http://www.pserc.cornell.edu/matpower/>`_. OUTPUT: **net** - Returns the required ieee network case3120sp EXAMPLE: import pandapower.networks as pn net = pn.case3120sp() """ case3120sp = pp.from_pickle(os.path.join(_get_cases_path(), "case3120sp.p")) return case3120sp
def case6ww(): """ Calls the pickle file case6ww.p which data origin is `PYPOWER <https:/pypi.python.org/pypi/PYPOWER>`_. OUTPUT: **net** - Returns the required ieee network case6ww EXAMPLE: import pandapower.networks as pn net = pn.case6ww() """ case6ww = pp.from_pickle(os.path.join(_get_cases_path(), "case6ww.p")) return case6ww
def case6ww(): """ Calls the pickle file case6ww.p which data origin is `PYPOWER <https:/pypi.python.org/pypi/PYPOWER>`_. It represents the 6 bus example from pp. 104, 112, 119, 123-124, 549 from A. J. Wood and B. F. Wollenberg, Power generation, operation, and control. John Wiley & Sons, 2012.. OUTPUT: **net** - Returns the required ieee network case6ww EXAMPLE: import pandapower.networks as pn net = pn.case6ww() """ case6ww = pp.from_pickle(os.path.join(_get_cases_path(), "case6ww.p")) return case6ww
def case4gs(): """ This is the 4 bus example from J. J. Grainger and W. D. Stevenson, Power system analysis. McGraw-Hill, 1994. pp. 337-338. Its data origin is `PYPOWER <https:/pypi.python.org/pypi/PYPOWER>`_. OUTPUT: **net** - Returns the required ieee network case4gs EXAMPLE: import pandapower.networks as pn net = pn.case4gs() """ case4gs = pp.from_pickle(os.path.join(_get_cases_path(), "case4gs.p")) return case4gs
def case9241pegase(): """ This grid represents a part of the European high voltage transmission network. The data is provided by `MATPOWER <http://www.pserc.cornell.edu/matpower/>`_. The data origin are the paper `C. Josz, S. Fliscounakis, J. Maenght, P. Panciatici, AC power flow data in MATPOWER and QCQP format: iTesla, RTE snapshots, and PEGASE <https://arxiv.org/abs/1603.01533>`_, 2016 and S. Fliscounakis, P. Panciatici, F. Capitanescu, and L. Wehenkel, Contingency ranking with respect to overloads in very large power systems taking into account uncertainty, preventive, and corrective actions, IEEE Transactions on Power Systems, vol. 28, no. 4, pp. 4909-4917, Nov 2013.. OUTPUT: **net** - Returns the required ieee network case9241pegase EXAMPLE: import pandapower.networks as pn net = pn.case9241pegase() """ case9241pegase = pp.from_pickle(os.path.join(_get_cases_path(), "case9241pegase.p")) return case9241pegase
def GBnetwork(): """ Calls the pickle file GBnetwork.p which data is provided by `W. A. Bukhsh, Ken McKinnon, Network data of real transmission networks, April 2013 <http://www.maths.ed.ac.uk/optenergy/NetworkData/fullGB/>`_. This data represents detailed model of electricity transmission network of Great Britian (GB). It consists of 2224 nodes, 3207 branches and 394 generators. This data is obtained from publically available data on National grid website. The data was originally pointing out by Manolis Belivanis, University of Strathclyde. OUTPUT: **net** - Returns the required ieee network GBreducednetwork EXAMPLE: import pandapower.networks as pn net = pn.GBnetwork() """ GBnetwork = pp.from_pickle(os.path.join(_get_cases_path(), "GBnetwork.p")) return GBnetwork
def iceland(): """ Calls the pickle file iceland.p which data is provided by `W. A. Bukhsh, Ken McKinnon, Network data of real transmission networks, April 2013 <http://www.maths.ed.ac.uk/optenergy/NetworkData/iceland/>`_. This data represents electricity transmission network of Iceland. It consists of 118 nodes, 206 branches and 35 generators. It was originally developed in PSAT format by Patrick McNabb, Durham University in January 2011. OUTPUT: **net** - Returns the required ieee network iceland EXAMPLE: import pandapower.networks as pn net = pn.iceland() """ iceland = pp.from_pickle(os.path.join(_get_cases_path(), "iceland.p")) return iceland
def case33bw(): """ Calls the pickle file case33bw.p which data is provided by `MATPOWER <http://www.pserc.cornell.edu/matpower/>`_. The data origin is the paper `M. Baran, F. Wu, Network reconfiguration in distribution systems for loss reduction and load balancing <http://ieeexplore.ieee.org/document/25627/>`_ IEEE Transactions on Power Delivery, 1989. OUTPUT: **net** - Returns the required ieee network case33bw EXAMPLE: import pandapower.networks as pn net = pn.case33bw() """ case33bw = pp.from_pickle(os.path.join(_get_cases_path(), "case33bw.p")) return case33bw
def case145(): """ Calls the pickle file case145.p which data origin is `MATPOWER <http://www.pserc.cornell.edu/matpower/>`_. This data is converted by MATPOWER 5.1 using CDF2MPC on 18-May-2016 from 'dd50cdf.txt'. OUTPUT: **net** - Returns the required ieee network case145 EXAMPLE: import pandapower.networks as pn net = pn.case145() """ case145 = pp.from_pickle(os.path.join(_get_cases_path(), "case145.p")) return case145
def case300(): """ Calls the pickle file case300.p which data origin is `PYPOWER <https:/pypi.python.org/pypi/PYPOWER>`_. Some more information about this network are given by `Washington case 300 <http://www2.ee.washington.edu/research/pstca/pf300/pg_tca300bus.htm>`_ and `Illinois University case 300 <http://icseg.iti.illinois.edu/ieee-300-bus-system/>`_. OUTPUT: **net** - Returns the required ieee network case300 EXAMPLE: import pandapower.networks as pn net = pn.case300() """ case300 = pp.from_pickle(os.path.join(_get_cases_path(), "case300.p")) return case300
def case9(): """ Calls the pickle file case9.p which data origin is `PYPOWER <https:/pypi.python.org/pypi/PYPOWER>`_. This network was published in Anderson and Fouad's book 'Power System Control and Stability' for the first time in 1980. OUTPUT: **net** - Returns the required ieee network case9 EXAMPLE: import pandapower.networks as pn net = pn.case9() """ case9 = pp.from_pickle(os.path.join(_get_cases_path(), "case9.p")) return case9
def case39(): """ Calls the pickle file case39.p which data origin is `PYPOWER <https:/pypi.python.org/pypi/PYPOWER>`_. Some more information about this network are given by `Illinois University case 39 <http://icseg.iti.illinois.edu/ieee-39-bus-system/>`_. Because the Pypower data origin proposes vn_kv=345 for all nodes the transformers connect node of the same voltage level. OUTPUT: **net** - Returns the required ieee network case39 EXAMPLE: import pandapower.networks as pn net = pn.case39() """ case39 = pp.from_pickle(os.path.join(_get_cases_path(), "case39.p")) return case39
def case24_ieee_rts(): """ Calls the pickle file case24_ieee_rts.p which data origin is `PYPOWER <https:/pypi.python.org/pypi/PYPOWER>`_. Some more information about this network are given by `Illinois University case 24 <http://icseg.iti.illinois.edu/ieee-24-bus-system/>`_. OUTPUT: **net** - Returns the required ieee network case24 EXAMPLE: import pandapower.networks as pn net = pn.case24_ieee_rts() """ case24 = pp.from_pickle( os.path.join(_get_cases_path(), "case24_ieee_rts.p")) return case24
def case39(): """ Calls the pickle file case39.p which data origin is `PYPOWER <https:/pypi.python.org/pypi/PYPOWER>`_. This network was published the first time in G. Bills et al., On-line stability analysis study, RP 90-1, E. P. R. I. North American Rockwell Corporation, Edison Electric Institute, Ed. IEEE Press, Oct. 1970,. Some more information about this network are given by `Illinois University case 39 <http://icseg.iti.illinois.edu/ieee-39-bus-system/>`_. Because the Pypower data origin proposes vn_kv=345 for all nodes the transformers connect node of the same voltage level. OUTPUT: **net** - Returns the required ieee network case39 EXAMPLE: import pandapower.networks as pn net = pn.case39() """ case39 = pp.from_pickle(os.path.join(_get_cases_path(), "case39.p")) return case39
def GBreducednetwork(): """ Calls the pickle file GBreducednetwork.p which data is provided by `W. A. Bukhsh, Ken McKinnon, Network data of real transmission networks, April 2013 <http://www.maths.ed.ac.uk/optenergy/NetworkData/reducedGB/>`_. This data is a representative model of electricity transmission network in Great Britain (GB). It was originally developed at the University of Strathclyde in 2010. OUTPUT: **net** - Returns the required ieee network GBreducednetwork EXAMPLE: import pandapower.networks as pn net = pn.GBreducednetwork() """ GBreducednetwork = pp.from_pickle(os.path.join(_get_cases_path(), "GBreducednetwork.p")) return GBreducednetwork
def case9241pegase(): """ Calls the pickle file case33bw.p which data is provided by `MATPOWER <http://www.pserc.cornell.edu/matpower/>`_. The data origin is the paper `C. Josz, S. Fliscounakis, J. Maenght, P. Panciatici, AC power flow data in MATPOWER and QCQP format: iTesla, RTE snapshots, and PEGASE <https://arxiv.org/abs/1603.01533>`_, 2016. OUTPUT: **net** - Returns the required ieee network case9241pegase EXAMPLE: import pandapower.networks as pn net = pn.case9241pegase() """ case9241pegase = pp.from_pickle( os.path.join(_get_cases_path(), "case9241pegase.p")) return case9241pegase
def case6ww(generator_nodes_as_pv=False): """ Calls the pickle file case6ww.p which data origin is `PYPOWER <https:/pypi.python.org/pypi/PYPOWER>`_. RETURN: **net** - Returns the required ieee network case6ww EXAMPLE: import pandapower.networks as pn net = pn.case6ww() """ case6ww = pp.from_pickle( os.path.join(_get_networks_path(), "ieee_case_pickles", "case6ww.p")) return case6ww