Salome HOME
chgt Copyrigth
[tools/eficas.git] / OldCodes / PSEN_N1 / PSEN_Cata_N1.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 ASSD, JDC_CATA, AU_MOINS_UN, PROC, SIMP, FACT, OPER, MACRO, BLOC, A_VALIDATOR
26 from Accas import *
27 import opsPSEN_N1
28 #
29 #class loi      ( ASSD ) : pass
30 #class variable ( ASSD ) : pass
31 class sd_charge     ( ASSD ) : pass
32 class sd_generateur ( ASSD ) : pass
33 class sd_ligne     ( ASSD ) : pass
34 class sd_transfo ( ASSD ) : pass
35 class sd_moteur ( ASSD ) : pass
36 #
37
38 # import types
39 class Tuple:
40    def __init__(self,ntuple):
41      self.ntuple=ntuple
42
43    def __convert__(self,valeur):
44      if type(valeur) == types.StringType:
45        return None
46      if len(valeur) != self.ntuple:
47        return None
48      return valeur
49
50    def info(self):
51      return "Tuple de %s elements" % self.ntuple
52
53    __repr__=info
54    __str__=info
55
56 # class Matrice:
57 #   def __init__(self,nbLigs=None,nbCols=None,methodeCalculTaille=None,formatSortie="ligne",valSup=None,valMin=None,structure=None):
58 #       self.nbLigs=nbLigs
59 #       self.nbCols=nbCols
60 #       self.methodeCalculTaille=methodeCalculTaille
61 #       self.formatSortie=formatSortie
62 #       self.valSup=valSup
63 #       self.valMin=valMin
64 #       self.structure=structure
65 #
66 #   def __convert__(self,valeur):
67 #     # Attention ne verifie pas grand chose
68 #     if type(valeur) != types.ListType :
69 #       return None
70 #     return valeur
71 #
72 #   def info(self):
73 #       return "Matrice %s x %s" % (self.nbLigs, self.nbCols)
74 #
75 #       __repr__=info
76 #       __str__=info
77
78
79 #CONTEXT.debug = 1
80 JdC = JDC_CATA ( code = 'PSEN',
81                  execmodul = None,
82                  regles = ( AU_MOINS_UN ( 'CASE_SELECTION' ),
83                             # AU_MOINS_UN ( 'DIRECTORY' ),
84                             # AU_MOINS_UN ( 'DISTRIBUTION' ),
85                             # AU_MOINS_UN ( 'SIMULATION' ),
86                             # AU_PLUS_UN ( 'PSSE_PARAMETERS' ),
87                             # AU_PLUS_UN ( 'DIRECTORY' ),
88                             # AU_PLUS_UN ( 'SIMULATION' ),
89                             # AU_PLUS_UN ( 'CORRELATION' ),
90                             # AU_PLUS_UN ( 'N_1_GENERATORS' ),
91                             # AU_PLUS_UN ( 'N_1_LINES' ),
92                             # AU_PLUS_UN ( 'N_1_LOADS' ),
93                             # AU_PLUS_UN ( 'N_1_TRANSFORMERS' ),
94
95                             ),
96                  ) # Fin JDC_CATA
97
98
99 # --------------------------------------------------
100 # fin entete
101 # --------------------------------------------------
102 ## TODO : RUN
103 CASE_SELECTION = MACRO ( nom = "CASE_SELECTION",
104                       sd_prod = opsPSEN_N1.INCLUDE,
105                       op_init = opsPSEN_N1.INCLUDE_context,
106                       regles = (UN_PARMI('FromFile', 'AllCases', 'WorstCases'),),
107                       fichier_ini = 1,
108                       op = None,
109                       fr = "Sélectionnez les cas à analyser",
110                       ang = 'Select the cases to analyze',
111                       PSSE_path = SIMP(statut="o",typ='Repertoire',defaut='C:\Program Files (x86)\PTI\PSSE33\PSSBIN'),
112                       output_folder = SIMP(statut="o", typ="Repertoire"),
113
114                       FromFile = FACT(
115                            statut = 'f',
116                            input_path = SIMP(statut="f",typ='Repertoire'),
117                            branch_cases = SIMP(statut='o', typ='TXM'),
118                            transfo_cases = SIMP(statut='o', typ='TXM'),
119                            high_cases = SIMP(statut='o', typ='TXM'),
120                            low_cases = SIMP(statut='o', typ='TXM'),
121                         ),
122
123                       AllCases = FACT(
124                            statut='f',
125                            all_cases = SIMP(statut='o', typ=bool, defaut = True),
126                          ),
127
128                       WorstCases = FACT(
129                           regles = (UN_PARMI('AvgBranchLoad', 'AvgBranchLoadPercent'), UN_PARMI('AvgTransfoLoad', 'AvgTransfoLoadPercent'), UN_PARMI('AvgHighVoltage', 'AvgHighVoltagePercent'), UN_PARMI('AvgLowVoltage', 'AvgLowVoltagePercent'),),
130                           statut = 'f',
131                           AvgBranchLoad = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0),
132                           AvgBranchLoadPercent = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0, val_max = 100),
133                           AvgTransfoLoad = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0),
134                           AvgTransfoLoadPercent = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0, val_max = 100),
135                           AvgHighVoltage = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0),
136                           AvgHighVoltagePercent = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0, val_max = 100),
137                           AvgLowVoltage = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0),
138                           AvgLowVoltagePercent = SIMP(statut = 'f', typ = 'I', defaut = 0, val_min = 0, val_max = 100),
139                         ),
140
141                       MaxDepth = SIMP(statut = 'o', typ = 'I', defaut = 5),
142                       Consigne = SIMP(statut = "o",homo = 'information',typ = "TXM", defaut = "complete CASE SELECTION"),
143
144                       BusesList = SIMP(statut = 'f', typ = 'R', min = 0, max = '**', defaut = (), homo = 'SansOrdreNiDoublon'),
145
146                       optionsLF = FACT (
147                         statut = 'o',
148                         AdjTaps = SIMP(statut = 'o', typ = 'TXM', into = ['0 - Lock', '1 - Stepping', '2 - Direct'], defaut = '1 - Stepping'),
149                         AdjDCtaps = SIMP(statut = 'o', typ = 'TXM', into = ['0 - Disable', '1 - Enable'], defaut = '1 - Enable'),
150                         SolutionMethod = SIMP(statut = 'o', typ = 'TXM', into = ['0 - FDNS', '1 - FNSL', '2 - Optimized FDNS'], defaut = '1 - FNSL'),
151                         AdjSwitchedShunts = SIMP(statut = 'o', typ = 'TXM', into = ['0 - Disable', '1 - Enable', '2 - Enable continuous mode'], defaut = '1 - Enable'),
152                         DispatchMode = SIMP(statut = 'o', typ = 'TXM', into = ['0 - Disable', '1 - Reserve', '2 - Pmax', '3 - Inertia', '4 - Droop'], defaut = '1 - Reserve'),
153                         FlatStart = SIMP(statut = 'o', typ = bool, defaut = False),
154                         VarLimits = SIMP(statut = 'o', typ = 'I', defaut = 99),
155                       ),                 
156                  )
157
158 CONTINGENCY_OPTIONS = PROC ( nom = 'CONTINGENCY_OPTIONS',
159                             op = None,
160                             fr = "Definitions des lois marginales utilisees par les variables d'entree",
161                             ang = 'Nyu',
162                             Vmin = SIMP(statut = 'o', typ = 'R', defaut = 0.9, val_min = 0),
163                             Vmax = SIMP(statut = 'o', typ = 'R', defaut = 1.1, val_min = 0),
164                             ContRate = SIMP(statut = 'o', typ = 'TXM', defaut = 'a', into=['a', 'b']),
165                             FlowLimitLines = SIMP(statut = 'o', typ = 'I', defaut = 110, val_min = 0),
166                             FloLimitTransfos = SIMP(statut = 'o', typ = 'I', defaut = 100, val_min = 0),
167                             Tolance = SIMP(statut = 'o', typ = 'I', defaut = 10, val_min = 0),
168                             RadialLinesOnly = SIMP(statut = 'o', typ = bool, defaut = False),
169                             TripTransfos = SIMP(statut = 'o', typ = bool, defaut = True),
170                             TripGenerators = SIMP(statut = 'o', typ = bool, defaut = True),
171                             TripN_2 = SIMP(statut = 'o', typ = bool, defaut = False),
172                             IsolatedGen = SIMP(statut = 'o', typ = bool, defaut = True),
173                         )
174
175 OUTPUT_OPTIONS = PROC ( nom = 'OUTPUT_OPTIONS',
176                         op = None,
177                         fr = "Definitions des lois marginales utilisees par les variables d'entree",
178                         ang = 'Nyu',
179                         TrNoGSUorGNDOutput = SIMP(statut = 'o', typ = bool, defaut = True),
180                         TestBusName = SIMP(statut = 'o', typ = bool, defaut = True),
181                         ReportSpaces = SIMP(statut = 'o', typ = bool, defaut = True),
182                         RepeatComponentAllLines = SIMP(statut = 'o', typ = bool, defaut = True),
183                         MultipleContingencyReport = SIMP(statut = 'o', typ = bool, defaut = True),
184                         WriteIndivExcels = SIMP(statut = 'o', typ = bool, defaut = True),
185                         WriteFlowDifs = SIMP(statut = 'o', typ = bool, defaut = True),
186                     )
187
188 DATA_PROCESSING = MACRO ( nom = 'DATA_PROCESSING',
189                         sd_prod = opsPSEN_N1.PROCESS,
190                         op_init = opsPSEN_N1.PROCESS_context,
191                         fichier_ini = 1,
192                         op = None,
193                         fr = "Sélectionnez les cas à analyser",
194                         ang = 'Select the cases to analyze',
195                         XLS_file = SIMP(statut="o", typ = ('Fichier', 'XLS file (*.xls);;All Files (*)',),),
196                         Onglets  = SIMP(statut = 'f', typ = 'TXM', min = 0, max = '**', homo = 'SansOrdreNiDoublon',into=(),),
197                         BusList  = SIMP(statut = 'f', typ = 'TXM', min = 0, max = '**', homo = 'SansOrdreNiDoublon',into=(),),
198                         ContList  = SIMP(statut = 'f', typ = 'TXM', min = 0, max = '**', homo = 'SansOrdreNiDoublon',into=(),),
199                       )