Scheduler
The Scheduler class (g_sim.SScheduler, src/ADSIDAC/Scheduler/Scheduler.cpp) has three functions:
- it parses the command line and the options file,
- it stores the directories of the inputs and outputs,
- it checks the sequence termination criteria.
Under MPI the distribution of sequences over ranks is not part of this class; it is done by Server and Client in src/ADSIDAC/ParallelExec/.
Options
Scheduler::parseOptions() declares every command-line option with Boost.Program_options and copies the values into g_sim.config. After the command line it reads a file named ZiniADS.txt from the current directory, if there is one, as an options file with one name=value line per option. Values given on the command line take precedence. The two required options are project-dir (the directory that holds Input/ and receives Output/) and input-deck (the RELAP5 input deck). The full list is in Running a simulation.
Directories
From the project directory the scheduler derives the input directories (getODMDirectory(), getOATDirectory(), getEOPDirectory(), getIndicatorsDirectory(), getSystemDirectory(), getHardwareReliabilityDirectory(), getSupportSystemsDirectory(), getSchedulerDirectory()) and the output directories (getOutputDirectory(), getESDirectory(), getPEDirectory(), getKPSDirectory()). All other modules ask the scheduler for these paths. Under MPI each worker redirects the output directories to its own rank_N/Output/.
Sequence termination
Scheduler::checkForTerminatingCurrentSequence() decides whether the current sequence ends. The truncation probability and truncation time come from Input/Scheduler/ZCtrlPar.txt; --truncation-time overrides the time. The criteria are checked in this order:
- RELAP5 has already stopped the sequence (
r5pars_.csnostopis not 0). - Probability truncation. The unconditional probability of the current branch is below the truncation probability (consequence
ProbTruncated). - Time truncation. The simulation time exceeds the truncation time (consequence
TimeTruncated). - Alarm truncation. An alarm whose name starts with
A_ENDSEQ_is activated (consequenceEndseqAlarm). This lets the analyst end a sequence on a parameter value or a component state. - Non-response action. The expectation of a procedure step has failed and the step's non-response action is
Stop(ProcedureStep.cppcallssetSequenceTerminatedByNonResponseAction(true); consequenceNonResponseAction). - Simulation error. An error while reading an input file or during the simulation sets
r5pars_.sim_err. The end state takes the consequence type and the message that the failing module stored in the branch record (setTempTypeOfConsequence(),setTempESMessage()).
For criteria 2 to 6 the function creates the BranchEndState, hands it to BranchRecord::addAnEndState() and sets r5pars_.csnostop, which makes RELAP5 leave its time-step loop.