6#include "../Branch/BranchRecord.h"
7#include <boost/serialization/export.hpp>
8#include "../Global/SimulationContext.h"
9#include <boost/archive/binary_oarchive.hpp>
10#include <boost/archive/binary_iarchive.hpp>
27 string file_name, str;
28 int n_IE, n_IEFT, n_SSIE;
30 file_name +=
"Initiating_Event.txt";
31 ifstream fin(file_name.c_str(), ios::in);
33 cout <<
"File: " << file_name <<
" cound not be found" << endl;
34 ofstream fout(
"err messages.txt", ios::app);
35 fout <<
r5pars_.timesno <<
" File: " << file_name <<
" cound not be found\n";
39 for (
int i = 0; i < n_IE; i++) {
40 auto ie_pt = make_unique<InitiatingEventUnit>();
41 ie_pt->readInfoFromFile(fin);
51 for (
int i = 0; i < n_SSIE; ++i) {
52 auto ssie_pt = make_unique<SupportSystemInitiatingEventUnit>();
53 ssie_pt->readInfoFromFile(fin);
60 bool need_for_check =
false;
61 double probability_of_event;
67 r_value = ie_itr->checkActivationState();
68 if (r_value ==
sim::None) { need_for_check =
true; }
72 ie_itr->Failure_Probability.setProbability(probability_of_event);
79 bsa_pt->
setControlValue(ie_itr->getValueToActOnTheInteractiveControl());
85 r_value = ieft_itr->checkActivationState();
86 if (r_value ==
sim::None) { need_for_check =
true; }
89 probability_of_event = ieft_itr->Failure_Probability.calculateProbability();
90 ieft_itr->Failure_Probability.setProbability(probability_of_event);
97 bsa_pt->
setControlValue(ieft_itr->getProbabilityValueToActOnTheSystemFTNode());
103 r_value = ssie_itr->checkActivationState();
104 if (r_value ==
sim::None) { need_for_check =
true; }
107 probability_of_event = ssie_itr->Failure_Probability.calculateProbability();
108 ssie_itr->Failure_Probability.setProbability(probability_of_event);
114 bssa_pt->
setControlValue(ssie_itr->getProbabilityValueToActOnTheSupportSystemNode());
133 auto ieu_pt = make_unique<InitiatingEventUnit>();
134 ieu_pt->copyInitiatingEventUnit(*src);
138 auto ieftu_pt = make_unique<InitiatingEventFTUnit>();
139 ieftu_pt->copyInitiatingEventFTUnit(*src);
143 auto ssieu_pt = make_unique<SupportSystemInitiatingEventUnit>();
144 ssieu_pt->copySupportSystemInitiatingEventUnit(*src);
152 int i_need_to_check_for_activation;
154 i_need_to_check_for_activation = 1;
156 i_need_to_check_for_activation = 0;
158 fout <<
"InitiatingEventController\n" << i_need_to_check_for_activation <<
' ' <<
initiating_event.size() <<
' '
171 int num1, num2, num3, i_need_to_check_for_activation;
175 if (str !=
"InitiatingEventController") {
176 ofstream fout(
"err messages.txt", ios::app);
177 cout <<
"InfoChunkMental::retrieveInfoChunkMentalFromFile File retrieval error in previous function" << endl;
179 <<
" InfoChunkMental::retrieveInfoChunkMentalFromFile File retrieval error in previous function\n";
187 fin >> i_need_to_check_for_activation >> num1 >> num2 >> num3;
188 if (i_need_to_check_for_activation == 1) {
193 for (
int i = 0; i < num1; i++) {
194 auto initiating_event_pt = make_unique<InitiatingEventUnit>();
195 initiating_event_pt->retrieveInitiatingEventUnitFromFile(fin);
198 for (
int i = 0; i < num2; i++) {
199 auto initiating_event_ft_pt = make_unique<InitiatingEventFTUnit>();
200 initiating_event_ft_pt->retrieveInitiatingEventFTUnitFromFile(fin);
203 for (
int i = 0; i < num3; i++) {
204 auto support_system_initiating_event_pt = make_unique<SupportSystemInitiatingEventUnit>();
205 support_system_initiating_event_pt->retrieveSupportSystemInitiatingEventUnitFromFile(fin);
Initiating event definition, timing, and execution control.
SimulationContext g_sim
Global simulation context: the single instance, defined in SimulationContext.cpp.
void setTempTypeOfConsequence(Consequence)
Stores the consequence of the end state the running sequence will get.
void addSSReliabilityBranch(BranchSupportSystemAction *, BranchSupportSystemAction *)
Registers a support system reliability fork with two alternatives (index 0 first)....
void addHWReliabilityBranch(BranchSystemAction *, BranchSystemAction *)
Registers a hardware reliability fork with two alternatives (index 0 first). The record takes ownersh...
void setTempESMessage(std::string)
Stores the description of the end state the running sequence will get if it is terminated (set by mod...
void setFunctionalState(int)
void setFunctionalState(int)
void setSenderAndReceiver(int, int)
void setControlValue(double)
void setDisplayName(std::string)
void setCorrespondingComponentNameOfControl(std::string)
std::vector< std::unique_ptr< InitiatingEventFTUnit > > initiating_event_ft
InitiatingEventController()
bool getNeedToCheckForActivation()
std::vector< std::unique_ptr< InitiatingEventUnit > > initiating_event
virtual ~InitiatingEventController()
void checkAndExecuteInitiatingEvent()
void InitiationForSimulation()
std::vector< std::unique_ptr< SupportSystemInitiatingEventUnit > > support_system_initiating_event
void saveInitiatingEventControllerToFile(std::ofstream &)
void setNeedToCheckForActivation(bool)
void retrieveInitiatingEventControllerFromFile(std::ifstream &)
void copyInitiatingEventController(InitiatingEventController &)
void clearInitiatingEventController()
bool need_to_check_for_activation
double calculateProbability()
std::string getSystemDirectory()
void setTimerAndProbability(double, double)
bool log
Enable/disable rank-specific logging.
Scheduler SScheduler
Simulation scheduling, parses CLI options.
BranchRecord Branch_center
Dynamic event tree state.