← Documentation
ADS-IDAC Engine 5.0.0
BranchScannedParameter.cpp
Go to the documentation of this file.
1// BranchScannedParameter.cpp: implementation of the BranchScannedParameter class.
2//
4
5#include <sstream>
7#include "../Global/SimulationContext.h"
8#include <boost/serialization/export.hpp>
9#include <boost/archive/binary_oarchive.hpp>
10#include <boost/archive/binary_iarchive.hpp>
11BOOST_CLASS_EXPORT_IMPLEMENT(BranchScannedParameter)
12using namespace std;
13
15// Construction/Destruction
17
19
20}
21
23
24}
25
28 this->copyTimerAndProbability(_bsp);
29 this->copyCommunication(_bsp);
30}
31
33 string str;
34 str = " Add Scanned ";
35 switch (this->getTypeOfScannedParameter()) {
36 case sim::Comm::ParameterValue: str += "Parameter";
37 break;
38
39 case sim::Comm::ComponentState: str += "Component State";
40 break;
41
42 case sim::Comm::SupportSystemState: str += "Support System State";
43 break;
44
45 case sim::Comm::AlarmState: str += "Alarm State";
46 break;
47
48 default:
49 // not a valid scan parameter
50 break;
51 }
52 str += "; Priority: ";
53 str += to_string(this->getScanPriority());
54
55 fout << ' ' << this->getSender() << ' ' << sim::ControlAction::ParameterScan << ' ' << sim::None << ' ' << this->getInfoName() << ' '
56 << this->getProbability() << ' '
57 << this->getTimeOfCommunication() << ' ' << this->getRemainingTime() << ' ' << 0.0 << ' ' << 0 << ' '
58 << '"' << "Intended_Receiver:" << g_sim.Translator.getString(this->getIntendedReceiver()) << ';' << str << '"' << '\n';
59}
60
64 this->saveCommunicationToFile(fout);
65}
66
71}
72
74 string str;
75 str = "AddScannedParameter: Sender: ";
76 str += g_sim.Translator.getString(this->getSender());
77 str += "; Receiver: ";
79 str += "; Parameter: ";
80 str += this->getInfoName();
82 str += " - BYPASSED";
83 }
84 str += "; New Probability: ";
85 std::ostringstream streamObj;
86 streamObj << this->getProbability();
87 str += streamObj.str();
88 return str;
89}
SimulationContext g_sim
Global simulation context: the single instance, defined in SimulationContext.cpp.
void saveInfoToFile(std::ostream &)
void saveBranchScannedParameterToFile(std::ofstream &)
void copyBranchScannedParameter(BranchScannedParameter)
void retrieveBranchScannedParameterFromFile(std::ifstream &)
double getTimeOfCommunication()
void saveCommunicationToFile(std::ofstream &)
int getIntendedReceiver()
void retrieveCommunicationFromFile(std::ifstream &)
void copyCommunication(Communication &)
std::string getString(int) const
void copyDecisionScannedParameter(DecisionScannedParameter)
void saveDecisionScannedParameterToFile(std::ofstream &)
void retrieveDecisionScannedParameterFromFile(std::ifstream &)
std::string getInfoName()
Definition: KBElement.cpp:26
double getProbability()
Definition: Probability.cpp:27
void saveTimerAndProbabilityToFile(std::ofstream &)
void copyTimerAndProbability(TimerAndProbability &)
void retrieveTimerAndProbabilityFromFile(std::ifstream &)
double getRemainingTime()
Definition: Timer.cpp:31
constexpr int SupportSystemState
Definition: SimConstants.h:292
constexpr int ComponentState
Definition: SimConstants.h:285
constexpr int AlarmState
Definition: SimConstants.h:284
constexpr int ParameterValue
Definition: SimConstants.h:286
constexpr int ParameterScan
Definition: SimConstants.h:252
constexpr int Bypass
Definition: SimConstants.h:132
constexpr int None
Definition: SimConstants.h:75
ConvertToString Translator
Parameter name/value conversion.