← Documentation
ADS-IDAC Engine 5.0.0
BranchSystemAction.cpp
Go to the documentation of this file.
1// BranchSystemAction.cpp: implementation of the BranchSystemAction class.
2//
4
5#include <sstream>
7#include "../Global/ConvertToString.h"
8#include <boost/serialization/export.hpp>
9#include "../Global/SimulationContext.h"
10#include <boost/archive/binary_oarchive.hpp>
11#include <boost/archive/binary_iarchive.hpp>
12BOOST_CLASS_EXPORT_IMPLEMENT(BranchSystemAction)
13using namespace std;
14
15
17// Construction/Destruction
19
22}
23
25
26}
28 this->copyControlElement(_bsp);
29 this->copyCommunication(_bsp);
30 this->copyTimerAndProbability(_bsp);
32}
34 string str;
35 str = "HWReliability: Sender: ";
36 str += g_sim.Translator.getString(this->getSender());
37 str += "; Receiver: ";
39 str += "; Component: ";
40 str += this->getDisplayName();
42 str += "; Status: Success";
44 str += "; Status: Fail";
46 str += "; Status: Maneuver Action";
47 } else {
48 }
49 str += "; Control: ";
51 str += "; Probability: ";
52 std::ostringstream streamObj;
53 streamObj << this->getProbability();
54 str += streamObj.str();
55 return str;
56}
58 fout << ' ' << this->getSender() << ' ' << sim::Action::Direct << ' ' << sim::None << ' ' << this->getDisplayName() << ' '
59 << this->getProbability() << ' '
61 << this->getControlValue() << " 0 ";
63 fout << '"' << "Failed!_Intended_Receiver:" << g_sim.Translator.getString(this->getIntendedReceiver()) << '"' << '\n';
64 } else {
65 fout << '"' << "Success!_Intended_Receiver:" << g_sim.Translator.getString(this->getIntendedReceiver()) << '"' << '\n';
66 }
67}
71 fout << functional_state << '\n';
72 this->saveControlElementToFile(fout);
73 this->saveCommunicationToFile(fout);
75}
77 fin >> functional_state;
81}
SimulationContext g_sim
Global simulation context: the single instance, defined in SimulationContext.cpp.
void saveBranchSystemActionToFile(std::ofstream &)
std::string translateMessage()
void saveInfoToFile(std::ostream &)
void retrieveBranchSystemActionFromFile(std::ifstream &)
void copyBranchSystemAction(BranchSystemAction &)
double getTimeOfCommunication()
void saveCommunicationToFile(std::ofstream &)
int getIntendedReceiver()
void retrieveCommunicationFromFile(std::ifstream &)
void copyCommunication(Communication &)
std::string getDisplayName()
void saveControlElementToFile(std::ofstream &)
void retrieveControlElementFromFile(std::ifstream &)
std::string getCorrespondingComponentNameOfControl()
double getControlValue()
double getAdjustedTimeRequiredToPerformTheAction()
void copyControlElement(ControlElement &)
std::string getString(int) const
double getProbability()
Definition: Probability.cpp:27
void saveTimerAndProbabilityToFile(std::ofstream &)
void copyTimerAndProbability(TimerAndProbability &)
void retrieveTimerAndProbabilityFromFile(std::ifstream &)
constexpr int Direct
Definition: SimConstants.h:202
constexpr int Failed
Definition: SimConstants.h:103
constexpr int Succeed
Definition: SimConstants.h:104
constexpr int Control
Definition: SimConstants.h:111
constexpr int Unknown
Definition: SimConstants.h:120
constexpr int None
Definition: SimConstants.h:75
ConvertToString Translator
Parameter name/value conversion.