1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2013 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 # --------------------------------------------------
25 #from Accas import ASSD, JDC_CATA, AU_MOINS_UN, PROC, SIMP, FACT, OPER, MACRO, BLOC, A_VALIDATOR
30 #class loi ( ASSD ) : pass
31 #class variable ( ASSD ) : pass
32 class sd_charge ( ASSD ) : pass
33 class sd_generateur ( ASSD ) : pass
34 class sd_ligne ( ASSD ) : pass
35 class sd_transfo ( ASSD ) : pass
36 class sd_moteur ( ASSD ) : pass
41 def __init__(self,ntuple):
44 def __convert__(self,valeur):
46 if type(valeur) == types.StringType:
48 if len(valeur) != self.ntuple:
53 return "Tuple de %s elements" % self.ntuple
59 # def __init__(self,nbLigs=None,nbCols=None,methodeCalculTaille=None,formatSortie="ligne",valSup=None,valMin=None,structure=None):
62 # self.methodeCalculTaille=methodeCalculTaille
63 # self.formatSortie=formatSortie
66 # self.structure=structure
68 # def __convert__(self,valeur):
69 # # Attention ne verifie pas grand chose
70 # if type(valeur) != types.ListType :
75 # return "Matrice %s x %s" % (self.nbLigs, self.nbCols)
82 JdC = JDC_CATA ( code = 'PSEN',
84 regles = ( AU_MOINS_UN ( 'CASE_SELECTION', 'CONTINGENCY_PROCESSING' ),
85 AU_MOINS_UN ( 'CONTINGENCY_SELECTION','N_PROCESSING_OPTIONS','CONTINGENCY_PROCESSING' ),
86 PRESENT_PRESENT ( 'CONTINGENCY_SELECTION','CONTINGENCY_OPTIONS' ),
87 PRESENT_PRESENT ( 'CONTINGENCY_PROCESSING','CONTINGENCY_OPTIONS' ),
88 AU_MOINS_UN ( 'SIMULATION' ),
89 # AU_PLUS_UN ( 'PSSE_PARAMETERS' ),
90 AU_PLUS_UN ( 'CASE_SELECTION' ),
91 AU_PLUS_UN ( 'CONTINGENCY_OPTIONS' ),
92 AU_PLUS_UN ( 'CONTINGENCY_SELECTION' ),
93 AU_PLUS_UN ( 'CONTINGENCY_PROCESSING' ),
94 AU_PLUS_UN ( 'N_PROCESSING_OPTIONS' ),
95 # AU_PLUS_UN ( 'N_1_LINES' ),
96 # AU_PLUS_UN ( 'N_1_LOADS' ),
97 # AU_PLUS_UN ( 'N_1_TRANSFORMERS' ),
102 MODIFICATION_CATALOGUE = MACRO ( nom = "MODIFICATION_CATALOGUE",
103 sd_prod = pn.modification_catalogue,
104 op_init= pn.modification_catalogue2,
106 UIinfo={"groupes":("CACHE")},
107 Fonction=SIMP(statut='o', typ='TXM', into=['ajoutDefinitionMC']),
108 Etape=SIMP(statut='o', typ='TXM',),
109 Genea=SIMP(statut='o', typ='TXM', min=0, max='**'),
110 NomSIMP=SIMP(statut='o', typ='TXM',),
111 TypeSIMP=SIMP(statut='o', typ='TXM',),
112 PhraseArguments=SIMP(statut='o', typ='TXM',),)
115 # --------------------------------------------------
117 # --------------------------------------------------
119 CASE_SELECTION = MACRO ( nom = "CASE_SELECTION",
120 sd_prod = opsPSEN_N1.INCLUDE,
121 op_init = opsPSEN_N1.INCLUDE_context,
124 fr = "Selectionnez les cas a analyser",
125 ang = 'Select the cases to analyze',
126 PSSE_path = SIMP(statut="o",typ='Repertoire',defaut='C:\Program Files (x86)\PTI\PSSE33\PSSBIN'),
127 output_folder = SIMP(statut="o", typ="Repertoire"),
130 BusesList = SIMP(statut = 'f', typ = 'R', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'),
131 LinesList = SIMP(statut = 'f', typ = 'R', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'),
132 TransformersList = SIMP(statut = 'f', typ = 'TXM', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'),
133 MaxDepth = SIMP(statut = 'o', typ = 'I', defaut = 5),
134 OutputNewCsv = SIMP ( statut = "o",typ=bool,defaut=False,),
136 N_PROCESSING_OPTIONS = PROC ( nom = 'N_PROCESSING_OPTIONS',
138 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.",
139 Output_bus_values = SIMP(statut = 'o', typ = bool, defaut = True),
140 Output_lines_values = SIMP(statut = 'o', typ = bool, defaut = True),
141 Output_transformer_values = SIMP(statut = 'o', typ = bool, defaut = True),
142 Threshold_selection_for_the_treated_cases = FACT(
144 Branches = SIMP(statut="o",typ=Tuple(3),defaut=(0,0,0),validators=VerifTypeTuple(('R','R','R'),),),
145 Transformers = SIMP(statut="o",typ=Tuple(3),defaut=(0,0,0),validators=VerifTypeTuple(('R','R','R'),),),
146 High_voltage = SIMP(statut="o",typ=Tuple(3),defaut=(0,0,0),validators=VerifTypeTuple(('R','R','R'),),),
147 Low_voltage = SIMP(statut="o",typ=Tuple(3),defaut=(0,0,0),validators=VerifTypeTuple(('R','R','R'),),),
152 CONTINGENCY_OPTIONS = PROC (nom = 'CONTINGENCY_OPTIONS',
155 GeneralOptions = FACT(statut='o',
156 Vmin = SIMP(statut = 'o', typ = 'R', defaut = 0.9, val_min = 0),
157 Vmax = SIMP(statut = 'o', typ = 'R', defaut = 1.1, val_min = 0),
158 ContingencyRate = SIMP(statut = 'o', typ = 'TXM', defaut = 'a', into=['a', 'b']),
159 FlowLimitLines = SIMP(statut = 'o', typ = 'I', defaut = 120, val_min = 0),
160 FlowLimitTransformers = SIMP(statut = 'o', typ = 'I', defaut = 120, val_min = 0),
161 Tolerance = SIMP(statut = 'o', typ = 'R', defaut = 0.5, val_min = 0),
162 TripLines = SIMP(statut = 'o', typ = bool, defaut = True),
163 TripTransfos = SIMP(statut = 'o', typ = bool, defaut = True),
164 TripGenerators = SIMP(statut = 'o', typ = bool, defaut = True),
165 TripBuses = SIMP(statut = 'o', typ = bool, defaut = False),
168 LoadFlowOptions = FACT(statut='o',
169 AdjustTaps = SIMP(statut = 'o', typ = 'TXM', into = ['0 - Lock', '1 - Stepping', '2 - Direct'], defaut = '1 - Stepping'),
170 AdjustDCtaps = SIMP(statut = 'o', typ = 'TXM', into = ['0 - Disable', '1 - Enable'], defaut = '1 - Enable'),
171 SolutionMethod = SIMP(statut = 'o', typ = 'TXM', into = ['0 - FDNS', '1 - FNSL', '2 - Optimized FDNS'], defaut = '1 - FNSL'),
172 AdjustSwitchedShunts = SIMP(statut = 'o', typ = 'TXM', into = ['0 - Disable', '1 - Enable', '2 - Enable continuous mode'], defaut = '1 - Enable'),
173 DispatchMode = SIMP(statut = 'o', typ = 'TXM', into = ['0 - Disable', '1 - Reserve', '2 - Pmax', '3 - Inertia', '4 - Droop'], defaut = '1 - Reserve'),
174 FlatStart = SIMP(statut = 'o', typ = bool, defaut = False),
175 VarLimits = SIMP(statut = 'o', typ = 'I', defaut = 99,ang = 'if set to -1, var limits will not be applied'),
178 # OutputOptions = FACT(statut='o',
179 # consigne1 = SIMP(statut='o',homo='information',typ = "TXM",defaut = 'Output PSSE multiple contingency report to Shell?'),
180 # MultipleContingencyReport = SIMP(statut = 'o', typ = bool, defaut = True, ang = 'Output PSSE multiple contingency report to Shell?'),
181 # consigne2 = SIMP(statut='o',homo='information',typ = "TXM",defaut = 'Write an Excel file for the results of each case file?'),
182 # WriteIndivExcels = SIMP(statut = 'o', typ = bool, defaut = True),
183 # 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?'),
184 # WriteFlowDifs = SIMP(statut = 'o', typ = bool, defaut = True),
191 CONTINGENCY_SELECTION = PROC(nom='CONTINGENCY_SELECTION',op = None,
192 SelectionMethod = SIMP(statut='o',typ='TXM',into=['CaseSelectionFromFile','SelectAllCases','SelectWorstCases'],
195 b_file = BLOC(condition="SelectionMethod=='CaseSelectionFromFile'",
196 CaseSelectionFromFiles = FACT(
198 case = FACT(statut='o',max='**',
199 case_name=SIMP(statut='o',typ='TXM'),
200 csv_file= SIMP(statut='o', typ = ('Fichier', 'CSV file (*.csv);;All Files (*)',),),),
201 # regles=(AU_MOINS_UN('branch_cases','transformer_cases','high_voltage_cases','low_voltage_cases',),),
202 # branch_cases = SIMP(statut='o', defaut='', typ = ('Fichier', 'CSV file (*.csv);;All Files (*)','Sauvegarde'),),
203 # transformer_cases = SIMP(statut='o', defaut='', typ = ('Fichier', 'CSV file (*.csv);;All Files (*)','Sauvegarde',),),
204 # high_voltage_cases = SIMP(statut='o', defaut='', typ = ('Fichier', 'CSV file (*.csv);;All Files (*)','Sauvegarde'),),
205 # low_voltage_cases = SIMP(statut='o', defaut='', typ = ('Fichier', 'CSV file (*.csv);;All Files (*)','Sauvegarde'),),
208 # CaseSelectionFromFile = FACT(
210 # input_path = SIMP(statut="o",typ='Repertoire'),
211 # branch_cases = SIMP(statut='o', typ='TXM'),
212 # transformer_cases = SIMP(statut='o', typ='TXM'),
213 # high_cases = SIMP(statut='o', typ='TXM'),
214 # low_cases = SIMP(statut='o', typ='TXM'),
219 # b_all = BLOC(condition="SelectionMethod=='SelectAllCases'",
220 # SelectAllCases = FACT(
222 # all_cases = SIMP(statut='o', typ=bool, defaut = True),
226 b_worst = BLOC(condition="SelectionMethod=='SelectWorstCases'",
227 SelectWorstCases = FACT(
228 regles = (AU_MOINS_UN('AvgLineLoad', 'AvgLineLoadPercent','AvgTransformerLoad','AvgTransformerLoadPercent','AvgHighVoltage', 'AvgHighVoltagePercent','AvgLowVoltage', 'AvgLowVoltagePercent'),
229 EXCLUS('AvgLineLoad', 'AvgLineLoadPercent'),EXCLUS('AvgTransformerLoad','AvgTransformerLoadPercent'),EXCLUS('AvgHighVoltage', 'AvgHighVoltagePercent'),EXCLUS('AvgLowVoltage', 'AvgLowVoltagePercent'),),
231 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.'),
232 AvgLineLoad = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0),
233 AvgLineLoadPercent = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0, val_max = 100),
234 AvgTransformerLoad = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0),
235 AvgTransformerLoadPercent = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0, val_max = 100),
236 AvgHighVoltage = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0),
237 AvgHighVoltagePercent = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0, val_max = 100),
238 AvgLowVoltage = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0),
239 AvgLowVoltagePercent = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0, val_max = 100),
244 Automatic_N_2_Selection = FACT(statut='f',
246 BusesList = SIMP(statut = 'o', typ = 'R', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'),
247 LinesList = SIMP(statut = 'o', typ = 'R', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'),
248 TransformersList = SIMP(statut = 'o', typ = 'TXM', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'),
251 MultipleContingencyList = FACT (statut='f',
253 ComponentList=SIMP(statut='o', typ = 'TXM', max='**', homo = 'SansOrdreNiDoublon',),
258 CONTINGENCY_PROCESSING = MACRO ( nom = 'CONTINGENCY_PROCESSING',
259 sd_prod = opsPSEN_N1.PROCESS,
260 op_init = opsPSEN_N1.PROCESS_context,
268 XLS_file = SIMP(statut="o", typ = ('Fichier', 'XLS file (*.xls);;All Files (*)',),),
269 b_TabList = BLOC(condition="XLS_file != None and XLS_file != ''",
270 TabList = SIMP(statut = 'o', typ = 'TXM', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'), ),
272 # b_highVoltage = BLOC(condition="'High Voltage 0' in TabList",
273 # HighVoltageBuses = SIMP(statut = 'o', typ = 'TXM', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'),
274 # HighVoltageContingencies = SIMP(statut = 'o', typ = 'TXM', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'),
279 Ordre_Des_Commandes = ('CASE_SELECTION' , 'N_PROCESSING_OPTIONS' , 'CONTINGENCY_SELECTION', 'CONTINGENCY_OPTIONS' ,'CONTINGENCY_PROCESSING',)
280 Classement_Commandes_Ds_Arbre = ('CASE_SELECTION' , 'N_PROCESSING_OPTIONS' , 'CONTINGENCY_SELECTION', 'CONTINGENCY_OPTIONS' ,'CONTINGENCY_PROCESSING',)