print("These are the top most disruptive lines(by amount excess):") print(data.nlargest(3, ['total_excess_load'])) print("\nThese are the top most disruptive lines(by number of failures):") print(data.nlargest(3, ['failures'])) worst_1 = (data.nlargest(3, ['failures'])).iat[0,0] worst_2 = (data.nlargest(3, ['failures'])).iat[1,0] worst_3 = (data.nlargest(3, ['failures'])).iat[2,0] print(f"Therefore, the most disruptive line, by number of failures, is the line of index number {worst_1}") print(f"Whilst the second most disruptive is {worst_2}") print(f"And the third most disruptive is {worst_3}") #============= PRINTING MAP OF LINES WITH NAMES net = pn.GBreducednetwork() i = 1 while i < (((len(net.line.index))-1)+1): net.line.at[i, 'name'] = i net.line.at[i, 'std_type'] = i i += 1 pp.runpp(net) pf_res_plotly(net) #============= print("Program finished successfully")
infofunc=net.bus.name + '<br>' + net.bus.vn_kv.astype(str) + ' kV') bc_busbar = pplotly.create_bus_trace(net, busbar_id, size=8, color="red", infofunc=net.bus.name + '<br>' + net.bus.vn_kv.astype(str) + ' kV') bc = bc_gen + bc_ext_grid + bc_trafo + bc_busbar #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 + tc, on_map = True, # map_style='dark', showlegend=True, aspectratio='auto') pplotly.pf_res_plotly(bc + tc, on_map=True, map_style='dark', aspectratio='auto') #pp.to_excel(net, filename="Aachen Net.xlsx", include_results=True) end = time.time() elapsed_time = end - start print('Time elapsed: ' + elapsed_time)