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
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_busbar ( sd_generateur,sd_charge ) : pass
37 def __init__(self,ntuple):
40 def __convert__(self,valeur):
41 if type(valeur) == types.StringType:
43 if len(valeur) != self.ntuple:
48 return "Tuple de %s elements" % self.ntuple
54 def __init__(self,nbLigs=None,nbCols=None,methodeCalculTaille=None,formatSortie="ligne",valSup=None,valMin=None,structure=None):
57 self.methodeCalculTaille=methodeCalculTaille
58 self.formatSortie=formatSortie
61 self.structure=structure
63 def __convert__(self,valeur):
64 # Attention ne verifie pas grand chose
65 if type(valeur) != types.ListType :
70 return "Matrice %s x %s" % (self.nbLigs, self.nbCols)
77 JdC = JDC_CATA ( code = 'PSEN',
79 regles = ( AU_MOINS_UN ( 'PARAMETRES_PSSE' ),
80 AU_MOINS_UN ( 'DIRECTORY' ),
81 AU_MOINS_UN ( 'DISTRIBUTION' ),
82 AU_MOINS_UN ( 'SIMULATION' ),
83 AU_PLUS_UN ( 'PARAMETRES_PSSE' ),
84 AU_PLUS_UN ( 'DIRECTORY' ),
85 AU_PLUS_UN ( 'SIMULATION' ),
86 AU_PLUS_UN ( 'CORRELATION' ),
91 # --------------------------------------------------
93 # --------------------------------------------------
95 MONGENER = OPER ( nom = "MONGENER",
96 sd_prod = sd_generateur,
97 UIinfo = {"groupes": ("CACHE")},
102 ID = SIMP ( statut = 'o', typ = "TXM", fr = "num bus", ang = "num bus",),
104 MACHARGE = OPER ( nom = "MACHARGE",
106 UIinfo = {"groupes": ("CACHE")},
111 ID = SIMP ( statut = 'o', typ = "TXM", fr = "num bus", ang = "num bus",),
113 MONBUSBAR = OPER ( nom = "MONBUSBAR",
115 UIinfo = {"groupes": ("CACHE")},
120 ID = SIMP ( statut = 'o', typ = "TXM", fr = "num bus", ang = "num bus",),
125 PARAMETRES_PSSE = PROC ( nom = "PARAMETRES_PSSE",
128 COUT_COMBUSTIBLE = SIMP ( statut = "o",
132 COUT_DELESTAGE = SIMP ( statut = "o",
136 COUT_MVAR = SIMP ( statut = "o",
140 IMAP = SIMP ( statut = "o",
142 into=['RateA','RateB','RateC'],
147 SIMULATION = PROC ( nom = "SIMULATION",
150 regles =(EXCLUS('NUMBER_PACKAGE','CONVERGENCE'),),
152 SIZE_PACKAGE = SIMP ( statut = "o",
157 NUMBER_PACKAGE = SIMP ( statut = "f",
161 CONVERGENCE = SIMP ( statut = "f",
166 STUDY = SIMP ( statut = "o",
168 into = ( 'N-1', 'Load', 'Wind-1', 'Wind-2', 'PV' ),
170 fr = "Affichage du niveau de wrapper de la bibliotheque Open TURNS",
171 ang = "Open TURNS library debug level print",
178 #================================
179 # Definition des LOIS
180 #================================
182 # Nota : les variables de type OPER doivent etre en majuscules !
183 # Nota : les variables de type OPER doivent etre de premier niveau (pas imbriquees dans un autre type)
184 DISTRIBUTION = OPER ( nom = "DISTRIBUTION",
187 fr = "Definitions des lois marginales utilisees par les variables d'entree",
190 # Choisir generateur ou charge
193 TypeMachine = SIMP ( statut='o', typ='TXM',
194 into = ('charge','vent1','vent2','pv','N-1',),
196 TypeComposant = SIMP (statut='o', typ='TXM',
197 into = ('Generateur','Charge'),),
198 b_gener = BLOC (condition = "TypeComposant == 'Generateur'",
199 #Generateur = SIMP(statut='o',typ=sd_generateur),),
200 Generateur = SIMP(statut='o',typ=sd_generateur,max="**", homo="SansOrdreNiDoublon"),),
201 b_charge = BLOC (condition = "TypeComposant == 'Charge'",
202 #charge = SIMP(statut='o',typ=sd_charge,max="**", homo="SansOrdreNiDoublon"),),
203 charge = SIMP(statut='o',typ=sd_charge),),
206 # Type de distribution
209 Kind = SIMP ( statut = "o", typ = "TXM",
210 into = ( "NonParametrique",
221 #"NonCentralStudent",
233 fr = "Choix du type de la loi marginale",
234 ang = "1D marginal distribution",
239 # Definition des parametres selon le type de la loi
242 NONPARAM = BLOC ( condition = " Kind in ( 'NonParametrique', ) ",
244 FileName = SIMP ( statut = "o",
245 typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
246 fr = "Nom du modele physique",
247 ang = "Physical model identifier",
251 # BETA = BLOC ( condition = " Kind in ( 'Beta', ) ",
253 # Settings = SIMP ( statut = "o",
256 # into = ( "RT", "MuSigma" ),
258 # fr = "Parametrage de la loi beta",
259 # ang = "Beta distribution parameter set",
262 # RT_Parameters = BLOC ( condition = " Settings in ( 'RT', ) ",
264 # R = SIMP ( statut = "o",
268 # fr = "Parametre R de la loi | R > 0",
269 # ang = "R parameter | R > 0",
273 # T = SIMP ( statut = "o",
277 # fr = "Parametre T de la loi | T > R",
278 # ang = "T parameter | T > R",
281 # ), # Fin BLOC RT_Parameters
284 # MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
286 # Mu = SIMP ( statut = "o",
289 # fr = "Moyenne de la loi",
290 # ang = "Mean value",
293 # Sigma = SIMP ( statut = "o",
297 # fr = "Ecart type de la loi",
298 # ang = "Standard deviation",
301 # ), # Fin BLOC MuSigma_Parameters
304 # A = SIMP ( statut = "o",
307 # fr = "Borne inferieure du support de la loi",
308 # ang = "Support lower bound",
312 # B = SIMP ( statut = "o",
315 # fr = "Borne superieure du support de la loi",
316 # ang = "Support upper bound",
323 EXPONENTIAL = BLOC ( condition = " Kind in ( 'Exponential', ) ",
325 Lambda = SIMP ( statut = "o",
329 fr = "Parametre Lambda | Lambda > 0",
330 ang = "Lambda parameter | Lambda > 0",
333 Gamma = SIMP ( statut = "o",
336 fr = "Borne inferieure du support de la loi",
337 ang = "Support lower bound",
340 ), # Fin BLOC EXPONENTIAL
344 # GAMMA = BLOC ( condition = " Kind in ( 'Gamma', ) ",
346 # Settings = SIMP ( statut = "o",
349 # into = ( "KLambda", "MuSigma" ),
350 # defaut = "KLambda",
351 # fr = "Parametrage de la loi gamma",
352 # ang = "Gamma distribution parameter set",
355 # KLambda_Parameters = BLOC ( condition = " Settings in ( 'KLambda', ) ",
357 # K = SIMP ( statut = "o",
361 # fr = "Parametre K de la loi | K > 0",
362 # ang = "K parameter | K > 0",
365 # Lambda = SIMP ( statut = "o",
369 # fr = "Parametre Lambda de la loi | Lambda > 0",
370 # ang = "Lambda parameter | Lambda > 0",
373 # ), # Fin BLOC KLambda_Parameters
376 # MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
378 # Mu = SIMP ( statut = "o",
381 # fr = "Moyenne de la loi",
382 # ang = "Mean value",
385 # Sigma = SIMP ( statut = "o",
389 # fr = "Ecart type de la loi",
390 # ang = "Standard deviation",
393 # ), # Fin BLOC MuSigma_Parameters
395 # Gamma = SIMP ( statut = "o",
398 # fr = "Borne inferieure du supoport de la loi",
399 # ang = "Support lower bound",
403 # ), # Fin BLOC GAMMA
407 # GEOMETRIC = BLOC ( condition = " Kind in ( 'Geometric', ) ",
409 # P = SIMP ( statut = "o",
414 # fr = "Parametre P | 0 < P < 1",
415 # ang = "P parameter | 0 < P < 1",
418 # ), # Fin BLOC GEOMETRIC
422 # GUMBEL = BLOC ( condition = " Kind in ( 'Gumbel', ) ",
424 # Settings = SIMP ( statut = "o",
427 # into = ( "AlphaBeta", "MuSigma" ),
428 # defaut = "AlphaBeta",
429 # fr = "Parametrage de la loi gumbel",
430 # ang = "Gumbel distribution parameter set",
433 # AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ",
435 # Alpha = SIMP ( statut = "o",
439 # fr = "Parametre Alpha de la loi | Alpha > 0",
440 # ang = "Alpha parameter | Alpha > 0",
443 # Beta = SIMP ( statut = "o",
446 # fr = "Parametre Beta de la loi",
447 # ang = "Beta parameter",
450 # ), # Fin BLOC AlphaBeta_Parameters
453 # MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
455 # Mu = SIMP ( statut = "o",
458 # fr = "Moyenne de la loi",
459 # ang = "Mean value",
462 # Sigma = SIMP ( statut = "o",
466 # fr = "Ecart type de la loi",
467 # ang = "Standard deviation",
470 # ), # Fin BLOC MuSigma_Parameters
472 # ), # Fin BLOC GUMBEL
476 HISTOGRAM = BLOC ( condition = " Kind in ( 'Histogram', ) ",
478 First = SIMP ( statut = "o",
481 fr = "Borne inferieure du supoport de la loi",
482 ang = "Support lower bound",
485 # Il faut definir une collection de couples ( x,p )
486 Values = SIMP ( statut = 'o',
489 fr = "Liste de couples : largeur de classe, hauteur de classe",
490 ang = "Class bandwidth, class height couple list",
491 validators=VerifTypeTuple(('R','R')),
494 ), # Fin BLOC HISTOGRAM
498 # LAPLACE = BLOC ( condition = " Kind in ( 'Laplace', ) ",
500 # Lambda = SIMP ( statut = "o",
504 # fr = "Parametre Lambda | Lambda > 0",
505 # ang = "Lambda parameter | Lambda > 0",
508 # Mu = SIMP ( statut = "o",
511 # fr = "Moyenne de la loi",
512 # ang = "Mean value",
515 # ), # Fin BLOC LAPLACE
517 # LOGNORMAL = BLOC ( condition = " Kind in ( 'LogNormal', ) ",
519 # Settings = SIMP ( statut = "o",
522 # into = ( "MuSigmaLog", "MuSigma", "MuSigmaOverMu" ),
523 # defaut = "MuSigmaLog",
524 # fr = "Parametrage de la loi lognormale",
525 # ang = "Lognormal distribution parameter set",
528 # MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
530 # Mu = SIMP ( statut = "o",
533 # fr = "Moyenne de la loi",
534 # ang = "Mean value",
537 # Sigma = SIMP ( statut = "o",
541 # fr = "Ecart type de la loi",
542 # ang = "Standard deviation",
545 # ), # Fin BLOC MuSigma_Parameters
547 # MuSigmaOverMu_Parameters = BLOC ( condition = " Settings in ( 'MuSigmaOverMu', ) ",
549 # Mu = SIMP ( statut = "o",
552 # fr = "Moyenne de la loi",
553 # ang = "Mean value",
556 # SigmaOverMu = SIMP ( statut = "o",
560 # fr = "Rapport ecart type / moyenne de la loi",
561 # ang = "Standard deviation / mean value ratio",
564 # ), # Fin BLOC MuSigmaOverMu_Parameters
566 # MuSigmaLog_Parameters = BLOC ( condition = " Settings in ( 'MuSigmaLog', ) ",
568 # MuLog = SIMP ( statut = "o",
571 # fr = "Moyenne du log",
572 # ang = "Log mean value",
575 # SigmaLog = SIMP ( statut = "o",
579 # fr = "Ecart type du log",
580 # ang = "Log standard deviation",
583 # ), # Fin BLOC MuSigmaLog_Parameters
585 # Gamma = SIMP ( statut = "o",
588 # fr = "Borne inferieure du support de la loi",
589 # ang = "Support lower bound",
592 # ), # Fin BLOC LOGNORMAL
596 # LOGISTIC = BLOC ( condition = " Kind in ( 'Logistic', ) ",
598 # Alpha = SIMP ( statut = "o",
601 # fr = "Borne inferieure du supoport de la loi",
602 # ang = "Support lower bound",
605 # Beta = SIMP ( statut = "o",
609 # fr = "Parametre Beta de la loi | Beta > 0",
610 # ang = "Beta parameter | Beta > 0",
613 # ), # Fin BLOC LOGISTIC
617 # MULTINOMIAL = BLOC ( condition = " Kind in ( 'MultiNomial', ) ",
619 # N = SIMP ( statut = "o",
622 # fr = "Parametre N de la loi | N > 0",
623 # ang = "N parameter | N > 0",
626 # # Il faut definir une collection de couples ( x,p )
627 # Values = SIMP ( statut = 'o',
630 # fr = "Liste de probabilités",
631 # ang = "Probability list",
632 # validators=VerifTypeTuple(('R','R')),
635 # ), # Fin BLOC MULTINOMIAL
638 # NONCENTRALSTUDENT = BLOC ( condition = " Kind in ( 'NonCentralStudent', ) ",
640 # Nu = SIMP ( statut = "o",
643 # fr = "Parametre Nu de la loi | Nu > 0",
644 # ang = "Nu parameter | Nu > 0",
647 # Delta = SIMP ( statut = "o",
650 # fr = "Parametre Delta de la loi | Delta > 0",
651 # ang = "Delta parameter | Delta > 0",
654 # Gamma = SIMP ( statut = "o",
657 # fr = "Parametre Gamma de centrage de la loi",
658 # ang = "Gamma parameter",
661 # ), # Fin BLOC NONCENTRALSTUDENT
664 NORMAL = BLOC ( condition = " Kind in ( 'Normal', ) ",
666 Mu = SIMP ( statut = "o",
669 fr = "Moyenne de la loi",
673 Sigma = SIMP ( statut = "o",
677 fr = "Ecart type de la loi",
678 ang = "Standard deviation",
685 # POISSON = BLOC ( condition = " Kind in ( 'Poisson', ) ",
687 # Lambda = SIMP ( statut = "o",
691 # fr = "Parametre Lambda de la loi | Lambda > 0",
692 # ang = "Lambda parameter | Lambda > 0",
695 # ), # Fin BLOC POISSON
699 # RAYLEIGH = BLOC ( condition = " Kind in ( 'Rayleigh', ) ",
701 # Sigma = SIMP ( statut = "o",
704 # fr = "Parametre Sigma de la loi | Sigma > 0",
705 # ang = "Sigma parameter | Sigma > 0",
708 # Gamma = SIMP ( statut = "o",
711 # fr = "Borne inferieure du support de la loi",
712 # ang = "Support lower bound",
714 # ), # Fin BLOC RAYLEIGH
716 PDF = BLOC ( condition = " Kind in ( 'PDF_from_file', ) ",
718 FileName = SIMP ( statut = "o",
719 typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
720 fr = "Nom du modele physique",
721 ang = "Physical model identifier",
725 # STUDENT = BLOC ( condition = " Kind in ( 'Student', ) ",
727 # Mu = SIMP ( statut = "o",
730 # fr = "Parametre Mu de la loi",
731 # ang = "Mu parameter",
734 # Nu = SIMP ( statut = "o",
738 # fr = "Parametre Nu de la loi | Nu > 2",
739 # ang = "Nu parameter | Nu > 2",
742 # Sigma = SIMP ( statut = "o",
745 # fr = "Parametre Sigma de la loi",
746 # ang = "Sigma parameter",
749 # ), # Fin BLOC STUDENT
753 # TRIANGULAR = BLOC ( condition = " Kind in ( 'Triangular', ) ",
755 # A = SIMP ( statut = "o",
758 # fr = "Borne inferieure du support de la loi | A < M < B",
759 # ang = "Support lower bound | A < M < B",
762 # M = SIMP ( statut = "o",
765 # fr = "Mode de la loi | A < M < B",
766 # ang = "Mode | A < M < B",
769 # B = SIMP ( statut = "o",
772 # fr = "Borne superieure du support de la loi | A < M < B",
773 # ang = "Support upper bound | A < M < B",
776 # ), # Fin BLOC TRIANGULAR
780 TRUNCATEDNORMAL = BLOC ( condition = " Kind in ( 'TruncatedNormal', ) ",
782 MuN = SIMP ( statut = "o",
785 fr = "Moyenne de la loi Normale non tronquée",
786 ang = "Mean value of the associated non truncated normal distribution",
789 SigmaN = SIMP ( statut = "o",
793 fr = "Ecart-type de la loi Normale non tronquée",
794 ang = "Standard deviation of the associated non truncated normal distribution",
797 A = SIMP ( statut = "o",
800 fr = "Borne inferieure de la loi | A < B",
801 ang = "Lower bound | A < B",
804 B = SIMP ( statut = "o",
807 fr = "Borne superieure de la loi | A < B",
808 ang = "Upper bound | A < B",
811 ), # Fin BLOC TRUNCATEDNORMAL
815 UNIFORM = BLOC ( condition = " Kind in ( 'Uniform', ) ",
817 A = SIMP ( statut = "o",
820 fr = "Borne inferieure du support de la loi | A < B",
821 ang = "Support lower bound | A < B",
824 B = SIMP ( statut = "o",
827 fr = "Borne superieure du support de la loi | A < B",
828 ang = "Support upper bound | A < B",
831 ), # Fin BLOC UNIFORM
835 USERDEFINED = BLOC ( condition = " Kind in ( 'UserDefined', ) ",
837 # Il faut definir une collection de couples ( x,p )
838 Fichier = SIMP ( statut = 'o',
839 typ =( 'Fichier', 'CSV (*.csv);;All Files (*)',),
843 ), # Fin BLOC USERDEFINED
847 WEIBULL = BLOC ( condition = " Kind in ( 'Weibull', ) ",
849 Settings = SIMP ( statut = "o",
852 into = ( "AlphaBeta", "MuSigma" ),
853 defaut = "AlphaBeta",
854 fr = "Parametrage de la loi weibull",
855 ang = "Weibull distribution parameter set",
858 AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ",
860 Alpha = SIMP ( statut = "o",
864 fr = "Parametre Alpha de la loi | Alpha > 0",
865 ang = "Alpha parameter | Alpha > 0",
868 Beta = SIMP ( statut = "o",
872 fr = "Parametre Beta de la loi | Beta > 0",
873 ang = "Beta parameter | Beta > 0",
876 ), # Fin BLOC AlphaBeta_Parameters
879 MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
881 Mu = SIMP ( statut = "o",
884 fr = "Moyenne de la loi",
888 Sigma = SIMP ( statut = "o",
892 fr = "Ecart type de la loi",
893 ang = "Standard deviation",
896 ), # Fin BLOC MuSigma_Parameters
898 Gamma = SIMP ( statut = "o",
901 fr = "Borne inferieure du support de la loi",
902 ang = "Support lower bound",
905 ), # Fin BLOC WEIBULL
911 #================================
912 # Definition du modele physique
913 #================================
917 CORRELATION = PROC ( nom = 'CORRELATION',
920 fr = "Correlation entre variables",
921 ang = "Variable correlation",
923 #### Copula = SIMP ( statut = "o",
925 #### into = ( "Independent", "Normal" ),
926 #### defaut = "Independent",
927 #### fr = "Type de la copule",
928 #### ang = "Copula kind",
931 ## # Matrix = BLOC ( condition = "Copula in ( 'Normal', )",
933 CorrelationMatrix = SIMP ( statut = "o",
934 typ = Matrice(nbLigs=None,
936 methodeCalculTaille='NbDeDistributions',
937 structure="symetrique"),
938 fr = "Matrice de correlation entre les variables d'entree",
939 ang = "Correlation matrix for input variables",
941 ## #), # Fin BLOC Matrix
946 DIRECTORY = MACRO ( nom = 'DIRECTORY',
948 fr = "Chargement des generateurs et des charges",
949 ang = "Physical model wrapper load",
950 sd_prod = opsPSEN.INCLUDE,
951 op_init = opsPSEN.INCLUDE_context,
955 fichier_sav=SIMP(statut="o", typ = ('Fichier', 'Wrapper Files (*.sav);;All Files (*)',),),
956 dossier_resultat=SIMP(statut="o",typ='Repertoire'),
957 fichier_lignes=SIMP(statut="o" ,typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),),
958 fichier_groupes=SIMP(statut="o", typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),),
959 fichier_parc=SIMP(statut="o" ,typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),),
960 chemin_psse=SIMP(statut="o",typ='Repertoire'),