From: PASCALE NOYRET Date: Mon, 30 May 2022 10:07:11 +0000 (+0200) Subject: devlpt UQ X-Git-Tag: merge_uncertainty_odysee_1210~72 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f832d4a67378ade001b0149bf9ef976f17608ed2;p=tools%2Feficas.git devlpt UQ --- diff --git a/ReacteurNumerique/cata_RN_UQ.py b/ReacteurNumerique/cata_RN_UQ.py new file mode 100644 index 00000000..a789074c --- /dev/null +++ b/ReacteurNumerique/cata_RN_UQ.py @@ -0,0 +1,38 @@ +import os, sys +repInitial = os.path.dirname(os.path.abspath(__file__)) +repEficas = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +if os.path.dirname(repInitial) not in sys.path : + sys.path.insert(0,repInitial) +if os.path.dirname(repEficas) not in sys.path : + sys.path.insert(0,repEficas) +import types + +from Accas import OPER, BLOC, FACT, SIMP, ASSD, JDC_CATA, Matrice, Tuple, AU_MOINS_UN, A_VALIDATOR, PROC +from Noyau.N_VALIDATOR import Valid + +# +avecIncertitude=True +# +dictUQ = {'initial_power' : ({'Uniform' : {}}, {'TruncatedNormal' : {}}), + 'initial_core_inlet_temperature' : ({'Uniform' : {}}, {'TruncatedNormal' : {}}), + #'initial_boron_concentration' : ({'Uniform' : {}}, {'TruncatedNormal' : {}}), + #'initial_inlet_pressure' : ({'Uniform' : {}}, {'TruncatedNormal' : {}}), + #'initial_outlet_pressure' : ({'Uniform' : {}}, {'TruncatedNormal' : {}}), + #'assembly_width' : ({'Uniform' : {}}, {'TruncatedNormal' : {}}), + # modifier la partie Accas pour garder une reference a l objet nomme + } + +listeDesSortiesPossibles = ("Average_mass_flux", "Boiling_power_fraction", "Boron_concentration", "Enthalpy", "Fuel_power_fraction", "Fuel_temperature", "Kinetic_reactivity", "Liquid_power", "Mass_flux", "Mass_fraction", "Mass_title", "Mixture_density", "Mixture_specific_enthalpy", "Mixture_temperature", "Neutronic_power", "Outlet_pressure", "Pollutant_concentration", "Pressure ", "Rowlands_fuel_effective_temp", "Thermal_power", "Water_density", "Water_temperature", "Power_level" ) + +from cata_UQ import creeOperExpressionIncertitude +ExpressionIncertitude=creeOperExpressionIncertitude(dictUQ, listeDesSortiesPossibles) + + + +#autonome=1 +autonome=0 +if autonome : + from Accas import * + JdC = JDC_CATA(code="UQ"); + ExpressionIncertitude = creeOperExpressionIncertitude(dictUQ, listeDesSortiesPossibles); + diff --git a/generator/generator_UQ.py b/generator/generator_UQ.py index ff2d4495..b8034ccf 100644 --- a/generator/generator_UQ.py +++ b/generator/generator_UQ.py @@ -142,11 +142,26 @@ class UQGenerator(PythonGenerator): def creeTexteInputVariables(self,indent): texte='' for v in self.lesVariablesInput : - loiDistribution= v.getChildOrChildInBloc('Distribution').valeur - if loiDistribution in UQGenerator.__dict__: - Appli.__dict__[self.code.upper()](self,) - - texte += (v.nom)+'\n' + nomVariableInput = v.variableDeterministe.nom + loiDistribution = v.getChildOrChildInBloc('Distribution').valeur + # on cherche le bloc qui contient ce qui est necessaire a la loi + # on est confiant !!!! sur l adequation du catalogue et des attributs des lois persalys + # reflechir a cela + texte="{}{} = persalys.input('{}', ot.{}(".format(indent,nomVariableInput,nomVariableInput,loiDistribution) + chaineArgs='' + leBlocDesArgs=None + for mc in v.mcListe : + if (mc.nom).find('b_Model_Variable_') == 0 : + for mcFils in mc.mcListe : + if mcFils.nom.find(loiDistribution) > 1: + leBlocDesArgs=mcFils + break + if not leBlocDesArgs : + print ('souci pour dumper la loi') + return '' + for mcFils in leBlocDesArgs.mcListe : + chaineArgs+=str(mcFils.valeur) +', ' + texte+=chaineArgs[0:-2]+'))\n' return texte def creeScriptPersalys(self, debug=True) :