--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2008-2018 EDF R&D
+#
+# This file is part of SALOME ADAO module
+#
+# 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
+import os
+from Accas import OPER, BLOC, FACT, SIMP, ASSD, JDC_CATA, VerifTypeTuple, Matrice
+from Extensions.i18n import tr
+import types
+monFichier = os.path.abspath(__file__)
+
+JdC = JDC_CATA(
+ code='Essai'
+)
+VERSION_CATALOGUE = 'V_0'
+
+
+NMIN_ASSEMBLY = 1
+NMAX_ASSEMBLY = 18
+
+
+class Tuple:
+ def __init__(self, ntuple):
+ self.ntuple = ntuple
+
+ def __convert__(self, valeur):
+ if len(valeur) != self.ntuple:
+ return None
+ return valeur
+
+ def info(self):
+ return "Tuple de %s elements" % self.ntuple
+
+
+
+class VerifPostTreatment(VerifTypeTuple):
+
+ def __init__(self):
+ super(VerifPostTreatment, self).__init__(('TXM', 'TXM'))
+ self.cata_info = ""
+ self.physValeurs = ('Neutronics', 'Thermalhydraulics')
+ self.typeValeurs = ('MED', 'SUM', 'MIN', 'MAX', 'MEAN')
+
+ def info(self):
+ return tr(": verifie les \ntypes dans un tuple")
+
+ def infoErreurListe(self):
+ return tr("Les types entres ne sont pas permis")
+
+ def default(self, valeur):
+ return valeur
+
+ def isList(self):
+ return 1
+
+ def convertItem(self, valeur):
+ if len(valeur) != len(self.typeDesTuples):
+ raise ValueError(
+ tr("%s devrait etre de type %s ") % (valeur, self.typeDesTuples))
+ ok = self.verifType(valeur)
+ if ok == 0:
+ raise ValueError(
+ tr("%s devrait etre de type %s (%d)") % (valeur, self.typeDesTuples, ok))
+ if ok < 0:
+ raise ValueError(
+ tr("%s devrait etre dans %s ") % (valeur[1], self.typeValeurs))
+ return valeur
+
+ def verifItem(self, valeur):
+ try:
+ if len(valeur) != len(self.typeDesTuples):
+ return 0
+ ok = self.verifType(valeur)
+ if ok != 1:
+ return 0
+ except:
+ return 0
+ return 1
+
+ def verifType(self, valeur):
+ ok = 0
+ for v in valeur:
+ if type(v) == bytes or type(v) == str:
+ ok += 1
+ if ok == len(self.typeDesTuples):
+ if valeur[1] in self.typeValeurs: # and valeur[1] in self.physValeurs:
+ return 1
+ return -1
+ return 0
+
+ def verif(self, valeur):
+ if type(valeur) in (list, tuple):
+ liste = list(valeur)
+ for val in liste:
+ if self.verifItem(val) != 1:
+ return 0
+ return 1
+ return 0
+
+
+class myAssembly(ASSD):
+ pass
+
+
+class myTechnoData(ASSD):
+ pass
+
+
+class myRodBank(ASSD):
+ pass
+
+
+class myModelData(ASSD):
+ pass
+
+
+class myScenarioData(ASSD):
+ pass
+
+
+Assembly = OPER(nom='Assembly', sd_prod=myAssembly,
+ assembly_name=SIMP(statut='o', typ='TXM'),
+ assembly_type=SIMP(statut='o', typ='TXM', into=("UOX", "MOX", "REF")),
+ description=BLOC(condition='assembly_type != "REF"',
+ assembly_width=SIMP(statut='o', typ='R'),
+ radial_description=FACT(statut='o',
+ clad_outer_radius=SIMP(statut='o', typ='R'),
+ guide_tube_outer_radius=SIMP(statut='o', typ='R'),
+ fuel_rod_pitch=SIMP(statut='o', typ='R'),
+ nfuel_rods=SIMP(statut='o', typ='I')),
+ axial_description=FACT(statut='o',
+ active_length_start=SIMP(statut='o', typ='R'),
+ active_length_end=SIMP(statut='o', typ='R')),
+ grids=FACT(statut='o',
+ mixing=FACT(statut='o',
+ positions=SIMP(
+ statut='f', typ='R', max="**"),
+ size=SIMP(statut='o', typ='R')),
+ non_mixing=FACT(statut='o',
+ positions=SIMP(
+ statut='f', typ='R', max='**'),
+ size=SIMP(statut='o', typ='R')),
+ )
+ )
+ )
+
+
+RodBank = OPER(nom="RodBank", sd_prod=myRodBank,
+ rodbank_name=SIMP(statut='o', typ='TXM'),
+ step_height=SIMP(statut='o', typ='R'),
+ nsteps=SIMP(statut='o', typ='I'))
+
+
+def add_lr_refl(ass_list):
+ return ["RW"] + ass_list + ["RE"]
+
+
+def add_tb_refl(ass_list):
+ return ["RS"] + ass_list + ["RN"]
+
+
+def generate_ass_map(nass_list):
+ xsym_list = [a for a in 'ABCDEFGHJKLNPRSTUVWXYZ']
+ xsym_list.reverse()
+ ysym_list = ["%02d" % i for i in range(NMIN_ASSEMBLY, NMAX_ASSEMBLY+1)]
+ ysym_list.reverse()
+ def_xaxis = {}
+ def_yaxis = {}
+ for n in range(NMIN_ASSEMBLY, NMAX_ASSEMBLY+1):
+ def_xaxis[n] = add_lr_refl(xsym_list[-n:])
+ def_yaxis[n] = add_tb_refl(ysym_list[-n:])
+
+ dico = {}
+ #for n in nass_list:
+ for n in (6,) :
+ dico['assembly_map_%d' % n] = BLOC(condition="nb_assembly==%d" % n,
+ xaxis=SIMP(statut='o',
+ typ='TXM',
+ min=n+2, max=n+2,
+ defaut=def_xaxis[n],),
+ #defaut=def_xaxis[n],
+ #nomXML='xaxis'+str(n)),
+ yaxis=SIMP(statut='o',
+ typ='TXM',
+ min=n+2, max=n+2,
+ defaut=def_yaxis[n]),
+ assembly_map=SIMP(statut="o",
+ typ=Matrice(nbLigs=n+2,
+ nbCols=n+2,
+ #valSup=1,
+ #valMin=-1,
+ #typElt='TXM', # ici c'est le nom de l'assemblage
+ typElt=myAssembly, # ici c'est le nom de l'assemblage
+ listeHeaders=None),
+ ),
+ rod_map=SIMP(statut="o",
+ typ=Matrice(nbLigs=n+2,
+ nbCols=n+2,
+ valSup=1,
+ valMin=-1,
+ typElt='TXM', # ici c'est le nom de l'assemblage
+ listeHeaders=None),
+ defaut=(n+2)*[(n+2)*['.']]))
+
+ return dico
+
+
+Techno_data = OPER(nom='Techno_data', sd_prod=myTechnoData,
+ assembly_list=SIMP(statut='o', typ=myAssembly, min=1, max="**"), # à resorber quand on mettra dans la Matrice
+ rodbank_list=SIMP(statut='o', typ=myRodBank, min=0, max="**"), # idem
+ radial_description=FACT(statut='o',
+ nb_assembly=SIMP(statut='o', typ='I', into=list(range(NMIN_ASSEMBLY, NMAX_ASSEMBLY))),
+ **(generate_ass_map(range(NMIN_ASSEMBLY, NMAX_ASSEMBLY)))
+ ), # Radial_Description
+ axial_description=FACT(statut='o',
+ lower_refl_size=SIMP(statut='o', typ='R'),
+ upper_refl_size=SIMP(statut='o', typ='R'),
+ ),
+ nominal_power=SIMP(statut='o', typ='R'),
+ fuel_power_fraction=SIMP(statut='o', typ='R'),
+ ) # Techno data
+
+Model_data = OPER(nom='Model_data', sd_prod=myModelData,
+ physics=SIMP(statut='o', typ='TXM', into=(
+ 'Neutronics', 'Thermalhydraulics')),
+ scale=SIMP(statut='o', typ='TXM', into=(
+ 'system', 'component', 'local')),
+ b_neutro_compo=BLOC(condition='physics=="Neutronics" and scale=="component"',
+ codeNeutro=SIMP(statut='o', typ='TXM', into=('COCAGNE', 'APOLLO3')),
+ radial_meshingNeutro=FACT(statut='o',
+ flux_solver=SIMP(statut='o', typ='TXM', into=('subdivision', 'pin-by-pin')),
+ b_flux_subdivision=BLOC(condition='flux_solver=="subdivision"',
+ flux_subdivision=SIMP(statut='o', typ='I')),
+ feedback_solver=SIMP(statut='o', typ='TXM', into=('subdivision', 'pin-by-pin')),
+ b_feedback_subdivision=BLOC(condition='feedback_solver=="subdivision"',
+ feedback_subdivision=SIMP(statut='o', typ='I')))),
+ b_scale_compo=BLOC(condition='scale=="component"',
+ axial_meshing=FACT(statut='o',
+ lower_refl=SIMP(statut='o', typ='I'),
+ fuel=SIMP(statut='o', typ='I'),
+ upper_refl=SIMP(statut='o', typ='I'))),
+ b_thermo_compo=BLOC(condition='physics=="Thermalhydraulics" and scale=="component"',
+ code=SIMP(statut='o', typ='TXM', into=('THYC', 'CATHARE3', 'FLICA4')),
+ radial_meshing=FACT(statut='o',
+ fluid=SIMP(statut='o', typ='TXM', into=('subdivision', 'subchannel')),
+ b_fluid_subdivision=BLOC(condition='fluid=="subdivision"',
+ fluid_subdivision=SIMP(statut='o', typ='I')),
+ pellet=SIMP(statut='o', typ='I'),
+ clad=SIMP(statut='o', typ='I'))),
+ b_scale_local=BLOC(condition='scale=="local"',
+ mesh_file=SIMP(statut='o', typ='Fichier')),
+ )
+
+
+Scenario_data = OPER(nom='Scenario_data', sd_prod=myScenarioData,
+ initial_power=SIMP(statut='o', typ='R', val_min=0., defaut=100.),
+ initial_power_unit=SIMP(statut='o', typ='TXM',
+ into=('% Nominal power', 'W'),
+ defaut ='% Nominal power',),
+ initial_rod_positions=SIMP(statut='o',
+ typ=Tuple(2),
+ validators=VerifTypeTuple(['TXM', 'I']),
+ ang="Type@label, position (e.g. RodBank@RB, 0)",
+ max='**'),
+ scenario_type=SIMP(statut='o',
+ typ='TXM',
+ into=['RIA']),
+ b_ria=BLOC(condition='scenario_type=="RIA"',
+ ejected_rod=SIMP(statut='o',
+ typ='TXM'),
+ rod_position_program=SIMP(statut='o',
+ typ=Tuple(2),
+ validators=VerifTypeTuple(['R', 'I']),
+ max='**'),
+ ),
+ post_processing=SIMP(statut='f',
+ typ=Tuple(2),
+ validators=VerifPostTreatment(),
+ max='**'),
+ )
--- /dev/null
+
+REF=Assembly(assembly_name='REF',
+ assembly_type='REF',);
+
+U1=Assembly(assembly_name='U1',
+ assembly_type='UOX',
+ assembly_width=0.21504,
+ radial_description=_F(clad_outer_radius=0.00475,
+ guide_tube_outer_radius=0.006025,
+ fuel_rod_pitch=0.0126,
+ nfuel_rods=264,),
+ axial_description=_F(active_length_start=0.2,
+ active_length_end=1.5,),
+ grids=_F(mixing=_F(positions=(1.0807,),
+ size=0.033,),
+ non_mixing=_F(positions=(0.026,),
+ size=0.033,),),);
+
+RB=RodBank(rodbank_name='RB',
+ step_height=0.008,
+ nsteps=162,);
+
+techno_data=Techno_data(assembly_list=(REF,U1,),
+ rodbank_list=(RB,),
+ radial_description=_F(nb_assembly=6,
+ xaxis=('RW','F','E','D','C','B','A','RE',),
+ yaxis=('RS','06','05','04','03','02','01','RN',),
+ assembly_map=((REF,REF,REF,REF,REF,REF,REF,REF,),(REF,REF,U1,U1,U1,U1,REF,REF,),(REF,U1,U1,U1,U1,U1,U1,REF,),(REF,U1,U1,U1,U1,U1,REF,REF,),(REF,U1,U1,U1,U1,U1,U1,REF,),(REF,U1,U1,U1,U1,U1,REF,REF,),(REF,REF,U1,U1,U1,U1,REF,REF,),(REF,REF,REF,REF,REF,REF,REF,REF,),),
+ rod_map=
+ (['#','#','#','#','#','#','#',
+ '#'],['#','#','.','.','.','.','#','#'],['#','.','.','.','RB','.',
+ '.','#'],['#','.','RB','.','.','.','.','#'],['#','.','.','.','.',
+ 'RB','.','#'],['#','.','.','RB','.','.','.','#'],['#','#','.','.',
+ '.','.','#','#'],['#','#','#','#','#','#','#','#'],),),
+ axial_description=_F(lower_refl_size=0.2,
+ upper_refl_size=0.2,),
+ nominal_power=100000000.0,
+ fuel_power_fraction=0.974,);
+
+neutro_model=Model_data(physics='Neutronics',
+ scale='component',
+ codeNeutro='COCAGNE',
+ radial_meshingNeutro=_F(flux_solver='subdivision',
+ flux_subdivision=1,
+ feedback_solver='subdivision',
+ feedback_subdivision=2,),
+ axial_meshing=_F(lower_refl=1,
+ fuel=21,
+ upper_refl=1,),);
+
+thermo_model=Model_data(physics='Thermalhydraulics',
+ scale='component',
+ axial_meshing=_F(lower_refl=1,
+ fuel=40,
+ upper_refl=1,),
+ code='THYC',
+ radial_meshing=_F(fluid='subdivision',
+ fluid_subdivision=1,
+ pellet=8,
+ clad=2,),);
+
+scenario_data=Scenario_data(initial_power=100.0,
+ initial_power_unit='% Nominal power',
+ initial_rod_positions=(('Rodbank@RB',162),('Rodcluster@B04',0)),
+ scenario_type='RIA',
+ ejected_rod='B04',
+ rod_position_program=((0.0,0),(0.1,162)),
+ post_processing=(('Fuel temperature@Thermalhydraulics','MAX'),('Neutronic power@Neutronics','SUM'),('Fuel temperature@Thermalhydraulics','MED')),);
+#VERSION_CATALOGUE:V_0:FIN VERSION_CATALOGUE
+#CHECKSUM:ce13abdd0825f97e69e9b5deb5d790c8 -:FIN CHECKSUM
\ No newline at end of file