]> SALOME platform Git repositories - tools/eficas.git/commitdiff
Salome HOME
changement du nom du sous module dans la base principale
authorMUNET Claire <claire.munet@edf.fr>
Tue, 23 Oct 2018 15:41:05 +0000 (17:41 +0200)
committerMUNET Claire <claire.munet@edf.fr>
Tue, 23 Oct 2018 15:41:05 +0000 (17:41 +0200)
17 files changed:
PSSE_PF_Eficas/ExtractGeneratorLoadLineandTransfoDico.py [new file with mode: 0644]
PSSE_PF_Eficas/PSEN [new submodule]
PSSE_PF_Eficas/PSEN_Cata.py [new file with mode: 0644]
PSSE_PF_Eficas/PSEN_Cata_PF.py [new file with mode: 0644]
PSSE_PF_Eficas/__init__.py [new file with mode: 0644]
PSSE_PF_Eficas/com.py [new file with mode: 0644]
PSSE_PF_Eficas/configuration_PSEN.py [new file with mode: 0644]
PSSE_PF_Eficas/debugPFWrapper.py [new file with mode: 0644]
PSSE_PF_Eficas/mesScripts.py [new file with mode: 0644]
PSSE_PF_Eficas/opsPSEN.py [new file with mode: 0644]
PSSE_PF_Eficas/opsPSEN_PF.py [new file with mode: 0644]
PSSE_PF_Eficas/prefs.py [new file with mode: 0644]
PSSE_PF_Eficas/prefs_PSEN.py [new file with mode: 0644]
PSSE_PF_Eficas/properties.py [new file with mode: 0644]
PSSE_PF_Eficas/qtEficas_PSEN.py [new file with mode: 0644]
PSSE_PF_Eficas/temp.txt [new file with mode: 0644]
PSSE_PF_Eficas/usrCmdPF.py [new file with mode: 0644]

diff --git a/PSSE_PF_Eficas/ExtractGeneratorLoadLineandTransfoDico.py b/PSSE_PF_Eficas/ExtractGeneratorLoadLineandTransfoDico.py
new file mode 100644 (file)
index 0000000..438b08f
--- /dev/null
@@ -0,0 +1,391 @@
+
+############################################################
+# ojectif de ce module: extraire des donnes pour afficher dans l'interface Eficas
+############################################################
+NoBreakersandSwitches = True
+
+
+def ExtractGeneratorLoadLineandTransfoDico(NetworkFile,PSSE_PATH, PSSPY_PATH):
+
+    import os
+    import sys
+    import numpy as np
+
+    #print NetworkFile
+    #print PSSE_PATH
+    #psspy_path34 = os.path.join("../", PSSE_PATH, "PSSPY27")
+    sys.path.append(PSSPY_PATH)
+    os.environ['PATH'] +=  ';' + PSSE_PATH + ';'
+
+    import psspy
+    import redirect
+
+    ###initialization PSSE
+    psspy.psseinit(10000)
+    _i=psspy.getdefaultint()
+    _f=psspy.getdefaultreal()
+    _s=psspy.getdefaultchar()
+    redirect.psse2py()
+
+    # Silent execution of PSSe
+    islct=6 # 6=no output; 1=standard
+    psspy.progress_output(islct)
+
+    #open Network File
+    psspy.case(NetworkFile)
+
+    #Extract Loads
+    sid = -1 #all buses
+    flag = 1 #all in service loads/generators (4 all loads/generators)
+
+
+    string = ['NUMBER']
+    ierr,iarray = psspy.aloadint(sid,flag,string)
+
+    string = ['NAME','ID','EXNAME']
+    ierr,carray = psspy.aloadchar(sid,flag,string)
+
+    string = ['mvaact']
+    ierr, xdata = psspy.aloadcplx(sid, flag, string)
+
+    LoadDico = {}  # [Bus name, load ID, extended bus name, bus number]
+    for i in range(len(iarray[0])):
+        idname = "Lo" + carray[1][i].strip()
+#        try: #id is an integer
+#            idname = "Lo" + str(int(carray[1][i]))
+#        except: #id is not an integer
+#            idname = "Lo" + carray[1][i]
+        loadname = carray[0][i].strip()+ "__" + idname
+        loadname = loadname.replace(" ","_")
+        loadname = loadname.replace("-","_")
+        loadname = loadname.replace(".","_")
+        loadname = loadname.replace("&","and")
+        loadname = loadname.replace("%","pct")
+        loadname = loadname.replace("=","eq")
+        loadname = loadname.replace("#","_")
+        loadname = loadname.replace("$","_")
+        loadname = loadname.replace("/","_")
+        loadname = loadname.replace("\\","_")
+        try:
+            int(loadname[0])
+            loadname="_" + loadname
+        except:
+            pass
+        LoadDico[loadname]= {}
+        LoadDico[loadname]['NAME'] = carray[0][i].strip()
+        LoadDico[loadname]['ID'] = carray[1][i]
+        LoadDico[loadname]['EXNAME'] =carray[2][i]
+        LoadDico[loadname]['NUMBER']=iarray[0][i]
+        LoadDico[loadname]['P']=np.real(xdata)[0][i]
+        LoadDico[loadname]['Q']=np.imag(xdata)[0][i]
+
+    #Extract Generators
+    sid = -1 #all buses
+    flag = 1 #all in service loads/generators (4 all loads/generators)
+
+    string = ['NUMBER']
+    ierr,iarray = psspy.amachint(sid,flag,string)
+
+    string = ['NAME','ID','EXNAME']
+    ierr,carray = psspy.amachchar(sid,flag,string)
+
+    rstrings = ['pgen','qgen','mbase','pmax','qmax','pmin','qmin']
+    ierr, rarray = psspy.amachreal(sid, flag, rstrings)
+
+    MachineDico = {} # [Bus name, machine ID, extended bus name, bus number]
+    for i in range(len(iarray[0])):
+        idname = "Gr" + carray[1][i].strip()
+##        try:
+##            idname = "Gr" + str(int(carray[1][i]))
+##        except:
+##            idname = "Gr" + carray[1][i]
+        machinename = carray[0][i].strip()+ "__" + idname
+        machinename = machinename.replace(" ","_")
+        machinename = machinename.replace("-","_")
+        machinename = machinename.replace(".","_")
+        machinename = machinename.replace("&","and")
+        machinename = machinename.replace("%","pct")
+        machinename = machinename.replace("=","eq")
+        machinename = machinename.replace("#","_")
+        machinename = machinename.replace("$","_")
+        machinename = machinename.replace("/","_")
+        machinename = machinename.replace("\\","_")            
+        try:
+            int(machinename[0])
+            machinename="_" + machinename
+        except:
+            pass
+        MachineDico[machinename]={}
+        MachineDico[machinename]['NAME'] = carray[0][i].strip()
+        MachineDico[machinename]['ID'] = carray[1][i]
+        MachineDico[machinename]['EXNAME'] =carray[2][i]
+        MachineDico[machinename]['NUMBER']=iarray[0][i]
+        MachineDico[machinename]['P']=rarray[0][i]
+        MachineDico[machinename]['Q']=rarray[1][i]
+        MachineDico[machinename]['PMAX']=rarray[3][i]
+        MachineDico[machinename]['QMAX']=rarray[4][i]
+        MachineDico[machinename]['PMIN']=rarray[5][i]
+        MachineDico[machinename]['QMIN']=rarray[6][i]
+
+    #Extract Motors
+    sid = -1 #all buses
+    flag = 1 #all in service loads/generators (4 all loads/generators)
+
+    string = ['NUMBER','PSETCODE','BASECODE']
+    ierr,iarray = psspy.aindmacint(sid,flag,string)
+
+    string = ['NAME','ID','EXNAME']
+    ierr,carray = psspy.aindmacchar(sid,flag,string)
+
+    rstrings = ['psetpoint','mbase','p','q']
+    ierr, rarray = psspy.aindmacreal(sid, flag, rstrings)
+
+
+    MotorDico = {} # [Bus name, machine ID, extended bus name, bus number]
+    for i in range(len(iarray[0])):
+        idname = "Mo" + carray[1][i].strip()
+##        try:
+##            idname = "Gr" + str(int(carray[1][i]))
+##        except:
+##            idname = "Gr" + carray[1][i]
+        motorname = carray[0][i].strip()+ "__" + idname
+        motorname = motorname.replace(" ","_")
+        motorname = motorname.replace("-","_")
+        motorname = motorname.replace(".","_")
+        motorname = motorname.replace("&","and")
+        motorname = motorname.replace("%","pct")
+        motorname = motorname.replace("=","eq")
+        motorname = motorname.replace("#","_")
+        motorname = motorname.replace("$","_")
+        motorname = motorname.replace("/","_")
+        motorname = motorname.replace("\\","_")
+        
+        try:
+            int(motorname[0])
+            motorname="_" + motorname
+        except:
+            pass
+        MotorDico[motorname]={}
+        MotorDico[motorname]['NAME'] = carray[0][i].strip()
+        MotorDico[motorname]['ID'] = carray[1][i]
+        MotorDico[motorname]['EXNAME'] =carray[2][i]
+        MotorDico[motorname]['NUMBER']=iarray[0][i]
+        MotorDico[motorname]['PSETCODE']=iarray[1][i]
+        MotorDico[motorname]['BASECODE']=iarray[2][i]
+        MotorDico[motorname]['PSETPOINT']=rarray[0][i]
+        MotorDico[motorname]['MBASE']=rarray[1][i]
+        MotorDico[motorname]['P']=rarray[2][i]
+        MotorDico[motorname]['Q']=rarray[3][i]
+
+
+    #Extract Lignes
+    sid = -1
+    owner = 1
+    ties = 1
+    flag = 2 #6 for two-winding transfos
+    entry = 1 #each branch once, not both directions
+    string = ['FROMNUMBER','TONUMBER']
+    ierr,iarray = psspy.abrnint(sid,owner,ties,flag,entry,string)
+    string = ['FROMNAME','TONAME','FROMEXNAME','TOEXNAME','ID']
+    ierr,carray = psspy.abrnchar(sid,owner,ties,flag,entry,string)
+
+    LineDico = {} #[linename, Bus name 1, Bus name 2, ID, extended bus name 1, extended bus name 2, bus number 1, bus number 2]
+    for i in range(len(iarray[0])):
+        idname = carray[4][i].strip()
+        #idname = carray[4][i]
+        if '@' in idname:
+            idname = idname.replace('@','Br')
+        elif '*' in idname:
+            idname = idname.replace('*','Sw')
+        else:
+            try:
+                idname = 'Li' + str(int(idname))
+            except:
+                idname = 'Li' + idname
+        linename =carray[0][i].strip() + "__" + carray[1][i].strip() + "__" + idname
+        linename = linename.replace(" ","_")
+        linename = linename.replace("-","_")
+        linename = linename.replace(".","_")
+        linename = linename.replace("&","and")
+        linename = linename.replace("%","pct")
+        linename = linename.replace("=","eq")
+        linename = linename.replace("#","_")
+        linename = linename.replace("$","_")
+        linename = linename.replace("/","_")
+        linename = linename.replace("\\","_")
+        try:
+            int(linename[0])
+            linename="_" + linename
+        except:
+            pass
+        if NoBreakersandSwitches:
+            if 'Br' not in idname and 'Sw' not in idname:
+                LineDico[linename]={}
+                LineDico[linename]['FROMNAME']=carray[0][i].strip()
+                LineDico[linename]['TONAME']=carray[1][i].strip()
+                LineDico[linename]['ID']=carray[4][i]
+                LineDico[linename]['FROMEXNAME']=carray[2][i]
+                LineDico[linename]['TOEXNAME']=carray[3][i]
+                LineDico[linename]['FROMNUMBER']=iarray[0][i]
+                LineDico[linename]['TONUMBER']=iarray[1][i]
+
+
+    print "Read lines"
+    
+    #Extract Transfos
+    sid = -1
+    owner = 1
+    ties = 1
+    flag = 6 #two-winding transfos
+    entry = 1 #each branch once, not both directions
+    string = ['FROMNUMBER','TONUMBER']
+    ierr,iarray = psspy.abrnint(sid,owner,ties,flag,entry,string)
+    string = ['FROMNAME','TONAME','FROMEXNAME','TOEXNAME','ID']
+    ierr,carray = psspy.abrnchar(sid,owner,ties,flag,entry,string)
+
+    TfoDico = {} #[linename, Bus name 1, Bus name 2, machine ID, extended bus name 1, extended bus name 2, bus number 1, bus number 2]
+    for i in range(len(iarray[0])):
+        idname = 'Tr' + carray[4][i].strip()
+##        try:
+##            idname = 'Tr' + str(int(carray[4][i]))
+##        except:
+##            idname = 'Tr' + carray[4][i]
+        tfoname = carray[0][i].strip() + "__" + carray[1][i].strip() + "__" + idname
+        tfoname = tfoname.replace(" ","_")
+        tfoname = tfoname.replace("-","_")
+        tfoname = tfoname.replace(".","_")
+        tfoname = tfoname.replace("&","and")
+        tfoname = tfoname.replace("%","pct")
+        tfoname = tfoname.replace("=","eq")
+        tfoname = tfoname.replace("#","_")
+        tfoname = tfoname.replace("$","_")
+        tfoname = tfoname.replace("/","_")
+        tfoname = tfoname.replace("\\","_")
+        try:
+            int(tfoname[0])
+            tfoname="_" + tfoname
+        except:
+            pass
+        TfoDico[tfoname]={}
+        TfoDico[tfoname]['FROMNAME']=carray[0][i].strip()
+        TfoDico[tfoname]['TONAME']=carray[1][i].strip()
+        TfoDico[tfoname]['ID']=carray[4][i]
+        TfoDico[tfoname]['FROMEXNAME']=carray[2][i]
+        TfoDico[tfoname]['TOEXNAME']=carray[3][i]
+        TfoDico[tfoname]['FROMNUMBER']=iarray[0][i]
+        TfoDico[tfoname]['TONUMBER']=iarray[1][i]
+        TfoDico[tfoname]['#WIND']=2
+    print "Read Transfos"
+
+    #Extract 3 winding Transfos
+    sid = -1 #assume a subsystem containing all buses in working case
+    owner_3flow = 1 #1 = use bus ownership 2 = use tfo ownership
+    ties_3flow = 3 #ignored bc sid is negative. 3 = interior subsystem and subsystem tie 3 winding transformers 
+    flag=3 #all 3 winding transfo windings
+    string = ['wind1number','wind2number','wind3number']
+    ierr,iarray = psspy.awndint(sid,owner,ties,flag,entry,string)
+    string = ['wind1name','wind2name','wind3name','wind1exname','wind2exname','wind3exname','id']
+    ierr,carray = psspy.awndchar(sid,owner,ties,flag,entry,string)
+
+    #[Bus name 1, Bus name 2, Bus name 3, machine ID, extended bus name 1, extended bus name 2, extended bus name 3, bus number 1, bus number 2, bus number 3]
+    for i in range(len(iarray[0])):
+        idname = 'Tr' + carray[6][i].strip()
+##        try:
+##            idname = 'Tr' + str(int(carray[4][i]))
+##        except:
+##            idname = 'Tr' + carray[4][i]
+        tfoname = carray[0][i].strip() + "__" + carray[1][i].strip() + "__" + carray[2][i].strip() + "__" + idname
+        tfoname = tfoname.replace(" ","_")
+        tfoname = tfoname.replace("-","_")
+        tfoname = tfoname.replace(".","_")
+        tfoname = tfoname.replace("&","and")
+        tfoname = tfoname.replace("%","pct")
+        tfoname = tfoname.replace("=","eq")
+        tfoname = tfoname.replace("#","_")
+        tfoname = tfoname.replace("$","_")
+        tfoname = tfoname.replace("/","_")
+        tfoname = tfoname.replace("\\","_")
+        try:
+            int(tfoname[0])
+            tfoname="_" + tfoname
+        except:
+            pass
+        TfoDico[tfoname]={}
+        TfoDico[tfoname]['FROMNAME']=carray[0][i].strip()
+        TfoDico[tfoname]['TONAME']=carray[1][i].strip()
+        TfoDico[tfoname]['3NAME']=carray[2][i].strip()
+        TfoDico[tfoname]['ID']=carray[6][i]
+        TfoDico[tfoname]['FROMEXNAME']=carray[3][i]
+        TfoDico[tfoname]['TOEXNAME']=carray[4][i]
+        TfoDico[tfoname]['3EXNAME']=carray[5][i]
+        TfoDico[tfoname]['FROMNUMBER']=iarray[0][i]
+        TfoDico[tfoname]['TONUMBER']=iarray[1][i]
+        TfoDico[tfoname]['3NUMBER']=iarray[2][i]
+        TfoDico[tfoname]['#WIND']=3
+    print "Read 3-Winding Transfos"
+    # path1 = os.getcwd()
+    # import json
+    # path_temp=os.path.dirname(NetworkFile)
+    # # filew = open(path_temp+'/temp.txt', 'w')
+    # json.dump(MachineDico, open("toto.txt", 'w'))
+    # # filew.write(MachineDico)
+    # # filew.close()
+    filew = open('temp.txt', 'w')
+    filew.write(NetworkFile + '\n')
+    filew.write(PSSE_PATH + '\n')
+    filew.close()
+
+    return MachineDico, LoadDico, LineDico, TfoDico, MotorDico
+
+
+def PFExtractGeneratorLoadLineandTransfoDico(NetworkFile, PF_PATH,Python3_path):
+    # PSEN sous PowerFactory Lecture les donnees de Generateur,Load,Line,Transfo
+    import os,pickle
+    import sys, subprocess
+    import numpy as np
+    path1=os.getcwd()
+    # path_temp=os.path.dirname(NetworkFile)
+    filew=open('temp.txt','w')
+    filew.write(NetworkFile+'\n')
+    filew.write(PF_PATH + '\n')
+    filew.write(Python3_path + '\n')
+    filew.close()
+    print('changer le chemin de Python3 executable')
+    lancer = [Python3_path+'/python.exe', path1+'/com.py']# changer le chemin de Python3 executable
+    proc = subprocess.Popen(lancer)
+    proc.wait()
+    with open('Data_for_interface', 'rb') as fichier:
+       mon_depickler = pickle.Unpickler(fichier)
+       data_file = mon_depickler.load()
+
+    import collections
+    def convert(data):
+        if isinstance(data, basestring):
+            return str(data)
+        elif isinstance(data, collections.Mapping):
+            return dict(map(convert, data.iteritems()))
+        elif isinstance(data, collections.Iterable):
+            return type(data)(map(convert, data))
+        else:
+            return data
+    data=convert(data_file)
+    MachineDico=data['MachineDico']
+    LoadDico = data['LoadDico']
+    LineDico = data['LineDico']
+    TfoDico = data['TransfoDico']
+    MotorDico = data['MotorDico']
+    os.remove('Data_for_interface')
+
+    
+    return MachineDico, LoadDico, LineDico, TfoDico, MotorDico
+
+
+#NetworkFile=r"C:\Users\j15773\Documents\Projects\DEWA\Task 4\FEWA_GCCIA_SUMMAX2018_OPF_EQ2.sav"
+
+#PSSE_PATH=r"C:\Program Files (x86)\PTI\PSSE34\PSSBIN"
+#PSSPY_PATH=r"C:\Program Files (x86)\PTI\PSSE34\PSSPY27"
+
+#PSSE_PATH=r"C:\Program Files (x86)\PTI\PSSE33\PSSBIN"
+#PSSPY_PATH=r"C:\Program Files (x86)\PTI\PSSE33\PSSBIN"
+
+#MachineDico, LoadDico, LineDico, TfoDico, MotorDico = ExtractGeneratorLoadLineandTransfoDico(NetworkFile,PSSE_PATH,PSSPY_PATH)
diff --git a/PSSE_PF_Eficas/PSEN b/PSSE_PF_Eficas/PSEN
new file mode 160000 (submodule)
index 0000000..661f9cd
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 661f9cdeb9fd990499c7175cda68c99f5c4ae51e
diff --git a/PSSE_PF_Eficas/PSEN_Cata.py b/PSSE_PF_Eficas/PSEN_Cata.py
new file mode 100644 (file)
index 0000000..edee53a
--- /dev/null
@@ -0,0 +1,2788 @@
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2013   EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+# --------------------------------------------------
+# debut entete
+# --------------------------------------------------
+
+#from Accas import ASSD, JDC_CATA, AU_MOINS_UN, PROC, SIMP, FACT, OPER, MACRO, BLOC, A_VALIDATOR
+from Accas import *
+import opsPSEN
+
+class loi      ( ASSD ) : pass
+class variable ( ASSD ) : pass
+class sd_charge     ( ASSD ) : pass
+class sd_generateur ( ASSD ) : pass
+class sd_ligne     ( ASSD ) : pass
+class sd_transfo ( ASSD ) : pass
+class sd_moteur (ASSD) : pass
+#class sd_busbar ( sd_generateur,sd_charge ) : pass
+
+import types
+class Tuple:
+  def __init__(self,ntuple):
+    self.ntuple=ntuple
+
+  def __convert__(self,valeur):
+    if type(valeur) == types.StringType:
+      return None
+    if len(valeur) != self.ntuple:
+      return None
+    return valeur
+
+  def info(self):
+    return "Tuple de %s elements" % self.ntuple
+
+  __repr__=info
+  __str__=info
+
+class Matrice:
+  def __init__(self,nbLigs=None,nbCols=None,methodeCalculTaille=None,formatSortie="ligne",valSup=None,valMin=None,structure=None):
+      self.nbLigs=nbLigs
+      self.nbCols=nbCols
+      self.methodeCalculTaille=methodeCalculTaille
+      self.formatSortie=formatSortie
+      self.valSup=valSup
+      self.valMin=valMin
+      self.structure=structure
+
+  def __convert__(self,valeur):
+    # Attention ne verifie pas grand chose
+    if type(valeur) != types.ListType :
+      return None
+    return valeur
+
+  def info(self):
+      return "Matrice %s x %s" % (self.nbLigs, self.nbCols)
+
+      __repr__=info
+      __str__=info
+
+
+#CONTEXT.debug = 1
+JdC = JDC_CATA ( code = 'PSEN',
+                 execmodul = None,
+                 regles = ( AU_MOINS_UN ( 'PSSE_PARAMETERS' ),
+                            AU_MOINS_UN ( 'DIRECTORY' ),
+                            AU_MOINS_UN ( 'DISTRIBUTION' ),
+                            AU_MOINS_UN ( 'SIMULATION' ),
+                            AU_PLUS_UN ( 'PSSE_PARAMETERS' ),
+                            AU_PLUS_UN ( 'DIRECTORY' ),
+                            AU_PLUS_UN ( 'SIMULATION' ),
+                            AU_PLUS_UN ( 'CORRELATION' ),
+                            AU_PLUS_UN ( 'N_1_GENERATORS' ),
+                            AU_PLUS_UN ( 'N_1_LINES' ),
+                            AU_PLUS_UN ( 'N_1_LOADS' ),
+                            AU_PLUS_UN ( 'N_1_MOTORS' ),
+                            AU_PLUS_UN ( 'N_1_TRANSFORMERS' ),
+
+                            ),
+                 ) # Fin JDC_CATA
+
+
+# --------------------------------------------------
+# fin entete
+# --------------------------------------------------
+
+MONGENER =  OPER ( nom = "MONGENER",
+            sd_prod = sd_generateur,
+            UIinfo = {"groupes": ("CACHE")},
+            op = None,
+            fr = "Generateur",
+            ang = "Generator",
+
+  ID = SIMP ( statut = 'o', typ = "TXM", fr = "num bus", ang = "num bus",),
+)
+MONMOTEUR =  OPER ( nom = "MONMOTEUR",
+            sd_prod = sd_moteur,
+            UIinfo = {"groupes": ("CACHE")},
+            op = None,
+            fr = "Moteur",
+            ang = "Motor",
+
+  ID = SIMP ( statut = 'o', typ = "TXM", fr = "num bus", ang = "num bus",),
+)
+MACHARGE =  OPER ( nom = "MACHARGE",
+            sd_prod = sd_charge,
+            UIinfo = {"groupes": ("CACHE")},
+            op = None,
+            fr = "Charge",
+            ang = "Load",
+
+  ID = SIMP ( statut = 'o', typ = "TXM", fr = "nom charge", ang = "load name",),
+)
+MALIGNE =  OPER ( nom = "MALIGNE",
+            sd_prod = sd_ligne,
+            UIinfo = {"groupes": ("CACHE")},
+            op = None,
+            fr = "Ligne",
+            ang = "Line",
+
+  ID = SIMP ( statut = 'o', typ = "TXM", fr = "nom ligne", ang = "line name",),
+)
+MONTRANSFO =  OPER ( nom = "MONTRANSFO",
+            sd_prod = sd_transfo,
+            UIinfo = {"groupes": ("CACHE")},
+            op = None,
+            fr = "Transformateur",
+            ang = "Transformer",
+
+  ID = SIMP ( statut = 'o', typ = "TXM", fr = "nom transformateur", ang = "transformer name",),
+)
+
+
+
+PSSE_PARAMETERS = PROC ( nom = "PSSE_PARAMETERS",
+             op=None,
+             docu = "",
+  ALGORITHM = SIMP ( statut = "o",
+                     typ='TXM',
+                     into=["Optimum Power Flow","Economic Dispatch and Power Flow"],
+                     defaut="Optimum Power Flow",
+                    ),
+  I_MAX = SIMP ( statut = "o",
+                     typ='TXM',
+                     into=['RateA','RateB','RateC'],
+                     defaut='RateA',
+                    ),
+  LOCK_TAPS = SIMP ( statut = "o",
+                     typ=bool,
+                     defaut=True,
+                     ),
+
+  b_OPF = BLOC (condition = "ALGORITHM == 'Optimum Power Flow'",
+  FUEL_COST = SIMP ( statut = "o",
+                     typ=bool,
+                     defaut=True,
+                     ),
+  LOADSHEDDING_COST = SIMP ( statut = "o",
+                     typ=bool,
+                     defaut=False,
+                     ),
+  MVAR_COST = SIMP ( statut = "o",
+                     typ=bool,
+                     defaut=False,
+                    ),
+  ITERATION_LIMIT = SIMP ( statut = "o",
+                 typ = "I",
+                 val_min=1,
+                 defaut=20,
+                 ),
+  UNIT_COMMITMENT = SIMP ( statut = "o",
+                        typ = bool,
+                        defaut = True,
+                        fr = "Premiere passe de l'OPF pour determiner quels groupes doivent être connectes. Deconnecter les autres.",
+                        ang = "First OPF to determine which units should be run; others are disconnected.",
+                        ),
+  b_UnitCommitment = BLOC (condition = "UNIT_COMMITMENT == True",
+  SAVE_CASE_BEFORE_UNIT_COMMITMENT = SIMP ( statut = "o",
+                        typ = bool,
+                        defaut = False,
+                        fr = "Sauvegarder des fichiers de cas avant d'avoir deconnecte les groupes ne produisant pas de la puissance active",
+                        ang = "Save network case files before having disconnected groups that dont generate active power.",
+                        ),
+
+    SpinningReserveCorrection = FACT(statut='f', max="**",                           
+                                           
+      SpinningReserveID = SIMP ( statut = "o",
+                     typ = "I",
+                     val_min = 1,
+                     val_max = 15,
+                     defaut=1,
+                     fr = "Numero de réserve comme definie dans PSS/E correspondant à une réserve tournante",
+                     ang= "Period reserve constraint identifier numer as defined in PSS/E, corresponding to an online (spinning) reserve." 
+                     ),
+    ),
+                                
+  ),
+  DECIMAL_SEPARATOR = SIMP(statut="o",typ='TXM',into=[',','.'],defaut='.',),
+  ),
+
+  b_ECD = BLOC (condition = "ALGORITHM == 'Economic Dispatch and Power Flow'",
+  ecd_file=SIMP(statut="o", typ = ('Fichier', 'Economic Dispatch Files (*.ecd);;All Files (*)',),),
+  ),
+
+##  P_MIN= SIMP ( statut = "o",
+##                     typ=bool,
+##                     defaut=True,
+##                     ),
+)
+
+SIMULATION = PROC ( nom = "SIMULATION",
+             op = None,
+             docu = "",
+  regles             =(EXCLUS('NUMBER_PACKAGE','CONVERGENCE'), UN_PARMI('NUMBER_PACKAGE','CONVERGENCE'),),
+
+  SIZE_PACKAGE = SIMP ( statut = "o",
+                 typ = "I",
+                 val_min=10,
+                 defaut=100,
+                 ),
+  NUMBER_PACKAGE = SIMP ( statut = "f",
+                 typ = "I",
+                 val_min=1,
+                 ),
+  CONVERGENCE = SIMP ( statut = "f",
+                 typ="I",
+                 into=[1],
+                 ),
+
+  MAX_CORES = SIMP ( statut = "f",
+                 typ="I",
+                 val_min=1,
+                ),
+
+##  STUDY = SIMP ( statut = "o",
+##                 typ = "TXM",
+##                 into = ( 'N-1', 'Load', 'Wind-1', 'Wind-2', 'PV' ),
+##                 max=5,
+##                 fr = "Affichage du niveau de wrapper de la bibliotheque Open TURNS",
+##                 ang = "Open TURNS library debug level print",
+##                 ),
+)
+
+
+#================================
+# Definition du modele physique
+#================================
+
+
+
+CORRELATION = PROC ( nom = 'CORRELATION',
+                     op = None,
+                     docu = "",
+                     fr = "Correlation entre variables",
+                     ang = "Variable correlation",
+
+####  Copula = SIMP ( statut = "o",
+####                  typ = 'TXM',
+####                  into = ( "Independent", "Normal" ),
+####                  defaut = "Independent",
+####                  fr = "Type de la copule",
+####                  ang = "Copula kind",
+####                  ),
+##
+## # Matrix = BLOC ( condition = "Copula in ( 'Normal', )",
+##
+    CorrelationMatrix = SIMP ( statut = "o",
+                               typ = Matrice(nbLigs=None,
+                                             nbCols=None,
+                                             methodeCalculTaille='NbDeDistributions',
+                                             structure="symetrique"),
+                               fr = "Matrice de correlation entre les variables d'entree",
+                               ang = "Correlation matrix for input variables",
+                               #val_max=1.0,
+                               #val_min=-1.0,
+                               ),
+##  #), # Fin BLOC Matrix
+##
+##
+)
+
+DIRECTORY = MACRO ( nom = 'DIRECTORY',
+        op=None,
+        fr = "Chargement des directoires et fichiers",
+        ang = "Load directories and files necessary to run PSEN",
+                sd_prod = opsPSEN.INCLUDE,
+                op_init = opsPSEN.INCLUDE_context,
+                #sd_prod=None,
+                fichier_ini = 1,
+
+        PSSE_path=SIMP(statut="o",typ='Repertoire',defaut='C:\Program Files (x86)\PTI\PSSE34\PSSBIN'),
+        PSSPY_path=SIMP(statut="o",typ='Repertoire',defaut='C:\Program Files (x86)\PTI\PSSE34\PSSPY27'), 
+        sav_file=SIMP(statut="o", typ = ('Fichier', 'Network Case Files (*.sav);;All Files (*)',),),
+        results_folder=SIMP(statut="o",typ='Repertoire'),
+        #lines_file=SIMP(statut="o" ,typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),),
+        #groups_file=SIMP(statut="o", typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),),
+        #generationsystem_file=SIMP(statut="o" ,typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),),
+
+)
+(
+
+
+)
+
+
+#================================
+# Importation des fichiers csv N-1
+#================================
+
+N_1_LINES = PROC( nom="N_1_LINES",
+                     op = None,
+                     docu = "",
+                     fr = "N-1 lignes",
+                     ang = "N-1 lines",
+  Activated = SIMP ( statut='o', typ=bool, defaut=True),
+##  FileName = SIMP ( statut = "o",
+##                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+##                    fr = "chemin du fichier csv des probabilites des defauts lignes",
+##                    ang = "csv file path with probabilities of line outages",
+##                    ),
+  Probability = SIMP ( statut = 'o',
+                       typ = Tuple(2),
+                       max = '**',
+                       fr = "Probabilite d'indisponibilite de la ligne",
+                       ang = "Probability that the line is not available",
+                       validators=VerifTypeTuple((sd_ligne,'R')),),
+              )
+
+N_1_TRANSFORMERS = PROC( nom="N_1_TRANSFORMERS",
+                     op = None,
+                     docu = "",
+                     fr = "N-1 transformateurs",
+                     ang = "N-1 transformers",
+  Activated = SIMP ( statut='o', typ=bool, defaut=True),
+##  FileName = SIMP ( statut = "o",
+##                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+##                    fr = "chemin du fichier csv des probabilites des defauts transformateur",
+##                    ang = "csv file path with probabilities of transformer outages",
+##                    ),
+  Probability = SIMP ( statut = 'o',
+                       typ = Tuple(2),
+                       max = '**',
+                       fr = "Probabilite d'indisponibilite de la ligne",
+                       ang = "Probability that the line is not available",
+                       validators=VerifTypeTuple((sd_transfo,'R')),),
+              )
+N_1_GENERATORS = PROC( nom="N_1_GENERATORS",
+                     op = None,
+                     docu = "",
+                     fr = "N-1 generateurs",
+                     ang = "N-1 generators",
+  Activated = SIMP ( statut='o', typ=bool, defaut=True),
+##  FileName = SIMP ( statut = "o",
+##                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+##                    fr = "chemin du fichier csv des probabilites des defauts generateurs",
+##                    ang = "csv file path with probabilities of generator outages",
+##                    ),
+  Probability = SIMP ( statut = 'o',
+                       typ = Tuple(2),
+                       max = '**',
+                       fr = "Probabilite d'indisponibilite du generateur",
+                       ang = "Probability that the generator is not available",
+                       validators=VerifTypeTuple((sd_generateur,'R')),),
+              )
+N_1_MOTORS = PROC( nom="N_1_MOTORS",
+                     op = None,
+                     docu = "",
+                     fr = "N-1 moteurs",
+                     ang = "N-1 motors",
+  Activated = SIMP ( statut='o', typ=bool, defaut=True),
+##  FileName = SIMP ( statut = "o",
+##                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+##                    fr = "chemin du fichier csv des probabilites des defauts generateurs",
+##                    ang = "csv file path with probabilities of generator outages",
+##                    ),
+  Probability = SIMP ( statut = 'o',
+                       typ = Tuple(2),
+                       max = '**',
+                       fr = "Probabilite d'indisponibilite du moteur",
+                       ang = "Probability that the motor is not available",
+                       validators=VerifTypeTuple((sd_moteur,'R')),),
+              )
+N_1_LOADS = PROC( nom="N_1_LOADS",
+                     op = None,
+                     docu = "",
+                     fr = "N-1 charges",
+                     ang = "N-1 loads",
+  Activated = SIMP ( statut='o', typ=bool, defaut=True),
+##  FileName = SIMP ( statut = "o",
+##                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+##                    fr = "chemin du fichier csv des probabilites des defauts charges",
+##                    ang = "csv file path with probabilities of load outages",
+##                    ),
+  Probability = SIMP ( statut = 'o',
+                       typ = Tuple(2),
+                       max = '**',
+                       fr = "Probabilite d'indisponibilite du generateur",
+                       ang = "Probability that the generator is not available",
+                       validators=VerifTypeTuple((sd_charge,'R')),),
+              )
+
+
+
+
+#================================
+# Definition des LOIS
+#================================
+
+# Nota : les variables de type OPER doivent etre en majuscules !
+# Nota : les variables de type OPER doivent etre de premier niveau (pas imbriquees dans un autre type)
+DISTRIBUTION = OPER ( nom = "DISTRIBUTION",
+                      sd_prod = loi,
+                      op = 68,
+                      fr = "Definitions des lois marginales utilisees par les variables d'entree",
+
+#====
+# Choisir generateur ou charge
+#====
+
+##  TypeMachine = SIMP ( statut='o', typ='TXM',
+##                      into = ('charge','vent1','vent2','pv','N-1',),
+##                      ),
+  Activated = SIMP ( statut='o', typ=bool, defaut=True),
+  ComponentType = SIMP (statut='o', typ='TXM',
+                      into = ('Generator','Load','Motor','Line','Transformer', 'Reserve Constraint'),),
+                        
+  b_reserve = BLOC (condition = "ComponentType == 'Reserve Constraint'",
+
+  ReserveID = SIMP (statut= "o", typ = "I",
+               val_max = 15,
+               val_min = 1,
+               fr = "Numero de réserve comme definie dans PSS/E",
+               ang= "Period resperve constraint identifier numer as defined in PSS/E.",
+               defaut = 1,
+               ),
+                    
+  Law = SIMP ( statut = "o", typ = "TXM",
+                into = ( "Exponential",
+                         "Histogram",
+                         "Normal",
+                         #"Rayleigh",
+                         "PDF_from_file",
+                         "TruncatedNormal",
+                         "TimeSeries_from_file",
+                         "Uniform",
+                         "UserDefined",
+                         "Weibull",
+                         ),
+                fr = "Choix du type de la loi marginale",
+                ang = "1D marginal distribution",
+                ),
+
+
+#====
+# Definition des parametres selon le type de la loi
+#====
+
+
+  EXPONENTIAL = BLOC ( condition = " Law in ( 'Exponential', ) ",
+
+                         Lambda = SIMP ( statut = "o",
+                                         typ = "R",
+                                         max = 1,
+                                         val_min = 0.,
+                                         fr = "Parametre Lambda | Lambda > 0",
+                                         ang = "Lambda parameter | Lambda > 0",
+                                         ),
+
+                            Gamma = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne inferieure du support de la loi",
+                                        ang = "Support lower bound",
+                                        ),
+
+  ), # Fin BLOC EXPONENTIAL
+
+
+  HISTOGRAM = BLOC ( condition = " Law in ( 'Histogram', ) ",
+
+                       First = SIMP ( statut = "o",
+                                    typ = "R",
+                                    max = 1,
+                                    fr = "Borne inferieure du supoport de la loi",
+                                    ang = "Support lower bound",
+                                    ),
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : largeur de classe, hauteur de classe",
+                                       ang = "Class bandwidth, class height couple list",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       ),
+
+  ), # Fin BLOC HISTOGRAM
+
+
+   NORMAL = BLOC ( condition = " Law in ( 'Normal', ) ",
+
+                    Mu = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Moyenne de la loi",
+                                ang = "Mean value",
+                                ),
+
+                   Sigma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  val_min = 0.,
+                                  fr = "Ecart type de la loi",
+                                  ang = "Standard deviation",
+                                  ),
+
+   ), # Fin BLOC NORMAL
+
+
+  RAYLEIGH = BLOC ( condition = " Law in ( 'Rayleigh', ) ",
+
+                   Sigma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  fr = "Parametre Sigma de la loi | Sigma > 0",
+                                  ang = "Sigma parameter | Sigma > 0",
+                                  ),
+
+                   Gamma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  fr = "Borne inferieure du support de la loi",
+                                  ang = "Support lower bound",
+                                  ),
+ ), # Fin BLOC RAYLEIGH
+
+  PDF = BLOC ( condition = " Law in ( 'PDF_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Nom du fichier .csv",
+                    ang = ".csv file name",
+                    ),
+              ),
+
+
+
+   TRUNCATEDNORMAL = BLOC ( condition = " Law in ( 'TruncatedNormal', ) ",
+
+                             MuN = SIMP ( statut = "o",
+                                          typ = "R",
+                                          max = 1,
+                                          fr = "Moyenne de la loi Normale non tronqu�e",
+                                          ang = "Mean value of the associated non truncated normal distribution",
+                                          ),
+
+                             SigmaN = SIMP ( statut = "o",
+                                             typ = "R",
+                                             max = 1,
+                                             val_min = 0.,
+                                             fr = "Ecart-type de la loi Normale non tronqu�e",
+                                             ang = "Standard deviation of the associated non truncated normal distribution",
+                                             ),
+
+                             A = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne inferieure de la loi | A < B",
+                                        ang = "Lower bound | A < B",
+                                        ),
+
+                             B = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne superieure de la loi | A < B",
+                                        ang = "Upper bound | A < B",
+                                        ),
+
+   ), # Fin BLOC TRUNCATEDNORMAL
+
+
+  TimeSeries = BLOC ( condition = " Law in ( 'TimeSeries_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Fichier CSV d'une serie temporelle",
+                    ang = "CSV file of a time series",
+                    ),
+              ),
+
+
+   UNIFORM = BLOC ( condition = " Law in ( 'Uniform', ) ",
+
+                     A = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Borne inferieure du support de la loi | A < B",
+                                ang = "Support lower bound | A < B",
+                                ),
+
+                     B = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Borne superieure du support de la loi | A < B",
+                                ang = "Support upper bound | A < B",
+                                ),
+
+   ), # Fin BLOC UNIFORM
+
+
+   USERDEFINED = BLOC ( condition = " Law in ( 'UserDefined', ) ",
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : (valeur, prob.)",
+                                       ang = "List of pairs : (value, prob.)",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       ),
+
+  ), # Fin BLOC USERDEFINED
+
+
+   WEIBULL = BLOC ( condition = " Law in ( 'Weibull', ) ",
+
+                     Settings = SIMP ( statut = "o",
+                                          typ = "TXM",
+                                          max = 1,
+                                          into = ( "AlphaBeta", "MuSigma" ),
+                                          defaut = "AlphaBeta",
+                                          fr = "Parametrage de la loi weibull",
+                                          ang = "Weibull distribution parameter set",
+                                          ),
+
+                     AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ",
+
+                                         Alpha = SIMP ( statut = "o",
+                                                        typ = "R",
+                                                        max = 1,
+                                                        val_min = 0.,
+                                                        fr = "Parametre Alpha de la loi | Alpha > 0",
+                                                        ang = "Alpha parameter | Alpha > 0",
+                                                        ),
+
+                                         Beta = SIMP ( statut = "o",
+                                                       typ = "R",
+                                                       max = 1,
+                                                       val_min = 0.,
+                                                       fr = "Parametre Beta de la loi | Beta > 0",
+                                                       ang = "Beta parameter | Beta > 0",
+                                                       ),
+
+                                         ), # Fin BLOC AlphaBeta_Parameters
+
+
+                     MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
+
+                                         Mu = SIMP ( statut = "o",
+                                                     typ = "R",
+                                                     max = 1,
+                                                     fr = "Moyenne de la loi",
+                                                     ang = "Mean value",
+                                                     ),
+
+                                         Sigma = SIMP ( statut = "o",
+                                                        typ = "R",
+                                                        max = 1,
+                                                        val_min = 0.,
+                                                        fr = "Ecart type de la loi",
+                                                        ang = "Standard deviation",
+                                                        ),
+
+                                         ), # Fin BLOC MuSigma_Parameters
+
+                     Gamma = SIMP ( statut = "o",
+                                    typ = "R",
+                                    max = 1,
+                                    fr = "Borne inferieure du support de la loi",
+                                    ang = "Support lower bound",
+                                    ),
+
+    ), # Fin BLOC WEIBULL
+                     
+            ), #fin de BLOC reserve
+                    
+
+  
+  
+  b_gener = BLOC (condition = "ComponentType == 'Generator'",
+
+  Type = SIMP (statut= "o", typ = "TXM",
+               into = ("Generator Power Level", "Generator Availability"),
+               fr = "Choisir si c'est le niveau de puissance ou la disponibilit� du generateur qui sera tiree",
+               ang= "Choose whether the power level or the availability of the generator will be set by the law",
+               defaut = "Generator Power Level",
+               ),
+
+  Sampling = SIMP (statut= "o", typ = "TXM",
+               into = ("Same sample for all generators", "One sample per generator"),
+               fr = "Choisir si une seule tirage sera fait pour tous les generateurs ou si des tirages differents seront faits pour chaque generateur",
+               ang= "Choose whether one drawing/sample will be performed for all of the generators or whether a different drawing/sample will be performed for each generator.",
+               defaut = "Same sample for all generators",
+               ),
+
+  Generator   = SIMP(statut='o',typ=sd_generateur,max="**", homo="SansOrdreNiDoublon"),
+
+#====
+# Type de distribution
+#====
+
+  b_gener_level = BLOC (condition= "Type == 'Generator Power Level'",
+
+  Law = SIMP ( statut = "o", typ = "TXM",
+                into = ( "Exponential",
+                         "Histogram",
+                         "Normal",
+                         #"Rayleigh",
+                         "PDF_from_file",
+                         "TruncatedNormal",
+                         "TimeSeries_from_file",
+                         "Uniform",
+                         "UserDefined",
+                         "Weibull",
+                         ),
+                fr = "Choix du type de la loi marginale",
+                ang = "1D marginal distribution",
+                ),
+
+
+#====
+# Definition des parametres selon le type de la loi
+#====
+
+
+  EXPONENTIAL = BLOC ( condition = " Law in ( 'Exponential', ) ",
+
+                         Lambda = SIMP ( statut = "o",
+                                         typ = "R",
+                                         max = 1,
+                                         val_min = 0.,
+                                         fr = "Parametre Lambda | Lambda > 0",
+                                         ang = "Lambda parameter | Lambda > 0",
+                                         ),
+
+                            Gamma = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne inferieure du support de la loi",
+                                        ang = "Support lower bound",
+                                        ),
+
+  ), # Fin BLOC EXPONENTIAL
+
+
+  HISTOGRAM = BLOC ( condition = " Law in ( 'Histogram', ) ",
+
+                       First = SIMP ( statut = "o",
+                                    typ = "R",
+                                    max = 1,
+                                    fr = "Borne inferieure du supoport de la loi",
+                                    ang = "Support lower bound",
+                                    ),
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : largeur de classe, hauteur de classe",
+                                       ang = "Class bandwidth, class height couple list",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       ),
+
+  ), # Fin BLOC HISTOGRAM
+
+
+   NORMAL = BLOC ( condition = " Law in ( 'Normal', ) ",
+
+                    Mu = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Moyenne de la loi",
+                                ang = "Mean value",
+                                ),
+
+                   Sigma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  val_min = 0.,
+                                  fr = "Ecart type de la loi",
+                                  ang = "Standard deviation",
+                                  ),
+
+   ), # Fin BLOC NORMAL
+
+
+  RAYLEIGH = BLOC ( condition = " Law in ( 'Rayleigh', ) ",
+
+                   Sigma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  fr = "Parametre Sigma de la loi | Sigma > 0",
+                                  ang = "Sigma parameter | Sigma > 0",
+                                  ),
+
+                   Gamma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  fr = "Borne inferieure du support de la loi",
+                                  ang = "Support lower bound",
+                                  ),
+ ), # Fin BLOC RAYLEIGH
+
+  PDF = BLOC ( condition = " Law in ( 'PDF_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Nom du fichier .csv",
+                    ang = ".csv file name",
+                    ),
+              ),
+
+
+
+   TRUNCATEDNORMAL = BLOC ( condition = " Law in ( 'TruncatedNormal', ) ",
+
+                             MuN = SIMP ( statut = "o",
+                                          typ = "R",
+                                          max = 1,
+                                          fr = "Moyenne de la loi Normale non tronqu�e",
+                                          ang = "Mean value of the associated non truncated normal distribution",
+                                          ),
+
+                             SigmaN = SIMP ( statut = "o",
+                                             typ = "R",
+                                             max = 1,
+                                             val_min = 0.,
+                                             fr = "Ecart-type de la loi Normale non tronqu�e",
+                                             ang = "Standard deviation of the associated non truncated normal distribution",
+                                             ),
+
+                             A = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne inferieure de la loi | A < B",
+                                        ang = "Lower bound | A < B",
+                                        ),
+
+                             B = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne superieure de la loi | A < B",
+                                        ang = "Upper bound | A < B",
+                                        ),
+
+   ), # Fin BLOC TRUNCATEDNORMAL
+
+
+  TimeSeries = BLOC ( condition = " Law in ( 'TimeSeries_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Fichier CSV d'une serie temporelle",
+                    ang = "CSV file of a time series",
+                    ),
+              ),
+
+
+   UNIFORM = BLOC ( condition = " Law in ( 'Uniform', ) ",
+
+                     A = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Borne inferieure du support de la loi | A < B",
+                                ang = "Support lower bound | A < B",
+                                ),
+
+                     B = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Borne superieure du support de la loi | A < B",
+                                ang = "Support upper bound | A < B",
+                                ),
+
+   ), # Fin BLOC UNIFORM
+
+
+   USERDEFINED = BLOC ( condition = " Law in ( 'UserDefined', ) ",
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : (valeur, prob.)",
+                                       ang = "List of pairs : (value, prob.)",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       ),
+
+  ), # Fin BLOC USERDEFINED
+
+
+   WEIBULL = BLOC ( condition = " Law in ( 'Weibull', ) ",
+
+                     Settings = SIMP ( statut = "o",
+                                          typ = "TXM",
+                                          max = 1,
+                                          into = ( "AlphaBeta", "MuSigma" ),
+                                          defaut = "AlphaBeta",
+                                          fr = "Parametrage de la loi weibull",
+                                          ang = "Weibull distribution parameter set",
+                                          ),
+
+                     AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ",
+
+                                         Alpha = SIMP ( statut = "o",
+                                                        typ = "R",
+                                                        max = 1,
+                                                        val_min = 0.,
+                                                        fr = "Parametre Alpha de la loi | Alpha > 0",
+                                                        ang = "Alpha parameter | Alpha > 0",
+                                                        ),
+
+                                         Beta = SIMP ( statut = "o",
+                                                       typ = "R",
+                                                       max = 1,
+                                                       val_min = 0.,
+                                                       fr = "Parametre Beta de la loi | Beta > 0",
+                                                       ang = "Beta parameter | Beta > 0",
+                                                       ),
+
+                                         ), # Fin BLOC AlphaBeta_Parameters
+
+
+                     MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
+
+                                         Mu = SIMP ( statut = "o",
+                                                     typ = "R",
+                                                     max = 1,
+                                                     fr = "Moyenne de la loi",
+                                                     ang = "Mean value",
+                                                     ),
+
+                                         Sigma = SIMP ( statut = "o",
+                                                        typ = "R",
+                                                        max = 1,
+                                                        val_min = 0.,
+                                                        fr = "Ecart type de la loi",
+                                                        ang = "Standard deviation",
+                                                        ),
+
+                                         ), # Fin BLOC MuSigma_Parameters
+
+                     Gamma = SIMP ( statut = "o",
+                                    typ = "R",
+                                    max = 1,
+                                    fr = "Borne inferieure du support de la loi",
+                                    ang = "Support lower bound",
+                                    ),
+
+    ), # Fin BLOC WEIBULL
+
+
+    Transfer_Function = FACT(statut='f',
+
+        TF_Input = SIMP ( statut='o',
+                       typ = 'TXM',
+                       fr = 'Entrer une fonction de transfert � partir d''un fichier .pow (vitesse de vent - puissance eolienne)\n \
+                             ou entrer une liste de tuples (valeur tiree - puissance normalisee)',
+                       ang = 'Enter wind speed - turbine production transfer function as a .pow file, \n \
+                              or enter a generic list of (law output value, normalized power output) tuples',
+                       into = ('.pow file', 'tuples list'),
+                             ),
+        b_file = BLOC(condition = "TF_Input == '.pow file'",
+                      File_Name = SIMP ( statut = "o",
+                                        typ = ('Fichier', 'Pow files (*.pow);;All Files (*)',),
+                                        fr = "Nom du fichier de transfer .pow",
+                                        ang = ".pow file name",
+                                        ),
+                      Wind_Speed_Measurement_Height = SIMP ( statut = 'o',
+                                        typ = "R",
+                                        max = 1,
+                                        fr = 'Hauteur (en metres) a laquelle les mesures de vitesse du vent ont ete prises',
+                                        ang = 'Height of wind speed measurements (m)',
+                                        sug = 10,
+                                        val_min = 0,
+                                        ),
+                      Hub_Height = SIMP (statut = 'o',
+                                         typ = "R",
+                                         fr = 'hauteur de moyeu de l''eolienne',
+                                         ang = 'wind turbine hub height',
+                                         sug = 80,
+                                         val_min = 0,),
+                      AlphaWS = SIMP (statut = 'o',
+                                         typ = "R",
+                                         fr = 'l''alpha pour extrapoler les mesures de vitesse du vent a la hauteur du moyeu ',
+                                         ang = 'alpha used to extrapolate wind speed measurements to hub height',
+                                         defaut = 1./7,
+                                         val_min = 0,
+                                         val_max = 1,
+                                            ),
+                      Percent_Losses = SIMP (statut = 'o',
+                                         typ = "R",
+                                         fr = 'pourcentage de pertes entre la sortie theorique d''une turbine et la sortie de la centrale',
+                                         ang = 'percent losses between theoretical power output of a single turbine and the output of the farm',
+                                         defaut = 5,
+                                         val_min = 0,
+                                         val_max = 100,
+                                             ),
+                      ), #fin du bloc FileName
+
+        b_tuples = BLOC(condition = "TF_Input == 'tuples list'",
+
+                       TF_Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       min = 2,
+                                       fr = "Liste de couples : valeur tiree, puissance normalisee sortie",
+                                       ang = "List of couples : value set by law, normalized power output",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       ),
+                      ), #fin du block Tuples List
+
+        ), #fin du FACT Transfer Function
+
+  ), #fin du bloc generator level
+
+
+  b_gener_avail = BLOC (condition= "Type == 'Generator Availability'",
+
+  Law = SIMP ( statut = "o", typ = "TXM",
+                into = ( #"Exponential",
+                         #"Histogram",
+                         #"Normal",
+                         #"Rayleigh",
+                         #"PDF_from_file",
+                         #"TruncatedNormal",
+                         "TimeSeries_from_file",
+                         #"Uniform",
+                         "UserDefined",
+                         #"Weibull",
+                         ),
+                fr = "Choix du type de la loi marginale",
+                ang = "1D marginal distribution",
+                defaut="UserDefined",
+                ),
+
+
+#====
+# Definition des parametres selon le type de la loi
+#====
+
+
+  TimeSeries = BLOC ( condition = " Law in ( 'TimeSeries_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Fichier CSV d'une serie temporelle",
+                    ang = "CSV file of a time series",
+                    ),
+              ),
+
+
+   USERDEFINED = BLOC ( condition = " Law in ( 'UserDefined', ) ",
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : (valeur, prob.)",
+                                       ang = "List of pairs : (value, prob.)",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       defaut=((0,0.0),(1,1.0)),
+                                       ),
+
+  ), # Fin BLOC USERDEFINED
+
+
+  ), #fin du bloc generator avail
+
+
+  ), #fin du bloc generateur
+
+#Bloc Charge
+  b_charge = BLOC (condition = "ComponentType == 'Load'",
+
+
+#====
+# Type de distribution
+#====
+
+  Type = SIMP (statut= "o", typ = "TXM",
+               into = ("Load Level", "Load Availability"),
+               fr = "Choisir si c'est le niveau de charge ou la disponibilit� de la charge qui sera tiree",
+               ang= "Choose whether the power level or the availability of the load will be set by the law",
+               defaut = "Load Level",
+               ),
+
+  Sampling = SIMP (statut= "o", typ = "TXM",
+               into = ("Same sample for all loads", "One sample per load"),
+               fr = "Choisir si une seule tirage sera fait pour tous les charges ou si des tirages differents seront faits pour chaque charge",
+               ang= "Choose whether one drawing/sample will be performed for all of the loads or whether a different drawing/sample will be performed for each load.",
+               defaut = "Same sample for all loads",
+               ),
+
+  Load       = SIMP(statut='o',typ=sd_charge,max="**", homo="SansOrdreNiDoublon",),
+
+
+  b_charge_level = BLOC (condition = "Type == 'Load Level'",
+
+  Law = SIMP ( statut = "o", typ = "TXM",
+                into = ( "Exponential",
+                         "Histogram",
+                         "Normal",
+                         #"Rayleigh",
+                         "PDF_from_file",
+                         "TruncatedNormal",
+                         "TimeSeries_from_file",
+                         "Uniform",
+                         "UserDefined",
+                         "Weibull",
+                         ),
+                fr = "Choix du type de la loi marginale",
+                ang = "1D marginal distribution",
+                ),
+
+
+#====
+# Definition des parametres selon le type de la loi
+#====
+
+
+  EXPONENTIAL = BLOC ( condition = " Law in ( 'Exponential', ) ",
+
+                         Lambda = SIMP ( statut = "o",
+                                         typ = "R",
+                                         max = 1,
+                                         val_min = 0.,
+                                         fr = "Parametre Lambda | Lambda > 0",
+                                         ang = "Lambda parameter | Lambda > 0",
+                                         ),
+
+                         Gamma = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne inferieure du support de la loi",
+                                        ang = "Support lower bound",
+                                        ),
+
+  ), # Fin BLOC EXPONENTIAL
+
+
+  HISTOGRAM = BLOC ( condition = " Law in ( 'Histogram', ) ",
+
+                       First = SIMP ( statut = "o",
+                                    typ = "R",
+                                    max = 1,
+                                    fr = "Borne inferieure du supoport de la loi",
+                                    ang = "Support lower bound",
+                                    ),
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : largeur de classe, hauteur de classe",
+                                       ang = "Class bandwidth, class height couple list",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       ),
+
+  ), # Fin BLOC HISTOGRAM
+
+
+   NORMAL = BLOC ( condition = " Law in ( 'Normal', ) ",
+
+                    Mu = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Moyenne de la loi",
+                                ang = "Mean value",
+                                ),
+
+                   Sigma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  val_min = 0.,
+                                  fr = "Ecart type de la loi",
+                                  ang = "Standard deviation",
+                                  ),
+
+   ), # Fin BLOC NORMAL
+
+
+  RAYLEIGH = BLOC ( condition = " Law in ( 'Rayleigh', ) ",
+
+                   Sigma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  fr = "Parametre Sigma de la loi | Sigma > 0",
+                                  ang = "Sigma parameter | Sigma > 0",
+                                  ),
+
+                   Gamma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  fr = "Borne inferieure du support de la loi",
+                                  ang = "Support lower bound",
+                                  ),
+ ), # Fin BLOC RAYLEIGH
+
+  PDF = BLOC ( condition = " Law in ( 'PDF_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Nom du fichier .csv",
+                    ang = ".csv file name",
+                    ),
+              ),
+
+
+
+   TRUNCATEDNORMAL = BLOC ( condition = " Law in ( 'TruncatedNormal', ) ",
+
+                             MuN = SIMP ( statut = "o",
+                                          typ = "R",
+                                          max = 1,
+                                          fr = "Moyenne de la loi Normale non tronqu�e",
+                                          ang = "Mean value of the associated non truncated normal distribution",
+                                          ),
+
+                             SigmaN = SIMP ( statut = "o",
+                                             typ = "R",
+                                             max = 1,
+                                             val_min = 0.,
+                                             fr = "Ecart-type de la loi Normale non tronqu�e",
+                                             ang = "Standard deviation of the associated non truncated normal distribution",
+                                             ),
+
+                             A = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne inferieure de la loi | A < B",
+                                        ang = "Lower bound | A < B",
+                                        ),
+
+                             B = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne superieure de la loi | A < B",
+                                        ang = "Upper bound | A < B",
+                                        ),
+
+   ), # Fin BLOC TRUNCATEDNORMAL
+
+
+  TimeSeries = BLOC ( condition = " Law in ( 'TimeSeries_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Fichier CSV d'une serie temporelle",
+                    ang = "CSV file of a time series",
+                    ),
+              ),
+
+
+   UNIFORM = BLOC ( condition = " Law in ( 'Uniform', ) ",
+
+                     A = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Borne inferieure du support de la loi | A < B",
+                                ang = "Support lower bound | A < B",
+                                ),
+
+                     B = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Borne superieure du support de la loi | A < B",
+                                ang = "Support upper bound | A < B",
+                                ),
+
+   ), # Fin BLOC UNIFORM
+
+
+   USERDEFINED = BLOC ( condition = " Law in ( 'UserDefined', ) ",
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : (valeur, probabilite)",
+                                       ang = "List of pairs : (value, probability)",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       ),
+
+  ), # Fin BLOC USERDEFINED
+
+
+   WEIBULL = BLOC ( condition = " Law in ( 'Weibull', ) ",
+
+                     Settings = SIMP ( statut = "o",
+                                          typ = "TXM",
+                                          max = 1,
+                                          into = ( "AlphaBeta", "MuSigma" ),
+                                          defaut = "AlphaBeta",
+                                          fr = "Parametrage de la loi weibull",
+                                          ang = "Weibull distribution parameter set",
+                                          ),
+
+                     AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ",
+
+                                         Alpha = SIMP ( statut = "o",
+                                                        typ = "R",
+                                                        max = 1,
+                                                        val_min = 0.,
+                                                        fr = "Parametre Alpha de la loi | Alpha > 0",
+                                                        ang = "Alpha parameter | Alpha > 0",
+                                                        ),
+
+                                         Beta = SIMP ( statut = "o",
+                                                       typ = "R",
+                                                       max = 1,
+                                                       val_min = 0.,
+                                                       fr = "Parametre Beta de la loi | Beta > 0",
+                                                       ang = "Beta parameter | Beta > 0",
+                                                       ),
+
+                                         ), # Fin BLOC AlphaBeta_Parameters
+
+
+                     MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
+
+                                         Mu = SIMP ( statut = "o",
+                                                     typ = "R",
+                                                     max = 1,
+                                                     fr = "Moyenne de la loi",
+                                                     ang = "Mean value",
+                                                     ),
+
+                                         Sigma = SIMP ( statut = "o",
+                                                        typ = "R",
+                                                        max = 1,
+                                                        val_min = 0.,
+                                                        fr = "Ecart type de la loi",
+                                                        ang = "Standard deviation",
+                                                        ),
+
+                                         ), # Fin BLOC MuSigma_Parameters
+
+                     Gamma = SIMP ( statut = "o",
+                                    typ = "R",
+                                    max = 1,
+                                    fr = "Borne inferieure du support de la loi",
+                                    ang = "Support lower bound",
+                                    ),
+
+    ), # Fin BLOC WEIBULL
+
+  ), #fin du block Load Level
+
+
+  b_charge_avail = BLOC (condition = "Type == 'Load Availability'",
+
+  Law = SIMP ( statut = "o", typ = "TXM",
+                into = ( #"Exponential",
+                         #"Histogram",
+                         #"Normal",
+                         #"Rayleigh",
+                         #"PDF_from_file",
+                         #"TruncatedNormal",
+                         "TimeSeries_from_file",
+                         #"Uniform",
+                         "UserDefined",
+                         #"Weibull",
+                         ),
+                fr = "Choix du type de la loi marginale",
+                ang = "1D marginal distribution",
+                defaut = "UserDefined",
+                ),
+
+
+#====
+# Definition des parametres selon le type de la loi
+#====
+
+  TimeSeries = BLOC ( condition = " Law in ( 'TimeSeries_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Fichier CSV d'une serie temporelle",
+                    ang = "CSV file of a time series",
+                    ),
+              ),
+
+
+
+   USERDEFINED = BLOC ( condition = " Law in ( 'UserDefined', ) ",
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : (valeur, probabilite)",
+                                       ang = "List of pairs : (value, probability)",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       defaut=((0,0.0),(1,1.0)),
+                                       ),
+
+  ), # Fin BLOC USERDEFINED
+
+
+  ), #fin du block Load Avail
+
+
+  ), #fin du bloc charge
+
+
+
+#Bloc Moteur
+  b_moteur = BLOC (condition = "ComponentType == 'Motor'",
+
+
+#====
+# Type de distribution
+#====
+
+  Type = SIMP (statut= "o", typ = "TXM",
+               into = ("Motor Level", "Motor Availability"),
+               fr = "Choisir si c'est le niveau de charge du moteur ou la disponibilit� du moteur qui sera tiree",
+               ang= "Choose whether the power level or the availability of the motor will be set by the law",
+               defaut = "Motor Level",
+               ),
+
+  Sampling = SIMP (statut= "o", typ = "TXM",
+               into = ("Same sample for all motors", "One sample per motor"),
+               fr = "Choisir si une seule tirage sera fait pour tous les moteurs ou si des tirages differents seront faits pour chaque moteur",
+               ang= "Choose whether one drawing/sample will be performed for all of the motors or whether a different drawing/sample will be performed for each motor.",
+               defaut = "Same sample for all motors",
+               ),
+
+  Motor       = SIMP(statut='o',typ=sd_moteur,max="**", homo="SansOrdreNiDoublon",),
+
+
+  b_moteur_level = BLOC (condition = "Type == 'Motor Level'",
+
+  Law = SIMP ( statut = "o", typ = "TXM",
+                into = ( "Exponential",
+                         "Histogram",
+                         "Normal",
+                         #"Rayleigh",
+                         "PDF_from_file",
+                         "TruncatedNormal",
+                         "TimeSeries_from_file",
+                         "Uniform",
+                         "UserDefined",
+                         "Weibull",
+                         ),
+                fr = "Choix du type de la loi marginale",
+                ang = "1D marginal distribution",
+                ),
+
+
+#====
+# Definition des parametres selon le type de la loi
+#====
+
+
+  EXPONENTIAL = BLOC ( condition = " Law in ( 'Exponential', ) ",
+
+                         Lambda = SIMP ( statut = "o",
+                                         typ = "R",
+                                         max = 1,
+                                         val_min = 0.,
+                                         fr = "Parametre Lambda | Lambda > 0",
+                                         ang = "Lambda parameter | Lambda > 0",
+                                         ),
+
+                         Gamma = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne inferieure du support de la loi",
+                                        ang = "Support lower bound",
+                                        ),
+
+  ), # Fin BLOC EXPONENTIAL
+
+
+  HISTOGRAM = BLOC ( condition = " Law in ( 'Histogram', ) ",
+
+                       First = SIMP ( statut = "o",
+                                    typ = "R",
+                                    max = 1,
+                                    fr = "Borne inferieure du supoport de la loi",
+                                    ang = "Support lower bound",
+                                    ),
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : largeur de classe, hauteur de classe",
+                                       ang = "Class bandwidth, class height couple list",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       ),
+
+  ), # Fin BLOC HISTOGRAM
+
+
+   NORMAL = BLOC ( condition = " Law in ( 'Normal', ) ",
+
+                    Mu = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Moyenne de la loi",
+                                ang = "Mean value",
+                                ),
+
+                   Sigma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  val_min = 0.,
+                                  fr = "Ecart type de la loi",
+                                  ang = "Standard deviation",
+                                  ),
+
+   ), # Fin BLOC NORMAL
+
+
+  RAYLEIGH = BLOC ( condition = " Law in ( 'Rayleigh', ) ",
+
+                   Sigma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  fr = "Parametre Sigma de la loi | Sigma > 0",
+                                  ang = "Sigma parameter | Sigma > 0",
+                                  ),
+
+                   Gamma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  fr = "Borne inferieure du support de la loi",
+                                  ang = "Support lower bound",
+                                  ),
+ ), # Fin BLOC RAYLEIGH
+
+  PDF = BLOC ( condition = " Law in ( 'PDF_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Nom du fichier .csv",
+                    ang = ".csv file name",
+                    ),
+              ),
+
+
+
+   TRUNCATEDNORMAL = BLOC ( condition = " Law in ( 'TruncatedNormal', ) ",
+
+                             MuN = SIMP ( statut = "o",
+                                          typ = "R",
+                                          max = 1,
+                                          fr = "Moyenne de la loi Normale non tronqu�e",
+                                          ang = "Mean value of the associated non truncated normal distribution",
+                                          ),
+
+                             SigmaN = SIMP ( statut = "o",
+                                             typ = "R",
+                                             max = 1,
+                                             val_min = 0.,
+                                             fr = "Ecart-type de la loi Normale non tronqu�e",
+                                             ang = "Standard deviation of the associated non truncated normal distribution",
+                                             ),
+
+                             A = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne inferieure de la loi | A < B",
+                                        ang = "Lower bound | A < B",
+                                        ),
+
+                             B = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne superieure de la loi | A < B",
+                                        ang = "Upper bound | A < B",
+                                        ),
+
+   ), # Fin BLOC TRUNCATEDNORMAL
+
+
+  TimeSeries = BLOC ( condition = " Law in ( 'TimeSeries_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Fichier CSV d'une serie temporelle",
+                    ang = "CSV file of a time series",
+                    ),
+              ),
+
+
+   UNIFORM = BLOC ( condition = " Law in ( 'Uniform', ) ",
+
+                     A = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Borne inferieure du support de la loi | A < B",
+                                ang = "Support lower bound | A < B",
+                                ),
+
+                     B = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Borne superieure du support de la loi | A < B",
+                                ang = "Support upper bound | A < B",
+                                ),
+
+   ), # Fin BLOC UNIFORM
+
+
+   USERDEFINED = BLOC ( condition = " Law in ( 'UserDefined', ) ",
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : (valeur, probabilite)",
+                                       ang = "List of pairs : (value, probability)",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       ),
+
+  ), # Fin BLOC USERDEFINED
+
+
+   WEIBULL = BLOC ( condition = " Law in ( 'Weibull', ) ",
+
+                     Settings = SIMP ( statut = "o",
+                                          typ = "TXM",
+                                          max = 1,
+                                          into = ( "AlphaBeta", "MuSigma" ),
+                                          defaut = "AlphaBeta",
+                                          fr = "Parametrage de la loi weibull",
+                                          ang = "Weibull distribution parameter set",
+                                          ),
+
+                     AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ",
+
+                                         Alpha = SIMP ( statut = "o",
+                                                        typ = "R",
+                                                        max = 1,
+                                                        val_min = 0.,
+                                                        fr = "Parametre Alpha de la loi | Alpha > 0",
+                                                        ang = "Alpha parameter | Alpha > 0",
+                                                        ),
+
+                                         Beta = SIMP ( statut = "o",
+                                                       typ = "R",
+                                                       max = 1,
+                                                       val_min = 0.,
+                                                       fr = "Parametre Beta de la loi | Beta > 0",
+                                                       ang = "Beta parameter | Beta > 0",
+                                                       ),
+
+                                         ), # Fin BLOC AlphaBeta_Parameters
+
+
+                     MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
+
+                                         Mu = SIMP ( statut = "o",
+                                                     typ = "R",
+                                                     max = 1,
+                                                     fr = "Moyenne de la loi",
+                                                     ang = "Mean value",
+                                                     ),
+
+                                         Sigma = SIMP ( statut = "o",
+                                                        typ = "R",
+                                                        max = 1,
+                                                        val_min = 0.,
+                                                        fr = "Ecart type de la loi",
+                                                        ang = "Standard deviation",
+                                                        ),
+
+                                         ), # Fin BLOC MuSigma_Parameters
+
+                     Gamma = SIMP ( statut = "o",
+                                    typ = "R",
+                                    max = 1,
+                                    fr = "Borne inferieure du support de la loi",
+                                    ang = "Support lower bound",
+                                    ),
+
+    ), # Fin BLOC WEIBULL
+
+  ), #fin du block Load Level
+
+
+  b_moteur_avail = BLOC (condition = "Type == 'Motor Availability'",
+
+  Law = SIMP ( statut = "o", typ = "TXM",
+                into = ( #"Exponential",
+                         #"Histogram",
+                         #"Normal",
+                         #"Rayleigh",
+                         #"PDF_from_file",
+                         #"TruncatedNormal",
+                         "TimeSeries_from_file",
+                         #"Uniform",
+                         "UserDefined",
+                         #"Weibull",
+                         ),
+                fr = "Choix du type de la loi marginale",
+                ang = "1D marginal distribution",
+                defaut = "UserDefined",
+                ),
+
+
+#====
+# Definition des parametres selon le type de la loi
+#====
+
+  TimeSeries = BLOC ( condition = " Law in ( 'TimeSeries_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Fichier CSV d'une serie temporelle",
+                    ang = "CSV file of a time series",
+                    ),
+              ),
+
+
+
+   USERDEFINED = BLOC ( condition = " Law in ( 'UserDefined', ) ",
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : (valeur, probabilite)",
+                                       ang = "List of pairs : (value, probability)",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       defaut=((0,0.0),(1,1.0)),
+                                       ),
+
+  ), # Fin BLOC USERDEFINED
+
+
+  ), #fin du block Load Avail
+
+
+  ), #fin du bloc moteur
+
+
+  b_ligne = BLOC (condition = "ComponentType == 'Line'",
+
+
+#====
+# Type de distribution
+#====
+
+  Type = SIMP (statut= "o", typ = "TXM",
+               into = ("Line Availability",),
+               fr = "La disponibilite de la ligne sera tiree",
+               ang= "Line availability will be set by the law",
+               defaut = "Line Availability",
+               ),
+
+  Sampling = SIMP (statut= "o", typ = "TXM",
+               into = ("Same sample for all lines", "One sample per line"),
+               fr = "Choisir si une seule tirage sera fait pour tous les lignes ou si des tirages differents seront faits pour chaque ligne",
+               ang= "Choose whether one drawing/sample will be performed for all of the lines or whether a different drawing/sample will be performed for each line.",
+               defaut = "Same sample for all lines",
+               ),
+
+  Line   = SIMP(statut='o',typ=sd_ligne,max="**", homo="SansOrdreNiDoublon"),
+
+  Law = SIMP ( statut = "o", typ = "TXM",
+                into = ( #"Exponential",
+                         #"Histogram",
+                         #"Normal",
+                         #"Rayleigh",
+                         #"PDF_from_file",
+                         #"TruncatedNormal",
+                         "TimeSeries_from_file",
+                         #"Uniform",
+                         "UserDefined",
+                         #"Weibull",
+                         ),
+                defaut = "UserDefined",
+                fr = "Choix du type de la loi marginale",
+                ang = "1D marginal distribution",
+                ),
+
+
+#====
+# Definition des parametres selon le type de la loi
+#====
+
+
+  EXPONENTIAL = BLOC ( condition = " Law in ( 'Exponential', ) ",
+
+                         Lambda = SIMP ( statut = "o",
+                                         typ = "R",
+                                         max = 1,
+                                         val_min = 0.,
+                                         fr = "Parametre Lambda | Lambda > 0",
+                                         ang = "Lambda parameter | Lambda > 0",
+                                         ),
+
+                         Gamma = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne inferieure du support de la loi",
+                                        ang = "Support lower bound",
+                                        ),
+
+  ), # Fin BLOC EXPONENTIAL
+
+
+  HISTOGRAM = BLOC ( condition = " Law in ( 'Histogram', ) ",
+
+                       First = SIMP ( statut = "o",
+                                    typ = "R",
+                                    max = 1,
+                                    fr = "Borne inferieure du supoport de la loi",
+                                    ang = "Support lower bound",
+                                    ),
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : largeur de classe, hauteur de classe",
+                                       ang = "Class bandwidth, class height couple list",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       ),
+
+  ), # Fin BLOC HISTOGRAM
+
+
+   NORMAL = BLOC ( condition = " Law in ( 'Normal', ) ",
+
+                    Mu = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Moyenne de la loi",
+                                ang = "Mean value",
+                                ),
+
+                   Sigma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  val_min = 0.,
+                                  fr = "Ecart type de la loi",
+                                  ang = "Standard deviation",
+                                  ),
+
+   ), # Fin BLOC NORMAL
+
+
+  RAYLEIGH = BLOC ( condition = " Law in ( 'Rayleigh', ) ",
+
+                   Sigma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  fr = "Parametre Sigma de la loi | Sigma > 0",
+                                  ang = "Sigma parameter | Sigma > 0",
+                                  ),
+
+                   Gamma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  fr = "Borne inferieure du support de la loi",
+                                  ang = "Support lower bound",
+                                  ),
+ ), # Fin BLOC RAYLEIGH
+
+  PDF = BLOC ( condition = " Law in ( 'PDF_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Nom du fichier .csv",
+                    ang = ".csv file name",
+                    ),
+              ),
+
+
+
+   TRUNCATEDNORMAL = BLOC ( condition = " Law in ( 'TruncatedNormal', ) ",
+
+                             MuN = SIMP ( statut = "o",
+                                          typ = "R",
+                                          max = 1,
+                                          fr = "Moyenne de la loi Normale non tronqu�e",
+                                          ang = "Mean value of the associated non truncated normal distribution",
+                                          ),
+
+                             SigmaN = SIMP ( statut = "o",
+                                             typ = "R",
+                                             max = 1,
+                                             val_min = 0.,
+                                             fr = "Ecart-type de la loi Normale non tronqu�e",
+                                             ang = "Standard deviation of the associated non truncated normal distribution",
+                                             ),
+
+                             A = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne inferieure de la loi | A < B",
+                                        ang = "Lower bound | A < B",
+                                        ),
+
+                             B = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne superieure de la loi | A < B",
+                                        ang = "Upper bound | A < B",
+                                        ),
+
+   ), # Fin BLOC TRUNCATEDNORMAL
+
+
+  TimeSeries = BLOC ( condition = " Law in ( 'TimeSeries_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Fichier CSV d'une serie temporelle",
+                    ang = "CSV file of a time series",
+                    ),
+              ),
+
+
+   UNIFORM = BLOC ( condition = " Law in ( 'Uniform', ) ",
+
+                     A = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Borne inferieure du support de la loi | A < B",
+                                ang = "Support lower bound | A < B",
+                                ),
+
+                     B = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Borne superieure du support de la loi | A < B",
+                                ang = "Support upper bound | A < B",
+                                ),
+
+   ), # Fin BLOC UNIFORM
+
+
+   USERDEFINED = BLOC ( condition = " Law in ( 'UserDefined', ) ",
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : (valeur, probabilite)",
+                                       ang = "List of pairs : (value, probability)",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       defaut=((0,0.0),(1,1.0)),
+                                       ),
+
+  ), # Fin BLOC USERDEFINED
+
+
+   WEIBULL = BLOC ( condition = " Law in ( 'Weibull', ) ",
+
+                     Settings = SIMP ( statut = "o",
+                                          typ = "TXM",
+                                          max = 1,
+                                          into = ( "AlphaBeta", "MuSigma" ),
+                                          defaut = "AlphaBeta",
+                                          fr = "Parametrage de la loi weibull",
+                                          ang = "Weibull distribution parameter set",
+                                          ),
+
+                     AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ",
+
+                                         Alpha = SIMP ( statut = "o",
+                                                        typ = "R",
+                                                        max = 1,
+                                                        val_min = 0.,
+                                                        fr = "Parametre Alpha de la loi | Alpha > 0",
+                                                        ang = "Alpha parameter | Alpha > 0",
+                                                        ),
+
+                                         Beta = SIMP ( statut = "o",
+                                                       typ = "R",
+                                                       max = 1,
+                                                       val_min = 0.,
+                                                       fr = "Parametre Beta de la loi | Beta > 0",
+                                                       ang = "Beta parameter | Beta > 0",
+                                                       ),
+
+                                         ), # Fin BLOC AlphaBeta_Parameters
+
+
+                     MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
+
+                                         Mu = SIMP ( statut = "o",
+                                                     typ = "R",
+                                                     max = 1,
+                                                     fr = "Moyenne de la loi",
+                                                     ang = "Mean value",
+                                                     ),
+
+                                         Sigma = SIMP ( statut = "o",
+                                                        typ = "R",
+                                                        max = 1,
+                                                        val_min = 0.,
+                                                        fr = "Ecart type de la loi",
+                                                        ang = "Standard deviation",
+                                                        ),
+
+                                         ), # Fin BLOC MuSigma_Parameters
+
+                     Gamma = SIMP ( statut = "o",
+                                    typ = "R",
+                                    max = 1,
+                                    fr = "Borne inferieure du support de la loi",
+                                    ang = "Support lower bound",
+                                    ),
+
+    ), # Fin BLOC WEIBULL
+
+  ), #fin du bloc ligne
+
+  b_transfo = BLOC (condition = "ComponentType == 'Transformer'",
+
+
+#====
+# Type de distribution
+#====
+
+  Type = SIMP (statut= "o", typ = "TXM",
+               into = ("Transformer Availability",),
+               fr = "La disponibilite du transformateur sera tiree",
+               ang= "Transformer availability will be set by the law",
+               defaut = "Transformer Availability"
+               ),
+
+  Sampling = SIMP (statut= "o", typ = "TXM",
+               into = ("Same sample for all transformers", "One sample per transformer"),
+               fr = "Choisir si une seule tirage sera fait pour tous les transforamteurs ou si des tirages differents seront faits pour chaque transformateur",
+               ang= "Choose whether one drawing/sample will be performed for all of the tranformers or whether a different drawing/sample will be performed for each transformer.",
+               defaut = "Same sample for all transformers",
+               ),
+
+  Transformer = SIMP(statut='o',typ=sd_transfo,max="**", homo="SansOrdreNiDoublon"),
+
+  Law = SIMP ( statut = "o", typ = "TXM",
+                into = ( #"Beta",
+                         #"Exponential",
+                         #"Gamma",
+                         #"Geometric",
+                         #"Gumbel",
+                         #"Histogram",
+                         #"Laplace",
+                         #"Logistic",
+                         #"LogNormal",
+                         #"MultiNomial",
+                         #"NonCentralStudent",
+                         #"Normal",
+                         #"Poisson",
+                         #"Rayleigh",
+                         #"Student",
+                         #"PDF_from_file",
+                         #"Triangular",
+                         #"TruncatedNormal",
+                         "TimeSeries_from_file",
+                         #"Uniform",
+                         "UserDefined",
+                         #"Weibull",
+                         ),
+                defaut="UserDefined",
+                fr = "Choix du type de la loi marginale",
+                ang = "1D marginal distribution",
+                ),
+
+
+#====
+# Definition des parametres selon le type de la loi
+#====
+
+##  NONPARAM = BLOC ( condition = " Law in ( 'NonParametrique', ) ",
+##
+##  FileName = SIMP ( statut = "o",
+##                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+##                    fr = "Nom du modele physique",
+##                    ang = "Physical model identifier",
+##                    ),
+##              ),
+
+#  BETA = BLOC ( condition = " Law in ( 'Beta', ) ",
+#
+#                  Settings = SIMP ( statut = "o",
+#                                       typ = "TXM",
+#                                       max = 1,
+#                                       into = ( "RT", "MuSigma" ),
+#                                       defaut = "RT",
+#                                       fr = "Parametrage de la loi beta",
+#                                       ang = "Beta distribution parameter set",
+#                                       ),
+#
+#                  RT_Parameters = BLOC ( condition = " Settings in ( 'RT', ) ",
+#
+#                                      R = SIMP ( statut = "o",
+#                                                 typ = "R",
+#                                                 max = 1,
+#                                                 val_min = 0.,
+#                                                 fr = "Parametre R de la loi | R > 0",
+#                                                 ang = "R parameter | R > 0",
+#                                                 ),
+#
+#                                      # T > R
+#                                      T = SIMP ( statut = "o",
+#                                                 typ = "R",
+#                                                 max = 1,
+#                                                 val_min = 0.,
+#                                                 fr = "Parametre T de la loi | T > R",
+#                                                 ang = "T parameter | T > R",
+#                                                 ),
+#
+#                                      ), # Fin BLOC RT_Parameters
+#
+#
+#                  MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
+#
+#                                      Mu = SIMP ( statut = "o",
+#                                                  typ = "R",
+#                                                  max = 1,
+#                                                  fr = "Moyenne de la loi",
+#                                                  ang = "Mean value",
+#                                                  ),
+#
+#                                      Sigma = SIMP ( statut = "o",
+#                                                     typ = "R",
+#                                                     max = 1,
+#                                                     val_min = 0.,
+#                                                     fr = "Ecart type de la loi",
+#                                                     ang = "Standard deviation",
+#                                                     ),
+#
+#                                      ), # Fin BLOC MuSigma_Parameters
+#
+#
+#                  A = SIMP ( statut = "o",
+#                             typ = "R",
+#                             max = 1,
+#                             fr = "Borne inferieure du support de la loi",
+#                             ang = "Support lower bound",
+#                             ),
+#
+#                  # B > A
+#                  B = SIMP ( statut = "o",
+#                             typ = "R",
+#                             max = 1,
+#                             fr = "Borne superieure du support de la loi",
+#                             ang = "Support upper bound",
+#                             ),
+#
+#  ), # Fin BLOC BETA
+
+
+
+  EXPONENTIAL = BLOC ( condition = " Law in ( 'Exponential', ) ",
+
+                         Lambda = SIMP ( statut = "o",
+                                         typ = "R",
+                                         max = 1,
+                                         val_min = 0.,
+                                         fr = "Parametre Lambda | Lambda > 0",
+                                         ang = "Lambda parameter | Lambda > 0",
+                                         ),
+
+                         Gamma = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne inferieure du support de la loi",
+                                        ang = "Support lower bound",
+                                        ),
+
+  ), # Fin BLOC EXPONENTIAL
+
+
+
+#  GAMMA = BLOC ( condition = " Law in ( 'Gamma', ) ",
+#
+#                   Settings = SIMP ( statut = "o",
+#                                        typ = "TXM",
+#                                        max = 1,
+#                                        into = ( "KLambda", "MuSigma" ),
+#                                        defaut = "KLambda",
+#                                        fr = "Parametrage de la loi gamma",
+#                                        ang = "Gamma distribution parameter set",
+#                                        ),
+#
+#                   KLambda_Parameters = BLOC ( condition = " Settings in ( 'KLambda', ) ",
+#
+#                                       K = SIMP ( statut = "o",
+#                                                  typ = "R",
+#                                                  max = 1,
+#                                                  val_min = 0.,
+#                                                  fr = "Parametre K de la loi | K > 0",
+#                                                  ang = "K parameter | K > 0",
+#                                                  ),
+#
+#                                       Lambda = SIMP ( statut = "o",
+#                                                       typ = "R",
+#                                                       max = 1,
+#                                                       val_min = 0.,
+#                                                       fr = "Parametre Lambda de la loi | Lambda > 0",
+#                                                       ang = "Lambda parameter | Lambda > 0",
+#                                                       ),
+#
+#                                       ), # Fin BLOC KLambda_Parameters
+#
+#
+#                   MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
+#
+#                                       Mu = SIMP ( statut = "o",
+#                                                   typ = "R",
+#                                                   max = 1,
+#                                                   fr = "Moyenne de la loi",
+#                                                   ang = "Mean value",
+#                                                   ),
+#
+#                                       Sigma = SIMP ( statut = "o",
+#                                                      typ = "R",
+#                                                      max = 1,
+#                                                      val_min = 0.,
+#                                                      fr = "Ecart type de la loi",
+#                                                      ang = "Standard deviation",
+#                                                      ),
+#
+#                                       ), # Fin BLOC MuSigma_Parameters
+#
+#                   Gamma = SIMP ( statut = "o",
+#                                  typ = "R",
+#                                  max = 1,
+#                                  fr = "Borne inferieure du supoport de la loi",
+#                                  ang = "Support lower bound",
+#                                  ),
+#
+#
+#  ), # Fin BLOC GAMMA
+
+
+#
+#  GEOMETRIC = BLOC ( condition = " Law in ( 'Geometric', ) ",
+#
+#                       P = SIMP ( statut = "o",
+#                                  typ = "R",
+#                                  max = 1,
+#                                  val_min = 0.,
+#                                  val_max = 1.,
+#                                  fr = "Parametre P | 0 < P < 1",
+#                                  ang = "P parameter | 0 < P < 1",
+#                                  ),
+#
+#  ), # Fin BLOC GEOMETRIC
+#
+#
+#
+#  GUMBEL = BLOC ( condition = " Law in ( 'Gumbel', ) ",
+#
+#                    Settings = SIMP ( statut = "o",
+#                                         typ = "TXM",
+#                                         max = 1,
+#                                         into = ( "AlphaBeta", "MuSigma" ),
+#                                         defaut = "AlphaBeta",
+#                                         fr = "Parametrage de la loi gumbel",
+#                                         ang = "Gumbel distribution parameter set",
+#                                         ),
+#
+#                    AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ",
+#
+#                                        Alpha = SIMP ( statut = "o",
+#                                                       typ = "R",
+#                                                       max = 1,
+#                                                       val_min = 0.,
+#                                                       fr = "Parametre Alpha de la loi | Alpha > 0",
+#                                                       ang = "Alpha parameter | Alpha > 0",
+#                                                       ),
+#
+#                                        Beta = SIMP ( statut = "o",
+#                                                      typ = "R",
+#                                                      max = 1,
+#                                                      fr = "Parametre Beta de la loi",
+#                                                      ang = "Beta parameter",
+#                                                      ),
+#
+#                                        ), # Fin BLOC AlphaBeta_Parameters
+#
+#
+#                    MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
+#
+#                                        Mu = SIMP ( statut = "o",
+#                                                    typ = "R",
+#                                                    max = 1,
+#                                                    fr = "Moyenne de la loi",
+#                                                    ang = "Mean value",
+#                                                    ),
+#
+#                                        Sigma = SIMP ( statut = "o",
+#                                                       typ = "R",
+#                                                       max = 1,
+#                                                       val_min = 0.,
+#                                                       fr = "Ecart type de la loi",
+#                                                       ang = "Standard deviation",
+#                                                       ),
+#
+#                                        ), # Fin BLOC MuSigma_Parameters
+#
+#  ), # Fin BLOC GUMBEL
+
+
+
+  HISTOGRAM = BLOC ( condition = " Law in ( 'Histogram', ) ",
+
+                       First = SIMP ( statut = "o",
+                                    typ = "R",
+                                    max = 1,
+                                    fr = "Borne inferieure du supoport de la loi",
+                                    ang = "Support lower bound",
+                                    ),
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : largeur de classe, hauteur de classe",
+                                       ang = "Class bandwidth, class height couple list",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       ),
+
+  ), # Fin BLOC HISTOGRAM
+
+
+
+#  LAPLACE = BLOC ( condition = " Law in ( 'Laplace', ) ",
+#
+#                   Lambda = SIMP ( statut = "o",
+#                                   typ = "R",
+#                                   max = 1,
+#                                   val_min = 0.,
+#                                   fr = "Parametre Lambda | Lambda > 0",
+#                                   ang = "Lambda parameter | Lambda > 0",
+#                                   ),
+#
+#                   Mu = SIMP ( statut = "o",
+#                               typ = "R",
+#                               max = 1,
+#                               fr = "Moyenne de la loi",
+#                               ang = "Mean value",
+#                              ),
+#
+#  ), # Fin BLOC LAPLACE
+#
+#  LOGNORMAL = BLOC ( condition = " Law in ( 'LogNormal', ) ",
+#
+#                     Settings = SIMP ( statut = "o",
+#                                       typ = "TXM",
+#                                       max = 1,
+#                                       into = ( "MuSigmaLog", "MuSigma", "MuSigmaOverMu" ),
+#                                       defaut = "MuSigmaLog",
+#                                       fr = "Parametrage de la loi lognormale",
+#                                       ang = "Lognormal distribution parameter set",
+#                                       ),
+#
+#                     MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
+#
+#                                                 Mu = SIMP ( statut = "o",
+#                                                             typ = "R",
+#                                                             max = 1,
+#                                                             fr = "Moyenne de la loi",
+#                                                             ang = "Mean value",
+#                                                             ),
+#
+#                                                 Sigma = SIMP ( statut = "o",
+#                                                                typ = "R",
+#                                                                max = 1,
+#                                                                val_min = 0.,
+#                                                                fr = "Ecart type de la loi",
+#                                                                ang = "Standard deviation",
+#                                                                ),
+#
+#                                                 ), # Fin BLOC MuSigma_Parameters
+#
+#                     MuSigmaOverMu_Parameters = BLOC ( condition = " Settings in ( 'MuSigmaOverMu', ) ",
+#
+#                                                 Mu = SIMP ( statut = "o",
+#                                                             typ = "R",
+#                                                             max = 1,
+#                                                             fr = "Moyenne de la loi",
+#                                                             ang = "Mean value",
+#                                                             ),
+#
+#                                                 SigmaOverMu = SIMP ( statut = "o",
+#                                                                typ = "R",
+#                                                                max = 1,
+#                                                                val_min = 0.,
+#                                                                fr = "Rapport ecart type / moyenne de la loi",
+#                                                                ang = "Standard deviation / mean value ratio",
+#                                                                ),
+#
+#                                                 ), # Fin BLOC MuSigmaOverMu_Parameters
+#
+#                     MuSigmaLog_Parameters = BLOC ( condition = " Settings in ( 'MuSigmaLog', ) ",
+#
+#                                                    MuLog = SIMP ( statut = "o",
+#                                                                   typ = "R",
+#                                                                   max = 1,
+#                                                                   fr = "Moyenne du log",
+#                                                                   ang = "Log mean value",
+#                                                                   ),
+#
+#                                                    SigmaLog = SIMP ( statut = "o",
+#                                                                      typ = "R",
+#                                                                      max = 1,
+#                                                                      val_min = 0.,
+#                                                                      fr = "Ecart type du log",
+#                                                                      ang = "Log standard deviation",
+#                                                                      ),
+#
+#                                                    ), # Fin BLOC MuSigmaLog_Parameters
+#
+#                     Gamma = SIMP ( statut = "o",
+#                                    typ = "R",
+#                                    max = 1,
+#                                    fr = "Borne inferieure du support de la loi",
+#                                    ang = "Support lower bound",
+#                                    ),
+#
+#   ), # Fin BLOC LOGNORMAL
+#
+#
+#
+#   LOGISTIC = BLOC ( condition = " Law in ( 'Logistic', ) ",
+#
+#                       Alpha = SIMP ( statut = "o",
+#                                      typ = "R",
+#                                      max = 1,
+#                                      fr = "Borne inferieure du supoport de la loi",
+#                                      ang = "Support lower bound",
+#                                      ),
+#
+#                       Beta = SIMP ( statut = "o",
+#                                     typ = "R",
+#                                     max = 1,
+#                                     val_min = 0.,
+#                                     fr = "Parametre Beta de la loi | Beta > 0",
+#                                     ang = "Beta parameter | Beta > 0",
+#                                     ),
+#
+#   ), # Fin BLOC LOGISTIC
+#
+#
+#
+#   MULTINOMIAL = BLOC ( condition = " Law in ( 'MultiNomial', ) ",
+#
+#                         N = SIMP ( statut = "o",
+#                                    typ = "I",
+#                                    max = 1,
+#                                    fr = "Parametre N de la loi | N > 0",
+#                                    ang = "N parameter | N > 0",
+#                                    ),
+#
+#                       # Il faut definir une collection de couples ( x,p )
+#                       Values = SIMP ( statut = 'o',
+#                                       typ = "R",
+#                                       max = '**',
+#                                       fr = "Liste de probabilit�s",
+#                                       ang = "Probability list",
+#                                       validators=VerifTypeTuple(('R','R')),
+#                                       ),
+#
+#   ), # Fin BLOC MULTINOMIAL
+#
+#
+#  NONCENTRALSTUDENT = BLOC ( condition = " Law in ( 'NonCentralStudent', ) ",
+#
+#                   Nu = SIMP ( statut = "o",
+#                               typ = "R",
+#                               max = 1,
+#                               fr = "Parametre Nu de la loi | Nu > 0",
+#                               ang = "Nu parameter | Nu > 0",
+#                              ),
+#
+#                   Delta = SIMP ( statut = "o",
+#                                  typ = "R",
+#                                  max = 1,
+#                                  fr = "Parametre Delta de la loi | Delta > 0",
+#                                  ang = "Delta parameter | Delta > 0",
+#                                  ),
+#
+#                   Gamma = SIMP ( statut = "o",
+#                                  typ = "R",
+#                                  max = 1,
+#                                  fr = "Parametre Gamma de centrage de la loi",
+#                                  ang = "Gamma parameter",
+#                                  ),
+#
+#  ), # Fin BLOC NONCENTRALSTUDENT
+
+
+   NORMAL = BLOC ( condition = " Law in ( 'Normal', ) ",
+
+                    Mu = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Moyenne de la loi",
+                                ang = "Mean value",
+                                ),
+
+                   Sigma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  val_min = 0.,
+                                  fr = "Ecart type de la loi",
+                                  ang = "Standard deviation",
+                                  ),
+
+   ), # Fin BLOC NORMAL
+
+
+#
+#   POISSON = BLOC ( condition = " Law in ( 'Poisson', ) ",
+#
+#                     Lambda = SIMP ( statut = "o",
+#                                     typ = "R",
+#                                     max = 1,
+#                                     val_min = 0.,
+#                                     fr = "Parametre Lambda de la loi | Lambda > 0",
+#                                     ang = "Lambda parameter | Lambda > 0",
+#                                     ),
+#
+#   ), # Fin BLOC POISSON
+#
+#
+#
+#  RAYLEIGH = BLOC ( condition = " Law in ( 'Rayleigh', ) ",
+#
+#                   Sigma = SIMP ( statut = "o",
+#                                  typ = "R",
+#                                  max = 1,
+#                                  fr = "Parametre Sigma de la loi | Sigma > 0",
+#                                  ang = "Sigma parameter | Sigma > 0",
+#                                  ),
+#
+#                   Gamma = SIMP ( statut = "o",
+#                                  typ = "R",
+#                                  max = 1,
+#                                  fr = "Borne inferieure du support de la loi",
+#                                  ang = "Support lower bound",
+#                                  ),
+# ), # Fin BLOC RAYLEIGH
+
+  PDF = BLOC ( condition = " Law in ( 'PDF_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Nom du fichier .csv",
+                    ang = ".csv file name",
+                    ),
+              ),
+
+#   STUDENT = BLOC ( condition = " Law in ( 'Student', ) ",
+#
+#                     Mu = SIMP ( statut = "o",
+#                                 typ = "R",
+#                                 max = 1,
+#                                 fr = "Parametre Mu de la loi",
+#                                 ang = "Mu parameter",
+#                                 ),
+#
+#                     Nu = SIMP ( statut = "o",
+#                                 typ = "R",
+#                                 max = 1,
+#                                 val_min = 2.,
+#                                 fr = "Parametre Nu de la loi | Nu > 2",
+#                                 ang = "Nu parameter | Nu > 2",
+#                                 ),
+#
+#                   Sigma = SIMP ( statut = "o",
+#                                  typ = "R",
+#                                  max = 1,
+#                                  fr = "Parametre Sigma de la loi",
+#                                  ang = "Sigma parameter",
+#                                  ),
+#
+#   ), # Fin BLOC STUDENT
+#
+#
+#
+#   TRIANGULAR = BLOC ( condition = " Law in ( 'Triangular', ) ",
+#
+#                         A = SIMP ( statut = "o",
+#                                    typ = "R",
+#                                    max = 1,
+#                                    fr = "Borne inferieure du support de la loi | A < M < B",
+#                                    ang = "Support lower bound | A < M < B",
+#                                    ),
+#
+#                         M = SIMP ( statut = "o",
+#                                    typ = "R",
+#                                    max = 1,
+#                                    fr = "Mode de la loi | A < M < B",
+#                                    ang = "Mode | A < M < B",
+#                                    ),
+#
+#                         B = SIMP ( statut = "o",
+#                                    typ = "R",
+#                                    max = 1,
+#                                    fr = "Borne superieure du support de la loi | A < M < B",
+#                                    ang = "Support upper bound | A < M < B",
+#                                    ),
+#
+#   ), # Fin BLOC TRIANGULAR
+#
+#
+
+   TRUNCATEDNORMAL = BLOC ( condition = " Law in ( 'TruncatedNormal', ) ",
+
+                             MuN = SIMP ( statut = "o",
+                                          typ = "R",
+                                          max = 1,
+                                          fr = "Moyenne de la loi Normale non tronqu�e",
+                                          ang = "Mean value of the associated non truncated normal distribution",
+                                          ),
+
+                             SigmaN = SIMP ( statut = "o",
+                                             typ = "R",
+                                             max = 1,
+                                             val_min = 0.,
+                                             fr = "Ecart-type de la loi Normale non tronqu�e",
+                                             ang = "Standard deviation of the associated non truncated normal distribution",
+                                             ),
+
+                             A = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne inferieure de la loi | A < B",
+                                        ang = "Lower bound | A < B",
+                                        ),
+
+                             B = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne superieure de la loi | A < B",
+                                        ang = "Upper bound | A < B",
+                                        ),
+
+   ), # Fin BLOC TRUNCATEDNORMAL
+
+
+  TimeSeries = BLOC ( condition = " Law in ( 'TimeSeries_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Fichier CSV d'une serie temporelle",
+                    ang = "CSV file of a time series",
+                    ),
+              ),
+
+
+   UNIFORM = BLOC ( condition = " Law in ( 'Uniform', ) ",
+
+                     A = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Borne inferieure du support de la loi | A < B",
+                                ang = "Support lower bound | A < B",
+                                ),
+
+                     B = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Borne superieure du support de la loi | A < B",
+                                ang = "Support upper bound | A < B",
+                                ),
+
+   ), # Fin BLOC UNIFORM
+
+
+   USERDEFINED = BLOC ( condition = " Law in ( 'UserDefined', ) ",
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : (valeur, probabilite)",
+                                       ang = "List of pairs : (value, probability)",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       defaut=((0,0.0),(1,1.0)),
+                                       ),
+
+  ), # Fin BLOC USERDEFINED
+
+
+   WEIBULL = BLOC ( condition = " Law in ( 'Weibull', ) ",
+
+                     Settings = SIMP ( statut = "o",
+                                          typ = "TXM",
+                                          max = 1,
+                                          into = ( "AlphaBeta", "MuSigma" ),
+                                          defaut = "AlphaBeta",
+                                          fr = "Parametrage de la loi weibull",
+                                          ang = "Weibull distribution parameter set",
+                                          ),
+
+                     AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ",
+
+                                         Alpha = SIMP ( statut = "o",
+                                                        typ = "R",
+                                                        max = 1,
+                                                        val_min = 0.,
+                                                        fr = "Parametre Alpha de la loi | Alpha > 0",
+                                                        ang = "Alpha parameter | Alpha > 0",
+                                                        ),
+
+                                         Beta = SIMP ( statut = "o",
+                                                       typ = "R",
+                                                       max = 1,
+                                                       val_min = 0.,
+                                                       fr = "Parametre Beta de la loi | Beta > 0",
+                                                       ang = "Beta parameter | Beta > 0",
+                                                       ),
+
+                                         ), # Fin BLOC AlphaBeta_Parameters
+
+
+                     MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
+
+                                         Mu = SIMP ( statut = "o",
+                                                     typ = "R",
+                                                     max = 1,
+                                                     fr = "Moyenne de la loi",
+                                                     ang = "Mean value",
+                                                     ),
+
+                                         Sigma = SIMP ( statut = "o",
+                                                        typ = "R",
+                                                        max = 1,
+                                                        val_min = 0.,
+                                                        fr = "Ecart type de la loi",
+                                                        ang = "Standard deviation",
+                                                        ),
+
+                                         ), # Fin BLOC MuSigma_Parameters
+
+                     Gamma = SIMP ( statut = "o",
+                                    typ = "R",
+                                    max = 1,
+                                    fr = "Borne inferieure du support de la loi",
+                                    ang = "Support lower bound",
+                                    ),
+
+    ), # Fin BLOC WEIBULL
+
+
+
+  ), #fin du bloc transformer
+
+
+)
+
+#Classement_Commandes_Ds_Arbre=('DIRECTORY', 'DISTRIBUTION', 'CORRELATION')       
+Classement_Commandes_Ds_Arbre=('DIRECTORY', 'PSSE_PARAMETERS', 'SIMULATION', 'DISTRIBUTION', 'CORRELATION','N_1_GENERATORS', 'N_1_LINES', 'N_1_TRANSFORMERS', 'N_1_LOADS','N_1_MOTORS') 
+
+Ordre_Des_Commandes = ( 'DIRECTORY', 'PSSE_PARAMETERS', 'SIMULATION', 'DISTRIBUTION', 'CORRELATION',
+                        'N_1_GENERATORS', 'N_1_LINES', 'N_1_TRANSFORMERS', 'N_1_LOADS','N_1_MOTORS')
diff --git a/PSSE_PF_Eficas/PSEN_Cata_PF.py b/PSSE_PF_Eficas/PSEN_Cata_PF.py
new file mode 100644 (file)
index 0000000..34c0482
--- /dev/null
@@ -0,0 +1,2446 @@
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2013   EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+# --------------------------------------------------
+# debut entete
+# --------------------------------------------------
+
+#from Accas import ASSD, JDC_CATA, AU_MOINS_UN, PROC, SIMP, FACT, OPER, MACRO, BLOC, A_VALIDATOR
+from Accas import *
+import opsPSEN_PF
+
+class loi      ( ASSD ) : pass
+class variable ( ASSD ) : pass
+class sd_charge     ( ASSD ) : pass
+class sd_generateur ( ASSD ) : pass
+class sd_ligne     ( ASSD ) : pass
+class sd_transfo ( ASSD ) : pass
+class sd_moteur (ASSD) : pass
+#class sd_busbar ( sd_generateur,sd_charge ) : pass
+
+import types
+class Tuple:
+  def __init__(self,ntuple):
+    self.ntuple=ntuple
+
+  def __convert__(self,valeur):
+    if type(valeur) == types.StringType:
+      return None
+    if len(valeur) != self.ntuple:
+      return None
+    return valeur
+
+  def info(self):
+    return "Tuple de %s elements" % self.ntuple
+
+  __repr__=info
+  __str__=info
+
+class Matrice:
+  def __init__(self,nbLigs=None,nbCols=None,methodeCalculTaille=None,formatSortie="ligne",valSup=None,valMin=None,structure=None):
+      self.nbLigs=nbLigs
+      self.nbCols=nbCols
+      self.methodeCalculTaille=methodeCalculTaille
+      self.formatSortie=formatSortie
+      self.valSup=valSup
+      self.valMin=valMin
+      self.structure=structure
+
+  def __convert__(self,valeur):
+    # Attention ne verifie pas grand chose
+    if type(valeur) != types.ListType :
+      return None
+    return valeur
+
+  def info(self):
+      return "Matrice %s x %s" % (self.nbLigs, self.nbCols)
+
+      __repr__=info
+      __str__=info
+
+
+#CONTEXT.debug = 1
+JdC = JDC_CATA ( code = 'PSEN',
+                 execmodul = None,
+                 regles = ( AU_MOINS_UN ( 'PF_PARAMETERS' ),
+                            AU_MOINS_UN ( 'DIRECTORY' ),
+                            AU_MOINS_UN ( 'DISTRIBUTION' ),
+                            AU_MOINS_UN ( 'SIMULATION' ),
+                            AU_PLUS_UN ( 'PF_PARAMETERS' ),
+                            AU_PLUS_UN ( 'DIRECTORY' ),
+                            AU_PLUS_UN ( 'SIMULATION' ),
+                            AU_PLUS_UN ( 'CORRELATION' ),
+                            AU_PLUS_UN ( 'N_1_GENERATORS' ),
+                            AU_PLUS_UN ( 'N_1_LINES' ),
+                            AU_PLUS_UN ( 'N_1_LOADS' ),
+                            AU_PLUS_UN ( 'N_1_MOTORS' ),
+                            AU_PLUS_UN ( 'N_1_TRANSFORMERS' ),
+
+                            ),
+                 ) # Fin JDC_CATA
+
+
+# --------------------------------------------------
+# fin entete
+# --------------------------------------------------
+
+MONGENER =  OPER ( nom = "MONGENER",
+            sd_prod = sd_generateur,
+            UIinfo = {"groupes": ("CACHE")},
+            op = None,
+            fr = "Generateur",
+            ang = "Generator",
+
+  ID = SIMP ( statut = 'o', typ = "TXM", fr = "num bus", ang = "num bus",),
+)
+MONMOTEUR =  OPER ( nom = "MONMOTEUR",
+            sd_prod = sd_moteur,
+            UIinfo = {"groupes": ("CACHE")},
+            op = None,
+            fr = "Moteur",
+            ang = "Motor",
+
+  ID = SIMP ( statut = 'o', typ = "TXM", fr = "num bus", ang = "num bus",),
+)
+
+MACHARGE =  OPER ( nom = "MACHARGE",
+            sd_prod = sd_charge,
+            UIinfo = {"groupes": ("CACHE")},
+            op = None,
+            fr = "Charge",
+            ang = "Load",
+
+  ID = SIMP ( statut = 'o', typ = "TXM", fr = "nom charge", ang = "load name",),
+)
+MALIGNE =  OPER ( nom = "MALIGNE",
+            sd_prod = sd_ligne,
+            UIinfo = {"groupes": ("CACHE")},
+            op = None,
+            fr = "Ligne",
+            ang = "Line",
+
+  ID = SIMP ( statut = 'o', typ = "TXM", fr = "nom ligne", ang = "line name",),
+)
+MONTRANSFO =  OPER ( nom = "MONTRANSFO",
+            sd_prod = sd_transfo,
+            UIinfo = {"groupes": ("CACHE")},
+            op = None,
+            fr = "Transformateur",
+            ang = "Transformer",
+
+  ID = SIMP ( statut = 'o', typ = "TXM", fr = "nom transformateur", ang = "transformer name",),
+)
+
+
+
+PF_PARAMETERS = PROC ( nom = "PF_PARAMETERS", op=None, docu = "",
+        ALGORITHM = SIMP ( statut = "o",typ='TXM', into=["Optimum Power Flow"], defaut="Optimum Power Flow", ),
+        # I_MAX=SIMP(statut="o",typ='TXM',into=['RateA', 'RateB', 'RateC'],defaut='RateA',),
+        LOCK_TAPS = SIMP ( statut = "o", typ=bool, defaut=True, ),
+        b_OPF = BLOC (condition = "ALGORITHM == 'Optimum Power Flow'",
+                OBJECTIVE_FUNCTION=SIMP(statut="o",typ='TXM',into=['MINIMISATION_OF_COST','LOADSHEDDING_COSTS','MINIMISATION_OF_LOSSES','MAXIMISATION_MVAR_RESERVE'],defaut='MINIMISATION_OF_COST',),
+                ITERATION_INTERIOR = SIMP ( statut = "o",typ = "I",val_min=1,defaut=700,),
+                NON_COST_OPTIMAL_SOLUTION_ALLOWED=SIMP(statut="o",typ=bool,defaut=True, ),
+                LOAD_SHEDDING_ALLOWED=SIMP(statut="o",typ=bool,defaut=True, ),
+                LS_Q_CONVERGENCE_CRITERIA=SIMP(statut="o",typ=bool,defaut=False,
+                        fr = "Determine quel critère de convergence est utilisé--celui basé sur le quantité de delestage et la puissance reactive modifiée au niveau des shunt, ou celui basé sur la tension moyenne des buses et le flux des branches.",
+                        ang = "Determines which convergence criteria is used--one based on added load-shedding and shunt reactive power, or one based on average bus voltages and branch flows",
+                                               ),
+                UNIT_COMMITMENT = SIMP ( statut = "o", typ = bool,defaut = True,
+                        fr = "Premiere passe de l'OPF pour determiner quels groupes doivent Ãªtre connectes. Deconnecter les autres.",
+                        ang = "First OPF to determine which units should be run; others are disconnected.",),
+                # b_UnitCommitment = BLOC (condition = "UNIT_COMMITMENT == True",
+                #         SAVE_CASE_BEFORE_UNIT_COMMITMENT = SIMP ( statut = "o",typ = bool,defaut = False,
+                #         fr = "Sauvegarder des fichiers de cas avant d'avoir deconnecte les groupes ne produisant pas de la puissance active",
+                #         ang = "Save network case files before having disconnected groups that dont generate active power.",),),
+                      ),
+        DECIMAL_SEPARATOR = SIMP(statut="o",typ='TXM',into=[',','.'],defaut='.',),
+        )
+
+SIMULATION = PROC ( nom = "SIMULATION", op = None, docu = "",
+                    regles             =(EXCLUS('NUMBER_PACKAGE','CONVERGENCE'), UN_PARMI('NUMBER_PACKAGE','CONVERGENCE'),),
+         SIZE_PACKAGE = SIMP ( statut = "o",  typ = "I",    val_min=1, defaut=10,  ),
+         NUMBER_PACKAGE = SIMP ( statut = "f",typ = "I",  val_min=1, ),
+         CONVERGENCE = SIMP ( statut = "f",   typ="I",  into=[1], ),)
+
+
+#================================
+# Definition du modele physique
+#================================
+
+
+
+CORRELATION = PROC ( nom = 'CORRELATION',
+                     op = None,
+                     docu = "",
+                     fr = "Correlation entre variables",
+                     ang = "Variable correlation",
+
+####  Copula = SIMP ( statut = "o",
+####                  typ = 'TXM',
+####                  into = ( "Independent", "Normal" ),
+####                  defaut = "Independent",
+####                  fr = "Type de la copule",
+####                  ang = "Copula kind",
+####                  ),
+##
+## # Matrix = BLOC ( condition = "Copula in ( 'Normal', )",
+##
+    CorrelationMatrix = SIMP ( statut = "o",
+                               typ = Matrice(nbLigs=None,
+                                             nbCols=None,
+                                             methodeCalculTaille='NbDeDistributions',
+                                             structure="symetrique"),
+                               fr = "Matrice de correlation entre les variables d'entree",
+                               ang = "Correlation matrix for input variables",
+                               #val_max=1.0,
+                               #val_min=-1.0
+                               ),
+##  #), # Fin BLOC Matrix
+##
+##
+)
+
+DIRECTORY = MACRO ( nom = 'DIRECTORY',
+        op=None,
+        fr = "Chargement des directoires et fichiers",
+        ang = "Load directories and files necessary to run PSEN",
+                sd_prod = opsPSEN_PF.INCLUDE,
+                op_init = opsPSEN_PF.INCLUDE_context,
+                #sd_prod=None,
+                fichier_ini = 1,
+
+        PF_path=SIMP(statut="o",typ='Repertoire',defaut=r'C:\Program Files\DIgSILENT\PowerFactory 2017 SP1\Python\3.5'),
+        pfd_file=SIMP(statut="o", typ = ('Fichier', 'Network Case Files (*.pfd);;All Files (*)',),),
+        results_folder=SIMP(statut="o",typ='Repertoire'),#,defaut=r'C:\Users\VN38270N\Documents\ResultatSim'),
+        Python3_path=SIMP(statut="o",typ='Repertoire',defaut=r'C:\Anaconda3'),
+        #lines_file=SIMP(statut="o" ,typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),),
+        #groups_file=SIMP(statut="o", typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),),
+        #generationsystem_file=SIMP(statut="o" ,typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),),
+
+)
+
+
+
+#================================
+# Importation des fichiers csv N-1
+#================================
+
+N_1_LINES = PROC( nom="N_1_LINES",
+                     op = None,
+                     docu = "",
+                     fr = "N-1 lignes",
+                     ang = "N-1 lines",
+  Activated = SIMP ( statut='o', typ=bool, defaut=True),
+##  FileName = SIMP ( statut = "o",
+##                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+##                    fr = "chemin du fichier csv des probabilites des defauts lignes",
+##                    ang = "csv file path with probabilities of line outages",
+##                    ),
+  Probability = SIMP ( statut = 'o',
+                       typ = Tuple(2),
+                       max = '**',
+                       fr = "Probabilite d'indisponibilite de la ligne",
+                       ang = "Probability that the line is not available",
+                       validators=VerifTypeTuple((sd_ligne,'R')),),
+              )
+
+N_1_TRANSFORMERS = PROC( nom="N_1_TRANSFORMERS",
+                     op = None,
+                     docu = "",
+                     fr = "N-1 transformateurs",
+                     ang = "N-1 transformers",
+  Activated = SIMP ( statut='o', typ=bool, defaut=True),
+##  FileName = SIMP ( statut = "o",
+##                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+##                    fr = "chemin du fichier csv des probabilites des defauts transformateur",
+##                    ang = "csv file path with probabilities of transformer outages",
+##                    ),
+  Probability = SIMP ( statut = 'o',
+                       typ = Tuple(2),
+                       max = '**',
+                       fr = "Probabilite d'indisponibilite de la ligne",
+                       ang = "Probability that the line is not available",
+                       validators=VerifTypeTuple((sd_transfo,'R')),),
+              )
+N_1_GENERATORS = PROC( nom="N_1_GENERATORS",
+                     op = None,
+                     docu = "",
+                     fr = "N-1 generateurs",
+                     ang = "N-1 generators",
+  Activated = SIMP ( statut='o', typ=bool, defaut=True),
+##  FileName = SIMP ( statut = "o",
+##                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+##                    fr = "chemin du fichier csv des probabilites des defauts generateurs",
+##                    ang = "csv file path with probabilities of generator outages",
+##                    ),
+  Probability = SIMP ( statut = 'o',
+                       typ = Tuple(2),
+                       max = '**',
+                       fr = "Probabilite d'indisponibilite du generateur",
+                       ang = "Probability that the generator is not available",
+                       validators=VerifTypeTuple((sd_generateur,'R')),),
+              )
+N_1_MOTORS = PROC( nom="N_1_MOTORS",
+                     op = None,
+                     docu = "",
+                     fr = "N-1 moteurs",
+                     ang = "N-1 motors",
+  Activated = SIMP ( statut='o', typ=bool, defaut=True),
+##  FileName = SIMP ( statut = "o",
+##                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+##                    fr = "chemin du fichier csv des probabilites des defauts generateurs",
+##                    ang = "csv file path with probabilities of generator outages",
+##                    ),
+  Probability = SIMP ( statut = 'o',
+                       typ = Tuple(2),
+                       max = '**',
+                       fr = "Probabilite d'indisponibilite du moteur",
+                       ang = "Probability that the motor is not available",
+                       validators=VerifTypeTuple((sd_moteur,'R')),),
+              )
+N_1_LOADS = PROC( nom="N_1_LOADS",
+                     op = None,
+                     docu = "",
+                     fr = "N-1 charges",
+                     ang = "N-1 loads",
+  Activated = SIMP ( statut='o', typ=bool, defaut=True),
+##  FileName = SIMP ( statut = "o",
+##                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+##                    fr = "chemin du fichier csv des probabilites des defauts charges",
+##                    ang = "csv file path with probabilities of load outages",
+##                    ),
+  Probability = SIMP ( statut = 'o',
+                       typ = Tuple(2),
+                       max = '**',
+                       fr = "Probabilite d'indisponibilite du generateur",
+                       ang = "Probability that the generator is not available",
+                       validators=VerifTypeTuple((sd_charge,'R')),),
+              )
+
+
+
+
+#================================
+# Definition des LOIS
+#================================
+
+# Nota : les variables de type OPER doivent etre en majuscules !
+# Nota : les variables de type OPER doivent etre de premier niveau (pas imbriquees dans un autre type)
+DISTRIBUTION = OPER ( nom = "DISTRIBUTION",
+                      sd_prod = loi,
+                      op = 68,
+                      fr = "Definitions des lois marginales utilisees par les variables d'entree",
+
+#====
+# Choisir generateur ou charge
+#====
+
+##  TypeMachine = SIMP ( statut='o', typ='TXM',
+##                      into = ('charge','vent1','vent2','pv','N-1',),
+##                      ),
+  Activated = SIMP ( statut='o', typ=bool, defaut=True),
+  ComponentType = SIMP (statut='o', typ='TXM',
+                      into = ('Generator','Load','Motor','Line','Transformer'),),
+  b_gener = BLOC (condition = "ComponentType == 'Generator'",
+
+  Type = SIMP (statut= "o", typ = "TXM",
+               into = ("Generator Power Level", "Generator Unavailability"),
+               fr = "Choisir si c'est le niveau de puissance ou la indisponibilit� du generateur qui sera tiree",
+               ang= "Choose whether the power level or the unavailability of the generator will be set by the law",
+               defaut = "Generator Power Level",
+               ),
+
+  Sampling = SIMP (statut= "o", typ = "TXM",
+               into = ("Same sample for all generators", "One sample per generator"),
+               fr = "Choisir si une seule tirage sera fait pour tous les generateurs ou si des tirages differents seront faits pour chaque generateur",
+               ang= "Choose whether one drawing/sample will be performed for all of the generators or whether a different drawing/sample will be performed for each generator.",
+               defaut = "Same sample for all generators",
+               ),
+
+  Generator   = SIMP(statut='o',typ=sd_generateur,max="**", homo="SansOrdreNiDoublon"),
+
+#====
+# Type de distribution
+#====
+
+  b_gener_level = BLOC (condition= "Type == 'Generator Power Level'",
+
+  Law = SIMP ( statut = "o", typ = "TXM",
+                into = ( "Exponential",
+                         "Histogram",
+                         "Normal",
+                         #"Rayleigh",
+                         "PDF_from_file",
+                         "TruncatedNormal",
+                         "TimeSeries_from_file",
+                         "Uniform",
+                         "UserDefined",
+                         "Weibull",
+                         ),
+                fr = "Choix du type de la loi marginale",
+                ang = "1D marginal distribution",
+                ),
+
+
+#====
+# Definition des parametres selon le type de la loi
+#====
+
+
+  EXPONENTIAL = BLOC ( condition = " Law in ( 'Exponential', ) ",
+
+                         Lambda = SIMP ( statut = "o",
+                                         typ = "R",
+                                         max = 1,
+                                         val_min = 0.,
+                                         fr = "Parametre Lambda | Lambda > 0",
+                                         ang = "Lambda parameter | Lambda > 0",
+                                         ),
+
+                         Gamma = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne inferieure du support de la loi",
+                                        ang = "Support lower bound",
+                                        ),
+
+  ), # Fin BLOC EXPONENTIAL
+
+
+  HISTOGRAM = BLOC ( condition = " Law in ( 'Histogram', ) ",
+
+                       First = SIMP ( statut = "o",
+                                    typ = "R",
+                                    max = 1,
+                                    fr = "Borne inferieure du supoport de la loi",
+                                    ang = "Support lower bound",
+                                    ),
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : largeur de classe, hauteur de classe",
+                                       ang = "Class bandwidth, class height couple list",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       ),
+
+  ), # Fin BLOC HISTOGRAM
+
+
+   NORMAL = BLOC ( condition = " Law in ( 'Normal', ) ",
+
+                    Mu = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Moyenne de la loi",
+                                ang = "Mean value",
+                                ),
+
+                   Sigma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  val_min = 0.,
+                                  fr = "Ecart type de la loi",
+                                  ang = "Standard deviation",
+                                  ),
+
+   ), # Fin BLOC NORMAL
+
+
+  RAYLEIGH = BLOC ( condition = " Law in ( 'Rayleigh', ) ",
+
+                   Sigma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  fr = "Parametre Sigma de la loi | Sigma > 0",
+                                  ang = "Sigma parameter | Sigma > 0",
+                                  ),
+
+                   Gamma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  fr = "Borne inferieure du support de la loi",
+                                  ang = "Support lower bound",
+                                  ),
+ ), # Fin BLOC RAYLEIGH
+
+  PDF = BLOC ( condition = " Law in ( 'PDF_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Nom du fichier .csv",
+                    ang = ".csv file name",
+                    ),
+              ),
+
+
+
+   TRUNCATEDNORMAL = BLOC ( condition = " Law in ( 'TruncatedNormal', ) ",
+
+                             MuN = SIMP ( statut = "o",
+                                          typ = "R",
+                                          max = 1,
+                                          fr = "Moyenne de la loi Normale non tronqu�e",
+                                          ang = "Mean value of the associated non truncated normal distribution",
+                                          ),
+
+                             SigmaN = SIMP ( statut = "o",
+                                             typ = "R",
+                                             max = 1,
+                                             val_min = 0.,
+                                             fr = "Ecart-type de la loi Normale non tronqu�e",
+                                             ang = "Standard deviation of the associated non truncated normal distribution",
+                                             ),
+
+                             A = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne inferieure de la loi | A < B",
+                                        ang = "Lower bound | A < B",
+                                        ),
+
+                             B = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne superieure de la loi | A < B",
+                                        ang = "Upper bound | A < B",
+                                        ),
+
+   ), # Fin BLOC TRUNCATEDNORMAL
+
+
+  TimeSeries = BLOC ( condition = " Law in ( 'TimeSeries_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Fichier CSV d'une serie temporelle",
+                    ang = "CSV file of a time series",
+                    ),
+              ),
+
+
+   UNIFORM = BLOC ( condition = " Law in ( 'Uniform', ) ",
+
+                     A = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Borne inferieure du support de la loi | A < B",
+                                ang = "Support lower bound | A < B",
+                                ),
+
+                     B = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Borne superieure du support de la loi | A < B",
+                                ang = "Support upper bound | A < B",
+                                ),
+
+   ), # Fin BLOC UNIFORM
+
+
+   USERDEFINED = BLOC ( condition = " Law in ( 'UserDefined', ) ",
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : (valeur, prob.)",
+                                       ang = "List of pairs : (value, prob.)",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       ),
+
+  ), # Fin BLOC USERDEFINED
+
+
+   WEIBULL = BLOC ( condition = " Law in ( 'Weibull', ) ",
+
+                     Settings = SIMP ( statut = "o",
+                                          typ = "TXM",
+                                          max = 1,
+                                          into = ( "AlphaBeta", "MuSigma" ),
+                                          defaut = "AlphaBeta",
+                                          fr = "Parametrage de la loi weibull",
+                                          ang = "Weibull distribution parameter set",
+                                          ),
+
+                     AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ",
+
+                                         Alpha = SIMP ( statut = "o",
+                                                        typ = "R",
+                                                        max = 1,
+                                                        val_min = 0.,
+                                                        fr = "Parametre Alpha de la loi | Alpha > 0",
+                                                        ang = "Alpha parameter | Alpha > 0",
+                                                        ),
+
+                                         Beta = SIMP ( statut = "o",
+                                                       typ = "R",
+                                                       max = 1,
+                                                       val_min = 0.,
+                                                       fr = "Parametre Beta de la loi | Beta > 0",
+                                                       ang = "Beta parameter | Beta > 0",
+                                                       ),
+
+                                         ), # Fin BLOC AlphaBeta_Parameters
+
+
+                     MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
+
+                                         Mu = SIMP ( statut = "o",
+                                                     typ = "R",
+                                                     max = 1,
+                                                     fr = "Moyenne de la loi",
+                                                     ang = "Mean value",
+                                                     ),
+
+                                         Sigma = SIMP ( statut = "o",
+                                                        typ = "R",
+                                                        max = 1,
+                                                        val_min = 0.,
+                                                        fr = "Ecart type de la loi",
+                                                        ang = "Standard deviation",
+                                                        ),
+
+                                         ), # Fin BLOC MuSigma_Parameters
+
+                     Gamma = SIMP ( statut = "o",
+                                    typ = "R",
+                                    max = 1,
+                                    fr = "Borne inferieure du support de la loi",
+                                    ang = "Support lower bound",
+                                    ),
+
+    ), # Fin BLOC WEIBULL
+
+
+    Transfer_Function = FACT(statut='f',
+
+        TF_Input = SIMP ( statut='o',
+                       typ = 'TXM',
+                       fr = 'Entrer une fonction de transfert ï¿½ partir d''un fichier .pow (vitesse de vent - puissance eolienne)\n \
+                             ou entrer une liste de tuples (valeur tiree - puissance normalisee)',
+                       ang = 'Enter wind speed - turbine production transfer function as a .pow file, \n \
+                              or enter a generic list of (law output value, normalized power output) tuples',
+                       into = ('.pow file', 'tuples list'),
+                             ),
+        b_file = BLOC(condition = "TF_Input == '.pow file'",
+                      File_Name = SIMP ( statut = "o",
+                                        typ = ('Fichier', 'Pow files (*.pow);;All Files (*)',),
+                                        fr = "Nom du fichier de transfer .pow",
+                                        ang = ".pow file name",
+                                        ),
+                      Wind_Speed_Measurement_Height = SIMP ( statut = 'o',
+                                        typ = "R",
+                                        max = 1,
+                                        fr = 'Hauteur (en metres) a laquelle les mesures de vitesse du vent ont ete prises',
+                                        ang = 'Height of wind speed measurements (m)',
+                                        sug = 10,
+                                        val_min = 0,
+                                        ),
+                      Hub_Height = SIMP (statut = 'o',
+                                         typ = "R",
+                                         fr = 'hauteur de moyeu de l''eolienne',
+                                         ang = 'wind turbine hub height',
+                                         sug = 80,
+                                         val_min = 0,),
+                      AlphaWS = SIMP (statut = 'o',
+                                         typ = "R",
+                                         fr = 'l''alpha pour extrapoler les mesures de vitesse du vent a la hauteur du moyeu ',
+                                         ang = 'alpha used to extrapolate wind speed measurements to hub height',
+                                         defaut = 1./7,
+                                         val_min = 0,
+                                         val_max = 1,
+                                            ),
+                      Percent_Losses = SIMP (statut = 'o',
+                                         typ = "R",
+                                         fr = 'pourcentage de pertes entre la sortie theorique d''une turbine et la sortie de la centrale',
+                                         ang = 'percent losses between theoretical power output of a single turbine and the output of the farm',
+                                         defaut = 5,
+                                         val_min = 0,
+                                         val_max = 100,
+                                             ),
+                      ), #fin du bloc FileName
+
+        b_tuples = BLOC(condition = "TF_Input == 'tuples list'",
+
+                       TF_Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       min = 2,
+                                       fr = "Liste de couples : valeur tiree, puissance normalisee sortie",
+                                       ang = "List of couples : value set by law, normalized power output",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       ),
+                      ), #fin du block Tuples List
+
+        ), #fin du FACT Transfer Function
+
+  ), #fin du bloc generator level
+
+
+  b_gener_avail = BLOC (condition= "Type == 'Generator Unavailability'",
+
+  Law = SIMP ( statut = "o", typ = "TXM",
+                into = ( #"Exponential",
+                         #"Histogram",
+                         #"Normal",
+                         #"Rayleigh",
+                         #"PDF_from_file",
+                         #"TruncatedNormal",
+                         "TimeSeries_from_file",
+                         #"Uniform",
+                         "UserDefined",
+                         #"Weibull",
+                         ),
+                fr = "Choix du type de la loi marginale",
+                ang = "1D marginal distribution",
+                defaut="UserDefined",
+                ),
+
+
+#====
+# Definition des parametres selon le type de la loi
+#====
+
+
+  TimeSeries = BLOC ( condition = " Law in ( 'TimeSeries_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Fichier CSV d'une serie temporelle",
+                    ang = "CSV file of a time series",
+                    ),
+              ),
+
+
+   USERDEFINED = BLOC ( condition = " Law in ( 'UserDefined', ) ",
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : (valeur, prob.)",
+                                       ang = "List of pairs : (value, prob.)",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       defaut=((0,1.0),(1,0.0)),
+                                       ),
+
+  ), # Fin BLOC USERDEFINED
+
+
+  ), #fin du bloc generator avail
+
+
+  ), #fin du bloc generateur
+
+#Bloc Charge
+  b_charge = BLOC (condition = "ComponentType == 'Load'",
+
+
+#====
+# Type de distribution
+#====
+
+  Type = SIMP (statut= "o", typ = "TXM",
+               into = ("Load Level", "Load Unavailability"),
+               fr = "Choisir si c'est le niveau de charge ou la indisponibilit� de la charge qui sera tiree",
+               ang= "Choose whether the power level or the unavailability of the load will be set by the law",
+               defaut = "Load Level",
+               ),
+
+  Sampling = SIMP (statut= "o", typ = "TXM",
+               into = ("Same sample for all loads", "One sample per load"),
+               fr = "Choisir si une seule tirage sera fait pour tous les charges ou si des tirages differents seront faits pour chaque charge",
+               ang= "Choose whether one drawing/sample will be performed for all of the loads or whether a different drawing/sample will be performed for each load.",
+               defaut = "Same sample for all loads",
+               ),
+
+  Load       = SIMP(statut='o',typ=sd_charge,max="**", homo="SansOrdreNiDoublon",),
+
+
+  b_charge_level = BLOC (condition = "Type == 'Load Level'",
+
+  Law = SIMP ( statut = "o", typ = "TXM",
+                into = ( "Exponential",
+                         "Histogram",
+                         "Normal",
+                         #"Rayleigh",
+                         "PDF_from_file",
+                         "TruncatedNormal",
+                         "TimeSeries_from_file",
+                         "Uniform",
+                         "UserDefined",
+                         "Weibull",
+                         ),
+                fr = "Choix du type de la loi marginale",
+                ang = "1D marginal distribution",
+                ),
+
+
+#====
+# Definition des parametres selon le type de la loi
+#====
+
+
+  EXPONENTIAL = BLOC ( condition = " Law in ( 'Exponential', ) ",
+
+                         Lambda = SIMP ( statut = "o",
+                                         typ = "R",
+                                         max = 1,
+                                         val_min = 0.,
+                                         fr = "Parametre Lambda | Lambda > 0",
+                                         ang = "Lambda parameter | Lambda > 0",
+                                         ),
+
+                         Gamma = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne inferieure du support de la loi",
+                                        ang = "Support lower bound",
+                                        ),
+
+  ), # Fin BLOC EXPONENTIAL
+
+
+  HISTOGRAM = BLOC ( condition = " Law in ( 'Histogram', ) ",
+
+                       First = SIMP ( statut = "o",
+                                    typ = "R",
+                                    max = 1,
+                                    fr = "Borne inferieure du supoport de la loi",
+                                    ang = "Support lower bound",
+                                    ),
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : largeur de classe, hauteur de classe",
+                                       ang = "Class bandwidth, class height couple list",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       ),
+
+  ), # Fin BLOC HISTOGRAM
+
+
+   NORMAL = BLOC ( condition = " Law in ( 'Normal', ) ",
+
+                    Mu = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Moyenne de la loi",
+                                ang = "Mean value",
+                                ),
+
+                   Sigma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  val_min = 0.,
+                                  fr = "Ecart type de la loi",
+                                  ang = "Standard deviation",
+                                  ),
+
+   ), # Fin BLOC NORMAL
+
+
+  RAYLEIGH = BLOC ( condition = " Law in ( 'Rayleigh', ) ",
+
+                   Sigma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  fr = "Parametre Sigma de la loi | Sigma > 0",
+                                  ang = "Sigma parameter | Sigma > 0",
+                                  ),
+
+                   Gamma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  fr = "Borne inferieure du support de la loi",
+                                  ang = "Support lower bound",
+                                  ),
+ ), # Fin BLOC RAYLEIGH
+
+  PDF = BLOC ( condition = " Law in ( 'PDF_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Nom du fichier .csv",
+                    ang = ".csv file name",
+                    ),
+              ),
+
+
+
+   TRUNCATEDNORMAL = BLOC ( condition = " Law in ( 'TruncatedNormal', ) ",
+
+                             MuN = SIMP ( statut = "o",
+                                          typ = "R",
+                                          max = 1,
+                                          fr = "Moyenne de la loi Normale non tronqu�e",
+                                          ang = "Mean value of the associated non truncated normal distribution",
+                                          ),
+
+                             SigmaN = SIMP ( statut = "o",
+                                             typ = "R",
+                                             max = 1,
+                                             val_min = 0.,
+                                             fr = "Ecart-type de la loi Normale non tronqu�e",
+                                             ang = "Standard deviation of the associated non truncated normal distribution",
+                                             ),
+
+                             A = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne inferieure de la loi | A < B",
+                                        ang = "Lower bound | A < B",
+                                        ),
+
+                             B = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne superieure de la loi | A < B",
+                                        ang = "Upper bound | A < B",
+                                        ),
+
+   ), # Fin BLOC TRUNCATEDNORMAL
+
+
+  TimeSeries = BLOC ( condition = " Law in ( 'TimeSeries_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Fichier CSV d'une serie temporelle",
+                    ang = "CSV file of a time series",
+                    ),
+              ),
+
+
+   UNIFORM = BLOC ( condition = " Law in ( 'Uniform', ) ",
+
+                     A = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Borne inferieure du support de la loi | A < B",
+                                ang = "Support lower bound | A < B",
+                                ),
+
+                     B = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Borne superieure du support de la loi | A < B",
+                                ang = "Support upper bound | A < B",
+                                ),
+
+   ), # Fin BLOC UNIFORM
+
+
+   USERDEFINED = BLOC ( condition = " Law in ( 'UserDefined', ) ",
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : (valeur, probabilite)",
+                                       ang = "List of pairs : (value, probability)",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       ),
+
+  ), # Fin BLOC USERDEFINED
+
+
+   WEIBULL = BLOC ( condition = " Law in ( 'Weibull', ) ",
+
+                     Settings = SIMP ( statut = "o",
+                                          typ = "TXM",
+                                          max = 1,
+                                          into = ( "AlphaBeta", "MuSigma" ),
+                                          defaut = "AlphaBeta",
+                                          fr = "Parametrage de la loi weibull",
+                                          ang = "Weibull distribution parameter set",
+                                          ),
+
+                     AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ",
+
+                                         Alpha = SIMP ( statut = "o",
+                                                        typ = "R",
+                                                        max = 1,
+                                                        val_min = 0.,
+                                                        fr = "Parametre Alpha de la loi | Alpha > 0",
+                                                        ang = "Alpha parameter | Alpha > 0",
+                                                        ),
+
+                                         Beta = SIMP ( statut = "o",
+                                                       typ = "R",
+                                                       max = 1,
+                                                       val_min = 0.,
+                                                       fr = "Parametre Beta de la loi | Beta > 0",
+                                                       ang = "Beta parameter | Beta > 0",
+                                                       ),
+
+                                         ), # Fin BLOC AlphaBeta_Parameters
+
+
+                     MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
+
+                                         Mu = SIMP ( statut = "o",
+                                                     typ = "R",
+                                                     max = 1,
+                                                     fr = "Moyenne de la loi",
+                                                     ang = "Mean value",
+                                                     ),
+
+                                         Sigma = SIMP ( statut = "o",
+                                                        typ = "R",
+                                                        max = 1,
+                                                        val_min = 0.,
+                                                        fr = "Ecart type de la loi",
+                                                        ang = "Standard deviation",
+                                                        ),
+
+                                         ), # Fin BLOC MuSigma_Parameters
+
+                     Gamma = SIMP ( statut = "o",
+                                    typ = "R",
+                                    max = 1,
+                                    fr = "Borne inferieure du support de la loi",
+                                    ang = "Support lower bound",
+                                    ),
+
+    ), # Fin BLOC WEIBULL
+
+  ), #fin du block Load Level
+
+
+  b_charge_avail = BLOC (condition = "Type == 'Load Unavailability'",
+
+  Law = SIMP ( statut = "o", typ = "TXM",
+                into = ( #"Exponential",
+                         #"Histogram",
+                         #"Normal",
+                         #"Rayleigh",
+                         #"PDF_from_file",
+                         #"TruncatedNormal",
+                         "TimeSeries_from_file",
+                         #"Uniform",
+                         "UserDefined",
+                         #"Weibull",
+                         ),
+                fr = "Choix du type de la loi marginale",
+                ang = "1D marginal distribution",
+                defaut = "UserDefined",
+                ),
+
+
+#====
+# Definition des parametres selon le type de la loi
+#====
+
+  TimeSeries = BLOC ( condition = " Law in ( 'TimeSeries_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Fichier CSV d'une serie temporelle",
+                    ang = "CSV file of a time series",
+                    ),
+              ),
+
+
+
+   USERDEFINED = BLOC ( condition = " Law in ( 'UserDefined', ) ",
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : (valeur, probabilite)",
+                                       ang = "List of pairs : (value, probability)",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       defaut=((0,1.0),(1,0.0)),
+                                       ),
+
+  ), # Fin BLOC USERDEFINED
+
+
+  ), #fin du block Load Avail
+
+
+  ), #fin du bloc charge
+
+
+
+#Bloc Moteur
+  b_moteur = BLOC (condition = "ComponentType == 'Motor'",
+
+
+#====
+# Type de distribution
+#====
+
+  Type = SIMP (statut= "o", typ = "TXM",
+               into = ("Motor Level", "Motor Unavailability"),
+               fr = "Choisir si c'est le niveau de charge du moteur ou la indisponibilit� du moteur qui sera tiree",
+               ang= "Choose whether the power level or the unavailability of the motor will be set by the law",
+               defaut = "Motor Level",
+               ),
+
+  Sampling = SIMP (statut= "o", typ = "TXM",
+               into = ("Same sample for all motors", "One sample per motor"),
+               fr = "Choisir si une seule tirage sera fait pour tous les moteurs ou si des tirages differents seront faits pour chaque moteur",
+               ang= "Choose whether one drawing/sample will be performed for all of the motors or whether a different drawing/sample will be performed for each motor.",
+               defaut = "Same sample for all motors",
+               ),
+
+  Motor       = SIMP(statut='o',typ=sd_moteur,max="**", homo="SansOrdreNiDoublon",),
+
+
+  b_moteur_level = BLOC (condition = "Type == 'Motor Level'",
+
+  Law = SIMP ( statut = "o", typ = "TXM",
+                into = ( "Exponential",
+                         "Histogram",
+                         "Normal",
+                         #"Rayleigh",
+                         "PDF_from_file",
+                         "TruncatedNormal",
+                         "TimeSeries_from_file",
+                         "Uniform",
+                         "UserDefined",
+                         "Weibull",
+                         ),
+                fr = "Choix du type de la loi marginale",
+                ang = "1D marginal distribution",
+                ),
+
+
+#====
+# Definition des parametres selon le type de la loi
+#====
+
+
+  EXPONENTIAL = BLOC ( condition = " Law in ( 'Exponential', ) ",
+
+                         Lambda = SIMP ( statut = "o",
+                                         typ = "R",
+                                         max = 1,
+                                         val_min = 0.,
+                                         fr = "Parametre Lambda | Lambda > 0",
+                                         ang = "Lambda parameter | Lambda > 0",
+                                         ),
+
+                         Gamma = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne inferieure du support de la loi",
+                                        ang = "Support lower bound",
+                                        ),
+
+  ), # Fin BLOC EXPONENTIAL
+
+
+  HISTOGRAM = BLOC ( condition = " Law in ( 'Histogram', ) ",
+
+                       First = SIMP ( statut = "o",
+                                    typ = "R",
+                                    max = 1,
+                                    fr = "Borne inferieure du supoport de la loi",
+                                    ang = "Support lower bound",
+                                    ),
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : largeur de classe, hauteur de classe",
+                                       ang = "Class bandwidth, class height couple list",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       ),
+
+  ), # Fin BLOC HISTOGRAM
+
+
+   NORMAL = BLOC ( condition = " Law in ( 'Normal', ) ",
+
+                    Mu = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Moyenne de la loi",
+                                ang = "Mean value",
+                                ),
+
+                   Sigma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  val_min = 0.,
+                                  fr = "Ecart type de la loi",
+                                  ang = "Standard deviation",
+                                  ),
+
+   ), # Fin BLOC NORMAL
+
+
+  RAYLEIGH = BLOC ( condition = " Law in ( 'Rayleigh', ) ",
+
+                   Sigma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  fr = "Parametre Sigma de la loi | Sigma > 0",
+                                  ang = "Sigma parameter | Sigma > 0",
+                                  ),
+
+                   Gamma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  fr = "Borne inferieure du support de la loi",
+                                  ang = "Support lower bound",
+                                  ),
+ ), # Fin BLOC RAYLEIGH
+
+  PDF = BLOC ( condition = " Law in ( 'PDF_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Nom du fichier .csv",
+                    ang = ".csv file name",
+                    ),
+              ),
+
+
+
+   TRUNCATEDNORMAL = BLOC ( condition = " Law in ( 'TruncatedNormal', ) ",
+
+                             MuN = SIMP ( statut = "o",
+                                          typ = "R",
+                                          max = 1,
+                                          fr = "Moyenne de la loi Normale non tronqu�e",
+                                          ang = "Mean value of the associated non truncated normal distribution",
+                                          ),
+
+                             SigmaN = SIMP ( statut = "o",
+                                             typ = "R",
+                                             max = 1,
+                                             val_min = 0.,
+                                             fr = "Ecart-type de la loi Normale non tronqu�e",
+                                             ang = "Standard deviation of the associated non truncated normal distribution",
+                                             ),
+
+                             A = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne inferieure de la loi | A < B",
+                                        ang = "Lower bound | A < B",
+                                        ),
+
+                             B = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne superieure de la loi | A < B",
+                                        ang = "Upper bound | A < B",
+                                        ),
+
+   ), # Fin BLOC TRUNCATEDNORMAL
+
+
+  TimeSeries = BLOC ( condition = " Law in ( 'TimeSeries_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Fichier CSV d'une serie temporelle",
+                    ang = "CSV file of a time series",
+                    ),
+              ),
+
+
+   UNIFORM = BLOC ( condition = " Law in ( 'Uniform', ) ",
+
+                     A = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Borne inferieure du support de la loi | A < B",
+                                ang = "Support lower bound | A < B",
+                                ),
+
+                     B = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Borne superieure du support de la loi | A < B",
+                                ang = "Support upper bound | A < B",
+                                ),
+
+   ), # Fin BLOC UNIFORM
+
+
+   USERDEFINED = BLOC ( condition = " Law in ( 'UserDefined', ) ",
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : (valeur, probabilite)",
+                                       ang = "List of pairs : (value, probability)",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       ),
+
+  ), # Fin BLOC USERDEFINED
+
+
+   WEIBULL = BLOC ( condition = " Law in ( 'Weibull', ) ",
+
+                     Settings = SIMP ( statut = "o",
+                                          typ = "TXM",
+                                          max = 1,
+                                          into = ( "AlphaBeta", "MuSigma" ),
+                                          defaut = "AlphaBeta",
+                                          fr = "Parametrage de la loi weibull",
+                                          ang = "Weibull distribution parameter set",
+                                          ),
+
+                     AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ",
+
+                                         Alpha = SIMP ( statut = "o",
+                                                        typ = "R",
+                                                        max = 1,
+                                                        val_min = 0.,
+                                                        fr = "Parametre Alpha de la loi | Alpha > 0",
+                                                        ang = "Alpha parameter | Alpha > 0",
+                                                        ),
+
+                                         Beta = SIMP ( statut = "o",
+                                                       typ = "R",
+                                                       max = 1,
+                                                       val_min = 0.,
+                                                       fr = "Parametre Beta de la loi | Beta > 0",
+                                                       ang = "Beta parameter | Beta > 0",
+                                                       ),
+
+                                         ), # Fin BLOC AlphaBeta_Parameters
+
+
+                     MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
+
+                                         Mu = SIMP ( statut = "o",
+                                                     typ = "R",
+                                                     max = 1,
+                                                     fr = "Moyenne de la loi",
+                                                     ang = "Mean value",
+                                                     ),
+
+                                         Sigma = SIMP ( statut = "o",
+                                                        typ = "R",
+                                                        max = 1,
+                                                        val_min = 0.,
+                                                        fr = "Ecart type de la loi",
+                                                        ang = "Standard deviation",
+                                                        ),
+
+                                         ), # Fin BLOC MuSigma_Parameters
+
+                     Gamma = SIMP ( statut = "o",
+                                    typ = "R",
+                                    max = 1,
+                                    fr = "Borne inferieure du support de la loi",
+                                    ang = "Support lower bound",
+                                    ),
+
+    ), # Fin BLOC WEIBULL
+
+  ), #fin du block Load Level
+
+
+  b_moteur_avail = BLOC (condition = "Type == 'Motor Unavailability'",
+
+  Law = SIMP ( statut = "o", typ = "TXM",
+                into = ( #"Exponential",
+                         #"Histogram",
+                         #"Normal",
+                         #"Rayleigh",
+                         #"PDF_from_file",
+                         #"TruncatedNormal",
+                         "TimeSeries_from_file",
+                         #"Uniform",
+                         "UserDefined",
+                         #"Weibull",
+                         ),
+                fr = "Choix du type de la loi marginale",
+                ang = "1D marginal distribution",
+                defaut = "UserDefined",
+                ),
+
+
+#====
+# Definition des parametres selon le type de la loi
+#====
+
+  TimeSeries = BLOC ( condition = " Law in ( 'TimeSeries_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Fichier CSV d'une serie temporelle",
+                    ang = "CSV file of a time series",
+                    ),
+              ),
+
+
+
+   USERDEFINED = BLOC ( condition = " Law in ( 'UserDefined', ) ",
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : (valeur, probabilite)",
+                                       ang = "List of pairs : (value, probability)",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       defaut=((0,1.0),(1,0.0)),
+                                       ),
+
+  ), # Fin BLOC USERDEFINED
+
+
+  ), #fin du block Load Avail
+
+
+  ), #fin du bloc moteur
+
+
+  b_ligne = BLOC (condition = "ComponentType == 'Line'",
+
+
+#====
+# Type de distribution
+#====
+
+  Type = SIMP (statut= "o", typ = "TXM",
+               into = ("Line Unavailability",),
+               fr = "L'indisponibilite de la ligne sera tiree",
+               ang= "Line unavailability will be set by the law",
+               defaut = "Line Unavailability",
+               ),
+
+  Sampling = SIMP (statut= "o", typ = "TXM",
+               into = ("Same sample for all lines", "One sample per line"),
+               fr = "Choisir si une seule tirage sera fait pour tous les lignes ou si des tirages differents seront faits pour chaque ligne",
+               ang= "Choose whether one drawing/sample will be performed for all of the lines or whether a different drawing/sample will be performed for each line.",
+               defaut = "Same sample for all lines",
+               ),
+
+  Line   = SIMP(statut='o',typ=sd_ligne,max="**", homo="SansOrdreNiDoublon"),
+
+  Law = SIMP ( statut = "o", typ = "TXM",
+                into = ( #"Exponential",
+                         #"Histogram",
+                         #"Normal",
+                         #"Rayleigh",
+                         #"PDF_from_file",
+                         #"TruncatedNormal",
+                         "TimeSeries_from_file",
+                         #"Uniform",
+                         "UserDefined",
+                         #"Weibull",
+                         ),
+                defaut = "UserDefined",
+                fr = "Choix du type de la loi marginale",
+                ang = "1D marginal distribution",
+                ),
+
+
+#====
+# Definition des parametres selon le type de la loi
+#====
+
+
+  EXPONENTIAL = BLOC ( condition = " Law in ( 'Exponential', ) ",
+
+                         Lambda = SIMP ( statut = "o",
+                                         typ = "R",
+                                         max = 1,
+                                         val_min = 0.,
+                                         fr = "Parametre Lambda | Lambda > 0",
+                                         ang = "Lambda parameter | Lambda > 0",
+                                         ),
+
+                         Gamma = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne inferieure du support de la loi",
+                                        ang = "Support lower bound",
+                                        ),
+
+  ), # Fin BLOC EXPONENTIAL
+
+
+  HISTOGRAM = BLOC ( condition = " Law in ( 'Histogram', ) ",
+
+                       First = SIMP ( statut = "o",
+                                    typ = "R",
+                                    max = 1,
+                                    fr = "Borne inferieure du supoport de la loi",
+                                    ang = "Support lower bound",
+                                    ),
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : largeur de classe, hauteur de classe",
+                                       ang = "Class bandwidth, class height couple list",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       ),
+
+  ), # Fin BLOC HISTOGRAM
+
+
+   NORMAL = BLOC ( condition = " Law in ( 'Normal', ) ",
+
+                    Mu = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Moyenne de la loi",
+                                ang = "Mean value",
+                                ),
+
+                   Sigma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  val_min = 0.,
+                                  fr = "Ecart type de la loi",
+                                  ang = "Standard deviation",
+                                  ),
+
+   ), # Fin BLOC NORMAL
+
+
+  RAYLEIGH = BLOC ( condition = " Law in ( 'Rayleigh', ) ",
+
+                   Sigma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  fr = "Parametre Sigma de la loi | Sigma > 0",
+                                  ang = "Sigma parameter | Sigma > 0",
+                                  ),
+
+                   Gamma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  fr = "Borne inferieure du support de la loi",
+                                  ang = "Support lower bound",
+                                  ),
+ ), # Fin BLOC RAYLEIGH
+
+  PDF = BLOC ( condition = " Law in ( 'PDF_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Nom du fichier .csv",
+                    ang = ".csv file name",
+                    ),
+              ),
+
+
+
+   TRUNCATEDNORMAL = BLOC ( condition = " Law in ( 'TruncatedNormal', ) ",
+
+                             MuN = SIMP ( statut = "o",
+                                          typ = "R",
+                                          max = 1,
+                                          fr = "Moyenne de la loi Normale non tronqu�e",
+                                          ang = "Mean value of the associated non truncated normal distribution",
+                                          ),
+
+                             SigmaN = SIMP ( statut = "o",
+                                             typ = "R",
+                                             max = 1,
+                                             val_min = 0.,
+                                             fr = "Ecart-type de la loi Normale non tronqu�e",
+                                             ang = "Standard deviation of the associated non truncated normal distribution",
+                                             ),
+
+                             A = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne inferieure de la loi | A < B",
+                                        ang = "Lower bound | A < B",
+                                        ),
+
+                             B = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne superieure de la loi | A < B",
+                                        ang = "Upper bound | A < B",
+                                        ),
+
+   ), # Fin BLOC TRUNCATEDNORMAL
+
+
+  TimeSeries = BLOC ( condition = " Law in ( 'TimeSeries_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Fichier CSV d'une serie temporelle",
+                    ang = "CSV file of a time series",
+                    ),
+              ),
+
+
+   UNIFORM = BLOC ( condition = " Law in ( 'Uniform', ) ",
+
+                     A = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Borne inferieure du support de la loi | A < B",
+                                ang = "Support lower bound | A < B",
+                                ),
+
+                     B = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Borne superieure du support de la loi | A < B",
+                                ang = "Support upper bound | A < B",
+                                ),
+
+   ), # Fin BLOC UNIFORM
+
+
+   USERDEFINED = BLOC ( condition = " Law in ( 'UserDefined', ) ",
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : (valeur, probabilite)",
+                                       ang = "List of pairs : (value, probability)",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       defaut=((0,1.0),(1,0.0)),
+                                       ),
+
+  ), # Fin BLOC USERDEFINED
+
+
+   WEIBULL = BLOC ( condition = " Law in ( 'Weibull', ) ",
+
+                     Settings = SIMP ( statut = "o",
+                                          typ = "TXM",
+                                          max = 1,
+                                          into = ( "AlphaBeta", "MuSigma" ),
+                                          defaut = "AlphaBeta",
+                                          fr = "Parametrage de la loi weibull",
+                                          ang = "Weibull distribution parameter set",
+                                          ),
+
+                     AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ",
+
+                                         Alpha = SIMP ( statut = "o",
+                                                        typ = "R",
+                                                        max = 1,
+                                                        val_min = 0.,
+                                                        fr = "Parametre Alpha de la loi | Alpha > 0",
+                                                        ang = "Alpha parameter | Alpha > 0",
+                                                        ),
+
+                                         Beta = SIMP ( statut = "o",
+                                                       typ = "R",
+                                                       max = 1,
+                                                       val_min = 0.,
+                                                       fr = "Parametre Beta de la loi | Beta > 0",
+                                                       ang = "Beta parameter | Beta > 0",
+                                                       ),
+
+                                         ), # Fin BLOC AlphaBeta_Parameters
+
+
+                     MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
+
+                                         Mu = SIMP ( statut = "o",
+                                                     typ = "R",
+                                                     max = 1,
+                                                     fr = "Moyenne de la loi",
+                                                     ang = "Mean value",
+                                                     ),
+
+                                         Sigma = SIMP ( statut = "o",
+                                                        typ = "R",
+                                                        max = 1,
+                                                        val_min = 0.,
+                                                        fr = "Ecart type de la loi",
+                                                        ang = "Standard deviation",
+                                                        ),
+
+                                         ), # Fin BLOC MuSigma_Parameters
+
+                     Gamma = SIMP ( statut = "o",
+                                    typ = "R",
+                                    max = 1,
+                                    fr = "Borne inferieure du support de la loi",
+                                    ang = "Support lower bound",
+                                    ),
+
+    ), # Fin BLOC WEIBULL
+
+  ), #fin du bloc ligne
+
+  b_transfo = BLOC (condition = "ComponentType == 'Transformer'",
+
+
+#====
+# Type de distribution
+#====
+
+  Type = SIMP (statut= "o", typ = "TXM",
+               into = ("Transformer Unavailability",),
+               fr = "L'indisponibilite du transformateur sera tiree",
+               ang= "Transformer unavailability will be set by the law",
+               defaut = "Transformer Unavailability"
+               ),
+
+  Sampling = SIMP (statut= "o", typ = "TXM",
+               into = ("Same sample for all transformers", "One sample per transformer"),
+               fr = "Choisir si une seule tirage sera fait pour tous les transforamteurs ou si des tirages differents seront faits pour chaque transformateur",
+               ang= "Choose whether one drawing/sample will be performed for all of the tranformers or whether a different drawing/sample will be performed for each transformer.",
+               defaut = "Same sample for all transformers",
+               ),
+
+  Transformer = SIMP(statut='o',typ=sd_transfo,max="**", homo="SansOrdreNiDoublon"),
+
+  Law = SIMP ( statut = "o", typ = "TXM",
+                into = ( #"Beta",
+                         #"Exponential",
+                         #"Gamma",
+                         #"Geometric",
+                         #"Gumbel",
+                         #"Histogram",
+                         #"Laplace",
+                         #"Logistic",
+                         #"LogNormal",
+                         #"MultiNomial",
+                         #"NonCentralStudent",
+                         #"Normal",
+                         #"Poisson",
+                         #"Rayleigh",
+                         #"Student",
+                         #"PDF_from_file",
+                         #"Triangular",
+                         #"TruncatedNormal",
+                         "TimeSeries_from_file",
+                         #"Uniform",
+                         "UserDefined",
+                         #"Weibull",
+                         ),
+                defaut="UserDefined",
+                fr = "Choix du type de la loi marginale",
+                ang = "1D marginal distribution",
+                ),
+
+
+#====
+# Definition des parametres selon le type de la loi
+#====
+
+##  NONPARAM = BLOC ( condition = " Law in ( 'NonParametrique', ) ",
+##
+##  FileName = SIMP ( statut = "o",
+##                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+##                    fr = "Nom du modele physique",
+##                    ang = "Physical model identifier",
+##                    ),
+##              ),
+
+#  BETA = BLOC ( condition = " Law in ( 'Beta', ) ",
+#
+#                  Settings = SIMP ( statut = "o",
+#                                       typ = "TXM",
+#                                       max = 1,
+#                                       into = ( "RT", "MuSigma" ),
+#                                       defaut = "RT",
+#                                       fr = "Parametrage de la loi beta",
+#                                       ang = "Beta distribution parameter set",
+#                                       ),
+#
+#                  RT_Parameters = BLOC ( condition = " Settings in ( 'RT', ) ",
+#
+#                                      R = SIMP ( statut = "o",
+#                                                 typ = "R",
+#                                                 max = 1,
+#                                                 val_min = 0.,
+#                                                 fr = "Parametre R de la loi | R > 0",
+#                                                 ang = "R parameter | R > 0",
+#                                                 ),
+#
+#                                      # T > R
+#                                      T = SIMP ( statut = "o",
+#                                                 typ = "R",
+#                                                 max = 1,
+#                                                 val_min = 0.,
+#                                                 fr = "Parametre T de la loi | T > R",
+#                                                 ang = "T parameter | T > R",
+#                                                 ),
+#
+#                                      ), # Fin BLOC RT_Parameters
+#
+#
+#                  MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
+#
+#                                      Mu = SIMP ( statut = "o",
+#                                                  typ = "R",
+#                                                  max = 1,
+#                                                  fr = "Moyenne de la loi",
+#                                                  ang = "Mean value",
+#                                                  ),
+#
+#                                      Sigma = SIMP ( statut = "o",
+#                                                     typ = "R",
+#                                                     max = 1,
+#                                                     val_min = 0.,
+#                                                     fr = "Ecart type de la loi",
+#                                                     ang = "Standard deviation",
+#                                                     ),
+#
+#                                      ), # Fin BLOC MuSigma_Parameters
+#
+#
+#                  A = SIMP ( statut = "o",
+#                             typ = "R",
+#                             max = 1,
+#                             fr = "Borne inferieure du support de la loi",
+#                             ang = "Support lower bound",
+#                             ),
+#
+#                  # B > A
+#                  B = SIMP ( statut = "o",
+#                             typ = "R",
+#                             max = 1,
+#                             fr = "Borne superieure du support de la loi",
+#                             ang = "Support upper bound",
+#                             ),
+#
+#  ), # Fin BLOC BETA
+
+
+
+  EXPONENTIAL = BLOC ( condition = " Law in ( 'Exponential', ) ",
+
+                         Lambda = SIMP ( statut = "o",
+                                         typ = "R",
+                                         max = 1,
+                                         val_min = 0.,
+                                         fr = "Parametre Lambda | Lambda > 0",
+                                         ang = "Lambda parameter | Lambda > 0",
+                                         ),
+
+                         Gamma = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne inferieure du support de la loi",
+                                        ang = "Support lower bound",
+                                        ),
+
+  ), # Fin BLOC EXPONENTIAL
+
+
+
+#  GAMMA = BLOC ( condition = " Law in ( 'Gamma', ) ",
+#
+#                   Settings = SIMP ( statut = "o",
+#                                        typ = "TXM",
+#                                        max = 1,
+#                                        into = ( "KLambda", "MuSigma" ),
+#                                        defaut = "KLambda",
+#                                        fr = "Parametrage de la loi gamma",
+#                                        ang = "Gamma distribution parameter set",
+#                                        ),
+#
+#                   KLambda_Parameters = BLOC ( condition = " Settings in ( 'KLambda', ) ",
+#
+#                                       K = SIMP ( statut = "o",
+#                                                  typ = "R",
+#                                                  max = 1,
+#                                                  val_min = 0.,
+#                                                  fr = "Parametre K de la loi | K > 0",
+#                                                  ang = "K parameter | K > 0",
+#                                                  ),
+#
+#                                       Lambda = SIMP ( statut = "o",
+#                                                       typ = "R",
+#                                                       max = 1,
+#                                                       val_min = 0.,
+#                                                       fr = "Parametre Lambda de la loi | Lambda > 0",
+#                                                       ang = "Lambda parameter | Lambda > 0",
+#                                                       ),
+#
+#                                       ), # Fin BLOC KLambda_Parameters
+#
+#
+#                   MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
+#
+#                                       Mu = SIMP ( statut = "o",
+#                                                   typ = "R",
+#                                                   max = 1,
+#                                                   fr = "Moyenne de la loi",
+#                                                   ang = "Mean value",
+#                                                   ),
+#
+#                                       Sigma = SIMP ( statut = "o",
+#                                                      typ = "R",
+#                                                      max = 1,
+#                                                      val_min = 0.,
+#                                                      fr = "Ecart type de la loi",
+#                                                      ang = "Standard deviation",
+#                                                      ),
+#
+#                                       ), # Fin BLOC MuSigma_Parameters
+#
+#                   Gamma = SIMP ( statut = "o",
+#                                  typ = "R",
+#                                  max = 1,
+#                                  fr = "Borne inferieure du supoport de la loi",
+#                                  ang = "Support lower bound",
+#                                  ),
+#
+#
+#  ), # Fin BLOC GAMMA
+
+
+#
+#  GEOMETRIC = BLOC ( condition = " Law in ( 'Geometric', ) ",
+#
+#                       P = SIMP ( statut = "o",
+#                                  typ = "R",
+#                                  max = 1,
+#                                  val_min = 0.,
+#                                  val_max = 1.,
+#                                  fr = "Parametre P | 0 < P < 1",
+#                                  ang = "P parameter | 0 < P < 1",
+#                                  ),
+#
+#  ), # Fin BLOC GEOMETRIC
+#
+#
+#
+#  GUMBEL = BLOC ( condition = " Law in ( 'Gumbel', ) ",
+#
+#                    Settings = SIMP ( statut = "o",
+#                                         typ = "TXM",
+#                                         max = 1,
+#                                         into = ( "AlphaBeta", "MuSigma" ),
+#                                         defaut = "AlphaBeta",
+#                                         fr = "Parametrage de la loi gumbel",
+#                                         ang = "Gumbel distribution parameter set",
+#                                         ),
+#
+#                    AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ",
+#
+#                                        Alpha = SIMP ( statut = "o",
+#                                                       typ = "R",
+#                                                       max = 1,
+#                                                       val_min = 0.,
+#                                                       fr = "Parametre Alpha de la loi | Alpha > 0",
+#                                                       ang = "Alpha parameter | Alpha > 0",
+#                                                       ),
+#
+#                                        Beta = SIMP ( statut = "o",
+#                                                      typ = "R",
+#                                                      max = 1,
+#                                                      fr = "Parametre Beta de la loi",
+#                                                      ang = "Beta parameter",
+#                                                      ),
+#
+#                                        ), # Fin BLOC AlphaBeta_Parameters
+#
+#
+#                    MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
+#
+#                                        Mu = SIMP ( statut = "o",
+#                                                    typ = "R",
+#                                                    max = 1,
+#                                                    fr = "Moyenne de la loi",
+#                                                    ang = "Mean value",
+#                                                    ),
+#
+#                                        Sigma = SIMP ( statut = "o",
+#                                                       typ = "R",
+#                                                       max = 1,
+#                                                       val_min = 0.,
+#                                                       fr = "Ecart type de la loi",
+#                                                       ang = "Standard deviation",
+#                                                       ),
+#
+#                                        ), # Fin BLOC MuSigma_Parameters
+#
+#  ), # Fin BLOC GUMBEL
+
+
+
+  HISTOGRAM = BLOC ( condition = " Law in ( 'Histogram', ) ",
+
+                       First = SIMP ( statut = "o",
+                                    typ = "R",
+                                    max = 1,
+                                    fr = "Borne inferieure du supoport de la loi",
+                                    ang = "Support lower bound",
+                                    ),
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : largeur de classe, hauteur de classe",
+                                       ang = "Class bandwidth, class height couple list",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       ),
+
+  ), # Fin BLOC HISTOGRAM
+
+
+
+#  LAPLACE = BLOC ( condition = " Law in ( 'Laplace', ) ",
+#
+#                   Lambda = SIMP ( statut = "o",
+#                                   typ = "R",
+#                                   max = 1,
+#                                   val_min = 0.,
+#                                   fr = "Parametre Lambda | Lambda > 0",
+#                                   ang = "Lambda parameter | Lambda > 0",
+#                                   ),
+#
+#                   Mu = SIMP ( statut = "o",
+#                               typ = "R",
+#                               max = 1,
+#                               fr = "Moyenne de la loi",
+#                               ang = "Mean value",
+#                              ),
+#
+#  ), # Fin BLOC LAPLACE
+#
+#  LOGNORMAL = BLOC ( condition = " Law in ( 'LogNormal', ) ",
+#
+#                     Settings = SIMP ( statut = "o",
+#                                       typ = "TXM",
+#                                       max = 1,
+#                                       into = ( "MuSigmaLog", "MuSigma", "MuSigmaOverMu" ),
+#                                       defaut = "MuSigmaLog",
+#                                       fr = "Parametrage de la loi lognormale",
+#                                       ang = "Lognormal distribution parameter set",
+#                                       ),
+#
+#                     MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
+#
+#                                                 Mu = SIMP ( statut = "o",
+#                                                             typ = "R",
+#                                                             max = 1,
+#                                                             fr = "Moyenne de la loi",
+#                                                             ang = "Mean value",
+#                                                             ),
+#
+#                                                 Sigma = SIMP ( statut = "o",
+#                                                                typ = "R",
+#                                                                max = 1,
+#                                                                val_min = 0.,
+#                                                                fr = "Ecart type de la loi",
+#                                                                ang = "Standard deviation",
+#                                                                ),
+#
+#                                                 ), # Fin BLOC MuSigma_Parameters
+#
+#                     MuSigmaOverMu_Parameters = BLOC ( condition = " Settings in ( 'MuSigmaOverMu', ) ",
+#
+#                                                 Mu = SIMP ( statut = "o",
+#                                                             typ = "R",
+#                                                             max = 1,
+#                                                             fr = "Moyenne de la loi",
+#                                                             ang = "Mean value",
+#                                                             ),
+#
+#                                                 SigmaOverMu = SIMP ( statut = "o",
+#                                                                typ = "R",
+#                                                                max = 1,
+#                                                                val_min = 0.,
+#                                                                fr = "Rapport ecart type / moyenne de la loi",
+#                                                                ang = "Standard deviation / mean value ratio",
+#                                                                ),
+#
+#                                                 ), # Fin BLOC MuSigmaOverMu_Parameters
+#
+#                     MuSigmaLog_Parameters = BLOC ( condition = " Settings in ( 'MuSigmaLog', ) ",
+#
+#                                                    MuLog = SIMP ( statut = "o",
+#                                                                   typ = "R",
+#                                                                   max = 1,
+#                                                                   fr = "Moyenne du log",
+#                                                                   ang = "Log mean value",
+#                                                                   ),
+#
+#                                                    SigmaLog = SIMP ( statut = "o",
+#                                                                      typ = "R",
+#                                                                      max = 1,
+#                                                                      val_min = 0.,
+#                                                                      fr = "Ecart type du log",
+#                                                                      ang = "Log standard deviation",
+#                                                                      ),
+#
+#                                                    ), # Fin BLOC MuSigmaLog_Parameters
+#
+#                     Gamma = SIMP ( statut = "o",
+#                                    typ = "R",
+#                                    max = 1,
+#                                    fr = "Borne inferieure du support de la loi",
+#                                    ang = "Support lower bound",
+#                                    ),
+#
+#   ), # Fin BLOC LOGNORMAL
+#
+#
+#
+#   LOGISTIC = BLOC ( condition = " Law in ( 'Logistic', ) ",
+#
+#                       Alpha = SIMP ( statut = "o",
+#                                      typ = "R",
+#                                      max = 1,
+#                                      fr = "Borne inferieure du supoport de la loi",
+#                                      ang = "Support lower bound",
+#                                      ),
+#
+#                       Beta = SIMP ( statut = "o",
+#                                     typ = "R",
+#                                     max = 1,
+#                                     val_min = 0.,
+#                                     fr = "Parametre Beta de la loi | Beta > 0",
+#                                     ang = "Beta parameter | Beta > 0",
+#                                     ),
+#
+#   ), # Fin BLOC LOGISTIC
+#
+#
+#
+#   MULTINOMIAL = BLOC ( condition = " Law in ( 'MultiNomial', ) ",
+#
+#                         N = SIMP ( statut = "o",
+#                                    typ = "I",
+#                                    max = 1,
+#                                    fr = "Parametre N de la loi | N > 0",
+#                                    ang = "N parameter | N > 0",
+#                                    ),
+#
+#                       # Il faut definir une collection de couples ( x,p )
+#                       Values = SIMP ( statut = 'o',
+#                                       typ = "R",
+#                                       max = '**',
+#                                       fr = "Liste de probabilit�s",
+#                                       ang = "Probability list",
+#                                       validators=VerifTypeTuple(('R','R')),
+#                                       ),
+#
+#   ), # Fin BLOC MULTINOMIAL
+#
+#
+#  NONCENTRALSTUDENT = BLOC ( condition = " Law in ( 'NonCentralStudent', ) ",
+#
+#                   Nu = SIMP ( statut = "o",
+#                               typ = "R",
+#                               max = 1,
+#                               fr = "Parametre Nu de la loi | Nu > 0",
+#                               ang = "Nu parameter | Nu > 0",
+#                              ),
+#
+#                   Delta = SIMP ( statut = "o",
+#                                  typ = "R",
+#                                  max = 1,
+#                                  fr = "Parametre Delta de la loi | Delta > 0",
+#                                  ang = "Delta parameter | Delta > 0",
+#                                  ),
+#
+#                   Gamma = SIMP ( statut = "o",
+#                                  typ = "R",
+#                                  max = 1,
+#                                  fr = "Parametre Gamma de centrage de la loi",
+#                                  ang = "Gamma parameter",
+#                                  ),
+#
+#  ), # Fin BLOC NONCENTRALSTUDENT
+
+
+   NORMAL = BLOC ( condition = " Law in ( 'Normal', ) ",
+
+                    Mu = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Moyenne de la loi",
+                                ang = "Mean value",
+                                ),
+
+                   Sigma = SIMP ( statut = "o",
+                                  typ = "R",
+                                  max = 1,
+                                  val_min = 0.,
+                                  fr = "Ecart type de la loi",
+                                  ang = "Standard deviation",
+                                  ),
+
+   ), # Fin BLOC NORMAL
+
+
+#
+#   POISSON = BLOC ( condition = " Law in ( 'Poisson', ) ",
+#
+#                     Lambda = SIMP ( statut = "o",
+#                                     typ = "R",
+#                                     max = 1,
+#                                     val_min = 0.,
+#                                     fr = "Parametre Lambda de la loi | Lambda > 0",
+#                                     ang = "Lambda parameter | Lambda > 0",
+#                                     ),
+#
+#   ), # Fin BLOC POISSON
+#
+#
+#
+#  RAYLEIGH = BLOC ( condition = " Law in ( 'Rayleigh', ) ",
+#
+#                   Sigma = SIMP ( statut = "o",
+#                                  typ = "R",
+#                                  max = 1,
+#                                  fr = "Parametre Sigma de la loi | Sigma > 0",
+#                                  ang = "Sigma parameter | Sigma > 0",
+#                                  ),
+#
+#                   Gamma = SIMP ( statut = "o",
+#                                  typ = "R",
+#                                  max = 1,
+#                                  fr = "Borne inferieure du support de la loi",
+#                                  ang = "Support lower bound",
+#                                  ),
+# ), # Fin BLOC RAYLEIGH
+
+  PDF = BLOC ( condition = " Law in ( 'PDF_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Nom du fichier .csv",
+                    ang = ".csv file name",
+                    ),
+              ),
+
+#   STUDENT = BLOC ( condition = " Law in ( 'Student', ) ",
+#
+#                     Mu = SIMP ( statut = "o",
+#                                 typ = "R",
+#                                 max = 1,
+#                                 fr = "Parametre Mu de la loi",
+#                                 ang = "Mu parameter",
+#                                 ),
+#
+#                     Nu = SIMP ( statut = "o",
+#                                 typ = "R",
+#                                 max = 1,
+#                                 val_min = 2.,
+#                                 fr = "Parametre Nu de la loi | Nu > 2",
+#                                 ang = "Nu parameter | Nu > 2",
+#                                 ),
+#
+#                   Sigma = SIMP ( statut = "o",
+#                                  typ = "R",
+#                                  max = 1,
+#                                  fr = "Parametre Sigma de la loi",
+#                                  ang = "Sigma parameter",
+#                                  ),
+#
+#   ), # Fin BLOC STUDENT
+#
+#
+#
+#   TRIANGULAR = BLOC ( condition = " Law in ( 'Triangular', ) ",
+#
+#                         A = SIMP ( statut = "o",
+#                                    typ = "R",
+#                                    max = 1,
+#                                    fr = "Borne inferieure du support de la loi | A < M < B",
+#                                    ang = "Support lower bound | A < M < B",
+#                                    ),
+#
+#                         M = SIMP ( statut = "o",
+#                                    typ = "R",
+#                                    max = 1,
+#                                    fr = "Mode de la loi | A < M < B",
+#                                    ang = "Mode | A < M < B",
+#                                    ),
+#
+#                         B = SIMP ( statut = "o",
+#                                    typ = "R",
+#                                    max = 1,
+#                                    fr = "Borne superieure du support de la loi | A < M < B",
+#                                    ang = "Support upper bound | A < M < B",
+#                                    ),
+#
+#   ), # Fin BLOC TRIANGULAR
+#
+#
+
+   TRUNCATEDNORMAL = BLOC ( condition = " Law in ( 'TruncatedNormal', ) ",
+
+                             MuN = SIMP ( statut = "o",
+                                          typ = "R",
+                                          max = 1,
+                                          fr = "Moyenne de la loi Normale non tronqu�e",
+                                          ang = "Mean value of the associated non truncated normal distribution",
+                                          ),
+
+                             SigmaN = SIMP ( statut = "o",
+                                             typ = "R",
+                                             max = 1,
+                                             val_min = 0.,
+                                             fr = "Ecart-type de la loi Normale non tronqu�e",
+                                             ang = "Standard deviation of the associated non truncated normal distribution",
+                                             ),
+
+                             A = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne inferieure de la loi | A < B",
+                                        ang = "Lower bound | A < B",
+                                        ),
+
+                             B = SIMP ( statut = "o",
+                                        typ = "R",
+                                        max = 1,
+                                        fr = "Borne superieure de la loi | A < B",
+                                        ang = "Upper bound | A < B",
+                                        ),
+
+   ), # Fin BLOC TRUNCATEDNORMAL
+
+
+  TimeSeries = BLOC ( condition = " Law in ( 'TimeSeries_from_file', ) ",
+
+  FileName = SIMP ( statut = "o",
+                    typ = ('Fichier', 'Wrapper Files (*.csv);;All Files (*)',),
+                    fr = "Fichier CSV d'une serie temporelle",
+                    ang = "CSV file of a time series",
+                    ),
+              ),
+
+
+   UNIFORM = BLOC ( condition = " Law in ( 'Uniform', ) ",
+
+                     A = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Borne inferieure du support de la loi | A < B",
+                                ang = "Support lower bound | A < B",
+                                ),
+
+                     B = SIMP ( statut = "o",
+                                typ = "R",
+                                max = 1,
+                                fr = "Borne superieure du support de la loi | A < B",
+                                ang = "Support upper bound | A < B",
+                                ),
+
+   ), # Fin BLOC UNIFORM
+
+
+   USERDEFINED = BLOC ( condition = " Law in ( 'UserDefined', ) ",
+
+                       # Il faut definir une collection de couples ( x,p )
+                       Values = SIMP ( statut = 'o',
+                                       typ = Tuple(2),
+                                       max = '**',
+                                       fr = "Liste de couples : (valeur, probabilite)",
+                                       ang = "List of pairs : (value, probability)",
+                                       validators=VerifTypeTuple(('R','R')),
+                                       defaut=((0,1.0),(1,0.0)),
+                                       ),
+
+  ), # Fin BLOC USERDEFINED
+
+
+   WEIBULL = BLOC ( condition = " Law in ( 'Weibull', ) ",
+
+                     Settings = SIMP ( statut = "o",
+                                          typ = "TXM",
+                                          max = 1,
+                                          into = ( "AlphaBeta", "MuSigma" ),
+                                          defaut = "AlphaBeta",
+                                          fr = "Parametrage de la loi weibull",
+                                          ang = "Weibull distribution parameter set",
+                                          ),
+
+                     AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ",
+
+                                         Alpha = SIMP ( statut = "o",
+                                                        typ = "R",
+                                                        max = 1,
+                                                        val_min = 0.,
+                                                        fr = "Parametre Alpha de la loi | Alpha > 0",
+                                                        ang = "Alpha parameter | Alpha > 0",
+                                                        ),
+
+                                         Beta = SIMP ( statut = "o",
+                                                       typ = "R",
+                                                       max = 1,
+                                                       val_min = 0.,
+                                                       fr = "Parametre Beta de la loi | Beta > 0",
+                                                       ang = "Beta parameter | Beta > 0",
+                                                       ),
+
+                                         ), # Fin BLOC AlphaBeta_Parameters
+
+
+                     MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ",
+
+                                         Mu = SIMP ( statut = "o",
+                                                     typ = "R",
+                                                     max = 1,
+                                                     fr = "Moyenne de la loi",
+                                                     ang = "Mean value",
+                                                     ),
+
+                                         Sigma = SIMP ( statut = "o",
+                                                        typ = "R",
+                                                        max = 1,
+                                                        val_min = 0.,
+                                                        fr = "Ecart type de la loi",
+                                                        ang = "Standard deviation",
+                                                        ),
+
+                                         ), # Fin BLOC MuSigma_Parameters
+
+                     Gamma = SIMP ( statut = "o",
+                                    typ = "R",
+                                    max = 1,
+                                    fr = "Borne inferieure du support de la loi",
+                                    ang = "Support lower bound",
+                                    ),
+
+    ), # Fin BLOC WEIBULL
+
+
+
+  ), #fin du bloc transformer
+
+
+)
+
+                     
+
+
+#Classement_Commandes_Ds_Arbre=('DIRECTORY', 'DISTRIBUTION', 'CORRELATION',)
+#Classement_Commandes_Ds_Arbre=('DIRECTORY', 'PF_PARAMETERS', 'SIMULATION', 'DISTRIBUTION', 'N_1_GENERATORS', 'N_1_LINES', 'N_1_TRANSFORMERS', 'N_1_MOTORS','N_1_LOADS','CORRELATION',)
+Classement_Commandes_Ds_Arbre=('DIRECTORY', 'PF_PARAMETERS', 'SIMULATION', 'DISTRIBUTION', 'CORRELATION')
+
+Ordre_Des_Commandes = ('DIRECTORY', 'PF_PARAMETERS', 'SIMULATION', 'DISTRIBUTION', 'N_1_GENERATORS', 'N_1_LINES', 'N_1_TRANSFORMERS', 'N_1_MOTORS','N_1_LOADS','CORRELATION')
diff --git a/PSSE_PF_Eficas/__init__.py b/PSSE_PF_Eficas/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/PSSE_PF_Eficas/com.py b/PSSE_PF_Eficas/com.py
new file mode 100644 (file)
index 0000000..77e9ec8
--- /dev/null
@@ -0,0 +1,607 @@
+#!/usr/bin/python3
+########################################################################################################################
+# ojectif de ce module: extraire des donnes pour afficher dans l'interface Eficas. Subprocess dans la fonction PFExtractGeneratorLoadLineandTransfoDico
+########################################################################################################################
+import pdb
+
+NoBreakersandSwitches = True
+
+NetworkFile = r'C:\Logiciels DER\PSEN_MERGED_V6\Example\Corse PF\Modele_Corse_PSEN_peak_good.pfd'
+PF_PATH = r'C:\Program Files\DIgSILENT\PowerFactory 2016 SP2\Python\3.5'
+
+def PFExtractData(NetworkFile, PF_PATH):
+    #PSEN sous PowerFactory, extraire des donnees de Gen, Load, Bus, Branch, Transfos,Motor
+    import os
+    import sys
+    import numpy as np
+
+    print (NetworkFile)
+    print (PF_PATH)
+    (filepath, filename) = os.path.split(NetworkFile)
+    sys.path.append(PF_PATH)
+    os.environ['PATH'] += ';' + os.path.dirname(os.path.dirname(PF_PATH)) + ';'
+
+    import powerfactory
+    import powerfactory as pf
+    app = pf.GetApplication()
+    # app.Show()
+    user = app.GetCurrentUser()
+    ComImp = user.CreateObject('ComPFDIMPORT')# objet pour importer pfd file
+
+    app.SetWriteCacheEnabled(1)  # Disable consistency check
+    ComImp.g_file = NetworkFile
+    ComImp.g_target = user  # project is imported under the user account
+    err = ComImp.Execute()  # Execute command starts the import process
+    ComImp.Delete()
+    app.SetWriteCacheEnabled(0)  # Enable consistency check
+    prjs = user.GetContents('*.IntPrj')
+    prjs.sort(key=lambda x: x.gnrl_modif, reverse=True)
+    #•pdb.set_trace()
+    prj = prjs[0]
+    prj.Activate()
+    studycase = app.GetActiveStudyCase()
+    grids = studycase.GetChildren(1, '*.ElmNet', 1)[0].contents
+    tous = []
+    for grid in grids:
+        tous.extend(grid.obj_id.GetContents('*.ElmTerm', 1))
+    bus = []
+    for noeud in tous:
+        # if ((noeud.iUsage == 0) and (noeud.outserv == 0)):  # eliminer tous les noeuds out-service
+        # if ((noeud.iUsage == 0)or(noeud.iUsage == 1)) :
+        bus.append(noeud)
+    noeuds = sorted(bus, key=lambda x: x.cStatName)
+    buses = []
+    for ii in range(len(noeuds)):
+        busname = noeuds[ii].cStatName.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_")
+        aa = [ii, noeuds[ii].uknom, busname, noeuds[ii].GetBusType()]
+        # [numero,nominal KV,busname]
+        buses.append(aa)
+    # ==============================================================#
+    # Loads data (busnumber, active, reactive, status, name, id)
+    tous = []
+    for grid in grids:
+        tous.extend(grid.obj_id.GetContents( '*.ElmLod', 1))
+    tous = sorted(tous, key=lambda x: x.bus1.cBusBar.cStatName)
+    LoadDico = {}
+    for bus in buses:
+        idload = 0
+        for load in tous:
+            busname = load.bus1.cBusBar.cStatName
+            busname = busname.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_")
+            if busname == bus[2]:
+                idload += 1  # cree id pour load
+                busnumber = bus[0]
+                loadname = busname
+                loadname = loadname.replace(" ", "_")
+                loadname = loadname.replace("-", "_")
+                loadname = loadname.replace(".", "_")
+                loadname = loadname.replace("/", "_")
+                loadname = loadname.replace("&", "and")
+                loadname = loadname.replace("%","pct")
+                loadname = loadname.replace("=","eq")
+                loadname = loadname.replace("#","_")
+                loadname = loadname.replace("$","_")
+                loadname = loadname.replace("\\","_")
+                loadname = loadname.replace("(","_")
+                loadname = loadname.replace(")","_")
+                try:
+                    int(loadname[0])
+                    loadname = "C_" + loadname
+                except:
+                    pass
+                loadname=loadname+'_Lo'+str(idload)
+                #p = load.plini  #CM
+                #q = load.qlini  #CM
+                p = load.plini_a
+                q = load.qlini_a
+                LoadDico[loadname] = {}
+                LoadDico[loadname]['NAME'] = load.loc_name.strip()
+                LoadDico[loadname]['ID'] = idload
+                LoadDico[loadname]['EXNAME'] = busname + '_' + str(bus[1])+'KV'
+                LoadDico[loadname]['NUMBER'] = busnumber
+                LoadDico[loadname]['P'] = p
+                LoadDico[loadname]['Q'] = q
+    # ==============================================================#Generator
+    MachineDico = {}  # [Bus name, machine ID, extended bus name, bus number]
+    tous = []
+    for grid in grids:
+        tous.extend(grid.obj_id.GetContents( '*.ElmSym', 1))
+
+    for plant in tous:
+        if plant.i_mot == 0:
+            busname = plant.bus1.cBusBar.cStatName
+            busname = busname.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_")
+            for ii in range(len(buses)):
+                if busname in buses[ii]:
+                    busnumber = ii
+                    break
+            idplant = plant.loc_name#plant.ngnum
+#            p = plant.pgini  #CM
+#            q = plant.qgini  #CM
+            p = plant.pgini_a
+            q = plant.qgini_a
+            pmax = plant.Pmax_uc
+            pmin = plant.Pmin_uc
+            qmax = plant.cQ_max
+            qmin = plant.cQ_min
+            machinename = busname + '_' + 'syn_' + 'Gr_' + str(idplant)  # generator synchrone
+            machinename = machinename.replace(" ", "_")
+            # machinename = machinename.replace("Generator", "gen")
+            machinename = machinename.replace("-", "_")
+            machinename = machinename.replace(".", "_")
+            machinename = machinename.replace("/", "_")
+            machinename = machinename.replace("&", "and")
+            machinename = machinename.replace("%","pct")
+            machinename = machinename.replace("=","eq")
+            machinename = machinename.replace("#","_")
+            machinename = machinename.replace("$","_")
+            machinename = machinename.replace("\\","_")   
+            machinename = machinename.replace("(","_")
+            machinename = machinename.replace(")","_") 
+            # machinename = machinename + '_' +'syn_' + 'Gr_' + str(idplant) # generator synchrone
+            try:
+                int(machinename[0])
+                machinename = "G_" + machinename
+            except:
+                pass
+
+            MachineDico[machinename] = {}
+            MachineDico[machinename]['NAME'] = plant.loc_name
+            MachineDico[machinename]['ID'] = idplant
+            MachineDico[machinename]['EXNAME'] = busname + '_' + str(bus[1])+'KV'
+            MachineDico[machinename]['NUMBER'] = busnumber
+            MachineDico[machinename]['P'] = p
+            MachineDico[machinename]['Q'] = q
+            MachineDico[machinename]['PMAX'] = pmax
+            MachineDico[machinename]['QMAX'] = qmax
+            MachineDico[machinename]['PMIN'] = pmin
+            MachineDico[machinename]['QMIN'] = qmin
+    tous = []
+    for grid in grids:
+        tous.extend(grid.obj_id.GetContents( '*.ElmAsm', 1))
+
+    for plant in tous:
+        if plant.i_mot == 0:
+            busname = plant.bus1.cBusBar.cStatName
+            busname = busname.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_")
+            for ii in range(len(buses)):
+                if busname in buses[ii]:
+                    busnumber = ii
+                    break
+            idplant = plant.loc_name
+#            p = plant.pgini  #CM
+#            q = plant.qgini  #CM
+            p = plant.pgini_a
+            q = plant.qgini_a
+            pmax = plant.Pmax_uc
+            pmin = plant.Pmin_uc
+            qmax = plant.cQ_max
+            qmin = plant.cQ_min
+            machinename = busname + '_' + 'asyn_' + 'Gr_' + str(idplant)  # generator asynchrone
+            machinename = machinename.replace(" ", "_")
+            machinename = machinename.replace("-", "_")
+            machinename = machinename.replace(".", "_")
+            machinename = machinename.replace("/", "_")
+            machinename = machinename.replace("&", "and")
+            machinename = machinename.replace("%","pct")
+            machinename = machinename.replace("=","eq")
+            machinename = machinename.replace("#","_")
+            machinename = machinename.replace("$","_")
+            machinename = machinename.replace("\\","_")   
+            machinename = machinename.replace("(","_")
+            machinename = machinename.replace(")","_")
+            # machinename = machinename + '_' +'asyn_' + 'Gr_' + str(idplant) # generator asynchrone
+            try:
+                int(machinename[0])
+                machinename = "G_" + machinename
+            except:
+                pass
+
+            MachineDico[machinename] = {}
+            MachineDico[machinename]['NAME'] = plant.loc_name
+            MachineDico[machinename]['ID'] = idplant
+            MachineDico[machinename]['EXNAME'] = busname + '_' + str(bus[1])+'KV'
+            MachineDico[machinename]['NUMBER'] = busnumber
+            MachineDico[machinename]['P'] = p
+            MachineDico[machinename]['Q'] = q
+            MachineDico[machinename]['PMAX'] = pmax
+            MachineDico[machinename]['QMAX'] = qmax
+            MachineDico[machinename]['PMIN'] = pmin
+            MachineDico[machinename]['QMIN'] = qmin
+    tous = []
+    for grid in grids:
+        tous.extend(grid.obj_id.GetContents( '*.ElmGenstat', 1))
+    for plant in tous:
+        busname = plant.bus1.cBusBar.cStatName
+        busname = busname.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_")
+        for ii in range(len(buses)):
+            if busname in buses[ii]:
+                busnumber = ii
+                break
+        idplant = plant.loc_name
+#            p = plant.pgini  #CM
+#            q = plant.qgini  #CM
+        p = plant.pgini_a
+        q = plant.qgini_a
+        pmax = plant.Pmax_uc
+        pmin = plant.Pmin_uc
+        qmax = plant.cQ_max
+        qmin = plant.cQ_min
+        machinename = busname + '_' + 'genstat_' + 'Gr_' + str(idplant)  # generator static
+        machinename = machinename.replace(" ", "_")
+        machinename = machinename.replace("-", "_")
+        machinename = machinename.replace(".", "_")
+        machinename = machinename.replace("/", "_")
+        machinename = machinename.replace("&", "and")
+        machinename = machinename.replace("%","pct")
+        machinename = machinename.replace("=","eq")
+        machinename = machinename.replace("#","_")
+        machinename = machinename.replace("$","_")
+        machinename = machinename.replace("\\","_")   
+        machinename = machinename.replace("(","_")
+        machinename = machinename.replace(")","_")
+
+        try:
+            int(machinename[0])
+            machinename = "G_" + machinename
+        except:
+            pass
+
+        MachineDico[machinename] = {}
+        MachineDico[machinename]['NAME'] = plant.loc_name
+        MachineDico[machinename]['ID'] = idplant
+        MachineDico[machinename]['EXNAME'] = busname + '_' + str(bus[1]) + 'KV'
+        MachineDico[machinename]['NUMBER'] = busnumber
+        MachineDico[machinename]['P'] = p
+        MachineDico[machinename]['Q'] = q
+        MachineDico[machinename]['PMAX'] = pmax
+        MachineDico[machinename]['QMAX'] = qmax
+        MachineDico[machinename]['PMIN'] = pmin
+        MachineDico[machinename]['QMIN'] = qmin
+
+    tous = []
+    for grid in grids:
+        tous.extend(grid.obj_id.GetContents( '*.ElmPvsys', 1))
+    for plant in tous:
+        busname = plant.bus1.cBusBar.cStatName
+        busname = busname.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_")
+        for ii in range(len(buses)):
+            if busname in buses[ii]:
+                busnumber = ii
+                break
+        idplant = plant.loc_name#plant.ngnum
+#            p = plant.pgini  #CM
+#            q = plant.qgini  #CM
+        p = plant.pgini_a
+        q = plant.qgini_a
+        pmax = plant.Pmax_uc
+        pmin = plant.Pmin_uc
+        qmax = plant.cQ_max
+        qmin = plant.cQ_min
+        machinename = busname + '_' + 'pv_' + 'Gr_' + str(idplant)  # generator PV
+        machinename = machinename.replace(" ", "_")
+        machinename = machinename.replace("-", "_")
+        machinename = machinename.replace(".", "_")
+        machinename = machinename.replace("/", "_")
+        machinename = machinename.replace("&", "and")
+        machinename = machinename.replace("%","pct")
+        machinename = machinename.replace("=","eq")
+        machinename = machinename.replace("#","_")
+        machinename = machinename.replace("$","_")
+        machinename = machinename.replace("\\","_")   
+        machinename = machinename.replace("(","_")
+        machinename = machinename.replace(")","_")
+
+        try:
+            int(machinename[0])
+            machinename = "G_" + machinename
+        except:
+            pass
+
+        MachineDico[machinename] = {}
+        MachineDico[machinename]['NAME'] = plant.loc_name
+        MachineDico[machinename]['ID'] = idplant
+        MachineDico[machinename]['EXNAME'] = busname + '_' + str(bus[1]) + 'KV'
+        MachineDico[machinename]['NUMBER'] = busnumber
+        MachineDico[machinename]['P'] = p
+        MachineDico[machinename]['Q'] = q
+        MachineDico[machinename]['PMAX'] = pmax
+        MachineDico[machinename]['QMAX'] = qmax
+        MachineDico[machinename]['PMIN'] = pmin
+        MachineDico[machinename]['QMIN'] = qmin
+    # ==============================================================#Motor
+
+    MotorDico = {}  # [Bus name, machine ID, extended bus name, bus number]
+    tous = []
+    for grid in grids:
+        tous.extend(grid.obj_id.GetContents( '*.ElmSym', 1))
+
+    for plant in tous:
+        if plant.i_mot == 1:
+            busname = plant.bus1.cBusBar.cStatName
+            for ii in range(len(buses)):
+                if busname in buses[ii]:
+                    busnumber = ii
+                    break
+            idplant = plant.loc_name#plant.ngnum
+#            p = plant.pgini  #CM
+#            q = plant.qgini  #CM
+            p = plant.pgini_a
+            q = plant.qgini_a
+            pmax = plant.Pmax_uc
+            pmin = plant.Pmin_uc
+            qmax = plant.cQ_max
+            qmin = plant.cQ_min
+            machinename = busname + '_' + 'syn_' + 'Mo_' + str(idplant)  # Motor synchrone
+            machinename = machinename.replace(" ", "_")
+            machinename = machinename.replace("-", "_")
+            machinename = machinename.replace(".", "_")
+            machinename = machinename.replace("/", "_")
+            machinename = machinename.replace("&", "and")
+            machinename = machinename.replace("%","pct")
+            machinename = machinename.replace("=","eq")
+            machinename = machinename.replace("#","_")
+            machinename = machinename.replace("$","_")
+            machinename = machinename.replace("\\","_")   
+            machinename = machinename.replace("(","_")
+            machinename = machinename.replace(")","_")
+
+            try:
+                int(machinename[0])
+                machinename = "M_" + machinename
+            except:
+                pass
+            MotorDico[machinename] = {}
+            MotorDico[machinename]['NAME'] = plant.loc_name
+            MotorDico[machinename]['ID'] = idplant
+            MotorDico[machinename]['EXNAME'] = busname + '_' + str(bus[1])+'KV'
+            MotorDico[machinename]['NUMBER'] = busnumber
+            MotorDico[machinename]['P'] = p
+            MotorDico[machinename]['Q'] = q
+            MotorDico[machinename]['PMAX'] = pmax
+            MotorDico[machinename]['QMAX'] = qmax
+            MotorDico[machinename]['PMIN'] = pmin
+            MotorDico[machinename]['QMIN'] = qmin
+    tous = []
+    for grid in grids:
+        tous.extend(grid.obj_id.GetContents( '*.ElmAsm', 1))
+
+    for plant in tous:
+        if plant.i_mot == 1:
+            busname = plant.bus1.cBusBar.cStatName
+            busname = busname.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_")
+            for ii in range(len(buses)):
+                if busname in buses[ii]:
+                    busnumber = ii
+                    break
+            idplant = plant.loc_name#plant.ngnum
+#            p = plant.pgini  #CM
+#            q = plant.qgini  #CM
+            p = plant.pgini_a
+            q = plant.qgini_a
+            # pmax = plant.Pmax_uc
+            pmax = plant.P_max
+            pmin = plant.Pmin_uc
+            qmax = plant.cQ_max
+            qmin = plant.cQ_min
+            machinename = busname + '_' + 'asyn_' + 'Mo_' + str(idplant)  # moteur asynchrone
+            machinename = machinename.replace(" ", "_")
+            machinename = machinename.replace("-", "_")
+            machinename = machinename.replace(".", "_")
+            machinename = machinename.replace("/", "_")
+            machinename = machinename.replace("&", "and")
+            machinename = machinename.replace("%","pct")
+            machinename = machinename.replace("=","eq")
+            machinename = machinename.replace("#","_")
+            machinename = machinename.replace("$","_")
+            machinename = machinename.replace("\\","_")   
+            machinename = machinename.replace("(","_")
+            machinename = machinename.replace(")","_")
+
+            try:
+                int(machinename[0])
+                machinename = "M_" + machinename
+            except:
+                pass
+            MotorDico[machinename] = {}
+            MotorDico[machinename]['NAME'] = plant.loc_name
+            MotorDico[machinename]['ID'] = idplant
+            MotorDico[machinename]['EXNAME'] = busname + '_' + str(bus[1]) + 'KV'
+            MotorDico[machinename]['NUMBER'] = busnumber
+            MotorDico[machinename]['P'] = p
+            MotorDico[machinename]['Q'] = q
+            MotorDico[machinename]['PMAX'] = pmax
+            MotorDico[machinename]['QMAX'] = qmax
+            MotorDico[machinename]['PMIN'] = pmin
+            MotorDico[machinename]['QMIN'] = qmin
+    # ==============================================================#
+    LineDico = {}  # [linename, Bus name 1, Bus name 2, ID, extended bus name 1, extended bus name 2, bus number 1, bus number 2]
+    tous = []
+    for grid in grids:
+        tous.extend(grid.obj_id.GetContents( '*.ElmLne', 1))
+    for line in tous:
+        linename = line.loc_name
+        frombus_name = line.bus1.cBusBar.cStatName
+        frombus_name = frombus_name.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_")
+        for ii in range(len(buses)):
+            if frombus_name in buses[ii]:
+                frombus_number = ii
+                frombus_KV=buses[ii][1]
+                break
+        tobus_name = line.bus2.cBusBar.cStatName
+        tobus_name = tobus_name.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_")
+        for ii in range(len(buses)):
+            if tobus_name in buses[ii]:
+                tobus_number = ii
+                tobus_KV=buses[ii][1]
+                break
+        idline = line.loc_name#line.nlnum
+        linename=frombus_name+'_'+tobus_name+'_'+idline+'_Li'
+        linename = linename.replace(" ", "_")
+        linename = linename.replace("-", "_")
+        linename = linename.replace(".", "_")
+        linename = linename.replace("/", "_")
+        linename = linename.replace("&", "and")
+        linename = linename.replace("%","pct")
+        linename = linename.replace("=","eq")
+        linename = linename.replace("#","_")
+        linename = linename.replace("$","_")
+        linename = linename.replace("\\","_")   
+        linename = linename.replace("(","_")
+        linename = linename.replace(")","_") 
+        try:
+            int(linename[0])
+            linename = "L_" + linename
+        except:
+            pass
+        if NoBreakersandSwitches:
+            LineDico[linename] = {}
+            LineDico[linename]['FROMNAME'] = frombus_name
+            LineDico[linename]['TONAME'] = tobus_name
+            LineDico[linename]['ID'] = idline
+            LineDico[linename]['FROMEXNAME'] = frombus_name+'_'+str(frombus_KV)
+            LineDico[linename]['TOEXNAME'] = tobus_name+'_'+str(tobus_KV)
+            LineDico[linename]['FROMNUMBER'] = frombus_number  # il n'y a pas de bus number dans PowerFactory
+            LineDico[linename]['TONUMBER'] = tobus_number
+
+
+    print ("Read lines")
+    # Extract Transfos
+    TfoDico = {}  # [tranlinename, Bus name 1, Bus name 2, machine ID, extended bus name 1, extended bus name 2, bus number 1, bus number 2]
+    tous = []
+    for grid in grids:
+        tous.extend(grid.obj_id.GetContents( '*.ElmTr2', 1))
+
+    for tfo in tous:
+        # tfosname = tfo.loc_name
+        id_tfo=tfo.loc_name#tfo.ntnum
+        frombus_name=tfo.bushv.cBusBar.cStatName
+        tobus_name=tfo.buslv.cBusBar.cStatName
+        frombus_name = frombus_name.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_")
+        tobus_name = tobus_name.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_")
+        for ii in range(len(buses)):
+            if frombus_name in buses[ii]:
+                frombus_number = ii
+                frombus_KV=buses[ii][1]
+                break
+        for ii in range(len(buses)):
+            if tobus_name in buses[ii]:
+                tobus_number = ii
+                tobus_KV=buses[ii][1]
+                break
+
+        tfoname = frombus_name+'_' +tobus_name+'_' + str(id_tfo)+'_'+'Tr'
+        tfoname = tfoname.replace(" ", "_")
+        tfoname = tfoname.replace("-", "_")
+        tfoname = tfoname.replace(".", "_")
+        tfoname = tfoname.replace("/", "_")
+        tfoname = tfoname.replace("&", "and")
+        tfoname = tfoname.replace("%","pct")
+        tfoname = tfoname.replace("=","eq")
+        tfoname = tfoname.replace("#","_")
+        tfoname = tfoname.replace("$","_")
+        tfoname = tfoname.replace("\\","_")   
+        tfoname = tfoname.replace("(","_")
+        tfoname = tfoname.replace(")","_")       
+        try:
+            int(tfoname[0])
+            tfoname = "_" + tfoname
+        except:
+            pass
+        if NoBreakersandSwitches:
+            TfoDico[tfoname] = {}
+            TfoDico[tfoname]['FROMNAME'] = frombus_name
+            TfoDico[tfoname]['TONAME'] = tobus_name
+            TfoDico[tfoname]['ID'] = id_tfo
+            TfoDico[tfoname]['FROMEXNAME'] = frombus_name+'_'+str(frombus_KV)
+            TfoDico[tfoname]['TOEXNAME'] = tobus_name+str(tobus_KV)
+            TfoDico[tfoname]['FROMNUMBER'] = frombus_number # il n'y a pas de bus number dans PowerFactory
+            TfoDico[tfoname]['TONUMBER'] = tobus_number
+            TfoDico[tfoname]['#WIND'] = 2
+
+    # Extract 3 winding Transfos
+    tous = []
+    for grid in grids:
+        tous.extend(grid.obj_id.GetContents( '*.ElmTr3', 1))
+    for tfo in tous:
+        # tfosname = tfo.loc_name
+        id_tfo = tfo.loc_name#tfo.nt3nm
+        frombus_name = tfo.bushv.cBusBar.cStatName
+        tobus_name = tfo.busmv.cBusBar.cStatName
+        bus3 = tfo.buslv.cBusBar.cStatName
+        frombus_name = frombus_name.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_")
+        tobus_name = tobus_name.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_")
+        bus3 = bus3.replace('/','_').replace(')','_').replace('(','_').replace(" ","_").replace("-","_").replace(".","_").replace("&","and").replace("%","pct").replace("=","eq").replace("#","_").replace("$","_")
+        for ii in range(len(buses)):
+            if frombus_name in buses[ii]:
+                frombus_number = ii
+                frombus_KV=buses[ii][1]
+                break
+        for ii in range(len(buses)):
+            if tobus_name in buses[ii]:
+                tobus_number = ii
+                tobus_KV=buses[ii][1]
+                break
+        for ii in range(len(buses)):
+            if bus3 in buses[ii]:
+                bus3_number = ii
+                bus3_KV=buses[ii][1]
+                break
+        tfoname = frombus_name+ '_' + tobus_name + '_' +bus3+'_' + str(id_tfo)+'_'+ 'Tr3'
+        tfoname = tfoname.replace(" ", "_")
+        tfoname = tfoname.replace("-", "_")
+        tfoname = tfoname.replace(".", "_")
+        tfoname = tfoname.replace("/", "_")
+        tfoname = tfoname.replace("&", "and")
+        tfoname = tfoname.replace("%","pct")
+        tfoname = tfoname.replace("=","eq")
+        tfoname = tfoname.replace("#","_")
+        tfoname = tfoname.replace("$","_")
+        tfoname = tfoname.replace("\\","_")   
+        tfoname = tfoname.replace("(","_")
+        tfoname = tfoname.replace(")","_")       
+        try:
+            int(tfoname[0])
+            tfoname = "_" + tfoname
+        except:
+            pass
+        if NoBreakersandSwitches:
+            TfoDico[tfoname] = {}
+            TfoDico[tfoname]['FROMNAME'] = frombus_name
+            TfoDico[tfoname]['TONAME'] = tobus_name
+            TfoDico[tfoname]['3NAME']= bus3
+            TfoDico[tfoname]['ID'] = id_tfo
+            TfoDico[tfoname]['FROMEXNAME'] = frombus_name+'_'+str(frombus_KV)
+            TfoDico[tfoname]['TOEXNAME'] = tobus_name+'_'+str(tobus_KV)
+            TfoDico[tfoname]['3EXNAME']=bus3+'_'+str(bus3_KV)
+            TfoDico[tfoname]['FROMNUMBER'] = frombus_number  # il n'y a pas de bus number dans PowerFactory
+            TfoDico[tfoname]['TONUMBER'] = tobus_number
+            TfoDico[tfoname]['3NUMBER'] = bus3_number
+            TfoDico[tfoname]['#WIND'] = 3
+
+    print ("Read 3-Winding Transfos")
+    prj.Delete()
+
+    return MachineDico, LoadDico, LineDico, TfoDico, MotorDico
+filer=open('temp.txt','r')
+_path=[]
+for line in filer:
+    _path.append(line)
+filer.close()
+pfd_file=_path[0].replace('\n','')
+PF_path=_path[1].replace('\n','')
+
+MachineDico, LoadDico, LineDico, TransfoDico, MotorDico = PFExtractData(pfd_file,PF_path)
+Data={}
+Data['MachineDico']=MachineDico
+Data['LoadDico']=LoadDico
+Data['LineDico']=LineDico
+Data['TransfoDico']=TransfoDico
+Data['MotorDico']=MotorDico
+# Data=[MachineDico, LoadDico, LineDico, TransfoDico, MotorDico]
+import pickle
+# print('=========='+str(pickle.HIGHEST_PROTOCOL)+'=========')
+with open('Data_for_interface', 'wb') as fichier:
+       mon_pickler = pickle.Pickler(fichier,protocol=2)
+       mon_pickler.dump(Data)
+
diff --git a/PSSE_PF_Eficas/configuration_PSEN.py b/PSSE_PF_Eficas/configuration_PSEN.py
new file mode 100644 (file)
index 0000000..33ab30f
--- /dev/null
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+#            CONFIGURATION MANAGEMENT OF EDF VERSION
+# ======================================================================
+# COPYRIGHT (C) 1991 - 2002  EDF R&D                  WWW.CODE-ASTER.ORG
+# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
+# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
+# (AT YOUR OPTION) ANY LATER VERSION.
+#
+# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+#
+# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
+# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
+#    1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
+#
+#
+# ======================================================================
+"""
+    Ce module sert pour charger les paramètres de configuration d'EFICAS
+"""
+# Modules Python
+from InterfaceQT4 import configuration
+import os
+
+
+class CONFIG(configuration.CONFIG_BASE):
+
+  #-----------------------------------
+  def __init__(self,appli,repIni):
+  #-----------------------------------
+
+      self.labels_user=['catalogues','lang']
+      self.labels_eficas=['lang','rep_cata','catalogues']
+
+      configuration.CONFIG_BASE.__init__(self,appli,'.Eficas_monCode')
+
+
+def make_config(appli,rep):
+    return CONFIG(appli,rep)
+
diff --git a/PSSE_PF_Eficas/debugPFWrapper.py b/PSSE_PF_Eficas/debugPFWrapper.py
new file mode 100644 (file)
index 0000000..0712ed4
--- /dev/null
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+"""
+Created on Thu Feb  9 14:57:43 2017
+
+@author: j15773
+"""
+
+import sys,os
+path1 = os.path.abspath(os.path.join(os.path.abspath(__file__), '../', '../', 'PSEN_Eficas', 'PSEN'))
+sys.path.append(path1) 
+import PSENconfig
+import subprocess
+import PFWrapper
+
+filer = open('temp.txt', 'r')
+_path = []
+for line in filer:
+    _path.append(line)
+filer.close()
+
+Python3_path = _path[2].replace('\n', '')
+
+WrapperFilePath = os.path.join(path1, 'PFWrapper.py')
+p = subprocess.Popen([Python3_path + '/python.exe', WrapperFilePath])
+
+(out, err) = p.communicate()
+print out
+print err
diff --git a/PSSE_PF_Eficas/mesScripts.py b/PSSE_PF_Eficas/mesScripts.py
new file mode 100644 (file)
index 0000000..15f80ed
--- /dev/null
@@ -0,0 +1,35 @@
+def view_zone(listeparam) :
+    item=listeparam[0]
+    import visu_geom
+    visu_zone = visu_geom.VisuGeom(from_eficas=True,
+                          eficas_item=item,
+                          ligne_arbre=False)
+    visu_zone.visualize()
+
+def view_ligne_arbre(listeparam) :
+    item=listeparam[0]
+    import visu_geom
+    visu_arbre = visu_geom.VisuGeom(from_eficas=True,
+                           eficas_item=item,
+                           ligne_arbre=True)
+    visu_arbre.visualize()
+
+def import_zone(listeparam,appli) :
+    item=listeparam[0]
+    # simulation de la recuperation zone
+    #import eficasSalome
+    #eficasSalome.runEficas(code='MT',fichier='/home/I29518/test_zone.comm')
+    appli.viewmanager.handleOpen(fichier='/home/A96028/Install_EficasV1/EficasV1/MT/MT_include.comm')
+
+def import_zone2(listeparam,appli) :
+    editor=listeparam[0]
+    itemWidget=listeparam[1]
+    texte="sansnom=ZONE(NOEUDS=(_F(NOM='N1', X=0.0,), _F(NOM='N2', X=0.19,),), ELEMENTS=(_F(NOM='E1', DEBUT='N1', FIN='N2', RAFFINAGE='NON', MATERIAU=MAT_R01, SECTION_MASSE=_F(TYPE_SECTION='CONSTANTE', DIAM_EXTERN_DEBUT=0.1, DIAM_INTERN_DEBUT=0,), SECTION_RIGIDITE=_F(TYPE_SECTION='CONSTANTE', DIAM_EXTERN_DEBUT=0.1, DIAM_INTERN_DEBUT=0.0,),), _F(NOM='E2', DEBUT='N2', FIN='N3', RAFFINAGE='NON', MATERIAU=MAT_R01, SECTION_MASSE=_F(TYPE_SECTION='VARIABLE', DIAM_EXTERN_DEBUT=0.1, DIAM_INTERN_DEBUT=0, DIAM_EXTERN_SORTIE=0.2, DIAM_INTERN_SORTIE=0.0,), SECTION_RIGIDITE=_F(TYPE_SECTION='VARIABLE', DIAM_EXTERN_DEBUT=0.1, DIAM_INTERN_DEBUT=0.0, DIAM_EXTERN_SORTIE=0.2, DIAM_INTERN_SORTIE=0.0,),),),);"
+    editor.updateJdc(itemWidget,texte)
+
+def Source():
+    print "jjjjjjjjjjjjjjjjjjj"
+
+dict_commandes={
+       'GENDOF':(Source,"Source",(),False,True,"affiche un message"),
+               }
diff --git a/PSSE_PF_Eficas/opsPSEN.py b/PSSE_PF_Eficas/opsPSEN.py
new file mode 100644 (file)
index 0000000..ad26a26
--- /dev/null
@@ -0,0 +1,111 @@
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2013   EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from ExtractGeneratorLoadLineandTransfoDico import ExtractGeneratorLoadLineandTransfoDico,PFExtractGeneratorLoadLineandTransfoDico
+# from ExtractGeneratorLoadLineandTransfoDico import ExtractGeneratorLoadLineandTransfoDico
+
+def INCLUDE(self,PSSE_path,PSSPY_path,sav_file,**args):
+   """ 
+       Fonction sd_prod pour la macro INCLUDE
+   """
+   
+   if sav_file==None: return
+   reevalue=0
+   listeADeTruire=[]
+   listeNouveau=[]
+   toClean=False
+   if hasattr(self,'fichier_ini'):
+       reevalue=1
+       if self.fichier_ini == sav_file : return
+       self.fichier_ini=sav_file
+       if hasattr(self,'old_context_fichier_init' ):
+         toClean=True
+         for concept in self.old_context_fichier_init.values():
+             #self.jdc.delete_concept(concept)
+             listeADeTruire.append(concept)
+         self.jdc_aux=None
+         self.contexte_fichier_init={}
+         #self.reevalue_sd_jdc()
+         self.jdc.reset_context()
+
+   self.fichier_ini=sav_file
+   self.contexte_fichier_init = {}
+   self.fichier_unite = 999
+   self.fichier_err = None
+   self.fichier_text=""
+    
+   unite = 999
+   try :
+        print('before ExtractGeneratorLoadLineandTransfoDico')
+        MachineDico,LoadDico,LineDico,TransfoDico, MotorDico = ExtractGeneratorLoadLineandTransfoDico(sav_file,PSSE_path,PSSPY_path)
+        print('after extract')
+   except :
+       if self.jdc.appli is not None:
+            self.jdc.appli.affiche_alerte("Error", 'An error happened in ExtractGeneratorandLoadList execution ')
+            self.g_context = {}
+            self.etapes = []
+            self.jdc_aux = None
+            self.fichier_err = str(exc)
+            self.contexte_fichier_init = {}
+
+   
+   for nom in MachineDico.keys():
+      self.fichier_text += "%s=MONGENER(ID='%s',);\n" % (nom, 'a')
+      listeNouveau.append(nom)
+
+   for nom in LoadDico.keys():
+      self.fichier_text += "%s=MACHARGE(ID='%s',);\n" % (nom, 'a')
+      listeNouveau.append(nom)
+      
+   for nom in LineDico.keys():
+      self.fichier_text += "%s=MALIGNE(ID='%s',);\n" % (nom,'a')
+      listeNouveau.append(nom)
+
+   for nom in TransfoDico.keys():
+      self.fichier_text += "%s=MONTRANSFO(ID='%s',);\n" % (nom,'a')
+      listeNouveau.append(nom)
+
+   for nom in MotorDico.keys():
+      self.fichier_text += "%s=MONMOTEUR(ID='%s',);\n" % (nom,'a')
+
+   import Extensions.jdc_include
+   self.JdC_aux = Extensions.jdc_include.JDC_CATA_INCLUDE(code='PSEN', execmodul=None)
+   self.make_contexte_include(None, self.fichier_text)
+   self.old_context_fichier_init = self.contexte_fichier_init
+   self.parent.record_unit(unite, self)
+
+   self.jdc.MachineDico=MachineDico
+   self.jdc.LoadDico=LoadDico
+   self.jdc.LineDico=LineDico
+   self.jdc.TransfoDico=TransfoDico
+   self.jdc.MotorDico = MotorDico
+
+   if toClean:
+    for concept in listeADeTruire :
+      if concept.nom not in listeNouveau: self.jdc.delete_concept(concept)
+    self.reevalue_sd_jdc()
+
+def INCLUDE_context(self,d):
+   """ 
+       Fonction op_init pour macro INCLUDE
+   """
+   for k,v in self.g_context.items():
+      d[k]=v
+
diff --git a/PSSE_PF_Eficas/opsPSEN_PF.py b/PSSE_PF_Eficas/opsPSEN_PF.py
new file mode 100644 (file)
index 0000000..269402b
--- /dev/null
@@ -0,0 +1,112 @@
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2013   EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from ExtractGeneratorLoadLineandTransfoDico import PFExtractGeneratorLoadLineandTransfoDico
+
+def INCLUDE(self, PF_path, pfd_file,Python3_path, **args):
+   """ 
+       Fonction sd_prod pour la macro INCLUDE
+   """
+   
+   if pfd_file==None: return
+   reevalue=0
+   listeADeTruire=[]
+   listeNouveau=[]
+   toClean=False
+   if hasattr(self,'fichier_ini'):
+       reevalue=1
+       if self.fichier_ini == pfd_file : return
+       self.fichier_ini=pfd_file
+       if hasattr(self,'old_context_fichier_init' ):
+         toClean=True
+         for concept in self.old_context_fichier_init.values():
+             #self.jdc.delete_concept(concept)
+             listeADeTruire.append(concept)
+         self.jdc_aux=None
+         self.contexte_fichier_init={}
+         #self.reevalue_sd_jdc()
+         self.jdc.reset_context()
+
+   self.fichier_ini=pfd_file
+   self.contexte_fichier_init = {}
+   self.fichier_unite = 999
+   self.fichier_err = None
+   self.fichier_text=""
+    
+   unite = 999
+
+   try:
+       print('before PFExtractGeneratorLoadLineandTransfoDico')
+       MachineDico, LoadDico, LineDico, TransfoDico, MotorDico = PFExtractGeneratorLoadLineandTransfoDico(pfd_file, PF_path,Python3_path)
+
+       print('after extract')
+   except :
+     if self.jdc.appli is not None:
+        self.jdc.appli.affiche_alerte("Error", 'An error happened in ExtractGeneratorandLoadList execution ')
+        self.g_context = {}
+        self.etapes = []
+        self.jdc_aux = None
+        self.fichier_err = str(exc)
+        self.contexte_fichier_init = {}
+
+   
+   for nom in MachineDico.keys():
+      self.fichier_text += "%s=MONGENER(ID='%s',);\n" % (nom, 'a')
+      listeNouveau.append(nom)
+
+   for nom in LoadDico.keys():
+      self.fichier_text += "%s=MACHARGE(ID='%s',);\n" % (nom, 'a')
+      listeNouveau.append(nom)
+      
+   for nom in LineDico.keys():
+      self.fichier_text += "%s=MALIGNE(ID='%s',);\n" % (nom,'a')
+      listeNouveau.append(nom)
+
+   for nom in TransfoDico.keys():
+      self.fichier_text += "%s=MONTRANSFO(ID='%s',);\n" % (nom,'a')
+      listeNouveau.append(nom)
+
+   for nom in MotorDico.keys():
+      self.fichier_text += "%s=MONMOTEUR(ID='%s',);\n" % (nom,'a')
+
+   import Extensions.jdc_include
+   self.JdC_aux = Extensions.jdc_include.JDC_CATA_INCLUDE(code='PSEN', execmodul=None)
+   self.make_contexte_include(None, self.fichier_text)
+   self.old_context_fichier_init = self.contexte_fichier_init
+   self.parent.record_unit(unite, self)
+
+   self.jdc.MachineDico=MachineDico
+   self.jdc.LoadDico=LoadDico
+   self.jdc.LineDico=LineDico
+   self.jdc.TransfoDico=TransfoDico
+   self.jdc.MotorDico = MotorDico
+
+   if toClean:
+    for concept in listeADeTruire :
+      if concept.nom not in listeNouveau: self.jdc.delete_concept(concept)
+    self.reevalue_sd_jdc()
+
+def INCLUDE_context(self,d):
+   """ 
+       Fonction op_init pour macro INCLUDE
+   """
+   for k,v in self.g_context.items():
+      d[k]=v
+
diff --git a/PSSE_PF_Eficas/prefs.py b/PSSE_PF_Eficas/prefs.py
new file mode 100644 (file)
index 0000000..c19b171
--- /dev/null
@@ -0,0 +1,22 @@
+# Copyright (C) 2007-2012   EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+code="PSEN" 
+import sys, os
+if os.path.dirname(os.path.abspath(__file__)) not in sys.path :
+   sys.path.insert(0,os.path.dirname(os.path.abspath(__file__)))
diff --git a/PSSE_PF_Eficas/prefs_PSEN.py b/PSSE_PF_Eficas/prefs_PSEN.py
new file mode 100644 (file)
index 0000000..c9ab6fb
--- /dev/null
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+#            CONFIGURATION MANAGEMENT OF EDF VERSION
+# ======================================================================
+# COPYRIGHT (C) 1991 - 2002  EDF R&D                  WWW.CODE-ASTER.ORG
+# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
+# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
+# (AT YOUR OPTION) ANY LATER VERSION.
+#
+# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+#
+# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
+# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
+#    1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
+#
+#
+# ======================================================================
+
+import os,sys
+# repIni sert a localiser le fichier editeur.ini
+# Obligatoire
+repIni=os.path.dirname(os.path.abspath(__file__))
+INSTALLDIR=os.path.join(repIni,'..')
+sys.path[:0]=[INSTALLDIR]
+
+
+# lang indique la langue utilisee pour les chaines d'aide : fr ou ang
+lang='en' #'fr'
+
+# Codage des strings qui accepte les accents (en remplacement de 'ascii')
+encoding='iso-8859-1'
+docPath=repIni
+
+
+#
+catalogues=(
+   ('PSEN', 'PSEN for PSSE', os.path.join(repIni, 'PSEN_Cata.py'), 'PSEN', 'python'),
+   ('PSEN','PSEN for PowerFactory',os.path.join(repIni,'PSEN_Cata_PF.py'),'PSEN','python'),
+  
+)
+#simpleClic=True
+#nombreDeBoutonParLigne=2
diff --git a/PSSE_PF_Eficas/properties.py b/PSSE_PF_Eficas/properties.py
new file mode 100644 (file)
index 0000000..1d328a4
--- /dev/null
@@ -0,0 +1,24 @@
+#@ MODIF properties Accas DATE 11/06/2008 AUTEUR aster M.ADMINISTRATEUR
+# RESPONSABLE D6BHHHH J-P.LEFEBVRE
+# ======================================================================
+# COPYRIGHT (C) 1991 - 2001  EDF R&D                  WWW.CODE-ASTER.ORG
+# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
+# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR   
+# (AT YOUR OPTION) ANY LATER VERSION.                                 
+#
+# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT 
+# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF          
+# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU    
+# GENERAL PUBLIC LICENSE FOR MORE DETAILS.                            
+#
+# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE   
+# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,       
+#    1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.      
+# ======================================================================
+#     IDENTIFICATION DU GESTIONNAIRE DE COMMANDE ACCAS A PARTIR
+#     DE LA VERSION DU CODE_ASTER ASSOCIE
+#----------------------------------------------------------------------
+version = "1.2"
+date = "25/05/2010"
+exploit = False
diff --git a/PSSE_PF_Eficas/qtEficas_PSEN.py b/PSSE_PF_Eficas/qtEficas_PSEN.py
new file mode 100644 (file)
index 0000000..a7d0489
--- /dev/null
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2012   EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+"""
+   Ce module sert a lancer EFICAS configure pour Code_Aster
+"""
+# Modules Python
+# Modules Eficas
+
+import sys, os
+# sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..'))
+# code="PSEN"
+import sys, os
+# if os.path.dirname(os.path.abspath(__file__)) not in sys.path :
+#   sys.path.insert(0,os.path.dirname(os.path.abspath(__file__)))
+import prefs
+# name='prefs_'+prefs.code
+# __import__(name)
+import prefs_PSEN
+
+#from PyQt4.QtCore import *
+
+from InterfaceQT4 import eficas_go
+
+
+if __name__=='__main__':
+    eficas_go.lance_eficas(code=prefs.code)
diff --git a/PSSE_PF_Eficas/temp.txt b/PSSE_PF_Eficas/temp.txt
new file mode 100644 (file)
index 0000000..78d21f9
--- /dev/null
@@ -0,0 +1,2 @@
+X:/Small Grid PSSE/TestIsland_2015_OPF - Areas.sav
+C:\Program Files (x86)\PTI\PSSE34\PSSBIN
diff --git a/PSSE_PF_Eficas/usrCmdPF.py b/PSSE_PF_Eficas/usrCmdPF.py
new file mode 100644 (file)
index 0000000..cc039cd
--- /dev/null
@@ -0,0 +1,29 @@
+# -*- coding: cp1252 -*-
+import sys
+from tkinter import *
+import os
+
+
+def maFonction6(event):
+    quitting()
+
+def quitting():
+    can1.delete(proceeding)
+    can1.create_text(200,50,font=('Fixedsys',12),text="If you want to quit press button again...")
+    Button(root,text="Stop Simulation",font=("Fixedsys"),command=really_quitting).grid(row=4,column=1,sticky=N,padx=5)
+
+def really_quitting():
+    print ('quitting')
+    root.destroy()
+
+# création d'une instance de la classe TK, que l'on affecte à l'objet "root"
+root = Tk()
+root.title("PSEN - Processing...")
+can1=Canvas(root,width=400,height=100,bg="light blue")
+can1.grid(row=0,column=0,rowspan=10)
+
+proceeding=can1.create_text(200,50,font=('Fixedsys',12),text="Processing...")
+
+Button(root,text="Stop Simulation",font=("Fixedsys"),command=quitting).grid(row=4,column=1,sticky=N,padx=5)
+root.bind("<q>", maFonction6) # lettre q
+root.mainloop()