← Documentation
ADS-IDAC Engine 5.0.0
BranchExpectedParameterTrend.cpp
Go to the documentation of this file.
1// BranchExpectedParameterTrend.cpp: implementation of the BranchExpectedParameterTrend 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(BranchExpectedParameterTrend)
13using namespace std;
14
15
17// Construction/Destruction
19
21
22}
23
25
26}
31}
33// fout << ' ' << this->getSender() << ' ' << sim::Action::SendInfo << ' ' << sim::None << ' ' << this->getDisplayName() << ' ' << this->getProbability() << ' '
34// << this->getTimeOfCommunication() << ' ' << this->getRemainingTime() << ' ' << this->getObservedParameterRateOfChange() << " 0 "
35// << '"' << "Intended_Receiver:" << Translator.getString(this->getIntendedReceiver()) << '"' << '\n';
36
37 // char ch1[50], ch2[50], ch3[50];
38 double v1, v2, v3;
39 string str;
40 str += "Status:";
42 str += ";_Exp_State:";
45 v1 = this->getExpectedValue1();
46 // _gcvt(v1, 12, ch1);
47 str += to_string(v1);
48 } else {
49 v1 = this->getExpectedValue1();
50 v2 = this->getExpectedValue2();
51 // _gcvt(v1, 12, ch1);
52 // _gcvt(v2, 12, ch2);
53 str += '_';
54 str += to_string(v1);
55 str += "_and_";
56 str += to_string(v2);
57 }
58 str += ";_Observed_value:";
60 // _gcvt(v3, 12, ch3);
61 str += to_string(v3);
63 str += ";_Use_of_memorized_info";
64 }
65 fout << ' ' << this->getSender() << ' ' << sim::Action::SendInfo << ' ' << sim::None << ' ' << this->getDisplayName() << ' '
66 << this->getProbability() << ' '
67 << this->getTimeOfCommunication() << ' ' << this->getRemainingTime() << ' '
68 << this->getObservedParameterRateOfChange() << " 0 "
69 << '"' << "Intended_Receiver:" << g_sim.Translator.getString(this->getIntendedReceiver()) << ';' << str << '"' << '\n';
70}
72 string str;
73 std::ostringstream streamObj;
74 str = "Parameter_Trend: Sender: ";
75 str += g_sim.Translator.getString(this->getSender());
76 str += "; Receiver: ";
78 str += "; Parameter_Trend: ";
79 str += this->getDisplayName();
80 str += "; Status: ";
82 str += "; Exp State: ";
84 str += ' ';
86 streamObj << this->getExpectedValue1();
87 str += streamObj.str();
88 } else {
89 streamObj << this->getExpectedValue1();
90 str += streamObj.str();
91 streamObj.str("");
92 str += " and ";
93 streamObj << this->getExpectedValue2();
94 str += streamObj.str();
95 streamObj.str("");
96 }
97 str += "; Observed value: ";
98 streamObj << this->getObservedParameterRateOfChange();
99 str += streamObj.str();
100 streamObj.str("");
102 str += "; Use of memorized info";
103 }
104 str += "; New Probability: ";
105 streamObj << this->getProbability();
106 str += streamObj.str();
107 return str;
108}
112 this->saveCommunicationToFile(fout);
113}
118}
SimulationContext g_sim
Global simulation context: the single instance, defined in SimulationContext.cpp.
void retrieveBranchExpectedParameterTrendFromFile(std::ifstream &)
void copyBranchExpectedParameterTrend(BranchExpectedParameterTrend &)
void saveBranchExpectedParameterTrendToFile(std::ofstream &)
double getTimeOfCommunication()
void saveCommunicationToFile(std::ofstream &)
int getIntendedReceiver()
void retrieveCommunicationFromFile(std::ifstream &)
void copyCommunication(Communication &)
std::string getString(int) const
void saveDecisionExpectedParameterTrendToFile(std::ofstream &)
void retrieveDecisionExpectedParameterTrendFromFile(std::ifstream &)
void copyDecisionExpectedParameterTrend(DecisionExpectedParameterTrend &)
std::string getDisplayName()
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 SendInfo
Definition: SimConstants.h:204
constexpr int Between
Definition: SimConstants.h:92
constexpr int OldInfo
Definition: SimConstants.h:126
constexpr int None
Definition: SimConstants.h:75
ConvertToString Translator
Parameter name/value conversion.