1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2021 EDF R&D
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.
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.
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
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 # --------------------------------------------------
23 # --------------------------------------------------
32 def __init__(self,ntuple):
35 def __convert__(self,valeur):
37 if type(valeur) == types.StringType:
39 if len(valeur) != self.ntuple:
44 return "Tuple de %s elements" % self.ntuple
51 JdC = JDC_CATA ( code = 'PSEN',
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' ),
70 MODIFICATION_CATALOGUE = MACRO ( nom = "MODIFICATION_CATALOGUE",
71 sd_prod = pn.modification_catalogue,
72 op_init= pn.modification_catalogue2,
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',),
82 # --------------------------------------------------
84 # --------------------------------------------------
86 CASE_SELECTION = MACRO ( nom = "CASE_SELECTION",
87 sd_prod = opsPSEN_N1.INCLUDE,
88 op_init = opsPSEN_N1.INCLUDE_context,
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"),
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,),
103 N_PROCESSING_OPTIONS = PROC ( nom = 'N_PROCESSING_OPTIONS',
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(
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'),),),
119 CONTINGENCY_OPTIONS = PROC (nom = 'CONTINGENCY_OPTIONS',
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),
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'),
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),
157 CONTINGENCY_SELECTION = PROC(nom='CONTINGENCY_SELECTION',op = None,
158 SelectionMethod = SIMP(statut='o',typ='TXM',into=['CaseSelectionFromFile','SelectAllCases','SelectWorstCases'],
161 b_file = BLOC(condition="SelectionMethod=='CaseSelectionFromFile'",
162 CaseSelectionFromFiles = FACT(
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'),),
174 # CaseSelectionFromFile = FACT(
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'),
185 # b_all = BLOC(condition="SelectionMethod=='SelectAllCases'",
186 # SelectAllCases = FACT(
188 # all_cases = SIMP(statut='o', typ=bool, defaut = True),
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'),),
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),
210 Automatic_N_2_Selection = FACT(statut='f',
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'),
217 MultipleContingencyList = FACT (statut='f',
219 ComponentList=SIMP(statut='o', typ = 'TXM', max='**', homo = 'SansOrdreNiDoublon',),
224 CONTINGENCY_PROCESSING = MACRO ( nom = 'CONTINGENCY_PROCESSING',
225 sd_prod = opsPSEN_N1.PROCESS,
226 op_init = opsPSEN_N1.PROCESS_context,
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'),
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',)