]> SALOME platform Git repositories - tools/eficas.git/blob - OldCodes/ProcessOutputs_Eficas/ProcessOutputs_Cata.py
Salome HOME
chgt Copyrigth
[tools/eficas.git] / OldCodes / ProcessOutputs_Eficas / ProcessOutputs_Cata.py
1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2021   EDF R&D
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20
21 # --------------------------------------------------
22 # debut entete
23 # --------------------------------------------------
24
25 from Accas import *
26 import opsPSEN_N1
27 import pn
28 #
29
30 # import types
31 class Tuple:
32    def __init__(self,ntuple):
33      self.ntuple=ntuple
34
35    def __convert__(self,valeur):
36      import types
37      if type(valeur) == types.StringType:
38        return None
39      if len(valeur) != self.ntuple:
40        return None
41      return valeur
42
43    def info(self):
44      return "Tuple de %s elements" % self.ntuple
45
46    __repr__=info
47    __str__=info
48
49
50 #CONTEXT.debug = 1
51 JdC = JDC_CATA ( code = 'PSEN',
52                  execmodul = None,
53                  regles = ( AU_MOINS_UN ( 'CASE_SELECTION', 'CONTINGENCY_PROCESSING' ),
54                             AU_MOINS_UN ( 'CONTINGENCY_SELECTION','N_PROCESSING_OPTIONS','CONTINGENCY_PROCESSING' ),
55                             PRESENT_PRESENT ( 'CONTINGENCY_SELECTION','CONTINGENCY_OPTIONS' ),
56                             # AU_MOINS_UN ( 'SIMULATION' ),
57                             # AU_PLUS_UN ( 'PSSE_PARAMETERS' ),
58                             AU_PLUS_UN ( 'CASE_SELECTION' ),
59                             AU_PLUS_UN ( 'CONTINGENCY_OPTIONS' ),
60                             AU_PLUS_UN ( 'CONTINGENCY_SELECTION' ),
61                             AU_PLUS_UN ( 'CONTINGENCY_PROCESSING' ),
62                             AU_PLUS_UN ( 'N_PROCESSING_OPTIONS' ),
63                             # AU_PLUS_UN ( 'N_1_LINES' ),
64                             # AU_PLUS_UN ( 'N_1_LOADS' ),
65                             # AU_PLUS_UN ( 'N_1_TRANSFORMERS' ),
66
67                             ),
68                  ) # Fin JDC_CATA
69
70 MODIFICATION_CATALOGUE = MACRO ( nom = "MODIFICATION_CATALOGUE",
71                      sd_prod = pn.modification_catalogue,
72                      op_init=  pn.modification_catalogue2,
73                      op=None,
74                      UIinfo={"groupes":("CACHE")},
75                      Fonction=SIMP(statut='o', typ='TXM', into=['ajoutDefinitionMC']),
76                      Etape=SIMP(statut='o', typ='TXM',),
77                      Genea=SIMP(statut='o', typ='TXM', min=0, max='**'),
78                      NomSIMP=SIMP(statut='o', typ='TXM',),
79                      TypeSIMP=SIMP(statut='o', typ='TXM',),
80                      PhraseArguments=SIMP(statut='o', typ='TXM',),
81 )
82 # --------------------------------------------------
83 # fin entete
84 # --------------------------------------------------
85 ## TODO : RUN
86 CASE_SELECTION = MACRO ( nom = "CASE_SELECTION",
87                       sd_prod = opsPSEN_N1.INCLUDE,
88                       op_init = opsPSEN_N1.INCLUDE_context,
89                       fichier_ini = 1,
90                       op = None,
91                       fr = "Sélectionnez les cas à analyser",
92                       ang = 'Select the cases to analyze',
93                       PSSE_path = SIMP(statut="o",typ='Repertoire',defaut='C:\Program Files (x86)\PTI\PSSE33\PSSBIN'),
94                       output_folder = SIMP(statut="o", typ="Repertoire"),
95
96
97                       BusesList = SIMP(statut = 'f', typ = 'R', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'),
98                       LinesList = SIMP(statut = 'f', typ = 'R', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'),
99                       TransformersList = SIMP(statut = 'f', typ = 'TXM', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'),
100                       MaxDepth = SIMP(statut = 'o', typ = 'I', defaut = 5),
101                       OutputNewCsv = SIMP ( statut = "o",typ=bool,defaut=False,),
102                  )
103 N_PROCESSING_OPTIONS = PROC ( nom = 'N_PROCESSING_OPTIONS',
104                             op = None,
105                             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.",  
106                            Output_bus_values = SIMP(statut = 'o', typ = bool, defaut = True),
107                            Output_lines_values = SIMP(statut = 'o', typ = bool, defaut = True),
108                            Output_transformer_values = SIMP(statut = 'o', typ = bool, defaut = True),
109                            Threshold_selection_for_the_treated_cases = FACT(
110                               statut = 'f',
111                               Branches = SIMP(statut="o",typ=Tuple(3),defaut=(0,0,0),validators=VerifTypeTuple(('R','R','R'),),),
112                               Transformers = SIMP(statut="o",typ=Tuple(3),defaut=(0,0,0),validators=VerifTypeTuple(('R','R','R'),),),
113                               High_voltage = SIMP(statut="o",typ=Tuple(3),defaut=(0,0,0),validators=VerifTypeTuple(('R','R','R'),),),
114                               Low_voltage = SIMP(statut="o",typ=Tuple(3),defaut=(0,0,0),validators=VerifTypeTuple(('R','R','R'),),),
115                            ),
116                            )
117
118
119 CONTINGENCY_OPTIONS = PROC (nom = 'CONTINGENCY_OPTIONS',
120                             op = None,
121                             
122                             GeneralOptions = FACT(statut='o',
123                                 Vmin = SIMP(statut = 'o', typ = 'R', defaut = 0.9, val_min = 0),
124                                 Vmax = SIMP(statut = 'o', typ = 'R', defaut = 1.1, val_min = 0),
125                                 ContingencyRate = SIMP(statut = 'o', typ = 'TXM', defaut = 'a', into=['a', 'b']),
126                                 FlowLimitLines = SIMP(statut = 'o', typ = 'I', defaut = 120, val_min = 0),
127                                 FlowLimitTransformers = SIMP(statut = 'o', typ = 'I', defaut = 120, val_min = 0),
128                                 Tolerance = SIMP(statut = 'o', typ = 'R', defaut = 0.5, val_min = 0),
129                                 TripLines = SIMP(statut = 'o', typ = bool, defaut = True),
130                                 TripTransfos = SIMP(statut = 'o', typ = bool, defaut = True),
131                                 TripGenerators = SIMP(statut = 'o', typ = bool, defaut = True),
132                                 ),                            
133
134                             LoadFlowOptions = FACT(statut='o',
135                                 AdjustTaps = SIMP(statut = 'o', typ = 'TXM', into = ['0 - Lock', '1 - Stepping', '2 - Direct'], defaut = '1 - Stepping'),
136                                 AdjustDCtaps = SIMP(statut = 'o', typ = 'TXM', into = ['0 - Disable', '1 - Enable'], defaut = '1 - Enable'),
137                                 SolutionMethod = SIMP(statut = 'o', typ = 'TXM', into = ['0 - FDNS', '1 - FNSL', '2 - Optimized FDNS'], defaut = '1 - FNSL'),
138                                 AdjustSwitchedShunts = SIMP(statut = 'o', typ = 'TXM', into = ['0 - Disable', '1 - Enable', '2 - Enable continuous mode'], defaut = '1 - Enable'),
139                                 DispatchMode = SIMP(statut = 'o', typ = 'TXM', into = ['0 - Disable', '1 - Reserve', '2 - Pmax', '3 - Inertia', '4 - Droop'], defaut = '1 - Reserve'),
140                                 FlatStart = SIMP(statut = 'o', typ = bool, defaut = False),
141                                 VarLimits = SIMP(statut = 'o', typ = 'I', defaut = 99,ang = 'if set to -1, var limits will not be applied'),
142                                 ),
143                             
144 #                            OutputOptions = FACT(statut='o',
145 #                                consigne1 = SIMP(statut='o',homo='information',typ = "TXM",defaut = 'Output PSSE multiple contingency report to Shell?'),
146 #                                MultipleContingencyReport = SIMP(statut = 'o', typ = bool, defaut = True, ang = 'Output PSSE multiple contingency report to Shell?'),
147 #                                consigne2 = SIMP(statut='o',homo='information',typ = "TXM",defaut = 'Write an Excel file for the results of each case file?'),
148 #                                WriteIndivExcels = SIMP(statut = 'o', typ = bool, defaut = True),
149 #                                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?'),
150 #                                WriteFlowDifs = SIMP(statut = 'o', typ = bool, defaut = True),                            
151 #                            ),
152                         )
153
154
155
156
157 CONTINGENCY_SELECTION = PROC(nom='CONTINGENCY_SELECTION',op = None,
158                       SelectionMethod = SIMP(statut='o',typ='TXM',into=['CaseSelectionFromFile','SelectAllCases','SelectWorstCases'],
159                       ),
160                       
161                       b_file = BLOC(condition="SelectionMethod=='CaseSelectionFromFile'",
162                       CaseSelectionFromFiles = FACT(
163                            statut = 'o',
164                            case = FACT(statut='o',max='**',
165                                        case_name=SIMP(statut='o',typ='TXM'),
166                                        csv_file= SIMP(statut='o', typ = ('Fichier', 'CSV file (*.csv);;All Files (*)',),),),
167 #                           regles=(AU_MOINS_UN('branch_cases','transformer_cases','high_voltage_cases','low_voltage_cases',),),
168 #                           branch_cases = SIMP(statut='o', defaut='', typ = ('Fichier', 'CSV file (*.csv);;All Files (*)','Sauvegarde'),),
169 #                           transformer_cases = SIMP(statut='o', defaut='', typ = ('Fichier', 'CSV file (*.csv);;All Files (*)','Sauvegarde',),),
170 #                           high_voltage_cases = SIMP(statut='o', defaut='', typ = ('Fichier', 'CSV file (*.csv);;All Files (*)','Sauvegarde'),),
171 #                           low_voltage_cases = SIMP(statut='o', defaut='', typ = ('Fichier', 'CSV file (*.csv);;All Files (*)','Sauvegarde'),),
172                         ),
173 #                        ',
174 #                      CaseSelectionFromFile = FACT(
175 #                           statut = 'o',
176 #                           input_path = SIMP(statut="o",typ='Repertoire'),
177 #                           branch_cases = SIMP(statut='o', typ='TXM'),
178 #                           transformer_cases = SIMP(statut='o', typ='TXM'),
179 #                           high_cases = SIMP(statut='o', typ='TXM'),
180 #                           low_cases = SIMP(statut='o', typ='TXM'),
181 #                        ),
182                         
183                         ),
184                         
185 #                      b_all = BLOC(condition="SelectionMethod=='SelectAllCases'",
186 #                      SelectAllCases = FACT(
187 #                           statut='o',
188 #                           all_cases = SIMP(statut='o', typ=bool, defaut = True),
189 #                         ),
190 #                         ),
191                          
192                       b_worst = BLOC(condition="SelectionMethod=='SelectWorstCases'",
193                       SelectWorstCases = FACT(
194                           regles = (AU_MOINS_UN('AvgBranchLoad', 'AvgBranchLoadPercent','AvgTransformerLoad','AvgTransformerLoadPercent','AvgHighVoltage', 'AvgHighVoltagePercent','AvgLowVoltage', 'AvgLowVoltagePercent'),
195                                     EXCLUS('AvgBranchLoad', 'AvgBranchLoadPercent'),EXCLUS('AvgTransformerLoad','AvgTransformerLoadPercent'),EXCLUS('AvgHighVoltage', 'AvgHighVoltagePercent'),EXCLUS('AvgLowVoltage', 'AvgLowVoltagePercent'),),
196                           statut = 'o',
197                           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.'),
198                           AvgBranchLoad = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0),
199                           AvgBranchLoadPercent = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0, val_max = 100),
200                           AvgTransformerLoad = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0),
201                           AvgTransformerLoadPercent = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0, val_max = 100),
202                           AvgHighVoltage = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0),
203                           AvgHighVoltagePercent = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0, val_max = 100),
204                           AvgLowVoltage = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0),
205                           AvgLowVoltagePercent = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0, val_max = 100),
206                         ),
207                         ),
208
209
210                       Automatic_N_2_Selection = FACT(statut='f',
211                                                      
212                           BusesList = SIMP(statut = 'o', typ = 'R', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'),
213                           LinesList = SIMP(statut = 'o', typ = 'R', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'),
214                           TransformersList = SIMP(statut = 'o', typ = 'TXM', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'),                                                    
215                         ),
216
217                      MultipleContingencyList = FACT (statut='f',
218                                                           max="**",
219                                                           ComponentList=SIMP(statut='o', typ = 'TXM', max='**', homo = 'SansOrdreNiDoublon',),
220                      ),
221
222                       )
223
224 CONTINGENCY_PROCESSING = MACRO ( nom = 'CONTINGENCY_PROCESSING',
225                         sd_prod = opsPSEN_N1.PROCESS,
226                         op_init = opsPSEN_N1.PROCESS_context,
227                         op = None,
228                         fichier_ini = 1,
229                         fr = "",
230                         ang="",
231                         XLS_file = SIMP(statut="f", typ = ('Fichier', 'XLS file (*.xls);;All Files (*)',),),
232                         b_TabList = BLOC(condition="XLS_file != None and XLS_file != ''",
233                             TabList = SIMP(statut = 'o', typ = 'TXM', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'), 
234                         
235                           ),
236                         
237                     )
238
239 Ordre_Des_Commandes = ('CASE_SELECTION' , 'N_PROCESSING_OPTIONS' , 'CONTINGENCY_SELECTION', 'CONTINGENCY_OPTIONS' ,'CONTINGENCY_PROCESSING',)
240 Classement_Commandes_Ds_Arbre = ('CASE_SELECTION' , 'N_PROCESSING_OPTIONS' , 'CONTINGENCY_SELECTION', 'CONTINGENCY_OPTIONS' ,'CONTINGENCY_PROCESSING',)