From dea79db5e9dda4f555a91004e71665d51c6bc935 Mon Sep 17 00:00:00 2001 From: MUNET Claire Date: Tue, 23 Oct 2018 11:35:44 +0200 Subject: [PATCH] decoupage processOutput --- InterfaceQT4/editor.py | 5 +- ...EN_Cata_N1.py => PSEN_Cata_Contingency.py} | 70 +--------- .../PSEN_Cata_DataProcessing.py | 122 ++++++++++++++++++ ProcessOutputs_Eficas/prefs_PSEN_N1.py | 3 +- 4 files changed, 134 insertions(+), 66 deletions(-) rename ProcessOutputs_Eficas/{PSEN_Cata_N1.py => PSEN_Cata_Contingency.py} (76%) create mode 100644 ProcessOutputs_Eficas/PSEN_Cata_DataProcessing.py diff --git a/InterfaceQT4/editor.py b/InterfaceQT4/editor.py index 505bfcf2..1959b08b 100755 --- a/InterfaceQT4/editor.py +++ b/InterfaceQT4/editor.py @@ -417,7 +417,7 @@ class JDCEditor(Ui_baseWidget,QWidget): if self.code == "ZCRACKS" : texte=self._newZCRACKS() if self.code == "TELEMAC" : texte=self._newTELEMAC() if self.code == "PSEN" : texte = self._newPSEN() - if self.code == "PSEN_N1" : texte = self._newPSEN_N1() + if self.code == "PSEN_N1" : texte = self.readercata.cata[0].TEXTE_NEW_JDC if hasattr(self.readercata.cata[0],'TEXTE_NEW_JDC') : texte=self.readercata.cata[0].TEXTE_NEW_JDC @@ -1800,7 +1800,8 @@ class JDCEditor(Ui_baseWidget,QWidget): #---------------------------# def _newPSEN_N1(self): #---------------------------# - texte="CASE_SELECTION();N_PROCESSING_OPTIONS();CONTINGENCY_OPTIONS();CONTINGENCY_SELECTION();\nCONTINGENCY_PROCESSING(); " + texte="" + # texte="CASE_SELECTION();CONTINGENCY_OPTIONS();CONTINGENCY_SELECTION();\nCONTINGENCY_PROCESSING(); " #texte="CONTINGENCY_SELECTION();\nCONTINGENCY_PROCESSING(); " return texte diff --git a/ProcessOutputs_Eficas/PSEN_Cata_N1.py b/ProcessOutputs_Eficas/PSEN_Cata_Contingency.py similarity index 76% rename from ProcessOutputs_Eficas/PSEN_Cata_N1.py rename to ProcessOutputs_Eficas/PSEN_Cata_Contingency.py index 455d4833..d18a371e 100644 --- a/ProcessOutputs_Eficas/PSEN_Cata_N1.py +++ b/ProcessOutputs_Eficas/PSEN_Cata_Contingency.py @@ -55,49 +55,19 @@ class Tuple: __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', 'CONTINGENCY_PROCESSING' ), - AU_MOINS_UN ( 'CONTINGENCY_SELECTION','N_PROCESSING_OPTIONS','CONTINGENCY_PROCESSING' ), + AU_MOINS_UN ( 'CONTINGENCY_SELECTION','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, @@ -112,10 +82,6 @@ MODIFICATION_CATALOGUE = MACRO ( nom = "MODIFICATION_CATALOGUE", PhraseArguments=SIMP(statut='o', typ='TXM',),) -# -------------------------------------------------- -# fin entete -# -------------------------------------------------- -## TODO : RUN CASE_SELECTION = MACRO ( nom = "CASE_SELECTION", sd_prod = opsPSEN_N1.INCLUDE, op_init = opsPSEN_N1.INCLUDE_context, @@ -138,20 +104,6 @@ CASE_SELECTION = MACRO ( nom = "CASE_SELECTION", 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', @@ -185,14 +137,6 @@ CONTINGENCY_OPTIONS = PROC (nom = 'CONTINGENCY_OPTIONS', flush = SIMP ( statut = "f",typ="I",val_min=1,defaut=10,), -# 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), -# ), ) @@ -264,19 +208,19 @@ 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', 'All files (*)',),), - #CSV_folder = SIMP(statut="o", typ = 'Repertoire'), - #b_TabList = BLOC(condition="(XLS_file != None and XLS_file != '') or (CSV_folder != None and CSV_folder != '')", + 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',) +Ordre_Des_Commandes = ('CASE_SELECTION' , 'CONTINGENCY_SELECTION', 'CONTINGENCY_OPTIONS' ,'CONTINGENCY_PROCESSING',) +Classement_Commandes_Ds_Arbre = ('CASE_SELECTION', 'CONTINGENCY_SELECTION', 'CONTINGENCY_OPTIONS' ,'CONTINGENCY_PROCESSING',) + +TEXTE_NEW_JDC = "CASE_SELECTION();CONTINGENCY_OPTIONS();CONTINGENCY_SELECTION();\nCONTINGENCY_PROCESSING(); " diff --git a/ProcessOutputs_Eficas/PSEN_Cata_DataProcessing.py b/ProcessOutputs_Eficas/PSEN_Cata_DataProcessing.py new file mode 100644 index 00000000..da147583 --- /dev/null +++ b/ProcessOutputs_Eficas/PSEN_Cata_DataProcessing.py @@ -0,0 +1,122 @@ +# -*- 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 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_PLUS_UN ( 'CASE_SELECTION' ), + AU_PLUS_UN ( 'N_PROCESSING_OPTIONS' ), + ), + ) # 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',),) + + +# +CASE_SELECTION = MACRO ( nom = "CASE_SELECTION", + sd_prod = opsPSEN_N1.INCLUDE, + op_init = opsPSEN_N1.INCLUDE_context, + fichier_ini = 1, + op = None, + fr = "Selectionnez les cas a  analyser", + ang = 'Select the cases to analyze', + PSSE_path = SIMP(statut="o",typ='Repertoire',defaut='C:\Program Files (x86)\PTI\PSSE34\PSSBIN'), + PSSPY_path = SIMP(statut="o",typ='Repertoire',defaut='C:\Program Files (x86)\PTI\PSSE34\PSSPY27'), + 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='.',), + + AreaList = SIMP(statut = 'f', typ = 'I', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'), + 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'),),), + ), + ) + + +Ordre_Des_Commandes = ('CASE_SELECTION' , 'N_PROCESSING_OPTIONS' ) +Classement_Commandes_Ds_Arbre = ('CASE_SELECTION' , 'N_PROCESSING_OPTIONS') + +TEXTE_NEW_JDC = "CASE_SELECTION(); N_PROCESSING_OPTIONS(); " \ No newline at end of file diff --git a/ProcessOutputs_Eficas/prefs_PSEN_N1.py b/ProcessOutputs_Eficas/prefs_PSEN_N1.py index 64c2ebb2..cb93ccbb 100644 --- a/ProcessOutputs_Eficas/prefs_PSEN_N1.py +++ b/ProcessOutputs_Eficas/prefs_PSEN_N1.py @@ -38,7 +38,8 @@ affiche='ordre' # catalogues=( - ('PSEN_N1','Process output for PSSE',os.path.join(repIni,'PSEN_Cata_N1.py'),'ProcessOutputs','python'), + ('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'), ) -- 2.39.2