Beispiel #1
0
  def _readMoreXML(self,xmlNode):
    """
      Function to read the portion of the xml input that belongs to this specialized class and initialize
      some members based on inputs. This can be overloaded in specialize code interface in order to
      read specific flags
      @ In, xmlNode, xml.etree.ElementTree.Element, Xml element node
      @ Out, None.
    """
    GenericCode._readMoreXML(self,xmlNode)
    self.include=''
    self.tilastDict={} #{'folder_name':'tilast'} - this dictionary contains the last simulation time of each branch, this is necessary to define the correct restart time
    self.branch = {} #{'folder_name':['variable branch','variable value']} where variable branch is the variable sampled for the current branch e.g. {det_1:[timeloca, 200]}
    self.values = {} #{'folder_name':[['variable branch_1','variable value_1'],['variable branch_2','variable value_2']]} for each DET sampled variables
    self.printInterval = ''  #value of the print interval
    self.boolOutputVariables=[] #list of MAAP5 boolean variables of interest
    self.contOutputVariables=[] #list of MAAP5 continuous variables of interest
###########
    self.multiBranchOccurred=[]
###########
    for child in xmlNode:
      if child.tag == 'includeForTimer':
        if child.text != None:
          self.include = child.text
      if child.tag == 'boolMaapOutputVariables':
        #here we'll store boolean output MAAP variables to look for
        if child.text != None:
          self.boolOutputVariables = child.text.split(',')
      if child.tag == 'contMaapOutputVariables':
        #here we'll store boolean output MAAP variables to look for
        if child.text != None:
          self.contOutputVariables = child.text.split(',')
      if child.tag == 'stopSimulation':
        self.stop=child.text #this node defines if the MAAP5 simulation stop condition is: 'mission_time' or the occurrence of a given event e.g. 'IEVNT(691)'
    if (len(self.boolOutputVariables)==0) and (len(self.contOutputVariables)==0):
      raise IOError('At least one of two nodes <boolMaapOutputVariables> or <contMaapOutputVariables> has to be specified')
Beispiel #2
0
 def __init__(self):
     """
   Initializes the SERPENT Interface.
   @ In, None
   @ Out, None
 """
     GenericCode.__init__(self)
     self.printTag = 'SERPENT'  # Print Tag
     self.isotope_list_f = None  # isotope list file (if any)
     self.isotopes = []  # isotopes to collect
     self.traceCutOff = 1.e-7  # cutoff threshold for ignoring isotopes
Beispiel #3
0
 def _readMoreXML(self, xmlNode):
   """
     Function to read the portion of the xml input that belongs to this class and initialize some members
     based on inputs
     @ In, xmlNode, xml.etree.ElementTree.Element, xml element node
     @ Out, None
   """
   GenericCode._readMoreXML(self, xmlNode)
   for outNode in xmlNode.findall('codeOutput'):
     outType = outNode.get('type').strip()
     outName = outNode.text.strip()
     self.codeOutputs[outName] = outType
Beispiel #4
0
 def __init__(self):
   """
     Initializes the SAPHIRE code interface
     @ In, None
     @ Out, None
   """
   GenericCode.__init__(self)
   self.codeOutputs = {} # dict of {codeOutputFileName:codeOutputFileType}, SAPHIRE can generate multiple output files
                         # such as uncertainty files for event trees or fault trees, and importance files for event
                         # trees or fault trees. This dictionary will store the users defined outputflies that
                         # will be collected.
   self.outputDest = 'Publish' # Saphire will dump its outputs to this folder
   self.ignoreInputExtensions = ['zip'] # the list of input extensions that will be ignored by the code interface.
                                        # i.e. files with extension 'zip' will not be perturbed.
   self.setRunOnShell(shell=False) # Saphire can not run through shell
Beispiel #5
0
  def createNewInput(self,currentInputFiles,oriInputFiles,samplerType,**Kwargs):
    """
      This method is used to generate an input based on the information passed in.
      @ In, currentInputFiles, list,  list of current input files (input files from last this method call)
      @ In, oriInputFiles, list, list of the original input files
      @ In, samplerType, string, Sampler type (e.g. MonteCarlo, Adaptive, etc. see manual Samplers section)
      @ In, Kwargs, dictionary, kwarded dictionary of parameters. In this dictionary there is another dictionary called "SampledVars"
            where RAVEN stores the variables that got sampled (e.g. Kwargs['SampledVars'] => {'var1':10,'var2':40})
      @ Out, newInputFiles, list, list of newer input files, list of the new input files (modified and not)
    """
    self.samplerType=samplerType
    if 'dynamiceventtree' in str(samplerType).lower():
      if Kwargs['RAVEN_parentID'] == 'None':
        self.oriInput(oriInputFiles) #original input files are checked only the first time
      self.stopSimulation(currentInputFiles, Kwargs)
###########
      if Kwargs['RAVEN_parentID'] != 'None':
        print('Kwargs',Kwargs)
        self.restart(currentInputFiles, Kwargs['RAVEN_parentID'])
###########
        if len(self.multiBranchOccurred)>0:
          self.multiBranchMethod(currentInputFiles, Kwargs)
###########
        if str(Kwargs['prefix'].split('-')[-1]) != '1':
          self.modifyBranch(currentInputFiles, Kwargs)
    return GenericCode.createNewInput(self,currentInputFiles,oriInputFiles,samplerType,**Kwargs)