6#include "../ControlPanel/ControlPanel.h"
7#include "../Procedure/ProcedureExpectedSupportSystemStateUnit.h"
8#include "../Global/SimulationContext.h"
80 fin >> str >> num_prereqs;
81 for (i_temp = 0; i_temp < num_prereqs; i_temp++) {
82 auto exp_or_upt = make_unique<ExpectationORUnit>();
83 exp_or_pt = exp_or_upt.get();
95 exp_or_pt->
add(exp_pt);
103 exp_or_pt->
add(exp_pt);
111 exp_or_pt->
add(exp_pt);
119 exp_or_pt->
add(exp_pt);
126 exp_or_pt->
add(exp_pt);
133 exp_or_pt->
add(exp_pt);
135 ofstream fout(
"err messages.txt", ios::app);
136 cout <<
"ProcedureStepUnit::readInfofromFile: expectation body obj_type:" << obj_type <<
" cannot be recognized"
138 fout <<
r5pars_.timesno <<
" ProcedureStepUnit::readInfofromFile: expectation body obj_type:" << obj_type
139 <<
" cannot be recognized\n";
154 map<string, SystemAlarm *>::iterator alarm_map_itr;
155 map<string, SystemDisplay *>::iterator display_map_itr;
156 map<string, SystemControl *>::iterator control_map_itr;
166 sd_pt = display_map_itr->second;
176 ofstream fout(
"err messages.txt", ios::app);
177 cout <<
"ProcedureStepUnit::checkForTypeOfExpectation obj: " << _prereq_name <<
" Type of display:" <<
static_cast<int>(n_temp)
178 <<
" cannot be recognized" << endl;
179 fout <<
r5pars_.timesno <<
" DiagnosisComponentActionUnit::checkForTypeOfPrerequisite obj: " << _prereq_name
180 <<
" Type of display:" <<
static_cast<int>(n_temp) <<
" cannot be recognized\n";
188 if (_prereq_name ==
"Mental_Belief") {
190 }
else if (_prereq_name ==
"Parameter_Difference") {
193 ofstream fout(
"err messages.txt", ios::app);
194 cout <<
"DiagnosisComponentActionUnit::checkForTypeOfExpectation: Obj_name: " << _prereq_name
195 <<
" cannot be recognized" << endl;
196 fout <<
r5pars_.timesno <<
" DiagnosisComponentActionUnit::checkForTypeOfPrerequisite: Obj_name: " << _prereq_name
197 <<
" cannot be recognized\n";
207 bool found_prereq =
false;
208 bool branch_generated =
false;
209 int state_of_activation;
212 state_of_activation = (*expectationOR_itr)->getStateOfActivation();
216 branch_generated = (*expectationOR_itr)->assessExpectation(_operator, _stm, _entry);
217 if (branch_generated) {
218 return branch_generated;
222 branch_generated = (*expectationOR_itr)->assessExpectation(_operator, _stm, _entry);
223 if (branch_generated) {
224 return branch_generated;
236 return branch_generated;
243 for (
auto& exp_or : prereq->expectation_OR) {
244 exp_or->setStateOfExpectation(
sim::None);
260 auto prereq_pt = make_unique<ExpectationORUnit>();
261 prereq_pt->copyExpectationORUnit(*src);
276 fout << num_prereq <<
'\n';
278 prereq->saveExpectationORUnitToFile(fout);
291 for (i = 0; i < num_prereq; i++) {
292 auto prereq_ptr = make_unique<ExpectationORUnit>();
293 prereq_ptr->retrieveExpectationORUnitFromFile(fin);
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...
std::map< std::string, SystemAlarm * > alarm_map
std::map< std::string, SystemDisplay * > display_map
ControlPanelDisplay indicators
void setControlInput(double)
DiagnosisComponentActionUnit()
int getPrerequisiteState()
void readDiagnosisComponentActionUnitInfoFromFile(std::ifstream &)
void readDiagnosisComponentPrerequisiteFromFile(std::ifstream &)
void setPrerequisiteState(int)
std::vector< std::unique_ptr< ExpectationORUnit > > action_prerequisites
void clearDiagnosisComponentActionUnit()
void resetComponentActionUnit()
void retrieveDiagnosisComponentActionUnitFromFile(std::ifstream &)
std::string getControlParameterName()
virtual ~DiagnosisComponentActionUnit()
int checkForTypeOfPrerequisite(std::string)
void setLowerLimit(double)
std::string control_parameter_name
void copyDiagnosisComponentActionUnit(DiagnosisComponentActionUnit &)
void setControlParameterName(std::string)
bool assessPrerequisites(Operator &, ShortTermMemory &, int)
void setUpperLimit(double)
void saveDiagnosisComponentActionUnitToFile(std::ofstream &)
void setTypeOfExpectation(int)
void add(ExpectationElement *)
void readInfoFromFile(std::ifstream &)
void readInfoFromFile(std::ifstream &)
void setInfoName(std::string)
void retrieveKBElementFromFile(std::ifstream &)
void saveKBElementToFile(std::ofstream &)
void copyKBElement(KBElement &)
void readInfoFromFileWithoutInfoName(std::ifstream &)
void readInfoFromFileWithoutInfoName(std::ifstream &)
void readInfoFromFile(std::ifstream &)
void readInfoFromFileWithoutInfoName(std::ifstream &)
void readInfoFromFileWithoutInfoName(std::ifstream &)
DisplayType getTypeOfDisplay()
constexpr int MentalBelief
constexpr int ParameterDifference
constexpr int ParameterTrend
constexpr int SupportSystemState
constexpr int ComponentState
constexpr int ParameterValue
constexpr int ParameterControl
ControlPanel Indicator
Control room panel state.
BranchRecord Branch_center
Dynamic event tree state.