packages/engine/scram-node/src/risk_analysis.h
Contains the main system for performing analysis.
Namespaces
| Name |
|---|
| scram |
| scram::core |
Classes
| Name | |
|---|---|
| class | scram::core::RiskAnalysis <br>Main system that performs analyses. |
| struct | scram::core::RiskAnalysis::Context <br>Provides the optional context of the analysis. |
| struct | scram::core::RiskAnalysis::Result <br>The analysis results binding to the unique analysis target. |
| struct | scram::core::RiskAnalysis::Result::Id <br>The analysis target type as a unique identifier. |
| struct | scram::core::RiskAnalysis::EtaResult <br>The analysis results grouped by an event-tree. |
Source code
cpp
/*
* Copyright (C) 2014-2018 Olzhas Rakhimov
* Copyright (C) 2023 OpenPRA ORG Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <memory>
#include <optional>
#include <utility>
#include <variant>
#include <vector>
#include "alignment.h"
#include "analysis.h"
#include "event.h"
#include "event_tree_analysis.h"
#include "fault_tree_analysis.h"
#include "importance_analysis.h"
#include "model.h"
#include "probability_analysis.h"
#include "settings.h"
#include "uncertainty_analysis.h"
namespace scram::core {
class RiskAnalysis : public Analysis {
public:
struct Context {
const mef::Alignment& alignment;
const mef::Phase& phase;
};
struct Result {
struct Id {
std::variant<const mef::Gate*, std::pair<const mef::InitiatingEvent&,
const mef::Sequence&>>
target;
std::optional<Context> context;
};
const Id id;
std::unique_ptr<const FaultTreeAnalysis> fault_tree_analysis;
std::unique_ptr<const ProbabilityAnalysis> probability_analysis;
std::unique_ptr<const ImportanceAnalysis> importance_analysis;
std::unique_ptr<const UncertaintyAnalysis> uncertainty_analysis;
};
struct EtaResult {
const mef::InitiatingEvent& initiating_event;
std::optional<Context> context;
std::unique_ptr<const EventTreeAnalysis> event_tree_analysis;
};
RiskAnalysis(mef::Model* model, const Settings& settings);
const mef::Model& model() const { return *model_; }
void Analyze() noexcept;
const std::vector<Result>& results() const { return results_; }
const std::vector<EtaResult>& event_tree_results() const {
return event_tree_results_;
}
private:
void RunAnalysis(std::optional<Context> context = {}) noexcept;
void RunAnalysis(const mef::Gate& target, Result* result) noexcept;
template <class Algorithm>
void RunAnalysis(const mef::Gate& target, Result* result) noexcept;
template <class Algorithm, class Calculator>
void RunAnalysis(FaultTreeAnalyzer<Algorithm>* fta, Result* result) noexcept;
mef::Model* model_;
std::vector<Result> results_;
std::vector<EtaResult> event_tree_results_;
};
} // namespace scram::coreUpdated on 2025-11-11 at 16:51:09 +0000
