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
28 class loi ( ASSD ) : pass
29 class variable ( ASSD ) : pass
33 def __init__(self,ntuple):
36 def __convert__(self,valeur):
37 if type(valeur) == types.StringType:
39 if len(valeur) != self.ntuple:
44 return "Tuple de %s elements" % self.ntuple
50 def __init__(self,nbLigs=None,nbCols=None,methodeCalculTaille=None,formatSortie="ligne",valSup=None,valMin=None,structure=None):
53 self.methodeCalculTaille=methodeCalculTaille
54 self.formatSortie=formatSortie
57 self.structure=structure
59 def __convert__(self,valeur):
60 # Attention ne verifie pas grand chose
61 if type(valeur) != types.ListType :
66 return "Matrice %s x %s" % (self.nbLigs, self.nbCols)
73 JdC = JDC_CATA ( code = 'OPENTURNS_STUDY',
75 ## regles = ( AU_MOINS_UN ( 'CRITERIA' ),
76 ## AU_MOINS_UN ( 'MODEL' ),
77 ## AVANT ( ('DISTRIBUTION', 'MODEL'), 'VARIABLE' ),
78 # A_CLASSER ( 'VARIABLE', 'CORRELATION' ),
79 # A_CLASSER ( 'VARIABLE', 'CRITERIA' ),
80 # A_CLASSER ( 'CORRELATION', 'CRITERIA' ),
85 # --------------------------------------------------
87 # --------------------------------------------------
89 SIMULATION = PROC ( nom = "SIMULATION",
93 SAMPLE = SIMP ( statut = "o",
99 STUDY = SIMP ( statut = "o",
101 into = ( 'N-1', 'Load', 'Wind-1', 'Wind-2', 'PV' ),
103 fr = "Affichage du niveau de wrapper de la bibliotheque Open TURNS",
104 ang = "Open TURNS library debug level print",
109 OPF_Parameters = PROC ( nom = "OPF_Parameters",
113 Minimize_fuel_cost = SIMP ( statut = "o",
115 into=('True','False'),
119 Minimize_adj_bus_shunt = SIMP ( statut = "o",
121 into=('True','False'),
123 fr="Choix minimize bus shunts"
125 Minimize_adj_bus_loads = SIMP ( statut = "o",
127 into=('True','False'),
129 fr="Choix minimize bus loads"
134 PSSe_Irate = PROC ( nom = "PSSe_Irate",
138 Rate_A = SIMP ( statut = "o",
140 into=('True','False'),
144 Rate_B = SIMP ( statut = "o",
146 into=('True','False'),
150 Rate_C = SIMP ( statut = "o",
152 into=('True','False'),
160 #================================
161 # Definition des LOIS
162 #================================
164 # Nota : les variables de type OPER doivent etre en majuscules !
165 # Nota : les variables de type OPER doivent etre de premier niveau (pas imbriquees dans un autre type)
166 DISTRIBUTION = OPER ( nom = "DISTRIBUTION",
169 fr = "Definitions des lois marginales utilisees par les variables d'entree",
173 # Type de distribution
175 Type_Model = SIMP ( statut='o', typ='TXM',
176 into = ('type_1','type_2','type_3','type_4',
180 Kind = SIMP ( statut = "o", typ = "TXM",
202 fr = "Choix du type de la loi marginale",
203 ang = "1D marginal distribution",
207 # Definition des parametres selon le type de la loi
210 BETA = BLOC ( condition = " Kind in ( 'Beta', ) ",
212 Settings = SIMP ( statut = "o",
215 into = ( "RT", "MuSigma" ),
217 fr = "Parametrage de la loi beta",
218 ang = "Beta distribution parameter set",
221 RT_Parameters = BLOC ( condition = " Settings in ( 'RT', ) ",
223 R = SIMP ( statut = "o",
227 fr = "Parametre R de la loi | R > 0",
228 ang = "R parameter | R > 0",
232 T = SIMP ( statut = "o",
236 fr = "Parametre T de la loi | T > R",
237 ang = "T parameter | T > R",
240 ), # Fin BLOC RT_Parameters
243 MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
245 Mu = SIMP ( statut = "o",
248 fr = "Moyenne de la loi",
252 Sigma = SIMP ( statut = "o",
256 fr = "Ecart type de la loi",
257 ang = "Standard deviation",
260 ), # Fin BLOC MuSigma_Parameters
263 A = SIMP ( statut = "o",
266 fr = "Borne inferieure du support de la loi",
267 ang = "Support lower bound",
271 B = SIMP ( statut = "o",
274 fr = "Borne superieure du support de la loi",
275 ang = "Support upper bound",
282 EXPONENTIAL = BLOC ( condition = " Kind in ( 'Exponential', ) ",
284 Lambda = SIMP ( statut = "o",
288 fr = "Parametre Lambda | Lambda > 0",
289 ang = "Lambda parameter | Lambda > 0",
292 Gamma = SIMP ( statut = "o",
295 fr = "Borne inferieure du support de la loi",
296 ang = "Support lower bound",
299 ), # Fin BLOC EXPONENTIAL
303 GAMMA = BLOC ( condition = " Kind in ( 'Gamma', ) ",
305 Settings = SIMP ( statut = "o",
308 into = ( "KLambda", "MuSigma" ),
310 fr = "Parametrage de la loi gamma",
311 ang = "Gamma distribution parameter set",
314 KLambda_Parameters = BLOC ( condition = " Settings in ( 'KLambda', ) ",
316 K = SIMP ( statut = "o",
320 fr = "Parametre K de la loi | K > 0",
321 ang = "K parameter | K > 0",
324 Lambda = SIMP ( statut = "o",
328 fr = "Parametre Lambda de la loi | Lambda > 0",
329 ang = "Lambda parameter | Lambda > 0",
332 ), # Fin BLOC KLambda_Parameters
335 MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
337 Mu = SIMP ( statut = "o",
340 fr = "Moyenne de la loi",
344 Sigma = SIMP ( statut = "o",
348 fr = "Ecart type de la loi",
349 ang = "Standard deviation",
352 ), # Fin BLOC MuSigma_Parameters
354 Gamma = SIMP ( statut = "o",
357 fr = "Borne inferieure du supoport de la loi",
358 ang = "Support lower bound",
366 GEOMETRIC = BLOC ( condition = " Kind in ( 'Geometric', ) ",
368 P = SIMP ( statut = "o",
373 fr = "Parametre P | 0 < P < 1",
374 ang = "P parameter | 0 < P < 1",
377 ), # Fin BLOC GEOMETRIC
381 GUMBEL = BLOC ( condition = " Kind in ( 'Gumbel', ) ",
383 Settings = SIMP ( statut = "o",
386 into = ( "AlphaBeta", "MuSigma" ),
387 defaut = "AlphaBeta",
388 fr = "Parametrage de la loi gumbel",
389 ang = "Gumbel distribution parameter set",
392 AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ",
394 Alpha = SIMP ( statut = "o",
398 fr = "Parametre Alpha de la loi | Alpha > 0",
399 ang = "Alpha parameter | Alpha > 0",
402 Beta = SIMP ( statut = "o",
405 fr = "Parametre Beta de la loi",
406 ang = "Beta parameter",
409 ), # Fin BLOC AlphaBeta_Parameters
412 MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
414 Mu = SIMP ( statut = "o",
417 fr = "Moyenne de la loi",
421 Sigma = SIMP ( statut = "o",
425 fr = "Ecart type de la loi",
426 ang = "Standard deviation",
429 ), # Fin BLOC MuSigma_Parameters
435 HISTOGRAM = BLOC ( condition = " Kind in ( 'Histogram', ) ",
437 First = SIMP ( statut = "o",
440 fr = "Borne inferieure du supoport de la loi",
441 ang = "Support lower bound",
444 # Il faut definir une collection de couples ( x,p )
445 Values = SIMP ( statut = 'o',
448 fr = "Liste de couples : largeur de classe, hauteur de classe",
449 ang = "Class bandwidth, class height couple list",
450 validators=VerifTypeTuple(('R','R')),
453 ), # Fin BLOC HISTOGRAM
457 LAPLACE = BLOC ( condition = " Kind in ( 'Laplace', ) ",
459 Lambda = SIMP ( statut = "o",
463 fr = "Parametre Lambda | Lambda > 0",
464 ang = "Lambda parameter | Lambda > 0",
467 Mu = SIMP ( statut = "o",
470 fr = "Moyenne de la loi",
474 ), # Fin BLOC LAPLACE
476 LOGNORMAL = BLOC ( condition = " Kind in ( 'LogNormal', ) ",
478 Settings = SIMP ( statut = "o",
481 into = ( "MuSigmaLog", "MuSigma", "MuSigmaOverMu" ),
482 defaut = "MuSigmaLog",
483 fr = "Parametrage de la loi lognormale",
484 ang = "Lognormal distribution parameter set",
487 MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
489 Mu = SIMP ( statut = "o",
492 fr = "Moyenne de la loi",
496 Sigma = SIMP ( statut = "o",
500 fr = "Ecart type de la loi",
501 ang = "Standard deviation",
504 ), # Fin BLOC MuSigma_Parameters
506 MuSigmaOverMu_Parameters = BLOC ( condition = " Settings in ( 'MuSigmaOverMu', ) ",
508 Mu = SIMP ( statut = "o",
511 fr = "Moyenne de la loi",
515 SigmaOverMu = SIMP ( statut = "o",
519 fr = "Rapport ecart type / moyenne de la loi",
520 ang = "Standard deviation / mean value ratio",
523 ), # Fin BLOC MuSigmaOverMu_Parameters
525 MuSigmaLog_Parameters = BLOC ( condition = " Settings in ( 'MuSigmaLog', ) ",
527 MuLog = SIMP ( statut = "o",
530 fr = "Moyenne du log",
531 ang = "Log mean value",
534 SigmaLog = SIMP ( statut = "o",
538 fr = "Ecart type du log",
539 ang = "Log standard deviation",
542 ), # Fin BLOC MuSigmaLog_Parameters
544 Gamma = SIMP ( statut = "o",
547 fr = "Borne inferieure du support de la loi",
548 ang = "Support lower bound",
551 ), # Fin BLOC LOGNORMAL
555 LOGISTIC = BLOC ( condition = " Kind in ( 'Logistic', ) ",
557 Alpha = SIMP ( statut = "o",
560 fr = "Borne inferieure du supoport de la loi",
561 ang = "Support lower bound",
564 Beta = SIMP ( statut = "o",
568 fr = "Parametre Beta de la loi | Beta > 0",
569 ang = "Beta parameter | Beta > 0",
572 ), # Fin BLOC LOGISTIC
576 MULTINOMIAL = BLOC ( condition = " Kind in ( 'MultiNomial', ) ",
578 N = SIMP ( statut = "o",
581 fr = "Parametre N de la loi | N > 0",
582 ang = "N parameter | N > 0",
585 # Il faut definir une collection de couples ( x,p )
586 Values = SIMP ( statut = 'o',
589 fr = "Liste de probabilités",
590 ang = "Probability list",
591 validators=VerifTypeTuple(('R','R')),
594 ), # Fin BLOC MULTINOMIAL
597 NONCENTRALSTUDENT = BLOC ( condition = " Kind in ( 'NonCentralStudent', ) ",
599 Nu = SIMP ( statut = "o",
602 fr = "Parametre Nu de la loi | Nu > 0",
603 ang = "Nu parameter | Nu > 0",
606 Delta = SIMP ( statut = "o",
609 fr = "Parametre Delta de la loi | Delta > 0",
610 ang = "Delta parameter | Delta > 0",
613 Gamma = SIMP ( statut = "o",
616 fr = "Parametre Gamma de centrage de la loi",
617 ang = "Gamma parameter",
620 ), # Fin BLOC NONCENTRALSTUDENT
623 NORMAL = BLOC ( condition = " Kind in ( 'Normal', ) ",
625 Mu = SIMP ( statut = "o",
628 fr = "Moyenne de la loi",
632 Sigma = SIMP ( statut = "o",
636 fr = "Ecart type de la loi",
637 ang = "Standard deviation",
644 POISSON = BLOC ( condition = " Kind in ( 'Poisson', ) ",
646 Lambda = SIMP ( statut = "o",
650 fr = "Parametre Lambda de la loi | Lambda > 0",
651 ang = "Lambda parameter | Lambda > 0",
654 ), # Fin BLOC POISSON
658 RAYLEIGH = BLOC ( condition = " Kind in ( 'Rayleigh', ) ",
660 Sigma = SIMP ( statut = "o",
663 fr = "Parametre Sigma de la loi | Sigma > 0",
664 ang = "Sigma parameter | Sigma > 0",
667 Gamma = SIMP ( statut = "o",
670 fr = "Borne inferieure du support de la loi",
671 ang = "Support lower bound",
673 ), # Fin BLOC RAYLEIGH
676 STUDENT = BLOC ( condition = " Kind in ( 'Student', ) ",
678 Mu = SIMP ( statut = "o",
681 fr = "Parametre Mu de la loi",
682 ang = "Mu parameter",
685 Nu = SIMP ( statut = "o",
689 fr = "Parametre Nu de la loi | Nu > 2",
690 ang = "Nu parameter | Nu > 2",
693 Sigma = SIMP ( statut = "o",
696 fr = "Parametre Sigma de la loi",
697 ang = "Sigma parameter",
700 ), # Fin BLOC STUDENT
704 TRIANGULAR = BLOC ( condition = " Kind in ( 'Triangular', ) ",
706 A = SIMP ( statut = "o",
709 fr = "Borne inferieure du support de la loi | A < M < B",
710 ang = "Support lower bound | A < M < B",
713 M = SIMP ( statut = "o",
716 fr = "Mode de la loi | A < M < B",
717 ang = "Mode | A < M < B",
720 B = SIMP ( statut = "o",
723 fr = "Borne superieure du support de la loi | A < M < B",
724 ang = "Support upper bound | A < M < B",
727 ), # Fin BLOC TRIANGULAR
731 TRUNCATEDNORMAL = BLOC ( condition = " Kind in ( 'TruncatedNormal', ) ",
733 MuN = SIMP ( statut = "o",
736 fr = "Moyenne de la loi Normale non tronquée",
737 ang = "Mean value of the associated non truncated normal distribution",
740 SigmaN = SIMP ( statut = "o",
744 fr = "Ecart-type de la loi Normale non tronquée",
745 ang = "Standard deviation of the associated non truncated normal distribution",
748 A = SIMP ( statut = "o",
751 fr = "Borne inferieure de la loi | A < B",
752 ang = "Lower bound | A < B",
755 B = SIMP ( statut = "o",
758 fr = "Borne superieure de la loi | A < B",
759 ang = "Upper bound | A < B",
762 ), # Fin BLOC TRUNCATEDNORMAL
766 UNIFORM = BLOC ( condition = " Kind in ( 'Uniform', ) ",
768 A = SIMP ( statut = "o",
771 fr = "Borne inferieure du support de la loi | A < B",
772 ang = "Support lower bound | A < B",
775 B = SIMP ( statut = "o",
778 fr = "Borne superieure du support de la loi | A < B",
779 ang = "Support upper bound | A < B",
782 ), # Fin BLOC UNIFORM
786 USERDEFINED = BLOC ( condition = " Kind in ( 'UserDefined', ) ",
788 # Il faut definir une collection de couples ( x,p )
789 Fichier = SIMP ( statut = 'o',
790 typ =( 'Fichier', 'CSV (*.csv);;All Files (*)',),
794 ), # Fin BLOC USERDEFINED
798 WEIBULL = BLOC ( condition = " Kind in ( 'Weibull', ) ",
800 Settings = SIMP ( statut = "o",
803 into = ( "AlphaBeta", "MuSigma" ),
804 defaut = "AlphaBeta",
805 fr = "Parametrage de la loi weibull",
806 ang = "Weibull distribution parameter set",
809 AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ",
811 Alpha = SIMP ( statut = "o",
815 fr = "Parametre Alpha de la loi | Alpha > 0",
816 ang = "Alpha parameter | Alpha > 0",
819 Beta = SIMP ( statut = "o",
823 fr = "Parametre Beta de la loi | Beta > 0",
824 ang = "Beta parameter | Beta > 0",
827 ), # Fin BLOC AlphaBeta_Parameters
830 MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
832 Mu = SIMP ( statut = "o",
835 fr = "Moyenne de la loi",
839 Sigma = SIMP ( statut = "o",
843 fr = "Ecart type de la loi",
844 ang = "Standard deviation",
847 ), # Fin BLOC MuSigma_Parameters
849 Gamma = SIMP ( statut = "o",
852 fr = "Borne inferieure du support de la loi",
853 ang = "Support lower bound",
856 ), # Fin BLOC WEIBULL
862 #================================
863 # Definition du modele physique
864 #================================
868 CORRELATION = PROC ( nom = 'CORRELATION',
871 fr = "Correlation entre variables",
872 ang = "Variable correlation",
874 #### Copula = SIMP ( statut = "o",
876 #### into = ( "Independent", "Normal" ),
877 #### defaut = "Independent",
878 #### fr = "Type de la copule",
879 #### ang = "Copula kind",
882 ## # Matrix = BLOC ( condition = "Copula in ( 'Normal', )",
884 CorrelationMatrix = SIMP ( statut = "o",
885 typ = Matrice(nbLigs=None,
887 methodeCalculTaille='NbDeDistributions',
888 structure="symetrique"),
889 fr = "Matrice de correlation entre les variables d'entree",
890 ang = "Correlation matrix for input variables",
892 ## #), # Fin BLOC Matrix