Source Code Layout
The repository is built with CMake. Each directory under src/ that holds engine code has its own CMakeLists.txt and builds one static library; the executable adsidac is linked from them. A C++ class is normally one .h file and one .cpp file that carry the name of the class.
Top level
| Path | Content |
|---|---|
src/ | Engine sources (below) |
mock-solver/ | Stand-alone mock thermal-hydraulic solver. It is a separate CMake project (mock-solver/CMakeLists.txt), not a target of the top-level build. main.cpp starts an HTTP server (MockServer) around a lumped-parameter PWR model (SimplifiedPWR), with ParameterMapper, TripEvaluator and CheckpointStore. See Mock solver architecture |
unittests/ | Boost.Test unit tests. The build adds Crew, System, ReasonMachine, Procedure, BoostSerialization and FaultTree; the HWReliability and CalculationAid directories are present but not added in unittests/CMakeLists.txt |
tests/ | Integration tests. tests/BV4/ is the three-loop PWR fixture (input deck BV4.i and the Input/ tree), tests/BV3/ is a reference input set that is not part of the build, tests/template/ holds the ZiniADS.txt example, and tests/scripts/ holds the validation scripts that tests/CMakeLists.txt registers with ctest |
tools/adsmd/ | adsmd, a Rust workspace (crates adsmd-cli, adsmd-deck, adsmd-parsers, adsmd-types, adsmd-validate, adsmd-report) that parses and validates an ADS-IDAC input tree. Built with cargo, not with CMake |
third_party/ | Header-only dependencies: httplib.h (HTTP server and client) and json.hpp |
lib/relap/ | Location of pre-built RELAP5 libraries for -DUSE_PREBUILT_RELAP=ON |
studies/ | Campaign input decks (not test fixtures) |
scripts/ | Benchmark, probe, cluster job and figure scripts |
Docker/ | Container build files |
docs/ | This documentation site (VitePress) |
src/
| Directory | Library | Content |
|---|---|---|
src/ADSIDAC/ | see below | The C++17 engine. ADSIDAC.cpp contains main(), the serial sequence loop and the --merge-only entry point |
src/Relap/ | relap, envrl, r5par, restart_membuf | RELAP5/MOD3.3 in Fortran. relap/ is the code itself, envrl/ its environmental library, steam/ the steam tables copied next to the executable at configure time. The files at this level are the coupling layer, built as the r5par library: R5Par.for is the r5par module shared with C++, R5ParFind.for, R5ParChk.for, R5ParIni.f90 and R5ParUpdate.for locate the requested cards and refresh their values every time step, resetini.for resets RELAP5 state between sequences, finteract.for lets C++ change an interactive variable, and getcarg.for supplies the input-deck arguments. restart_membuf.f90 is the in-memory restart buffer (its own library). R5ParPointer.f90 is not compiled |
src/BNCore/ | bncore_core | Bayesian-network inference engine (factors, graph compilation, junction tree, exact inference). The crew model uses it for the human-failure-event network (Crew/HumanFailureEventsBBN) |
src/FaultTree/ | faulttree | Parser for .fta fault-tree files and exact quantification through BNCore's junction tree. It is built and unit tested; adsidac does not link it |
src/HCL/ | hcl, bbncore, bdd, smile, expat, xmlParser, tinydir | Hybrid Causal Logic library and its dependencies. Built only with -DENABLE_HCL=ON; the support-system reliability module links it in that configuration |
src/ADSIDAC/
| Directory | Library | Content |
|---|---|---|
Global/ | global | State and helpers shared by all modules: SimulationContext (g_sim) and SimConfig, SimConstants.h, the r5pars_ interop struct (fmodule.h), RestartNodeInfo (snapshot of the C++ state at a branch point), KeyParameterHistory, ConvertToString, the DET checkpoint file (DETCheckpoint.h), checked file I/O, the configuration fingerprint, the pivotal-event layouts (PEOutput.h), the output merge (OutputMerge.h) and restart trimming (RestartTrim.h) |
Solver/ | solver | Thermal-hydraulic solver abstraction. ThermalHydraulicSolver is the interface, RelapSolver wraps the RELAP5 Fortran entry point, RestApiSolver is the HTTP client of the mock solver, and AdsidacCallback implements the engine's hooks (evaluation point, branching point, restart of a new sequence) |
ParallelExec/ | parallelexec | MPI execution: Server (rank 0: task queue, dispatch, checkpoint gathering, output merge), Client (worker ranks: run sequences, hold and transfer branch data peer to peer), ParallelUtilities (serialized send and receive), ParallelGlobal.h (message tags and the Fortran callbacks) and VisualizationServer (the --viz-port HTTP server). With -DENABLE_MPI=OFF the target is an empty interface library |
Scheduler/ | scheduler | Scheduler (command-line options, ZiniADS.txt, project directories, simulation control parameters), InitiatingEventController, CommandControlCenter and CommunicationPlace (command dispatch and crew communication), and AnalysisInfoContainer (the analysis logs) |
System/ | system | SystemModule (g_sim.Plant) and the classes that map RELAP5 cards to C++ objects: hydraulic volumes and junctions, variable and logical trips, interactive and control variables, heat structures |
ControlPanel/ | controlpanel | The control room panel: displays, alarms and controls, their activation state, and the overlay I/O used by restart snapshots |
Crew/ | crew | The IDAC crew model: OperatorDM, OperatorAT and OperatorCT, the knowledge base (KB*), mental representations (Mental*), decisions (Decision*), communication items, diagnosis (EventSymptomMatrix, Diagnosis*), performance influencing factors (TimeConstrainedModule, InformationLoadModule, SPDS) and the human-failure-event network |
ReasonMachine/ | reasonmachine | The reasoning module used by the crew model for knowledge-based diagnosis: concepts, knowledge units, investigators, mental representation units, routine monitoring and their serialization (RMSerialization.h) |
Procedure/ | procedure | Emergency operating procedures: Procedures, ProcedureStep, the step units and the expectation units a step checks |
Branch/ | branch | The dynamic event tree: BranchRecord (g_sim.Branch_center), BranchCluster, BranchProbability, BranchEndState, and one Branch* class per branch content type (goals, strategies, actions, diagnoses, procedure steps, control values, action times, scanned parameters, system and support-system actions) |
HWReliability/ | hwreliability | Hardware reliability module: component failure units and their fault-tree units |
SupportSystemsReliability/ | supportsystems | Support-system reliability module and its display-state updates. Links hcl and xmlParser when ENABLE_HCL=ON |
CalculationAid/ | calculationaid | Polynomials, timers and probability helpers used by procedures and the crew model |
Notification/ | notification | Completion notifications through ntfy.sh and Discord webhooks |
Library dependencies
adsidac (executable)
├── solver → global, system, controlpanel, branch, crew, scheduler, supportsystems,
│ hwreliability, procedure, calculationaid, reasonmachine
├── parallelexec → MPI, Boost::serialization, LZ4, notification
├── notification
├── global → controlpanel
├── hwreliability → Boost::serialization
├── procedure → Boost::serialization
├── system → Boost::serialization
└── relap (Fortran) → envrl, restart_membuf
└── envrl (Fortran) → r5par (Fortran)
scheduler → calculationaid, controlpanel, supportsystems, reasonmachine, Boost::program_options
controlpanel → Boost::serialization
supportsystems → branch, controlpanel (+ hcl, scheduler, xmlParser with ENABLE_HCL=ON)
branch → crew
crew → reasonmachine, controlpanel, Boost::serialization, bncore_core
calculationaid → reasonmachine
faulttree → bncore_coreThe graph is acyclic. Support-system display states are updated by SupportSystemReliabilityModule::updateSupportSystemDisplayStates(), called from AdsidacCallback, which keeps controlpanel independent of supportsystems.