← Documentation
ADS-IDAC Engine 5.0.0
DisplayComponentState.cpp
Go to the documentation of this file.
1// DisplayComponentState.cpp: implementation of the DisplayComponentState class.
2//
4
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>
11BOOST_CLASS_EXPORT_IMPLEMENT(DisplayComponentState)
12using namespace std;
13
15// Construction/Destruction
20 // Deterministic defaults, overwritten by readInfoFromFile for well-formed
21 // inputs.
26}
27
29
30}
32 string str, str1;
35
36 if (str == "ON") {
39 } else if (str == "OFF") {
42 } else if (str == "OPEN") {
45 } else if (str == "CLOSE") {
48 } else if (str == "TRIP") {
51 } else {}
52
53 if (str1 == "GREATER_THEN_ON") {
55 } else if (str1 == "SMALLER_THEN_ON") {
57 } else if (str1 == "GREATER_THEN_OPEN" || str1 == "GREATER_THAN_OPEN") {
59 } else if (str1 == "SMALLER_THEN_OPEN") {
61 } else if (str1 == "GREATER_THEN_OFF") {
63 } else if (str1 == "SMALLER_THEN_OFF") {
65 } else if (str1 == "GREATER_THEN_CLOSE") {
67 } else if (str1 == "SMALLER_THEN_CLOSE") {
69 } else {
70 cout << "DisplayComponentState::readInfoFromFile: the relational operator "
72 << this->getDisplayName() << " is not allowed" << endl;
73 ofstream fout("err messages.txt", ios::app);
74 fout << r5pars_.timesno << " DisplayComponentState::readInfoFromFile: the relational operator "
76 << this->getDisplayName() << " is not allowed\n";
77 fout.close();
78 r5pars_.sim_err = true;
79 g_sim.Branch_center.setTempESMessage("DisplayComponentState::updateDisplayedComponentOperationalState err.");
81 }
82}
86}
90 double system_value;
92 system_value = this->getCorrespondingSystemParameterValue();
93 if (system_value < 0.0) {
94 // relap trip channel is false, system value is set to -1.0
98 break;
101 break;
104 break;
107 break;
109 cout << "DisplayComponentState::updateDisplayedComponentOperationalState: the relational operator "
111 << this->getDisplayName() << " is not allowed" << endl;
112 ofstream fout("err messages.txt", ios::app);
113 fout << r5pars_.timesno
114 << " DisplayComponentState::updateDisplayedComponentOperationalState: the relational operator "
116 << this->getDisplayName() << " is not allowed\n";
117 fout.close();
118 r5pars_.sim_err = true;
119 g_sim.Branch_center.setTempESMessage("DisplayComponentState::updateDisplayedComponentOperationalState err.");
121 break;
122 };
123 } else {
124 // RELAP trip channel is true, system_value is last time trip set to true
128 if (r5pars_.timesno - system_value >= threshold_value_to_change_the_component_state) {
129 // if (system_value >= threshold_value_to_change_the_component_state){
131 } else {
133 }
134 break;
137 if (r5pars_.timesno - system_value < threshold_value_to_change_the_component_state) {
139 } else {
141 }
142 break;
145 if (r5pars_.timesno - system_value >= threshold_value_to_change_the_component_state) {
147 } else {
149 }
150 break;
153 if (r5pars_.timesno - system_value < threshold_value_to_change_the_component_state) {
155 } else {
157 }
158 break;
160 cout << "DisplayComponentState::updateDisplayedComponentOperationalState: the relational operator "
162 << this->getDisplayName() << " is not allowed" << endl;
163 ofstream fout("err messages.txt", ios::app);
164 fout << r5pars_.timesno
165 << " DisplayComponentState::updateDisplayedComponentOperationalState: the relational operator "
167 << this->getDisplayName() << " is not allowed\n";
168 fout.close();
169 r5pars_.sim_err = true;
170 g_sim.Branch_center.setTempESMessage("DisplayComponentState::updateDisplayedComponentOperationalState err.");
172 break;
173 };
174 }
175 } else {
177 }
178}
181}
184}
192 this->copySystemDisplay(_dcs);
193}
195 this->saveSystemDisplayToFile(fout);
198 << '\n';
199}
204}
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 setTempESMessage(std::string)
Stores the description of the end state the running sequence will get if it is terminated (set by mod...
void copyDisplayComponentState(DisplayComponentState &)
double threshold_value_to_change_the_component_state
void setDisplayedComponentOperationalStateWhenFail(int)
void setRelationOperatorToChangeTheComponentState(int)
double getThresholdValueToChangeTheComponentState()
void readInfoFromFile(std::ifstream &)
void saveDisplayComponentStateToFile(std::ofstream &)
void setThresholdValueToChangeTheComponentState(double)
void retrieveDisplayComponentStateFromFile(std::ifstream &)
void setDisplayedComponentOperationalState(int)
std::string getDisplayName()
void setCorrespondingSystemParameterUnit(std::string)
double getCorrespondingSystemParameterValue()
void setTypeOfDisplay(DisplayType type)
int getFunctionalState()
void readInfoFromFile(std::ifstream &)
void saveSystemDisplayToFile(std::ofstream &)
void retrieveSystemDisplayFromFile(std::ifstream &)
void copySystemDisplay(SystemDisplay &)
struct @0 r5pars_
constexpr int GreaterThenClose
Definition: SimConstants.h:249
constexpr int GreaterThenOn
Definition: SimConstants.h:243
constexpr int GreaterThenOpen
Definition: SimConstants.h:245
constexpr int SmallerThenOn
Definition: SimConstants.h:244
constexpr int Trip
Definition: SimConstants.h:238
constexpr int GreaterThenOff
Definition: SimConstants.h:247
constexpr int SmallerThenOpen
Definition: SimConstants.h:246
constexpr int SmallerThenOff
Definition: SimConstants.h:248
constexpr int SmallerThenClose
Definition: SimConstants.h:250
constexpr int On
Definition: SimConstants.h:105
constexpr int Off
Definition: SimConstants.h:106
constexpr int Succeed
Definition: SimConstants.h:104
constexpr int Open
Definition: SimConstants.h:116
constexpr int Close
Definition: SimConstants.h:117
constexpr int None
Definition: SimConstants.h:75
BranchRecord Branch_center
Dynamic event tree state.