--- /dev/null
+# -*- coding: utf-8 -*-
+import os, sys
+import types
+from Accas import *
+
+MAP_DIRECTORY=os.getenv('MAP_DIRECTORY')
+if MAP_DIRECTORY == None : print ('sourcer l environnement Map SVP'); exit()
+sys.path.append(MAP_DIRECTORY)
+sys.path.append(os.path.join(MAP_DIRECTORY,'lib/python2.7/site-packages/mapy/virtual_polymer_common'))
+sys.path.append(os.path.join(MAP_DIRECTORY,'lib/python2.7/site-packages'))
+
+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
+
+from for_eficace import filtre_calculation_mechanistic
+from for_eficace import filtre_calculation_analitic
+from for_eficace import filtre_data_model
+#print filtre_calculation_analitic
+
+database = os.path.join(MAP_DIRECTORY,'share/map/tests/components/c_pre_polymer_data_management/local/')
+database="/home/A96028/MAPVp/my_map_installdir/share/map/tests/components/c_pre_polymer_data_management/local/"
+#database = "/home/A96028/MAPVp/my_map_installdir/lib/python2.7/site-packages/mapy/virtual_polymer_common"
+
+dicoInfoGenerales= {
+ 'Type_D_Equation' : ('initiation', 'propagation', 'termination', 'stabilization'),
+ 'Modele_TechnicalUse' : ('cable', 'coating', 'pipes'),
+ 'Aging_Factor' : { 'predefinedSimulationTime' : ('40years BR top', '40years BR bottom')},
+ 'Boundary_Conditions' : ('flux_volume','flux_surface','constant_constration','convection_flux'),
+ 'posttraitement_Typ' : ('chimique','mecanique','physique'),
+ }
+
+
+dicoTechnicalUse = {}
+dicoEquations = {}
+dicoEquationsParTechnicalUseParModelePartypeDEquation={}
+for technicalUse in dicoInfoGenerales['Modele_TechnicalUse'] :
+ dicoTechnicalUse[technicalUse] = filtre_calculation_mechanistic(database, technicalUse)
+ dicoEquations[technicalUse] = filtre_data_model(database, 'mechanistic_models',technicalUse)
+
+#print (dicoEquations)
+#print (1,dicoTechnicalUse)
+print (dicoEquations.keys())
+#print (dicoEquations['pipes'])
+#print (dicoEquations['cable']['base']['initiation'])
+#print (dicoTechnicalUse.keys())
+
+# --------------------------- blocPourCalculationForMechanisticSelonModeleTechnicalUse ------------
+
+def calculGeneralInformations(technicalUse, modelName):
+# la class contient l objet modele
+ monObj = dicoEquations[technicalUse][modelName]['class']
+ Material = SIMP(statut='o', typ ='TXM', homo = 'constant', defaut = monObj.materiaux[2:-2])
+ stabilized = SIMP(statut='o', typ ='TXM', homo = 'constant', defaut = monObj.stabilise)
+ EDF_developpement = SIMP(statut='o', typ ='TXM', homo = 'constant', defaut = monObj.dvt_EDF)
+ Documentation_report = SIMP(statut='o', typ ='TXM', homo = 'constant', defaut = monObj.reference)
+ Thickness = SIMP(statut='o', typ ='TXM', homo = 'constant', defaut = monObj.thickness)
+ Aging_conditions = SIMP(statut='o', typ ='TXM', homo = 'constant', defaut = monObj.type_vieil[1:-1])
+ Diffusion = SIMP(statut='o', typ = bool, homo = 'constant', defaut = monObj.diffusion)
+ Evaporation = SIMP(statut='o', typ = bool, homo = 'constant', defaut = monObj.evaporation)
+ Model_takes_into_account = FACT(statut ='o', Diffusion=Diffusion, Evaporation=Evaporation)
+ return FACT(statut = 'o',Material=Material,stabilized=stabilized,EDF_developpement=EDF_developpement,Documentation_report=Documentation_report,Thickness=Thickness,Aging_conditions=Aging_conditions,Model_takes_into_account=Model_takes_into_account)
+
+
+
+def calculAnalyticalEquations(technicalUse,modelName):
+# PN il faut ameliorer l algo
+ dicoArgs={}
+ dicoListeEquation={}
+ Consigne = SIMP(statut ="o", homo="information", typ="TXM", defaut = 'Les equations ne sont pas modifiables')
+
+ for debutEquation in dicoInfoGenerales['Type_D_Equation']:
+ liste=[]
+ for nomEquation in dicoEquations[technicalUse][modelName]['equations'].keys():
+ if nomEquation.find(debutEquation) != -1 :
+ liste.append(dicoEquations[technicalUse][modelName]['equations'][nomEquation] )
+ dicoListeEquation[debutEquation]=liste
+ for debutEquation in dicoInfoGenerales['Type_D_Equation']:
+ dicoArgsDuFact={}
+ for chaineEquation in dicoListeEquation[debutEquation]:
+ nom,params=chaineEquation.split("\t\t")
+ dicoArgsDuFact[nom]=SIMP(statut = 'o', typ ='TXM', defaut = params, homo= 'constant')
+ dicoArgs[debutEquation]=FACT(statut = 'o',**dicoArgsDuFact)
+ Equations = FACT(statut = 'o',Consigne = Consigne,**dicoArgs)
+
+ # on le garde pour pouvoir l utiliser plus tard dans DataBase
+ dicoEquationsParTechnicalUseParModelePartypeDEquation[technicalUse][modelName]=dicoListeEquation
+
+ dicoArgs={}
+ dicoArgsArrhenius={}
+
+ # Attention coef est une liste
+ for constante in dicoEquations[technicalUse][modelName]['class'].coef[0].keys():
+ v=dicoEquations[technicalUse][modelName]['class'].coef[0][constante]
+ if len(v) == 2 :
+ dicoArgsArrhenius [constante] = SIMP(statut ="o",typ=Tuple(2),validators = VerifTypeTuple(('R','R')),defaut =v )
+ else :
+ dicoArgs [constante] = SIMP(statut ="o",typ='R',defaut =v[0] )
+ ConstantesNonArrhenius = FACT(statut = 'o',**dicoArgs)
+ ConstantesArrhenius = FACT(statut = 'o',**dicoArgsArrhenius)
+ Constantes = FACT(statut = 'o',ConstantesNonArrhenius = ConstantesNonArrhenius, ConstantesArrhenius=ConstantesArrhenius)
+
+
+ return FACT(statut = 'o',Equations = Equations, Constantes=Constantes)
+
+def calculAgingParameters():
+ Time = SIMP(statut='o',typ='R',)
+ Temperature = SIMP(statut='o',typ='R',)
+ DoseRate = SIMP(statut='o',typ='R',)
+ Thickness = SIMP(statut='o',typ='R',)
+ return FACT(statut='o', Time=Time, Temperature=Temperature,DoseRate=DoseRate,Thickness=Thickness)
+ #dicoArgs['Dicretization'] = SIMP(statut='o',typ='R',)
+
+def calculInitialParameters(technicalUse,modelName):
+# Attention les parametres initiaux sont renvoyes sous forme de liste alors que la valeur attendue est un reel
+ dicoArgs={}
+ for (k,v) in dicoTechnicalUse[technicalUse][modelName]['initial_parameter'].items():
+ dicoArgs[k]= SIMP(statut='o',typ='R', defaut=v[0])
+ return FACT(statut='o',**dicoArgs)
+
+
+
+def blocPourCalculationForMechanisticSelonModeleTechnicalUse(technicalUse):
+# technicalUse = ['pipes', 'coating', 'cable']
+ dicoArgs={}
+ dicoEquationsParTechnicalUseParModelePartypeDEquation[technicalUse]={}
+
+ condition = "TechnicalUse == '" + technicalUse + "'"
+ ModelName = SIMP(statut='o',typ='TXM', into = dicoTechnicalUse[technicalUse].keys(),)
+ SimulationName = SIMP(statut='o',typ='TXM')
+
+ for modeleName in dicoTechnicalUse[technicalUse].keys() :
+ # modeleName est le modele par exmple radio_oxydation_PE_tetra_stabilization
+ dicoBloc = {}
+ dicoBloc['condition' ] = "ModelName == '" + modeleName + "'"
+ dicoBloc['GeneralInformations'] = calculGeneralInformations(technicalUse,modeleName)
+ dicoBloc['AnalyticalEquation'] = calculAnalyticalEquations(technicalUse,modeleName)
+ dicoBloc['AgingParameters'] = calculAgingParameters()
+ dicoBloc['InitialParameters'] = calculInitialParameters(technicalUse,modeleName)
+ if dicoBloc != None : dicoArgs['b_ModelName_' + modeleName] = BLOC(**dicoBloc)
+ return BLOC(condition=condition, ModelName = ModelName,SimulationName=SimulationName,**dicoArgs)
+
+
+
+JdC = JDC_CATA ( code='VP',
+ execmodul=None,
+ )
+
+
+# ---------------------------------------------------------------------------------
+Calculation_for_Mechanistic = PROC (nom="Calculation_for_Mechanistic", op=None,
+# ---------------------------------------------------------------------------------
+ TechnicalUse= SIMP(statut= 'o',typ= 'TXM',into=dicoInfoGenerales['Modele_TechnicalUse'], defaut = 'cable'),
+ b_cable = blocPourCalculationForMechanisticSelonModeleTechnicalUse('cable'),
+ b_pipes = blocPourCalculationForMechanisticSelonModeleTechnicalUse('pipes'),
+ b_coating = blocPourCalculationForMechanisticSelonModeleTechnicalUse('coating'),
+
+)
+
+
+
+from mapy.virtual_polymer_common import class_data
+monMechanisticModel=class_data.Modele()
+monMechanisticEquation=class_data.Equation()
+if monMechanisticEquation.comment == "" : monMechanisticEquation.comment = ' '
+
+
+
+def chercheConstituant(laClasse):
+ lesArgs={}
+ lesArgs['statut']='o'
+ for constituant in laClasse.constituants :
+ monIndex=laClasse.constituants.index(constituant)
+ valdefaut=laClasse.equation[monIndex]
+ monSimp=SIMP(statut = 'o', typ = bool, defaut=True)
+ lesArgs[constituant]=monSimp
+
+ lesArgsBloc={}
+ nomEquation = ' differentiel_'+constituant
+ monSimp2 = SIMP(statut= 'o',typ= 'TXM', defaut = valdefaut)
+ laCondition= constituant+' == True'
+ lesArgsBloc['condition']=laCondition
+ lesArgsBloc[nomEquation]=monSimp2
+ nomBloc = 'b_'+constituant
+ leBloc = BLOC(**lesArgsBloc)
+ lesArgs[nomBloc]=BLOC(**lesArgsBloc)
+ return FACT(**lesArgs)
+
+def chercheConstantes(laClasse):
+ lesArgs={}
+ lesArgs['statut']='o'
+ for constante in laClasse.const_cine_nom :
+ monSimp=SIMP(statut = 'o', typ = bool, defaut=True)
+ lesArgs[constante]=monSimp
+ return FACT(**lesArgs)
+
+
+def calculBlocAnalyticalEquationsForModification():
+# PN refaire l algo
+#print (dicoEquations['cable']['base']['initiation'])
+ #for technicalUse in dicoInfoGenerales['Modele_TechnicalUse']:
+ #condition = "TechnicalUse == '" + technicalUse + "'"
+ for technicalUse in ('cable',):
+ dicoArgs={}
+ typeReaction = SIMP (statut='o', typ='TXM', into = dicoInfoGenerales['Type_D_Equation'])
+ for typeDeLaReaction in dicoInfoGenerales['Type_D_Equation']:
+ lesArgsBloc={}
+ laCondition= "typeReaction == '" + typeDeLaReaction + "'"
+ dicoListeEquation=dicoEquations[technicalUse]['base'][typeDeLaReaction]
+ ListeEquation = dicoListeEquation.keys()
+ equationsAModifier=SIMP (statut='o', typ='TXM', max="**", homo = 'SansOrdreNiDoublon', into=ListeEquation)
+ #print (equationsAModifier)
+ dicoArgs['b_'+typeDeLaReaction]=BLOC(condition=laCondition, equationsAModifier=equationsAModifier)
+ return FACT(statut='o', typeReaction = typeReaction, **dicoArgs)
+
+ #for debutEquation in dicoInfoGenerales['Type_D_Equation']:
+ # dicoArgsDuFact={}
+ # for chaineEquation in dicoListeEquation[debutEquation]:
+ # nom,params=chaineEquation.split("\t\t")
+ # dicoArgsDuFact[nom]=SIMP(statut = 'o', typ ='TXM', defaut = params, homo= 'constant')
+ # dicoArgs[debutEquation]=FACT(statut = 'o',**dicoArgsDuFact)
+ #Equations = FACT(statut = 'o',Consigne = Consigne,**dicoArgs)
+
+ #dicoArgs={}
+ #dicoArgsArrhenius={}
+
+ # Attention coef est une liste
+ #for constante in dicoEquation[technicalUse]['class'].coef[0].keys():
+ # v=dicoEquation[technicalUse]['class'].coef[0][constante]
+ # if len(v) == 2 :
+ # dicoArgsArrhenius [constante] = SIMP(statut ="o",typ=Tuple(2),validators = VerifTypeTuple(('R','R')),defaut =v )
+ # else :
+ # dicoArgs [constante] = SIMP(statut ="o",typ='R',defaut =v[0] )
+ #ConstantesNonArrhenius = FACT(statut = 'o',**dicoArgs)
+ #ConstantesArrhenius = FACT(statut = 'o',**dicoArgsArrhenius)
+ #Constantes = FACT(statut = 'o',ConstantesNonArrhenius = ConstantesNonArrhenius, ConstantesArrhenius=ConstantesArrhenius)
+
+ return FACT(statut = 'o',Equations = Equations, Constantes=Constantes)
+
+
+
+
+# ------------------------------------------
+Database = PROC (nom="Database", op=None,
+# ------------------------------------------
+
+
+# ------------------------------------------------------------------------
+ Type_chgt = SIMP (statut= 'o',typ= 'TXM',into=('modify equation', 'create equation', 'modify model', 'create model'),),
+
+ b_creation_equation = BLOC (condition = 'Type_chgt == "create equation"',
+ # toutes les valeurs sont par defaut class_data.Equation
+ # generer le catalogue avec un fact
+ # Aging_Type type_vieil,
+ Creation = FACT ( statut = 'o',
+ ChemicalFormulation = SIMP(statut='o', typ='TXM', defaut = monMechanisticEquation.representation ),
+ Aging_Type = SIMP(statut= 'o',typ= 'TXM', min=1,max=1, into=('All', 'thermo', 'radio'), defaut = monMechanisticEquation.type_vieil[0]),
+ Reaction_Type = SIMP(statut= 'o',typ= 'TXM', min=1,max=1, into=dicoInfoGenerales['Type_D_Equation'], defaut = monMechanisticEquation.type_react),
+ Constituants = chercheConstituant(monMechanisticEquation),
+ New = SIMP (statut = 'o', typ = bool, defaut=False),
+ b_new = BLOC(condition = " New == True" ,
+ Constituant = FACT ( statut = 'o', min=1, max='**',
+ Name = SIMP(statut= 'o',typ= 'TXM'),
+ Differential_Equation = SIMP(statut= 'o',typ= 'TXM'),
+ ),
+ ), # b new
+
+ Constantes = chercheConstantes(monMechanisticEquation),
+ New_Cst = SIMP (statut = 'o', typ = bool, defaut=False),
+ b_new_cst = BLOC(condition = " New_Cst == True" ,
+ Constante = FACT ( statut = 'o', min=1, max='**',
+ Name = SIMP (statut = 'o', typ = 'TXM'),
+ ), # fin constante
+ ), #fin b_new
+
+ Arrhenius = SIMP (statut = 'o', typ = bool, defaut=monMechanisticEquation.arrhenius),
+ Comment = SIMP(statut= 'o',typ= 'TXM', defaut = monMechanisticEquation.comment),
+ ), # fin creation mechanistic model
+ ), # fin b_create_equation
+
+ b_modify_equation = BLOC (condition = 'Type_chgt == "modify equation"',
+# les valeurs par defaut seront lues dans la base de données
+ Filtre = calculBlocAnalyticalEquationsForModification(),
+ #Filtre = FACT (statut='o',
+ # #Reaction_Type=SIMP(statut= 'o',typ= 'TXM', min=1,into=dicoInfoGenerales['Type_D_Equation'], siValide=lienDB.remplitMechanisticModifyEquationListeEquation),
+ # Reaction_Type=SIMP(statut= 'o',typ= 'TXM', min=1,into=dicoInfoGenerales['Type_D_Equation'],),# siValide=lienDB.remplitMechanisticModifyEquationListeEquation),
+# Filtre getMechanisticEquation(Reaction_Type)
+# diictionnaire key : nom de l equation / valeur classe instancies liste de nom d'equation
+ # Equation_List=SIMP(statut= 'o',typ= 'TXM'), #siValide=lienDB.remplitModificationEquation),
+ # ),
+ # lorsque le choix est fait on peut recuperer les valeurs par defaut
+
+ #ChemicalFormulation = SIMP(statut='o', typ='TXM', defaut = 'POOH -> 2P'),
+ Modification = FACT (statut='o',
+ ChemicalFormulation = SIMP(statut='o', typ='TXM', ), # classe.representation
+ Reaction_Type=SIMP(statut= 'o',typ= 'TXM', min=1,into=dicoInfoGenerales['Type_D_Equation']), # classe.type_react
+ Aging_Type=SIMP(statut= 'o',typ= 'TXM', min=1,max=1, into=('All', 'thermo', 'radio'),), # classe.type_vieil
+
+ Constituants = FACT ( statut = 'o', # classe.constituants --> liste de nom. les equations sont dans le meme ordre self.equation
+ POOH = SIMP (statut = 'o', typ = bool, defaut=False),
+ b_pooh = BLOC(condition = " POOH == True" ,
+ Differential_Equation_POOH = SIMP(statut= 'o',typ= 'TXM', defaut = '-ku1*POOH'),
+ ), # Fin b_pooh
+ PO = SIMP (statut = 'o', typ = bool, defaut=False),
+ b_po = BLOC(condition = " PO == True" ,
+ Differential_Equation_PO = SIMP(statut= 'o',typ= 'TXM', defaut = '-ku1*POOH'),
+ ), # Fin b_po
+ New = SIMP (statut = 'o', typ = bool, defaut=False),
+ b_new = BLOC(condition = " New == True" ,
+ Constituant = FACT ( statut = 'o', min=1, max='**',
+ Name = SIMP (statut = 'o', typ = 'TXM'),
+ Differential_Equation = SIMP(statut= 'o',typ= 'TXM'),
+ ), # Fin Constituant
+ ), # Fin b_new
+ ),# Fin Constituants
+
+ Constantes = FACT ( statut = 'o', # self.const_cine_nom
+ KU1 = SIMP (statut = 'o', typ = bool, defaut=False),
+ New = SIMP (statut = 'o', typ = bool, defaut=False),
+ b_new = BLOC(condition = " New == True" ,
+ Constante = FACT ( statut = 'o', min=1, max='**',
+ Name = SIMP (statut = 'o', typ = 'TXM'),
+ ), # fin constante
+ ), #fin b_new
+ ), # fin constantes
+ Arrhenius = SIMP (statut = 'o', typ = bool, ), # classe.arrhenius[0]
+ Comment = SIMP(statut= 'o',typ= 'TXM',), # classe.comment
+ ), # fin modification
+ ), # fin b_modify_equation
+
+
+ b_create_model = BLOC (condition = 'Type_chgt == "create model"',
+# Filtre getMechanisticTechnicalUse(Filtre_TechnicalUse)
+# dictionnaire key : nom du modele / valeur classe instancies liste de nom modele
+# la classe par defaut getDefaultMechanistic
+# renvoie un obj instancie
+ # toutes les valeurs sont par defaut class_data.Equation
+ # generer le catalogue avec un fact
+ Creation = FACT (statut='o',
+ ID=FACT (statut='o',
+ Name =SIMP(statut='o',typ='TXM'), # obj.nom
+ Material=SIMP(statut='o',typ='TXM',),# obj.materiaux[0]
+ TechnicalUse = SIMP(statut= 'o',typ= 'TXM',into=dicoInfoGenerales['Modele_TechnicalUse']),#defaut=obj.technical_use
+ Reference=SIMP(statut='o',typ='TXM',), # defaut=monModele.reference, momModele = obj par la suite
+ Model_Developed_For_EDF = SIMP(typ = bool, statut = 'o'), #defaut = monModele.dvt_EDF[0]
+ Aging_Type=SIMP(statut= 'o',typ= 'TXM', min=1,max=1, into=('all', 'thermo', 'radio'),), # defaut = monModele.type_vieil
+# attention c est une liste --> a reflechir
+ Stabilizer = SIMP(typ = bool, statut = 'o'), #,defaut = monModele.stabilise
+ material_thickness = SIMP(typ = 'TXM', statut = 'o', into = ['thin','thick']), # monModele.thickness
+ Diffusion = SIMP(typ = bool, statut = 'o'),# defaut = monModele.diffusion ,siValide = lienDB.prepareDiffusion
+ Evaporation = SIMP(typ = bool, statut = 'o'), # defaut monModele.evaporation
+ Comment = SIMP(statut= 'o',typ= 'TXM',), # classe.comment
+ ), #fin id
+ Equations = FACT (statut = 'o',
+# remplir avec getEquation sur modele
+# dictionnaire avec comme clef 'base' puis initiation ...
+ Liste=SIMP(statut= 'o',typ='TXM', min=1,max='**', homo='SansOrdreNiDoublon',into =['POOH -> 2P [k]' , 'A [K5,Y5]', 'B', 'C']),
+# quand coche je recupere le nom entre crochet + split sur , attention sans blanc
+# et on cree le SIMP apres pour recuperer la valeur
+ K5=SIMP (statut = 'o', typ = 'R' ),
+ New = SIMP (statut = 'o', typ = bool, defaut=False),
+#
+ b_new = BLOC(condition = " New == True" ,
+ Add=FACT(statut = 'o',max='**',
+ Filtre = SIMP(statut= 'o',typ= 'TXM',into=dicoInfoGenerales['Type_D_Equation']),
+ Equations=SIMP(statut= 'o',typ='TXM', min=1,max='**', homo='SansOrdreNiDoublon',into =['POOH -> 2P' , 'A', 'B', 'C'])
+ )
+ ), # b new
+ ) # fin equations
+ ), #fin creation
+ ), # fin create model
+
+ b_modify_model = BLOC (condition = 'Type_chgt == "modify model"',
+# Filtre getMechanisticTechnicalUse(Filtre_TechnicalUse)
+# dictionnaire key : nom du modele / valeur classe instancies liste de nom modele
+# la classe par defaut getDefaultMechanistic
+# renvoie un obj instancie
+ Filtre = FACT (statut='o',
+ TechnicalUse=SIMP(statut= 'o',typ= 'TXM', min=1,into=dicoInfoGenerales['Modele_TechnicalUse'],),
+# si valide
+ ModeleName=SIMP(statut='o',typ='TXM',into=['A','B']), # a choisir dans la liste des clefs
+ ),
+ Modification = FACT (statut='o',
+ ID=FACT (statut='o',
+ Name =SIMP(statut='o',typ='TXM'), # obj.nom
+ Material=SIMP(statut='o',typ='TXM',),# obj.materiaux[0]
+ TechnicalUse = SIMP(statut= 'o',typ= 'TXM',into=dicoInfoGenerales['Modele_TechnicalUse']),#defaut=obj.technical_use
+ Reference=SIMP(statut='o',typ='TXM',), # defaut=monModele.reference, momModele = obj par la suite
+ Model_Developed_For_EDF = SIMP(typ = bool, statut = 'o'), #defaut = monModele.dvt_EDF[0]
+ Aging_Type=SIMP(statut= 'o',typ= 'TXM', min=1,max=1, into=('all', 'thermo', 'radio'),), # defaut = monModele.type_vieil
+# attention c est une liste --> a reflechir
+ Stabilizer = SIMP(typ = bool, statut = 'o'), #,defaut = monModele.stabilise
+ material_thickness = SIMP(typ = 'TXM', statut = 'o', into = ['thin','thick']), # monModele.thickness
+ Diffusion = SIMP(typ = bool, statut = 'o'),# defaut = monModele.diffusion ,siValide = lienDB.prepareDiffusion
+ Evaporation = SIMP(typ = bool, statut = 'o'), # defaut monModele.evaporation
+ Comment = SIMP(statut= 'o',typ= 'TXM',), # classe.comment
+ ), #fin id
+ Equations = FACT (statut = 'o',
+# remplir avec getEquation sur modele
+# dictionnaire avec comme clef 'base' puis initiation ...
+ Liste=SIMP(statut= 'o',typ='TXM', min=1,max='**', homo='SansOrdreNiDoublon',into =['POOH -> 2P [k]' , 'A [K5,Y5]', 'B', 'C']),
+# quand coche je recupere le nom entre crochet + split sur , attention sans blanc
+# et on cree le SIMP apres pour recuperer la valeur
+ K5=SIMP (statut = 'o', typ = 'R' ),
+ New = SIMP (statut = 'o', typ = bool, defaut=False),
+#
+ b_new = BLOC(condition = " New == True" ,
+ Add=FACT(statut = 'o',max='**',
+ Filtre = SIMP(statut= 'o',typ= 'TXM',into=dicoInfoGenerales['Type_D_Equation']),
+ Equations=SIMP(statut= 'o',typ='TXM', min=1,max='**', homo='SansOrdreNiDoublon',into =['POOH -> 2P' , 'A', 'B', 'C'])
+ )
+ ), # b new
+ ) # fin equations
+ ), #fin modification
+ ), # fin modify model
+
+# ------------------------------------------------------------------------
+# b_Model_Analytic = BLOC(condition = "Model_Type == 'analytic model'",
+# Type_chgt = SIMP (statut= 'o',typ= 'TXM',into=('modify equation', 'create equation', 'modify model', 'create model') ),
+#
+# b_creation_equation = BLOC (condition = 'Type_chgt == "create equation"',
+# Creation = FACT(statut = 'o',
+# Name=SIMP(statut= 'o',typ= 'TXM',), # defaut o.nom
+# Equation_Type = SIMP(statut= 'o',typ= 'TXM',into=dicoInfoGenerales['posttraitement_Typ']), # defaut o.type_equa
+# PostProcessing = SIMP (statut = 'o', typ = bool,),# o.post_processing
+# Calculation_Result = SIMP(statut= 'o',typ= 'TXM'), # defaut o.calculation_result
+## dans o.parameters on a une liste
+# Parameters=SIMP(statut= 'o',typ='TXM', min=1,max='**', homo='SansOrdreNiDoublon',into =['A', 'Ea', 'C']),
+# New = SIMP (statut = 'o', typ = bool, defaut=False),
+# b_new = BLOC(condition = " New == True" ,
+# Param = FACT(statut = 'o', max='**',
+# Name=SIMP(statut= 'o',typ= 'TXM',),
+# ), #param
+# ), # b_new
+# Equation = SIMP(statut= 'o',typ= 'TXM'), # defaut o.equation
+# Universal_Constants=SIMP(statut= 'o',typ='TXM', min=1,max='**', homo='SansOrdreNiDoublon',into =['A', 'B', 'C']),
+# Results_Unit = SIMP(statut= 'o',typ= 'TXM'), # defaut o.results_unit
+# Integrate = SIMP (statut = 'o', typ = bool),# defaut o.integrate
+# Comment = SIMP(statut= 'o',typ= 'TXM'), # defaut o.comment
+# ),# Fact creation
+# ), #bloc b_creation_equation
+
+# b_modification_equation = BLOC (condition = 'Type_chgt == "modify equation"',
+# Filtre = FACT(statut = 'o',
+# Equation_Type = SIMP(statut= 'o',typ= 'TXM',into=dicoInfoGenerales['posttraitement_Typ']), # defaut o.type_equa
+# Equation_Choice = SIMP(statut= 'o',typ= 'TXM',into=['A','B','C']),
+# ),
+# Modification = FACT(statut = 'o',
+# Name=SIMP(statut= 'o',typ= 'TXM',), # defaut o.nom
+# Equation_Type = SIMP(statut= 'o',typ= 'TXM',into=dicoInfoGenerales['posttraitement_Typ']), # defaut o.type_equa
+# PostProcessing = SIMP (statut = 'o', typ = bool,),# o.post_processing
+# Calculation_Result = SIMP(statut= 'o',typ= 'TXM'), # defaut o.calculation_result # dans o.parameters on a une liste
+# Parameters=SIMP(statut= 'o',typ='TXM', min=1,max='**', homo='SansOrdreNiDoublon',into =['A', 'Ea', 'C']),
+# New = SIMP (statut = 'o', typ = bool, defaut=False),
+# b_new = BLOC(condition = " New == True" ,
+# Param = FACT(statut = 'o', max='**',
+# Name=SIMP(statut= 'o',typ= 'TXM',),
+# ), #param
+# ), # b_new
+# Equation = SIMP(statut= 'o',typ= 'TXM'), # defaut o.equation
+# Universal_Constants=SIMP(statut= 'o',typ='TXM', min=1,max='**', homo='SansOrdreNiDoublon',into =['A', 'B', 'C']),
+# Results_Unit = SIMP(statut= 'o',typ= 'TXM'), # defaut o.results_unit
+# Integrate = SIMP (statut = 'o', typ = bool),# defaut o.integrate
+# Comment = SIMP(statut= 'o',typ= 'TXM'), # defaut o.comment
+# ),# Fact Modification
+
+# ), #bloc b_modification_equation
+# ), # Fin model analytic
+# ------------------------------------------------------------------------
+# ---------------------------------------------------------------------------
+
+)
sys.path.append(os.path.join(MAP_DIRECTORY,'lib/python2.7/site-packages/mapy/virtual_polymer_common'))
sys.path.append(os.path.join(MAP_DIRECTORY,'lib/python2.7/site-packages'))
+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
from for_eficace import filtre_calculation_mechanistic
from for_eficace import filtre_calculation_analitic
#print filtre_calculation_analitic
database = os.path.join(MAP_DIRECTORY,'share/map/tests/components/c_pre_polymer_data_management/local/')
-#database="/home/A96028/MAPVp/my_map_installdir/share/map/tests/components/c_pre_polymer_data_management/local/"
+database="/home/A96028/MAPVp/my_map_installdir/share/map/tests/components/c_pre_polymer_data_management/local/"
+#database = "/home/A96028/MAPVp/my_map_installdir/lib/python2.7/site-packages/mapy/virtual_polymer_common"
dicoInfoGenerales= {
'Equation_Liste' : ('initiation', 'propagation', 'termination', 'stabilization'),
'Modele_TechnicalUse' : ('cable', 'coating', 'pipes'),
}
-dicoTechnicalUse= {}
+dicoTechnicalUse = {}
+dicoEquations = {}
for technicalUse in dicoInfoGenerales['Modele_TechnicalUse'] :
dicoTechnicalUse[technicalUse] = filtre_calculation_mechanistic(database, technicalUse)
-print (dicoTechnicalUse)
+ dicoEquations[technicalUse] = filtre_data_model(database, 'mechanistic_models',technicalUse)
# --------------------------- blocPourCalculationForMechanisticSelonModeleTechnicalUse ------------
+def calculGeneralInformations(dicoEquation,technicalUse):
+ monObj= dicoEquation[technicalUse]['class']
+ Material = SIMP(statut='o', typ ='TXM', homo = 'constant', defaut = monObj.materiaux[2:-2])
+ stabilized = SIMP(statut='o', typ ='TXM', homo = 'constant', defaut = monObj.stabilise)
+ EDF_developpement = SIMP(statut='o', typ ='TXM', homo = 'constant', defaut = monObj.dvt_EDF)
+ Documentation_report = SIMP(statut='o', typ ='TXM', homo = 'constant', defaut = monObj.reference)
+ Thickness = SIMP(statut='o', typ ='TXM', homo = 'constant', defaut = monObj.thickness)
+ Aging_conditions = SIMP(statut='o', typ ='TXM', homo = 'constant', defaut = monObj.type_vieil[1:-1])
+ Diffusion = SIMP(statut='o', typ = bool, homo= 'constant', defaut = monObj.diffusion)
+ Evaporation = SIMP(statut='o', typ = bool, homo= 'constant', defaut = monObj.evaporation)
+ Model_takes_into_account = FACT(statut ='o', Diffusion=Diffusion, Evaporation=Evaporation)
+ return FACT(statut = 'o',Material=Material,stabilized=stabilized,EDF_developpement=EDF_developpement,Documentation_report=Documentation_report,Thickness=Thickness,Aging_conditions=Aging_conditions,Model_takes_into_account=Model_takes_into_account)
+
+
-def calculAnalyticalEquations(dicoEquation,modelName):
+def calculAnalyticalEquations(dicoEquation,technicalUse):
+# PN refaire l algo
+ dicoArgs={}
+ dicoListeEquation={}
+ Consigne = SIMP(statut ="o", homo="information", typ="TXM", defaut = 'Les equations ne sont pas modifiables')
+ for debutEquation in dicoInfoGenerales['Equation_Liste']:
+ liste=[]
+ for nomEquation in dicoEquation[technicalUse]['equations'].keys():
+ if nomEquation.find(debutEquation) != -1 :
+ liste.append(dicoEquation[technicalUse]['equations'][nomEquation] )
+ dicoListeEquation[debutEquation]=liste
+ for debutEquation in dicoInfoGenerales['Equation_Liste']:
+ dicoArgsDuFact={}
+ for chaineEquation in dicoListeEquation[debutEquation]:
+ nom,params=chaineEquation.split("\t\t")
+ dicoArgsDuFact[nom]=SIMP(statut = 'o', typ ='TXM', defaut = params, homo= 'constant')
+ dicoArgs[debutEquation]=FACT(statut = 'o',**dicoArgsDuFact)
+ Equations = FACT(statut = 'o',Consigne = Consigne,**dicoArgs)
+
dicoArgs={}
- print (dicoEquation)
- dicoArgs['AFAIRE_pour_'+str(modelName)] = SIMP(statut='o',typ='TXM')
- return FACT(statut = 'o',**dicoArgs)
+ dicoArgsArrhenius={}
+
+ # Attention coef est une liste
+ for constante in dicoEquation[technicalUse]['class'].coef[0].keys():
+ v=dicoEquation[technicalUse]['class'].coef[0][constante]
+ if len(v) == 2 :
+ dicoArgsArrhenius [constante] = SIMP(statut ="o",typ=Tuple(2),validators = VerifTypeTuple(('R','R')),defaut =v )
+ else :
+ dicoArgs [constante] = SIMP(statut ="o",typ='R',defaut =v[0] )
+ ConstantesNonArrhenius = FACT(statut = 'o',**dicoArgs)
+ ConstantesArrhenius = FACT(statut = 'o',**dicoArgsArrhenius)
+ Constantes = FACT(statut = 'o',ConstantesNonArrhenius = ConstantesNonArrhenius, ConstantesArrhenius=ConstantesArrhenius)
-def calculChemicalKinetics(dicoEquation,modelName):
+
+ return FACT(statut = 'o',Equations = Equations, Constantes=Constantes)
+
+def calculAgingParameters():
+ Time = SIMP(statut='o',typ='R',)
+ Temperature = SIMP(statut='o',typ='R',)
+ DoseRate = SIMP(statut='o',typ='R',)
+ Thickness = SIMP(statut='o',typ='R',)
+ return FACT(statut='o', Time=Time, Temperature=Temperature,DoseRate=DoseRate,Thickness=Thickness)
+ #dicoArgs['Dicretization'] = SIMP(statut='o',typ='R',)
+
+def calculInitialParameters(dico,modelName):
+# Attention les parametres initiaux sont renvoyes sous forme de liste alors que la valeur attendue est un reel
dicoArgs={}
- dicoArgs['SimulationName']= SIMP(statut='o',typ='TXM')
- dicoArgs['Time'] = SIMP(statut='o',typ='R',)
- dicoArgs['Temperature'] = SIMP(statut='o',typ='R',)
- dicoArgs['DebitOfDose'] = SIMP(statut='o',typ='R',defaut = dicoEquation['debit_of_dose'])
- dicoArgs['Thickness'] = SIMP(statut='o',typ='R',)
- dicoArgs['Dicretization'] = SIMP(statut='o',typ='R',)
- for (k,v) in dicoEquation['initial_parameter'].items():
- dicoArgs[k]= SIMP(statut='o',typ='R', defaut=v)
+ for (k,v) in dico['initial_parameter'].items():
+ dicoArgs[k]= SIMP(statut='o',typ='R', defaut=v[0])
return FACT(statut='o',**dicoArgs)
dicoArgs={}
condition = "TechnicalUse == '" + technicalUse + "'"
ModelName = SIMP(statut='o',typ='TXM', into = dicoTechnicalUse[technicalUse].keys(),)
+ SimulationName = SIMP(statut='o',typ='TXM')
for k in dicoTechnicalUse[technicalUse].keys() :
+ # la clef est le modele
dicoBloc = {}
dicoBloc['condition' ] = "ModelName == '" + k + "'"
- dicoBloc['AnalyticalEquation'+str(k)] = calculAnalyticalEquations(dicoTechnicalUse[technicalUse][k],k)
- dicoBloc['ChemicalKinetics'] = calculChemicalKinetics(dicoTechnicalUse[technicalUse][k],k)
+ dicoBloc['GeneralInformations'] = calculGeneralInformations(dicoEquations[technicalUse],k)
+ dicoBloc['AnalyticalEquation'] = calculAnalyticalEquations(dicoEquations[technicalUse],k)
+ dicoBloc['AgingParameters'] = calculAgingParameters()
+ dicoBloc['InitialParameters'] = calculInitialParameters(dicoTechnicalUse[technicalUse][k],k)
if dicoBloc != None : dicoArgs['b_ModelName_' + k] = BLOC(**dicoBloc)
- return BLOC(condition=condition, ModelName = ModelName,**dicoArgs)
+ return BLOC(condition=condition, ModelName = ModelName,SimulationName=SimulationName,**dicoArgs)
# ----------------------------------------------
Calculation_for_Mechanistic = PROC (nom="Calculation_for_Mechanistic", op=None,
# ----------------------------------------------
- TechnicalUse= SIMP(statut= 'o',typ= 'TXM',into=dicoInfoGenerales['Modele_TechnicalUse']),
+ TechnicalUse= SIMP(statut= 'o',typ= 'TXM',into=dicoInfoGenerales['Modele_TechnicalUse'], defaut = 'cable'),
b_cable = blocPourCalculationForMechanisticSelonModeleTechnicalUse('cable'),
- b_pipes = blocPourCalculationForMechanisticSelonModeleTechnicalUse('pipes'),
- b_coating = blocPourCalculationForMechanisticSelonModeleTechnicalUse('coating'),
+ #b_pipes = blocPourCalculationForMechanisticSelonModeleTechnicalUse('pipes'),
+ #b_coating = blocPourCalculationForMechanisticSelonModeleTechnicalUse('coating'),
)
# -*- coding: utf-8 -*-
+import os, sys
import types
from Accas import *
-#import lienDB
+MAP_DIRECTORY=os.getenv('MAP_DIRECTORY')
+if MAP_DIRECTORY == None : print ('sourcer l environnement Map SVP'); exit()
+sys.path.append(MAP_DIRECTORY)
+sys.path.append(os.path.join(MAP_DIRECTORY,'lib/python2.7/site-packages/mapy/virtual_polymer_common'))
+sys.path.append(os.path.join(MAP_DIRECTORY,'lib/python2.7/site-packages'))
-monDico= { 'Equation_Liste' : ('initiation', 'propagation', 'termination', 'stabilization'),
+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
+
+from for_eficace import filtre_calculation_mechanistic
+from for_eficace import filtre_calculation_analitic
+from for_eficace import filtre_data_model
+#print filtre_calculation_analitic
+
+database = os.path.join(MAP_DIRECTORY,'share/map/tests/components/c_pre_polymer_data_management/local/')
+database="/home/A96028/MAPVp/my_map_installdir/share/map/tests/components/c_pre_polymer_data_management/local/"
+#database = "/home/A96028/MAPVp/my_map_installdir/lib/python2.7/site-packages/mapy/virtual_polymer_common"
+
+dicoInfoGenerales= {
+ 'Type_D_Equation' : ('initiation', 'propagation', 'termination', 'stabilization'),
'Modele_TechnicalUse' : ('cable', 'coating', 'pipes'),
- 'Aging_Factor' : { 'predefinedSimulationTime' : ('40years BR top', '40years BR bottom')},
+ 'Aging_Factor' : { 'predefinedSimulationTime' : ('40years BR top', '40years BR bottom')},
'Boundary_Conditions' : ('flux_volume','flux_surface','constant_constration','convection_flux'),
- 'posttraitement_Typ' : ('chimique','mecanique','physique'),
+ 'posttraitement_Typ' : ('chimique','mecanique','physique'),
}
+
+dicoTechnicalUse = {}
+dicoEquations = {}
+dicoEquationsParTechnicalUseParModelePartypeDEquation={}
+for technicalUse in dicoInfoGenerales['Modele_TechnicalUse'] :
+ dicoTechnicalUse[technicalUse] = filtre_calculation_mechanistic(database, technicalUse)
+ dicoEquations[technicalUse] = filtre_data_model(database, 'mechanistic_models',technicalUse)
+
+#print (dicoEquations)
+#print (1,dicoTechnicalUse)
+print (dicoEquations.keys())
+#print (dicoEquations['pipes'])
+#print (dicoEquations['cable']['base']['initiation'])
+#print (dicoTechnicalUse.keys())
+
+# --------------------------- blocPourCalculationForMechanisticSelonModeleTechnicalUse ------------
+
+def calculGeneralInformations(technicalUse, modelName):
+# la class contient l objet modele
+ monObj = dicoEquations[technicalUse][modelName]['class']
+ Material = SIMP(statut='o', typ ='TXM', homo = 'constant', defaut = monObj.materiaux[2:-2])
+ stabilized = SIMP(statut='o', typ ='TXM', homo = 'constant', defaut = monObj.stabilise)
+ EDF_developpement = SIMP(statut='o', typ ='TXM', homo = 'constant', defaut = monObj.dvt_EDF)
+ Documentation_report = SIMP(statut='o', typ ='TXM', homo = 'constant', defaut = monObj.reference)
+ Thickness = SIMP(statut='o', typ ='TXM', homo = 'constant', defaut = monObj.thickness)
+ Aging_conditions = SIMP(statut='o', typ ='TXM', homo = 'constant', defaut = monObj.type_vieil[1:-1])
+ Diffusion = SIMP(statut='o', typ = bool, homo = 'constant', defaut = monObj.diffusion)
+ Evaporation = SIMP(statut='o', typ = bool, homo = 'constant', defaut = monObj.evaporation)
+ Model_takes_into_account = FACT(statut ='o', Diffusion=Diffusion, Evaporation=Evaporation)
+ return FACT(statut = 'o',Material=Material,stabilized=stabilized,EDF_developpement=EDF_developpement,Documentation_report=Documentation_report,Thickness=Thickness,Aging_conditions=Aging_conditions,Model_takes_into_account=Model_takes_into_account)
+
+
+
+def calculAnalyticalEquations(technicalUse,modelName):
+# PN il faut ameliorer l algo
+ dicoArgs={}
+ dicoListeEquation={}
+ Consigne = SIMP(statut ="o", homo="information", typ="TXM", defaut = 'Les equations ne sont pas modifiables')
+
+ for debutEquation in dicoInfoGenerales['Type_D_Equation']:
+ liste=[]
+ for nomEquation in dicoEquations[technicalUse][modelName]['equations'].keys():
+ if nomEquation.find(debutEquation) != -1 :
+ liste.append(dicoEquations[technicalUse][modelName]['equations'][nomEquation] )
+ dicoListeEquation[debutEquation]=liste
+ for debutEquation in dicoInfoGenerales['Type_D_Equation']:
+ dicoArgsDuFact={}
+ for chaineEquation in dicoListeEquation[debutEquation]:
+ nom,params=chaineEquation.split("\t\t")
+ dicoArgsDuFact[nom]=SIMP(statut = 'o', typ ='TXM', defaut = params, homo= 'constant')
+ dicoArgs[debutEquation]=FACT(statut = 'o',**dicoArgsDuFact)
+ Equations = FACT(statut = 'o',Consigne = Consigne,**dicoArgs)
+
+ # on le garde pour pouvoir l utiliser plus tard dans DataBase
+ dicoEquationsParTechnicalUseParModelePartypeDEquation[technicalUse][modelName]=dicoListeEquation
+
+ dicoArgs={}
+ dicoArgsArrhenius={}
+
+ # Attention coef est une liste
+ for constante in dicoEquations[technicalUse][modelName]['class'].coef[0].keys():
+ v=dicoEquations[technicalUse][modelName]['class'].coef[0][constante]
+ if len(v) == 2 :
+ dicoArgsArrhenius [constante] = SIMP(statut ="o",typ=Tuple(2),validators = VerifTypeTuple(('R','R')),defaut =v )
+ else :
+ dicoArgs [constante] = SIMP(statut ="o",typ='R',defaut =v[0] )
+ ConstantesNonArrhenius = FACT(statut = 'o',**dicoArgs)
+ ConstantesArrhenius = FACT(statut = 'o',**dicoArgsArrhenius)
+ Constantes = FACT(statut = 'o',ConstantesNonArrhenius = ConstantesNonArrhenius, ConstantesArrhenius=ConstantesArrhenius)
+
+
+ return FACT(statut = 'o',Equations = Equations, Constantes=Constantes)
+
+def calculAgingParameters():
+ Time = SIMP(statut='o',typ='R',)
+ Temperature = SIMP(statut='o',typ='R',)
+ DoseRate = SIMP(statut='o',typ='R',)
+ Thickness = SIMP(statut='o',typ='R',)
+ return FACT(statut='o', Time=Time, Temperature=Temperature,DoseRate=DoseRate,Thickness=Thickness)
+ #dicoArgs['Dicretization'] = SIMP(statut='o',typ='R',)
+
+def calculInitialParameters(technicalUse,modelName):
+# Attention les parametres initiaux sont renvoyes sous forme de liste alors que la valeur attendue est un reel
+ dicoArgs={}
+ for (k,v) in dicoTechnicalUse[technicalUse][modelName]['initial_parameter'].items():
+ dicoArgs[k]= SIMP(statut='o',typ='R', defaut=v[0])
+ return FACT(statut='o',**dicoArgs)
+
+
+
+def blocPourCalculationForMechanisticSelonModeleTechnicalUse(technicalUse):
+# technicalUse = ['pipes', 'coating', 'cable']
+ dicoArgs={}
+ dicoEquationsParTechnicalUseParModelePartypeDEquation[technicalUse]={}
+
+ condition = "TechnicalUse == '" + technicalUse + "'"
+ ModelName = SIMP(statut='o',typ='TXM', into = dicoTechnicalUse[technicalUse].keys(),)
+ SimulationName = SIMP(statut='o',typ='TXM')
+
+ for modeleName in dicoTechnicalUse[technicalUse].keys() :
+ # modeleName est le modele par exmple radio_oxydation_PE_tetra_stabilization
+ dicoBloc = {}
+ dicoBloc['condition' ] = "ModelName == '" + modeleName + "'"
+ dicoBloc['GeneralInformations'] = calculGeneralInformations(technicalUse,modeleName)
+ dicoBloc['AnalyticalEquation'] = calculAnalyticalEquations(technicalUse,modeleName)
+ dicoBloc['AgingParameters'] = calculAgingParameters()
+ dicoBloc['InitialParameters'] = calculInitialParameters(technicalUse,modeleName)
+ if dicoBloc != None : dicoArgs['b_ModelName_' + modeleName] = BLOC(**dicoBloc)
+ return BLOC(condition=condition, ModelName = ModelName,SimulationName=SimulationName,**dicoArgs)
+
+
+
+JdC = JDC_CATA ( code='VP',
+ execmodul=None,
+ )
+
+
+# ---------------------------------------------------------------------------------
+Calculation_for_Mechanistic = PROC (nom="Calculation_for_Mechanistic", op=None,
+# ---------------------------------------------------------------------------------
+ TechnicalUse= SIMP(statut= 'o',typ= 'TXM',into=dicoInfoGenerales['Modele_TechnicalUse'], defaut = 'cable'),
+ b_cable = blocPourCalculationForMechanisticSelonModeleTechnicalUse('cable'),
+ b_pipes = blocPourCalculationForMechanisticSelonModeleTechnicalUse('pipes'),
+ b_coating = blocPourCalculationForMechanisticSelonModeleTechnicalUse('coating'),
+
+)
+
+
+
from mapy.virtual_polymer_common import class_data
monMechanisticModel=class_data.Modele()
monMechanisticEquation=class_data.Equation()
return FACT(**lesArgs)
+def calculBlocAnalyticalEquationsForModification():
+# PN refaire l algo
+#print (dicoEquations['cable']['base']['initiation'])
+ #for technicalUse in dicoInfoGenerales['Modele_TechnicalUse']:
+ #condition = "TechnicalUse == '" + technicalUse + "'"
+ for technicalUse in ('cable',):
+ dicoArgs={}
+ typeReaction = SIMP (statut='o', typ='TXM', into = dicoInfoGenerales['Type_D_Equation'])
+ for typeDeLaReaction in dicoInfoGenerales['Type_D_Equation']:
+ lesArgsBloc={}
+ laCondition= "typeReaction == '" + typeDeLaReaction + "'"
+ dicoListeEquation=dicoEquations[technicalUse]['base'][typeDeLaReaction]
+ ListeEquation = dicoListeEquation.keys()
+ equationsAModifier=SIMP (statut='o', typ='TXM', max="**", homo = 'SansOrdreNiDoublon', into=ListeEquation)
+ #print (equationsAModifier)
+ dicoArgs['b_'+typeDeLaReaction]=BLOC(condition=laCondition, equationsAModifier=equationsAModifier)
+ return FACT(statut='o', typeReaction = typeReaction, **dicoArgs)
+
+ #for debutEquation in dicoInfoGenerales['Type_D_Equation']:
+ # dicoArgsDuFact={}
+ # for chaineEquation in dicoListeEquation[debutEquation]:
+ # nom,params=chaineEquation.split("\t\t")
+ # dicoArgsDuFact[nom]=SIMP(statut = 'o', typ ='TXM', defaut = params, homo= 'constant')
+ # dicoArgs[debutEquation]=FACT(statut = 'o',**dicoArgsDuFact)
+ #Equations = FACT(statut = 'o',Consigne = Consigne,**dicoArgs)
+
+ #dicoArgs={}
+ #dicoArgsArrhenius={}
+
+ # Attention coef est une liste
+ #for constante in dicoEquation[technicalUse]['class'].coef[0].keys():
+ # v=dicoEquation[technicalUse]['class'].coef[0][constante]
+ # if len(v) == 2 :
+ # dicoArgsArrhenius [constante] = SIMP(statut ="o",typ=Tuple(2),validators = VerifTypeTuple(('R','R')),defaut =v )
+ # else :
+ # dicoArgs [constante] = SIMP(statut ="o",typ='R',defaut =v[0] )
+ #ConstantesNonArrhenius = FACT(statut = 'o',**dicoArgs)
+ #ConstantesArrhenius = FACT(statut = 'o',**dicoArgsArrhenius)
+ #Constantes = FACT(statut = 'o',ConstantesNonArrhenius = ConstantesNonArrhenius, ConstantesArrhenius=ConstantesArrhenius)
+
+ return FACT(statut = 'o',Equations = Equations, Constantes=Constantes)
+
-JdC = JDC_CATA(code='VP',
- execmodul=None,
- )
# ------------------------------------------
Database = PROC (nom="Database", op=None,
# ------------------------------------------
- Database_Type = SIMP(statut= 'o',typ= 'TXM', into=("Local database", "Standard database"),),
- Model_Type = SIMP(statut= 'o',typ= 'TXM', into=("master model", "analytic model" ,"mechanistic model") ),
-# ------------------------------------------------------------------------
- b_Model_Mechanistic = BLOC(condition = "Model_Type == 'mechanistic model'",
# ------------------------------------------------------------------------
Type_chgt = SIMP (statut= 'o',typ= 'TXM',into=('modify equation', 'create equation', 'modify model', 'create model'),),
# generer le catalogue avec un fact
# Aging_Type type_vieil,
Creation = FACT ( statut = 'o',
- ChemicalFormulation = SIMP(statut='o', typ='TXM', defaut = monMechanisticEquation.representation ),
- Aging_Type=SIMP(statut= 'o',typ= 'TXM', min=1,max=1, into=('All', 'thermo', 'radio'), defaut = monMechanisticEquation.type_vieil[0]),
- Reaction_Type=SIMP(statut= 'o',typ= 'TXM', min=1,max=1, into=monDico['Equation_Liste'], defaut = monMechanisticEquation.type_react),
- Constituants = chercheConstituant(monMechanisticEquation),
- New = SIMP (statut = 'o', typ = bool, defaut=False),
- b_new = BLOC(condition = " New == True" ,
- Constituant = FACT ( statut = 'o', min=1, max='**',
- Name = SIMP(statut= 'o',typ= 'TXM'),
- Differential_Equation = SIMP(statut= 'o',typ= 'TXM'),
- ),
- ), # b new
+ ChemicalFormulation = SIMP(statut='o', typ='TXM', defaut = monMechanisticEquation.representation ),
+ Aging_Type = SIMP(statut= 'o',typ= 'TXM', min=1,max=1, into=('All', 'thermo', 'radio'), defaut = monMechanisticEquation.type_vieil[0]),
+ Reaction_Type = SIMP(statut= 'o',typ= 'TXM', min=1,max=1, into=dicoInfoGenerales['Type_D_Equation'], defaut = monMechanisticEquation.type_react),
+ Constituants = chercheConstituant(monMechanisticEquation),
+ New = SIMP (statut = 'o', typ = bool, defaut=False),
+ b_new = BLOC(condition = " New == True" ,
+ Constituant = FACT ( statut = 'o', min=1, max='**',
+ Name = SIMP(statut= 'o',typ= 'TXM'),
+ Differential_Equation = SIMP(statut= 'o',typ= 'TXM'),
+ ),
+ ), # b new
- Constantes = chercheConstantes(monMechanisticEquation),
- New_Cst = SIMP (statut = 'o', typ = bool, defaut=False),
- b_new_cst = BLOC(condition = " New_Cst == True" ,
- Constante = FACT ( statut = 'o', min=1, max='**',
- Name = SIMP (statut = 'o', typ = 'TXM'),
- ), # fin constante
+ Constantes = chercheConstantes(monMechanisticEquation),
+ New_Cst = SIMP (statut = 'o', typ = bool, defaut=False),
+ b_new_cst = BLOC(condition = " New_Cst == True" ,
+ Constante = FACT ( statut = 'o', min=1, max='**',
+ Name = SIMP (statut = 'o', typ = 'TXM'),
+ ), # fin constante
), #fin b_new
Arrhenius = SIMP (statut = 'o', typ = bool, defaut=monMechanisticEquation.arrhenius),
b_modify_equation = BLOC (condition = 'Type_chgt == "modify equation"',
# les valeurs par defaut seront lues dans la base de données
- Filtre = FACT (statut='o',
- #Reaction_Type=SIMP(statut= 'o',typ= 'TXM', min=1,into=monDico['Equation_Liste'], siValide=lienDB.remplitMechanisticModifyEquationListeEquation),
- Reaction_Type=SIMP(statut= 'o',typ= 'TXM', min=1,into=monDico['Equation_Liste'],),# siValide=lienDB.remplitMechanisticModifyEquationListeEquation),
+ Filtre = calculBlocAnalyticalEquationsForModification(),
+ #Filtre = FACT (statut='o',
+ # #Reaction_Type=SIMP(statut= 'o',typ= 'TXM', min=1,into=dicoInfoGenerales['Type_D_Equation'], siValide=lienDB.remplitMechanisticModifyEquationListeEquation),
+ # Reaction_Type=SIMP(statut= 'o',typ= 'TXM', min=1,into=dicoInfoGenerales['Type_D_Equation'],),# siValide=lienDB.remplitMechanisticModifyEquationListeEquation),
# Filtre getMechanisticEquation(Reaction_Type)
# diictionnaire key : nom de l equation / valeur classe instancies liste de nom d'equation
- Equation_List=SIMP(statut= 'o',typ= 'TXM'), #siValide=lienDB.remplitModificationEquation),
- ),
+ # Equation_List=SIMP(statut= 'o',typ= 'TXM'), #siValide=lienDB.remplitModificationEquation),
+ # ),
# lorsque le choix est fait on peut recuperer les valeurs par defaut
#ChemicalFormulation = SIMP(statut='o', typ='TXM', defaut = 'POOH -> 2P'),
Modification = FACT (statut='o',
ChemicalFormulation = SIMP(statut='o', typ='TXM', ), # classe.representation
- Reaction_Type=SIMP(statut= 'o',typ= 'TXM', min=1,into=monDico['Equation_Liste']), # classe.type_react
+ Reaction_Type=SIMP(statut= 'o',typ= 'TXM', min=1,into=dicoInfoGenerales['Type_D_Equation']), # classe.type_react
Aging_Type=SIMP(statut= 'o',typ= 'TXM', min=1,max=1, into=('All', 'thermo', 'radio'),), # classe.type_vieil
Constituants = FACT ( statut = 'o', # classe.constituants --> liste de nom. les equations sont dans le meme ordre self.equation
ID=FACT (statut='o',
Name =SIMP(statut='o',typ='TXM'), # obj.nom
Material=SIMP(statut='o',typ='TXM',),# obj.materiaux[0]
- TechnicalUse = SIMP(statut= 'o',typ= 'TXM',into=monDico['Modele_TechnicalUse']),#defaut=obj.technical_use
+ TechnicalUse = SIMP(statut= 'o',typ= 'TXM',into=dicoInfoGenerales['Modele_TechnicalUse']),#defaut=obj.technical_use
Reference=SIMP(statut='o',typ='TXM',), # defaut=monModele.reference, momModele = obj par la suite
Model_Developed_For_EDF = SIMP(typ = bool, statut = 'o'), #defaut = monModele.dvt_EDF[0]
Aging_Type=SIMP(statut= 'o',typ= 'TXM', min=1,max=1, into=('all', 'thermo', 'radio'),), # defaut = monModele.type_vieil
#
b_new = BLOC(condition = " New == True" ,
Add=FACT(statut = 'o',max='**',
- Filtre = SIMP(statut= 'o',typ= 'TXM',into=monDico['Equation_Liste']),
+ Filtre = SIMP(statut= 'o',typ= 'TXM',into=dicoInfoGenerales['Type_D_Equation']),
Equations=SIMP(statut= 'o',typ='TXM', min=1,max='**', homo='SansOrdreNiDoublon',into =['POOH -> 2P' , 'A', 'B', 'C'])
)
), # b new
# la classe par defaut getDefaultMechanistic
# renvoie un obj instancie
Filtre = FACT (statut='o',
- TechnicalUse=SIMP(statut= 'o',typ= 'TXM', min=1,into=monDico['Modele_TechnicalUse'],),
+ TechnicalUse=SIMP(statut= 'o',typ= 'TXM', min=1,into=dicoInfoGenerales['Modele_TechnicalUse'],),
# si valide
ModeleName=SIMP(statut='o',typ='TXM',into=['A','B']), # a choisir dans la liste des clefs
),
ID=FACT (statut='o',
Name =SIMP(statut='o',typ='TXM'), # obj.nom
Material=SIMP(statut='o',typ='TXM',),# obj.materiaux[0]
- TechnicalUse = SIMP(statut= 'o',typ= 'TXM',into=monDico['Modele_TechnicalUse']),#defaut=obj.technical_use
+ TechnicalUse = SIMP(statut= 'o',typ= 'TXM',into=dicoInfoGenerales['Modele_TechnicalUse']),#defaut=obj.technical_use
Reference=SIMP(statut='o',typ='TXM',), # defaut=monModele.reference, momModele = obj par la suite
Model_Developed_For_EDF = SIMP(typ = bool, statut = 'o'), #defaut = monModele.dvt_EDF[0]
Aging_Type=SIMP(statut= 'o',typ= 'TXM', min=1,max=1, into=('all', 'thermo', 'radio'),), # defaut = monModele.type_vieil
#
b_new = BLOC(condition = " New == True" ,
Add=FACT(statut = 'o',max='**',
- Filtre = SIMP(statut= 'o',typ= 'TXM',into=monDico['Equation_Liste']),
+ Filtre = SIMP(statut= 'o',typ= 'TXM',into=dicoInfoGenerales['Type_D_Equation']),
Equations=SIMP(statut= 'o',typ='TXM', min=1,max='**', homo='SansOrdreNiDoublon',into =['POOH -> 2P' , 'A', 'B', 'C'])
)
), # b new
), #fin modification
), # fin modify model
- ), # Fin mechanistic
# ------------------------------------------------------------------------
- b_Model_Analytic = BLOC(condition = "Model_Type == 'analytic model'",
- Type_chgt = SIMP (statut= 'o',typ= 'TXM',into=('modify equation', 'create equation', 'modify model', 'create model') ),
+# b_Model_Analytic = BLOC(condition = "Model_Type == 'analytic model'",
+# Type_chgt = SIMP (statut= 'o',typ= 'TXM',into=('modify equation', 'create equation', 'modify model', 'create model') ),
+#
+# b_creation_equation = BLOC (condition = 'Type_chgt == "create equation"',
+# Creation = FACT(statut = 'o',
+# Name=SIMP(statut= 'o',typ= 'TXM',), # defaut o.nom
+# Equation_Type = SIMP(statut= 'o',typ= 'TXM',into=dicoInfoGenerales['posttraitement_Typ']), # defaut o.type_equa
+# PostProcessing = SIMP (statut = 'o', typ = bool,),# o.post_processing
+# Calculation_Result = SIMP(statut= 'o',typ= 'TXM'), # defaut o.calculation_result
+## dans o.parameters on a une liste
+# Parameters=SIMP(statut= 'o',typ='TXM', min=1,max='**', homo='SansOrdreNiDoublon',into =['A', 'Ea', 'C']),
+# New = SIMP (statut = 'o', typ = bool, defaut=False),
+# b_new = BLOC(condition = " New == True" ,
+# Param = FACT(statut = 'o', max='**',
+# Name=SIMP(statut= 'o',typ= 'TXM',),
+# ), #param
+# ), # b_new
+# Equation = SIMP(statut= 'o',typ= 'TXM'), # defaut o.equation
+# Universal_Constants=SIMP(statut= 'o',typ='TXM', min=1,max='**', homo='SansOrdreNiDoublon',into =['A', 'B', 'C']),
+# Results_Unit = SIMP(statut= 'o',typ= 'TXM'), # defaut o.results_unit
+# Integrate = SIMP (statut = 'o', typ = bool),# defaut o.integrate
+# Comment = SIMP(statut= 'o',typ= 'TXM'), # defaut o.comment
+# ),# Fact creation
+# ), #bloc b_creation_equation
- b_creation_equation = BLOC (condition = 'Type_chgt == "create equation"',
- Creation = FACT(statut = 'o',
- Name=SIMP(statut= 'o',typ= 'TXM',), # defaut o.nom
- Equation_Type = SIMP(statut= 'o',typ= 'TXM',into=monDico['posttraitement_Typ']), # defaut o.type_equa
- PostProcessing = SIMP (statut = 'o', typ = bool,),# o.post_processing
- Calculation_Result = SIMP(statut= 'o',typ= 'TXM'), # defaut o.calculation_result
-# dans o.parameters on a une liste
- Parameters=SIMP(statut= 'o',typ='TXM', min=1,max='**', homo='SansOrdreNiDoublon',into =['A', 'Ea', 'C']),
- New = SIMP (statut = 'o', typ = bool, defaut=False),
- b_new = BLOC(condition = " New == True" ,
- Param = FACT(statut = 'o', max='**',
- Name=SIMP(statut= 'o',typ= 'TXM',),
- ), #param
- ), # b_new
- Equation = SIMP(statut= 'o',typ= 'TXM'), # defaut o.equation
- Universal_Constants=SIMP(statut= 'o',typ='TXM', min=1,max='**', homo='SansOrdreNiDoublon',into =['A', 'B', 'C']),
- Results_Unit = SIMP(statut= 'o',typ= 'TXM'), # defaut o.results_unit
- Integrate = SIMP (statut = 'o', typ = bool),# defaut o.integrate
- Comment = SIMP(statut= 'o',typ= 'TXM'), # defaut o.comment
- ),# Fact creation
- ), #bloc b_creation_equation
-
- b_modification_equation = BLOC (condition = 'Type_chgt == "modify equation"',
- Filtre = FACT(statut = 'o',
- Equation_Type = SIMP(statut= 'o',typ= 'TXM',into=monDico['posttraitement_Typ']), # defaut o.type_equa
- Equation_Choice = SIMP(statut= 'o',typ= 'TXM',into=['A','B','C']),
- ),
- Modification = FACT(statut = 'o',
- Name=SIMP(statut= 'o',typ= 'TXM',), # defaut o.nom
- Equation_Type = SIMP(statut= 'o',typ= 'TXM',into=monDico['posttraitement_Typ']), # defaut o.type_equa
- PostProcessing = SIMP (statut = 'o', typ = bool,),# o.post_processing
- Calculation_Result = SIMP(statut= 'o',typ= 'TXM'), # defaut o.calculation_result
-# dans o.parameters on a une liste
- Parameters=SIMP(statut= 'o',typ='TXM', min=1,max='**', homo='SansOrdreNiDoublon',into =['A', 'Ea', 'C']),
- New = SIMP (statut = 'o', typ = bool, defaut=False),
- b_new = BLOC(condition = " New == True" ,
- Param = FACT(statut = 'o', max='**',
- Name=SIMP(statut= 'o',typ= 'TXM',),
- ), #param
- ), # b_new
- Equation = SIMP(statut= 'o',typ= 'TXM'), # defaut o.equation
- Universal_Constants=SIMP(statut= 'o',typ='TXM', min=1,max='**', homo='SansOrdreNiDoublon',into =['A', 'B', 'C']),
- Results_Unit = SIMP(statut= 'o',typ= 'TXM'), # defaut o.results_unit
- Integrate = SIMP (statut = 'o', typ = bool),# defaut o.integrate
- Comment = SIMP(statut= 'o',typ= 'TXM'), # defaut o.comment
- ),# Fact Modification
-
- ), #bloc b_modification_equation
- ), # Fin model analytic
+# b_modification_equation = BLOC (condition = 'Type_chgt == "modify equation"',
+# Filtre = FACT(statut = 'o',
+# Equation_Type = SIMP(statut= 'o',typ= 'TXM',into=dicoInfoGenerales['posttraitement_Typ']), # defaut o.type_equa
+# Equation_Choice = SIMP(statut= 'o',typ= 'TXM',into=['A','B','C']),
+# ),
+# Modification = FACT(statut = 'o',
+# Name=SIMP(statut= 'o',typ= 'TXM',), # defaut o.nom
+# Equation_Type = SIMP(statut= 'o',typ= 'TXM',into=dicoInfoGenerales['posttraitement_Typ']), # defaut o.type_equa
+# PostProcessing = SIMP (statut = 'o', typ = bool,),# o.post_processing
+# Calculation_Result = SIMP(statut= 'o',typ= 'TXM'), # defaut o.calculation_result # dans o.parameters on a une liste
+# Parameters=SIMP(statut= 'o',typ='TXM', min=1,max='**', homo='SansOrdreNiDoublon',into =['A', 'Ea', 'C']),
+# New = SIMP (statut = 'o', typ = bool, defaut=False),
+# b_new = BLOC(condition = " New == True" ,
+# Param = FACT(statut = 'o', max='**',
+# Name=SIMP(statut= 'o',typ= 'TXM',),
+# ), #param
+# ), # b_new
+# Equation = SIMP(statut= 'o',typ= 'TXM'), # defaut o.equation
+# Universal_Constants=SIMP(statut= 'o',typ='TXM', min=1,max='**', homo='SansOrdreNiDoublon',into =['A', 'B', 'C']),
+# Results_Unit = SIMP(statut= 'o',typ= 'TXM'), # defaut o.results_unit
+# Integrate = SIMP (statut = 'o', typ = bool),# defaut o.integrate
+# Comment = SIMP(statut= 'o',typ= 'TXM'), # defaut o.comment
+# ),# Fact Modification
+
+# ), #bloc b_modification_equation
+# ), # Fin model analytic
# ------------------------------------------------------------------------
# ---------------------------------------------------------------------------
- b_model_master=BLOC(condition = 'Model_Type == "master model"',
- Type_chgt = SIMP (statut= 'o',typ= 'TXM',into=('modify model', 'create model') ),
- ),
)