From: ARNER Kevin Date: Tue, 19 Mar 2019 09:45:54 +0000 (+0100) Subject: PSSE_PF_Eficas OK X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d768e55bb1ee63d6584de6d79e20c746b84fd769;p=tools%2Feficas.git PSSE_PF_Eficas OK --- diff --git a/InterfaceQT4/editor.py b/InterfaceQT4/editor.py index 1959b08b..14457437 100755 --- a/InterfaceQT4/editor.py +++ b/InterfaceQT4/editor.py @@ -260,7 +260,8 @@ class JDCEditor(Ui_baseWidget,QWidget): self.saveFile() # lancement avec le .bat - path1 = os.path.abspath(os.path.join(os.path.abspath(__file__), '../', '../', 'PSEN_Eficas', 'PSEN')) + # path1 = os.path.abspath(os.path.join(os.path.abspath(__file__), '../', '../', 'PSEN_Eficas', 'PSEN')) + path1 = os.path.abspath(os.path.join(os.path.abspath(__file__), '../', '../', 'PSSE_PF_Eficas', 'PSEN')) filer = open('temp.txt', 'r') _path = [] for line in filer: diff --git a/InterfaceQT4/qtEficas.py b/InterfaceQT4/qtEficas.py index 2c84c375..69ba0d24 100755 --- a/InterfaceQT4/qtEficas.py +++ b/InterfaceQT4/qtEficas.py @@ -73,8 +73,10 @@ class Appli(Ui_Eficas,QMainWindow): self.ficRecents={} self.mesScripts={} self.listeAEnlever=[] - self.ListePathCode=['Adao','ADAO','Carmel3D','Telemac','CF','MAP','ZCracks', 'SEP','SPECA','PSEN_Eficas','PSEN_N1'] - self.listeCode=['Adao','ADAO','Carmel3D','Telemac','CF','MAP','ZCracks', 'SEP','SPECA','PSEN_Eficas','PSEN_N1'] + # self.ListePathCode=['Adao','ADAO','Carmel3D','Telemac','CF','MAP','ZCracks', 'SEP','SPECA','PSEN_Eficas','PSEN_N1'] + # self.listeCode=['Adao','ADAO','Carmel3D','Telemac','CF','MAP','ZCracks', 'SEP','SPECA','PSEN_Eficas','PSEN_N1'] + self.ListePathCode=['Adao','ADAO','Carmel3D','Telemac','CF','MAP','ZCracks', 'SEP','SPECA','PSSE_PF_Eficas','PSEN_N1'] + self.listeCode=['Adao','ADAO','Carmel3D','Telemac','CF','MAP','ZCracks', 'SEP','SPECA','PSSE_PF_Eficas','PSEN_N1'] self.repIcon=os.path.join( os.path.dirname(os.path.abspath(__file__)),'..','Editeur','icons') diff --git a/PSSE_PF_Eficas/PSEN/PSENconfig.py b/PSSE_PF_Eficas/PSEN/PSENconfig.py index 24aee8d7..33668a85 100644 --- a/PSSE_PF_Eficas/PSEN/PSENconfig.py +++ b/PSSE_PF_Eficas/PSEN/PSENconfig.py @@ -1,7 +1,7 @@ -MachineDico = {'WIND30__Gr1': {'PMIN': 0.0, 'EXNAME': 'WIND30 30.000', 'NAME': 'WIND30', 'NUMBER': 18, 'QMAX': 0.0, 'Q': 0.0, 'P': 20.0, 'QMIN': 0.0, 'ID': '1 ', 'PMAX': 20.0}, 'NDIESELG1__Gr1': {'PMIN': 0.0, 'EXNAME': 'NDIESELG1 11.000', 'NAME': 'NDIESELG1', 'NUMBER': 6, 'QMAX': 10.235971450805664, 'Q': 0.14257816970348358, 'P': 10.647665023803711, 'QMIN': -7.048243522644043, 'ID': '1 ', 'PMAX': 17.100000381469727}, 'HYDRO30__Gr1': {'PMIN': 0.0, 'EXNAME': 'HYDRO30 30.000', 'NAME': 'HYDRO30', 'NUMBER': 16, 'QMAX': 24.0, 'Q': 0.0001832990237744525, 'P': 40.0, 'QMIN': 0.0, 'ID': '1 ', 'PMAX': 40.0}, 'SOLAR30__Gr1': {'PMIN': 0.0, 'EXNAME': 'SOLAR30 30.000', 'NAME': 'SOLAR30', 'NUMBER': 19, 'QMAX': 0.0, 'Q': 0.0, 'P': 15.000000953674316, 'QMIN': 0.0, 'ID': '1 ', 'PMAX': 15.000000953674316}, 'NDIESELG3__Gr1': {'PMIN': 0.0, 'EXNAME': 'NDIESELG3 11.000', 'NAME': 'NDIESELG3', 'NUMBER': 8, 'QMAX': 10.235971450805664, 'Q': 0.14257816970348358, 'P': 10.647665023803711, 'QMIN': -7.048243522644043, 'ID': '1 ', 'PMAX': 17.100000381469727}, 'NDIESELG2__Gr1': {'PMIN': 0.0, 'EXNAME': 'NDIESELG2 11.000', 'NAME': 'NDIESELG2', 'NUMBER': 7, 'QMAX': 10.235971450805664, 'Q': 0.14257816970348358, 'P': 10.647665023803711, 'QMIN': -7.048243522644043, 'ID': '1 ', 'PMAX': 17.100000381469727}, 'NDIESELG4__Gr1': {'PMIN': 0.0, 'EXNAME': 'NDIESELG4 11.000', 'NAME': 'NDIESELG4', 'NUMBER': 9, 'QMAX': 10.235971450805664, 'Q': 0.14257816970348358, 'P': 10.647665023803711, 'QMIN': -7.048243522644043, 'ID': '1 ', 'PMAX': 17.100000381469727}, 'ODIESELG2__Gr1': {'PMIN': 0.0, 'EXNAME': 'ODIESELG2 11.000', 'NAME': 'ODIESELG2', 'NUMBER': 2, 'QMAX': 8.220000267028809, 'Q': 3.820113182067871, 'P': 4.771888484356168e-07, 'QMIN': -6.849999904632568, 'ID': '1 ', 'PMAX': 13.699999809265137}, 'ODIESELG4__Gr1': {'PMIN': 0.0, 'EXNAME': 'ODIESELG4 11.000', 'NAME': 'ODIESELG4', 'NUMBER': 4, 'QMAX': 8.220000267028809, 'Q': 3.820113182067871, 'P': 4.771888484356168e-07, 'QMIN': -6.849999904632568, 'ID': '1 ', 'PMAX': 13.699999809265137}, 'ODIESELG3__Gr1': {'PMIN': 0.0, 'EXNAME': 'ODIESELG3 11.000', 'NAME': 'ODIESELG3', 'NUMBER': 3, 'QMAX': 8.220000267028809, 'Q': 3.820113182067871, 'P': 4.771888484356168e-07, 'QMIN': -6.849999904632568, 'ID': '1 ', 'PMAX': 13.699999809265137}, 'ODIESELG1__Gr1': {'PMIN': 0.0, 'EXNAME': 'ODIESELG1 11.000', 'NAME': 'ODIESELG1', 'NUMBER': 1, 'QMAX': 8.220000267028809, 'Q': 3.8200631141662598, 'P': 4.771888484356168e-07, 'QMIN': -6.849999904632568, 'ID': '1 ', 'PMAX': 13.699999809265137}} -LoadDico = {'ODIESEL__Lo1': {'EXNAME': 'ODIESEL 30.000', 'NAME': 'ODIESEL', 'NUMBER': 5, 'Q': 14.5, 'P': 30.000001907348633, 'ID': '1 '}, 'CITYB30__Lo1': {'EXNAME': 'CITYB30 30.000', 'NAME': 'CITYB30', 'NUMBER': 12, 'Q': 24.5, 'P': 50.0, 'ID': '1 '}, 'CITYD30__Lo1': {'EXNAME': 'CITYD30 30.000', 'NAME': 'CITYD30', 'NUMBER': 15, 'Q': 7.25, 'P': 15.000000953674316, 'ID': '1 '}, 'CITYC30__Lo1': {'EXNAME': 'CITYC30 30.000', 'NAME': 'CITYC30', 'NUMBER': 14, 'Q': 9.75, 'P': 20.0, 'ID': '1 '}} -LineDico = {'NDIESEL__HYDRO90__Li1': {'TONAME': 'HYDRO90', 'FROMNUMBER': 10, 'FROMEXNAME': 'NDIESEL 90.000', 'FROMNAME': 'NDIESEL', 'TOEXNAME': 'HYDRO90 90.000', 'TONUMBER': 17, 'ID': '1 '}, 'CITYC90__SOLAR90__Li1': {'TONAME': 'SOLAR90', 'FROMNUMBER': 13, 'FROMEXNAME': 'CITYC90 90.000', 'FROMNAME': 'CITYC90', 'TOEXNAME': 'SOLAR90 90.000', 'TONUMBER': 20, 'ID': '1 '}, 'NDIESEL__CITYB90__Li1': {'TONAME': 'CITYB90', 'FROMNUMBER': 10, 'FROMEXNAME': 'NDIESEL 90.000', 'FROMNAME': 'NDIESEL', 'TOEXNAME': 'CITYB90 90.000', 'TONUMBER': 11, 'ID': '1 '}, 'NDIESEL__CITYB90__Li2': {'TONAME': 'CITYB90', 'FROMNUMBER': 10, 'FROMEXNAME': 'NDIESEL 90.000', 'FROMNAME': 'NDIESEL', 'TOEXNAME': 'CITYB90 90.000', 'TONUMBER': 11, 'ID': '2 '}, 'CITYC90__HYDRO90__Li1': {'TONAME': 'HYDRO90', 'FROMNUMBER': 13, 'FROMEXNAME': 'CITYC90 90.000', 'FROMNAME': 'CITYC90', 'TOEXNAME': 'HYDRO90 90.000', 'TONUMBER': 17, 'ID': '1 '}, 'ODIESEL__JUNCTION30__Li1': {'TONAME': 'JUNCTION30', 'FROMNUMBER': 5, 'FROMEXNAME': 'ODIESEL 30.000', 'FROMNAME': 'ODIESEL', 'TOEXNAME': 'JUNCTION30 30.000', 'TONUMBER': 21, 'ID': '1 '}, 'CITYB90__CITYC90__Li1': {'TONAME': 'CITYC90', 'FROMNUMBER': 11, 'FROMEXNAME': 'CITYB90 90.000', 'FROMNAME': 'CITYB90', 'TOEXNAME': 'CITYC90 90.000', 'TONUMBER': 13, 'ID': '1 '}, 'WIND30__JUNCTION30__Li1': {'TONAME': 'JUNCTION30', 'FROMNUMBER': 18, 'FROMEXNAME': 'WIND30 30.000', 'FROMNAME': 'WIND30', 'TOEXNAME': 'JUNCTION30 30.000', 'TONUMBER': 21, 'ID': '1 '}, 'CITYD30__JUNCTION30__Li1': {'TONAME': 'JUNCTION30', 'FROMNUMBER': 15, 'FROMEXNAME': 'CITYD30 30.000', 'FROMNAME': 'CITYD30', 'TOEXNAME': 'JUNCTION30 30.000', 'TONUMBER': 21, 'ID': '1 '}, 'HYDRO90__SOLAR90__Li1': {'TONAME': 'SOLAR90', 'FROMNUMBER': 17, 'FROMEXNAME': 'HYDRO90 90.000', 'FROMNAME': 'HYDRO90', 'TOEXNAME': 'SOLAR90 90.000', 'TONUMBER': 20, 'ID': '1 '}, 'CITYD30__SOLAR30__Li1': {'TONAME': 'SOLAR30', 'FROMNUMBER': 15, 'FROMEXNAME': 'CITYD30 30.000', 'FROMNAME': 'CITYD30', 'TOEXNAME': 'SOLAR30 30.000', 'TONUMBER': 19, 'ID': '1 '}, 'HYDRO30__WIND30__Li2': {'TONAME': 'WIND30', 'FROMNUMBER': 16, 'FROMEXNAME': 'HYDRO30 30.000', 'FROMNAME': 'HYDRO30', 'TOEXNAME': 'WIND30 30.000', 'TONUMBER': 18, 'ID': '2 '}, 'HYDRO30__WIND30__Li1': {'TONAME': 'WIND30', 'FROMNUMBER': 16, 'FROMEXNAME': 'HYDRO30 30.000', 'FROMNAME': 'HYDRO30', 'TOEXNAME': 'WIND30 30.000', 'TONUMBER': 18, 'ID': '1 '}} -TransfoDico = {'ODIESELG2__ODIESEL__Tr1': {'TONAME': 'ODIESEL', 'FROMNUMBER': 2, '#WIND': 2, 'FROMEXNAME': 'ODIESELG2 11.000', 'FROMNAME': 'ODIESELG2', 'TOEXNAME': 'ODIESEL 30.000', 'TONUMBER': 5, 'ID': '1 '}, 'NDIESELG3__NDIESEL__Tr1': {'TONAME': 'NDIESEL', 'FROMNUMBER': 8, '#WIND': 2, 'FROMEXNAME': 'NDIESELG3 11.000', 'FROMNAME': 'NDIESELG3', 'TOEXNAME': 'NDIESEL 90.000', 'TONUMBER': 10, 'ID': '1 '}, 'ODIESEL__NDIESEL__Tr1': {'TONAME': 'NDIESEL', 'FROMNUMBER': 5, '#WIND': 2, 'FROMEXNAME': 'ODIESEL 30.000', 'FROMNAME': 'ODIESEL', 'TOEXNAME': 'NDIESEL 90.000', 'TONUMBER': 10, 'ID': '1 '}, 'SOLAR30__SOLAR90__Tr1': {'TONAME': 'SOLAR90', 'FROMNUMBER': 19, '#WIND': 2, 'FROMEXNAME': 'SOLAR30 30.000', 'FROMNAME': 'SOLAR30', 'TOEXNAME': 'SOLAR90 90.000', 'TONUMBER': 20, 'ID': '1 '}, 'NDIESELG2__NDIESEL__Tr1': {'TONAME': 'NDIESEL', 'FROMNUMBER': 7, '#WIND': 2, 'FROMEXNAME': 'NDIESELG2 11.000', 'FROMNAME': 'NDIESELG2', 'TOEXNAME': 'NDIESEL 90.000', 'TONUMBER': 10, 'ID': '1 '}, 'HYDRO30__HYDRO90__Tr1': {'TONAME': 'HYDRO90', 'FROMNUMBER': 16, '#WIND': 2, 'FROMEXNAME': 'HYDRO30 30.000', 'FROMNAME': 'HYDRO30', 'TOEXNAME': 'HYDRO90 90.000', 'TONUMBER': 17, 'ID': '1 '}, 'CITYC90__CITYC30__Tr1': {'TONAME': 'CITYC30', 'FROMNUMBER': 13, '#WIND': 2, 'FROMEXNAME': 'CITYC90 90.000', 'FROMNAME': 'CITYC90', 'TOEXNAME': 'CITYC30 30.000', 'TONUMBER': 14, 'ID': '1 '}, 'NDIESELG1__NDIESEL__Tr1': {'TONAME': 'NDIESEL', 'FROMNUMBER': 6, '#WIND': 2, 'FROMEXNAME': 'NDIESELG1 11.000', 'FROMNAME': 'NDIESELG1', 'TOEXNAME': 'NDIESEL 90.000', 'TONUMBER': 10, 'ID': '1 '}, 'HYDRO30__HYDRO90__Tr2': {'TONAME': 'HYDRO90', 'FROMNUMBER': 16, '#WIND': 2, 'FROMEXNAME': 'HYDRO30 30.000', 'FROMNAME': 'HYDRO30', 'TOEXNAME': 'HYDRO90 90.000', 'TONUMBER': 17, 'ID': '2 '}, 'CITYB90__CITYB30__Tr1': {'TONAME': 'CITYB30', 'FROMNUMBER': 11, '#WIND': 2, 'FROMEXNAME': 'CITYB90 90.000', 'FROMNAME': 'CITYB90', 'TOEXNAME': 'CITYB30 30.000', 'TONUMBER': 12, 'ID': '1 '}, 'CITYB90__CITYB30__Tr2': {'TONAME': 'CITYB30', 'FROMNUMBER': 11, '#WIND': 2, 'FROMEXNAME': 'CITYB90 90.000', 'FROMNAME': 'CITYB90', 'TOEXNAME': 'CITYB30 30.000', 'TONUMBER': 12, 'ID': '2 '}, 'HYDRO30__HYDRO90__Tr3': {'TONAME': 'HYDRO90', 'FROMNUMBER': 16, '#WIND': 2, 'FROMEXNAME': 'HYDRO30 30.000', 'FROMNAME': 'HYDRO30', 'TOEXNAME': 'HYDRO90 90.000', 'TONUMBER': 17, 'ID': '3 '}, 'SOLAR30__SOLAR90__Tr2': {'TONAME': 'SOLAR90', 'FROMNUMBER': 19, '#WIND': 2, 'FROMEXNAME': 'SOLAR30 30.000', 'FROMNAME': 'SOLAR30', 'TOEXNAME': 'SOLAR90 90.000', 'TONUMBER': 20, 'ID': '2 '}, 'ODIESELG3__ODIESEL__Tr1': {'TONAME': 'ODIESEL', 'FROMNUMBER': 3, '#WIND': 2, 'FROMEXNAME': 'ODIESELG3 11.000', 'FROMNAME': 'ODIESELG3', 'TOEXNAME': 'ODIESEL 30.000', 'TONUMBER': 5, 'ID': '1 '}, 'NDIESELG4__NDIESEL__Tr1': {'TONAME': 'NDIESEL', 'FROMNUMBER': 9, '#WIND': 2, 'FROMEXNAME': 'NDIESELG4 11.000', 'FROMNAME': 'NDIESELG4', 'TOEXNAME': 'NDIESEL 90.000', 'TONUMBER': 10, 'ID': '1 '}, 'ODIESELG4__ODIESEL__Tr1': {'TONAME': 'ODIESEL', 'FROMNUMBER': 4, '#WIND': 2, 'FROMEXNAME': 'ODIESELG4 11.000', 'FROMNAME': 'ODIESELG4', 'TOEXNAME': 'ODIESEL 30.000', 'TONUMBER': 5, 'ID': '1 '}, 'ODIESELG1__ODIESEL__Tr1': {'TONAME': 'ODIESEL', 'FROMNUMBER': 1, '#WIND': 2, 'FROMEXNAME': 'ODIESELG1 11.000', 'FROMNAME': 'ODIESELG1', 'TOEXNAME': 'ODIESEL 30.000', 'TONUMBER': 5, 'ID': '1 '}} +MachineDico = {'Champagne_G1_Ugen_genstat_Gr_HighDam_Champagne_G1': {'Q': 0.0, 'EXNAME': 'Champagne_G1_Ugen_66.0KV', 'NAME': 'HighDam_Champagne_G1', 'NUMBER': 26, 'QMAX': 10.200000762939453, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -7.309999942779541, 'ID': 'HighDam_Champagne_G1', 'PMAX': 13.600000381469727}, 'StLouis_Ugen_9_syn_Gr_SLPS_G9': {'Q': 0.0, 'EXNAME': 'StLouis_Ugen_9_66.0KV', 'NAME': 'SLPS_G9', 'NUMBER': 105, 'QMAX': 6.578999996185303, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -6.578999996185303, 'ID': 'SLPS_G9', 'PMAX': 13.770000457763672}, 'Sarako_22kV_genstat_Gr_PV_Sarako': {'Q': 0.0, 'EXNAME': 'Sarako_22kV_66.0KV', 'NAME': 'PV_Sarako', 'NUMBER': 91, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Sarako', 'PMAX': 15.0}, 'Ebene_22kV_1_genstat_Gr_PV_Ebene_1': {'Q': 0.0, 'EXNAME': 'Ebene_22kV_1_66.0KV', 'NAME': 'PV_Ebene_1', 'NUMBER': 33, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Ebene_1', 'PMAX': 0.5}, 'FVPS_22kV_3_genstat_Gr_PV_FVPS_3': {'Q': 0.0, 'EXNAME': 'FVPS_22kV_3_66.0KV', 'NAME': 'PV_FVPS_3', 'NUMBER': 44, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_FVPS_3', 'PMAX': 0.5}, 'Henrietta_22kV_2_genstat_Gr_PV_Henrietta_2': {'Q': 0.0, 'EXNAME': 'Henrietta_22kV_2_66.0KV', 'NAME': 'PV_Henrietta_2', 'NUMBER': 63, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Henrietta_2', 'PMAX': 0.5}, 'Terminal_1__syn_Gr_FVPS_G5': {'Q': 0.0, 'EXNAME': 'Terminal_1__66.0KV', 'NAME': 'FVPS_G5', 'NUMBER': 108, 'QMAX': 9.894586563110352, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -8.088730812072754, 'ID': 'FVPS_G5', 'PMAX': 15.979999542236328}, 'CaseNoyale_22kV_1_genstat_Gr_PV_CaseNoyale_1': {'Q': 0.0, 'EXNAME': 'CaseNoyale_22kV_1_66.0KV', 'NAME': 'PV_CaseNoyale_1', 'NUMBER': 19, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_CaseNoyale_1', 'PMAX': 0.5}, 'Sottise_22kV_2_genstat_Gr_PV_MonChoisy': {'Q': 0.0, 'EXNAME': 'Sottise_22kV_2_66.0KV', 'NAME': 'PV_MonChoisy', 'NUMBER': 94, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_MonChoisy', 'PMAX': 2.0}, 'Sottise_22kV_1_genstat_Gr_PV_Sottise_1': {'Q': 0.0, 'EXNAME': 'Sottise_22kV_1_66.0KV', 'NAME': 'PV_Sottise_1', 'NUMBER': 93, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Sottise_1', 'PMAX': 0.5}, 'LaFerme_G1_Ugen_genstat_Gr_RoR_LaFerme': {'Q': 0.0, 'EXNAME': 'LaFerme_G1_Ugen_66.0KV', 'NAME': 'RoR_LaFerme', 'NUMBER': 75, 'QMAX': 0.9000000357627869, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.6449999809265137, 'ID': 'RoR_LaFerme', 'PMAX': 1.2000000476837158}, 'Amaury_22kV_2_genstat_Gr_PV_Amaury_2': {'Q': 0.0, 'EXNAME': 'Amaury_22kV_2_66.0KV', 'NAME': 'PV_Amaury_2', 'NUMBER': 1, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Amaury_2', 'PMAX': 0.5}, 'Magenta_G1_Ugen_genstat_Gr_RoR_Magenta': {'Q': 0.0, 'EXNAME': 'Magenta_G1_Ugen_66.0KV', 'NAME': 'RoR_Magenta', 'NUMBER': 79, 'QMAX': 0.6000000238418579, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.4300000071525574, 'ID': 'RoR_Magenta', 'PMAX': 0.800000011920929}, 'StLouis_Ugen_11_syn_Gr_SLPS_G11': {'Q': 0.0, 'EXNAME': 'StLouis_Ugen_11_66.0KV', 'NAME': 'SLPS_G11', 'NUMBER': 100, 'QMAX': 12.898200035095215, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -9.2437105178833, 'ID': 'SLPS_G11', 'PMAX': 17.197599411010742}, 'Bellevue_G2_Ugen_syn_Gr_IPP_Bellevue_G2': {'Q': 0.0, 'EXNAME': 'Bellevue_G2_Ugen_66.0KV', 'NAME': 'IPP_Bellevue_G2', 'NUMBER': 12, 'QMAX': 26.700000762939453, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -20.91499900817871, 'ID': 'IPP_Bellevue_G2', 'PMAX': 31.0}, 'Fuel_22kV_2_genstat_Gr_PV_Fuel_2': {'Q': 0.0, 'EXNAME': 'Fuel_22kV_2_66.0KV', 'NAME': 'PV_Fuel_2', 'NUMBER': 57, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Fuel_2', 'PMAX': 0.5}, 'TourKoening_22kV_2_genstat_Gr_PV_TourKoening_2': {'Q': 0.0, 'EXNAME': 'TourKoening_22kV_2_66.0KV', 'NAME': 'PV_TourKoening_2', 'NUMBER': 116, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_TourKoening_2', 'PMAX': 0.5}, 'Fuel_G2_Ugen_syn_Gr_IPP_Fuel_G2': {'Q': 0.0, 'EXNAME': 'Fuel_G2_Ugen_66.0KV', 'NAME': 'IPP_Fuel_G2', 'NUMBER': 60, 'QMAX': 14.100000381469727, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -11.045000076293945, 'ID': 'IPP_Fuel_G2', 'PMAX': 13.5}, 'Bellevue_22kV_1_genstat_Gr_PV_Bellevue_1': {'Q': 0.0, 'EXNAME': 'Bellevue_22kV_1_66.0KV', 'NAME': 'PV_Bellevue_1', 'NUMBER': 8, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Bellevue_1', 'PMAX': 0.5}, 'LeVal_G2_Ugen_genstat_Gr_RoR_LeVal_G2': {'Q': 0.0, 'EXNAME': 'LeVal_G2_Ugen_66.0KV', 'NAME': 'RoR_LeVal_G2', 'NUMBER': 78, 'QMAX': 1.5, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -1.0750000476837158, 'ID': 'RoR_LeVal_G2', 'PMAX': 2.0}, 'NIPS_G3_Ugen_syn_Gr_NIPS_G3': {'Q': 0.0, 'EXNAME': 'NIPS_G3_Ugen_66.0KV', 'NAME': 'NIPS_G3', 'NUMBER': 87, 'QMAX': 28.260000228881836, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -20.253000259399414, 'ID': 'NIPS_G3', 'PMAX': 37.68000030517578}, 'FGPS_Ugen2_syn_Gr_FGPS_G2': {'Q': 0.0, 'EXNAME': 'FGPS_Ugen2_66.0KV', 'NAME': 'FGPS_G2', 'NUMBER': 38, 'QMAX': 17.56800079345703, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -14.640000343322754, 'ID': 'FGPS_G2', 'PMAX': 15.399999618530273}, 'FGPS_Ugen1_syn_Gr_FGPS_G1': {'Q': 0.0, 'EXNAME': 'FGPS_Ugen1_66.0KV', 'NAME': 'FGPS_G1', 'NUMBER': 37, 'QMAX': 17.56800079345703, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -14.640000343322754, 'ID': 'FGPS_G1', 'PMAX': 15.399999618530273}, 'UnionVale_22kV_1_genstat_Gr_PV_UnionVale_1': {'Q': 0.0, 'EXNAME': 'UnionVale_22kV_1_66.0KV', 'NAME': 'PV_UnionVale_1', 'NUMBER': 118, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_UnionVale_1', 'PMAX': 0.5}, 'FortGeorge_22kV_1_genstat_Gr_PV_FortGeorge_1': {'Q': 0.0, 'EXNAME': 'FortGeorge_22kV_1_66.0KV', 'NAME': 'PV_FortGeorge_1', 'NUMBER': 53, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_FortGeorge_1', 'PMAX': 0.5}, 'Wooton_22kV_1_genstat_Gr_PV_Esperance': {'Q': 0.0, 'EXNAME': 'Wooton_22kV_1_66.0KV', 'NAME': 'PV_Esperance', 'NUMBER': 121, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Esperance', 'PMAX': 2.0}, 'StLouis_22kV_1_genstat_Gr_PV_StLouis_1': {'Q': 0.0, 'EXNAME': 'StLouis_22kV_1_66.0KV', 'NAME': 'PV_StLouis_1', 'NUMBER': 96, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_StLouis_1', 'PMAX': 0.5}, 'Cecile_G1_Ugen_genstat_Gr_RoR_Cecile': {'Q': 0.0, 'EXNAME': 'Cecile_G1_Ugen_66.0KV', 'NAME': 'RoR_Cecile', 'NUMBER': 23, 'QMAX': 0.75, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.5375000238418579, 'ID': 'RoR_Cecile', 'PMAX': 1.0}, 'Combo_22kV_1_genstat_Gr_PV_Combo_1': {'Q': 0.0, 'EXNAME': 'Combo_22kV_1_66.0KV', 'NAME': 'PV_Combo_1', 'NUMBER': 28, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Combo_1', 'PMAX': 0.5}, 'CTDS_G1_Ugen_syn_Gr_IPP_CTDS_G1': {'Q': 0.0, 'EXNAME': 'CTDS_G1_Ugen_66.0KV', 'NAME': 'IPP_CTDS_G1', 'NUMBER': 14, 'QMAX': 29.439998626708984, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -21.6200008392334, 'ID': 'IPP_CTDS_G1', 'PMAX': 30.0}, 'Terminal_7__syn_Gr_FVPS_G12_MAN': {'Q': 0.0, 'EXNAME': 'Terminal_7__66.0KV', 'NAME': 'FVPS_G12_MAN', 'NUMBER': 114, 'QMAX': 7.390200614929199, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -5.2963104248046875, 'ID': 'FVPS_G12_MAN', 'PMAX': 8.0}, 'FVPS_22kV_1_genstat_Gr_PV_FVPS_1': {'Q': 0.0, 'EXNAME': 'FVPS_22kV_1_66.0KV', 'NAME': 'PV_FVPS_1', 'NUMBER': 42, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_FVPS_1', 'PMAX': 0.5}, 'FGPS_Ugen3_syn_Gr_FGPS_G3': {'Q': 0.0, 'EXNAME': 'FGPS_Ugen3_66.0KV', 'NAME': 'FGPS_G3', 'NUMBER': 39, 'QMAX': 22.374000549316406, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -16.780500411987305, 'ID': 'FGPS_G3', 'PMAX': 21.0}, 'Combo_22kV_2_genstat_Gr_PV_Combo_2': {'Q': 0.0, 'EXNAME': 'Combo_22kV_2_66.0KV', 'NAME': 'PV_Combo_2', 'NUMBER': 29, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Combo_2', 'PMAX': 0.5}, 'Ebene_22kV_3_genstat_Gr_PV_Ebene_3': {'Q': 0.0, 'EXNAME': 'Ebene_22kV_3_66.0KV', 'NAME': 'PV_Ebene_3', 'NUMBER': 35, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Ebene_3', 'PMAX': 0.5}, 'FGPS_Ugen4_syn_Gr_FGPS_G4': {'Q': 0.0, 'EXNAME': 'FGPS_Ugen4_66.0KV', 'NAME': 'FGPS_G4', 'NUMBER': 40, 'QMAX': 22.44000244140625, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -18.700000762939453, 'ID': 'FGPS_G4', 'PMAX': 21.0}, 'Jin_Fei_22kV_2_genstat_Gr_PV_Jin_Fei_1': {'Q': 0.0, 'EXNAME': 'Jin_Fei_22kV_2_66.0KV', 'NAME': 'PV_Jin_Fei_1', 'NUMBER': 70, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Jin_Fei_1', 'PMAX': 0.5}, 'NIPS_G2_Ugen_syn_Gr_NIPS_G2': {'Q': 0.0, 'EXNAME': 'NIPS_G2_Ugen_66.0KV', 'NAME': 'NIPS_G2', 'NUMBER': 86, 'QMAX': 17.025001525878906, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -12.201250076293945, 'ID': 'NIPS_G2', 'PMAX': 22.700000762939453}, 'Nicolay_22kV_2_genstat_Gr_PV_Nicolay_2': {'Q': 0.0, 'EXNAME': 'Nicolay_22kV_2_66.0KV', 'NAME': 'PV_Nicolay_2', 'NUMBER': 89, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Nicolay_2', 'PMAX': 0.5}, 'Wooton_22kV_1_genstat_Gr_PV_Wooton_2': {'Q': 0.0, 'EXNAME': 'Wooton_22kV_1_66.0KV', 'NAME': 'PV_Wooton_2', 'NUMBER': 121, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Wooton_2', 'PMAX': 0.5}, 'Jin_Fei_22kV_1_genstat_Gr_PV_Jin_Fei_2': {'Q': 0.0, 'EXNAME': 'Jin_Fei_22kV_1_66.0KV', 'NAME': 'PV_Jin_Fei_2', 'NUMBER': 69, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Jin_Fei_2', 'PMAX': 0.5}, 'Fuel_G1_Ugen_syn_Gr_IPP_Fuel_G1': {'Q': 0.0, 'EXNAME': 'Fuel_G1_Ugen_66.0KV', 'NAME': 'IPP_Fuel_G1', 'NUMBER': 59, 'QMAX': 16.275001525878906, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -12.748749732971191, 'ID': 'IPP_Fuel_G1', 'PMAX': 13.5}, 'LeVal_G1_Ugen_genstat_Gr_RoR_LeVal_G1': {'Q': 0.0, 'EXNAME': 'LeVal_G1_Ugen_66.0KV', 'NAME': 'RoR_LeVal_G1', 'NUMBER': 77, 'QMAX': 1.5, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -1.0750000476837158, 'ID': 'RoR_LeVal_G1', 'PMAX': 2.0}, 'StLouis_22kV_2_genstat_Gr_PV_StLouis_2': {'Q': 0.0, 'EXNAME': 'StLouis_22kV_2_66.0KV', 'NAME': 'PV_StLouis_2', 'NUMBER': 97, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_StLouis_2', 'PMAX': 0.5}, 'TourKoening_22kV_1_genstat_Gr_PV_TourKoening_1': {'Q': 0.0, 'EXNAME': 'TourKoening_22kV_1_66.0KV', 'NAME': 'PV_TourKoening_1', 'NUMBER': 115, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_TourKoening_1', 'PMAX': 0.5}, 'StLouis_Ugen_10_syn_Gr_SLPS_G10': {'Q': 0.0, 'EXNAME': 'StLouis_Ugen_10_66.0KV', 'NAME': 'SLPS_G10', 'NUMBER': 99, 'QMAX': 12.898200035095215, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -9.2437105178833, 'ID': 'SLPS_G10', 'PMAX': 17.197599411010742}, 'LaChaumiere_22kV_2_genstat_Gr_PV_LaChaumiere_2': {'Q': 0.0, 'EXNAME': 'LaChaumiere_22kV_2_66.0KV', 'NAME': 'PV_LaChaumiere_2', 'NUMBER': 73, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_LaChaumiere_2', 'PMAX': 0.5}, 'FGPS_Ugen5_syn_Gr_FGPS_G5': {'Q': 0.0, 'EXNAME': 'FGPS_Ugen5_66.0KV', 'NAME': 'FGPS_G5', 'NUMBER': 41, 'QMAX': 22.44000244140625, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -18.700000762939453, 'ID': 'FGPS_G5', 'PMAX': 21.0}, 'Bellevue_22kV_2_genstat_Gr_PV_Bellevue_2': {'Q': 0.0, 'EXNAME': 'Bellevue_22kV_2_66.0KV', 'NAME': 'PV_Bellevue_2', 'NUMBER': 9, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Bellevue_2', 'PMAX': 0.5}, 'StLouis_Ugen_13_syn_Gr_SLPS_G13': {'Q': 0.0, 'EXNAME': 'StLouis_Ugen_13_66.0KV', 'NAME': 'SLPS_G13', 'NUMBER': 102, 'QMAX': 12.898200035095215, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -9.2437105178833, 'ID': 'SLPS_G13', 'PMAX': 17.197599411010742}, 'Wooton_22kV_2_genstat_Gr_PV_Wooton_1': {'Q': 0.0, 'EXNAME': 'Wooton_22kV_2_66.0KV', 'NAME': 'PV_Wooton_1', 'NUMBER': 122, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Wooton_1', 'PMAX': 0.5}, 'Sottise_22kV_2_genstat_Gr_PV_Sottise_2': {'Q': 0.0, 'EXNAME': 'Sottise_22kV_2_66.0KV', 'NAME': 'PV_Sottise_2', 'NUMBER': 94, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Sottise_2', 'PMAX': 0.5}, 'Nicolay_22kV_1_genstat_Gr_PV_Nicolay_1': {'Q': 0.0, 'EXNAME': 'Nicolay_22kV_1_66.0KV', 'NAME': 'PV_Nicolay_1', 'NUMBER': 88, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Nicolay_1', 'PMAX': 0.5}, 'StLouis_Ugen_8_syn_Gr_SLPS_G8': {'Q': 0.0, 'EXNAME': 'StLouis_Ugen_8_66.0KV', 'NAME': 'SLPS_G8', 'NUMBER': 104, 'QMAX': 6.578999996185303, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -6.578999996185303, 'ID': 'SLPS_G8', 'PMAX': 13.770000457763672}, 'Ferney_G2_Ugen_genstat_Gr_HighDam_Ferney_G2': {'Q': 0.0, 'EXNAME': 'Ferney_G2_Ugen_66.0KV', 'NAME': 'HighDam_Ferney_G2', 'NUMBER': 52, 'QMAX': 3.2875001430511475, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -2.6875, 'ID': 'HighDam_Ferney_G2', 'PMAX': 5.3125}, 'Ferney_G1_Ugen_genstat_Gr_HighDam_Ferney_G1': {'Q': 0.0, 'EXNAME': 'Ferney_G1_Ugen_66.0KV', 'NAME': 'HighDam_Ferney_G1', 'NUMBER': 51, 'QMAX': 3.2875001430511475, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -2.6875, 'ID': 'HighDam_Ferney_G1', 'PMAX': 5.3125}, 'Champagne_G2_Ugen_genstat_Gr_HighDam_Champagne_G2': {'Q': 0.0, 'EXNAME': 'Champagne_G2_Ugen_66.0KV', 'NAME': 'HighDam_Champagne_G2', 'NUMBER': 27, 'QMAX': 10.200000762939453, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -7.309999942779541, 'ID': 'HighDam_Champagne_G2', 'PMAX': 13.600000381469727}, 'PlaineDesRochesPowerStation_22kV_genstat_Gr_EOL_PlaindesRoches': {'Q': 0.0, 'EXNAME': 'PlaineDesRochesPowerStation_22kV_66.0KV', 'NAME': 'EOL_PlaindesRoches', 'NUMBER': 90, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'EOL_PlaindesRoches', 'PMAX': 9.399999618530273}, 'FVPS_22kV_2_genstat_Gr_PV_FVPS_2': {'Q': 0.0, 'EXNAME': 'FVPS_22kV_2_66.0KV', 'NAME': 'PV_FVPS_2', 'NUMBER': 43, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_FVPS_2', 'PMAX': 0.5}, 'Terminal_6__syn_Gr_FVPS_G6': {'Q': 0.0, 'EXNAME': 'Terminal_6__66.0KV', 'NAME': 'FVPS_G6', 'NUMBER': 113, 'QMAX': 9.894586563110352, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -8.088730812072754, 'ID': 'FVPS_G6', 'PMAX': 15.989350318908691}, 'Ebene_22kV_2_genstat_Gr_PV_Ebene_2': {'Q': 0.0, 'EXNAME': 'Ebene_22kV_2_66.0KV', 'NAME': 'PV_Ebene_2', 'NUMBER': 34, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Ebene_2', 'PMAX': 0.5}, 'LaChaumiere_22kV_1_genstat_Gr_PV_LaChaumiere_1': {'Q': 0.0, 'EXNAME': 'LaChaumiere_22kV_1_66.0KV', 'NAME': 'PV_LaChaumiere_1', 'NUMBER': 72, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_LaChaumiere_1', 'PMAX': 0.5}, 'Amaury_22kV_2_genstat_Gr_PV_PetiteRetraite': {'Q': 0.0, 'EXNAME': 'Amaury_22kV_2_66.0KV', 'NAME': 'PV_PetiteRetraite', 'NUMBER': 1, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_PetiteRetraite', 'PMAX': 2.0}, 'Terminal_2__syn_Gr_FVPS_G1': {'Q': 0.0, 'EXNAME': 'Terminal_2__66.0KV', 'NAME': 'FVPS_G1', 'NUMBER': 109, 'QMAX': 9.460636138916016, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -7.733980178833008, 'ID': 'FVPS_G1', 'PMAX': 15.288100242614746}, 'StLouis_Ugen_7_syn_Gr_SLPS_G7': {'Q': 0.0, 'EXNAME': 'StLouis_Ugen_7_66.0KV', 'NAME': 'SLPS_G7', 'NUMBER': 103, 'QMAX': 6.578999996185303, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -6.578999996185303, 'ID': 'SLPS_G7', 'PMAX': 13.770000457763672}, 'Beauchamp_G1_Ugen_syn_Gr_IPP_Beauchamp_G1': {'Q': 0.0, 'EXNAME': 'Beauchamp_G1_Ugen_66.0KV', 'NAME': 'IPP_Beauchamp_G1', 'NUMBER': 7, 'QMAX': 18.479999542236328, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -13.243999481201172, 'ID': 'IPP_Beauchamp_G1', 'PMAX': 22.0}, 'Terminal_3__syn_Gr_FVPS_G3': {'Q': 0.0, 'EXNAME': 'Terminal_3__66.0KV', 'NAME': 'FVPS_G3', 'NUMBER': 110, 'QMAX': 9.894586563110352, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -8.088730812072754, 'ID': 'FVPS_G3', 'PMAX': 15.989350318908691}, 'Tamarind_G1_Ugen_genstat_Gr_RoR_Tamarind': {'Q': 0.0, 'EXNAME': 'Tamarind_G1_Ugen_66.0KV', 'NAME': 'RoR_Tamarind', 'NUMBER': 106, 'QMAX': 3.2160003185272217, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -2.304800033569336, 'ID': 'RoR_Tamarind', 'PMAX': 4.288000106811523}, 'Terminal_4__syn_Gr_FVPS_G4': {'Q': 0.0, 'EXNAME': 'Terminal_4__66.0KV', 'NAME': 'FVPS_G4', 'NUMBER': 111, 'QMAX': 9.894586563110352, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -8.088730812072754, 'ID': 'FVPS_G4', 'PMAX': 15.989350318908691}, 'Amaury_22kV_1_genstat_Gr_PV_Amaury_1': {'Q': 0.0, 'EXNAME': 'Amaury_22kV_1_66.0KV', 'NAME': 'PV_Amaury_1', 'NUMBER': 0, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Amaury_1', 'PMAX': 0.5}, 'UnionVale_22kV_2_genstat_Gr_PV_UnionVale_2': {'Q': 0.0, 'EXNAME': 'UnionVale_22kV_2_66.0KV', 'NAME': 'PV_UnionVale_2', 'NUMBER': 119, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_UnionVale_2', 'PMAX': 0.5}, 'FortGeorge_22kV_2_genstat_Gr_PV_FortGeorge_2': {'Q': 0.0, 'EXNAME': 'FortGeorge_22kV_2_66.0KV', 'NAME': 'PV_FortGeorge_2', 'NUMBER': 54, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_FortGeorge_2', 'PMAX': 0.5}, 'Terminal_5__syn_Gr_FVPS_G2': {'Q': 0.0, 'EXNAME': 'Terminal_5__66.0KV', 'NAME': 'FVPS_G2', 'NUMBER': 112, 'QMAX': 9.460636138916016, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -7.733980178833008, 'ID': 'FVPS_G2', 'PMAX': 15.288100242614746}, 'Henrietta_22kV_1_genstat_Gr_PV_Henrietta_1': {'Q': 0.0, 'EXNAME': 'Henrietta_22kV_1_66.0KV', 'NAME': 'PV_Henrietta_1', 'NUMBER': 62, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Henrietta_1', 'PMAX': 0.5}, 'StLouis_Ugen_12_syn_Gr_SLPS_G12': {'Q': 0.0, 'EXNAME': 'StLouis_Ugen_12_66.0KV', 'NAME': 'SLPS_G12', 'NUMBER': 101, 'QMAX': 12.898200035095215, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -9.2437105178833, 'ID': 'SLPS_G12', 'PMAX': 17.197599411010742}, 'Curepipe_22kV_genstat_Gr_EOL_PlaineSophie': {'Q': 0.0, 'EXNAME': 'Curepipe_22kV_66.0KV', 'NAME': 'EOL_PlaineSophie', 'NUMBER': 31, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'EOL_PlaineSophie', 'PMAX': 30.0}, 'Medine_G2_Ugen_syn_Gr_IPP_Medine_G2': {'Q': 0.0, 'EXNAME': 'Medine_G2_Ugen_66.0KV', 'NAME': 'IPP_Medine_G2', 'NUMBER': 83, 'QMAX': 9.15000057220459, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -6.557499885559082, 'ID': 'IPP_Medine_G2', 'PMAX': 11.0}, 'Fuel_22kV_1_genstat_Gr_PV_Fuel_1': {'Q': 0.0, 'EXNAME': 'Fuel_22kV_1_66.0KV', 'NAME': 'PV_Fuel_1', 'NUMBER': 56, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Fuel_1', 'PMAX': 0.5}, 'CTSAV_G1_Ugen_syn_Gr_IPP_CTSAV_G1': {'Q': 0.0, 'EXNAME': 'CTSAV_G1_Ugen_66.0KV', 'NAME': 'IPP_CTSAV_G1', 'NUMBER': 16, 'QMAX': 39.60000228881836, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -25.80000114440918, 'ID': 'IPP_CTSAV_G1', 'PMAX': 37.0}, 'Terminal_syn_Gr_FVPS_G11_MAN': {'Q': 0.0, 'EXNAME': 'Terminal_66.0KV', 'NAME': 'FVPS_G11_MAN', 'NUMBER': 107, 'QMAX': 7.390200614929199, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -5.2963104248046875, 'ID': 'FVPS_G11_MAN', 'PMAX': 8.0}, 'Bellevue_G1_Ugen_syn_Gr_IPP_Bellevue_G1': {'Q': 0.0, 'EXNAME': 'Bellevue_G1_Ugen_66.0KV', 'NAME': 'IPP_Bellevue_G1', 'NUMBER': 11, 'QMAX': 26.700000762939453, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -20.91499900817871, 'ID': 'IPP_Bellevue_G1', 'PMAX': 31.0}, 'Ferney_22kV_genstat_Gr_PV_Ferney_1': {'Q': 0.0, 'EXNAME': 'Ferney_22kV_66.0KV', 'NAME': 'PV_Ferney_1', 'NUMBER': 50, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Ferney_1', 'PMAX': 0.5}, 'Anahita_22kV_1_genstat_Gr_PV_Anahita_1': {'Q': 0.0, 'EXNAME': 'Anahita_22kV_1_66.0KV', 'NAME': 'PV_Anahita_1', 'NUMBER': 3, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Anahita_1', 'PMAX': 0.5}, 'Medine_G1_Ugen_syn_Gr_IPP_Medine_G1': {'Q': 0.0, 'EXNAME': 'Medine_G1_Ugen_66.0KV', 'NAME': 'IPP_Medine_G1', 'NUMBER': 82, 'QMAX': 12.5, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -12.5, 'ID': 'IPP_Medine_G1', 'PMAX': 10.0}, 'CaseNoyale_22kV_2_genstat_Gr_PV_CaseNoyale_2': {'Q': 0.0, 'EXNAME': 'CaseNoyale_22kV_2_66.0KV', 'NAME': 'PV_CaseNoyale_2', 'NUMBER': 20, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_CaseNoyale_2', 'PMAX': 0.5}, 'NIPS_G1_Ugen_syn_Gr_NIPS_G1': {'Q': 0.0, 'EXNAME': 'NIPS_G1_Ugen_66.0KV', 'NAME': 'NIPS_G1', 'NUMBER': 85, 'QMAX': 16.356000900268555, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -11.721799850463867, 'ID': 'NIPS_G1', 'PMAX': 21.808000564575195}, 'Anahita_22kV_2_genstat_Gr_PV_Anahita_2': {'Q': 0.0, 'EXNAME': 'Anahita_22kV_2_66.0KV', 'NAME': 'PV_Anahita_2', 'NUMBER': 4, 'QMAX': 0.0, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -0.0, 'ID': 'PV_Anahita_2', 'PMAX': 0.5}, 'CTSAV_G2_Ugen_syn_Gr_IPP_CTSAV_G2': {'Q': 0.0, 'EXNAME': 'CTSAV_G2_Ugen_66.0KV', 'NAME': 'IPP_CTSAV_G2', 'NUMBER': 18, 'QMAX': 39.60000228881836, 'PMIN': 0.0, 'P': 0.0, 'QMIN': -25.80000114440918, 'ID': 'IPP_CTSAV_G2', 'PMAX': 37.0}} +LoadDico = {'Combo_22kV_2_Lo1': {'EXNAME': 'Combo_22kV_2_22.0KV', 'NAME': 'Combo_Load_2', 'NUMBER': 29, 'Q': 2.3155798440790565, 'P': 7.045000076293945, 'ID': 1}, 'CaseNoyale_22kV_2_Lo1': {'EXNAME': 'CaseNoyale_22kV_2_22.0KV', 'NAME': 'CaseNoyale_Load_2', 'NUMBER': 20, 'Q': 2.3155798440790565, 'P': 7.045000076293945, 'ID': 1}, 'FVPS_22kV_1_Lo1': {'EXNAME': 'FVPS_22kV_1_22.0KV', 'NAME': 'FortVictoria_Load_1', 'NUMBER': 42, 'Q': 4.999285895721721, 'P': 15.210000038146973, 'ID': 1}, 'Nicolay_22kV_1_Lo1': {'EXNAME': 'Nicolay_22kV_1_22.0KV', 'NAME': 'Nicolay_Load_1', 'NUMBER': 88, 'Q': 4.830013446924353, 'P': 14.694999694824219, 'ID': 1}, 'FVPS_22kV_2_Lo1': {'EXNAME': 'FVPS_22kV_2_22.0KV', 'NAME': 'FortVictoria_Load_2', 'NUMBER': 43, 'Q': 4.999285895721721, 'P': 15.210000038146973, 'ID': 1}, 'Anahita_22kV_1_Lo1': {'EXNAME': 'Anahita_22kV_1_22.0KV', 'NAME': 'Anahita_Load_1', 'NUMBER': 3, 'Q': 1.7370967871121035, 'P': 5.284999847412109, 'ID': 1}, 'Amaury_22kV_2_Lo1': {'EXNAME': 'Amaury_22kV_2_22.0KV', 'NAME': 'Amaury_Load_2', 'NUMBER': 1, 'Q': 2.4815653761717926, 'P': 7.550000190734863, 'ID': 1}, 'StLouis_22kV_2_Lo1': {'EXNAME': 'StLouis_22kV_2_22.0KV', 'NAME': 'StLouis_Load_2', 'NUMBER': 97, 'Q': 4.432305615934249, 'P': 13.484999656677246, 'ID': 1}, 'Nicolay_22kV_2_Lo1': {'EXNAME': 'Nicolay_22kV_2_22.0KV', 'NAME': 'Nicolay_Load_2', 'NUMBER': 89, 'Q': 4.830013446924353, 'P': 14.694999694824219, 'ID': 1}, 'Sottise_22kV_1_Lo1': {'EXNAME': 'Sottise_22kV_1_22.0KV', 'NAME': 'Sottise_Load_1', 'NUMBER': 93, 'Q': 4.217017587102438, 'P': 12.829999923706055, 'ID': 1}, 'Fuel_22kV_2_Lo1': {'EXNAME': 'Fuel_22kV_2_22.0KV', 'NAME': 'Fuel_Load_2', 'NUMBER': 57, 'Q': 3.6845493057984093, 'P': 11.210000038146973, 'ID': 1}, 'StLouis_22kV_1_Lo1': {'EXNAME': 'StLouis_22kV_1_22.0KV', 'NAME': 'StLouis_Load_1', 'NUMBER': 96, 'Q': 4.432305615934249, 'P': 13.484999656677246, 'ID': 1}, 'Jin_Fei_22kV_2_Lo1': {'EXNAME': 'Jin_Fei_22kV_2_22.0KV', 'NAME': 'Jin_Fei_Load_2', 'NUMBER': 70, 'Q': 2.0838575451816834, 'P': 6.340000152587891, 'ID': 1}, 'FortGeorge_22kV_2_Lo1': {'EXNAME': 'FortGeorge_22kV_2_22.0KV', 'NAME': 'FortGeorge_Load_2', 'NUMBER': 54, 'Q': 4.41587165932631, 'P': 13.4350004196167, 'ID': 1}, 'UnionVale_22kV_1_Lo1': {'EXNAME': 'UnionVale_22kV_1_22.0KV', 'NAME': 'UnionVale_Load_1', 'NUMBER': 118, 'Q': 3.83081365112094, 'P': 11.654999732971191, 'ID': 1}, 'Bellevue_22kV_1_Lo1': {'EXNAME': 'Bellevue_22kV_1_22.0KV', 'NAME': 'Bellevue_Load_1', 'NUMBER': 8, 'Q': 4.631159688158113, 'P': 14.09000015258789, 'ID': 1}, 'FVPS_22kV_3_Lo1': {'EXNAME': 'FVPS_22kV_3_22.0KV', 'NAME': 'FortVictoria_Load_3', 'NUMBER': 44, 'Q': 4.999285895721721, 'P': 15.210000038146973, 'ID': 1}, 'Henrietta_22kV_1_Lo1': {'EXNAME': 'Henrietta_22kV_1_22.0KV', 'NAME': 'Henrietta_Load_1', 'NUMBER': 62, 'Q': 3.972147934844134, 'P': 12.085000038146973, 'ID': 1}, 'FortGeorge_22kV_1_Lo1': {'EXNAME': 'FortGeorge_22kV_1_22.0KV', 'NAME': 'FortGeorge_Load_1', 'NUMBER': 53, 'Q': 4.41587165932631, 'P': 13.4350004196167, 'ID': 1}, 'Wooton_22kV_2_Lo1': {'EXNAME': 'Wooton_22kV_2_22.0KV', 'NAME': 'Wooton_Load_2', 'NUMBER': 122, 'Q': 6.701869566521236, 'P': 20.389999389648438, 'ID': 1}, 'Ebene_22kV_2_Lo1': {'EXNAME': 'Ebene_22kV_2_22.0KV', 'NAME': 'Ebene_Load_2', 'NUMBER': 34, 'Q': 6.284437131607226, 'P': 19.1200008392334, 'ID': 1}, 'LaChaumiere_22kV_2_Lo1': {'EXNAME': 'LaChaumiere_22kV_2_22.0KV', 'NAME': 'LaChaumiere_Load_2', 'NUMBER': 73, 'Q': 5.355908208276737, 'P': 16.295000076293945, 'ID': 1}, 'Sottise_22kV_2_Lo1': {'EXNAME': 'Sottise_22kV_2_22.0KV', 'NAME': 'Sottise_Load_2', 'NUMBER': 94, 'Q': 4.217017587102438, 'P': 12.829999923706055, 'ID': 1}, 'Fuel_22kV_1_Lo1': {'EXNAME': 'Fuel_22kV_1_22.0KV', 'NAME': 'Fuel_Load_1', 'NUMBER': 56, 'Q': 3.6845493057984093, 'P': 11.210000038146973, 'ID': 1}, 'TourKoening_22kV_2_Lo1': {'EXNAME': 'TourKoening_22kV_2_22.0KV', 'NAME': 'TourKoening_Load_2', 'NUMBER': 116, 'Q': 2.976233140523389, 'P': 9.055000305175781, 'ID': 1}, 'Amaury_22kV_1_Lo1': {'EXNAME': 'Amaury_22kV_1_22.0KV', 'NAME': 'Amaury_Load_1', 'NUMBER': 0, 'Q': 2.4815653761717926, 'P': 7.550000190734863, 'ID': 1}, 'Anahita_22kV_2_Lo1': {'EXNAME': 'Anahita_22kV_2_22.0KV', 'NAME': 'Anahita_Load_2', 'NUMBER': 4, 'Q': 1.7370967871121035, 'P': 5.284999847412109, 'ID': 1}, 'TourKoening_22kV_1_Lo1': {'EXNAME': 'TourKoening_22kV_1_22.0KV', 'NAME': 'TourKoening_Load_1', 'NUMBER': 115, 'Q': 2.976233140523389, 'P': 9.055000305175781, 'ID': 1}, 'UnionVale_22kV_2_Lo1': {'EXNAME': 'UnionVale_22kV_2_22.0KV', 'NAME': 'UnionVale_Load_2', 'NUMBER': 119, 'Q': 3.83081365112094, 'P': 11.654999732971191, 'ID': 1}, 'Bellevue_22kV_2_Lo1': {'EXNAME': 'Bellevue_22kV_2_22.0KV', 'NAME': 'Bellevue_Load_2', 'NUMBER': 9, 'Q': 4.631159688158113, 'P': 14.09000015258789, 'ID': 1}, 'Ebene_22kV_3_Lo1': {'EXNAME': 'Ebene_22kV_3_22.0KV', 'NAME': 'Ebene_Load_3', 'NUMBER': 35, 'Q': 6.284437131607226, 'P': 19.1200008392334, 'ID': 1}, 'Henrietta_22kV_2_Lo1': {'EXNAME': 'Henrietta_22kV_2_22.0KV', 'NAME': 'Henrietta_Load_2', 'NUMBER': 63, 'Q': 3.972147934844134, 'P': 12.085000038146973, 'ID': 1}, 'Jin_Fei_22kV_1_Lo1': {'EXNAME': 'Jin_Fei_22kV_1_22.0KV', 'NAME': 'Jin_Fei_Load_1', 'NUMBER': 69, 'Q': 2.0838575451816834, 'P': 6.340000152587891, 'ID': 1}, 'Ferney_22kV_Lo1': {'EXNAME': 'Ferney_22kV_22.0KV', 'NAME': 'Ferney_Load_1', 'NUMBER': 50, 'Q': 1.4462093496179527, 'P': 4.400000095367432, 'ID': 1}, 'LaChaumiere_22kV_1_Lo1': {'EXNAME': 'LaChaumiere_22kV_1_22.0KV', 'NAME': 'LaChaumiere_Load_1', 'NUMBER': 72, 'Q': 5.355908208276737, 'P': 16.295000076293945, 'ID': 1}, 'Ebene_22kV_1_Lo1': {'EXNAME': 'Ebene_22kV_1_22.0KV', 'NAME': 'Ebene_Load_1', 'NUMBER': 33, 'Q': 6.284437131607226, 'P': 19.1200008392334, 'ID': 1}, 'CaseNoyale_22kV_1_Lo1': {'EXNAME': 'CaseNoyale_22kV_1_22.0KV', 'NAME': 'CaseNoyale_Load_1', 'NUMBER': 19, 'Q': 2.3155798440790565, 'P': 7.045000076293945, 'ID': 1}, 'Combo_22kV_1_Lo1': {'EXNAME': 'Combo_22kV_1_22.0KV', 'NAME': 'Combo_Load_1', 'NUMBER': 28, 'Q': 2.3155798440790565, 'P': 7.045000076293945, 'ID': 1}, 'Wooton_22kV_1_Lo1': {'EXNAME': 'Wooton_22kV_1_22.0KV', 'NAME': 'Wooton_Load_1', 'NUMBER': 121, 'Q': 6.701869566521236, 'P': 20.389999389648438, 'ID': 1}} +LineDico = {'Medine_22kV_2_Henrietta_22kV_1_22kV_Henrietta_Medine_22kV_Li': {'TONAME': 'Henrietta_22kV_1', 'FROMNUMBER': 81, 'FROMEXNAME': 'Medine_22kV_2_22.0', 'FROMNAME': 'Medine_22kV_2', 'ID': '22kV_Henrietta_Medine_22kV', 'TONUMBER': 62, 'TOEXNAME': 'Henrietta_22kV_1_22.0'}, 'Terminal_1__FVPS_Ugen_1_Line11kV_1__Li': {'TONAME': 'FVPS_Ugen_1', 'FROMNUMBER': 108, 'FROMEXNAME': 'Terminal_1__11.0', 'FROMNAME': 'Terminal_1_', 'ID': 'Line11kV(1)', 'TONUMBER': 46, 'TOEXNAME': 'FVPS_Ugen_1_11.0'}, 'Amaury_66kV_Fuel_66kV_66kV_Amaury_Fuel_1_Li': {'TONAME': 'Fuel_66kV', 'FROMNUMBER': 2, 'FROMEXNAME': 'Amaury_66kV_66.0', 'FROMNAME': 'Amaury_66kV', 'ID': '66kV_Amaury_Fuel_1', 'TONUMBER': 58, 'TOEXNAME': 'Fuel_66kV_66.0'}, 'Henrietta_66kV_LaChaumiere_66kV_66kV_LaChaumiere_Henrietta_1_Li': {'TONAME': 'LaChaumiere_66kV', 'FROMNUMBER': 64, 'FROMEXNAME': 'Henrietta_66kV_66.0', 'FROMNAME': 'Henrietta_66kV', 'ID': '66kV_LaChaumiere_Henrietta_1', 'TONUMBER': 74, 'TOEXNAME': 'LaChaumiere_66kV_66.0'}, 'Cecile_22kV_Combo_22kV_2_22kV_Combo_Cecile_Li': {'TONAME': 'Combo_22kV_2', 'FROMNUMBER': 22, 'FROMEXNAME': 'Cecile_22kV_22.0', 'FROMNAME': 'Cecile_22kV', 'ID': '22kV_Combo_Cecile', 'TONUMBER': 29, 'TOEXNAME': 'Combo_22kV_2_22.0'}, 'Henrietta_66kV_Combo_66kV_66kV_Combo_Henrietta_Li': {'TONAME': 'Combo_66kV', 'FROMNUMBER': 64, 'FROMEXNAME': 'Henrietta_66kV_66.0', 'FROMNAME': 'Henrietta_66kV', 'ID': '66kV_Combo_Henrietta', 'TONUMBER': 30, 'TOEXNAME': 'Combo_66kV_66.0'}, 'StLouis_66kV_Dumas_66kV_66kV_Dumas_StLouis_2_Li': {'TONAME': 'Dumas_66kV', 'FROMNUMBER': 98, 'FROMEXNAME': 'StLouis_66kV_66.0', 'FROMNAME': 'StLouis_66kV', 'ID': '66kV_Dumas_StLouis_2', 'TONUMBER': 32, 'TOEXNAME': 'Dumas_66kV_66.0'}, 'Terminal_6__FVPS_Ugen_4_Line11kV_6__Li': {'TONAME': 'FVPS_Ugen_4', 'FROMNUMBER': 113, 'FROMEXNAME': 'Terminal_6__11.0', 'FROMNAME': 'Terminal_6_', 'ID': 'Line11kV(6)', 'TONUMBER': 49, 'TOEXNAME': 'FVPS_Ugen_4_11.0'}, 'Amaury_66kV_Bellevue_66kV_66kV_Amaury_Bellevue_1_Li': {'TONAME': 'Bellevue_66kV', 'FROMNUMBER': 2, 'FROMEXNAME': 'Amaury_66kV_66.0', 'FROMNAME': 'Amaury_66kV', 'ID': '66kV_Amaury_Bellevue_1', 'TONUMBER': 10, 'TOEXNAME': 'Bellevue_66kV_66.0'}, 'Dumas_66kV_FortGeorge_66kV_66kV_FortGeorge_Dumas_1_Li': {'TONAME': 'FortGeorge_66kV', 'FROMNUMBER': 32, 'FROMEXNAME': 'Dumas_66kV_66.0', 'FROMNAME': 'Dumas_66kV', 'ID': '66kV_FortGeorge_Dumas_1', 'TONUMBER': 55, 'TOEXNAME': 'FortGeorge_66kV_66.0'}, 'Champagne_66kV_Wooton_66kV_66kV_Champagne_Wooton_2_Li': {'TONAME': 'Wooton_66kV', 'FROMNUMBER': 25, 'FROMEXNAME': 'Champagne_66kV_66.0', 'FROMNAME': 'Champagne_66kV', 'ID': '66kV_Champagne_Wooton_2', 'TONUMBER': 123, 'TOEXNAME': 'Wooton_66kV_66.0'}, 'Amaury_66kV_Wooton_66kV_66kV_Wooton_Amaury_Li': {'TONAME': 'Wooton_66kV', 'FROMNUMBER': 2, 'FROMEXNAME': 'Amaury_66kV_66.0', 'FROMNAME': 'Amaury_66kV', 'ID': '66kV_Wooton_Amaury', 'TONUMBER': 123, 'TOEXNAME': 'Wooton_66kV_66.0'}, 'Wooton_66kV_Ebene_66kV_66kV_Ebene_Wooton_2_Li': {'TONAME': 'Ebene_66kV', 'FROMNUMBER': 123, 'FROMEXNAME': 'Wooton_66kV_66.0', 'FROMNAME': 'Wooton_66kV', 'ID': '66kV_Ebene_Wooton_2', 'TONUMBER': 36, 'TOEXNAME': 'Ebene_66kV_66.0'}, 'UnionVale_66kV_CTSAV_G1_66kV_66kV_CTSAVG1_UnionVale_Li': {'TONAME': 'CTSAV_G1_66kV', 'FROMNUMBER': 120, 'FROMEXNAME': 'UnionVale_66kV_66.0', 'FROMNAME': 'UnionVale_66kV', 'ID': '66kV_CTSAVG1_UnionVale', 'TONUMBER': 15, 'TOEXNAME': 'CTSAV_G1_66kV_66.0'}, 'Combo_66kV_Inter_CN_CO_66kV_66kV_Combo_CaseNoyale_PartOHL_Li': {'TONAME': 'Inter_CN_CO_66kV', 'FROMNUMBER': 30, 'FROMEXNAME': 'Combo_66kV_66.0', 'FROMNAME': 'Combo_66kV', 'ID': '66kV_Combo_CaseNoyale_PartOHL', 'TONUMBER': 66, 'TOEXNAME': 'Inter_CN_CO_66kV_66.0'}, 'Ebene_66kV_StLouis_66kV_66kV_StLouis_Ebene_1_Li': {'TONAME': 'StLouis_66kV', 'FROMNUMBER': 36, 'FROMEXNAME': 'Ebene_66kV_66.0', 'FROMNAME': 'Ebene_66kV', 'ID': '66kV_StLouis_Ebene_1', 'TONUMBER': 98, 'TOEXNAME': 'StLouis_66kV_66.0'}, 'StLouis_66kV_Dumas_66kV_66kV_Dumas_StLouis_1_Li': {'TONAME': 'Dumas_66kV', 'FROMNUMBER': 98, 'FROMEXNAME': 'StLouis_66kV_66.0', 'FROMNAME': 'StLouis_66kV', 'ID': '66kV_Dumas_StLouis_1', 'TONUMBER': 32, 'TOEXNAME': 'Dumas_66kV_66.0'}, 'CTDS_G1_66kV_Combo_66kV_66kV_CTDS_Combo_Li': {'TONAME': 'Combo_66kV', 'FROMNUMBER': 13, 'FROMEXNAME': 'CTDS_G1_66kV_66.0', 'FROMNAME': 'CTDS_G1_66kV', 'ID': '66kV_CTDS_Combo', 'TONUMBER': 30, 'TOEXNAME': 'Combo_66kV_66.0'}, 'CaseNoyale_66kV_Henrietta_66kV_66kV_Henrietta_CaseNoyale_Li': {'TONAME': 'Henrietta_66kV', 'FROMNUMBER': 21, 'FROMEXNAME': 'CaseNoyale_66kV_66.0', 'FROMNAME': 'CaseNoyale_66kV', 'ID': '66kV_Henrietta_CaseNoyale', 'TONUMBER': 64, 'TOEXNAME': 'Henrietta_66kV_66.0'}, 'Dumas_66kV_Jin_Fei_66kV_66kV_Dumas_Jin_Fei_Li': {'TONAME': 'Jin_Fei_66kV', 'FROMNUMBER': 32, 'FROMEXNAME': 'Dumas_66kV_66.0', 'FROMNAME': 'Dumas_66kV', 'ID': '66kV_Dumas_Jin_Fei', 'TONUMBER': 71, 'TOEXNAME': 'Jin_Fei_66kV_66.0'}, 'Inter_NI_DU_2_66kV_NIPS_66kV_66kV_Nicolay_Dumas_2_Li': {'TONAME': 'NIPS_66kV', 'FROMNUMBER': 68, 'FROMEXNAME': 'Inter_NI_DU_2_66kV_66.0', 'FROMNAME': 'Inter_NI_DU_2_66kV', 'ID': '66kV_Nicolay_Dumas_2', 'TONUMBER': 84, 'TOEXNAME': 'NIPS_66kV_66.0'}, 'Ferney_22kV_Champagne_22kV_22kV_Champagne_Ferney_Li': {'TONAME': 'Champagne_22kV', 'FROMNUMBER': 50, 'FROMEXNAME': 'Ferney_22kV_22.0', 'FROMNAME': 'Ferney_22kV', 'ID': '22kV_Champagne_Ferney', 'TONUMBER': 24, 'TOEXNAME': 'Champagne_22kV_22.0'}, 'Amaury_66kV_Bellevue_66kV_66kV_Amaury_Bellevue_2_Li': {'TONAME': 'Bellevue_66kV', 'FROMNUMBER': 2, 'FROMEXNAME': 'Amaury_66kV_66.0', 'FROMNAME': 'Amaury_66kV', 'ID': '66kV_Amaury_Bellevue_2', 'TONUMBER': 10, 'TOEXNAME': 'Bellevue_66kV_66.0'}, 'Dumas_66kV_Wooton_66kV_66kV_Dumas_Wooton_Li': {'TONAME': 'Wooton_66kV', 'FROMNUMBER': 32, 'FROMEXNAME': 'Dumas_66kV_66.0', 'FROMNAME': 'Dumas_66kV', 'ID': '66kV_Dumas_Wooton', 'TONUMBER': 123, 'TOEXNAME': 'Wooton_66kV_66.0'}, 'Bellevue_66kV_Sottise_66kV_66kV_Bellevue_Sottise_2_Li': {'TONAME': 'Sottise_66kV', 'FROMNUMBER': 10, 'FROMEXNAME': 'Bellevue_66kV_66.0', 'FROMNAME': 'Bellevue_66kV', 'ID': '66kV_Bellevue_Sottise_2', 'TONUMBER': 95, 'TOEXNAME': 'Sottise_66kV_66.0'}, 'Terminal_FVPS_Ugen_1_Line11kV_Li': {'TONAME': 'FVPS_Ugen_1', 'FROMNUMBER': 107, 'FROMEXNAME': 'Terminal_11.0', 'FROMNAME': 'Terminal', 'ID': 'Line11kV', 'TONUMBER': 46, 'TOEXNAME': 'FVPS_Ugen_1_11.0'}, 'Wooton_66kV_Ebene_66kV_66kV_Ebene_Wooton_1_Li': {'TONAME': 'Ebene_66kV', 'FROMNUMBER': 123, 'FROMEXNAME': 'Wooton_66kV_66.0', 'FROMNAME': 'Wooton_66kV', 'ID': '66kV_Ebene_Wooton_1', 'TONUMBER': 36, 'TOEXNAME': 'Ebene_66kV_66.0'}, 'Terminal_5__FVPS_Ugen_3_Line11kV_5__Li': {'TONAME': 'FVPS_Ugen_3', 'FROMNUMBER': 112, 'FROMEXNAME': 'Terminal_5__11.0', 'FROMNAME': 'Terminal_5_', 'ID': 'Line11kV(5)', 'TONUMBER': 48, 'TOEXNAME': 'FVPS_Ugen_3_11.0'}, 'StLouis_66kV_FVPS_66kV_66kV_SL_FVPS_Cable2_Li': {'TONAME': 'FVPS_66kV', 'FROMNUMBER': 98, 'FROMEXNAME': 'StLouis_66kV_66.0', 'FROMNAME': 'StLouis_66kV', 'ID': '66kV_SL_FVPS_Cable2', 'TONUMBER': 45, 'TOEXNAME': 'FVPS_66kV_66.0'}, 'Medine_22kV_1_LaChaumiere_22kV_1_22kV_LaChaumiere_Medine_22kV_Li': {'TONAME': 'LaChaumiere_22kV_1', 'FROMNUMBER': 80, 'FROMEXNAME': 'Medine_22kV_1_22.0', 'FROMNAME': 'Medine_22kV_1', 'ID': '22kV_LaChaumiere_Medine_22kV', 'TONUMBER': 72, 'TOEXNAME': 'LaChaumiere_22kV_1_22.0'}, 'Terminal_2__FVPS_Ugen_2_Line11kV_2__Li': {'TONAME': 'FVPS_Ugen_2', 'FROMNUMBER': 109, 'FROMEXNAME': 'Terminal_2__11.0', 'FROMNAME': 'Terminal_2_', 'ID': 'Line11kV(2)', 'TONUMBER': 47, 'TOEXNAME': 'FVPS_Ugen_2_11.0'}, 'LaChaumiere_66kV_StLouis_66kV_66kV_StLouis_LaChaumiere_Li': {'TONAME': 'StLouis_66kV', 'FROMNUMBER': 74, 'FROMEXNAME': 'LaChaumiere_66kV_66.0', 'FROMNAME': 'LaChaumiere_66kV', 'ID': '66kV_StLouis_LaChaumiere', 'TONUMBER': 98, 'TOEXNAME': 'StLouis_66kV_66.0'}, 'Dumas_66kV_Bellevue_66kV_66kV_Dumas_Bellevue_Li': {'TONAME': 'Bellevue_66kV', 'FROMNUMBER': 32, 'FROMEXNAME': 'Dumas_66kV_66.0', 'FROMNAME': 'Dumas_66kV', 'ID': '66kV_Dumas_Bellevue', 'TONUMBER': 10, 'TOEXNAME': 'Bellevue_66kV_66.0'}, 'Henrietta_66kV_LaChaumiere_66kV_66kV_LaChaumiere_Henrietta_2_Li': {'TONAME': 'LaChaumiere_66kV', 'FROMNUMBER': 64, 'FROMEXNAME': 'Henrietta_66kV_66.0', 'FROMNAME': 'Henrietta_66kV', 'ID': '66kV_LaChaumiere_Henrietta_2', 'TONUMBER': 74, 'TOEXNAME': 'LaChaumiere_66kV_66.0'}, 'StLouis_66kV_FVPS_66kV_66kV_SL_FVPS_Cable3_Li': {'TONAME': 'FVPS_66kV', 'FROMNUMBER': 98, 'FROMEXNAME': 'StLouis_66kV_66.0', 'FROMNAME': 'StLouis_66kV', 'ID': '66kV_SL_FVPS_Cable3', 'TONUMBER': 45, 'TOEXNAME': 'FVPS_66kV_66.0'}, 'LeVal_22kV_Wooton_22kV_2_22kV_Wooton_LeVal_Li': {'TONAME': 'Wooton_22kV_2', 'FROMNUMBER': 76, 'FROMEXNAME': 'LeVal_22kV_22.0', 'FROMNAME': 'LeVal_22kV', 'ID': '22kV_Wooton_LeVal', 'TONUMBER': 122, 'TOEXNAME': 'Wooton_22kV_2_22.0'}, 'Inter_NI_DU_1_66kV_NIPS_66kV_66kV_Nicolay_Dumas_1_Li': {'TONAME': 'NIPS_66kV', 'FROMNUMBER': 67, 'FROMEXNAME': 'Inter_NI_DU_1_66kV_66.0', 'FROMNAME': 'Inter_NI_DU_1_66kV', 'ID': '66kV_Nicolay_Dumas_1', 'TONUMBER': 84, 'TOEXNAME': 'NIPS_66kV_66.0'}, 'Inter_Anahita_Fuel_66kV_Anahita_66kV_66kV_Anahita_Fuel_OHL_Li': {'TONAME': 'Anahita_66kV', 'FROMNUMBER': 65, 'FROMEXNAME': 'Inter_Anahita_Fuel_66kV_66.0', 'FROMNAME': 'Inter_Anahita_Fuel_66kV', 'ID': '66kV_Anahita_Fuel_OHL', 'TONUMBER': 5, 'TOEXNAME': 'Anahita_66kV_66.0'}, 'Terminal_7__FVPS_Ugen_4_Line11kV_7__Li': {'TONAME': 'FVPS_Ugen_4', 'FROMNUMBER': 114, 'FROMEXNAME': 'Terminal_7__11.0', 'FROMNAME': 'Terminal_7_', 'ID': 'Line11kV(7)', 'TONUMBER': 49, 'TOEXNAME': 'FVPS_Ugen_4_11.0'}, 'Dumas_66kV_FortGeorge_66kV_66kV_FortGeorge_Dumas_2_Li': {'TONAME': 'FortGeorge_66kV', 'FROMNUMBER': 32, 'FROMEXNAME': 'Dumas_66kV_66.0', 'FROMNAME': 'Dumas_66kV', 'ID': '66kV_FortGeorge_Dumas_2', 'TONUMBER': 55, 'TOEXNAME': 'FortGeorge_66kV_66.0'}, 'UnionVale_66kV_Champagne_66kV_66kV_UnionVale_Champagne_Li': {'TONAME': 'Champagne_66kV', 'FROMNUMBER': 120, 'FROMEXNAME': 'UnionVale_66kV_66.0', 'FROMNAME': 'UnionVale_66kV', 'ID': '66kV_UnionVale_Champagne', 'TONUMBER': 25, 'TOEXNAME': 'Champagne_66kV_66.0'}, 'Terminal_3__FVPS_Ugen_2_Line11kV_3__Li': {'TONAME': 'FVPS_Ugen_2', 'FROMNUMBER': 110, 'FROMEXNAME': 'Terminal_3__11.0', 'FROMNAME': 'Terminal_3_', 'ID': 'Line11kV(3)', 'TONUMBER': 47, 'TOEXNAME': 'FVPS_Ugen_2_11.0'}, 'Terminal_4__FVPS_Ugen_3_Line11kV_4__Li': {'TONAME': 'FVPS_Ugen_3', 'FROMNUMBER': 111, 'FROMEXNAME': 'Terminal_4__11.0', 'FROMNAME': 'Terminal_4_', 'ID': 'Line11kV(4)', 'TONUMBER': 48, 'TOEXNAME': 'FVPS_Ugen_3_11.0'}, 'Amaury_66kV_Fuel_66kV_66kV_Amaury_Fuel_2_Li': {'TONAME': 'Fuel_66kV', 'FROMNUMBER': 2, 'FROMEXNAME': 'Amaury_66kV_66.0', 'FROMNAME': 'Amaury_66kV', 'ID': '66kV_Amaury_Fuel_2', 'TONUMBER': 58, 'TOEXNAME': 'Fuel_66kV_66.0'}, 'Curepipe_22kV_Henrietta_22kV_1_22kV_PlaineSophie_Henrietta_Li': {'TONAME': 'Henrietta_22kV_1', 'FROMNUMBER': 31, 'FROMEXNAME': 'Curepipe_22kV_22.0', 'FROMNAME': 'Curepipe_22kV', 'ID': '22kV_PlaineSophie_Henrietta', 'TONUMBER': 62, 'TOEXNAME': 'Henrietta_22kV_1_22.0'}, 'Ebene_66kV_StLouis_66kV_66kV_StLouis_Ebene_2_Li': {'TONAME': 'StLouis_66kV', 'FROMNUMBER': 36, 'FROMEXNAME': 'Ebene_66kV_66.0', 'FROMNAME': 'Ebene_66kV', 'ID': '66kV_StLouis_Ebene_2', 'TONUMBER': 98, 'TOEXNAME': 'StLouis_66kV_66.0'}, 'Fuel_PowerStation_66kV_Fuel_66kV_66kV_FuelPowerStation_Fuel_Li': {'TONAME': 'Fuel_66kV', 'FROMNUMBER': 61, 'FROMEXNAME': 'Fuel_PowerStation_66kV_66.0', 'FROMNAME': 'Fuel_PowerStation_66kV', 'ID': '66kV_FuelPowerStation_Fuel', 'TONUMBER': 58, 'TOEXNAME': 'Fuel_66kV_66.0'}, 'Dumas_66kV_Amaury_66kV_66kV_Dumas_Amaury_Li': {'TONAME': 'Amaury_66kV', 'FROMNUMBER': 32, 'FROMEXNAME': 'Dumas_66kV_66.0', 'FROMNAME': 'Dumas_66kV', 'ID': '66kV_Dumas_Amaury', 'TONUMBER': 2, 'TOEXNAME': 'Amaury_66kV_66.0'}, 'StLouis_66kV_FVPS_66kV_66kV_SL_FVPS_Cable4_Li': {'TONAME': 'FVPS_66kV', 'FROMNUMBER': 98, 'FROMEXNAME': 'StLouis_66kV_66.0', 'FROMNAME': 'StLouis_66kV', 'ID': '66kV_SL_FVPS_Cable4', 'TONUMBER': 45, 'TOEXNAME': 'FVPS_66kV_66.0'}, 'Champagne_66kV_Wooton_66kV_66kV_Champagne_Wooton_1_Li': {'TONAME': 'Wooton_66kV', 'FROMNUMBER': 25, 'FROMEXNAME': 'Champagne_66kV_66.0', 'FROMNAME': 'Champagne_66kV', 'ID': '66kV_Champagne_Wooton_1', 'TONUMBER': 123, 'TOEXNAME': 'Wooton_66kV_66.0'}, 'TourKoening_66kV_StLouis_66kV_66kV_StLouis_TourKoening_Li': {'TONAME': 'StLouis_66kV', 'FROMNUMBER': 117, 'FROMEXNAME': 'TourKoening_66kV_66.0', 'FROMNAME': 'TourKoening_66kV', 'ID': '66kV_StLouis_TourKoening', 'TONUMBER': 98, 'TOEXNAME': 'StLouis_66kV_66.0'}, 'StLouis_66kV_FVPS_66kV_66kV_SL_FVPS_Cable1_Li': {'TONAME': 'FVPS_66kV', 'FROMNUMBER': 98, 'FROMEXNAME': 'StLouis_66kV_66.0', 'FROMNAME': 'StLouis_66kV', 'ID': '66kV_SL_FVPS_Cable1', 'TONUMBER': 45, 'TOEXNAME': 'FVPS_66kV_66.0'}, 'UnionVale_66kV_CTSAV_G2_66kV_66kV_CTSAVG2_UnionVale_Li': {'TONAME': 'CTSAV_G2_66kV', 'FROMNUMBER': 120, 'FROMEXNAME': 'UnionVale_66kV_66.0', 'FROMNAME': 'UnionVale_66kV', 'ID': '66kV_CTSAVG2_UnionVale', 'TONUMBER': 17, 'TOEXNAME': 'CTSAV_G2_66kV_66.0'}, 'TourKoening_66kV_LaChaumiere_66kV_66kV_LaChaumiere_TourKoening_Li': {'TONAME': 'LaChaumiere_66kV', 'FROMNUMBER': 117, 'FROMEXNAME': 'TourKoening_66kV_66.0', 'FROMNAME': 'TourKoening_66kV', 'ID': '66kV_LaChaumiere_TourKoening', 'TONUMBER': 74, 'TOEXNAME': 'LaChaumiere_66kV_66.0'}, 'Sarako_66kV_LaChaumiere_66kV_66kV_Sarako_LaChaumiere_Li': {'TONAME': 'LaChaumiere_66kV', 'FROMNUMBER': 92, 'FROMEXNAME': 'Sarako_66kV_66.0', 'FROMNAME': 'Sarako_66kV', 'ID': '66kV_Sarako_LaChaumiere', 'TONUMBER': 74, 'TOEXNAME': 'LaChaumiere_66kV_66.0'}, 'Combo_66kV_UnionVale_66kV_66kV_UnionVale_Combo_Li': {'TONAME': 'UnionVale_66kV', 'FROMNUMBER': 30, 'FROMEXNAME': 'Combo_66kV_66.0', 'FROMNAME': 'Combo_66kV', 'ID': '66kV_UnionVale_Combo', 'TONUMBER': 120, 'TOEXNAME': 'UnionVale_66kV_66.0'}, 'BeauchampPowerStation_66kV_Anahita_66kV_66kV_Anahita_Beauchamp_Li': {'TONAME': 'Anahita_66kV', 'FROMNUMBER': 6, 'FROMEXNAME': 'BeauchampPowerStation_66kV_66.0', 'FROMNAME': 'BeauchampPowerStation_66kV', 'ID': '66kV_Anahita_Beauchamp', 'TONUMBER': 5, 'TOEXNAME': 'Anahita_66kV_66.0'}, 'Bellevue_66kV_Sottise_66kV_66kV_Bellevue_Sottise_1_Li': {'TONAME': 'Sottise_66kV', 'FROMNUMBER': 10, 'FROMEXNAME': 'Bellevue_66kV_66.0', 'FROMNAME': 'Bellevue_66kV', 'ID': '66kV_Bellevue_Sottise_1', 'TONUMBER': 95, 'TOEXNAME': 'Sottise_66kV_66.0'}, 'Amaury_22kV_1_PlaineDesRochesPowerStation_22kV_22kV_PlaineDesRochesPowerStation_Li': {'TONAME': 'PlaineDesRochesPowerStation_22kV', 'FROMNUMBER': 0, 'FROMEXNAME': 'Amaury_22kV_1_22.0', 'FROMNAME': 'Amaury_22kV_1', 'ID': '22kV_PlaineDesRochesPowerStation', 'TONUMBER': 90, 'TOEXNAME': 'PlaineDesRochesPowerStation_22kV_22.0'}, 'Jin_Fei_66kV_Bellevue_66kV_66kV_Bellevue_Jin_Fei_Li': {'TONAME': 'Bellevue_66kV', 'FROMNUMBER': 71, 'FROMEXNAME': 'Jin_Fei_66kV_66.0', 'FROMNAME': 'Jin_Fei_66kV', 'ID': '66kV_Bellevue_Jin_Fei', 'TONUMBER': 10, 'TOEXNAME': 'Bellevue_66kV_66.0'}, 'Inter_CN_CO_66kV_CaseNoyale_66kV_66kV_Combo_CaseNoyale_PartUGC_Li': {'TONAME': 'CaseNoyale_66kV', 'FROMNUMBER': 66, 'FROMEXNAME': 'Inter_CN_CO_66kV_66.0', 'FROMNAME': 'Inter_CN_CO_66kV', 'ID': '66kV_Combo_CaseNoyale_PartUGC', 'TONUMBER': 21, 'TOEXNAME': 'CaseNoyale_66kV_66.0'}, 'Champagne_66kV_Fuel_66kV_66kV_Champagne_Fuel_Li': {'TONAME': 'Fuel_66kV', 'FROMNUMBER': 25, 'FROMEXNAME': 'Champagne_66kV_66.0', 'FROMNAME': 'Champagne_66kV', 'ID': '66kV_Champagne_Fuel', 'TONUMBER': 58, 'TOEXNAME': 'Fuel_66kV_66.0'}, 'Inter_Anahita_Fuel_66kV_Fuel_66kV_66kV_Anahita_Fuel_UGC_Li': {'TONAME': 'Fuel_66kV', 'FROMNUMBER': 65, 'FROMEXNAME': 'Inter_Anahita_Fuel_66kV_66.0', 'FROMNAME': 'Inter_Anahita_Fuel_66kV', 'ID': '66kV_Anahita_Fuel_UGC', 'TONUMBER': 58, 'TOEXNAME': 'Fuel_66kV_66.0'}} +TransfoDico = {'Anahita_66kV_Anahita_22kV_1_Anahita_TS1_Tr': {'TONAME': 'Anahita_22kV_1', 'FROMNUMBER': 5, '#WIND': 2, 'FROMEXNAME': 'Anahita_66kV_66.0', 'FROMNAME': 'Anahita_66kV', 'ID': 'Anahita_TS1', 'TONUMBER': 3, 'TOEXNAME': 'Anahita_22kV_122.0'}, 'FVPS_66kV_FVPS_Ugen_3_FVPS_TP_2_Tr': {'TONAME': 'FVPS_Ugen_3', 'FROMNUMBER': 45, '#WIND': 2, 'FROMEXNAME': 'FVPS_66kV_66.0', 'FROMNAME': 'FVPS_66kV', 'ID': 'FVPS_TP_2', 'TONUMBER': 48, 'TOEXNAME': 'FVPS_Ugen_311.0'}, 'NIPS_66kV_NIPS_G1_Ugen_NIPS_TP1_Tr': {'TONAME': 'NIPS_G1_Ugen', 'FROMNUMBER': 84, '#WIND': 2, 'FROMEXNAME': 'NIPS_66kV_66.0', 'FROMNAME': 'NIPS_66kV', 'ID': 'NIPS_TP1', 'TONUMBER': 85, 'TOEXNAME': 'NIPS_G1_Ugen11.0'}, 'CTSAV_G1_66kV_CTSAV_G1_Ugen_CTSAV_G1_TP_Tr': {'TONAME': 'CTSAV_G1_Ugen', 'FROMNUMBER': 15, '#WIND': 2, 'FROMEXNAME': 'CTSAV_G1_66kV_66.0', 'FROMNAME': 'CTSAV_G1_66kV', 'ID': 'CTSAV_G1_TP', 'TONUMBER': 16, 'TOEXNAME': 'CTSAV_G1_Ugen11.0'}, 'FortGeorge_66kV_FGPS_Ugen1_FGPS_TP1_Tr': {'TONAME': 'FGPS_Ugen1', 'FROMNUMBER': 55, '#WIND': 2, 'FROMEXNAME': 'FortGeorge_66kV_66.0', 'FROMNAME': 'FortGeorge_66kV', 'ID': 'FGPS_TP1', 'TONUMBER': 37, 'TOEXNAME': 'FGPS_Ugen111.0'}, 'StLouis_66kV_StLouis_Ugen_12_StLouisG12_TP_Tr': {'TONAME': 'StLouis_Ugen_12', 'FROMNUMBER': 98, '#WIND': 2, 'FROMEXNAME': 'StLouis_66kV_66.0', 'FROMNAME': 'StLouis_66kV', 'ID': 'StLouisG12_TP', 'TONUMBER': 101, 'TOEXNAME': 'StLouis_Ugen_1211.0'}, 'Henrietta_22kV_1_Tamarind_G1_Ugen_Tamarind_G1_TP_Tr': {'TONAME': 'Tamarind_G1_Ugen', 'FROMNUMBER': 62, '#WIND': 2, 'FROMEXNAME': 'Henrietta_22kV_1_22.0', 'FROMNAME': 'Henrietta_22kV_1', 'ID': 'Tamarind_G1_TP', 'TONUMBER': 106, 'TOEXNAME': 'Tamarind_G1_Ugen6.599999904632568'}, 'FortGeorge_66kV_FGPS_Ugen5_FGPS_TP5_Tr': {'TONAME': 'FGPS_Ugen5', 'FROMNUMBER': 55, '#WIND': 2, 'FROMEXNAME': 'FortGeorge_66kV_66.0', 'FROMNAME': 'FortGeorge_66kV', 'ID': 'FGPS_TP5', 'TONUMBER': 41, 'TOEXNAME': 'FGPS_Ugen511.0'}, 'Sarako_66kV_Sarako_22kV_Sarako_TP_Tr': {'TONAME': 'Sarako_22kV', 'FROMNUMBER': 92, '#WIND': 2, 'FROMEXNAME': 'Sarako_66kV_66.0', 'FROMNAME': 'Sarako_66kV', 'ID': 'Sarako_TP', 'TONUMBER': 91, 'TOEXNAME': 'Sarako_22kV22.0'}, 'Sottise_66kV_Sottise_22kV_1_Sottise_TS1_Tr': {'TONAME': 'Sottise_22kV_1', 'FROMNUMBER': 95, '#WIND': 2, 'FROMEXNAME': 'Sottise_66kV_66.0', 'FROMNAME': 'Sottise_66kV', 'ID': 'Sottise_TS1', 'TONUMBER': 93, 'TOEXNAME': 'Sottise_22kV_122.0'}, 'FortGeorge_66kV_FortGeorge_22kV_1_FortGeorge_TS3_Tr': {'TONAME': 'FortGeorge_22kV_1', 'FROMNUMBER': 55, '#WIND': 2, 'FROMEXNAME': 'FortGeorge_66kV_66.0', 'FROMNAME': 'FortGeorge_66kV', 'ID': 'FortGeorge_TS3', 'TONUMBER': 53, 'TOEXNAME': 'FortGeorge_22kV_122.0'}, 'CTDS_G1_66kV_CTDS_G1_Ugen_CTDS_G1_TP_Tr': {'TONAME': 'CTDS_G1_Ugen', 'FROMNUMBER': 13, '#WIND': 2, 'FROMEXNAME': 'CTDS_G1_66kV_66.0', 'FROMNAME': 'CTDS_G1_66kV', 'ID': 'CTDS_G1_TP', 'TONUMBER': 14, 'TOEXNAME': 'CTDS_G1_Ugen11.0'}, 'BeauchampPowerStation_66kV_Beauchamp_G1_Ugen_Beauchamp_G1_TP_Tr': {'TONAME': 'Beauchamp_G1_Ugen', 'FROMNUMBER': 6, '#WIND': 2, 'FROMEXNAME': 'BeauchampPowerStation_66kV_66.0', 'FROMNAME': 'BeauchampPowerStation_66kV', 'ID': 'Beauchamp_G1_TP', 'TONUMBER': 7, 'TOEXNAME': 'Beauchamp_G1_Ugen15.0'}, 'CTSAV_G2_66kV_CTSAV_G2_Ugen_CTSAV_G2_TP_Tr': {'TONAME': 'CTSAV_G2_Ugen', 'FROMNUMBER': 17, '#WIND': 2, 'FROMEXNAME': 'CTSAV_G2_66kV_66.0', 'FROMNAME': 'CTSAV_G2_66kV', 'ID': 'CTSAV_G2_TP', 'TONUMBER': 18, 'TOEXNAME': 'CTSAV_G2_Ugen11.0'}, 'FVPS_22kV_3_FVPS_Ugen_3_FVPS_TS3_Tr': {'TONAME': 'FVPS_Ugen_3', 'FROMNUMBER': 44, '#WIND': 2, 'FROMEXNAME': 'FVPS_22kV_3_22.0', 'FROMNAME': 'FVPS_22kV_3', 'ID': 'FVPS_TS3', 'TONUMBER': 48, 'TOEXNAME': 'FVPS_Ugen_311.0'}, 'Cecile_22kV_Cecile_G1_Ugen_Cecile_G2_TP2_Tr': {'TONAME': 'Cecile_G1_Ugen', 'FROMNUMBER': 22, '#WIND': 2, 'FROMEXNAME': 'Cecile_22kV_22.0', 'FROMNAME': 'Cecile_22kV', 'ID': 'Cecile_G2_TP2', 'TONUMBER': 23, 'TOEXNAME': 'Cecile_G1_Ugen6.599999904632568'}, 'Medine_22kV_1_Medine_G1_Ugen_Medine_G1_TP_Tr': {'TONAME': 'Medine_G1_Ugen', 'FROMNUMBER': 80, '#WIND': 2, 'FROMEXNAME': 'Medine_22kV_1_22.0', 'FROMNAME': 'Medine_22kV_1', 'ID': 'Medine_G1_TP', 'TONUMBER': 82, 'TOEXNAME': 'Medine_G1_Ugen6.599999904632568'}, 'Champagne_66kV_Champagne_22kV_Champagne_TS1_Tr': {'TONAME': 'Champagne_22kV', 'FROMNUMBER': 25, '#WIND': 2, 'FROMEXNAME': 'Champagne_66kV_66.0', 'FROMNAME': 'Champagne_66kV', 'ID': 'Champagne_TS1', 'TONUMBER': 24, 'TOEXNAME': 'Champagne_22kV22.0'}, 'Henrietta_22kV_2_Magenta_G1_Ugen_Magenta_G1_TP_Tr': {'TONAME': 'Magenta_G1_Ugen', 'FROMNUMBER': 63, '#WIND': 2, 'FROMEXNAME': 'Henrietta_22kV_2_22.0', 'FROMNAME': 'Henrietta_22kV_2', 'ID': 'Magenta_G1_TP', 'TONUMBER': 79, 'TOEXNAME': 'Magenta_G1_Ugen6.599999904632568'}, 'UnionVale_66kV_UnionVale_22kV_2_UnionVale_TS2_Tr': {'TONAME': 'UnionVale_22kV_2', 'FROMNUMBER': 120, '#WIND': 2, 'FROMEXNAME': 'UnionVale_66kV_66.0', 'FROMNAME': 'UnionVale_66kV', 'ID': 'UnionVale_TS2', 'TONUMBER': 119, 'TOEXNAME': 'UnionVale_22kV_222.0'}, 'StLouis_66kV_StLouis_Ugen_10_StLouisG10_TP_Tr': {'TONAME': 'StLouis_Ugen_10', 'FROMNUMBER': 98, '#WIND': 2, 'FROMEXNAME': 'StLouis_66kV_66.0', 'FROMNAME': 'StLouis_66kV', 'ID': 'StLouisG10_TP', 'TONUMBER': 99, 'TOEXNAME': 'StLouis_Ugen_1011.0'}, 'Amaury_66kV_Amaury_22kV_2_Amaury_TS2_Tr': {'TONAME': 'Amaury_22kV_2', 'FROMNUMBER': 2, '#WIND': 2, 'FROMEXNAME': 'Amaury_66kV_66.0', 'FROMNAME': 'Amaury_66kV', 'ID': 'Amaury_TS2', 'TONUMBER': 1, 'TOEXNAME': 'Amaury_22kV_222.0'}, 'Bellevue_66kV_Bellevue_22kV_1_Bellevue_TS1_Tr': {'TONAME': 'Bellevue_22kV_1', 'FROMNUMBER': 10, '#WIND': 2, 'FROMEXNAME': 'Bellevue_66kV_66.0', 'FROMNAME': 'Bellevue_66kV', 'ID': 'Bellevue_TS1', 'TONUMBER': 8, 'TOEXNAME': 'Bellevue_22kV_122.0'}, 'Medine_22kV_2_Medine_G2_Ugen_Medine_G2_TP_Tr': {'TONAME': 'Medine_G2_Ugen', 'FROMNUMBER': 81, '#WIND': 2, 'FROMEXNAME': 'Medine_22kV_2_22.0', 'FROMNAME': 'Medine_22kV_2', 'ID': 'Medine_G2_TP', 'TONUMBER': 83, 'TOEXNAME': 'Medine_G2_Ugen6.599999904632568'}, 'NIPS_66kV_Nicolay_22kV_1_Nicolay_TS1_Tr': {'TONAME': 'Nicolay_22kV_1', 'FROMNUMBER': 84, '#WIND': 2, 'FROMEXNAME': 'NIPS_66kV_66.0', 'FROMNAME': 'NIPS_66kV', 'ID': 'Nicolay_TS1', 'TONUMBER': 88, 'TOEXNAME': 'Nicolay_22kV_122.0'}, 'Fuel_66kV_Fuel_22kV_2_Fuel_TS2_Tr': {'TONAME': 'Fuel_22kV_2', 'FROMNUMBER': 58, '#WIND': 2, 'FROMEXNAME': 'Fuel_66kV_66.0', 'FROMNAME': 'Fuel_66kV', 'ID': 'Fuel_TS2', 'TONUMBER': 57, 'TOEXNAME': 'Fuel_22kV_222.0'}, 'FVPS_66kV_FVPS_Ugen_3_FVPS_TP_4_Tr': {'TONAME': 'FVPS_Ugen_3', 'FROMNUMBER': 45, '#WIND': 2, 'FROMEXNAME': 'FVPS_66kV_66.0', 'FROMNAME': 'FVPS_66kV', 'ID': 'FVPS_TP_4', 'TONUMBER': 48, 'TOEXNAME': 'FVPS_Ugen_311.0'}, 'StLouis_66kV_StLouis_22kV_1_StLouis_TS1_Tr': {'TONAME': 'StLouis_22kV_1', 'FROMNUMBER': 98, '#WIND': 2, 'FROMEXNAME': 'StLouis_66kV_66.0', 'FROMNAME': 'StLouis_66kV', 'ID': 'StLouis_TS1', 'TONUMBER': 96, 'TOEXNAME': 'StLouis_22kV_122.0'}, 'StLouis_66kV_StLouis_Ugen_7_StLouisG7_TP_Tr': {'TONAME': 'StLouis_Ugen_7', 'FROMNUMBER': 98, '#WIND': 2, 'FROMEXNAME': 'StLouis_66kV_66.0', 'FROMNAME': 'StLouis_66kV', 'ID': 'StLouisG7_TP', 'TONUMBER': 103, 'TOEXNAME': 'StLouis_Ugen_711.0'}, 'UnionVale_66kV_UnionVale_22kV_1_UnionVale_TS1_Tr': {'TONAME': 'UnionVale_22kV_1', 'FROMNUMBER': 120, '#WIND': 2, 'FROMEXNAME': 'UnionVale_66kV_66.0', 'FROMNAME': 'UnionVale_66kV', 'ID': 'UnionVale_TS1', 'TONUMBER': 118, 'TOEXNAME': 'UnionVale_22kV_122.0'}, 'Bellevue_66kV_Bellevue_G1_Ugen_Bellevue_G1_TP_Tr': {'TONAME': 'Bellevue_G1_Ugen', 'FROMNUMBER': 10, '#WIND': 2, 'FROMEXNAME': 'Bellevue_66kV_66.0', 'FROMNAME': 'Bellevue_66kV', 'ID': 'Bellevue_G1_TP', 'TONUMBER': 11, 'TOEXNAME': 'Bellevue_G1_Ugen11.0'}, 'Bellevue_66kV_Bellevue_G2_Ugen_Bellevue_G2_TP_Tr': {'TONAME': 'Bellevue_G2_Ugen', 'FROMNUMBER': 10, '#WIND': 2, 'FROMEXNAME': 'Bellevue_66kV_66.0', 'FROMNAME': 'Bellevue_66kV', 'ID': 'Bellevue_G2_TP', 'TONUMBER': 12, 'TOEXNAME': 'Bellevue_G2_Ugen11.0'}, 'Fuel_PowerStation_66kV_Fuel_G1_Ugen_Fuel_G1_TP_Tr': {'TONAME': 'Fuel_G1_Ugen', 'FROMNUMBER': 61, '#WIND': 2, 'FROMEXNAME': 'Fuel_PowerStation_66kV_66.0', 'FROMNAME': 'Fuel_PowerStation_66kV', 'ID': 'Fuel_G1_TP', 'TONUMBER': 59, 'TOEXNAME': 'Fuel_G1_Ugen6.599999904632568'}, 'LeVal_22kV_LeVal_G1_Ugen_LeVal_TP1_Tr': {'TONAME': 'LeVal_G1_Ugen', 'FROMNUMBER': 76, '#WIND': 2, 'FROMEXNAME': 'LeVal_22kV_22.0', 'FROMNAME': 'LeVal_22kV', 'ID': 'LeVal_TP1', 'TONUMBER': 77, 'TOEXNAME': 'LeVal_G1_Ugen6.599999904632568'}, 'StLouis_66kV_StLouis_22kV_2_StLouis_TS2_Tr': {'TONAME': 'StLouis_22kV_2', 'FROMNUMBER': 98, '#WIND': 2, 'FROMEXNAME': 'StLouis_66kV_66.0', 'FROMNAME': 'StLouis_66kV', 'ID': 'StLouis_TS2', 'TONUMBER': 97, 'TOEXNAME': 'StLouis_22kV_222.0'}, 'Ebene_66kV_Ebene_22kV_3_Ebene_TS3_Tr': {'TONAME': 'Ebene_22kV_3', 'FROMNUMBER': 36, '#WIND': 2, 'FROMEXNAME': 'Ebene_66kV_66.0', 'FROMNAME': 'Ebene_66kV', 'ID': 'Ebene_TS3', 'TONUMBER': 35, 'TOEXNAME': 'Ebene_22kV_322.0'}, 'StLouis_66kV_StLouis_Ugen_9_StLouisG9_TP_Tr': {'TONAME': 'StLouis_Ugen_9', 'FROMNUMBER': 98, '#WIND': 2, 'FROMEXNAME': 'StLouis_66kV_66.0', 'FROMNAME': 'StLouis_66kV', 'ID': 'StLouisG9_TP', 'TONUMBER': 105, 'TOEXNAME': 'StLouis_Ugen_911.0'}, 'LaChaumiere_66kV_LaChaumiere_22kV_2_LaChaumiere_TS2_Tr': {'TONAME': 'LaChaumiere_22kV_2', 'FROMNUMBER': 74, '#WIND': 2, 'FROMEXNAME': 'LaChaumiere_66kV_66.0', 'FROMNAME': 'LaChaumiere_66kV', 'ID': 'LaChaumiere_TS2', 'TONUMBER': 73, 'TOEXNAME': 'LaChaumiere_22kV_222.0'}, 'StLouis_66kV_StLouis_Ugen_8_StLouisG8_TP_Tr': {'TONAME': 'StLouis_Ugen_8', 'FROMNUMBER': 98, '#WIND': 2, 'FROMEXNAME': 'StLouis_66kV_66.0', 'FROMNAME': 'StLouis_66kV', 'ID': 'StLouisG8_TP', 'TONUMBER': 104, 'TOEXNAME': 'StLouis_Ugen_811.0'}, 'Ferney_22kV_Ferney_G2_Ugen_Ferney_G2_TP_Tr': {'TONAME': 'Ferney_G2_Ugen', 'FROMNUMBER': 50, '#WIND': 2, 'FROMEXNAME': 'Ferney_22kV_22.0', 'FROMNAME': 'Ferney_22kV', 'ID': 'Ferney_G2_TP', 'TONUMBER': 52, 'TOEXNAME': 'Ferney_G2_Ugen6.599999904632568'}, 'Ebene_66kV_Ebene_22kV_2_Ebene_TS2_Tr': {'TONAME': 'Ebene_22kV_2', 'FROMNUMBER': 36, '#WIND': 2, 'FROMEXNAME': 'Ebene_66kV_66.0', 'FROMNAME': 'Ebene_66kV', 'ID': 'Ebene_TS2', 'TONUMBER': 34, 'TOEXNAME': 'Ebene_22kV_222.0'}, 'Combo_66kV_Combo_22kV_1_Combo_TS1_Tr': {'TONAME': 'Combo_22kV_1', 'FROMNUMBER': 30, '#WIND': 2, 'FROMEXNAME': 'Combo_66kV_66.0', 'FROMNAME': 'Combo_66kV', 'ID': 'Combo_TS1', 'TONUMBER': 28, 'TOEXNAME': 'Combo_22kV_122.0'}, 'Anahita_66kV_Anahita_22kV_2_Anahita_TS2_Tr': {'TONAME': 'Anahita_22kV_2', 'FROMNUMBER': 5, '#WIND': 2, 'FROMEXNAME': 'Anahita_66kV_66.0', 'FROMNAME': 'Anahita_66kV', 'ID': 'Anahita_TS2', 'TONUMBER': 4, 'TOEXNAME': 'Anahita_22kV_222.0'}, 'FortGeorge_66kV_FGPS_Ugen4_FGPS_TP4_Tr': {'TONAME': 'FGPS_Ugen4', 'FROMNUMBER': 55, '#WIND': 2, 'FROMEXNAME': 'FortGeorge_66kV_66.0', 'FROMNAME': 'FortGeorge_66kV', 'ID': 'FGPS_TP4', 'TONUMBER': 40, 'TOEXNAME': 'FGPS_Ugen411.0'}, 'CaseNoyale_66kV_CaseNoyale_22kV_1_CaseNoyale_TS1_Tr': {'TONAME': 'CaseNoyale_22kV_1', 'FROMNUMBER': 21, '#WIND': 2, 'FROMEXNAME': 'CaseNoyale_66kV_66.0', 'FROMNAME': 'CaseNoyale_66kV', 'ID': 'CaseNoyale_TS1', 'TONUMBER': 19, 'TOEXNAME': 'CaseNoyale_22kV_122.0'}, 'Sottise_66kV_Sottise_22kV_2_Sottise_TS2_Tr': {'TONAME': 'Sottise_22kV_2', 'FROMNUMBER': 95, '#WIND': 2, 'FROMEXNAME': 'Sottise_66kV_66.0', 'FROMNAME': 'Sottise_66kV', 'ID': 'Sottise_TS2', 'TONUMBER': 94, 'TOEXNAME': 'Sottise_22kV_222.0'}, 'Jin_Fei_66kV_Jin_Fei_22kV_1_Jin_Fei_TS1_Tr': {'TONAME': 'Jin_Fei_22kV_1', 'FROMNUMBER': 71, '#WIND': 2, 'FROMEXNAME': 'Jin_Fei_66kV_66.0', 'FROMNAME': 'Jin_Fei_66kV', 'ID': 'Jin_Fei_TS1', 'TONUMBER': 69, 'TOEXNAME': 'Jin_Fei_22kV_122.0'}, 'TourKoening_66kV_TourKoening_22kV_2_TourKoening_TS2_Tr': {'TONAME': 'TourKoening_22kV_2', 'FROMNUMBER': 117, '#WIND': 2, 'FROMEXNAME': 'TourKoening_66kV_66.0', 'FROMNAME': 'TourKoening_66kV', 'ID': 'TourKoening_TS2', 'TONUMBER': 116, 'TOEXNAME': 'TourKoening_22kV_222.0'}, 'FortGeorge_66kV_FGPS_Ugen3_FGPS_TP3_Tr': {'TONAME': 'FGPS_Ugen3', 'FROMNUMBER': 55, '#WIND': 2, 'FROMEXNAME': 'FortGeorge_66kV_66.0', 'FROMNAME': 'FortGeorge_66kV', 'ID': 'FGPS_TP3', 'TONUMBER': 39, 'TOEXNAME': 'FGPS_Ugen311.0'}, 'CaseNoyale_66kV_CaseNoyale_22kV_2_CaseNoyale_TS2_Tr': {'TONAME': 'CaseNoyale_22kV_2', 'FROMNUMBER': 21, '#WIND': 2, 'FROMEXNAME': 'CaseNoyale_66kV_66.0', 'FROMNAME': 'CaseNoyale_66kV', 'ID': 'CaseNoyale_TS2', 'TONUMBER': 20, 'TOEXNAME': 'CaseNoyale_22kV_222.0'}, 'FVPS_22kV_1_FVPS_Ugen_2_FVPS_TS1_Tr': {'TONAME': 'FVPS_Ugen_2', 'FROMNUMBER': 42, '#WIND': 2, 'FROMEXNAME': 'FVPS_22kV_1_22.0', 'FROMNAME': 'FVPS_22kV_1', 'ID': 'FVPS_TS1', 'TONUMBER': 47, 'TOEXNAME': 'FVPS_Ugen_211.0'}, 'NIPS_66kV_NIPS_G3_Ugen_NIPS_TP3_Tr': {'TONAME': 'NIPS_G3_Ugen', 'FROMNUMBER': 84, '#WIND': 2, 'FROMEXNAME': 'NIPS_66kV_66.0', 'FROMNAME': 'NIPS_66kV', 'ID': 'NIPS_TP3', 'TONUMBER': 87, 'TOEXNAME': 'NIPS_G3_Ugen11.0'}, 'Fuel_66kV_Fuel_22kV_1_Fuel_TS1_Tr': {'TONAME': 'Fuel_22kV_1', 'FROMNUMBER': 58, '#WIND': 2, 'FROMEXNAME': 'Fuel_66kV_66.0', 'FROMNAME': 'Fuel_66kV', 'ID': 'Fuel_TS1', 'TONUMBER': 56, 'TOEXNAME': 'Fuel_22kV_122.0'}, 'Amaury_66kV_Amaury_22kV_1_Amaury_TS1_Tr': {'TONAME': 'Amaury_22kV_1', 'FROMNUMBER': 2, '#WIND': 2, 'FROMEXNAME': 'Amaury_66kV_66.0', 'FROMNAME': 'Amaury_66kV', 'ID': 'Amaury_TS1', 'TONUMBER': 0, 'TOEXNAME': 'Amaury_22kV_122.0'}, 'TourKoening_66kV_TourKoening_22kV_1_TourKoening_TS1_Tr': {'TONAME': 'TourKoening_22kV_1', 'FROMNUMBER': 117, '#WIND': 2, 'FROMEXNAME': 'TourKoening_66kV_66.0', 'FROMNAME': 'TourKoening_66kV', 'ID': 'TourKoening_TS1', 'TONUMBER': 115, 'TOEXNAME': 'TourKoening_22kV_122.0'}, 'Wooton_66kV_Wooton_22kV_2_Wooton_TS2_Tr': {'TONAME': 'Wooton_22kV_2', 'FROMNUMBER': 123, '#WIND': 2, 'FROMEXNAME': 'Wooton_66kV_66.0', 'FROMNAME': 'Wooton_66kV', 'ID': 'Wooton_TS2', 'TONUMBER': 122, 'TOEXNAME': 'Wooton_22kV_222.0'}, 'Ebene_66kV_Ebene_22kV_1_Ebene_TS1_Tr': {'TONAME': 'Ebene_22kV_1', 'FROMNUMBER': 36, '#WIND': 2, 'FROMEXNAME': 'Ebene_66kV_66.0', 'FROMNAME': 'Ebene_66kV', 'ID': 'Ebene_TS1', 'TONUMBER': 33, 'TOEXNAME': 'Ebene_22kV_122.0'}, 'Jin_Fei_66kV_Jin_Fei_22kV_2_Jin_Fei_TS2_Tr': {'TONAME': 'Jin_Fei_22kV_2', 'FROMNUMBER': 71, '#WIND': 2, 'FROMEXNAME': 'Jin_Fei_66kV_66.0', 'FROMNAME': 'Jin_Fei_66kV', 'ID': 'Jin_Fei_TS2', 'TONUMBER': 70, 'TOEXNAME': 'Jin_Fei_22kV_222.0'}, 'Fuel_PowerStation_66kV_Fuel_G2_Ugen_Fuel_G2_TP_Tr': {'TONAME': 'Fuel_G2_Ugen', 'FROMNUMBER': 61, '#WIND': 2, 'FROMEXNAME': 'Fuel_PowerStation_66kV_66.0', 'FROMNAME': 'Fuel_PowerStation_66kV', 'ID': 'Fuel_G2_TP', 'TONUMBER': 60, 'TOEXNAME': 'Fuel_G2_Ugen6.599999904632568'}, 'NIPS_66kV_Nicolay_22kV_2_Nicolay_TS2_Tr': {'TONAME': 'Nicolay_22kV_2', 'FROMNUMBER': 84, '#WIND': 2, 'FROMEXNAME': 'NIPS_66kV_66.0', 'FROMNAME': 'NIPS_66kV', 'ID': 'Nicolay_TS2', 'TONUMBER': 89, 'TOEXNAME': 'Nicolay_22kV_222.0'}, 'FVPS_66kV_FVPS_Ugen_2_FVPS_TP_1_Tr': {'TONAME': 'FVPS_Ugen_2', 'FROMNUMBER': 45, '#WIND': 2, 'FROMEXNAME': 'FVPS_66kV_66.0', 'FROMNAME': 'FVPS_66kV', 'ID': 'FVPS_TP_1', 'TONUMBER': 47, 'TOEXNAME': 'FVPS_Ugen_211.0'}, 'FortGeorge_66kV_FortGeorge_22kV_1_FortGeorge_TS1_Tr': {'TONAME': 'FortGeorge_22kV_1', 'FROMNUMBER': 55, '#WIND': 2, 'FROMEXNAME': 'FortGeorge_66kV_66.0', 'FROMNAME': 'FortGeorge_66kV', 'ID': 'FortGeorge_TS1', 'TONUMBER': 53, 'TOEXNAME': 'FortGeorge_22kV_122.0'}, 'Henrietta_66kV_Henrietta_22kV_2_Henrietta_TS2_Tr': {'TONAME': 'Henrietta_22kV_2', 'FROMNUMBER': 64, '#WIND': 2, 'FROMEXNAME': 'Henrietta_66kV_66.0', 'FROMNAME': 'Henrietta_66kV', 'ID': 'Henrietta_TS2', 'TONUMBER': 63, 'TOEXNAME': 'Henrietta_22kV_222.0'}, 'Wooton_66kV_Wooton_22kV_1_Wooton_TS1_Tr': {'TONAME': 'Wooton_22kV_1', 'FROMNUMBER': 123, '#WIND': 2, 'FROMEXNAME': 'Wooton_66kV_66.0', 'FROMNAME': 'Wooton_66kV', 'ID': 'Wooton_TS1', 'TONUMBER': 121, 'TOEXNAME': 'Wooton_22kV_122.0'}, 'NIPS_66kV_NIPS_G2_Ugen_NIPS_TP2_Tr': {'TONAME': 'NIPS_G2_Ugen', 'FROMNUMBER': 84, '#WIND': 2, 'FROMEXNAME': 'NIPS_66kV_66.0', 'FROMNAME': 'NIPS_66kV', 'ID': 'NIPS_TP2', 'TONUMBER': 86, 'TOEXNAME': 'NIPS_G2_Ugen11.0'}, 'FortGeorge_66kV_FortGeorge_22kV_2_FortGeorge_TS2_Tr': {'TONAME': 'FortGeorge_22kV_2', 'FROMNUMBER': 55, '#WIND': 2, 'FROMEXNAME': 'FortGeorge_66kV_66.0', 'FROMNAME': 'FortGeorge_66kV', 'ID': 'FortGeorge_TS2', 'TONUMBER': 54, 'TOEXNAME': 'FortGeorge_22kV_222.0'}, 'StLouis_66kV_StLouis_Ugen_11_StLouisG11_TP_Tr': {'TONAME': 'StLouis_Ugen_11', 'FROMNUMBER': 98, '#WIND': 2, 'FROMEXNAME': 'StLouis_66kV_66.0', 'FROMNAME': 'StLouis_66kV', 'ID': 'StLouisG11_TP', 'TONUMBER': 100, 'TOEXNAME': 'StLouis_Ugen_1111.0'}, 'Combo_66kV_Combo_22kV_2_Combo_TS2_Tr': {'TONAME': 'Combo_22kV_2', 'FROMNUMBER': 30, '#WIND': 2, 'FROMEXNAME': 'Combo_66kV_66.0', 'FROMNAME': 'Combo_66kV', 'ID': 'Combo_TS2', 'TONUMBER': 29, 'TOEXNAME': 'Combo_22kV_222.0'}, 'Ferney_22kV_Ferney_G1_Ugen_Ferney_G1_TP_Tr': {'TONAME': 'Ferney_G1_Ugen', 'FROMNUMBER': 50, '#WIND': 2, 'FROMEXNAME': 'Ferney_22kV_22.0', 'FROMNAME': 'Ferney_22kV', 'ID': 'Ferney_G1_TP', 'TONUMBER': 51, 'TOEXNAME': 'Ferney_G1_Ugen6.599999904632568'}, 'Henrietta_66kV_Henrietta_22kV_1_Henrietta_TS1_Tr': {'TONAME': 'Henrietta_22kV_1', 'FROMNUMBER': 64, '#WIND': 2, 'FROMEXNAME': 'Henrietta_66kV_66.0', 'FROMNAME': 'Henrietta_66kV', 'ID': 'Henrietta_TS1', 'TONUMBER': 62, 'TOEXNAME': 'Henrietta_22kV_122.0'}, 'Cecile_22kV_Cecile_G1_Ugen_Cecile_G1_TP1_Tr': {'TONAME': 'Cecile_G1_Ugen', 'FROMNUMBER': 22, '#WIND': 2, 'FROMEXNAME': 'Cecile_22kV_22.0', 'FROMNAME': 'Cecile_22kV', 'ID': 'Cecile_G1_TP1', 'TONUMBER': 23, 'TOEXNAME': 'Cecile_G1_Ugen6.599999904632568'}, 'Champagne_66kV_Champagne_G1_Ugen_Champagne_G1_TP_Tr': {'TONAME': 'Champagne_G1_Ugen', 'FROMNUMBER': 25, '#WIND': 2, 'FROMEXNAME': 'Champagne_66kV_66.0', 'FROMNAME': 'Champagne_66kV', 'ID': 'Champagne_G1_TP', 'TONUMBER': 26, 'TOEXNAME': 'Champagne_G1_Ugen6.599999904632568'}, 'FVPS_66kV_FVPS_Ugen_2_FVPS_TP_3_Tr': {'TONAME': 'FVPS_Ugen_2', 'FROMNUMBER': 45, '#WIND': 2, 'FROMEXNAME': 'FVPS_66kV_66.0', 'FROMNAME': 'FVPS_66kV', 'ID': 'FVPS_TP_3', 'TONUMBER': 47, 'TOEXNAME': 'FVPS_Ugen_211.0'}, 'LeVal_22kV_LeVal_G2_Ugen_LeVal_TP2_Tr': {'TONAME': 'LeVal_G2_Ugen', 'FROMNUMBER': 76, '#WIND': 2, 'FROMEXNAME': 'LeVal_22kV_22.0', 'FROMNAME': 'LeVal_22kV', 'ID': 'LeVal_TP2', 'TONUMBER': 78, 'TOEXNAME': 'LeVal_G2_Ugen6.599999904632568'}, 'FortGeorge_66kV_FGPS_Ugen2_FGPS_TP2_Tr': {'TONAME': 'FGPS_Ugen2', 'FROMNUMBER': 55, '#WIND': 2, 'FROMEXNAME': 'FortGeorge_66kV_66.0', 'FROMNAME': 'FortGeorge_66kV', 'ID': 'FGPS_TP2', 'TONUMBER': 38, 'TOEXNAME': 'FGPS_Ugen211.0'}, 'Champagne_66kV_Champagne_G2_Ugen_Champagne_G2_TP_Tr': {'TONAME': 'Champagne_G2_Ugen', 'FROMNUMBER': 25, '#WIND': 2, 'FROMEXNAME': 'Champagne_66kV_66.0', 'FROMNAME': 'Champagne_66kV', 'ID': 'Champagne_G2_TP', 'TONUMBER': 27, 'TOEXNAME': 'Champagne_G2_Ugen6.599999904632568'}, 'LaChaumiere_22kV_2_LaFerme_G1_Ugen_LaFerme_TP_Tr': {'TONAME': 'LaFerme_G1_Ugen', 'FROMNUMBER': 73, '#WIND': 2, 'FROMEXNAME': 'LaChaumiere_22kV_2_22.0', 'FROMNAME': 'LaChaumiere_22kV_2', 'ID': 'LaFerme_TP', 'TONUMBER': 75, 'TOEXNAME': 'LaFerme_G1_Ugen6.599999904632568'}, 'FVPS_22kV_2_FVPS_Ugen_2_FVPS_TS2_Tr': {'TONAME': 'FVPS_Ugen_2', 'FROMNUMBER': 43, '#WIND': 2, 'FROMEXNAME': 'FVPS_22kV_2_22.0', 'FROMNAME': 'FVPS_22kV_2', 'ID': 'FVPS_TS2', 'TONUMBER': 47, 'TOEXNAME': 'FVPS_Ugen_211.0'}, 'LaChaumiere_66kV_LaChaumiere_22kV_1_LaChaumiere_TS1_Tr': {'TONAME': 'LaChaumiere_22kV_1', 'FROMNUMBER': 74, '#WIND': 2, 'FROMEXNAME': 'LaChaumiere_66kV_66.0', 'FROMNAME': 'LaChaumiere_66kV', 'ID': 'LaChaumiere_TS1', 'TONUMBER': 72, 'TOEXNAME': 'LaChaumiere_22kV_122.0'}, 'Bellevue_66kV_Bellevue_22kV_2_Bellevue_TS2_Tr': {'TONAME': 'Bellevue_22kV_2', 'FROMNUMBER': 10, '#WIND': 2, 'FROMEXNAME': 'Bellevue_66kV_66.0', 'FROMNAME': 'Bellevue_66kV', 'ID': 'Bellevue_TS2', 'TONUMBER': 9, 'TOEXNAME': 'Bellevue_22kV_222.0'}, 'StLouis_66kV_StLouis_Ugen_13_StLouisG13_TP_Tr': {'TONAME': 'StLouis_Ugen_13', 'FROMNUMBER': 98, '#WIND': 2, 'FROMEXNAME': 'StLouis_66kV_66.0', 'FROMNAME': 'StLouis_66kV', 'ID': 'StLouisG13_TP', 'TONUMBER': 102, 'TOEXNAME': 'StLouis_Ugen_1311.0'}} MotorDico = {} -Dico ={'DIRECTORY': {'PSSPY_path': 'C:\\Program Files (x86)\\PTI\\PSSE34\\PSSPY27', 'PSSE_path': 'C:\\Program Files (x86)\\PTI\\PSSE34\\PSSBIN', 'sav_file': 'X:/Small Grid PSSE/TestIsland_2015_OPF - Areas.sav', 'results_folder': 'X:/Small Grid PSSE/Results'}, 'PSSE_PARAMETERS': {'UNIT_COMMITMENT': True, 'I_MAX': 'RateA', 'DECIMAL_SEPARATOR': '.', 'FUEL_COST': True, 'ALGORITHM': 'Optimum Power Flow', 'MVAR_COST': False, 'ITERATION_LIMIT': 20, 'SAVE_CASE_BEFORE_UNIT_COMMITMENT': False, 'LOCK_TAPS': True, 'LOADSHEDDING_COST': False}, 'CORRELATION': {'CorrelationMatrix': ["['load']", '[1.0]']}, 'DISTRIBUTIONload': {'Load': ['CITYB30__Lo1', 'CITYC30__Lo1', 'CITYD30__Lo1', 'ODIESEL__Lo1'], 'A': 0.8, 'B': 0.9, 'Activated': True, 'Sampling': 'Same sample for all loads', 'ComponentType': 'Load', 'Law': 'Uniform', 'Type': 'Load Level'}, 'SIMULATION': {'NUMBER_PACKAGE': 1, 'SIZE_PACKAGE': 10}} \ No newline at end of file +Dico ={'DISTRIBUTIONROR': {'Generator': ['Cecile_G1_Ugen_genstat_Gr_RoR_Cecile', 'LaFerme_G1_Ugen_genstat_Gr_RoR_LaFerme', 'LeVal_G1_Ugen_genstat_Gr_RoR_LeVal_G1', 'LeVal_G2_Ugen_genstat_Gr_RoR_LeVal_G2', 'Magenta_G1_Ugen_genstat_Gr_RoR_Magenta', 'Tamarind_G1_Ugen_genstat_Gr_RoR_Tamarind'], 'FileName': 'C:\\Users\\H92579\\Desktop\\Ile Maurice_bug_nbScenario\\Periode Jour/Jour_RoR.csv', 'Activated': True, 'Sampling': 'Same sample for all generators', 'ComponentType': 'Generator', 'Law': 'PDF_from_file', 'Type': 'Generator Power Level'}, 'DISTRIBUTIONFERNEY': {'Generator': ['Ferney_G1_Ugen_genstat_Gr_HighDam_Ferney_G1', 'Ferney_G2_Ugen_genstat_Gr_HighDam_Ferney_G2'], 'FileName': 'C:\\Users\\H92579\\Desktop\\Ile Maurice_bug_nbScenario\\Periode Jour/Jour_Ferney.csv', 'Activated': True, 'Sampling': 'Same sample for all generators', 'ComponentType': 'Generator', 'Law': 'PDF_from_file', 'Type': 'Generator Power Level'}, 'PF_PARAMETERS': {'UNIT_COMMITMENT': True, 'LS_Q_CONVERGENCE_CRITERIA': False, 'DECIMAL_SEPARATOR': ',', 'ALGORITHM': 'Optimum Power Flow', 'OBJECTIVE_FUNCTION': 'MINIMISATION_OF_COST', 'NON_COST_OPTIMAL_SOLUTION_ALLOWED': True, 'ITERATION_INTERIOR': 700, 'LOCK_TAPS': True, 'LOAD_SHEDDING_ALLOWED': False}, 'DISTRIBUTIONEOL': {'Generator': ['Curepipe_22kV_genstat_Gr_EOL_PlaineSophie', 'PlaineDesRochesPowerStation_22kV_genstat_Gr_EOL_PlaindesRoches'], 'FileName': 'C:\\Users\\H92579\\Desktop\\Ile Maurice_bug_nbScenario\\Periode Jour/Jour_EOL.csv', 'Activated': True, 'Sampling': 'Same sample for all generators', 'ComponentType': 'Generator', 'Law': 'PDF_from_file', 'Type': 'Generator Power Level'}, 'DISTRIBUTIONPV': {'Generator': ['Amaury_22kV_1_genstat_Gr_PV_Amaury_1', 'Amaury_22kV_2_genstat_Gr_PV_Amaury_2', 'Amaury_22kV_2_genstat_Gr_PV_PetiteRetraite', 'Anahita_22kV_1_genstat_Gr_PV_Anahita_1', 'Anahita_22kV_2_genstat_Gr_PV_Anahita_2', 'Bellevue_22kV_1_genstat_Gr_PV_Bellevue_1', 'Bellevue_22kV_2_genstat_Gr_PV_Bellevue_2', 'CaseNoyale_22kV_1_genstat_Gr_PV_CaseNoyale_1', 'CaseNoyale_22kV_2_genstat_Gr_PV_CaseNoyale_2', 'Combo_22kV_1_genstat_Gr_PV_Combo_1', 'Combo_22kV_2_genstat_Gr_PV_Combo_2', 'Ebene_22kV_1_genstat_Gr_PV_Ebene_1', 'Ebene_22kV_2_genstat_Gr_PV_Ebene_2', 'Ebene_22kV_3_genstat_Gr_PV_Ebene_3', 'FVPS_22kV_1_genstat_Gr_PV_FVPS_1', 'FVPS_22kV_2_genstat_Gr_PV_FVPS_2', 'FVPS_22kV_3_genstat_Gr_PV_FVPS_3', 'Ferney_22kV_genstat_Gr_PV_Ferney_1', 'FortGeorge_22kV_1_genstat_Gr_PV_FortGeorge_1', 'FortGeorge_22kV_2_genstat_Gr_PV_FortGeorge_2', 'Fuel_22kV_1_genstat_Gr_PV_Fuel_1', 'Fuel_22kV_2_genstat_Gr_PV_Fuel_2', 'Henrietta_22kV_1_genstat_Gr_PV_Henrietta_1', 'Henrietta_22kV_2_genstat_Gr_PV_Henrietta_2', 'Jin_Fei_22kV_1_genstat_Gr_PV_Jin_Fei_2', 'Jin_Fei_22kV_2_genstat_Gr_PV_Jin_Fei_1', 'LaChaumiere_22kV_1_genstat_Gr_PV_LaChaumiere_1', 'LaChaumiere_22kV_2_genstat_Gr_PV_LaChaumiere_2', 'Nicolay_22kV_1_genstat_Gr_PV_Nicolay_1', 'Nicolay_22kV_2_genstat_Gr_PV_Nicolay_2', 'Sarako_22kV_genstat_Gr_PV_Sarako', 'Sottise_22kV_1_genstat_Gr_PV_Sottise_1', 'Sottise_22kV_2_genstat_Gr_PV_MonChoisy', 'Sottise_22kV_2_genstat_Gr_PV_Sottise_2', 'StLouis_22kV_1_genstat_Gr_PV_StLouis_1', 'StLouis_22kV_2_genstat_Gr_PV_StLouis_2', 'TourKoening_22kV_1_genstat_Gr_PV_TourKoening_1', 'TourKoening_22kV_2_genstat_Gr_PV_TourKoening_2', 'UnionVale_22kV_1_genstat_Gr_PV_UnionVale_1', 'UnionVale_22kV_2_genstat_Gr_PV_UnionVale_2', 'Wooton_22kV_1_genstat_Gr_PV_Esperance', 'Wooton_22kV_1_genstat_Gr_PV_Wooton_2', 'Wooton_22kV_2_genstat_Gr_PV_Wooton_1'], 'FileName': 'C:\\Users\\H92579\\Desktop\\Ile Maurice_bug_nbScenario\\Periode Jour/Jour_PV.csv', 'Activated': True, 'Sampling': 'Same sample for all generators', 'ComponentType': 'Generator', 'Law': 'PDF_from_file', 'Type': 'Generator Power Level'}, 'SIMULATION': {'NUMBER_PACKAGE': 1, 'SIZE_PACKAGE': 20}, 'CORRELATION': {'CorrelationMatrix': ["['EOL', 'CHAMPAGNE', 'FERNEY', 'LOAD', 'PV', 'ROR']", '[1.0, 0.0098, 0.0005, -0.1805, 0.136, -0.033]', '[0.0098, 1.0, 0.5138, 0.2386, -0.0539, -0.0371]', '[0.0005, 0.5138, 1.0, 0.3026, -0.0625, 0.0098]', '[-0.1805, 0.2386, 0.3026, 1.0, 0.1982, 0.0972]', '[0.136, -0.0539, -0.0625, 0.1982, 1.0, 0.0572]', '[-0.033, -0.0371, 0.0098, 0.0972, 0.0572, 1.0]']}, 'DIRECTORY': {'Python3_path': 'C:\\Python35', 'pfd_file': 'C:\\Users\\H92579\\Desktop\\Ile Maurice_bug_nbScenario/Maurice_2017_CoalSeasonJour.pfd', 'results_folder': 'C:\\Users\\H92579\\Desktop\\Ile Maurice_bug_nbScenario', 'PF_path': 'C:\\Program Files\\DIgSILENT\\PowerFactory 2017 SP1\\Python/3.5'}, 'DISTRIBUTIONCHAMPAGNE': {'Generator': ['Champagne_G1_Ugen_genstat_Gr_HighDam_Champagne_G1', 'Champagne_G2_Ugen_genstat_Gr_HighDam_Champagne_G2'], 'FileName': 'C:\\Users\\H92579\\Desktop\\Ile Maurice_bug_nbScenario\\Periode Jour/Jour_Champagne.csv', 'Activated': True, 'Sampling': 'Same sample for all generators', 'ComponentType': 'Generator', 'Law': 'PDF_from_file', 'Type': 'Generator Power Level'}, 'DISTRIBUTIONLOAD': {'Load': ['Amaury_22kV_1_Lo1', 'Amaury_22kV_2_Lo1', 'Anahita_22kV_1_Lo1', 'Anahita_22kV_2_Lo1', 'Bellevue_22kV_1_Lo1', 'Bellevue_22kV_2_Lo1', 'CaseNoyale_22kV_1_Lo1', 'CaseNoyale_22kV_2_Lo1', 'Combo_22kV_1_Lo1', 'Combo_22kV_2_Lo1', 'Ebene_22kV_1_Lo1', 'Ebene_22kV_2_Lo1', 'Ebene_22kV_3_Lo1', 'FVPS_22kV_1_Lo1', 'FVPS_22kV_2_Lo1', 'FVPS_22kV_3_Lo1', 'Ferney_22kV_Lo1', 'FortGeorge_22kV_1_Lo1', 'FortGeorge_22kV_2_Lo1', 'Fuel_22kV_1_Lo1', 'Fuel_22kV_2_Lo1', 'Henrietta_22kV_1_Lo1', 'Henrietta_22kV_2_Lo1', 'Jin_Fei_22kV_1_Lo1', 'Jin_Fei_22kV_2_Lo1', 'LaChaumiere_22kV_1_Lo1', 'LaChaumiere_22kV_2_Lo1', 'Nicolay_22kV_1_Lo1', 'Nicolay_22kV_2_Lo1', 'Sottise_22kV_1_Lo1', 'Sottise_22kV_2_Lo1', 'StLouis_22kV_1_Lo1', 'StLouis_22kV_2_Lo1', 'TourKoening_22kV_1_Lo1', 'TourKoening_22kV_2_Lo1', 'UnionVale_22kV_1_Lo1', 'UnionVale_22kV_2_Lo1', 'Wooton_22kV_1_Lo1', 'Wooton_22kV_2_Lo1'], 'FileName': 'C:\\Users\\H92579\\Desktop\\Ile Maurice_bug_nbScenario\\Periode Jour/Jour_Load.csv', 'Activated': True, 'Sampling': 'Same sample for all loads', 'ComponentType': 'Load', 'Law': 'PDF_from_file', 'Type': 'Load Level'}} \ No newline at end of file diff --git a/PSSE_PF_Eficas/PSEN/TEST.py b/PSSE_PF_Eficas/PSEN/TEST.py new file mode 100644 index 00000000..3d7b83e1 --- /dev/null +++ b/PSSE_PF_Eficas/PSEN/TEST.py @@ -0,0 +1,92 @@ +import os +import sys +import PSENconfig +from support_functionsPF import read_pfd + + +PF_PATH = r'C:\Program Files\DIgSILENT\PowerFactory 2017 SP1\Python\3.5' +NetworkFile = r'C:\Users\H92579\Documents\Formation_PF\ex_PFD\Modele_Corse_PSEN_peak_good.pfd' + +(filepath, filename) = os.path.split(NetworkFile) +sys.path.append(PF_PATH) +os.environ['PATH'] += ';' + os.path.dirname(os.path.dirname(PF_PATH)) + ';' + +PFParams = PSENconfig.Dico['PF_PARAMETERS'] + +import powerfactory + +app = powerfactory.GetApplication() +#app.Show() +user = app.GetCurrentUser() +ComImp = user.CreateObject('ComPFDIMPORT') + +app.SetWriteCacheEnabled(1) # Disable consistency check +ComImp.g_file = PSENconfig.Dico['DIRECTORY']['pfd_file'] +ComImp.g_target = user # project is imported under the user account +err = ComImp.Execute() # Execute command starts the import process +app.SetWriteCacheEnabled(0) # Enable consistency check +if err: + app.PrintError('Project could not be imported...') + exit() +prjs = user.GetContents('*.IntPrj') +prjs.sort(key=lambda x: x.gnrl_modif, reverse=True) +prj = prjs[0] +app.ActivateProject(prj.loc_name) +prj = app.GetActiveProject() +studycase = app.GetActiveStudyCase() +studycase.loc_name = 'BaseCase' +app.PrintPlain('Project %s has been successfully imported.' % prj) +ComImp.Delete() + +all_inputs_init=read_pfd(app,prj.loc_name,recal=1) + +all_inputs_base=all_inputs_init + +buses_base=[] +[buses_base.append(bus[0:8]) for bus in all_inputs_base[0]] + +lines_base = [] +[lines_base.append(bus[0:11]) for bus in all_inputs_base[1]] + +trans_base = [] +[trans_base.append(bus[0:11]) for bus in all_inputs_base[2]] + +plants_base = [] +[plants_base.append(bus[0:11]) for bus in all_inputs_base[3]] + +loads_base = [] +[loads_base.append(bus[0:6]) for bus in all_inputs_base[4]] + +shunt_base = [] +[shunt_base.append(bus[0:6]) for bus in all_inputs_base[5]] + +motors_base = [] +[motors_base.append(bus[0:6]) for bus in all_inputs_base[6]] + +trans3_base = [] +[trans3_base.append(bus[0:14]) for bus in all_inputs_base[7]] + +swshunt_base = [] +[swshunt_base.append(bus[0:6]) for bus in all_inputs_base[8]] + +############################################################################## + +filer=open('temp1.txt','r') +_path=[] +for line in filer: + _path.append(line) +filer.close() +path_save = _path[0].replace('\n','') +ldf = app.GetFromStudyCase('ComLdf') +ldf.iopt_net = 0 # AC load flow +ldf.iopt_at = 1 # automatic tap transfos +ldf.iopt_asht = 1 # automatic shunt +ldf.iopt_lim = 1 # reactive power limit +ldf.iopt_plim = 1 # active power limit +ldf.iopt_limScale = 1 # scale factor +ldf.iopt_noinit = 1 # no initialisation load flow +ldf.iopt_initOPF = 0 # utiliser pour OPF +ldf.iShowOutLoopMsg = 0 # show off output +ldf.iopt_show = 0 # show off output +ldf.iopt_check = 0 # show off output +ldf.iopt_chctr = 0 # show off output \ No newline at end of file diff --git a/PSSE_PF_Eficas/PSEN/absence0.txt b/PSSE_PF_Eficas/PSEN/absence0.txt new file mode 100644 index 00000000..d6b24041 --- /dev/null +++ b/PSSE_PF_Eficas/PSEN/absence0.txt @@ -0,0 +1 @@ +19 diff --git a/PSSE_PF_Eficas/PSEN/comfile.py b/PSSE_PF_Eficas/PSEN/comfile.py index f3e0d010..d7be171b 100644 --- a/PSSE_PF_Eficas/PSEN/comfile.py +++ b/PSSE_PF_Eficas/PSEN/comfile.py @@ -4,9 +4,7 @@ ############################################################ import os,sys,pickle,time -# from support_functionsPF import *#Valentin from support_functionsPF import read_pfd,read_pfd_simple,np, config_contingency -# import PSENconfig # Valentin # sys.path.append(PSENconfig.Dico['DIRECTORY']['PF_path'])#Valentin # os.environ['PATH'] += ';' + os.path.dirname(os.path.dirname(PSENconfig.Dico['DIRECTORY']['PF_path'])) + ';'#Valentin import powerfactory @@ -19,7 +17,7 @@ tempdir = r'C:\Logiciels DER\PSEN_PF_V4\Example\Results' app = powerfactory.GetApplication() # app.ActivateProject('39 genstatpvmoteur(4)')#Valentin -prj = app.GetActiveProject() +prj = app.GetActiveProject() case = app.GetActiveStudyCase()#prj.GetContents('Case_0.IntCase',1)[0] # case = prj.GetContents('Case_46.IntCase',1)[0]#Valentin # case.Activate()#Valentin @@ -73,7 +71,7 @@ def saveOPFresults(plants): # return -nn=int(''.join(ele for ele in case.loc_name if ele.isdigit()))# cas number +nn = int(''.join(ele for ele in case.loc_name if ele.isdigit()))# case number cas = int(nn) scenario_temporaire = app.GetActiveScenario() if scenario_temporaire: diff --git a/PSSE_PF_Eficas/PSEN/data_dico b/PSSE_PF_Eficas/PSEN/data_dico new file mode 100644 index 00000000..a5e1d95c Binary files /dev/null and b/PSSE_PF_Eficas/PSEN/data_dico differ diff --git a/PSSE_PF_Eficas/PSEN/support_functionsPF.py b/PSSE_PF_Eficas/PSEN/support_functionsPF.py index 88ce6e53..ad249c5d 100644 --- a/PSSE_PF_Eficas/PSEN/support_functionsPF.py +++ b/PSSE_PF_Eficas/PSEN/support_functionsPF.py @@ -205,44 +205,56 @@ def read_pfd(app,doc,recal=0): prj = app.GetActiveProject() studycase=app.GetActiveStudyCase() grids=studycase.GetChildren(1,'*.ElmNet',1)[0].contents + if recal == 1:#calculer load-flow ldf = app.GetFromStudyCase('ComLdf') ldf.Execute() #run + tous=[] for grid in grids: tous.extend(grid.obj_id.GetContents('*.ElmTerm', 1)) + bus = [] for noeud in tous: bus.append(noeud) + noeuds = sorted(bus, key=lambda x: x.cStatName) + buses = [] for ii in range(len(noeuds)): if noeuds[ii].HasResults(): - mu = noeuds[ii].GetAttribute('m:u') + mu = noeuds[ii].GetAttribute('m:u') mphiu = noeuds[ii].GetAttribute('m:phiu') else : - mu = 0 + mu = 0 mphiu = 0 + busname = noeuds[ii].cStatName.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_") - aa = [ii, noeuds[ii].uknom, mu, busname, noeuds[ii].vmin, - noeuds[ii].vmax, noeuds[ii].GetBusType(), mphiu,noeuds[ii]] - # [numero,nominal KV,magnitude p.u, busname,Vmin,Vmax,type,angle degre,obj] + + aa = [ii, noeuds[ii].uknom, mu, busname, noeuds[ii].vmin, noeuds[ii].vmax, noeuds[ii].GetBusType(), mphiu,noeuds[ii]] # [numero,nominal KV,magnitude p.u, busname,Vmin,Vmax,type,angle degre,obj] + buses.append(aa) - ##== == == == == == == == == == = Line===================== Line===================== Line - # lignes = app.GetCalcRelevantObjects('*.ElmLne', 0) + + + ## Line ## + + tous=[] for grid in grids: tous.extend(grid.obj_id.GetContents( '*.ElmLne', 1)) + lines=[] for line in tous: - frombus_name=line.bus1.cBusBar.cStatName + frombus_name = line.bus1.cBusBar.cStatName frombus_name = frombus_name.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_") + for ii in range(len(buses)): if frombus_name in buses[ii]: frombus_number=ii break - tobus_name=line.bus2.cBusBar.cStatName + + tobus_name = line.bus2.cBusBar.cStatName tobus_name = tobus_name.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_") for ii in range(len(buses)): if tobus_name in buses[ii]: diff --git a/PSSE_PF_Eficas/com.py b/PSSE_PF_Eficas/com.py index 83ff246f..b51cae0f 100644 --- a/PSSE_PF_Eficas/com.py +++ b/PSSE_PF_Eficas/com.py @@ -22,7 +22,8 @@ def PFExtractData(NetworkFile, PF_PATH): (filepath, filename) = os.path.split(NetworkFile) sys.path.append(PF_PATH) os.environ['PATH'] += ';' + os.path.dirname(os.path.dirname(PF_PATH)) + ';' - + + import powerfactory import powerfactory as pf app = pf.GetApplication() @@ -605,11 +606,11 @@ PF_path=_path[1].replace('\n','') MachineDico, LoadDico, LineDico, TransfoDico, MotorDico = PFExtractData(pfd_file,PF_path) Data={} -Data['MachineDico']=MachineDico -Data['LoadDico']=LoadDico -Data['LineDico']=LineDico -Data['TransfoDico']=TransfoDico -Data['MotorDico']=MotorDico +Data['MachineDico'] = MachineDico +Data['LoadDico'] = LoadDico +Data['LineDico'] = LineDico +Data['TransfoDico'] = TransfoDico +Data['MotorDico'] = MotorDico import pickle diff --git a/PSSE_PF_Eficas/opsPSEN_PF.py b/PSSE_PF_Eficas/opsPSEN_PF.py index d3d945bf..9e9626ae 100644 --- a/PSSE_PF_Eficas/opsPSEN_PF.py +++ b/PSSE_PF_Eficas/opsPSEN_PF.py @@ -93,11 +93,11 @@ def INCLUDE(self, PF_path, pfd_file,Python3_path, **args): self.old_context_fichier_init = self.contexte_fichier_init self.parent.record_unit(unite, self) - self.jdc.MachineDico=MachineDico - self.jdc.LoadDico=LoadDico - self.jdc.LineDico=LineDico - self.jdc.TransfoDico=TransfoDico - self.jdc.MotorDico = MotorDico + self.jdc.MachineDico = MachineDico + self.jdc.LoadDico = LoadDico + self.jdc.LineDico = LineDico + self.jdc.TransfoDico = TransfoDico + self.jdc.MotorDico = MotorDico if toClean: diff --git a/PSSE_PF_Eficas/report.txt b/PSSE_PF_Eficas/report.txt new file mode 100644 index 00000000..4021b62a --- /dev/null +++ b/PSSE_PF_Eficas/report.txt @@ -0,0 +1 @@ +Starting time: 0.002446; Monte Carlo Size : 10.000000; Starting time: 0.293662; Monte Carlo Size : 10.000000; Starting time: 0.001656; Monte Carlo Size : 10.000000; Starting time: 0.249637; Monte Carlo Size : 2.000000; Starting time: 0.001503; Monte Carlo Size : 3.000000; Starting time: 0.001179; Monte Carlo Size : 10.000000; Starting time: 0.001271; Monte Carlo Size : 10.000000; Starting time: 0.300779; Monte Carlo Size : 10.000000; Starting time: 0.001302; Monte Carlo Size : 10.000000; Starting time: 0.237096; Monte Carlo Size : 750.000000; Starting time: 0.304474; Monte Carlo Size : 10.000000; Starting time: 0.238076; Monte Carlo Size : 10.000000; Starting time: 0.185095; Monte Carlo Size : 10.000000; Starting time: 0.225074; Monte Carlo Size : 10.000000; Starting time: 0.006847; Monte Carlo Size : 10.000000; Starting time: 0.008662; Monte Carlo Size : 10.000000; Starting time: 0.281258; Monte Carlo Size : 10.000000; Starting time: 0.006176; Monte Carlo Size : 10.000000; Starting time: 0.320835; Monte Carlo Size : 10.000000; Starting time: 0.008815; Monte Carlo Size : 10.000000; Starting time: 0.005938; Monte Carlo Size : 10.000000; Starting time: 0.006103; Monte Carlo Size : 20.000000; Starting time: 0.008669; Monte Carlo Size : 20.000000; \ No newline at end of file diff --git a/PSSE_PF_Eficas/temp.txt b/PSSE_PF_Eficas/temp.txt index 3818feec..5ff5a627 100644 --- a/PSSE_PF_Eficas/temp.txt +++ b/PSSE_PF_Eficas/temp.txt @@ -1,3 +1,3 @@ -C:/Users/H92579/Documents/Formation_PF/ex_PFD/Mayotte_Test.pfd -C:/Program Files/DIgSILENT/PowerFactory 2018 SP3/Python/3.5 -C:/Python35 +C:\Users\H92579\Desktop\Ile Maurice_bug_nbScenario/Maurice_2017_CoalSeasonJour.pfd +C:\Program Files\DIgSILENT\PowerFactory 2017 SP1\Python/3.5 +C:\Python35 diff --git a/PSSE_PF_Eficas/temp1.txt b/PSSE_PF_Eficas/temp1.txt new file mode 100644 index 00000000..eb3d431f --- /dev/null +++ b/PSSE_PF_Eficas/temp1.txt @@ -0,0 +1 @@ +C:\Users\H92579\Desktop\Ile Maurice_bug_nbScenario/N_20190319_09h16m37\package0_N_20190319_09h16m37 diff --git a/ProcessOutputs_Eficas/PFExtractGeneratorLoadLineandTransfoDico.py b/ProcessOutputs_Eficas/PFExtractGeneratorLoadLineandTransfoDico.py new file mode 100644 index 00000000..e81c9f2a --- /dev/null +++ b/ProcessOutputs_Eficas/PFExtractGeneratorLoadLineandTransfoDico.py @@ -0,0 +1,392 @@ +import os, sys, pickle, copy, subprocess, collections +# import sys +import numpy as np +# import copy +import pdb + +#sys.path.append(r'C:\PSEN_V16\Code\ProcessOutputs_Eficas\TreatOutputs') +path1 = os.path.abspath(os.path.join(os.path.abspath(__file__), '../','TreatOutputs')) +sys.path.append(path1) +import Options + + +def getNominalkV(NetworkFile): + + with open('Data_for_interface', 'rb') as fichier:#prendre les donnees dans fichier pickle + mon_depickler = pickle.Unpickler(fichier) + data_file = mon_depickler.load() + # def convert(data):#traitement Unicode + # # if isinstance(data, basestring): + # if isinstance(data, str): + # return str(data) + # elif isinstance(data, collections.Mapping): + # return dict(map(convert, data.iteritems())) + # elif isinstance(data, collections.Iterable): + # return type(data)(map(convert, data)) + # else: + # return data + # data = convert(data_file) + ##################################### + def convert_keys_to_string(dictionary): + """Recursively converts dictionary keys to strings.""" + if not isinstance(dictionary, dict): + return dictionary + return dict((str(k), convert_keys_to_string(v)) for k, v in dictionary.items()) + + data = convert_keys_to_string(data_file) + BusDico=data['BusDico'] + MachineDico = data['MachineDico'] + LoadDico = data['LoadDico'] + LineDico = data['LineDico'] + TfoDico = data['TransfoDico'] + # MotorDico = data['MotorDico'] + + bus_kv=[] + for bus in BusDico: + bus_kv.append(bus[1]) + Options.BusBase=bus_kv + bus_list={} + for bus in BusDico: + bus_list[bus[2]]=bus[1] + Options.BusBaseList=bus_list + BusList = [] + for item in bus_kv: + if item not in BusList: + BusList.append(item) + BusList = sorted(BusList) + for line in LineDico.keys(): + kv = bus_list[LineDico[line]['FROMNAME']] + Options.LinesBaseList[line]=kv + Options.LinesBase.append(kv) + LinesList = [] + for item in Options.LinesBase: + if item not in LinesList: + LinesList.append(item) + LinesList = sorted(LinesList) + + for tfo in TfoDico.keys(): + kv1 = bus_list[TfoDico[tfo]['FROMNAME']] + kv2 = bus_list[TfoDico[tfo]['TONAME']] + kv=[kv1,kv2] + if tfo[-3:]=='Tr3': + kv3=bus_list[TfoDico[tfo]['3NAME']] + kv = [kv1, kv2,kv3] + Options.TransfoBaseList[tfo]=kv + Options.TransfoBase.append(kv) + + TransfosList = [] + for item in Options.TransfoBase: + string = str(item[0]) + ' - ' + str(item[1]) + if len(item) == 3: # 3 winding transformer + string += ' - ' + str(item[2]) + if string not in TransfosList: + TransfosList.append(string) + TransfosList = sorted(TransfosList) + # Generators + for gen in MachineDico.keys(): + Options.GenBaseList[gen]=MachineDico[gen]['NUMBER'] + + return BusList, LinesList, TransfosList,BusDico + +def updateConts(): + Options.ContFullList = [] + tmp = list(Options.BusBaseList.keys()) + tmp.sort() + for key in tmp: + Options.ContFullList.append(key) + tmp = list(Options.GenBaseList.keys()) + tmp.sort() + for key in tmp: + Options.ContFullList.append(key) + tmp = list(Options.LinesBaseList.keys()) + tmp.sort() + for key in tmp: + Options.ContFullList.append(key) + tmp = list(Options.TransfoBaseList.keys()) +## trs = [] +## for tr in tmp: +## if tr.split("__")[-1].startswith("3WNDTR"): +## b = tr.split('__') +## for j,val in enumerate(b): +## if val.startswith("Wnd"): +## del b[j] +## tfo = '__'.join(b) +## trs.append(tfo) + tmp.sort() + for key in tmp: + Options.ContFullList.append(key) + #print Options.ContFullList + return Options.ContFullList + +def newContingency(MatList): + Options.CustomContingencies.append(MatList) + +def checkIfBorder(graph, key, depth, tmplist): + #print "in checkifBorder" + #print "depth ",depth + #print graph + if key in tmplist: + return True + if depth == 0: + return False + NonBorders = 0 + for item in graph[key]: + if not checkIfBorder(graph, item, depth - 1, tmplist): + NonBorders += 1 + if NonBorders < 2: # A generator is considered as isolated if it has less than two non-borders neighbours + if key not in tmplist: + tmplist.append(key) + return True + return False + +def getTrueLines(NetworkFile): + with open('Data_for_interface', 'rb') as fichier: + mon_depickler = pickle.Unpickler(fichier) + data_file = mon_depickler.load() + + # def convert(data): + # if isinstance(data, basestring): + # return str(data) + # elif isinstance(data, collections.Mapping): + # return dict(map(convert, data.iteritems())) + # elif isinstance(data, collections.Iterable): + # return type(data)(map(convert, data)) + # else: + # return data + # + # data = convert(data_file) + def convert_keys_to_string(dictionary): + """Recursively converts dictionary keys to strings.""" + if not isinstance(dictionary, dict): + return dictionary + return dict((str(k), convert_keys_to_string(v)) for k, v in dictionary.items()) + + data = convert_keys_to_string(data_file) + BusDico=data['BusDico'] + MachineDico = data['MachineDico'] + LoadDico = data['LoadDico'] + LineDico = data['LineDico'] + TfoDico = data['TransfoDico'] + MotorDico = data['MotorDico'] + + lst = [] + tmplist = [] + for line in LineDico.keys(): + aa = LineDico[line]['FROMNUMBER'] + bb = LineDico[line]['TONUMBER'] + if aa not in lst and aa not in tmplist: + tmplist.append(aa) + elif aa not in lst and aa in tmplist: + tmplist.remove(aa) + lst.append(aa) + if bb not in lst and bb not in tmplist: + tmplist.append(bb) + elif bb not in lst and bb in tmplist: + tmplist.remove(bb) + lst.append(bb) + for tfo in TfoDico.keys(): + aa = TfoDico[tfo]['FROMNUMBER'] + bb = TfoDico[tfo]['TONUMBER'] + if aa not in lst and aa not in tmplist: + tmplist.append(aa) + elif aa not in lst and aa in tmplist: + tmplist.remove(aa) + lst.append(aa) + if bb not in lst and bb not in tmplist: + tmplist.append(bb) + elif bb not in lst and bb in tmplist: + tmplist.remove(bb) + lst.append(bb) + if tfo[-3:]=='TR3': + cc = TfoDico[tfo]['3NUMBER'] + if cc not in lst and cc not in tmplist: + tmplist.append(cc) + elif cc not in lst and cc in tmplist: + tmplist.remove(cc) + lst.append(cc) + + # Create the graph + graph = {} + for ii in range(len(BusDico)): + graph[ii]=[] + for var in LineDico.keys(): + if LineDico[var]['TONUMBER'] not in graph[LineDico[var]['FROMNUMBER']]: + graph[LineDico[var]['FROMNUMBER']].append(LineDico[var]['TONUMBER']) + if LineDico[var]['FROMNUMBER'] not in graph[LineDico[var]['TONUMBER']]: + graph[LineDico[var]['TONUMBER']].append(LineDico[var]['FROMNUMBER']) + for var in TfoDico.keys(): + if TfoDico[var]['TONUMBER'] not in graph[TfoDico[var]['FROMNUMBER']]: + graph[TfoDico[var]['FROMNUMBER']].append(TfoDico[var]['TONUMBER']) + if TfoDico[var]['FROMNUMBER'] not in graph[TfoDico[var]['TONUMBER']]: + graph[TfoDico[var]['TONUMBER']].append(TfoDico[var]['FROMNUMBER']) + if var[-3:]=='TR3': + if TfoDico[var]['3NUMBER'] not in graph[TfoDico[var]['FROMNUMBER']]: + graph[TfoDico[var]['FROMNUMBER']].append(TfoDico[var]['3NUMBER']) + if TfoDico[var]['3NUMBER'] not in graph[TfoDico[var]['TONUMBER']]: + graph[TfoDico[var]['TONUMBER']].append(TfoDico[var]['3NUMBER']) + if TfoDico[var]['FROMNUMBER'] not in graph[TfoDico[var]['3NUMBER']]: + graph[TfoDico[var]['3NUMBER']].append(TfoDico[var]['FROMNUMBER']) + if TfoDico[var]['FROMNUMBER'] not in graph[TfoDico[var]['3NUMBER']]: + graph[TfoDico[var]['3NUMBER']].append(TfoDico[var]['TONUMBER']) + + + for key in sorted(graph.keys()): + #print key + checkIfBorder(graph, key, Options.RecursiveDepth, tmplist) + #print "out of Checkif 0" + #print "" + for key in reversed(sorted(graph.keys())):# + checkIfBorder(graph, key, Options.RecursiveDepth, tmplist) + + Options.IsolatedGenList = [] + + if Options.RecursiveDepth > 0 : + # Unfold it + for ii in BusDico: + if ii[0] in tmplist: + if ii[2] not in Options.IsolatedGenList: + Options.IsolatedGenList.append(ii[2]) + + # for i in range(len(carray[0])): + # if carray[0][i] in tmplist: + # if iarray[0][i] not in Options.IsolatedGenList: + # Options.IsolatedGenList.append(iarray[0][i]) + # if carray[1][i] in tmplist: + # if iarray[1][i] not in Options.IsolatedGenList: + # Options.IsolatedGenList.append(iarray[1][i]) + # + # for i in range(len(darray[0])): + # if darray[0][i] in tmplist: + # if jarray[0][i] not in Options.IsolatedGenList: + # Options.IsolatedGenList.append(jarray[0][i]) + # if darray[1][i] in tmplist: + # if jarray[1][i] not in Options.IsolatedGenList: + # Options.IsolatedGenList.append(jarray[1][i]) + # if darray[2][i] in tmplist: + # if jarray[1][i] not in Options.IsolatedGenList: + # Options.IsolatedGenList.append(jarray[1][i]) + + lines = [] + outLines = [] + for line in LineDico.keys(): + if '@' in LineDico[line] or '*' in LineDico[line]: #breaker or switch in PSSE + outLines.append(line) + elif LineDico[line]['FROMNAME'] not in Options.IsolatedGenList and LineDico[line]['TONAME'] not in Options.IsolatedGenList: + lines.append(line) + else: + outLines.append(line) + for line in TfoDico.keys(): + if line[-3:]!='TR3': + if '@' in TfoDico[line] or '*' in TfoDico[line]: + outLines.append(line) + elif TfoDico[line]['FROMNAME'] not in Options.IsolatedGenList and TfoDico[line]['TONAME'] not in Options.IsolatedGenList: + lines.append(line) + else: + outLines.append(line) + else: + if TfoDico[line]['FROMNAME'] not in Options.IsolatedGenList or TfoDico[line]['TONAME'] not in Options.IsolatedGenList or \ + TfoDico[line]['3NAME'] not in Options.IsolatedGenList: + lines.append(line) + else: + outLines.append(line) + # for i in range(len(iarray[0])): + # #name = iarray[0][i] + ' - ' + iarray[1][i] + # idname = iarray[2][i].strip() + # if '@' in idname: + # idname = idname.replace('@','BR') + # elif '*' in idname: + # idname = idname.replace('*','SW') + # else: + # #separate lines and transfos + # U1 = Options.BusBaseList[iarray[0][i]] + # U2 = Options.BusBaseList[iarray[1][i]] + # if U1==U2: + # typecode = 'LI' + # else: + # typecode= 'TR' + # try: + # idname = typecode + str(int(idname)) + # except: + # idname = typecode + idname + # linename = iarray[0][i].strip() + "__" + iarray[1][i].strip() + "__" + idname + # linename = linename.replace(" ","_") + # linename = linename.replace("-","_") + # linename = linename.replace(".","_") + # linename = linename.replace("&","and") + # try: + # int(linename[0]) + # linename="_" + linename + # except: + # pass + # + # if '@' in iarray[2][i] or '*' in iarray[2][i]: + # outLines.append(linename) + # elif iarray[0][i] not in Options.IsolatedGenList and iarray[1][i] not in Options.IsolatedGenList: + # lines.append(linename) + # else: + # outLines.append(linename) + + # for i in range(len(jarray[0])): + # idname = '3WNDTR' + darray[6][i].strip() + # tfoname = darray[0][i].strip() + "__" + darray[1][i].strip() + "__" + darray[2][i].strip() + "__" + idname + # tfoname = tfoname.replace(" ","_") + # tfoname = tfoname.replace("-","_") + # tfoname = tfoname.replace(".","_") + # tfoname = tfoname.replace("&","and") + # try: + # int(tfoname[0]) + # tfoname="_" + tfoname + # except: + # pass + # if jarray[0][i] not in Options.IsolatedGenList and jarray[1][i] not in Options.IsolatedGenList and jarray[2][i] not in Options.IsolatedGenList: + # lines.append(tfoname) + # else: + # outLines.append(tfoname) + + Options.TrueLines = lines + Options.RadialLines = outLines + #pdb.set_trace() + return lines, outLines + +NoBreakersandSwitches = True + +def PFExtractGeneratorLoadLineandTransfoDico(it, idx, NetworkFile, PF_PATH,Python3_path): + + + path1 = os.getcwd() + # path_temp=os.path.dirname(NetworkFile) + filew = open('temp.txt', 'w') + filew.write(NetworkFile + '\n') + filew.write(PF_PATH + '\n') + filew.write(Python3_path + '\n') + filew.close() + # print('changer le chemin de Python3 executable') + lancer = [Python3_path + '/python.exe', path1 + '/com_base.py'] # changer le chemin de Python3 executable + proc = subprocess.Popen(lancer) + proc.wait() + with open('Data_for_interface', 'rb') as fichier: + mon_depickler = pickle.Unpickler(fichier) + data_file = mon_depickler.load() + + + def convert_keys_to_string(dictionary): + """Recursively converts dictionary keys to strings.""" + if not isinstance(dictionary, dict): + return dictionary + return dict((str(k), convert_keys_to_string(v)) for k, v in dictionary.items()) + + data = convert_keys_to_string(data_file) + MachineDico = data['MachineDico'] + LoadDico = data['LoadDico'] + LineDico = data['LineDico'] + TfoDico = data['TransfoDico'] + MotorDico = data['MotorDico'] + # os.remove('Data_for_interface') + + return MachineDico, LoadDico, LineDico, TfoDico, MotorDico + + +#NetworkFile= "" +#PF_PATH= +#Python3_path= +#MachineDico, LoadDico, LineDico, TfoDico, MotorDico = PFExtractGeneratorLoadLineandTransfoDico(0, 0, NetworkFile, PF_PATH,Python3_path) \ No newline at end of file diff --git a/ProcessOutputs_Eficas/PSEN_Cata_N1_PF.py b/ProcessOutputs_Eficas/PSEN_Cata_N1_PF.py new file mode 100644 index 00000000..cce32aef --- /dev/null +++ b/ProcessOutputs_Eficas/PSEN_Cata_N1_PF.py @@ -0,0 +1,245 @@ +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2013 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# -------------------------------------------------- +# debut entete +# -------------------------------------------------- + +#from Accas import ASSD, JDC_CATA, AU_MOINS_UN, PROC, SIMP, FACT, OPER, MACRO, BLOC, A_VALIDATOR +from Accas import * +import opsPSEN_N1_PF +import pn +# +#class loi ( ASSD ) : pass +#class variable ( ASSD ) : pass +class sd_charge ( ASSD ) : pass +class sd_generateur ( ASSD ) : pass +class sd_ligne ( ASSD ) : pass +class sd_transfo ( ASSD ) : pass +class sd_moteur ( ASSD ) : pass +# + +# import types +class Tuple: + def __init__(self,ntuple): + self.ntuple=ntuple + + def __convert__(self,valeur): + import types + if type(valeur) == types.StringType: + return None + if len(valeur) != self.ntuple: + return None + return valeur + + def info(self): + return "Tuple de %s elements" % self.ntuple + + __repr__=info + __str__=info + +JdC = JDC_CATA ( code = 'PSEN', + execmodul = None, + regles = ( AU_MOINS_UN ( 'CASE_SELECTION', 'CONTINGENCY_PROCESSING' ), + AU_MOINS_UN ( 'CONTINGENCY_SELECTION','N_PROCESSING_OPTIONS','CONTINGENCY_PROCESSING' ), + PRESENT_PRESENT ( 'CONTINGENCY_SELECTION','CONTINGENCY_OPTIONS' ), + PRESENT_PRESENT ( 'CONTINGENCY_PROCESSING','CONTINGENCY_OPTIONS' ), + # AU_MOINS_UN ( 'SIMULATION' ), + # AU_PLUS_UN ( 'PSSE_PARAMETERS' ), + AU_PLUS_UN ( 'CASE_SELECTION' ), + AU_PLUS_UN ( 'CONTINGENCY_OPTIONS' ), + AU_PLUS_UN ( 'CONTINGENCY_SELECTION' ), + AU_PLUS_UN ( 'CONTINGENCY_PROCESSING' ), + AU_PLUS_UN ( 'N_PROCESSING_OPTIONS' ), + # AU_PLUS_UN ( 'N_1_LINES' ), + # AU_PLUS_UN ( 'N_1_LOADS' ), + # AU_PLUS_UN ( 'N_1_TRANSFORMERS' ), + + ), + ) # Fin JDC_CATA + +MODIFICATION_CATALOGUE = MACRO ( nom = "MODIFICATION_CATALOGUE", + sd_prod = pn.modification_catalogue, + op_init= pn.modification_catalogue2, + op=None, + UIinfo={"groupes":("CACHE")}, + Fonction=SIMP(statut='o', typ='TXM', into=['ajoutDefinitionMC']), + Etape=SIMP(statut='o', typ='TXM',), + Genea=SIMP(statut='o', typ='TXM', min=0, max='**'), + NomSIMP=SIMP(statut='o', typ='TXM',), + TypeSIMP=SIMP(statut='o', typ='TXM',), + PhraseArguments=SIMP(statut='o', typ='TXM',),) + + +# -------------------------------------------------- +# fin entete +# -------------------------------------------------- +## TODO : RUN +CASE_SELECTION = MACRO ( nom = "CASE_SELECTION", + sd_prod = opsPSEN_N1_PF.INCLUDE, + op_init = opsPSEN_N1_PF.INCLUDE_context, + fichier_ini = 1, + op = None, + fr = "Sélectionnez les cas à analyser", + ang = 'Select the cases to analyze', + PF_path = SIMP(statut="o",typ='Repertoire',defaut=r'C:\Program Files\DIgSILENT\PowerFactory 2017 SP1\Python\3.5'), + Python3_path=SIMP(statut="o",typ='Repertoire',defaut=r'C:\Anaconda3'), + PSEN_results_folder = SIMP(statut="o", typ="Repertoire"), + PSEN_results_csvfile = SIMP(statut='o', typ = ('Fichier', 'CSV file (*.csv);;All Files (*)',),), + PSEN_results_csvfile_cleaned = SIMP ( statut = "o",typ=bool,defaut=False,), + DecimalSeparator = SIMP(statut="o",typ='TXM',into=[',','.'],defaut='.',), + + BusesList = SIMP(statut = 'f', typ = 'R', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'), + LinesList = SIMP(statut = 'f', typ = 'R', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'), + TransformersList = SIMP(statut = 'f', typ = 'TXM', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'), + MaxDepth = SIMP(statut = 'o', typ = 'I', defaut = 5), + OutputNewCsv = SIMP ( statut = "o",typ=bool,defaut=False,), + NewCsvFile = SIMP(statut='o',typ='TXM', defaut='CleanedData.csv'), + ) + + +N_PROCESSING_OPTIONS = PROC ( nom = 'N_PROCESSING_OPTIONS', + op = None, + ang = "Select whether the program should be displaying data about the different categories.\nThe values displayed will be the min, max, and mean of each item, plus a chart.", + Output_bus_values = SIMP(statut = 'o', typ = bool, defaut = True), + Output_lines_values = SIMP(statut = 'o', typ = bool, defaut = True), + Output_transformer_values = SIMP(statut = 'o', typ = bool, defaut = True), + Threshold_selection_for_the_treated_cases = FACT( + statut = 'f', + Branches = SIMP(statut="o",typ=Tuple(3),defaut=(0,0,0),validators=VerifTypeTuple(('R','R','R'),),), + Transformers = SIMP(statut="o",typ=Tuple(3),defaut=(0,0,0),validators=VerifTypeTuple(('R','R','R'),),), + High_voltage = SIMP(statut="o",typ=Tuple(3),defaut=(0,0,0),validators=VerifTypeTuple(('R','R','R'),),), + Low_voltage = SIMP(statut="o",typ=Tuple(3),defaut=(0,0,0),validators=VerifTypeTuple(('R','R','R'),),), + ), + ) + + +CONTINGENCY_OPTIONS = PROC (nom = 'CONTINGENCY_OPTIONS', + op = None, + + GeneralOptions = FACT(statut='o', + Vmin = SIMP(statut = 'o', typ = 'R', defaut = 0.9, val_min = 0), + Vmax = SIMP(statut = 'o', typ = 'R', defaut = 1.1, val_min = 0), + # ContingencyRate = SIMP(statut = 'o', typ = 'TXM', defaut = 'a', into=['a', 'b']), + FlowLimitLines = SIMP(statut = 'o', typ = 'I', defaut = 120, val_min = 0), + FlowLimitTransformers = SIMP(statut = 'o', typ = 'I', defaut = 120, val_min = 0), + # Tolerance = SIMP(statut = 'o', typ = 'R', defaut = 0.5, val_min = 0), + ), + + LoadFlowOptions = FACT(statut='o', + AdjustTaps = SIMP(statut='o', typ=bool, defaut=False), + AdjustShunts = SIMP(statut='o', typ=bool, defaut=False), + # SolutionMethod = SIMP(statut = 'o', typ = 'TXM', into = ['0 - FDNS', '1 - FNSL', '2 - Optimized FDNS'], defaut = '1 - FNSL'), + # AdjustSwitchedShunts = SIMP(statut='o', typ=bool, defaut=False), + DispatchMode = SIMP(statut='o',typ='TXM',into=['ReferenceMachine','LoadAtReferenceBus','StaticGeneratorAtReferenceBus', 'DistributedSlackByLoads','DistributedSlackBySynchronousGenerators', 'DistributedSlackBySynchronousAndStaticGenerators'], defaut = 'ReferenceMachine'), + ActiveLimits = SIMP(statut='o', typ=bool, defaut=True), + FlatStart = SIMP(statut = 'o', typ = bool, defaut = False), + VarLimits = SIMP(statut='o', typ=bool, defaut=True), + + ), + output_file_format = SIMP(statut = 'o', typ = 'TXM', into = ['xls', 'csv'],defaut='xls'), + + process_directly = SIMP(statut = 'f', typ = bool, defaut = False), + + flush = SIMP ( statut = "f",typ="I",val_min=1,defaut=10,), + ) + + + + +CONTINGENCY_SELECTION = PROC(nom='CONTINGENCY_SELECTION',op = None, + SelectionMethod = SIMP(statut='o',typ='TXM',into=['CaseSelectionFromFile','SelectAllCases','SelectWorstCases'],), + + b_file = BLOC(condition="SelectionMethod=='CaseSelectionFromFile'", + + CaseSelectionFromFiles = FACT( + statut = 'o', + case = FACT(statut='o',max='**', + case_name=SIMP(statut='o',typ='TXM'), + csv_file= SIMP(statut='o', typ = ('Fichier', 'CSV file (*.csv);;All Files (*)',),), + ), + #consigne = SIMP(statut='o',homo='information',typ = "TXM",defaut = 'Enter the numbers of studycases separared by comma (i.e: 1,3,4 for the studycases: Case_1,Case_3 and Case_4)'), + ), + ), + + b_worst = BLOC(condition="SelectionMethod=='SelectWorstCases'", + SelectWorstCases = FACT( + regles = (AU_MOINS_UN('AvgLineLoad', 'AvgLineLoadPercent','AvgTransformerLoad','AvgTransformerLoadPercent','AvgHighVoltage', 'AvgHighVoltagePercent','AvgLowVoltage', 'AvgLowVoltagePercent'), + EXCLUS('AvgLineLoad', 'AvgLineLoadPercent'),EXCLUS('AvgTransformerLoad','AvgTransformerLoadPercent'),EXCLUS('AvgHighVoltage', 'AvgHighVoltagePercent'),EXCLUS('AvgLowVoltage', 'AvgLowVoltagePercent'),), + statut = 'o', + consigne = SIMP(statut='o',homo='information',typ = "TXM",defaut = 'Choose at least one of the potential selection criteria from the SelectWorstCases list on the right.'), + AvgLineLoad = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0), + AvgLineLoadPercent = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0, val_max = 100), + AvgTransformerLoad = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0), + AvgTransformerLoadPercent = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0, val_max = 100), + AvgHighVoltage = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0), + AvgHighVoltagePercent = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0, val_max = 100), + AvgLowVoltage = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0), + AvgLowVoltagePercent = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0, val_max = 100), + ), + ), + + Automatic_N_1_Selection = FACT(statut='o', + + TripLines = SIMP(statut = 'o', typ = bool, defaut = True), + TripTransfos = SIMP(statut = 'o', typ = bool, defaut = True), + TripGenerators = SIMP(statut = 'o', typ = bool, defaut = True), + #TripBuses = SIMP(statut = 'o', typ = bool, defaut = False), + + #consigne = SIMP(statut='o',homo='information',typ = "TXM",defaut = 'Once the TripComponent key is selected above, all voltage levels will be included in the creation of N-1 contingencies by default, unless specific voltage levels are selected below.'), + #N1AreaList = SIMP(statut = 'o', typ = 'I', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'), + #N1BusesList = SIMP(statut = 'o', typ = 'R', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'), + #N1LinesList = SIMP(statut = 'o', typ = 'R', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'), + #N1TransformersList = SIMP(statut = 'o', typ = 'TXM', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'), + + ), + + Automatic_N_2_Selection = FACT(statut='f', + MixType=SIMP(statut='o', typ=bool, defaut=False), + GenList=SIMP(statut='o', typ=bool, defaut=False), + # BusesList = SIMP(statut = 'o', typ = 'R', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'), + LinesList = SIMP(statut = 'o', typ = 'R', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'), + TransformersList = SIMP(statut = 'o', typ = 'TXM', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'), + ), + + MultipleContingencyList = FACT (statut='f', max="**", ComponentList=SIMP(statut='o', typ = 'TXM', max='**', homo = 'SansOrdreNiDoublon',), + ), + ) + +CONTINGENCY_PROCESSING = MACRO ( nom = 'CONTINGENCY_PROCESSING', + sd_prod = opsPSEN_N1_PF.PROCESS, + op_init = opsPSEN_N1_PF.PROCESS_context, + + #sd_prod=None, + + op = None, + fichier_ini = 1, + fr = "", + ang="", + XLS_file = SIMP(statut="o", typ = ('Fichier', 'XLS file (*.xls);;CSV file (*.csv);;All files (*)',),), + b_TabList = BLOC(condition="XLS_file != None and XLS_file != ''", + TabList = SIMP(statut = 'o', typ = 'TXM', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'), ), + + + + ) + +Ordre_Des_Commandes = ('CASE_SELECTION' , 'N_PROCESSING_OPTIONS' , 'CONTINGENCY_SELECTION', 'CONTINGENCY_OPTIONS' ,'CONTINGENCY_PROCESSING',) +Classement_Commandes_Ds_Arbre = ('CASE_SELECTION' , 'N_PROCESSING_OPTIONS' , 'CONTINGENCY_SELECTION', 'CONTINGENCY_OPTIONS' ,'CONTINGENCY_PROCESSING',) diff --git a/ProcessOutputs_Eficas/TreatOutputs/RunPF.py b/ProcessOutputs_Eficas/TreatOutputs/RunPF.py new file mode 100644 index 00000000..5602c2a1 --- /dev/null +++ b/ProcessOutputs_Eficas/TreatOutputs/RunPF.py @@ -0,0 +1,1890 @@ +#-*- coding:Utf-8 -*- + +## Misc +from __future__ import division +import os, sys,itertools,copy +import numpy as np +from functools import partial +import time + +## Excel file processing +import xlrd +import xlwt +import csv +import shutil +from win32com.client import Dispatch # XLSX write +import win32com.client as win32 + +## multiprocessing +import threading +# import thread +from multiprocessing.pool import ThreadPool +import pdb + +## Own imports +import Chart +#import Display +#import Menu +import Options +from UpdateOptionsPF import * +import UtilsPF as Utils +#from WriteFuncsPF import * +import WriteFuncs as WF +import WriteFuncsCsv as WFC +from Processor import * + + +#sys.path.append(r'C:\PSEN_V16\Code\ProcessOutputs_Eficas') +sys.path.append(os.path.dirname(os.path.dirname(__file__))) + +from PFExtractGeneratorLoadLineandTransfoDico import * + + + +def resetAll(): + Options.TotalStorage = [] + Options.TotalBusStorage = [] + Options.TotalTransfoStorage = [] + Options.TotalLinesStorage = [] + + Options.NamesStorage = [] + Options.ColsStorage = [] + Options.BusStorage = [] + Options.TransfoStorage = [] + Options.LinesStorage = [] + +def join_csv(outputfilepath, filelist): + f=open(outputfilepath,"a")#, newline='') + + for k,filepath in enumerate(filelist): + g = open(filepath,"r")#, newline='') + f.write(g.read()) + g.close() + + f.close() + +#if not Display.initialized: +def read_pfd(app,doc,recal=0): + ######################################################## + # ojectif de cette fonction: prendre les parametres du reseau + ######################################################## + # si recal==1, recalculer loadflow + prj = app.GetActiveProject() + studycase=app.GetActiveStudyCase() + grids=studycase.GetChildren(1,'*.ElmNet',1)[0].contents + if recal == 1:#calculer load-flow + ldf = app.GetFromStudyCase('ComLdf') + err = ldf.Execute() #run + #pdb.set_trace() + tous=[] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmTerm', 1)) + bus = [] + for noeud in tous: + bus.append(noeud) + noeuds = sorted(bus, key=lambda x: x.cStatName) + buses = [] + for ii in range(len(noeuds)): + busname = noeuds[ii].cStatName.replace('/','_').replace(')','_').replace('(','_') + aa = [ii, noeuds[ii].uknom, noeuds[ii].GetAttribute('m:u'), busname, noeuds[ii].vmin, + noeuds[ii].vmax, noeuds[ii].GetBusType(), noeuds[ii].GetAttribute('m:phiu'),noeuds[ii]] + # [numero,nominal KV,magnitude p.u, busname,Vmin,Vmax,type,angle degre,obj] + buses.append(aa) + ##== == == == == == == == == == = Line===================== Line===================== Line + # lignes = app.GetCalcRelevantObjects('*.ElmLne', 0) + tous=[] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmLne', 1)) + lines=[] + for line in tous: + frombus_name=line.bus1.cBusBar.cStatName + tobus_name=line.bus2.cBusBar.cStatName + frombus_name = frombus_name.replace('/','_').replace(')','_').replace('(','_') + tobus_name = tobus_name.replace('/','_').replace(')','_').replace('(','_') + for ii in range(len(buses)): + if frombus_name in buses[ii]: + frombus_number=ii + break + for ii in range(len(buses)): + if tobus_name in buses[ii]: + tobus_number=ii + break + + outs = line.GetChildren(1, 'outserv.Charef', 1) + if outs: + if outs[0].outserv==0: + outserv = outs[0].typ_id.curval + else: + outserv = line.outserv + else: + outserv = line.outserv + if outserv==1: + currentA = 0 + pourcent = 0 + flowP = 0 + flowQ = 0 + else: + currentA=line.GetAttribute('m:I:bus1') #courant en A de la ligne + pourcent=line.GetAttribute('c:loading') # taux de charge de la ligne + flowP=line.GetAttribute('m:P:bus1') + flowQ = line.GetAttribute('m:Q:bus1') + idline=line.loc_name#line.nlnum + linename = frombus_name + '_' + tobus_name + '_' + idline + "__LI" + linename = linename.replace(" ", "_") + linename = linename.replace("-", "_") + linename = linename.replace(".", "_") + linename = linename.replace("/", "_") + linename = linename.replace("&", "and") + try: + int(linename[0]) + linename = "L_" + linename + except: + pass + aa=[frombus_number,tobus_number,currentA,pourcent,pourcent,pourcent,flowP,flowQ,frombus_name,tobus_name,idline,line,linename] + lines.append(aa) + + # 2 windings transformers data (from, to, amps, rate%a, ploss, qloss)==============Transformateur2 + tous=[] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmTr2', 1)) + transf=[] + for trans in tous: + frombus_name=trans.bushv.cBusBar.cStatName + frombus_name = frombus_name.replace('/','_').replace(')','_').replace('(','_') + for ii in range(len(buses)): + if frombus_name in buses[ii]: + frombus_number=ii + break + tobus_name=trans.buslv.cBusBar.cStatName + tobus_name = tobus_name.replace('/','_').replace(')','_').replace('(','_') + for ii in range(len(buses)): + if tobus_name in buses[ii]: + tobus_number=ii + break + + outs = trans.GetChildren(1, 'outserv.Charef', 1) + if outs: + if outs[0].outserv==0: + outserv = outs[0].typ_id.curval + else: + outserv = trans.outserv + else: + outserv = trans.outserv + + if outserv==1: + currentA = 0 + pourcent = 0 + flowP = 0 + flowQ = 0 + else: + currentA=trans.GetAttribute('m:I:bushv') #courant en A du bus hv + pourcent=trans.GetAttribute('c:loading') # taux de charge + flowP=trans.GetAttribute('m:P:bushv') + flowQ = trans.GetAttribute('m:Q:bushv') + # idtr=trans.ntnum + idtr = trans.loc_name + tfoname = frombus_name+'_' + tobus_name + '_' + str(idtr) + "__TR" + tfoname = tfoname.replace(" ", "_") + tfoname = tfoname.replace("-", "_") + tfoname = tfoname.replace(".", "_") + tfoname = tfoname.replace("/", "_") + tfoname = tfoname.replace("&", "and") + try: + int(tfoname[0]) + tfoname = "_" + tfoname + except: + pass + aa=[frombus_number,tobus_number,currentA,pourcent,pourcent,pourcent,flowP,flowQ,frombus_name,tobus_name,idtr,trans,tfoname] + transf.append(aa) + #3 windings transformers data (from, to, amps, rate%a, ploss, qloss)==============Transformateur3 + tous=[] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmTr3', 1)) + transf3 = [] + for trans in tous: + wind1name = trans.bushv.cBusBar.cStatName + wind1name = wind1name.replace('/','_').replace(')','_').replace('(','_') + for ii in range(len(buses)): + if wind1name in buses[ii]: + wind1number = ii + break + wind2name = trans.busmv.cBusBar.cStatName + wind2name = wind2name.replace('/','_').replace(')','_').replace('(','_') + for ii in range(len(buses)): + if wind2name in buses[ii]: + wind2number = ii + break + wind3name = trans.buslv.cBusBar.cStatName + wind3name = wind3name.replace('/','_').replace(')','_').replace('(','_') + for ii in range(len(buses)): + if wind3name in buses[ii]: + wind3number = ii + break + outs = trans.GetChildren(1, 'outserv.Charef', 1) + if outs: + if outs[0].outserv==0: + outserv = outs[0].typ_id.curval + else: + outserv = trans.outserv + else: + outserv = trans.outserv + if outserv==1: + currentHV = 0 + currentMV = 0 + currentLV = 0 + pourcenthv = 0 + pourcentmv = 0 + pourcentlv = 0 + flowPh = 0 + flowPm = 0 + flowPl = 0 + flowQh = 0 + flowQm = 0 + flowQl = 0 + else: + currentHV = trans.GetAttribute('m:I:bushv') # courant en A du bus hv + currentMV = trans.GetAttribute('m:I:busmv') # courant en A du bus mv + currentLV = trans.GetAttribute('m:I:buslv') # courant en A du bus lv + pourcenthv = trans.GetAttribute('c:loading_h') # taux de charge + pourcentmv = trans.GetAttribute('c:loading_m') # taux de charge + pourcentlv = trans.GetAttribute('c:loading_l') # taux de charge + flowPh = trans.GetAttribute('m:P:bushv') + flowPm = trans.GetAttribute('m:P:busmv') + flowPl = trans.GetAttribute('m:P:buslv') + flowQh = trans.GetAttribute('m:Q:bushv') + flowQm = trans.GetAttribute('m:Q:busmv') + flowQl = trans.GetAttribute('m:Q:buslv') + # idtr3 = trans.nt3nm + idtr3 = trans.loc_name + tfoname = wind1name+ '_' + wind2name + '_' +wind3name+'_' + str(idtr3)+'__'+ 'TR3' + tfoname = tfoname.replace(" ", "_") + tfoname = tfoname.replace("-", "_") + tfoname = tfoname.replace(".", "_") + tfoname = tfoname.replace("/", "_") + tfoname = tfoname.replace("&", "and") + try: + int(tfoname[0]) + tfoname = "_" + tfoname + except: + pass + aa = [wind1number, wind2number,wind3number,1, currentHV, pourcenthv, pourcenthv, pourcenthv, flowPh, flowQh, wind1name,wind2name,wind3name,idtr3,trans,tfoname] + transf3.append(aa) + aa = [wind1number, wind2number, wind3number, 2, currentMV, pourcentmv, pourcentmv, pourcentmv, flowPm, flowQm, + wind1name, wind2name, wind3name, idtr3, trans,tfoname] + transf3.append(aa) + aa = [wind1number, wind2number, wind3number, 3, currentLV, pourcentlv, pourcentlv, pourcentlv, flowPl, flowQl, + wind1name, wind2name, wind3name, idtr3, trans,tfoname] + transf3.append(aa) + + #Machines data (bus, inservice, id, pgen, qgen, mvabase, pmax, qmax, name)==============Generator + tous=[] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmSym', 1)) + plants = [] + for plant in tous: + if plant.i_mot==0: + busname=plant.bus1.cBusBar.cStatName + busname = busname.replace('/','_').replace(')','_').replace('(','_') + for ii in range(len(buses)): + if busname in buses[ii]: + busnumber = ii + break + idplant = plant.loc_name#plant.ngnum + outs=plant.GetChildren(1, 'outserv.Charef', 1) + if outs: + if outs[0].outserv == 0: + outserv = outs[0].typ_id.curval + else: + outserv = plant.outserv + else: + outserv = plant.outserv + if outserv == 1: + pgen = 0 + qgen = 0 + else: + pgen = plant.GetAttribute('m:P:bus1') + qgen = plant.GetAttribute('m:Q:bus1') + sn = plant.GetAttribute('t:sgn') + # pmax = plant.Pmax_uc + pmax = plant.P_max + pmin = plant.Pmin_uc + qmax = plant.cQ_max + qmin = plant.cQ_min + aa=[busnumber,outserv,idplant,pgen,qgen,sn,pmax,pmin,busname,pmin,qmin,plant] + plants.append(aa) + tous=[] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmAsm', 1)) + for plant in tous: + if plant.i_mot==0: + busname=plant.bus1.cBusBar.cStatName + busname = busname.replace('/','_').replace(')','_').replace('(','_') + for ii in range(len(buses)): + if busname in buses[ii]: + busnumber = ii + break + idplant = plant.loc_name#plant.ngnum + outs = plant.GetChildren(1, 'outserv.Charef', 1) + if outs: + if outs[0].outserv == 0: + outserv = outs[0].typ_id.curval + else: + outserv = plant.outserv + else: + outserv = plant.outserv + if outserv==1: + pgen=0 + qgen = 0 + else: + pgen = plant.GetAttribute('m:P:bus1') + qgen = plant.GetAttribute('m:Q:bus1') + sn = plant.GetAttribute('t:sgn') + # pmax = plant.Pmax_uc + pmax = plant.P_max + pmin = plant.Pmin_uc + qmax = plant.cQ_max + qmin = plant.cQ_min + aa=[busnumber,outserv,idplant,pgen,qgen,sn,pmax,pmin,busname,pmin,qmin,plant] + plants.append(aa) + tous = [] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmGenstat', 1)) + for plant in tous: + busname = plant.bus1.cBusBar.cStatName + busname = busname.replace('/','_').replace(')','_').replace('(','_') + for ii in range(len(buses)): + if busname in buses[ii]: + busnumber = ii + break + idplant = plant.loc_name # plant.ngnum + outs = plant.GetChildren(1, 'outserv.Charef', 1) + if outs: + if outs[0].outserv==0: + outserv = outs[0].typ_id.curval + else: + outserv = plant.outserv + else: + outserv = plant.outserv + if outserv == 1: + pgen = 0 + qgen = 0 + else: + pgen = plant.GetAttribute('m:P:bus1') + qgen = plant.GetAttribute('m:Q:bus1') + sn = plant.GetAttribute('e:sgn') + # pmax = plant.Pmax_uc + pmax = plant.P_max + pmin = plant.Pmin_uc + qmax = plant.cQ_max + qmin = plant.cQ_min + aa = [busnumber, outserv, idplant, pgen, qgen, sn, pmax, pmin, busname, pmin, qmin,plant] + plants.append(aa) + tous = [] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmPvsys', 1)) + for plant in tous: + busname = plant.bus1.cBusBar.cStatName + busname = busname.replace('/','_').replace(')','_').replace('(','_') + for ii in range(len(buses)): + if busname in buses[ii]: + busnumber = ii + break + idplant = plant.loc_name # plant.ngnum + outs = plant.GetChildren(1, 'outserv.Charef', 1) + if outs: + if outs[0].outserv==0: + outserv = outs[0].typ_id.curval + else: + outserv = plant.outserv + else: + outserv = plant.outserv + if outserv == 1: + pgen = 0 + qgen = 0 + else: + pgen = plant.GetAttribute('m:P:bus1') + qgen = plant.GetAttribute('m:Q:bus1') + sn = plant.GetAttribute('e:sgn') + # pmax = plant.Pmax_uc + pmax = plant.P_max + pmin = plant.Pmin_uc + qmax = plant.cQ_max + qmin = plant.cQ_min + aa = [busnumber, outserv, idplant, pgen, qgen, sn, pmax, pmin, busname, pmin, qmin,plant] + plants.append(aa) + # Motors data (bus, active, reactive, status, name, id)===================== Motor + tous=[] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmSym', 1)) + motors = [] + for motor in tous: + if motor.i_mot == 1: + busname = motor.bus1.cBusBar.cStatName + busname = busname.replace('/','_').replace(')','_').replace('(','_') + for ii in range(len(buses)): + if busname in buses[ii]: + busnumber = ii + break + idplant = motor.loc_name#motor.ngnum + outs = motor.GetChildren(1, 'outserv.Charef', 1) + if outs: + if outs[0].outserv == 0: + outserv = outs[0].typ_id.curval + else: + outserv = motor.outserv + else: + outserv = motor.outserv + if outserv == 1: + pgen = 0 + qgen = 0 + else: + pgen = motor.GetAttribute('m:P:bus1') + qgen = motor.GetAttribute('m:Q:bus1') + aa = [busnumber, pgen, qgen, outserv, busname,idplant,motor] + motors.append(aa) + tous=[] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmAsm', 1)) + for motor in tous: + if motor.i_mot == 1: + busname = motor.bus1.cBusBar.cStatName + busname = busname.replace('/','_').replace(')','_').replace('(','_') + for ii in range(len(buses)): + if busname in buses[ii]: + busnumber = ii + break + idplant = motor.loc_name#motor.ngnum + outs = motor.GetChildren(1, 'outserv.Charef', 1) + if outs: + if outs[0].outserv == 0: + outserv = outs[0].typ_id.curval + else: + outserv = motor.outserv + else: + outserv = motor.outserv + # outserv = motor.outserv + if outserv == 1: + pgen = 0 + qgen = 0 + else: + pgen = motor.GetAttribute('m:P:bus1') + qgen = motor.GetAttribute('m:Q:bus1') + aa = [busnumber, pgen, qgen, outserv, busname,idplant,motor] + motors.append(aa) + + # Loads data (bus, active, reactive, status, name, id)===================== Load + tous=[] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmLod', 1)) + tous = sorted(tous, key=lambda x: x.bus1.cBusBar.cStatName) + loads = [] + for bus in buses: + idload = 0 + for load in tous: + busname = load.bus1.cBusBar.cStatName + busname = busname.replace('/','_').replace(')','_').replace('(','_') + if busname == bus[3]: + idload += 1# cree id pour load + busnumber = bus[0] + # outserv = load.outserv + outs = load.GetChildren(1, 'outserv.Charef', 1) + if outs: + if outs[0].outserv == 0: + outserv = outs[0].typ_id.curval + else: + outserv = load.outserv + else: + outserv = load.outserv + if outserv == 1: + pload = 0 + qload = 0 + else: + pload = load.GetAttribute('m:P:bus1') + qload = load.GetAttribute('m:Q:bus1') # qlini_a + aa = [busnumber, pload, qload, outserv, busname, idload,load] + loads.append(aa) + + #Fixed shunt data (number, MVAR, name, ...)========================== Fixed Shunt + tous=[] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmShnt', 1)) + tous = sorted(tous, key=lambda x: x.bus1.cBusBar.cStatName) + shunt = [] + for bus in buses: + idshunt = 0 + for shunt1 in tous: + if shunt1.ncapx==1:# nombre de step =1, considerer comme fix shunt pour equivalent a l'ancien programme sous PSSE + busname = shunt1.bus1.cBusBar.cStatName + busname = busname.replace('/','_').replace(')','_').replace('(','_') + if busname == bus[3]: + idshunt += 1 # cree id pour load + busnumber = bus[0] + qnom=shunt1.Qmax + outs = shunt1.GetChildren(1, 'outserv.Charef', 1) + if outs: + if outs[0].outserv == 0: + outserv = outs[0].typ_id.curval + else: + outserv = shunt1.outserv + else: + outserv = shunt1.outserv + if outserv == 1: + qshunt = 0 + else: + qshunt = shunt1.GetAttribute('m:Q:bus1') # qlini_a + aa = [busnumber, outserv, qshunt, busname,qnom, idshunt,bus,shunt1] + shunt.append(aa) + # Switched shunt data (number, status,MVAR, name,Qnom,id)================Swiched Shunt + swshunt = [] + for bus in buses: + idshunt = 0 + for shunt1 in tous: + if shunt1.ncapx != 1: # nombre de step #1, considerer comme switche shunt pour etre equivalent avec l'ancien programme sous PSSE + busname = shunt1.bus1.cBusBar.cStatName + busname = busname.replace('/','_').replace(')','_').replace('(','_') + if busname == bus[3]: + idshunt += 1 # cree id pour load + busnumber = bus[0] + qnom = shunt1.Qmax + outs = shunt1.GetChildren(1, 'outserv.Charef', 1) + if outs: + if outs[0].outserv == 0: + outserv = outs[0].typ_id.curval + else: + outserv = shunt1.outserv + else: + outserv = shunt1.outserv + if outserv == 1: + qshunt = 0 + else: + qshunt = shunt1.GetAttribute('m:Q:bus1') # qlini_a + aa = [busnumber, outserv, qshunt, busname, qnom, idshunt,shunt1] + swshunt.append(aa) + + return buses, lines, transf, plants, loads, shunt, motors, transf3, swshunt +# Display.init() +def read_pfd_simple(app,doc): + ######################################################## + # ojectif de cette fonction: prendre les parametres du reseau + ######################################################## + # si recal==1, recalculer loadflow + prj = app.GetActiveProject() + studycase=app.GetActiveStudyCase() + grids=studycase.GetChildren(1,'*.ElmNet',1)[0].contents + # if recal == 1:#calculer load-flow + # ldf = app.GetFromStudyCase('ComLdf') + # ldf.Execute() #run + tous=[] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmTerm', 1)) + bus = [] + for noeud in tous: + bus.append(noeud) + noeuds = sorted(bus, key=lambda x: x.cStatName) + buses = [] + for ii in range(len(noeuds)): + busname = noeuds[ii].cStatName.replace('/','_').replace(')','_').replace('(','_') + aa = [ii, noeuds[ii].uknom, 1, busname, noeuds[ii].vmin, + noeuds[ii].vmax, noeuds[ii].GetBusType(), 0,noeuds[ii]] + # [numero,nominal KV,magnitude p.u, busname,Vmin,Vmax,type,angle degre,obj] + buses.append(aa) + + #Machines data (bus, inservice, id, pgen, qgen, mvabase, pmax, qmax, name)==============Generator + tous=[] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmSym', 1)) + plants = [] + for plant in tous: + if plant.i_mot==0: + busname=plant.bus1.cBusBar.cStatName + busname = busname.replace('/','_').replace(')','_').replace('(','_') + for ii in range(len(buses)): + if busname in buses[ii]: + busnumber = ii + break + idplant = plant.loc_name#plant.ngnum + outs=plant.GetChildren(1, 'outserv.Charef', 1) + if outs: + if outs[0].outserv == 0: + outserv = outs[0].typ_id.curval + else: + outserv = plant.outserv + else: + outserv = plant.outserv + + aa=[busnumber,outserv,idplant,0,0,0,0,0,busname,0,0,plant] + plants.append(aa) + tous=[] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmAsm', 1)) + for plant in tous: + if plant.i_mot==0: + busname=plant.bus1.cBusBar.cStatName + busname = busname.replace('/','_').replace(')','_').replace('(','_') + for ii in range(len(buses)): + if busname in buses[ii]: + busnumber = ii + break + idplant = plant.loc_name#plant.ngnum + outs = plant.GetChildren(1, 'outserv.Charef', 1) + if outs: + if outs[0].outserv == 0: + outserv = outs[0].typ_id.curval + else: + outserv = plant.outserv + else: + outserv = plant.outserv + aa=[busnumber,outserv,idplant,0,0,0,0,0,busname,0,0,plant] + plants.append(aa) + tous = [] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmGenstat', 1)) + for plant in tous: + busname = plant.bus1.cBusBar.cStatName + busname = busname.replace('/','_').replace(')','_').replace('(','_') + for ii in range(len(buses)): + if busname in buses[ii]: + busnumber = ii + break + idplant = plant.loc_name # plant.ngnum + outs = plant.GetChildren(1, 'outserv.Charef', 1) + if outs: + if outs[0].outserv==0: + outserv = outs[0].typ_id.curval + else: + outserv = plant.outserv + else: + outserv = plant.outserv + + aa = [busnumber, outserv, idplant, 0, 0, 0, 0, 0, busname, 0, 0,plant] + plants.append(aa) + tous = [] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmPvsys', 1)) + for plant in tous: + busname = plant.bus1.cBusBar.cStatName + busname = busname.replace('/','_').replace(')','_').replace('(','_') + for ii in range(len(buses)): + if busname in buses[ii]: + busnumber = ii + break + idplant = plant.loc_name # plant.ngnum + outs = plant.GetChildren(1, 'outserv.Charef', 1) + if outs: + if outs[0].outserv==0: + outserv = outs[0].typ_id.curval + else: + outserv = plant.outserv + else: + outserv = plant.outserv + + aa = [busnumber, outserv, idplant, 0, 0, 0, 0, 0, busname, 0, 0,plant] + plants.append(aa) + + # Loads data (bus, active, reactive, status, name, id)===================== Load + tous=[] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmLod', 1)) + tous = sorted(tous, key=lambda x: x.bus1.cBusBar.cStatName) + loads = [] + for bus in buses: + idload = 0 + for load in tous: + busname = load.bus1.cBusBar.cStatName + busname = busname.replace('/','_').replace(')','_').replace('(','_') + if busname == bus[3]: + idload += 1# cree id pour load + busnumber = bus[0] + # outserv = load.outserv + outs = load.GetChildren(1, 'outserv.Charef', 1) + if outs: + if outs[0].outserv == 0: + outserv = outs[0].typ_id.curval + else: + outserv = load.outserv + else: + outserv = load.outserv + if outserv == 1: + pload = 0 + qload = 0 + else: + pload = load.plini_a + qload = load.qlini_a + aa = [busnumber, pload, qload, outserv, busname, idload,load] + loads.append(aa) + + #Fixed shunt data (number, MVAR, name, ...)========================== Fixed Shunt + tous=[] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmShnt', 1)) + tous = sorted(tous, key=lambda x: x.bus1.cBusBar.cStatName) + shunt = [] + for bus in buses: + idshunt = 0 + for shunt1 in tous: + if shunt1.ncapx==1:# nombre de step =1, considerer comme fix shunt pour equivalent a l'ancien programme sous PSSE + busname = shunt1.bus1.cBusBar.cStatName + busname = busname.replace('/','_').replace(')','_').replace('(','_') + if busname == bus[3]: + idshunt += 1 # cree id pour load + busnumber = bus[0] + qnom=shunt1.Qmax + outs = shunt1.GetChildren(1, 'outserv.Charef', 1) + if outs: + if outs[0].outserv == 0: + outserv = outs[0].typ_id.curval + else: + outserv = shunt1.outserv + else: + outserv = shunt1.outserv + if outserv == 1: + qshunt = 0 + else: + qshunt = shunt1.Qact + aa = [busnumber, outserv, qshunt, busname,qnom, idshunt,bus,shunt1] + shunt.append(aa) + # Switched shunt data (number, status,MVAR, name,Qnom,id)================Swiched Shunt + swshunt = [] + for bus in buses: + idshunt = 0 + for shunt1 in tous: + if shunt1.ncapx != 1: # nombre de step #1, considerer comme switche shunt pour etre equivalent avec l'ancien programme sous PSSE + busname = shunt1.bus1.cBusBar.cStatName + busname = busname.replace('/','_').replace(')','_').replace('(','_') + if busname == bus[3]: + idshunt += 1 # cree id pour load + busnumber = bus[0] + qnom = shunt1.Qmax + outs = shunt1.GetChildren(1, 'outserv.Charef', 1) + if outs: + if outs[0].outserv == 0: + outserv = outs[0].typ_id.curval + else: + outserv = shunt1.outserv + else: + outserv = shunt1.outserv + if outserv == 1: + qshunt = 0 + else: + qshunt = shunt1.Qact + aa = [busnumber, outserv, qshunt, busname, qnom, idshunt,shunt1] + swshunt.append(aa) + + return plants, loads, shunt, swshunt,buses + +def outputNewCsv(): + # Outputs a new .csv file with "cleansed" data (i.e same data than original .csv file, but without unselected branches / buses / etc) + path = os.path.join(Options.FolderList[0], Options.csvCleanedFileName) + with open(path, 'w', newline='') as csvfile: + writer = csv.writer(csvfile, delimiter = ';') + ignorelist = [] + colslist = [] + nameslist = [] + OptionsNamesStorage = Options.NamesStorage #to avoid calling multiple times + for col,header in enumerate(Options.ColsStorage): #remove P and Q columns because already have rate columns. + if (":TrP" in header or ":TrQ" in header or ":Tr3P" in header or ":Tr3Q" in header or ( + ":P " in header and ":PMachine" not in header) or (":Q " in header and ":QMachine" not in header)) and (" id" in header): + ignorelist.append(col) + else: + colslist.append(header) + nameslist.append(OptionsNamesStorage[col]) + writer.writerow(colslist) + writer.writerow(nameslist) + # Finally, write down all the associated values + for line in Options.TotalStorage: + cleanedline = [] + for it,li in enumerate(line): + if it not in ignorelist: + cleanedline.append(li) + if Options.DecimalSeparator[0]==',': + linewcommas = [] + for item in cleanedline: + try: + isnum = float(item)+1 + linewcommas.append(str(item).replace(".",",")) + except: + linewcommas.append(item) + writer.writerow(linewcommas) + else: + writer.writerow(cleanedline) + + +def separateLinesFromTr(Flows, TfoDico, LineDico): + # Separates Flows into two lists, one of transformers and one of lines + # First, get the branch list + branch_list = list(Flows.keys()) + TrList = [] + LineList = [] + for branch in branch_list: + if 'LI' in branch.split('__')[-1]: + try: + # Create the name of the line to compare it + #name = LineDico[branch]['FROMNAME'] + '-' + LineDico[branch]['TONAME'] + # Check if the line is non radial + if branch not in Options.TrueLines: # Skimming lines + continue + # Add the line to the list of the lines + LineList.append(branch) + except: + LineList.append(branch) +## elif '3WNDTR' in branch.split('__')[-1]: #was a bypass for 3wnd tfos because not integrated into checkifborder +## TrList.append(branch) + elif 'TR' in branch.split('__')[-1]: + try: + # Check if the transformer is in the list + #name = TfoDico[branch]['FROMNAME'] + '-' + TfoDico[branch]['TONAME'] + # if "3WNDTR" in branch.split('__')[-1]: + # b = branch.split('__') + # for j,val in enumerate(b): + # if val.startswith("Wnd"): + # del b[j] + # branchTr = '__'.join(b) + # else: #2 wnd transformer + # branchTr = branch + if branch not in Options.TrueLines: # Skimming transfos + continue + # if TrNoGSUorGNDOutput: # Careful: this is not portable, as it removes all "GND", "GSU" and "FMR" transformers systematically + # TrType = TfoDico[branch]['XFRNAME'].split('_')[-1][0:3] + # if TrType != 'GND' and TrType != 'GSU' and TrType != 'FMR': + # TrList.append(branch) + # else: + TrList.append(branch) + except: + TrList.append(branch) + + return TrList, LineList + +def getCases(): + CaseList = [] + # More readable options + AvgLineLoad = Options.AvgLineLoad[0] + AvgLineLoadPercent = Options.AvgLineLoadPercent[0] + AvgTransfoLoad = Options.AvgTransfoLoad[0] + AvgTransfoLoadPercent = Options.AvgTransfoLoadPercent[0] + AvgLowVoltage = Options.AvgLowVoltage[0] + AvgLowVoltagePercent = Options.AvgLowVoltagePercent[0] + AvgHighVoltage = Options.AvgHighVoltage[0] + AvgHighVoltagePercent = Options.AvgHighVoltagePercent[0] + + CaseSelectionMode = Options.CaseSelectionMode[0] + + # CaseSelectionMode can be either "Worst", "File" or "All". We handle those cases in different ways + if CaseSelectionMode == 'Worst': + # Must be "X worst cases" or "X % worst cases". If either of them is not 0 (i.e selected) we add the corresponding case + if AvgLineLoad != 0 or AvgLineLoadPercent != 0: + CaseList.append('MaxAvgLineLd') + if AvgTransfoLoad != 0 or AvgTransfoLoadPercent != 0: + CaseList.append('MaxAvgXfmrLd') + if AvgHighVoltage != 0 or AvgHighVoltagePercent != 0: + CaseList.append('MaxAvgVolt') + if AvgLowVoltage != 0 or AvgLowVoltagePercent != 0: + CaseList.append('MinAvgVolt') + + elif CaseSelectionMode == 'File': + # The case is considered as selected if the user entered a file name, so if the file name is not empty, we add the corresponding case. + # In the event where the user would have tried to select a number of cases before, we reset them. + if Options.NCasesfromFile[0] > 0: + for case in Options.CaseNamesfromFile: + if len(case) > 12: + CaseList.append(case[0:12]) + else: + CaseList.append(case) + + + elif CaseSelectionMode == 'All': + CaseList.append('All') + + tmp = [] + # In case some cases are duplicated in the case list, we create a new, clean list of cases + for item in CaseList: + if item not in tmp: + tmp.append(item) + CaseList = copy.deepcopy(tmp) + return CaseList + +def writeMultiContReport(accfiles, N_files): + accfiles = np.array(accfiles) + import sys + import psspy + + for i in range(int(np.ceil(N_files/22))): + if i == np.ceil(N_files/22)-1: + remainder = np.mod(N_files,22) + indices = np.arange(i*22,i*22+remainder) + nfiles = remainder + else: + indices = np.arange(i*22,i*22+22) + nfiles = 22 + + rate_base = 1 # 1 = rate A, 2=B, 3=C + rate_cont = 1 + Vlim_base = 1 #1=normal, 2=emergency + Vlim_cont = 1 + SummaryReport = 0 #0=no, 1=yes + NonConvergedContingencyReport = 1 #0=no, 1=yes + LoadingViolationsReport = 1 #0=no, 1=yes, 2, base case + worst case, 3=base case, worst case, and all violations + VoltageViolationsReport = 1 + options = [1,rate_base,rate_cont, Vlim_base, Vlim_cont, SummaryReport, 0, 0, 2, 0, NonConvergedContingencyReport, LoadingViolationsReport, VoltageViolationsReport, 1, 0, 0] + + BusMismatchTol = 0.5 + SystemMismatchTol = 5 + LoadingViolationPercent = 90 + WorstCaseContingencyViolationPercent = 100 + values = [BusMismatchTol, SystemMismatchTol, LoadingViolationPercent, WorstCaseContingencyViolationPercent,0,0,0] + + ierr = psspy.accc_multiple_run_report_2(options, values, nfiles, list(accfiles[indices])) + + +def run(dico): + #print dico + #print "je suis dans le run" + start_time = time.clock() + + PF_path=dico['CASE_SELECTION']['PF_path'] + Python3_path=dico['CASE_SELECTION']['Python3_path'] + CaseFile = '' + CaseFolder=dico['CASE_SELECTION']['PSEN_results_folder'] + FolderList = os.listdir(CaseFolder) + for folder in FolderList: + if folder[0:7] == 'package' or folder[0:4] == 'core': + # Get BaseCase.sav inside the first package folder we find + FolderContents = os.listdir(os.path.join(CaseFolder, folder)) + for file in FolderContents: + if file == 'BaseCase.pfd': + CaseFile = os.path.join(os.path.join(CaseFolder, folder), file) + break + break + + MachineDico, LoadDico, LineDico, TransfoDico, MotorDico = PFExtractGeneratorLoadLineandTransfoDico(0, 0, CaseFile, + PF_path, Python3_path)# creer Data_for_interface file + UpdateOptions(dico) + + PF_PATH = Options.PF_PATH[0] + FolderList = Options.FolderList + WriteIndivExcels = Options.WriteIndivExcels[0] + + LinesStorage = [] + BusStorage = [] + TransfoStorage = [] + + # Get the different files + FolderPath = FolderList[0] + FolderContents = os.listdir(FolderPath) + BaseCase = '' + # Get the BaseCase file to compute and eliminate all radial items + for fname in FolderContents: + # Browse all files in the main folder for a "package" folder + if fname[0:7] == 'package': + packNum = int(fname.split('_')[0][7:]) + PackageContents = os.listdir(os.path.join(FolderPath, fname)) + # Browse all files in the package folder for the BaseCase.sav file + for f in PackageContents: + if f[0:8] == 'BaseCase' and BaseCase == '': + # Found the BaseCase.sav file, load it and compute the radial items + BaseCase = os.path.join(os.path.join(FolderPath, fname), f) + BusList, LinesList, TransfosList,BusDico = getNominalkV(BaseCase) + updateConts() + getTrueLines(BaseCase) + break + break + + if Options.CaseSelectionMode[0] == 'Worst' or Options.AlreadyCleaned==False or Options.OutputNCSV==True or Options.Thresholds or sum(Options.OutputNValues)>0: + print('Reading data from PSEN results csv file.') + BusStorage, TransfoStorage, LinesStorage = Utils.getData(Options.csvPSENresults,TransfoDico,LineDico,BusDico) + + ############################### + # N processing + ############################### + if Options.OutputNCSV or Options.Thresholds: + print('Complete network processing') + + if Options.OutputNCSV: + outputNewCsv() + + # Output kept lines, transfos & buses (and which ones we've ignored because either isolated or not right voltage level) + if Options.Thresholds or sum(Options.OutputNValues)>0: #only do so if already have a reason to output this page + excel = Dispatch('Excel.Application') + wb_N = excel.Workbooks.Add() + + if Options.Thresholds: + print('Outputing threshold violations') + import Threshold + Threshold.processThresholds(wb_N) + + Utils.OutputKeptItems(wb_N) + Chart.outputChart(wb_N) + + ##################################### + # N-1 processing + ##################################### + + CaseList = getCases() + + if len(CaseList)>0: + print('Contingency calculations and processing') + + # Create the different N-1 output files + outputExcel = os.path.join(FolderList[0], "ACCCresults.xls") + Options.outFileName = os.path.join(FolderList[0], "ACCCresults_processed.xls") + if Options.ACCcsv: + ACCCresultsfolder = os.path.join(FolderList[0], "ACCCresults") + try: + os.mkdir(ACCCresultsfolder) + except: + pass + book = '' + else: + book = xlwt.Workbook() + + CaseFile = '' + for folder in os.listdir(FolderPath): + if folder[0:7] == 'package' or folder[0:4] == 'core': + # Get BaseCase.sav inside the first package folder we find + FolderContents = os.listdir(os.path.join(FolderPath, folder)) + for file in FolderContents: + if file == 'AllCase.pfd': + CaseFile0 = os.path.join(os.path.join(FolderPath, folder), file) + CaseFile = os.path.join(os.path.join(FolderPath, folder), file[0:-4]+'_ACCC.pfd') + shutil.copy2(CaseFile0, CaseFile) + break + break + + sys.path.append(PF_PATH) + os.environ['PATH'] += ';' + os.path.dirname(os.path.dirname(PF_PATH)) + ';' + + # import powerfactory + import powerfactory as pf + app = pf.GetApplication() + # app.Show() + user = app.GetCurrentUser() + ComImp = user.CreateObject('ComPFDIMPORT') # objet pour importer pfd file + + app.SetWriteCacheEnabled(1) # Disable consistency check + ComImp.g_file = CaseFile + ComImp.g_target = user # project is imported under the user account + err = ComImp.Execute() # Execute command starts the import process + ComImp.Delete() + app.SetWriteCacheEnabled(0) # Enable consistency check + prjs = user.GetContents('*.IntPrj') + prjs.sort(key=lambda x: x.gnrl_modif, reverse=True) + prj = prjs[0] + prj.Activate() + studycase0 = prj.GetContents('BaseCase.IntCase', 1)[0] # app.GetActiveStudyCase() + studycase0.Activate() + fScen = app.GetProjectFolder('scen') # Dossier contient triggers + scen = fScen.GetChildren(1, 'Base.IntScenario', 1)[0] + scen.Activate() + settrigger0 = studycase0.GetChildren(1, 'set_iteration.SetTrigger', 1) + if settrigger0: + settrigger0[0].outserv = 1 + all_inputs_base = read_pfd(app, prj.loc_name, recal=1) + scen.Deactivate() + + Ops = {} + for item in vars(Options): + if item.startswith('__'): + continue + Ops[item] = getattr(Options, item) + + for it, case in enumerate(CaseList): + treatCase(it, case, book, outputExcel,app,prj,all_inputs_base,os.path.dirname(CaseFile), Ops) + + Options.csvFileName = outputExcel + Options.sheets = [] + + if not Options.ACCcsv: + try: + book.save(outputExcel) + except: # nothing to save + pass + + stop_time=time.clock() + + if len(CaseList)>0: + print("Contingency calculations completed.") + print("Duration: %f minutes" \ + % (round(stop_time-start_time)/60.)) + + if Options.process_directly and len(CaseList)>0: + print("Starting contingency processing.") + if Options.ACCcsv: + FlowsCsvPath = os.path.join(FolderList[0], "ACCCresults", CaseList[0] + " Flows 0.csv") + Options.csvFileName = FlowsCsvPath + sheets = getCSVinfo(Options.csvFileName) + else: + Options.csvFileName = outputExcel + sheets = getXLSinfo(Options.csvFileName) + + sheets2 = sheets.copy() + for sheet in sheets2.keys(): + found=False + for case in CaseList: + if case in sheet: + found=True + break + if not found: + del sheets[sheet] + + if 'CONTINGENCY_PROCESSING' not in dico: + dico['CONTINGENCY_PROCESSING'] = {} + dico['CONTINGENCY_PROCESSING']['TabList']=sheets.keys() + for sheetname in sheets.keys(): + cplist = 'Component_List_For_'+sheetname + dico['CONTINGENCY_PROCESSING']["'" + cplist + "'"]=sheets[sheetname][0] + cnlist = 'Contingency_List_For_'+sheetname + dico['CONTINGENCY_PROCESSING']["'" + cnlist + "'"]=sheets[sheetname][1] + + processXLS(dico) + + + print('Treatment over.') + prj.Delete() + resetAll() + + return + + +def treatCase(it, case, book, outputExcel,app,prj,all_inputs_base,namefolder,Ops): + print('Case ' + case) + + # Rendering options more readable + flush = Ops['flush'] + AvgLineLoad = Ops['AvgLineLoad'][0] + AvgLineLoadPercent = Ops['AvgLineLoadPercent'][0] + AvgTransfoLoad = Ops['AvgTransfoLoad'][0] + AvgTransfoLoadPercent = Ops['AvgTransfoLoadPercent'][0] + AvgLowVoltage = Ops['AvgLowVoltage'][0] + AvgLowVoltagePercent = Ops['AvgLowVoltagePercent'][0] + AvgHighVoltage = Ops['AvgHighVoltage'][0] + AvgHighVoltagePercent = Ops['AvgHighVoltagePercent'][0] + + # PSEN output folder + FolderList = Ops['FolderList'] + OutFolder = Ops['OutFolder'][0] + + #user defined cases + CaseNamesfromFile= Ops['CaseNamesfromFile'] + CsvFiles=Ops['CsvFiles'] + + #input sav options + GetSavsfromFolder = Ops['GetSavsfromFolder'][0] + GetSavsfromFile = Ops['GetSavsfromFile'][0] + Ncases = Ops['Ncases'][0] + + #output options + TrNoGSUorGNDOutput = Ops['TrNoGSUorGNDOutput'][0] + ReportSpaces = Ops['ReportSpaces'][0] + RepeatComponentAllLines = Ops['RepeatComponentAllLines'][0] + MultipleContingencyReport = Ops['MultipleContingencyReport'][0] + WriteIndivExcels = Ops['WriteIndivExcels'][0] + #WriteFlowDifs = Ops['WriteFlowDifs'][0] + + + try: + FolderPath = FolderList[it] + except: + FolderPath = FolderList[0] + + ############################################# ######################### + studycases = prj.GetContents('*.IntCase', 1) + basecase=prj.GetContents('BaseCase.IntCase', 1)[0] + ############################################# ######################### + SavFileList = [] # studycase + if case == 'All': + for case1 in studycases: + # if case.loc_name!='BaseCase': + # table.append(case) + if case1!=basecase: + SavFileList.append(case1) + else: + for filename1 in os.listdir(FolderPath): + if filename1.startswith('simulationDClog_complete'): + if FolderPath[-1] != '\\': + FolderPath += '\\' + fname=filename1 + break + # Get the worst cases automatically or cases from the file + table = [] + numberToGet = 0 + #print case + if case == 'MaxAvgLineLd': + if AvgLineLoad != 0: + numberToGet = AvgLineLoad + elif AvgLineLoadPercent != 0: + numberToGet = Utils.rowNumber(Ops['csvPSENresults'], AvgLineLoadPercent) + if numberToGet != 0: + # Get X highest values + table = Utils.getHighestValue(Ops['LinesStorage'], numberToGet) + + elif case == 'MaxAvgXfmrLd': + if AvgTransfoLoad != 0: + numberToGet = AvgTransfoLoad + elif AvgTransfoLoadPercent != 0: + numberToGet = Utils.rowNumber(Ops['csvPSENresults'], AvgTransfoLoadPercent) + if numberToGet != 0: + table = Utils.getHighestValue(Ops['TransfoStorage'], numberToGet) + + elif case == 'MaxAvgVolt': + if AvgHighVoltage != 0: + numberToGet = AvgHighVoltage + elif AvgHighVoltagePercent != 0: + numberToGet = Utils.rowNumber(Ops['csvPSENresults'], AvgHighVoltagePercent) + if numberToGet != 0: + table = Utils.getHighestValue(Ops['BusStorage'], numberToGet) + + elif case == 'MinAvgVolt': + if AvgLowVoltage != 0: + numberToGet = AvgLowVoltage + elif AvgLowVoltagePercent != 0: + numberToGet = Utils.rowNumber(Ops['csvPSENresults'], AvgLowVoltagePercent) + if numberToGet != 0: + table = Utils.getLowestValue(Ops['BusStorage'], numberToGet) + + else: #case from file + + for i,name in enumerate(CaseNamesfromFile): + if name.startswith(case): + break + path = CsvFiles[i] + file = open(path, 'r') + data = csv.reader(file, delimiter = ';') + table0 = [row for row in data] + table = [] + for row in table0: + if isinstance(row, list): + value = row[0] + else: + value = row + try: + table.append(int(value)) + except: + pass + + for ii in table: + for obj in studycases: + try: + if obj.loc_name.split('_')[1]==str(ii): + SavFileList.append(obj) + break + except: + continue + + + N_files = len(SavFileList) + + + # Extract network component characteristics + # Still unsure if this is necessary for each case, as the gens, loads etc should be the same + # GenDico, LoadDico, LineDico, TfoDico, MotorDico, BusDico, BranchesDico, BusNominal = ExtractGeneratorLoadLineandTransfoDico(it, 0, os.path.join(FolderPath, SavFileList[0]), Ops['PSSE_PATH'][0]) + # GenDico, LoadDico, LineDico, TfoDico, MotorDico, BusDico, BranchesDico = PFExtractGeneratorLoadLineandTransfoDico( + # it, 0, os.path.join(FolderPath, SavFileList[0]), Ops['PF_PATH'][0]) + with open('Data_for_interface', 'rb') as fichier: + mon_depickler = pickle.Unpickler(fichier) + data_file = mon_depickler.load() + def convert_keys_to_string(dictionary): + """Recursively converts dictionary keys to strings.""" + if not isinstance(dictionary, dict): + return dictionary + return dict((str(k), convert_keys_to_string(v)) for k, v in dictionary.items()) + data = convert_keys_to_string(data_file) + BusDico=data['BusDico'] + GenDico = data['MachineDico'] + LoadDico = data['LoadDico'] + LineDico = data['LineDico'] + TfoDico = data['TransfoDico'] + MotorDico = data['MotorDico'] + BranchesDico= dict(list(LineDico.items()) + list(TfoDico.items())) + BusNominal=Ops['BusBaseList'] + + Voltages = {} + Flows = {} + FlowMax = {} + #LoadShed = {} + key = '' + accfiles = [] + ContList = [] + + books = [] + outputExcels = [] + + #create output folder for core + num_cores=1 + if num_cores >= 1: + for core in range(num_cores): + try: + #lock.acquire() + os.mkdir(os.path.join(FolderPath, "N_1_" + case + '_core' + str(core))) + #lock.release() + except: + #lock.release() + pass + #os.mkdir(os.path.join(FolderPath, "N_1_" + case + '_core' + str(core))) + + l = 0 #core number, only 1 core because currently no external multiprocessing in PF mode + if Ops['ACCcsv']: + FlowsCsvPath = os.path.join(FolderPath, "N_1_" + case + '_core' + str(l), case + " core " + str(l) + " Flows 0.csv") + VoltagesCsvPath = os.path.join(FolderPath, "N_1_" + case + '_core' + str(l), case + " core " + str(l) + " Voltage 0.csv") + #LoadShedCsvPath = os.path.join(FolderPath, "N_1_" + case + '_core' + str(l), case + " core " + str(l) + " LoadShed 0.csv") + outputCsv = [FlowsCsvPath,VoltagesCsvPath]#, LoadShedCsvPath] + FlowsCsv = open(FlowsCsvPath,'w', newline='') + VoltagesCsv = open(VoltagesCsvPath,'w', newline='') + #LoadShedCsv = open(LoadShedCsvPath,'w', newline='') + FlowsWriter = csv.writer(FlowsCsv, delimiter=';') + VoltagesWriter = csv.writer(VoltagesCsv, delimiter=';') + #LoadShedWriter = csv.writer(LoadShedCsv, delimiter=';') + book = [FlowsWriter, VoltagesWriter]#, LoadShedWriter] + outputExcel = outputCsv[:] + outputcsvhandles = [FlowsCsv, VoltagesCsv]#, LoadShedCsv] + + #currently not used b/c no external multiprocessing in PF (performed internally) + outputExcels.append(outputExcel) + books.append(book) + + for i in range(len(SavFileList)): + #sav_index = SavFileList.index(savfile) + print ('Case ' + case + ' Iteration ' + str(i + 1) )#str(sav_index + 1) + ret = treatPfds(namefolder, GenDico, LoadDico, LineDico, TfoDico, BusDico, BranchesDico, BusNominal, SavFileList[i],app, prj,all_inputs_base, Ops) + + # Aggregating data (append new info to Voltages, Flows, FlowDifs,BranchRates dictionaries for each new .sav treated) + for cont in list(ret[0]): #add "new" contingencies + if cont not in ContList: + ContList.append(cont) + + for k in ret[1].keys(): + if key == '': + key = k + if k not in Voltages.keys(): + Voltages[k] = {} + for cont_key in ret[1][k].keys(): # Run through ContList + #print "Voltages", k, cont_key, i + if cont_key not in Voltages[k].keys(): + Voltages[k][cont_key]=['']*min(flush,len(SavFileList)-int(np.floor(i/flush)*flush)) + Voltages[k][cont_key][i%flush]=ret[1][k][cont_key] + + for k in ret[2].keys(): + if key == '': + key = k + if k not in Flows.keys(): + Flows[k]={} + for cont_key in ret[2][k].keys(): + #print "Flows", k, cont_key, i + if cont_key not in Flows[k].keys(): + Flows[k][cont_key]=['']*min(flush,len(SavFileList)-int(np.floor(i/flush)*flush)) + Flows[k][cont_key][i%flush] = ret[2][k][cont_key] + + for k in ret[3]: + if key == '': + key = k + if k not in FlowMax.keys(): + FlowMax[k]=str(ret[3][k]) + +# for k in ret[4].keys(): +# if key == '': +# key = k +# if k not in LoadShed.keys(): +# LoadShed[k]={} +# for cont_key in ret[4][k].keys(): +# #print "LoadShed", k, cont_key, i +# if cont_key not in LoadShed[k].keys(): +# LoadShed[k][cont_key]=['']*min(flush,len(SavFileList)-int(np.floor(i/flush)*flush)) +# LoadShed[k][cont_key][i%flush] = ret[4][k][cont_key] + + accfiles.append(ret[5]) + + del ret + + if i % flush == flush - 1 or i == len(SavFileList) - 1: # flush variables to avoid memory errors + + # Separate lines from transformers + TrList, LineList = separateLinesFromTr(Flows, TfoDico, LineDico) + + # Create the first sheet. If it already exists, it will raise an exception which is caught; in this case all sheets of the book are iterated to get the first sheet + if not Ops['ACCcsv']: #Excel output files + sheet = False + try: + sheet = book.add_sheet(case + ' Flows 0') + except: # First sheet already exists + for idx in itertools.count(): # Browse all sheets for the one wanted + sheet = book.get_sheet(idx) + if sheet.name == case + ' Flows 0': + break + + if sheet != False: + row_index = WF.writeFlowsLines(book, outputExcel, case, accfiles, ContList, LineList, Flows, BranchesDico, FlowMax, sheet, Ops) + WF.writeFlowsTransfos(book, outputExcel, case, accfiles, ContList, TrList, Flows, TfoDico, FlowMax, row_index, Ops) + WF.writeVoltages(book, case, accfiles, ContList, Voltages, BusNominal, Ops) + #WF.writeLoadShed(book, case, accfiles, ContList, LoadShed, Ops) + + try: # Save the workbook in case something goes wrong + book.save(outputExcel) + except: # if nothing was output and nothing is to save + pass + + + else: #csv output files + row_index = WFC.writeFlowsLines(book, outputExcel, case, accfiles, ContList, LineList, Flows, BranchesDico, FlowMax, Ops) + WFC.writeFlowsTransfos(book, outputExcel, case, accfiles, ContList, TrList, Flows, TfoDico, FlowMax, row_index, Ops) + WFC.writeVoltages(book, case, accfiles, ContList, Voltages, BusNominal, Ops) + #WFC.writeLoadShed(book, case, accfiles, ContList, LoadShed, Ops) + + # Reset variables + Voltages = {} + Flows = {} + FlowMax = {} + key = '' + accfiles = [] + + if Ops['ACCcsv']: #close csv files written. + for handle in outputcsvhandles: + #handle.save() + handle.close() + + #concatenate ACCC results files (csv format) (for excel format, see PSSE version) + if Ops['ACCcsv']: + FlowsCsvPath = os.path.join(FolderList[0], "ACCCresults", case + " Flows 0.csv") + VoltagesCsvPath = os.path.join(FolderList[0], "ACCCresults", case + " Voltage 0.csv") + #LoadShedCsvPath = os.path.join(FolderList[0], "ACCCresults", case + " LoadShed 0.csv") + for fname in [FlowsCsvPath,VoltagesCsvPath]:#, LoadShedCsvPath]: + if os.path.isfile(fname): + os.remove(fname) + flowsfilelist = [] + voltagesfilelist = [] + #loadshedfilelist = [] + for outputcsv in outputExcels: + flowsfilelist.append(outputcsv[0]) + voltagesfilelist.append(outputcsv[1]) + #loadshedfilelist.append(outputcsv[2]) + join_csv(FlowsCsvPath, flowsfilelist) + join_csv(VoltagesCsvPath, voltagesfilelist) + #join_csv(LoadShedCsvPath, loadshedfilelist) + + + return + + + +def treatPfds(namefolder, GenDico, LoadDico, LineDico, TfoDico, BusDico, BranchesDico, BusNominal, study,app, prj, all_inputs_base, Ops): + Voltages = {} + Flows = {} + FlowMax = {} + LoadShed = {} + ContList = () + + #contingency options + Vmin = Ops['Vmin'][0] + Vmax = Ops['Vmax'][0] + ContRate = Ops['ContRate'][0] + flowlimitlines = Ops['flowlimitlines'][0] + flowlimittransfos = Ops['flowlimittransfos'][0] + Tolerance = Ops['Tolerance'][0] + TripLines = Ops['TripLines'][0] + TripTransfos = Ops['TripTransfos'][0] + TripGenerators = Ops['TripGenerators'][0] + TripBuses = Ops['TripBuses'][0] + IsolatedGen = Ops['IsolatedGen'][0] + + # Remove isolated branches (if a bus appears only once in branch list, its an isolated branch) + singleBuses = [] + notSingleBuses = [] + pairs = [] + for branch in BranchesDico: + branch = BranchesDico[branch] + ton = int(branch['TONUMBER']) + fromn = int(branch['FROMNUMBER']) + if [ton, fromn] in pairs: + continue + else: + pairs.append([ton, fromn]) + if fromn in notSingleBuses: + pass + elif fromn in singleBuses: + singleBuses.remove(fromn) + notSingleBuses.append(fromn) + else: + singleBuses.append(fromn) + if ton in notSingleBuses: + pass + elif ton in singleBuses: + singleBuses.remove(ton) + notSingleBuses.append(ton) + else: + singleBuses.append(ton) + newDict = {} + for branch in LineDico: + if int(LineDico[branch]['FROMNUMBER']) not in singleBuses and int( + LineDico[branch]['TONUMBER']) not in singleBuses: + newDict[branch] = LineDico[branch] + LineDico = copy.deepcopy(newDict) + + study.Activate() + with open(namefolder+'/data_dico', 'rb') as fichier: + mon_depickler = pickle.Unpickler(fichier) + dicopfd = mon_depickler.load() + + nn = int(''.join(ele for ele in study.loc_name if ele.isdigit())) # cas number + fScen = app.GetProjectFolder('scen') # Dossier contient triggers + #pdb.set_trace() + scenario = fScen.GetChildren(1, 'Case_'+str(nn)+'.IntScenario', 1) + scenario[0].Activate() + opf = app.GetFromStudyCase('ComOpf') + + if opf.iopt_obj=='shd': #update load levels + erropf = opf.Execute() # lancer opf, + all_inputs_base1 = read_pfd(app, prj.loc_name) + loads_base = all_inputs_base1[4] + Psetpoints = [] + Qsetpoints = [] + for load in loads_base: + LSscale = load[6].GetAttribute("s:scale") + P_setpoint = load[6].GetAttribute('e:plini')#('s:pini_set') + Q_setpoint = load[6].GetAttribute('e:qlini')#('s:qini_set') + Psetpoints.append(LSscale*P_setpoint) + Qsetpoints.append(LSscale*Q_setpoint) + + for it,load in enumerate(loads_base): +# try: #disactivate triggers if there are any +# loadPscale = load[6].GetChildren(1, 'plini.Charef', 1) +# loadQscale = load[6].GetChildren(1, 'qlini.Charef', 1) +# loadPscale[0].outserv = 1 +# loadQscale[0].outserv = 1 +# except: +# pass + load[6].plini = Psetpoints[it] + load[6].qlini = Qsetpoints[it] + +# #check to see if loads properly initialized +# all_inputs_base1 = read_pfd(app, prj.loc_name, 1) +# load_base = all_inputs_base1[4] +# print([l[1] for l in loads_base]) +# print([l[1] for l in load_base]) +# print('') +# for ind in range(len(load_base)): +# l0 = loads_base[ind] +# l1 = load_base[ind] +# if abs(l0[1]-l1[1])<0.01 and abs(l0[2]-l1[2])<0.01: +# pass +# else: +# print("loads not saved correctly after load-shedding") + #pdb.set_trace() + + all_inputs_base1 = read_pfd_simple(app, prj.loc_name) + plants_base = all_inputs_base1[0] + + try: + cntdef = study.GetContents('*.ComNmink', 1)[0] + except: + cntdef = study.CreateObject('ComNmink') + cntdef.optSel = 0 #all element + cntdef.iopt_n1 = 1 + cntdef.iopt_n2 = 0 + cntdef.iopt_cmd = 0 # 0: library; 1: direct + cntdef.optSel = 0 #0: whole cases, 1: selection + fFaults = app.GetProjectFolder('fault') # dossier Faults + try: + for obj in study.GetContents('*.ComSimoutage', 1): + obj.Delete() + except: + pass + try: + for obj in fFaults.GetContents('*.IntEvt', 1): + obj.Delete() + except: + pass + + # line N-1 contingencies + if TripLines: + cntdef.iopt_lne=1 + #transfo N-1 contingencies + if TripTransfos: + cntdef.iopt_trf = 1 + #generator N-1 contingencies + if TripGenerators: + cntdef.iopt_sym = 1 + if TripLines or TripTransfos or TripGenerators: + cntdef.iopt_n1 = 1#N_1 + cntdef.iopt_n2 = 0#N_2 + cntdef.iopt_nc = 0 # N_2 + cntdef.iopt_cmd = 0 # 0: library; 1: direct + cntdef.optSel = 0 # 0: whole cases, 1: selection + cntdef.Execute() + + plants_base_before = plants_base + buses_base = all_inputs_base[0] + lines_base = all_inputs_base[1] + transf_base = all_inputs_base[2] + plants_base = all_inputs_base[3] + transf3_base = all_inputs_base[7] + # buses_base ; lines_base; transf_base; plants_base; transf3_bas + + + + # settriger_iter = studycase.GetChildren(1, 'set_iteration.SetTrigger', 1)[0] + # settriger_iter.Activate() + # compy = studycase.GetContents('comp0.ComPython', 0)[0] + # compy.Execute() + + + # Automatic N-2 + try: + Set = study.GetContents('*.SetSelect',1)[0] + Set.Clear() + except: + Set = study.CreateObject('SetSelect') + if Ops['AutoN2Lines'] or Ops['AutoN2Transfos'] or Ops['AutoN2Gen']: + cntdef.iopt_n1 = 0 + cntdef.iopt_n2 = 1 + cntdef.iopt_cmd = 0 # 0: library; 1: direct + cntdef.optSel = 1 # 0: whole cases, 1: selection + cntdef.sel_user = Set + + # Automatic N-2 Lines + if Ops['AutoN2Lines']: + for key in LineDico: + if key[-3:-1] == 'BR' or key[-2:] == 'BR': + continue + if key[-3:-1] == 'Br' or key[-2:] == 'Br': + continue + if key[-3:-1] == 'SW' or key[-2:] == 'SW': + continue + if key[-3:-1] == 'Sw' or key[-2:] == 'Sw': + continue + aa = LineDico[key] + # Filling the automatic N-2's list if needed + voltage = BusNominal[aa['TONAME']] + if voltage in Ops['AutoN2Lines']: + for bb in lines_base: + if bb[0]==aa['FROMNUMBER'] and bb[1]==aa['TONUMBER']and bb[10]==aa['ID']: + Set.AddRef(bb[11]) + if Ops['AutoN2Melange']: + cntdef.Execute() + Set.Clear() + + # Automatic N-2 Transfos + if Ops['AutoN2Transfos']: + # verifier=False + for key in TfoDico: + tfo = TfoDico[key] + voltage1 = BusNominal[tfo['TONAME']] + voltage2 = BusNominal[tfo['FROMNAME']] + couple = (voltage1, voltage2) + couple2 = (voltage2, voltage1) + if tfo['#WIND'] == 2: + if couple in Ops['AutoN2Transfos'] or couple2 in Ops['AutoN2Transfos']: + # verifier=True + for bb in transf_base: + if bb[0] == tfo['FROMNUMBER'] and bb[1] == tfo['TONUMBER'] and bb[10] == tfo['ID']: + Set.AddRef(bb[11]) + if tfo['#WIND'] == 3: + voltage3 = BusNominal[tfo['3NAME']] + couple1 = (voltage1, voltage2, voltage3) + couple2 = (voltage3, voltage1, voltage2) + couple3 = (voltage2, voltage3, voltage1) + couple4 = (voltage1, voltage3, voltage2) + couple5 = (voltage2, voltage1, voltage3) + couple6 = (voltage3, voltage2, voltage1) + couples = (couple1, couple2, couple3, couple4, couple5, couple6) + AddKey = False + for couple in couples: + if couple in Ops['AutoN2Transfos']: + for bb in transf3_base: + if bb[0] == tfo['FROMNUMBER'] and bb[1] == tfo['TONUMBER'] and bb[2] == tfo['3NUMBER'] and bb[13] == tfo['ID']: + Set.AddRef(bb[14]) + break + if not Ops['AutoN2Melange']: + cntdef.Execute() + Set.Clear() + # Automatic N-2 Bus + if Ops['AutoN2Bus']: + for bus in BusDico: + name = bus[2] + voltage = BusNominal[name] + if voltage in Ops['AutoN2Bus']: + for bb in buses_base: + if bb[3]==name: + Set.AddRef(bb[8]) + if not Ops['AutoN2Melange']: + cntdef.Execute() + Set.Clear() + + if Ops['AutoN2Gen']: + for gen in plants_base_before: + Set.AddRef(gen[11]) + if not Ops['AutoN2Melange']: + cntdef.Execute() + Set.Clear() + # Execute + if Ops['AutoN2Melange']: + cntdef.Execute() + + cntana = study.CreateObject('ComSimoutage') + cntana.loadmax = min(Ops['flowlimitlines'][0], Ops['flowlimittransfos'][0]) # 0 pour afficher tous, si on met 90, afficher seulement les valeurs au dessus de 90 + cntana.vlmax = Ops['Vmax'][0] # 1 pour afficher tous + cntana.vlmin = Ops['Vmin'][0] # 1 pour afficher tous + cntana.iPerformOpt = 0 #0 monitor whole system, 1 monitor specific region + cntana.iEnableParallel = 1 + + paralcomp = study.CreateObject('SetParalman') + paralcomp.SlaveNum = 1 #use N-1 cores (not all) to allow for user to keep working on computer + + + nb = 0 + ContList=[] + rel = {} + rel['contigency']={} + + for obj in fFaults.GetContents('*.IntEvt', 1): + # stop = time.clock(); print('=== ' + str(round(stop - start, 3)) + ' seconds'); start = stop + if nb == 0: + aa = cntana.CreateObject('Comoutage', obj.loc_name) + cc = cntana.CreateObject('Comoutage', obj.loc_name) + else: + aa = cntana.AddCopy(cc, obj.loc_name) + ContList.append(obj.loc_name) + + # stop = time.clock(); print('aa ' + str(round(stop - start, 3)) + ' seconds'); # start = stop + temp = [] + for obj1 in obj.GetContents('*.EvtShc', 1): + temp.append(obj1.p_target) + # stop = time.clock(); print('bb ' + str(round(stop - start, 3)) + ' seconds'); start = stop + aa.SetObjs(temp) + # aa.cpCase=obj + nb += 1 + aa.number = nb + rel['contigency'][nb]=obj.loc_name + + cc.Delete() + ldf=study.GetContents('*.Comldf',1)[0] + + if Ops['AdjTaps']: + ldf.iopt_at = 1 # automatic tap transfos + else: + ldf.iopt_at=0 + if Ops['AdjustShunts']: + ldf.iopt_asht = 1 # automatic shunt + else: + ldf.iopt_asht = 0 + if Ops['VarLimits'][0]: + ldf.iopt_lim=1 + else: + ldf.iopt_lim=0 + if Ops['ActiveLimits']: + ldf.iopt_plim=1 + else: + ldf.iopt_plim = 0 + if Ops['FlatStart']: + ldf.iopt_noinit=1 + else: + ldf.iopt_noinit=0 + ldf.iPbalancing = Ops['DispatchMode'] + + #set active power of synchronous generators + #all_inputs_base1 = read_pfd_simple(app, prj.loc_name) + #plants_base = all_inputs_base1[0] + #all_inputs3 = read_pfd(app, prj.loc_name, recal=0) + #plants_base = all_inputs3[3] + + +# for plant in plants_base: +# try: +# print(plant[2],plant[3]) +# plant[11].pgini = plant[3] +# except: +# plant[11].pgini_a = plant[3] + + + # ldf.iopt_lim = Ops['VarLimits'] # reactive power limit + # ldf.iopt_plim = Ops['ActiveLimits'] # active power limit + # ldf.iopt_limScale = 1 # scale factor + # ldf.iopt_noinit = Ops['FlatStart'] # no initialisation load flow + + # Run Contingency Analysis + err = cntana.Execute() + + if (err!=0): + print('Error: Power Factory Contingency Analysis ended in error. Network probably does not converge for load-flows.') + + resFile = study.GetContents('Contingency Analysis*.ElmRes', 1)[0] + app.PrintPlain(resFile) + resFile.Load() + nbrow = resFile.GetNumberOfRows() + # bus1 = prj.GetChildren(1, 'Bus 1.ElmTerm', 1)[0] + + for bus in buses_base: + #Voltages[bus[3]]={} + col = resFile.FindColumn(bus[8], 'm:u') + for row in range(1,nbrow-1): + cntnumber=resFile.GetValue(row,1) + cntname = rel['contigency'][int(cntnumber[1])] + aa = resFile.GetValue(row , col) + if aa[0] == 0: + val = aa[1] +# else: +# val='' + if val < Vmin or val > Vmax: + if bus[3] not in Voltages.keys(): + Voltages[bus[3]] = {} + Voltages[bus[3]][cntname]=val + + for line in lines_base: + #aa=[frombus_number,tobus_number,currentA,pourcent,pourcent,pourcent,flowP,flowQ,frombus_name,tobus_name,idline,line] + #Flows[line[12]]={} + col = resFile.FindColumn(line[11], 'c:loading') + for row in range(1,nbrow-1): + cntnumber=resFile.GetValue(row,1) + cntname = rel['contigency'][int(cntnumber[1])] + aa = resFile.GetValue(row , col) + if aa[0] == 0: + val = aa[1] +# else: +# val='' + if val > flowlimitlines: + if line[12] not in Flows.keys(): + FlowMax[line[12]] = np.sqrt(3) * line[11].Unom * line[11].Irated + if line[12] not in Flows.keys(): + Flows[line[12]] = {} + Flows[line[12]][cntname]=val + + for tfo in transf_base: + FlowMax[tfo[12]] = tfo[11].Snom_a + Flows[tfo[12]]={} + col = resFile.FindColumn(tfo[11], 'c:loading') + for row in range(1,nbrow-1): + cntnumber=resFile.GetValue(row,1) + cntname = rel['contigency'][int(cntnumber[1])] + aa = resFile.GetValue(row , col) + if aa[0] == 0: + val = aa[1] +# else: +# val='' + if val > flowlimittransfos: + if tfo[12] not in Flows.keys(): + Flows[tfo[12]] = {} + Flows[tfo[12]][cntname]=val + + for tfo in transf3_base: + try: + FlowMax[tfo[15]]=max(tfo[14].typ_id.strn3_h,tfo[14].typ_id.strn3_m,tfo[14].typ_id.strn3_l)*tfo[14].nt3nm + except: + FlowMax[tfo[15]]='' + Flows[tfo[15]]={} + col = resFile.FindColumn(tfo[14], 'c:loading') + for row in range(1,nbrow-1): + cntnumber=resFile.GetValue(row,1) + cntname = rel['contigency'][int(cntnumber[1])] + aa = resFile.GetValue(row , col) + if aa[0] == 0: + val = aa[1] +# else: +# val='' + if val > flowlimittransfos: + if tfo[15] not in Flows.keys(): + Flows[tfo[15]] = {} + Flows[tfo[15]][cntname]=val + + return ContList, Voltages, Flows, FlowMax, LoadShed,study.loc_name + + + +if __name__ == '__main__': + from dicoN1 import Dico as dico + run(dico) diff --git a/ProcessOutputs_Eficas/TreatOutputs/UpdateOptionsPF.py b/ProcessOutputs_Eficas/TreatOutputs/UpdateOptionsPF.py new file mode 100644 index 00000000..1601f11a --- /dev/null +++ b/ProcessOutputs_Eficas/TreatOutputs/UpdateOptionsPF.py @@ -0,0 +1,298 @@ + +import Options +import csv +import sys +import os +import pdb + +def UpdateOptions(dico): + Options.SelectedBusBase=[] + Options.BusByNom = [False] + Options.LinesByNom = [False] + Options.SelectedLinesBase=[] + Options.TransfoByNom = [False] + Options.SelectedTransfoBase=[] + if 'CASE_SELECTION' in dico: + curdico = dico['CASE_SELECTION'] + for key in curdico.keys(): + if key=='OutputNewCsv': + Options.OutputNCSV = curdico[key] + elif key=='MaxDepth': + Options.RecursiveDepth = curdico[key] + elif key=='PSEN_results_folder': + Options.FolderList = [curdico[key]] + elif key=='PSEN_results_csvfile': + Options.csvPSENresults = curdico[key] + elif key=='PSEN_results_csvfile_cleaned': + Options.AlreadyCleaned = curdico[key] + elif key=='NewCsvFile': + Options.csvCleanedFileName = curdico[key] + elif key=='DecimalSeparator': + Options.DecimalSeparator = [curdico[key]] + elif key=='PSSE_path': + Options.PSSE_PATH = [curdico[key]] + elif key=='PF_path': + Options.PF_PATH = [curdico[key]] + elif key=='Python3_path': + Options.Python3_path = [curdico[key]] + elif key=='BusesList': + if curdico[key] != []: + Options.BusByNom = [True] + if isinstance(curdico[key], list): + Options.SelectedBusBase = [float(item) for item in curdico[key]] + else: + Options.SelectedBusBase = [float(curdico[key])] + elif key=='LinesList': + if curdico[key] != []: + Options.LinesByNom = [True] + if isinstance(curdico[key], list): + Options.SelectedLinesBase = [float(item) for item in curdico[key]] + else: + Options.SelectedLinesBase = [float(curdico[key])] + elif key=='TransformersList': + if curdico[key] != []: + Options.TransfoByNom = [True] + if isinstance(curdico[key], list): + newList = [] + for item in curdico[key]: + u1 = item.split('-')[0].strip("'").strip('"') + u2 = item.split('-')[1].strip("'").strip('"') + U1 = float(u1) + U2 = float(u2) + if len(item.split('-'))==3: + u3 = item.split('-')[2].strip("'").strip('"') + U3 = float(u3) + newList.append([U1,U2,U3]) + else: + newList.append([U1,U2]) + Options.SelectedTransfoBase = newList + else: + u1 = item.split('-')[0].strip("'").strip('"') + u2 = item.split('-')[1].strip("'").strip('"') + U1 = float(u1) + U2 = float(u2) + Options.SelectedTransfoBase = [[U1,U2]] + if len(item)==3: + u3 = item.split('-')[2].strip("'").strip('"') + U3 = float(u3) + Options.SelectedTransfoBase = [[U1,U2,U3]] + + else: + print('CASE_SELECTION ', key) + + if 'N_PROCESSING_OPTIONS' in dico: + curdico = dico['N_PROCESSING_OPTIONS'] + for key in curdico.keys(): + if key=='Branches': + if sum(x>0 for x in curdico[key])>0 and Options.Thresholds == False: + if Options.Thresholds ==False: + Options.Thresholds = True + Options.BranchThreshold = list(curdico[key]) + elif key=='Transformers': + if sum(x>0 for x in curdico[key])>0 and Options.Thresholds == False: + if Options.Thresholds ==False: + Options.Thresholds = True + Options.TransfoThreshold = list(curdico[key]) + elif key=='High_voltage': + if sum(x>0 for x in curdico[key])>0 and Options.Thresholds == False: + if Options.Thresholds ==False: + Options.Thresholds = True + Options.HighVoltageThreshold = list(curdico[key]) + elif key=='Low_voltage': + if sum(x>0 for x in curdico[key])>0 and Options.Thresholds == False: + if Options.Thresholds ==False: + Options.Thresholds = True + Options.LowVoltageThreshold = list(curdico[key]) + elif key=='Output_bus_values': + Options.OutputNValues[0]=curdico[key] + elif key=='Output_lines_values': + Options.OutputNValues[1]=curdico[key] + elif key=='Output_transformer_values': + Options.OutputNValues[2]=curdico[key] + else: + print('N_PROCESSING_OPTIONS ', key) + else: + Options.OutputNValues = [False,False,False] + Options.Thresholds = False + + if 'CONTINGENCY_SELECTION' in dico: + curdico = dico['CONTINGENCY_SELECTION'] + for key in curdico.keys(): + if key=='SelectionMethod': + if curdico[key]== None: + Options.CaseSelectionMode[0] = '' + elif curdico[key].lower()=='caseselectionfromfile': + Options.CaseSelectionMode[0] = "File" + elif curdico[key].lower()=='selectallcases': + Options.CaseSelectionMode[0] = "All" + elif curdico[key].lower()=='selectworstcases': + Options.CaseSelectionMode[0] = "Worst" + elif key.startswith('case_name'): + pass + elif key.startswith('csv_file'): + pass + elif key[0:3]=='Avg': + if "Transfo" not in key: + setattr(Options,key,[curdico[key]]) + elif key == "AvgTransformerLoad": + Options.AvgTransfoLoad = [curdico[key]] + elif key == "AvgTransformerLoadPercent": + Options.AvgTransfoLoadPercent = [curdico[key]] + + elif key[0:4]=="Trip": + setattr(Options,key,[curdico[key]]) + + elif key=="BusesList": + if isinstance(curdico[key], list): + Options.AutoN2Bus = [float(item) for item in curdico[key]] + else: + Options.AutoN2Bus = [float(curdico[key])] + elif key == "MixType": + Options.AutoN2Melange = curdico[key] + elif key == "GenList": + Options.AutoN2Gen = curdico[key] + elif key=="LinesList": + if isinstance(curdico[key], list): + Options.AutoN2Lines = [float(item) for item in curdico[key]] + else: + Options.AutoN2Lines = [float(curdico[key])] + elif key=="TransformersList": + if isinstance(curdico[key], list): + newList = [] + for item in curdico[key]: + u1 = item.split('-')[0].strip("'").strip('"') + u2 = item.split('-')[1].strip("'").strip('"') + U1 = float(u1) + U2 = float(u2) + if len(item)==3: + u3 = item.split('-')[2].strip("'").strip('"') + U3 = float(u3) + newList.append((U1,U2,U3)) + else: + newList.append((U1,U2)) + Options.AutoN2Transfos = newList + else: + u1 = item.split('-')[0].strip("'").strip('"') + u2 = item.split('-')[1].strip("'").strip('"') + U1 = float(u1) + U2 = float(u2) + Options.AutoN2Transfos = [(U1,U2)] + if len(item)==3: + u3 = item.split('-')[2].strip("'").strip('"') + U3 = float(u3) + Options.AutoN2Transfos = [(U1,U2,U3)] + + elif "ComponentList" in key: + lst = [] + for item in curdico[key]: + item2 = item.strip("'").strip('\"') + lst.append(item2) + Options.CustomContingencies.append(lst) + elif "consigne" in key: + pass + else: + print('CONTINGENCY_SELECTION ',key) + + #ensure the order of cases and files is correct + if 'case_name' in curdico: + name = 'case_name' + csvfile = 'csv_file' + Options.CaseNamesfromFile.append(curdico[name]) + Options.CsvFiles.append(curdico[csvfile]) + Options.NCasesfromFile[0] +=1 + else: + ite = 1 + stop = False + while not stop: + try: + name = 'case_name_' + str(ite) + csvfile = 'csv_file_' + str(ite) + Options.CaseNamesfromFile.append(curdico[name]) + Options.CsvFiles.append(curdico[csvfile]) + Options.NCasesfromFile[0] +=1 + ite += 1 + except: + stop = True + + if 'CONTINGENCY_OPTIONS' in dico: + curdico = dico['CONTINGENCY_OPTIONS'] + for key in curdico.keys(): + if key=='ContingencyRate': + Options.ContRate = [curdico[key]] + elif key=='FlowLimitLines': + Options.flowlimitlines = [curdico[key]] + elif key=='FlowLimitTransformers': + Options.flowlimittransfos = [curdico[key]] + elif key=="Vmin" or key=="Vmax" or key=="Tolerance" or key=='VarLimits': + setattr(Options,key,[curdico[key]]) + elif key=="AdjustTaps": + Options.AdjTaps = curdico[key] + elif key=="AdjustShunts": + Options.AdjustShunts = curdico[key] + elif key=="AdjustSwitchedShunts": + Options.AdjSwitchedShunts = curdico[key] + elif key=="SolutionMethod": + value = curdico[key].split("-")[0].strip('"').strip("'") + Options.SolutionMethod = [int(value)] + elif key=="ActiveLimits": + Options.ActiveLimits = curdico[key] + elif key=="FlatStart": + Options.FlatStart = curdico[key] + elif key=="DispatchMode": + if curdico[key]=="ReferenceMachine": + Options.DispatchMode = 0 + elif curdico[key]=='LoadAtReferenceBus': + Options.DispatchMode = 1 + elif curdico[key]=='StaticGeneratorAtReferenceBus': + Options.DispatchMode = 2 + elif curdico[key]=='DistributedSlackByLoads': + Options.DispatchMode = 3 + elif curdico[key]=='DistributedSlackBySynchronousGenerators': + Options.DispatchMode = 4 + elif curdico[key]=='DistributedSlackBySynchronousAndStaticGenerators': + Options.DispatchMode = 5 + elif key=="flush": + Options.flush = int(curdico["flush"]) + elif key=="output_file_format": + if curdico[key]=='csv': + Options.ACCcsv = True + elif curdico[key]=='xls': + Options.ACCcsv = False + elif key =="process_directly": + Options.process_directly = curdico[key] + else: + print('CONTINGENCY_OPTIONS ',key) + + #if dico.has_key('CONTINGENCY_PROCESSING'): + # curdico = dico['CONTINGENCY_PROCESSING'] + for key in dico.keys(): + if 'CONTINGENCY_PROCESSING' in key: + curdico = dico[key] + + Options.selectedDoubleCol = {} + Options.selectedDoubleRow = {} + for key in curdico.keys(): + if key=='XLS_file': + Options.csvFileName = curdico[key] + if Options.csvFileName.endswith('.csv'): + Options.ACCcsv = True + elif Options.csvFileName.endswith('.xls'): + Options.ACCcsv = False + elif key.strip("'").strip('"').startswith('Contingency_List_For_'): + tab = key.strip("'").strip('"').strip('Contingency_List_For_') + Options.selectedDoubleCol[tab]=[item.strip("'").strip('"') for item in curdico[key]] + elif key.strip("'").strip('"').startswith('Component_List_For_'): + tab = key.strip("'").strip('"').strip('Component_List_For_') + Options.selectedDoubleRow[tab]=[item.strip("'").strip('"') for item in curdico[key]] + elif key=='TabList': + pass + else: + print('CONTINGENCY_PROCESSING ', key) + + return +# for key in dico.keys(): +# atraiter=dico[key] +# for key2 in atraiter.keys(): +# param = atraiter[key2] +# Optionsparam=DicoTraduction[key][key2] +# setattr(Options, Optionsparam,param) \ No newline at end of file diff --git a/ProcessOutputs_Eficas/TreatOutputs/UtilsPF.py b/ProcessOutputs_Eficas/TreatOutputs/UtilsPF.py new file mode 100644 index 00000000..dfb2e4f8 --- /dev/null +++ b/ProcessOutputs_Eficas/TreatOutputs/UtilsPF.py @@ -0,0 +1,394 @@ +import Options +import csv +import sys +import os +import pdb +import shutil + +sys.path.append(os.path.dirname(os.path.dirname(__file__))) +#from ExtractGeneratorLoadLineandTransfoDico import * + +def OutputKeptItems(book): + + OKI = True + if OKI: + sheet = book.Worksheets.Add() + sheet.Name = 'Ignored summary' + + # Output kept & ignored lines/tfos + sheet.Cells(1, 1).Value = 'Kept branches' + sheet.Cells(1, 3).Value = 'Ignored branches' + + kbr = [] + ibr = Options.RadialLines + + for item in Options.TrueLines: + if 'LI' in item.split('__')[-1]:#Valentin + if Options.LinesByNom[0] and Options.LinesBaseList[item] not in Options.SelectedLinesBase: + ibr.append(item) + else: + kbr.append(item) + elif 'TR' in item.split('__')[-1]: + if Options.TransfoByNom[0] and Options.TransfoBaseList[item] not in Options.SelectedTransfoBase: + ibr.append(item) + else: + kbr.append(item) + + sheet.Cells(2, 1).Value = '(total: ' + str(len(kbr)) + ')' + sheet.Cells(2, 3).Value = '(total: ' + str(len(ibr)) + ')' + + for i in range(len(kbr)): + sheet.Cells(i + 3, 1).Value = kbr[i] + for i in range(len(ibr)): + sheet.Cells(i + 3, 3).Value = ibr[i] + + # Output kept & ignored buses + sheet.Cells(1, 6).Value = 'Kept buses' + sheet.Cells(1, 8).Value = 'Ignored buses' + + kb = [] + ib = [] + for item in Options.BusBaseList: + if item not in Options.IsolatedGenList: + if Options.BusByNom[0] and Options.BusBaseList[item] in Options.SelectedBusBase: + kb.append(item) + elif not Options.BusByNom[0]: + kb.append(item) + else: + ib.append(item) + else: + ib.append(item) + + sheet.Cells(2, 6).Value = '(total: ' + str(len(kb)) + ')' + sheet.Cells(2, 8).Value = '(total: ' + str(len(ib)) + ')' + + for i in range(len(kb)): + sheet.Cells(i + 3, 6).Value = kb[i] + for i in range(len(ib)): + sheet.Cells(i + 3, 8).Value = ib[i] + else: + pass + +def rowNumber(path, percent): + with open(path, 'r') as csvfile: + data = csv.reader(csvfile, delimiter=';') + count = 0 + for row in data: + try: + test = int(row[0])+1 + count += 1 + except: + pass + return int(float(percent * 0.01) * float(count)) + +def getData(path,TransfoDico,LineDico,BusDico): + + cols = [] + names = [] + BusStorage = [] + TransfoStorage = [] + LinesStorage = [] + BusMean = [] + TransfoMean = [] + LinesMean = [] + it = 0 + + Options.TotalBusStorage = [[]] + Options.TotalTransfoStorage = [[]] + Options.TotalLinesStorage = [[]] + Options.CaseIDStorage = [] + + #convert decimal separator to commas for csv files + if Options.DecimalSeparator[0]==",": + csvfilesave = path[0:-4] + "_comma" + ".csv" + shutil.copy2(path, csvfilesave) + os.remove(path) + + h = open(csvfilesave,"r") + crd = csv.reader(h,delimiter=";") + g = open(path, "w", newline='\n') + cwt = csv.writer(g, delimiter=";") + for row in crd: + rowwcommas = [] + for item in row: + try: + isnum = float(str(item).replace(",","."))+1 + rowwcommas.append(str(item).replace(",",".")) + except: + rowwcommas.append(item) + cwt.writerow(rowwcommas) + h.close() + g.close() + + with open(path, 'r') as csvfile: + data = csv.reader(csvfile, delimiter=';') + for row in data: + if len(row)>0: + if 'Summary Table' in row[0]: #dont mistake load shedding and shunt adjustment tables as their own iterations, break out of loop here + break + try: + #column number where individual element data is outputted in csv file + if names!=[]: + iGen=cols.index('Y:GenTot') + if float(row[iGen])==0: + continue + # if float(row[10]) == 0: + # continue + except: + pass + if cols == []: # first row -> fill the cols[] list + for item in row: + cols.append(item) + elif names == []: # Second row -> fill the names[] list + for i in range(len(row)): + names.append(row[i]) + else: # Store the data from the selected cols + tmpBus = [] + tmpTr = [] + tmpLine = [] + tmpAll = [] + for i in range(len(row)): + if i == 0: + it += 1 + # Check if this row is data + try: + int(row[i]) + except: + break + #try: + if 1: + if cols[i].find('VBus') != -1: + if (Options.BusByNom[0] and Options.BusBaseList[names[i]] not in Options.SelectedBusBase): + continue + elif names[i] in Options.IsolatedGenList: + continue + tmpAll.append(row[i]) + tmpBus.append(float(row[i])) + if it == 1: + Options.NamesStorage.append(names[i]) + Options.ColsStorage.append(cols[i]) + Options.TotalBusStorage[0].append(names[i]) + elif cols[i].find(':Tr%Rate') != -1: + if Options.AlreadyCleaned: + tfoname=names[i] + else: + idname = cols[i].strip().split(' id')[-1] # separer string par ' id' + name3 = cols[i].strip().split(' id')[0].split(' ')[1] + Bus1 = int(name3.split('-')[0]) + Bus2 = int(name3.split('-')[1]) + tfoname = BusDico[Bus1][2] + '_' + BusDico[Bus2][2] + '_' + str( + idname) + '__' + 'TR' + + # idname = cols[i].strip().split(' id')[-1] # separer string par ' id' + # Bus1 = names[i].split('-')[0].strip() + # Bus2 = names[i].split('-')[1].strip() + # # idname = 'TR' + cols[i].strip().split(' ')[-1][2:] + # # Bus1 = names[i].split(' - ')[0].strip() + # # Bus2 = names[i].split(' - ')[1].strip() + # tfoname = Bus1 + '_' + Bus2 + '_' + idname + '_' + 'Tr' + tfoname = tfoname.replace(" ", "_") + tfoname = tfoname.replace("-", "_") + tfoname = tfoname.replace(".", "_") + tfoname = tfoname.replace("/", "_") + tfoname = tfoname.replace("&", "and") + try: + int(tfoname[0]) + tfoname = "_" + tfoname + except: + pass + # tfoname = Bus1 + "__" + Bus2 + "__" + idname + # tfoname = tfoname.replace(" ","_") + # tfoname = tfoname.replace("-","_") + # tfoname = tfoname.replace(".","_") + # tfoname = tfoname.replace("&","and") + # try: + # int(tfoname[0]) + # tfoname="_" + tfoname + # except: + # pass + if (Options.TransfoByNom[0] and Options.TransfoBaseList[tfoname] not in Options.SelectedTransfoBase): + continue + elif Options.RecursiveDepth > 0 and tfoname not in Options.TrueLines: + continue + tmpAll.append(row[i]) + tmpTr.append(float(row[i])) + if it == 1: + Options.NamesStorage.append(tfoname) + Options.ColsStorage.append(cols[i]) + Options.TotalTransfoStorage[0].append(tfoname) + elif cols[i].find(':Tr3%Rate') != -1: + if Options.AlreadyCleaned: + tfoname=names[i] + [before, after] = names[i].split('__Wnd') + idname = after.split('__')[1] + tfoname_nownd = before + '__' + idname + else: + idname = cols[i].strip().split(' id')[-1].split(' wnd')[0] # separer string par ' id' + name3=cols[i].strip().split(' id')[0].split(' ')[1] + Bus1 = int(name3.split('-')[0]) + Bus2 = int(name3.split('-')[1]) + Bus3 = int(name3.split('-')[2]) + tfoname=BusDico[Bus1][2]+'_'+BusDico[Bus2][2]+'_'+BusDico[Bus3][2]+'_' + str(idname) + '__' + 'TR3' + + # tfoname=names[i]+str(idname)+ '_' + 'Tr3' + tfoname = tfoname.replace(" ", "_") + tfoname = tfoname.replace("-", "_") + tfoname = tfoname.replace(".", "_") + tfoname = tfoname.replace("/", "_") + tfoname = tfoname.replace("&", "and") + try: + int(tfoname[0]) + tfoname = "_" + tfoname + except: + pass + + if (Options.TransfoByNom[0] and Options.TransfoBaseList[tfoname] not in Options.SelectedTransfoBase): + continue +## elif Options.RecursiveDepth >0 and tfoname not in Options.TrueLines: #currently add all 3w transfos b/c Options.TrueLines doesnt have 3w tfos in it +## continue + tmpAll.append(row[i]) + tmpTr.append(float(row[i])) + if it == 1: + Options.NamesStorage.append(tfoname) + Options.ColsStorage.append(cols[i]) + Options.TotalTransfoStorage[0].append(tfoname) + elif cols[i].find(':%Rate') != -1: + if Options.AlreadyCleaned: + linename=names[i] + else: + idname = cols[i].strip().split(' id')[-1] # separer string par ' id' + name3 = cols[i].strip().split(' id')[0].split(' ')[1] + Bus1 = int(name3.split('-')[0]) + Bus2 = int(name3.split('-')[1]) + linename = BusDico[Bus1][2] + '_' + BusDico[Bus2][2] + '_' + str( idname) + '__' + 'LI' + + # idname = cols[i].strip().split(' id')[-1] # separer string par ' id' + # Bus1 = names[i].split('-')[0].strip() + # Bus2 = names[i].split('-')[1].strip() + if '@' in idname: + idname = idname.replace('@','BR') + elif '*' in idname: + idname = idname.replace('*','SW') + # else: + # try: + # idname = 'LI' + str(int(idname)) + # except: + # idname = 'LI' + idname + # linename = Bus1 + "_" + Bus2 + "_" + idname+'_Li' + linename = linename.replace(" ", "_") + linename = linename.replace("-", "_") + linename = linename.replace(".", "_") + linename = linename.replace("/", "_") + linename = linename.replace("&", "and") + + try: + int(linename[0]) + # linename="_" + linename + linename = "L_" + linename + except: + pass + + if (Options.LinesByNom[0] and Options.LinesBaseList[linename] not in Options.SelectedLinesBase): + continue + elif Options.RecursiveDepth > 0 and linename not in Options.TrueLines: + continue + tmpAll.append(row[i]) + tmpLine.append(float(row[i])) + if it == 1: + Options.NamesStorage.append(linename) + Options.ColsStorage.append(cols[i]) + Options.TotalLinesStorage[0].append(linename) + else: + tmpAll.append(row[i]) + if it == 1: + Options.NamesStorage.append(names[i]) + Options.ColsStorage.append(cols[i]) +# except Exception as e: +# print (e) + + def customAppend(fromCont, toCont, meanCont, row): + tmp = [] + if len(fromCont) > 0: + meanCont.append(sum(fromCont) / len(fromCont)) + tmp.append(sum(fromCont) / len(fromCont)) + tmp.append(min(fromCont)) + tmp.append(max(fromCont)) + tmp.append(int(row[0])) + else: + try: + int(row[0]) + except: + return + else: + meanCont.append(0) + tmp.append(0) + tmp.append(0) + tmp.append(0) + tmp.append(int(row[0])) + if tmp != []: + toCont.append(tmp) + customAppend(tmpBus, BusStorage, BusMean, row) + customAppend(tmpTr, TransfoStorage, TransfoMean, row) + customAppend(tmpLine, LinesStorage, LinesMean, row) + Options.TotalStorage.append(tmpAll) + Options.TotalBusStorage.append(tmpBus) + Options.TotalTransfoStorage.append(tmpTr) + Options.TotalLinesStorage.append(tmpLine) + try: + Options.CaseIDStorage.append(int(row[0])) + except: + pass + Options.BusStorage = BusStorage + Options.TransfoStorage = TransfoStorage + Options.LinesStorage = LinesStorage + #pdb.set_trace() + + #delete point version of csvfile + if Options.DecimalSeparator[0]==",": + csvfile.close() + os.remove(path) + csvfilesave = path[0:-4] + "_comma" + ".csv" + shutil.copy2(csvfilesave, path) + os.remove(csvfilesave) + + return BusMean, TransfoMean, LinesMean + +def getHighestValue(storage, numberToGet): + tmp = [] + table = [] + for i in range(len(storage)): + if len(table) < numberToGet: + table.append(Options.CaseIDStorage[i]) + tmp.append(storage[i]) + elif storage[i] > min(tmp): + try: + table.remove(Options.CaseIDStorage[storage.index(min(tmp))]) + except: + pass + table.append(Options.CaseIDStorage[i]) + try: + tmp.remove(min(tmp)) + except: + pass + tmp.append(storage[i]) + return table + +def getLowestValue(storage, numberToGet): + tmp = [] + table = [] + for i in range(len(storage)): + if len(table) < numberToGet: + table.append(Options.CaseIDStorage[i]) + tmp.append(storage[i]) + elif storage[i] < max(tmp): + try: + table.remove(Options.CaseIDStorage[storage.index(max(tmp))]) + except: + pass + table.append(Options.CaseIDStorage[i]) + try: + tmp.remove(max(tmp)) + except: + pass + tmp.append(storage[i]) + return table diff --git a/ProcessOutputs_Eficas/com_base.py b/ProcessOutputs_Eficas/com_base.py new file mode 100644 index 00000000..4e1e4b97 --- /dev/null +++ b/ProcessOutputs_Eficas/com_base.py @@ -0,0 +1,586 @@ +#!/usr/bin/python3 +######################################################################################################################## +# ojectif de ce module: extraire des donnes pour afficher dans l'interface Eficas. Subprocess dans la fonction PFExtractGeneratorLoadLineandTransfoDico +######################################################################################################################## +NoBreakersandSwitches = True + +def PFExtractData(NetworkFile, PF_PATH): + #PSEN sous PowerFactory, extraire des donnees de Gen, Load, Bus, Branch, Transfos,Motor + import os + import sys + import numpy as np + + (filepath, filename) = os.path.split(NetworkFile) + sys.path.append(PF_PATH) + os.environ['PATH'] += ';' + os.path.dirname(os.path.dirname(PF_PATH)) + ';' + + # import powerfactory + import powerfactory as pf + app = pf.GetApplication() + # app.Show() + user = app.GetCurrentUser() + ComImp = user.CreateObject('ComPFDIMPORT')# objet pour importer pfd file + + app.SetWriteCacheEnabled(1) # Disable consistency check + ComImp.g_file = NetworkFile + ComImp.g_target = user # project is imported under the user account + err = ComImp.Execute() # Execute command starts the import process + ComImp.Delete() + app.SetWriteCacheEnabled(0) # Enable consistency check + prjs = user.GetContents('*.IntPrj') + prjs.sort(key=lambda x: x.gnrl_modif, reverse=True) + prj = prjs[0] + prj.Activate() + studycase = app.GetActiveStudyCase() + grids = studycase.GetChildren(1, '*.ElmNet', 1)[0].contents + tous = [] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmTerm', 1)) + bus = [] + for noeud in tous: + # if ((noeud.iUsage == 0) and (noeud.outserv == 0)): # eliminer tous les noeuds out-service + # if ((noeud.iUsage == 0)or(noeud.iUsage == 1)) : + bus.append(noeud) + noeuds = sorted(bus, key=lambda x: x.cStatName) + buses = [] + for ii in range(len(noeuds)): + busname = noeuds[ii].cStatName.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_") + aa = [ii, round(noeuds[ii].uknom,2), busname, noeuds[ii].GetBusType()] + # [numero,nominal KV,busname,bustype] + buses.append(aa) + # ==============================================================# + # Loads data (busnumber, active, reactive, status, name, id) + tous = [] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmLod', 1)) + tous = sorted(tous, key=lambda x: x.bus1.cBusBar.cStatName) + LoadDico = {} + for bus in buses: + idload = 0 + for load in tous: + busname = load.bus1.cBusBar.cStatName + busname = busname.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_") + if busname == bus[2]: + idload += 1 # cree id pour load + busnumber = bus[0] + loadname = busname + loadname = loadname.replace(" ", "_") + loadname = loadname.replace("-", "_") + loadname = loadname.replace(".", "_") + loadname = loadname.replace("/", "_") + loadname = loadname.replace("&", "and") + loadname = loadname.replace("%","pct") + loadname = loadname.replace("=","eq") + loadname = loadname.replace("#","_") + loadname = loadname.replace("$","_") + loadname = loadname.replace("\\","_") + loadname = loadname.replace("(","_") + loadname = loadname.replace(")","_") + try: + int(loadname[0]) + loadname = "C_" + loadname + except: + pass + loadname=loadname+'_Lo'+str(idload) + p = load.plini + q = load.qlini + LoadDico[loadname] = {} + LoadDico[loadname]['NAME'] = load.loc_name.strip() + LoadDico[loadname]['ID'] = idload + LoadDico[loadname]['EXNAME'] = busname + '_' + str(bus[1])+'KV' + LoadDico[loadname]['NUMBER'] = busnumber + LoadDico[loadname]['P'] = p + LoadDico[loadname]['Q'] = q + # ==============================================================#Generator + MachineDico = {} # [Bus name, machine ID, extended bus name, bus number] + tous = [] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmSym', 1)) + + for plant in tous: + if plant.i_mot == 0: + busname = plant.bus1.cBusBar.cStatName + busname = busname.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_") + for ii in range(len(buses)): + if busname in buses[ii]: + busnumber = ii + break + idplant = plant.loc_name#plant.ngnum + p = plant.pgini + q = plant.qgini + pmax = plant.Pmax_uc + pmin = plant.Pmin_uc + qmax = plant.cQ_max + qmin = plant.cQ_min + machinename = busname + '_' + 'syn_' + 'Gr_' + str(idplant) # generator synchrone + machinename = machinename.replace(" ", "_") + # machinename = machinename.replace("Generator", "gen") + machinename = machinename.replace("-", "_") + machinename = machinename.replace(".", "_") + machinename = machinename.replace("/", "_") + machinename = machinename.replace("&", "and") + machinename = machinename.replace("%","pct") + machinename = machinename.replace("=","eq") + machinename = machinename.replace("#","_") + machinename = machinename.replace("$","_") + machinename = machinename.replace("\\","_") + machinename = machinename.replace("(","_") + machinename = machinename.replace(")","_") + # machinename = machinename + '_' +'syn_' + 'Gr_' + str(idplant) # generator synchrone + try: + int(machinename[0]) + machinename = "G_" + machinename + except: + pass + + MachineDico[machinename] = {} + MachineDico[machinename]['NAME'] = plant.loc_name + MachineDico[machinename]['ID'] = idplant + MachineDico[machinename]['EXNAME'] = busname + '_' + str(bus[1])+'KV' + MachineDico[machinename]['NUMBER'] = busnumber + MachineDico[machinename]['P'] = p + MachineDico[machinename]['Q'] = q + MachineDico[machinename]['PMAX'] = pmax + MachineDico[machinename]['QMAX'] = qmax + MachineDico[machinename]['PMIN'] = pmin + MachineDico[machinename]['QMIN'] = qmin + tous = [] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmAsm', 1)) + + for plant in tous: + if plant.i_mot == 0: + busname = plant.bus1.cBusBar.cStatName + busname = busname.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_") + for ii in range(len(buses)): + if busname in buses[ii]: + busnumber = ii + break + idplant = plant.loc_name + p = plant.pgini + q = plant.qgini + pmax = plant.Pmax_uc + pmin = plant.Pmin_uc + qmax = plant.cQ_max + qmin = plant.cQ_min + machinename = busname + '_' + 'asyn_' + 'Gr_' + str(idplant) # generator asynchrone + machinename = machinename.replace(" ", "_") + machinename = machinename.replace("-", "_") + machinename = machinename.replace(".", "_") + machinename = machinename.replace("/", "_") + machinename = machinename.replace("&", "and") + machinename = machinename.replace("%","pct") + machinename = machinename.replace("=","eq") + machinename = machinename.replace("#","_") + machinename = machinename.replace("$","_") + machinename = machinename.replace("\\","_") + machinename = machinename.replace("(","_") + machinename = machinename.replace(")","_") + # machinename = machinename + '_' +'asyn_' + 'Gr_' + str(idplant) # generator asynchrone + try: + int(machinename[0]) + machinename = "G_" + machinename + except: + pass + + MachineDico[machinename] = {} + MachineDico[machinename]['NAME'] = plant.loc_name + MachineDico[machinename]['ID'] = idplant + MachineDico[machinename]['EXNAME'] = busname + '_' + str(bus[1])+'KV' + MachineDico[machinename]['NUMBER'] = busnumber + MachineDico[machinename]['P'] = p + MachineDico[machinename]['Q'] = q + MachineDico[machinename]['PMAX'] = pmax + MachineDico[machinename]['QMAX'] = qmax + MachineDico[machinename]['PMIN'] = pmin + MachineDico[machinename]['QMIN'] = qmin + tous = [] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmGenstat', 1)) + for plant in tous: + busname = plant.bus1.cBusBar.cStatName + busname = busname.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_") + for ii in range(len(buses)): + if busname in buses[ii]: + busnumber = ii + break + idplant = plant.loc_name + p = plant.pgini + q = plant.qgini + pmax = plant.Pmax_uc + pmin = plant.Pmin_uc + qmax = plant.cQ_max + qmin = plant.cQ_min + machinename = busname + '_' + 'genstat_' + 'Gr_' + str(idplant) # generator static + machinename = machinename.replace(" ", "_") + machinename = machinename.replace("-", "_") + machinename = machinename.replace(".", "_") + machinename = machinename.replace("/", "_") + machinename = machinename.replace("&", "and") + machinename = machinename.replace("%","pct") + machinename = machinename.replace("=","eq") + machinename = machinename.replace("#","_") + machinename = machinename.replace("$","_") + machinename = machinename.replace("\\","_") + machinename = machinename.replace("(","_") + machinename = machinename.replace(")","_") + + try: + int(machinename[0]) + machinename = "G_" + machinename + except: + pass + + MachineDico[machinename] = {} + MachineDico[machinename]['NAME'] = plant.loc_name + MachineDico[machinename]['ID'] = idplant + MachineDico[machinename]['EXNAME'] = busname + '_' + str(bus[1]) + 'KV' + MachineDico[machinename]['NUMBER'] = busnumber + MachineDico[machinename]['P'] = p + MachineDico[machinename]['Q'] = q + MachineDico[machinename]['PMAX'] = pmax + MachineDico[machinename]['QMAX'] = qmax + MachineDico[machinename]['PMIN'] = pmin + MachineDico[machinename]['QMIN'] = qmin + + tous = [] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmPvsys', 1)) + for plant in tous: + busname = plant.bus1.cBusBar.cStatName + busname = busname.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_") + for ii in range(len(buses)): + if busname in buses[ii]: + busnumber = ii + break + idplant = plant.loc_name#plant.ngnum + p = plant.pgini + q = plant.qgini + pmax = plant.Pmax_uc + pmin = plant.Pmin_uc + qmax = plant.cQ_max + qmin = plant.cQ_min + machinename = busname + '_' + 'pv_' + 'Gr_' + str(idplant) # generator PV + machinename = machinename.replace(" ", "_") + machinename = machinename.replace("-", "_") + machinename = machinename.replace(".", "_") + machinename = machinename.replace("/", "_") + machinename = machinename.replace("&", "and") + machinename = machinename.replace("%","pct") + machinename = machinename.replace("=","eq") + machinename = machinename.replace("#","_") + machinename = machinename.replace("$","_") + machinename = machinename.replace("\\","_") + machinename = machinename.replace("(","_") + machinename = machinename.replace(")","_") + + try: + int(machinename[0]) + machinename = "G_" + machinename + except: + pass + + MachineDico[machinename] = {} + MachineDico[machinename]['NAME'] = plant.loc_name + MachineDico[machinename]['ID'] = idplant + MachineDico[machinename]['EXNAME'] = busname + '_' + str(bus[1]) + 'KV' + MachineDico[machinename]['NUMBER'] = busnumber + MachineDico[machinename]['P'] = p + MachineDico[machinename]['Q'] = q + MachineDico[machinename]['PMAX'] = pmax + MachineDico[machinename]['QMAX'] = qmax + MachineDico[machinename]['PMIN'] = pmin + MachineDico[machinename]['QMIN'] = qmin + # ==============================================================#Motor + + MotorDico = {} # [Bus name, machine ID, extended bus name, bus number] + tous = [] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmSym', 1)) + + for plant in tous: + if plant.i_mot == 1: + busname = plant.bus1.cBusBar.cStatName + busname = busname.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_") + for ii in range(len(buses)): + if busname in buses[ii]: + busnumber = ii + break + idplant = plant.loc_name#plant.ngnum + p = plant.pgini + q = plant.qgini + pmax = plant.Pmax_uc + pmin = plant.Pmin_uc + qmax = plant.cQ_max + qmin = plant.cQ_min + machinename = busname + '_' + 'syn_' + 'Mo_' + str(idplant) # Motor synchrone + machinename = machinename.replace(" ", "_") + machinename = machinename.replace("-", "_") + machinename = machinename.replace(".", "_") + machinename = machinename.replace("/", "_") + machinename = machinename.replace("&", "and") + machinename = machinename.replace("%","pct") + machinename = machinename.replace("=","eq") + machinename = machinename.replace("#","_") + machinename = machinename.replace("$","_") + machinename = machinename.replace("\\","_") + machinename = machinename.replace("(","_") + machinename = machinename.replace(")","_") + + try: + int(machinename[0]) + machinename = "M_" + machinename + except: + pass + MotorDico[machinename] = {} + MotorDico[machinename]['NAME'] = plant.loc_name + MotorDico[machinename]['ID'] = idplant + MotorDico[machinename]['EXNAME'] = busname + '_' + str(bus[1])+'KV' + MotorDico[machinename]['NUMBER'] = busnumber + MotorDico[machinename]['P'] = p + MotorDico[machinename]['Q'] = q + MotorDico[machinename]['PMAX'] = pmax + MotorDico[machinename]['QMAX'] = qmax + MotorDico[machinename]['PMIN'] = pmin + MotorDico[machinename]['QMIN'] = qmin + tous = [] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmAsm', 1)) + + for plant in tous: + if plant.i_mot == 1: + busname = plant.bus1.cBusBar.cStatName + busname = busname.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_") + for ii in range(len(buses)): + if busname in buses[ii]: + busnumber = ii + break + idplant = plant.loc_name#plant.ngnum + p = plant.pgini + q = plant.qgini + # pmax = plant.Pmax_uc + pmax = plant.P_max + pmin = plant.Pmin_uc + qmax = plant.cQ_max + qmin = plant.cQ_min + machinename = busname + '_' + 'asyn_' + 'Mo_' + str(idplant) # moteur asynchrone + machinename = machinename.replace(" ", "_") + machinename = machinename.replace("-", "_") + machinename = machinename.replace(".", "_") + machinename = machinename.replace("/", "_") + machinename = machinename.replace("&", "and") + machinename = machinename.replace("%","pct") + machinename = machinename.replace("=","eq") + machinename = machinename.replace("#","_") + machinename = machinename.replace("$","_") + machinename = machinename.replace("\\","_") + machinename = machinename.replace("(","_") + machinename = machinename.replace(")","_") + + try: + int(machinename[0]) + machinename = "M_" + machinename + except: + pass + MotorDico[machinename] = {} + MotorDico[machinename]['NAME'] = plant.loc_name + MotorDico[machinename]['ID'] = idplant + MotorDico[machinename]['EXNAME'] = busname + '_' + str(bus[1]) + 'KV' + MotorDico[machinename]['NUMBER'] = busnumber + MotorDico[machinename]['P'] = p + MotorDico[machinename]['Q'] = q + MotorDico[machinename]['PMAX'] = pmax + MotorDico[machinename]['QMAX'] = qmax + MotorDico[machinename]['PMIN'] = pmin + MotorDico[machinename]['QMIN'] = qmin + # ==============================================================# + LineDico = {} # [linename, Bus name 1, Bus name 2, ID, extended bus name 1, extended bus name 2, bus number 1, bus number 2] + tous = [] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmLne', 1)) + for line in tous: + linename = line.loc_name + frombus_name = line.bus1.cBusBar.cStatName + tobus_name = line.bus2.cBusBar.cStatName + frombus_name = frombus_name.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_") + tobus_name = tobus_name.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_") + for ii in range(len(buses)): + if frombus_name in buses[ii]: + frombus_number = ii + frombus_KV=buses[ii][1] + break + for ii in range(len(buses)): + if tobus_name in buses[ii]: + tobus_number = ii + tobus_KV=buses[ii][1] + break + idline = line.loc_name#line.nlnum + linename=frombus_name+'_'+tobus_name+'_'+idline+'__LI' + linename = linename.replace(" ", "_") + linename = linename.replace("-", "_") + linename = linename.replace(".", "_") + linename = linename.replace("/", "_") + linename = linename.replace("&", "and") + linename = linename.replace("%","pct") + linename = linename.replace("=","eq") + linename = linename.replace("#","_") + linename = linename.replace("$","_") + linename = linename.replace("\\","_") + linename = linename.replace("(","_") + linename = linename.replace(")","_") + try: + int(linename[0]) + linename = "L_" + linename + except: + pass + if NoBreakersandSwitches: + LineDico[linename] = {} + LineDico[linename]['FROMNAME'] = frombus_name + LineDico[linename]['TONAME'] = tobus_name + LineDico[linename]['ID'] = idline + LineDico[linename]['FROMEXNAME'] = frombus_name+'_'+str(frombus_KV) + LineDico[linename]['TOEXNAME'] = tobus_name+'_'+str(tobus_KV) + LineDico[linename]['FROMNUMBER'] = frombus_number # il n'y a pas de bus number dans PowerFactory + LineDico[linename]['TONUMBER'] = tobus_number + + + # print ("Read lines") + # Extract Transfos + TfoDico = {} # [tranlinename, Bus name 1, Bus name 2, machine ID, extended bus name 1, extended bus name 2, bus number 1, bus number 2] + tous = [] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmTr2', 1)) + + for tfo in tous: + # tfosname = tfo.loc_name + id_tfo=tfo.loc_name#tfo.ntnum + frombus_name=tfo.bushv.cBusBar.cStatName + tobus_name=tfo.buslv.cBusBar.cStatName + frombus_name = frombus_name.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_") + tobus_name = tobus_name.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_") + for ii in range(len(buses)): + if frombus_name in buses[ii]: + frombus_number = ii + frombus_KV=buses[ii][1] + break + for ii in range(len(buses)): + if tobus_name in buses[ii]: + tobus_number = ii + tobus_KV=buses[ii][1] + break + + tfoname = frombus_name+'_' +tobus_name+'_' + str(id_tfo)+'__'+'TR' + tfoname = tfoname.replace(" ", "_") + tfoname = tfoname.replace("-", "_") + tfoname = tfoname.replace(".", "_") + tfoname = tfoname.replace("/", "_") + tfoname = tfoname.replace("&", "and") + tfoname = tfoname.replace("%","pct") + tfoname = tfoname.replace("=","eq") + tfoname = tfoname.replace("#","_") + tfoname = tfoname.replace("$","_") + tfoname = tfoname.replace("\\","_") + tfoname = tfoname.replace("(","_") + tfoname = tfoname.replace(")","_") + try: + int(tfoname[0]) + tfoname = "_" + tfoname + except: + pass + if NoBreakersandSwitches: + TfoDico[tfoname] = {} + TfoDico[tfoname]['FROMNAME'] = frombus_name + TfoDico[tfoname]['TONAME'] = tobus_name + TfoDico[tfoname]['ID'] = id_tfo + TfoDico[tfoname]['FROMEXNAME'] = frombus_name+'_'+str(frombus_KV) + TfoDico[tfoname]['TOEXNAME'] = tobus_name+'_'+str(tobus_KV) + TfoDico[tfoname]['FROMNUMBER'] = frombus_number # il n'y a pas de bus number dans PowerFactory + TfoDico[tfoname]['TONUMBER'] = tobus_number + TfoDico[tfoname]['#WIND'] = 2 + + # Extract 3 winding Transfos + tous = [] + for grid in grids: + tous.extend(grid.obj_id.GetContents( '*.ElmTr3', 1)) + for tfo in tous: + # tfosname = tfo.loc_name + id_tfo = tfo.loc_name#tfo.nt3nm + frombus_name = tfo.bushv.cBusBar.cStatName + tobus_name = tfo.busmv.cBusBar.cStatName + bus3 = tfo.buslv.cBusBar.cStatName + frombus_name = frombus_name.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_") + tobus_name = tobus_name.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_") + bus3 = bus3.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_") + for ii in range(len(buses)): + if frombus_name in buses[ii]: + frombus_number = ii + frombus_KV=buses[ii][1] + break + for ii in range(len(buses)): + if tobus_name in buses[ii]: + tobus_number = ii + tobus_KV=buses[ii][1] + break + for ii in range(len(buses)): + if bus3 in buses[ii]: + bus3_number = ii + bus3_KV=buses[ii][1] + break + tfoname = frombus_name+ '_' + tobus_name + '_' +bus3+'_' + str(id_tfo)+'__'+ 'TR3' + tfoname = tfoname.replace(" ", "_") + tfoname = tfoname.replace("-", "_") + tfoname = tfoname.replace(".", "_") + tfoname = tfoname.replace("/", "_") + tfoname = tfoname.replace("&", "and") + tfoname = tfoname.replace("%","pct") + tfoname = tfoname.replace("=","eq") + tfoname = tfoname.replace("#","_") + tfoname = tfoname.replace("$","_") + tfoname = tfoname.replace("\\","_") + tfoname = tfoname.replace("(","_") + tfoname = tfoname.replace(")","_") + try: + int(tfoname[0]) + tfoname = "_" + tfoname + except: + pass + if NoBreakersandSwitches: + TfoDico[tfoname] = {} + TfoDico[tfoname]['FROMNAME'] = frombus_name + TfoDico[tfoname]['TONAME'] = tobus_name + TfoDico[tfoname]['3NAME']= bus3 + TfoDico[tfoname]['ID'] = id_tfo + TfoDico[tfoname]['FROMEXNAME'] = frombus_name+'_'+str(frombus_KV) + TfoDico[tfoname]['TOEXNAME'] = tobus_name+'_'+str(tobus_KV) + TfoDico[tfoname]['3EXNAME']=bus3+'_'+str(bus3_KV) + TfoDico[tfoname]['FROMNUMBER'] = frombus_number # il n'y a pas de bus number dans PowerFactory + TfoDico[tfoname]['TONUMBER'] = tobus_number + TfoDico[tfoname]['3NUMBER'] = bus3_number + TfoDico[tfoname]['#WIND'] = 3 + + print ("Read data OK") + prj.Delete() + return MachineDico, LoadDico, LineDico, TfoDico, MotorDico,buses +filer=open('temp.txt','r') +_path=[] +for line in filer: + _path.append(line) +filer.close() +pfd_file=_path[0].replace('\n','') +PF_path=_path[1].replace('\n','') + +MachineDico, LoadDico, LineDico, TransfoDico, MotorDico,BusDico = PFExtractData(pfd_file,PF_path) +Data={} +Data['MachineDico']=MachineDico +Data['LoadDico']=LoadDico +Data['LineDico']=LineDico +Data['TransfoDico']=TransfoDico +Data['MotorDico']=MotorDico +Data['BusDico']=BusDico +# Data=[MachineDico, LoadDico, LineDico, TransfoDico, MotorDico] +import pickle +# print('=========='+str(pickle.HIGHEST_PROTOCOL)+'=========') +with open('Data_for_interface', 'wb') as fichier: + mon_pickler = pickle.Pickler(fichier,protocol=2) + mon_pickler.dump(Data) + diff --git a/ProcessOutputs_Eficas/dico_print.py b/ProcessOutputs_Eficas/dico_print.py deleted file mode 100644 index 12c51b66..00000000 --- a/ProcessOutputs_Eficas/dico_print.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys -import os - -path1 = os.path.abspath(os.path.join(os.path.abspath(__file__),'..','TreatOutputs')) -sys.path.append(path1) -from Run import run - -# dico1 = {'CONTINGENCY_SELECTION': {'N1TransformersList': ['30.0 - 90.0', '90.0 - 30.0'], 'TripLines': True, 'csv_file': 'D:/PSEN_AVRIL_2018/Small Grid PSSE/Results2/QuatreCas.csv', 'N1LinesList': ['90.0'], 'N1BusesList': ['90.0'], 'SelectionMethod': 'CaseSelectionFromFile', 'case_name': 'QuatreCas', 'TripBuses': False, 'N1AreaList': [], 'TripTransfos': True, 'TripGenerators': True}, 'CASE_SELECTION': {'TransformersList': ['30.0 - 90.0', '90.0 - 30.0'], 'PSEN_results_csvfile': 'D:/PSEN_AVRIL_2018/Small Grid PSSE/Results2/N_20180411_07h44m15/simulationDClog_complete_07h44m15.csv', 'DecimalSeparator': '.', 'NewCsvFile': 'CleanedData.csv', 'PSSPY_path':'C:\\Program Files (x86)\\PTI\\PSSE34\\PSSPY27', 'BusesList': ['90.0'], 'PSEN_results_csvfile_cleaned': False, 'MaxDepth': 5, 'LinesList': ['90.0'], 'PSSE_path': 'C:\\Program Files (x86)\\PTI\\PSSE34\\PSSBIN', 'PSEN_results_folder': 'D:/PSEN_AVRIL_2018/Small Grid PSSE/Results2/N_20180411_07h44m15', 'OutputNewCsv': False, 'AreaList': ['1']}, 'CONTINGENCY_OPTIONS': {'SolutionMethod': '1 -FNSL', 'AdjustSwitchedShunts': '0 - Disable', 'Vmin': 0.95, 'FlowLimitTransformers': 100, 'Tolerance': 0.5, 'VarLimits': 99, 'FlowLimitLines': 100, 'FlatStart': False, 'AdjustDCtaps': '0 - Disable', 'output_file_format': 'csv', 'AdjustTaps': '1 - Stepping', 'Vmax': 1.05, 'ContingencyRate': 'a', 'DispatchMode': '1 - Reserve'}, 'N_PROCESSING_OPTIONS': {'Output_bus_values': False, 'Output_transformer_values': False, 'Output_lines_values': False}} -Dico ={'CONTINGENCY_SELECTION': {'N1TransformersList': ['30.0 - 90.0', '90.0 - 30.0'], 'TripLines': True, 'csv_file': 'D:/PSEN_AVRIL_2018/Small Grid PSSE/Results2/QuatreCas.csv', 'N1LinesList': ['30.0', '90.0'], 'N1BusesList': ['11.0', '30.0', '90.0'], 'SelectionMethod': 'CaseSelectionFromFile', 'case_name': 'TEST_QUATRE_CAS', 'TripBuses': False, 'N1AreaList': ['1'], 'TripTransfos': True, 'TripGenerators': True}, 'CASE_SELECTION': {'TransformersList': ['11.0 - 30.0', '11.0 - 90.0', '30.0 - 90.0', '90.0 - 30.0'], 'PSEN_results_csvfile': 'D:/PSEN_AVRIL_2018/Small Grid PSSE/Results2/N_20180411_08h39m58/simulationDClog_complete_08h39m58.csv', 'DecimalSeparator': '.', 'NewCsvFile': 'CleanedData.csv', 'PSSPY_path': 'C:\\Program Files (x86)\\PTI\\PSSE34\\PSSPY27', 'BusesList': ['11.0', '30.0', '90.0'], 'PSEN_results_csvfile_cleaned': False, 'MaxDepth': 5, 'LinesList': ['30.0', '90.0'], 'PSSE_path': 'C:\\Program Files (x86)\\PTI\\PSSE34\\PSSBIN', 'PSEN_results_folder': 'D:/PSEN_AVRIL_2018/Small Grid PSSE/Results2/N_20180411_08h39m58', 'OutputNewCsv': False, 'AreaList': ['1']}, 'CONTINGENCY_OPTIONS': {'SolutionMethod': '1 - FNSL', 'AdjustSwitchedShunts': '0 - Disable', 'Vmin': 0.99, 'FlowLimitTransformers': 100, 'Tolerance': 0.5, 'VarLimits': 99, 'FlowLimitLines': 100, 'FlatStart': False, 'AdjustDCtaps': '0 - Disable', 'output_file_format': 'csv', 'AdjustTaps': '1 - Stepping', 'Vmax': 1.01, 'ContingencyRate': 'a', 'DispatchMode': '1 - Reserve'}, 'N_PROCESSING_OPTIONS': {'Output_bus_values': False, 'Output_transformer_values': False, 'Output_lines_values': False}} -# try: - # run(Dico) -# except: - # pass - -# dico2 = {'CONTINGENCY_SELECTION': {'N1TransformersList': ['30.0 - 90.0', '90.0 - 30.0'], 'TripLines': True, 'csv_file': 'D:/PSEN_AVRIL_2018/Small Grid PSSE/Results2/QuatreCas.csv', 'N1LinesList': ['90.0'], 'N1BusesList': ['90.0'], 'SelectionMethod': 'CaseSelectionFromFile', 'case_name': 'TESTQuatreCas', 'TripBuses': False, 'N1AreaList': [], 'TripTransfos': True, 'TripGenerators': True}, 'CASE_SELECTION': {'TransformersList': ['30.0 - 90.0', '90.0 - 30.0'], 'PSEN_results_csvfile': 'D:/PSEN_AVRIL_2018/Small Grid PSSE/Results2/N_20180411_07h44m15/simulationDClog_complete_07h44m15.csv', 'DecimalSeparator': '.', 'NewCsvFile': 'CleanedData.csv', 'PSSPY_path':'C:\\Program Files (x86)\\PTI\\PSSE34\\PSSPY27', 'BusesList': ['90.0'], 'PSEN_results_csvfile_cleaned': False, 'MaxDepth': 5, 'LinesList': ['90.0'], 'PSSE_path': 'C:\\Program Files (x86)\\PTI\\PSSE34\\PSSBIN', 'PSEN_results_folder': 'D:/PSEN_AVRIL_2018/Small Grid PSSE/Results2/N_20180411_07h44m15', 'OutputNewCsv': False, 'AreaList': ['1', '2', '3']}, 'CONTINGENCY_OPTIONS': {'SolutionMethod': '1 - FNSL', 'AdjustSwitchedShunts': '0 - Disable', 'Vmin': 0.95, 'FlowLimitTransformers': 100, 'Tolerance': 0.5, 'VarLimits': 99, 'FlowLimitLines': 100, 'FlatStart': False, 'AdjustDCtaps': '0 - Disable', 'output_file_format': 'csv', 'AdjustTaps': '1 - Stepping', 'Vmax': 1.05, 'ContingencyRate': 'a', 'DispatchMode': '1 - Reserve'}, 'N_PROCESSING_OPTIONS': {'Output_bus_values': False, 'Output_transformer_values': False, 'Output_lines_values': False}} -# run(dico2) - -import cProfile, pstats, StringIO -pr = cProfile.Profile() -pr.enable() -run(Dico) -pr.disable() -s = StringIO.StringIO() -sortby = 'cumulative' -ps = pstats.Stats(pr, stream=s).sort_stats(sortby) -ps.print_stats() -print(dir(s)) -print(s) -print(ps.print_stats()) -# print(s.getValue()) \ No newline at end of file diff --git a/ProcessOutputs_Eficas/opsPSEN_N1_PF.py b/ProcessOutputs_Eficas/opsPSEN_N1_PF.py new file mode 100644 index 00000000..bcb43f3c --- /dev/null +++ b/ProcessOutputs_Eficas/opsPSEN_N1_PF.py @@ -0,0 +1,272 @@ + +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2013 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +from PFExtractGeneratorLoadLineandTransfoDico import * +#from ExtractGeneratorLoadLineandTransfoDico import ExtractGeneratorLoadLineandTransfoDico2 +path1 = os.path.abspath(os.path.join(os.path.abspath(__file__), '../','TreatOutputs')) +sys.path.append(path1) + +import Options + +def INCLUDE(self,PF_path,Python3_path,**args): + """ + Fonction sd_prod pour la macro INCLUDE + """ + CaseFolder = args['PSEN_results_folder'] + Options.RecursiveDepth = args['MaxDepth'] + if CaseFolder==None: + return + reevalue=0 + if hasattr(self,'fichier_ini'): + reevalue=1 + if self.fichier_ini == CaseFolder : return + if hasattr(self,'old_context_fichier_init' ): + for concept in self.old_context_fichier_init.values(): + self.jdc.delete_concept(concept) + self.jdc_aux=None + self.contexte_fichier_init={} + self.reevalue_sd_jdc() + self.jdc.reset_context() + + self.fichier_ini=CaseFolder + self.contexte_fichier_init = {} + self.fichier_unite = 999 + self.fichier_err = None + self.fichier_text="" + + unite = 999 + + CaseFile = '' + FolderList = os.listdir(CaseFolder) + for folder in FolderList: + if folder[0:7] == 'package' or folder[0:4]== 'core': + # Get BaseCase.sav inside the first package folder we find + FolderContents = os.listdir(os.path.join(CaseFolder, folder)) + for file in FolderContents: + if file == 'BaseCase.pfd': + CaseFile = os.path.join(os.path.join(CaseFolder, folder), file) + break + break + + + try: + + MachineDico, LoadDico, LineDico, TransfoDico, MotorDico = PFExtractGeneratorLoadLineandTransfoDico( + 0, 0, CaseFile, PF_path, Python3_path) + + BusList, LinesList, TransfosList,BusDico = getNominalkV(CaseFile) + + getTrueLines(CaseFile) + + except Exception as e: + exc_type, exc_obj, exc_tb = sys.exec_info() + print(e) + print(exc_type, exc_tb.tb_lineno) + #print "" + #print MachineDico,LoadDico,LineDico,TransfoDico,MotorDico,BusDico,BranchesDico,BusNominal + + for e in self.jdc.etapes: + if e.nom == 'CASE_SELECTION' : + etape=e + break + self.jdc.appli.changeIntoMC(e, 'BusesList', BusList) + self.jdc.appli.changeIntoMC(e, 'LinesList', LinesList) + self.jdc.appli.changeIntoMC(e, 'TransformersList', TransfosList) + + # self.jdc.appli.changeIntoDefMC('CONTINGENCY_SELECTION', ('Automatic_N_2_Selection', 'BusesList'), BusList) + self.jdc.appli.changeIntoDefMC('CONTINGENCY_SELECTION', ('Automatic_N_2_Selection', 'LinesList'), LinesList) + self.jdc.appli.changeIntoDefMC('CONTINGENCY_SELECTION', ('Automatic_N_2_Selection', 'TransformersList'), TransfosList) + + + try: + a = updateConts() + self.jdc.appli.changeIntoDefMC('CONTINGENCY_SELECTION', ('MultipleContingencyList', 'ComponentList'), Options.ContFullList) + except Exception as e: + exc_type, exc_obj, exc_tb = sys.exec_info() + print(e) + print(exc_type, exc_tb.tb_lineno) + + + #self.jdc.ajoutMC(e,'TransfosList',listeTuple) + + + +def INCLUDE_context(self,d): + """ + Fonction op_init pour macro INCLUDE + """ + for k,v in self.g_context.items(): + d[k]=v + + +def PROCESS_context(self,d): + pass + +def PROCESS(self,XLS_file,**args): + + self.sauve_args=args + if XLS_file == "" or XLS_file == None: return + #Storage.csvFileName = XLS_file + # c est la premiere fois + + if not (hasattr(self,'sheets')) : + from Processor import getXLSinfo, getCSVinfo + #from Processor_Storage import * + #print getSheets + #getSheets() + #ComponentList, ContingencyList = getComponentandContingencyList(Storage.sheets[0]) + #print ComponentList + #print ContingencyList + #Storage.selectedDoubleRow[Storage.sheets[0]]=['PV MATIMBA'] + #Storage.selectedDoubleCol[Storage.sheets[0]]=['MAZENOD_MHDAM_LI1_'] + #self.jdc.appli.changeIntoMC(self,'TabList',Storage.sheets) + #self.sheets=Storage.sheets + #self.OngletsValeurs=[] + if not (XLS_file == "" or XLS_file == None): + #XLSinfo = getXLSinfo(XLS_file) + if XLS_file.endswith('.xls') or XLS_file.endswith('.xlsx'): + XLSinfo = getXLSinfo(XLS_file) + elif XLS_file.endswith('.csv'): + XLSinfo = getCSVinfo(XLS_file) + self.sheets=XLSinfo + #self.sheets={'a':(('a','b','c'),('f','g','h'))} + #v pascale + self.jdc.editor.changeIntoMC(self,'TabList',self.sheets.keys(),('b_TabList',)) + + + + +## self.jdc.appli.changeIntoMC(self,'TabList',self.sheets.keys()) +## +## for k in self.sheets.keys(): +## nom='Component_List_For_'+k +## monInto=self.sheets[k][0] +## self.jdc.appli.ajoutDefinitionMC('CONTINGENCY_PROCESSING',nom,'TXM',min=0, max='**', into=monInto, homo= 'SansOrdreNiDoublon') +## nom='Contingency_List_For_'+k +## monInto=self.sheets[k][1] +## self.jdc.appli.ajoutDefinitionMC('CONTINGENCY_PROCESSING',nom,'TXM',min=0, max='**', into=monInto, homo= 'SansOrdreNiDoublon') + + self.MCAjoutes=[] + self.OngletsSelectionnes=[] + else : + # On a selectionne un onglet + # On teste si on a modifie la liste des onglets + + + nouveauxOngletsSelectionnes = self.get_child('b_TabList').get_child('TabList').valeur +# print (self.get_child('b_TabList')) +# print (self.get_child('b_TabList').get_child('TabList')) +# print (dir(self.get_child('b_TabList').get_child('TabList'))) +# print (self.get_child('b_TabList').get_child('TabList').valeur) + #print('nouveauxOngletsSelectionnes',nouveauxOngletsSelectionnes) + if nouveauxOngletsSelectionnes == self.OngletsSelectionnes: return + #print (6) + if nouveauxOngletsSelectionnes == () or nouveauxOngletsSelectionnes ==[]: + for MC in self.MCAjoutes : self.jdc.editor.deleteMC(self,MC,('b_TabList',)) + self.MCAjoutes==[] + self.OngletsSelectionnes=[] + self.jdc.editor.fenetreCentraleAffichee.reaffiche() + return + +# TabList= self.get_child('b_TabList').get_child('TabList').valeur +# nouveauxOngletsSelectionnes = [] +# for tab in TabList: +# nouveauxOngletsSelectionnes.append(tab.replace(' ','___')) +# +# if nouveauxOngletsSelectionnes==self.OngletsSelectionnes : return +# +# if nouveauxOngletsSelectionnes==() or nouveauxOngletsSelectionnes == [] : +# for MC in self.MCAjoutes : self.jdc.editor.deleteMC(self,MC,('b_TabList',)) +# self.MCAjoutes=[] +# self.OngletsSelectionnes=[] + + + + for Onglet in nouveauxOngletsSelectionnes: + if Onglet in self.OngletsSelectionnes : continue + + MCFils='Component_List_For_'+Onglet + if MCFils in self.jdc.editor.dicoNouveauxMC.keys() : continue + + + Onglet2 = Onglet.replace('___',' ') + MCFils='Component_List_For_'+Onglet + monInto=self.sheets[Onglet2][0] + self.jdc.editor.ajoutDefinitionMC('CONTINGENCY_PROCESSING',('b_TabList',),MCFils,'TXM',min=0, max='**', into=monInto, homo= 'SansOrdreNiDoublon') + self.jdc.editor.ajoutMC(self,MCFils,[],('b_TabList',)) + self.MCAjoutes.append(MCFils) + + MCFils='Contingency_List_For_'+Onglet + monInto=self.sheets[Onglet2][1] + self.jdc.editor.ajoutDefinitionMC('CONTINGENCY_PROCESSING',('b_TabList',),MCFils,'TXM',min=0, max='**', into=monInto, homo= 'SansOrdreNiDoublon') + self.jdc.editor.ajoutMC(self,MCFils,[],('b_TabList',)) + self.MCAjoutes.append(MCFils) + + + for Onglet in self.OngletsSelectionnes: + if Onglet in nouveauxOngletsSelectionnes : continue + + MCFils='Contingency_List_For_'+Onglet + self.jdc.editor.deleteMC(self,MCFils,('b_TabList',)) + self.jdc.editor.deleteDefinitionMC('CONTINGENCY_PROCESSING',('b_TabList',),MCFils) + self.MCAjoutes.remove(MCFils) + + MCFils='Component_List_For_'+Onglet + self.jdc.editor.deleteMC(self,MCFils,('b_TabList',)) + self.jdc.editor.deleteDefinitionMC('CONTINGENCY_PROCESSING',('b_TabList',),MCFils) + self.MCAjoutes.remove(MCFils) + + self.OngletsSelectionnes=nouveauxOngletsSelectionnes + self.jdc.editor.fenetreCentraleAffichee.reaffiche() +## nouveauxOngletsSelectionnes= self.get_child('TabList').getval() +## if nouveauxOngletsSelectionnes==self.OngletsSelectionnes : return +## if nouveauxOngletsSelectionnes==() or nouveauxOngletsSelectionnes == [] : +## for MC in self.MCAjoutes : +## self.jdc.appli.deleteMC(self,MC) +## self.MCAjoutes=[] +## self.OngletsSelectionnes=[] +## return +## +## for Onglet in nouveauxOngletsSelectionnes: +## if Onglet in self.OngletsSelectionnes : continue +## +## MCFils='Contingency_List_For_'+Onglet +## self.jdc.appli.ajoutMC(self,MCFils,[]) +## self.MCAjoutes.append(MCFils) +## MCFils='Component_List_For_'+Onglet +## self.jdc.appli.ajoutMC(self,MCFils,[]) +## self.MCAjoutes.append(MCFils) +## +## +## for Onglet in self.OngletsSelectionnes: +## if Onglet in nouveauxOngletsSelectionnes : continue +## +## MCFils='Contingency_List_For_'+Onglet +## self.jdc.appli.deleteMC(self,MCFils) +## self.MCAjoutes.remove(MCFils) +## +## MCFils='Component_List_For_'+Onglet +## self.jdc.appli.deleteMC(self,MCFils) +## self.MCAjoutes.remove(MCFils) +## +## self.OngletsSelectionnes=nouveauxOngletsSelectionnes +## +## diff --git a/ProcessOutputs_Eficas/prefs_PSEN_N1.py b/ProcessOutputs_Eficas/prefs_PSEN_N1.py index cb93ccbb..3d2098c0 100644 --- a/ProcessOutputs_Eficas/prefs_PSEN_N1.py +++ b/ProcessOutputs_Eficas/prefs_PSEN_N1.py @@ -38,8 +38,9 @@ affiche='ordre' # catalogues=( - ('PSEN_N1','Process contingency calculation and analysis',os.path.join(repIni,'PSEN_Cata_Contingency.py'),'ProcessOutputs','python'), - ('PSEN_N1','Post Calculation Analysis',os.path.join(repIni,'PSEN_Cata_DataProcessing.py'),'ProcessOutputs','python'), + ('PSEN_N1','PSSE_Process contingency calculation and analysis',os.path.join(repIni,'PSEN_Cata_Contingency.py'),'ProcessOutputs','python'), + ('PSEN_N1','PSSE_Post Calculation Analysis',os.path.join(repIni,'PSEN_Cata_DataProcessing.py'),'ProcessOutputs','python'), + ('PSEN_N1','PF_Process contingency calculation and analysis AND Post Calculation Analysis',os.path.join(repIni,'PSEN_Cata_N1_PF.py'),'ProcessOutputs','python'), ) diff --git a/generator/generator_PSEN.py b/generator/generator_PSEN.py index 2761c6b3..137f4a4c 100755 --- a/generator/generator_PSEN.py +++ b/generator/generator_PSEN.py @@ -97,7 +97,7 @@ class PSENGenerator(DicoImbriqueGenerator): #---------------------------------------------------------------------------------------- def writeDefault(self,fn) : - fileDico=os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)),'..','PSEN_Eficas','PSEN','PSENconfig.py')) + fileDico=os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)),'..','PSSE_PF_Eficas','PSEN','PSENconfig.py')) f = open( str(fileDico), 'wb') f.write( self.Entete + "Dico =" + str(self.Dico) ) f.close()