Beispiel #1
0
def test_excel():
    net_in = create_test_network()
    net_in.line_geodata.loc[0, "coords"] = [(1.1, 2.2), (3.3, 4.4)]
    net_in.line_geodata.loc[1, "coords"] = [(5.5, 5.5), (6.6, 6.6), (7.7, 7.7)]
    pp.to_excel(net_in, "testfile.xlsx")
    net_out = pp.from_excel("testfile.xlsx")
    assert_net_equal(net_in, net_out)
    os.remove('testfile.xlsx')
 def mainSaveClicked(self):
     #filename = QFileDialog.getOpenFileName()
     filename = QFileDialog.getSaveFileName(self, 'Save net')
     print(filename[0])
     try:
         pp.to_excel(self.net, filename[0])
         self.mainPrintMessage("Saved case to: " + filename[0])
     except:
         self.mainPrintMessage("Case not saved, maybe empty?")
Beispiel #3
0
def test_excel(net_in, tempdir):
    filename = os.path.join(tempdir, "testfile.xlsx")
    pp.to_excel(net_in, filename)
    net_out = pp.from_excel(filename)
    assert_net_equal(net_in, net_out)

    pp.set_user_pf_options(net_in, tolerance_kva=1e3)
    pp.to_excel(net_in, filename)
    net_out = pp.from_excel(filename)
    assert_net_equal(net_in, net_out)
    assert net_out.user_pf_options == net_in.user_pf_options
Beispiel #4
0
def test_excel(net_in, tmp_path):
    filename = os.path.abspath(str(tmp_path)) + "testfile.xlsx"
    pp.to_excel(net_in, filename)
    net_out = pp.from_excel(filename)
    assert_net_equal(net_in, net_out)

    # test in user_pf_options are equal
    pp.set_user_pf_options(net_in, tolerance_mva=1e3)
    pp.to_excel(net_in, filename)
    net_out = pp.from_excel(filename)
    assert_net_equal(net_in, net_out)
    assert net_out.user_pf_options == net_in.user_pf_options
Beispiel #5
0
def test_excel(net_in, tempdir):
    filename = os.path.join(tempdir, "testfile.xlsx")
    pp.to_excel(net_in, filename)
    net_out = pp.from_excel(filename)
    assert_net_equal(net_in, net_out)
Beispiel #6
0
        
        lc = pplotly.create_line_trace(net,lines=None, color="blue", 
#                                       infofunc= net.line.name.astype(str) + '<br>'
#                                       + '110.0 kV')
        
        tc = pplotly.create_trafo_trace(net,net.trafo.index,width=5,color="pink")
        
        pplotly.draw_traces(bc + lc + tc, on_map = True, 
                            map_style='dark', showlegend=True, aspectratio='auto')
        
        #pf_res_plotly(net, on_map=True)
        
        
        
        
        pp.to_excel(net, filename="Aachen Net.xlsx", include_results=True)
        
        
        
end = time.time()
elapsed_time = end - start
print('Elapsed time: ' + str(elapsed_time) + ' seconds.')








Beispiel #7
0
import pandapower.networks as pn
import numpy as np
import pandapower.plotting as plot
import matplotlib.pyplot as plt
from pandapower.plotting.plotly import vlevel_plotly
import pandas as pd

net = pn.create_cigre_network_lv()
net
plot.simple_plot(net, show_plot=True)

vlevel_plotly(net)

#del net.bus_geodata
pp.convert_format(net)
pp.to_excel(net, "examplecigrelow.xlsx")

netcoords = net.bus_geodata
netcoords.to_excel('cigrecoords.xlsx')

netlv = pp.from_excel("final code/examplecigrelow.xlsx")
#lv.bus_geodata
#del netlv.bus_geodata
netlv
plot.simple_plot(netlv, show_plot=True)
vlevel_plotly(netlv)

#vlevel_plotly(net)
netlv
net
netlv.bus_geodata
pp.create_sgen(net,
               bus=Zone5Bus,
               p_mw=Zone5Gen,
               q_mvar=Zone5Gen * P2Q,
               name="Zone 5 Gen")
pp.create_sgen(net,
               bus=Zone6Bus,
               p_mw=Zone6Gen,
               q_mvar=Zone6Gen * P2Q,
               name="Zone 6 Gen")
pp.create_sgen(net,
               bus=Zone7Bus,
               p_mw=Zone7Gen,
               q_mvar=Zone7Gen * P2Q,
               name="Zone 7 Gen")
pp.create_sgen(net,
               bus=Zone8Bus,
               p_mw=Zone8Gen,
               q_mvar=Zone1Gen * P2Q,
               name="Zone 8 Gen")

pp.runpp(net)

pp.to_excel(net, 'This 7thFeb2050_Government_' + str(n) + 'planned_lines.xlsx')

# In[25]:

print(net.res_line)

# In[ ]:
Beispiel #9
0
#creating External Grid (Slack Bus)
pp.create_ext_grid(net, 0, vm_pu = 1)


##############################################
#Creating Grid connections
for i in grid.index:
   pp.create_line(net, from_bus=grid.at[i,"id1"], to_bus=grid.at[i,"id2"], length_km=1, std_type="NAYY 4x50 SE")

##############################################
#Creating Transformer
#pp.create_transformer_from_parameters(net, hv_bus=0, lv_bus=grid.at[0, "id1"], i0_percent=0.038, pfe_kw=11.6, vkr_percent=0.322, sn_mva=40, vn_lv_kv=20.0, vn_hv_kv=110.0, vk_percent=17.8)
pp.create_transformer(net, hv_bus=0, lv_bus=grid.at[0, "id1"], std_type="25 MVA 110/20 kV")


##############################################
#Creating Load
for i in SS.index:
    pp.create_load(net, SS.at[i,'id'], p_mw=0.1)


pp.runpp(net)
print(net.res_bus)
#pp.plotting.plotly.geo_data_to_latlong(net, projection='epsg:5858')
pp.plotting.plotly.mapbox_plot.set_mapbox_token('pk.eyJ1IjoibmExMjAzMTMyIiwiYSI6ImNrYW9qYThxMzFvb3cyc3A2cWJyaHdhdTMifQ.bfRDDy-DV4-VuVWjDNzodg')

simple_plotly(net)
pp.plotting.plot_voltage_profile(net)
plt.show()
pp.to_excel(net, "example2.xlsx")
pp.create_sgen(net,
               bus=Zone5Bus,
               p_mw=Zone5Gen,
               q_mvar=Zone5Gen * P2Q,
               name="Zone 5 Gen")
pp.create_sgen(net,
               bus=Zone6Bus,
               p_mw=Zone6Gen,
               q_mvar=Zone6Gen * P2Q,
               name="Zone 6 Gen")
pp.create_sgen(net,
               bus=Zone7Bus,
               p_mw=Zone7Gen,
               q_mvar=Zone7Gen * P2Q,
               name="Zone 7 Gen")
pp.create_sgen(net,
               bus=Zone8Bus,
               p_mw=Zone8Gen,
               q_mvar=Zone1Gen * P2Q,
               name="Zone 8 Gen")

pp.runpp(net)

pp.to_excel(net, '7thFeb2050_Government_' + str(n) + 'nextlevel_lines.xlsx')

# In[25]:

print(net.res_line)

# In[ ]: