From 4b284251b0f28b0594b450aac65f5cf525b923f7 Mon Sep 17 00:00:00 2001 From: "pascale.noyret" Date: Fri, 2 Sep 2016 14:52:27 +0200 Subject: [PATCH] maj 0209 --- Accas/__init__.py | 1 + .../ExtractGeneratorLoadLineandTransfoDico.py | 620 ++++++++++++++++++ ProcessOutputs_Eficas/PSEN_Cata_N1.py | 250 +++++++ .../configuration_PSEN_N1.py | 43 ++ ProcessOutputs_Eficas/mesScripts_PSEN_N1.py | 57 ++ ProcessOutputs_Eficas/opsPSEN_N1.py | 223 +++++++ ProcessOutputs_Eficas/prefs.py | 22 + ProcessOutputs_Eficas/prefs_PSEN_N1.py | 41 ++ 8 files changed, 1257 insertions(+) create mode 100644 ProcessOutputs_Eficas/ExtractGeneratorLoadLineandTransfoDico.py create mode 100644 ProcessOutputs_Eficas/PSEN_Cata_N1.py create mode 100644 ProcessOutputs_Eficas/configuration_PSEN_N1.py create mode 100644 ProcessOutputs_Eficas/mesScripts_PSEN_N1.py create mode 100644 ProcessOutputs_Eficas/opsPSEN_N1.py create mode 100644 ProcessOutputs_Eficas/prefs.py create mode 100644 ProcessOutputs_Eficas/prefs_PSEN_N1.py diff --git a/Accas/__init__.py b/Accas/__init__.py index 716fd6f3..4cc226a2 100644 --- a/Accas/__init__.py +++ b/Accas/__init__.py @@ -89,6 +89,7 @@ from A_VALIDATOR import RangeVal, EnumVal, TypeVal, PairVal from A_VALIDATOR import CardVal, InstanceVal from A_VALIDATOR import VerifTypeTuple, VerifExiste from A_VALIDATOR import FileExtVal, FunctionVal +from A_VALIDATOR import CreeMotClef # On remplace la factory des validateurs initialement dans Noyau par celle # de A_VALIDATOR diff --git a/ProcessOutputs_Eficas/ExtractGeneratorLoadLineandTransfoDico.py b/ProcessOutputs_Eficas/ExtractGeneratorLoadLineandTransfoDico.py new file mode 100644 index 00000000..d9188102 --- /dev/null +++ b/ProcessOutputs_Eficas/ExtractGeneratorLoadLineandTransfoDico.py @@ -0,0 +1,620 @@ +import os +import sys +import numpy as np +import copy + +#import Storage + + +def getNominalkV(NetworkFile): + print "begin getNominalkV for ", NetworkFile + + print "version en dur" + BusList=(1,2,3,4,6) + LinesList=(7,8,9,10) + TransfosList=('Transfos_A', 'Transfos_B', 'Transfos_C', 'Transfos_D') + return BusList, LinesList, TransfosList + + import psspy + import redirect + + psspy.psseinit(80000) + redirect.psse2py() + psspy.progress_output(6) + + psspy.case(NetworkFile) + print "before buses" + # Buses + + sid = -1 + flag = 2 + ierr, ret = psspy.abusreal(sid, flag, ['BASE']) + Storage.BusBase = ret[0] + + ierr, carray = psspy.abuschar(sid, flag, ['NAME']) + Storage.BusBaseList = {} + for i in range(len(carray[0])): + Storage.BusBaseList[carray[0][i]] = ret[0][i] + + BusList = [] + for item in Storage.BusBase: + if item not in BusList: + BusList.append(item) + BusList = sorted(BusList) + + print "after buses" + + # Lines + + owner = 1 + ties = 1 + flag = 2 + entry = 1 + string = ['FROMNAME', 'TONAME'] + ierr, carray = psspy.abrnchar(sid, owner, ties, flag, entry, string) + + for i in range(len(carray[0])): + nom = Storage.BusBaseList[carray[0][i]] + name = carray[0][i] + '-' + carray[1][i] + Storage.LinesBaseList[name] = nom + Storage.LinesBase.append(nom) + + LinesList = [] + for item in Storage.LinesBase: + if item not in LinesList: + LinesList.append(item) + LinesList = sorted(LinesList) + + print "after lines" + + # Transfos + + owner = 1 + ties = 1 + flag = 6 + entry = 1 + string = ['FROMNAME', 'TONAME'] + ierr, carray = psspy.abrnchar(sid, owner, ties, flag, entry, string) + + for i in range(len(carray[0])): + nom1 = Storage.BusBaseList[carray[0][i]] + nom2 = Storage.BusBaseList[carray[1][i]] + name = carray[0][i] + '-' + carray[1][i] + Storage.TransfoBaseList[name] = [nom1, nom2] + Storage.TransfoBase.append([nom1, nom2]) + + TransfosList = [] + for item in Storage.TransfoBase: + string = str(item[0]) + ' - ' + str(item[1]) + if string not in TransfosList: + TransfosList.append(string) + TransfosList = sorted(TransfosList) + + print "after transfos" + + # Generators + + sid = -1 #all buses + flag = 1 #all in service loads/generators (4 all loads/generators) + + string = ['NUMBER'] + ierr,iarray = psspy.amachint(sid,flag,string) + + string = ['NAME','ID'] + ierr,carray = psspy.amachchar(sid,flag,string) + + for i in range(len(iarray[0])): + idname = "GR" + carray[1][i] + machinename = carray[0][i].strip()+ "__" + idname + machinename = machinename.replace(" ","_") + machinename = machinename.replace("-","_") + machinename = machinename.replace(".","_") + machinename = machinename.replace("&","and") + try: + int(machinename[0]) + machinename = "_" + machinename + except: + pass + Storage.GenBaseList[machinename] = iarray[0][i] + + return BusList, LinesList, TransfosList + +#PN --> inutiles +#def getBusNominalkV(NetworkFile): +# import psspy +# import redirect +# +# psspy.psseinit(80000) +# redirect.psse2py() +# psspy.progress_output(6) +# +# psspy.case(NetworkFile) +# +# sid = -1 +# flag = 2 +# ierr, ret = psspy.abusreal(sid, flag, ['BASE']) +# Storage.BusBase = ret[0] +# +# ierr, carray = psspy.abuschar(sid, flag, ['NAME']) +# buses = {} +# for i in range(len(carray[0])): +# buses[carray[0][i]] = ret[0][i] +# Storage.BusNames = buses +# ret = [] +# for item in Storage.BusBase: +# if item not in ret: +# ret.append(item) +# return sorted(ret) + +#def updateConts(): +# Storage.ContFullList = [] +# tmp = Storage.BusBaseList.keys() +# tmp.sort() +# for key in tmp: +# Storage.ContFullList.append(key) +# tmp = Storage.GenBaseList.keys() +# tmp.sort() +# for key in tmp: +# Storage.ContFullList.append(key) +# tmp = Storage.LinesBaseList.keys() +# tmp.sort() +# for key in tmp: +# Storage.ContFullList.append(key) +# tmp = Storage.TransfoBaseList.keys() +# tmp.sort() +# for key in tmp: +# Storage.ContFullList.append(key) +# print Storage.ContFullList +# return Storage.ContFullList +# +#def newContingency(MatList): +# Storage.CustomContingencies.append(MatList) +# +#def checkIfBorder(graph, key, depth, tmplist): +# 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): +# import psspy +# import redirect +# +# psspy.psseinit(80000) +# redirect.psse2py() +# psspy.progress_output(6) +# +# psspy.case(NetworkFile) +# +# sid = -1 +# owner = 1 +# ties = 1 +# flag = 4 # 6 for two-winding transfos +# entry = 1 #each branch once, not both directions +# string = ['FROMNAME', 'TONAME', 'ID'] +# ierr, iarray = psspy.abrnchar(sid, owner, ties, flag, entry, string) +# string = ['FROMNUMBER', 'TONUMBER'] +# ierr, carray = psspy.abrnint(sid, owner, ties, flag, entry, string) +# +# lst = [] +# tmplist = [] +# try: +# for i in range(len(carray[0])): +# if carray[0][i] not in lst and carray[0][i] not in tmplist: +# tmplist.append(carray[0][i]) +# elif carray[0][i] not in lst and carray[0][i] in tmplist: +# tmplist.remove(carray[0][i]) +# lst.append(carray[0][i]) +# if carray[1][i] not in lst and carray[1][i] not in tmplist: +# tmplist.append(carray[1][i]) +# elif carray[1][i] not in lst and carray[1][i] in tmplist: +# tmplist.remove(carray[1][i]) +# lst.append(carray[1][i]) +# except: +# pass +# +# # Create the graph +# graph = {} +# for i in range(len(carray[0])): +# try: +# if graph[carray[0][i]]: +# pass +# except: +# graph[carray[0][i]] = [] +# if carray[1][i] not in graph[carray[0][i]]: +# graph[carray[0][i]].append(carray[1][i]) +# try: +# if graph[carray[1][i]]: +# pass +# except: +# graph[carray[1][i]] = [] +# if carray[0][i] not in graph[carray[1][i]]: +# graph[carray[1][i]].append(carray[0][i]) +# +# # Search it twice, to ensure everything is mapped +# for key in sorted(graph.keys()): +# checkIfBorder(graph, key, Storage.RecursiveDepth, tmplist) +# for key in reversed(sorted(graph.keys())): +# checkIfBorder(graph, key, Storage.RecursiveDepth, tmplist) +# +# Storage.IsolatedGenList = [] +# # Unfold it +# for i in range(len(carray[0])): +# if carray[0][i] in tmplist: +# if iarray[0][i] not in Storage.IsolatedGenList: +# Storage.IsolatedGenList.append(iarray[0][i]) +# if carray[1][i] in tmplist: +# if iarray[1][i] not in Storage.IsolatedGenList: +# Storage.IsolatedGenList.append(iarray[1][i]) +# +# lines = [] +# outLines = [] +# for i in range(len(iarray[0])): +# name = iarray[0][i] + '-' + iarray[1][i] +# if '@' in iarray[2][i] or '*' in iarray[2][i]: +# outLines.append(name) +# elif iarray[0][i] not in Storage.IsolatedGenList and iarray[1][i] not in Storage.IsolatedGenList: +# lines.append(name) +# else: +# outLines.append(name) +# Storage.TrueLines = lines +# return lines +# +#NoBreakersandSwitches = True +# +#def ExtractGeneratorLoadLineandTransfoDico(NetworkFile,PSSE_PATH): +# import os +# import sys +# import numpy as np +# +# print NetworkFile +# print PSSE_PATH +# sys.path.append(PSSE_PATH) +# os.environ['PATH'] += ';' + PSSE_PATH + ';' +# +# import psspy +# import redirect +# +# ###initialization PSSE +# psspy.psseinit(10000) +# _i=psspy.getdefaultint() +# _f=psspy.getdefaultreal() +# _s=psspy.getdefaultchar() +# redirect.psse2py() +# +# # Silent execution of PSSe +# islct=6 # 6=no output; 1=standard +# psspy.progress_output(islct) +# +# #open Network File +# psspy.case(NetworkFile) +# +# # Extract Buses +# sid = -1 # all buses +# flag = 2 +# string = ['NUMBER'] +# ierr, iarray = psspy.abusint(sid, flag, string) +# +# string = ['NAME', 'EXNAME'] +# ierr, carray = psspy.abuschar(sid, flag, string) +# +# string = ['BASE'] +# ierr, ret = psspy.abusreal(sid, flag, string) +# +# BusDico = {} +# BusNominal = {} +# for i in range(len(iarray[0])): +# BusNum = iarray[0][i] +# BusDico[str(BusNum)] = carray[0][i].strip() +# BusNominal[BusDico[str(BusNum)]] = ret[0][i] +# +# #Extract Loads +# sid = -1 #all buses +# flag = 1 #all in service loads/generators (4 all loads/generators) +# +# +# string = ['NUMBER'] +# ierr,iarray = psspy.aloadint(sid,flag,string) +# +# string = ['NAME','ID','EXNAME'] +# ierr,carray = psspy.aloadchar(sid,flag,string) +# +# string = ['mvaact'] +# ierr, xdata = psspy.aloadcplx(sid, flag, string) +# +# LoadDico = {} # [Bus name, load ID, extended bus name, bus number] +# for i in range(len(iarray[0])): +# idname = "Lo" + carray[1][i].strip() +## try: #id is an integer +## idname = "Lo" + str(int(carray[1][i])) +## except: #id is not an integer +## idname = "Lo" + carray[1][i] +# loadname = carray[0][i].strip()+ "__" + idname +# loadname = loadname.replace(" ","_") +# loadname = loadname.replace("-","_") +# loadname = loadname.replace(".","_") +# loadname = loadname.replace("&","and") +# try: +# int(loadname[0]) +# loadname="_" + loadname +# except: +# pass +# LoadDico[loadname]= {} +# LoadDico[loadname]['NAME'] = carray[0][i].strip() +# LoadDico[loadname]['ID'] = carray[1][i] +# LoadDico[loadname]['EXNAME'] =carray[2][i] +# LoadDico[loadname]['NUMBER']=iarray[0][i] +# LoadDico[loadname]['P']=np.real(xdata)[0][i] +# LoadDico[loadname]['Q']=np.imag(xdata)[0][i] +# +# #Extract Generators +# sid = -1 #all buses +# flag = 1 #all in service loads/generators (4 all loads/generators) +# +# string = ['NUMBER'] +# ierr,iarray = psspy.amachint(sid,flag,string) +# +# string = ['NAME','ID','EXNAME'] +# ierr,carray = psspy.amachchar(sid,flag,string) +# +# rstrings = ['pgen','qgen','mbase','pmax','qmax','pmin','qmin'] +# ierr, rarray = psspy.amachreal(sid, flag, rstrings) +# +# MachineDico = {} # [Bus name, machine ID, extended bus name, bus number] +# for i in range(len(iarray[0])): +# idname = "Gr" + carray[1][i].strip() +### try: +### idname = "Gr" + str(int(carray[1][i])) +### except: +### idname = "Gr" + carray[1][i] +# machinename = carray[0][i].strip()+ "__" + idname +# machinename = machinename.replace(" ","_") +# machinename = machinename.replace("-","_") +# machinename = machinename.replace(".","_") +# machinename = machinename.replace("&","and") +# try: +# int(machinename[0]) +# machinename="_" + machinename +# except: +# pass +# MachineDico[machinename]={} +# MachineDico[machinename]['NAME'] = carray[0][i].strip() +# MachineDico[machinename]['ID'] = carray[1][i] +# MachineDico[machinename]['EXNAME'] =carray[2][i] +# MachineDico[machinename]['NUMBER']=iarray[0][i] +# MachineDico[machinename]['P']=rarray[0][i] +# MachineDico[machinename]['Q']=rarray[1][i] +# MachineDico[machinename]['PMAX']=rarray[3][i] +# MachineDico[machinename]['QMAX']=rarray[4][i] +# MachineDico[machinename]['PMIN']=rarray[5][i] +# MachineDico[machinename]['QMIN']=rarray[6][i] +# +# #Extract Motors +# sid = -1 #all buses +# flag = 1 #all in service loads/generators (4 all loads/generators) +# +# string = ['NUMBER','PSETCODE','BASECODE'] +# ierr,iarray = psspy.aindmacint(sid,flag,string) +# +# string = ['NAME','ID','EXNAME'] +# ierr,carray = psspy.aindmacchar(sid,flag,string) +# +# rstrings = ['psetpoint','mbase','p','q'] +# ierr, rarray = psspy.aindmacreal(sid, flag, rstrings) +# +# +# MotorDico = {} # [Bus name, machine ID, extended bus name, bus number] +# for i in range(len(iarray[0])): +# idname = "Mo" + carray[1][i].strip() +### try: +### idname = "Gr" + str(int(carray[1][i])) +### except: +### idname = "Gr" + carray[1][i] +# motorname = carray[0][i].strip()+ "__" + idname +# motorname = motorname.replace(" ","_") +# motorname = motorname.replace("-","_") +# motorname = motorname.replace(".","_") +# motorname = motorname.replace("&","and") +# try: +# int(motorname[0]) +# motorname="_" + motorname +# except: +# pass +# MotorDico[motorname]={} +# MotorDico[motorname]['NAME'] = carray[0][i].strip() +# MotorDico[motorname]['ID'] = carray[1][i] +# MotorDico[motorname]['EXNAME'] =carray[2][i] +# MotorDico[motorname]['NUMBER']=iarray[0][i] +# MotorDico[motorname]['PSETCODE']=iarray[1][i] +# MotorDico[motorname]['BASECODE']=iarray[2][i] +# MotorDico[motorname]['PSETPOINT']=rarray[0][i] +# MotorDico[motorname]['MBASE']=rarray[1][i] +# MotorDico[motorname]['P']=rarray[2][i] +# MotorDico[motorname]['Q']=rarray[3][i] +# +# +# #Extract Lignes +# sid = -1 +# owner = 1 +# ties = 1 +# flag = 2 #6 for two-winding transfos +# entry = 1 #each branch once, not both directions +# string = ['FROMNUMBER','TONUMBER'] +# ierr,iarray = psspy.abrnint(sid,owner,ties,flag,entry,string) +# string = ['FROMNAME','TONAME','FROMEXNAME','TOEXNAME','ID'] +# ierr,carray = psspy.abrnchar(sid,owner,ties,flag,entry,string) +# +# LineDico = {} #[linename, Bus name 1, Bus name 2, ID, extended bus name 1, extended bus name 2, bus number 1, bus number 2] +# for i in range(len(iarray[0])): +# idname = carray[4][i].strip() +# #idname = carray[4][i] +# 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 =carray[0][i].strip() + "__" + carray[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 NoBreakersandSwitches: +# if 'Br' not in idname and 'Sw' not in idname: +# LineDico[linename]={} +# LineDico[linename]['FROMNAME']=carray[0][i].strip() +# LineDico[linename]['TONAME']=carray[1][i].strip() +# LineDico[linename]['ID']=carray[4][i] +# LineDico[linename]['FROMEXNAME']=carray[2][i] +# LineDico[linename]['TOEXNAME']=carray[3][i] +# LineDico[linename]['FROMNUMBER']=iarray[0][i] +# LineDico[linename]['TONUMBER']=iarray[1][i] +# +# #Extract Branches +# sid = -1 +# owner = 1 +# ties = 1 +# flag = 4 # lines & transfos +# entry = 1 #each branch once, not both directions +# string = ['FROMNUMBER','TONUMBER'] +# ierr, iarray = psspy.abrnint(sid, owner, ties, flag, entry, string) +# string = ['FROMNAME','TONAME','FROMEXNAME','TOEXNAME','ID'] +# ierr, carray = psspy.abrnchar(sid, owner, ties, flag, entry, string) +# +# BranchesDico = {} #[linename, Bus name 1, Bus name 2, ID, extended bus name 1, extended bus name 2, bus number 1, bus number 2] +# for i in range(len(iarray[0])): +# idname = carray[4][i] +# if '@' in idname: +# idname = idname.replace('@','Br') +# elif '*' in idname: +# idname = idname.replace('*','Sw') +# else: +# idname = 'LI' + idname +# linename = carray[0][i].strip() + "__" + carray[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 linename[-1] == '_': +# linename = linename[:-1] +# BranchesDico[linename] = {} +# BranchesDico[linename]['FROMNAME'] = carray[0][i].strip() +# BranchesDico[linename]['TONAME'] = carray[1][i].strip() +# BranchesDico[linename]['ID'] = carray[4][i] +# BranchesDico[linename]['FROMEXNAME'] = carray[2][i] +# BranchesDico[linename]['TOEXNAME'] = carray[3][i] +# BranchesDico[linename]['FROMNUMBER'] = iarray[0][i] +# BranchesDico[linename]['TONUMBER'] = iarray[1][i] +# +# +# #Extract Transfos +# sid = -1 +# owner = 1 +# ties = 1 +# flag = 6 #two-winding transfos +# entry = 1 #each branch once, not both directions +# string = ['FROMNUMBER','TONUMBER'] +# ierr,iarray = psspy.abrnint(sid,owner,ties,flag,entry,string) +# string = ['FROMNAME','TONAME','FROMEXNAME','TOEXNAME','ID'] +# ierr,carray = psspy.abrnchar(sid,owner,ties,flag,entry,string) +# +# TfoDico = {} #[linename, Bus name 1, Bus name 2, machine ID, extended bus name 1, extended bus name 2, bus number 1, bus number 2] +# for i in range(len(iarray[0])): +# idname = 'Tr' + carray[4][i].strip() +### try: +### idname = 'Tr' + str(int(carray[4][i])) +### except: +### idname = 'Tr' + carray[4][i] +# tfoname = carray[0][i].strip() + "__" + carray[1][i].strip() + "__" + idname +# tfoname = tfoname.replace(" ","_") +# tfoname = tfoname.replace("-","_") +# tfoname = tfoname.replace(".","_") +# tfoname = tfoname.replace("&","and") +# try: +# int(tfoname[0]) +# tfoname="_" + tfoname +# except: +# pass +# TfoDico[tfoname]={} +# TfoDico[tfoname]['FROMNAME']=carray[0][i].strip() +# TfoDico[tfoname]['TONAME']=carray[1][i].strip() +# TfoDico[tfoname]['ID']=carray[4][i] +# TfoDico[tfoname]['FROMEXNAME']=carray[2][i] +# TfoDico[tfoname]['TOEXNAME']=carray[3][i] +# TfoDico[tfoname]['FROMNUMBER']=iarray[0][i] +# TfoDico[tfoname]['TONUMBER']=iarray[1][i] +# TfoDico[tfoname]['#WIND']=2 +# print "Read Transfos" +# +# #Extract 3 winding Transfos +# sid = -1 #assume a subsystem containing all buses in working case +# owner_3flow = 1 #1 = use bus ownership 2 = use tfo ownership +# ties_3flow = 3 #ignored bc sid is negative. 3 = interior subsystem and subsystem tie 3 winding transformers +# flag=3 #all 3 winding transfo windings +# string = ['wind1number','wind2number','wind3number'] +# ierr,iarray = psspy.awndint(sid,owner,ties,flag,entry,string) +# string = ['wind1name','wind2name','wind3name','wind1exname','wind2exname','wind3exname','id'] +# ierr,carray = psspy.awndchar(sid,owner,ties,flag,entry,string) +# +# #[Bus name 1, Bus name 2, Bus name 3, machine ID, extended bus name 1, extended bus name 2, extended bus name 3, bus number 1, bus number 2, bus number 3] +# for i in range(len(iarray[0])): +# idname = 'Tr' + carray[6][i].strip() +### try: +### idname = 'Tr' + str(int(carray[4][i])) +### except: +### idname = 'Tr' + carray[4][i] +# tfoname = carray[0][i].strip() + "__" + carray[1][i].strip() + "__" + carray[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 +# TfoDico[tfoname]={} +# TfoDico[tfoname]['FROMNAME']=carray[0][i].strip() +# TfoDico[tfoname]['TONAME']=carray[1][i].strip() +# TfoDico[tfoname]['3NAME']=carray[2][i].strip() +# TfoDico[tfoname]['ID']=carray[6][i] +# TfoDico[tfoname]['FROMEXNAME']=carray[3][i] +# TfoDico[tfoname]['TOEXNAME']=carray[4][i] +# TfoDico[tfoname]['3EXNAME']=carray[5][i] +# TfoDico[tfoname]['FROMNUMBER']=iarray[0][i] +# TfoDico[tfoname]['TONUMBER']=iarray[1][i] +# TfoDico[tfoname]['3NUMBER']=iarray[2][i] +# TfoDico[tfoname]['#WIND']=3 +# print "Read 3-Winding Transfos" +# +# return MachineDico, LoadDico, LineDico, TfoDico, MotorDico, BusDico, BranchesDico, BusNominal +# +# +##NetworkFile = r'\\Atlas.edf.fr\co\dpit-cist-siege\Der.012\Dpt-Etudes-Reseaux.001\Outils DER - Divers (excel, codes python, etc.)\PSEN_V15\Example\Results\N_20160705_17h36m34\package0_N_20160705_17h36m34\BaseCase.sav' +##PSSE_PATH=r"C:\Program Files (x86)\PTI\PSSE33\PSSBIN" +##sys.path.append(PSSE_PATH) +##os.environ['PATH'] += ';' + PSSE_PATH + ';' +##getNominalkV(NetworkFile) +##updateConts() diff --git a/ProcessOutputs_Eficas/PSEN_Cata_N1.py b/ProcessOutputs_Eficas/PSEN_Cata_N1.py new file mode 100644 index 00000000..f2598161 --- /dev/null +++ b/ProcessOutputs_Eficas/PSEN_Cata_N1.py @@ -0,0 +1,250 @@ +# -*- 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 +# +# + +# import types +class Tuple: + def __init__(self,ntuple): + self.ntuple=ntuple + + def __convert__(self,valeur): + 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 + +# class Matrice: +# def __init__(self,nbLigs=None,nbCols=None,methodeCalculTaille=None,formatSortie="ligne",valSup=None,valMin=None,structure=None): +# self.nbLigs=nbLigs +# self.nbCols=nbCols +# self.methodeCalculTaille=methodeCalculTaille +# self.formatSortie=formatSortie +# self.valSup=valSup +# self.valMin=valMin +# self.structure=structure +# +# def __convert__(self,valeur): +# # Attention ne verifie pas grand chose +# if type(valeur) != types.ListType : +# return None +# return valeur +# +# def info(self): +# return "Matrice %s x %s" % (self.nbLigs, self.nbCols) +# +# __repr__=info +# __str__=info + + +#CONTEXT.debug = 1 +JdC = JDC_CATA ( code = 'PSEN', + execmodul = None, + regles = ( AU_MOINS_UN ( 'CASE_SELECTION' ), + # AU_MOINS_UN ( 'DIRECTORY' ), + # AU_MOINS_UN ( 'DISTRIBUTION' ), + # AU_MOINS_UN ( 'SIMULATION' ), + # AU_PLUS_UN ( 'PSSE_PARAMETERS' ), + # AU_PLUS_UN ( 'DIRECTORY' ), + # AU_PLUS_UN ( 'SIMULATION' ), + # AU_PLUS_UN ( 'CORRELATION' ), + # AU_PLUS_UN ( 'N_1_GENERATORS' ), + # AU_PLUS_UN ( 'N_1_LINES' ), + # AU_PLUS_UN ( 'N_1_LOADS' ), + # AU_PLUS_UN ( 'N_1_TRANSFORMERS' ), + + ), + ) # Fin JDC_CATA + + +# -------------------------------------------------- +# fin entete +# -------------------------------------------------- +## TODO : RUN +CASE_SELECTION = MACRO ( nom = "CASE_SELECTION", + sd_prod = opsPSEN_N1.INCLUDE, + op_init = opsPSEN_N1.INCLUDE_context, + fichier_ini = 1, + op = None, + fr = "Sélectionnez les cas à analyser", + ang = 'Select the cases to analyze', + PSSE_path = SIMP(statut="o",typ='Repertoire',defaut='C:\Program Files (x86)\PTI\PSSE33\PSSBIN'), + output_folder = SIMP(statut="o", typ="Repertoire"), + + + 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,), + ) +N_PROCESSING_OPTIONS = PROC ( nom = 'N_PROCESSING_OPTIONS', + op = None, + ang = "Select whether the program should be displaying data ablout the different categories. The 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), + TripLines = SIMP(statut = 'o', typ = bool, defaut = True), + TripTransfos = SIMP(statut = 'o', typ = bool, defaut = True), + TripGenerators = SIMP(statut = 'o', typ = bool, defaut = True), + ), + + LoadFlowOptions = FACT(statut='o', + AdjustTaps = SIMP(statut = 'o', typ = 'TXM', into = ['0 - Lock', '1 - Stepping', '2 - Direct'], defaut = '1 - Stepping'), + AdjustDCtaps = SIMP(statut = 'o', typ = 'TXM', into = ['0 - Disable', '1 - Enable'], defaut = '1 - Enable'), + SolutionMethod = SIMP(statut = 'o', typ = 'TXM', into = ['0 - FDNS', '1 - FNSL', '2 - Optimized FDNS'], defaut = '1 - FNSL'), + AdjustSwitchedShunts = SIMP(statut = 'o', typ = 'TXM', into = ['0 - Disable', '1 - Enable', '2 - Enable continuous mode'], defaut = '1 - Enable'), + DispatchMode = SIMP(statut = 'o', typ = 'TXM', into = ['0 - Disable', '1 - Reserve', '2 - Pmax', '3 - Inertia', '4 - Droop'], defaut = '1 - Reserve'), + FlatStart = SIMP(statut = 'o', typ = bool, defaut = False), + VarLimits = SIMP(statut = 'o', typ = 'I', defaut = 99,ang = 'if set to -1, var limits will not be applied'), + ), + + OutputOptions = FACT(statut='o', + consigne1 = SIMP(statut='o',homo='information',typ = "TXM",defaut = 'Output PSSE multiple contingency report to Shell?'), + MultipleContingencyReport = SIMP(statut = 'o', typ = bool, defaut = True, ang = 'Output PSSE multiple contingency report to Shell?'), + consigne2 = SIMP(statut='o',homo='information',typ = "TXM",defaut = 'Write an Excel file for the results of each case file?'), + WriteIndivExcels = SIMP(statut = 'o', typ = bool, defaut = True), + consigne3 = SIMP(statut='o',homo='information',typ = "TXM",defaut = 'Add a tab in Excel results file for the differences between the max flow rate (MVAR) and the actual flow rate in lines and transformers?'), + WriteFlowDifs = SIMP(statut = 'o', typ = bool, defaut = True), + ), + ) + + + + +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', + regles=(AU_MOINS_UN('branch_cases','transformer_cases','high_voltage_cases','low_voltage_cases',),), + branch_cases = SIMP(statut='o', defaut='', typ = ('Fichier', 'CSV file (*.csv);;All Files (*)','Sauvegarde'),), + transformer_cases = SIMP(statut='o', defaut='', typ = ('Fichier', 'CSV file (*.csv);;All Files (*)','Sauvegarde',),), + high_voltage_cases = SIMP(statut='o', defaut='', typ = ('Fichier', 'CSV file (*.csv);;All Files (*)','Sauvegarde'),), + low_voltage_cases = SIMP(statut='o', defaut='', typ = ('Fichier', 'CSV file (*.csv);;All Files (*)','Sauvegarde'),), + ), + +# CaseSelectionFromFile = FACT( +# statut = 'o', +# input_path = SIMP(statut="o",typ='Repertoire'), +# branch_cases = SIMP(statut='o', typ='TXM'), +# transformer_cases = SIMP(statut='o', typ='TXM'), +# high_cases = SIMP(statut='o', typ='TXM'), +# low_cases = SIMP(statut='o', typ='TXM'), +# ), + + ), + +# b_all = BLOC(condition="SelectionMethod=='SelectAllCases'", +# SelectAllCases = FACT( +# statut='o', +# all_cases = SIMP(statut='o', typ=bool, defaut = True), +# ), +# ), + + b_worst = BLOC(condition="SelectionMethod=='SelectWorstCases'", + SelectWorstCases = FACT( + regles = (UN_PARMI('AvgBranchLoad', 'AvgBranchLoadPercent'), UN_PARMI('AvgTransformerLoad', 'AvgTransformerLoadPercent'), UN_PARMI('AvgHighVoltage', 'AvgHighVoltagePercent'), UN_PARMI('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.'), + AvgBranchLoad = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0), + AvgBranchLoadPercent = 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_2_Selection = FACT(statut='f', + + 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.PROCESS, + op_init = opsPSEN_N1.PROCESS_context, + + #sd_prod=None, + + op = None, + fichier_ini = 1, + fr = "", + ang="", + XLS_file = SIMP(statut="o", typ = ('Fichier', 'XLS file (*.xls);;All Files (*)',),), + TabList = SIMP(statut = 'f', typ = 'TXM', min = 0, max = '**', homo = 'SansOrdreNiDoublon'), + +# b_highVoltage = BLOC(condition="'High Voltage 0' in TabList", +# HighVoltageBuses = SIMP(statut = 'o', typ = 'TXM', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'), +# HighVoltageContingencies = SIMP(statut = 'o', typ = 'TXM', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'), +# ), + + ) + +Ordre_Des_Commandes = ('CASE_SELECTION' , 'N_PROCESSING_OPTIONS' , 'CONTINGENCY_OPTIONS' , 'CONTINGENCY_SELECTION',) diff --git a/ProcessOutputs_Eficas/configuration_PSEN_N1.py b/ProcessOutputs_Eficas/configuration_PSEN_N1.py new file mode 100644 index 00000000..4ab64b85 --- /dev/null +++ b/ProcessOutputs_Eficas/configuration_PSEN_N1.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# CONFIGURATION MANAGEMENT OF EDF VERSION +# ====================================================================== +# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG +# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY +# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY +# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR +# (AT YOUR OPTION) ANY LATER VERSION. +# +# THIS PROGRAM 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 +# GENERAL PUBLIC LICENSE FOR MORE DETAILS. +# +# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE +# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER, +# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE. +# +# +# ====================================================================== +""" + Ce module sert pour charger les paramètres de configuration d'EFICAS +""" +# Modules Python +from InterfaceQT4 import configuration +import os + + +class CONFIG(configuration.CONFIG_BASE): + + #----------------------------------- + def __init__(self,appli,repIni): + #----------------------------------- + + self.labels_user=['catalogues','lang'] + self.labels_eficas=['lang','rep_cata','catalogues'] + + configuration.CONFIG_BASE.__init__(self,appli,'.Eficas_monCode') + + +def make_config(appli,rep): + return CONFIG(appli,rep) + diff --git a/ProcessOutputs_Eficas/mesScripts_PSEN_N1.py b/ProcessOutputs_Eficas/mesScripts_PSEN_N1.py new file mode 100644 index 00000000..f3c14732 --- /dev/null +++ b/ProcessOutputs_Eficas/mesScripts_PSEN_N1.py @@ -0,0 +1,57 @@ +def EficasProcessXLS(listeparam) : + print "dans processXLS" + item=listeparam[0] + fileNameObj=item.object.get_child('XLS_file') + if fileNameObj : fileName=fileNameObj.get_valeur() + else : fileName = "" + if fileName == "" : return 0, 'Nom de fichier invalide' + + ongletListObj=item.object.get_child('Onglets') + if ongletListObj : ongletList= ongletListObj.get_valeur() + else : ongletList = [] + if ongletList == [] : return 0, 'ongletList invalide' + + busListObj=item.object.get_child('BusList') + if busListObj : busList= busListObj.get_valeur() + else : busList = [] + if busList == [] : return 0, 'BusList invalide' + + contListObj=item.object.get_child('ContList') + if contListObj : contList=contListObj.get_valeur() + else : contList = [] + if contList == [] : return 0, 'ContList invalide' + + dicoBus={} + dicoCont={} + for onglet in ongletList: + recherche=str(" ("+ str(onglet) +" )") + listeBusPourOnglet=[] + listeContPourOnglet=[] + for bus in busList : + nomBusSplit=str(bus).split(recherche) + if len(nomBusSplit) == 2 : listeBusPourOnglet.append(nomBusSplit[0]) + for cont in contList : + nomContSplit=str(cont).split(recherche) + if len(nomContSplit) == 2 : listeContPourOnglet.append(nomContSplit[0]) + if listeBusPourOnglet != [] : dicoBus[onglet]=listeBusPourOnglet + if listeContPourOnglet != [] : dicoCont[onglet]=listeContPourOnglet + + from Processor import processXLS + processXLS(fileName,dicoBus,dicoCont) + + #if nouvelleVal != [] : prob.set_valeur(nouvelleVal) + +# le dictionnaire des commandes a la structure suivante : +# la clef est la commande qui va proposer l action +# puis un tuple qui contient +# - la fonction a appeler +# - le label dans le menu du clic droit +# - un tuple contenant les parametres attendus par la fonction +# - appelable depuis Salome uniquement -) +# - appelable depuis un item valide uniquement +# - toolTip +dict_commandes={ + 'CONTINGENCY_PROCESSING': ( + (EficasProcessXLS,"process",('item',),False,True,"process values "), + ), + } diff --git a/ProcessOutputs_Eficas/opsPSEN_N1.py b/ProcessOutputs_Eficas/opsPSEN_N1.py new file mode 100644 index 00000000..55de6fdc --- /dev/null +++ b/ProcessOutputs_Eficas/opsPSEN_N1.py @@ -0,0 +1,223 @@ + +# -*- 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 +# + +print "version en dur" +from ExtractGeneratorLoadLineandTransfoDico import * +#from ExtractGeneratorLoadLineandTransfoDico import ExtractGeneratorLoadLineandTransfoDico2 + +#import Storage + +def INCLUDE(self,PSSE_path,**args): + """ + Fonction sd_prod pour la macro INCLUDE + """ + CaseFolder = args['output_folder'] + #Storage.MaximumDepth = args['MaxDepth'] + #print('casefolder loaded') + 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': + # 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.sav': + CaseFile = os.path.join(os.path.join(CaseFolder, folder), file) + break + break + print "ops before try" + + + try: + #MachineDico,LoadDico,LineDico,TransfoDico,MotorDico,BusDico,BranchesDico,BusNominal = ExtractGeneratorLoadLineandTransfoDico(CaseFile, PSSE_path) + # BusList = getBusNominalkV(CaseFile) + BusList, LinesList, TransfosList = getNominalkV(CaseFile) + #getTrueLines(CaseFile) + except Exception, e: + exc_type, exc_obj, exc_tb = sys.exec_info() + print(e) + print(exc_type, exc_tb.tb_lineno) + + 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: + #updateConts() + #self.jdc.appli.changeIntoDefMC('CONTINGENCY_SELECTION', ('MultipleContingencyList', 'ComponentList'), Storage.ContFullList) + ContFullList=('AAAA','ZER','t__uuu','nkop','iop') + self.jdc.appli.changeIntoDefMC('CONTINGENCY_SELECTION', ('MultipleContingencyList', 'ComponentList'), ContFullList) + except Exception, 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 getXLS(fileName) : + dico={} + dico['onglet1']=(('bus1','bus2','bus3'),('contin1','contin2','contin3')) + dico['onglet2']=(('bus4','bus5'),('contin4','contin5','contin6')) + dico['onglet3']=(('bus6','bus7'),('contin8',)) + print dico + return dico + + +def PROCESS_context(self,d): + print "dans le init du Process" + +def PROCESS(self,XLS_file,**args): + + + + print "dans PROCESS" + if XLS_file == "" or XLS_file == None: return + #Storage.csvFileName = XLS_file + # c est la premier fois + + if not (hasattr(self,'sheets')) : + print "dans if" + #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=[] + self.sheets=getXLS(XLS_file) + 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('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 + + + + # OldBusValeurs= self.get_child('BusList').getval() +# OldContValeurs= self.get_child('ContList').getval() +# if OldBusValeurs == None : OldBusValeurs=[] +# if OldContValeurs == None : OldContValeurs=[] +# +# listeBus=[] +# listeCont=[] +# listeBusCoches=[] +# listeContCoches=[] +# for o in OngletsValeurs : +# for b in self.dico[o][0]: +# texte=b+" ("+ str(o) +" )" +# listeBus.append(str(texte)) +# if texte in OldBusValeurs : listeBusCoches.append(str(texte)) +# for c in self.dico[o][1]: +# texte=c+" ("+ str(o) +" )" +# listeCont.append(str(texte)) +# if texte in OldContValeurs : listeContCoches.append(str(texte)) +# +# self.jdc.appli.changeIntoMCandSet(self,'BusList',listeBus,listeBusCoches) +# self.jdc.appli.changeIntoMCandSet(self,'ContList',listeCont,listeContCoches) diff --git a/ProcessOutputs_Eficas/prefs.py b/ProcessOutputs_Eficas/prefs.py new file mode 100644 index 00000000..647d0ae9 --- /dev/null +++ b/ProcessOutputs_Eficas/prefs.py @@ -0,0 +1,22 @@ +# Copyright (C) 2007-2012 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 +# +code="PSEN_N1" +import sys, os +if os.path.dirname(os.path.abspath(__file__)) not in sys.path : + sys.path.insert(0,os.path.dirname(os.path.abspath(__file__))) diff --git a/ProcessOutputs_Eficas/prefs_PSEN_N1.py b/ProcessOutputs_Eficas/prefs_PSEN_N1.py new file mode 100644 index 00000000..00992868 --- /dev/null +++ b/ProcessOutputs_Eficas/prefs_PSEN_N1.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# CONFIGURATION MANAGEMENT OF EDF VERSION +# ====================================================================== +# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG +# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY +# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY +# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR +# (AT YOUR OPTION) ANY LATER VERSION. +# +# THIS PROGRAM 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 +# GENERAL PUBLIC LICENSE FOR MORE DETAILS. +# +# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE +# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER, +# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE. +# +# +# ====================================================================== + +import os,sys +# repIni sert a localiser le fichier editeur.ini +# Obligatoire +repIni=os.path.dirname(os.path.abspath(__file__)) +INSTALLDIR=os.path.join(repIni,'..') +sys.path[:0]=[INSTALLDIR] + + +# lang indique la langue utilisee pour les chaines d'aide : fr ou ang +lang='en' #'fr' + +# Codage des strings qui accepte les accents (en remplacement de 'ascii') +encoding='iso-8859-1' +docPath=repIni + + +# +catalogues=( + ('PSEN_N1','default',os.path.join(repIni,'PSEN_Cata_N1.py'),'python','python'), +) -- 2.39.2