←
Documentation
ADS-IDAC Engine
5.0.0
EventSchemaUnit.cpp
Go to the documentation of this file.
1
// EventSchemaUnit.cpp: implementation of the EventSchemaUnit class.
2
//
4
5
#include "
EventSchemaUnit.h
"
6
#include "
ReasonMachine.h
"
7
#include "../Procedure/Procedures.h"
8
#include "../Global/SimulationContext.h"
9
using namespace
std;
10
11
13
// Construction/Destruction
15
16
EventSchemaUnit::EventSchemaUnit
()
17
{
18
this->
m_event_KE_pt
= NULL;
19
this->
m_procedure_name
=
"NONE"
;
20
this->
m_procedure_step_name
=
"NONE"
;
21
this->
m_procedure_step_pt
= NULL;
22
this->
m_max_delay
= 1200;
23
}
24
25
EventSchemaUnit::~EventSchemaUnit
()
26
{
27
this->
m_symptom_list
.clear();
28
}
29
30
//DEL string EventSchemaUnit::m_procedure_step()
31
//DEL {
32
//DEL
33
//DEL }
34
35
void
EventSchemaUnit::ConvertESUinfoToString
()
36
{
37
this->
m_ID_KE
= this->
m_event_KE_pt
->
m_ID
;
38
//this->m_procedure_name = this->m_procedure_step_pt->getCurrentProcedureName();
39
//this->m_procedure_step_name = this->m_procedure_step_pt->getCurrentStepName();
40
41
for
(
auto
&
e
: this->
m_symptom_list
)
42
{
43
e
->ConvertESUinfoToStringForm();
44
}
45
}
46
47
void
EventSchemaUnit::CopyESUInfoWithoutPointerFromAnother
(
EventSchemaUnit
* _ESU_pt)
48
{
49
this->
CopyIDElementToRestartInfo
((
IDElement
*)_ESU_pt);
50
this->
m_diagnose_claim_threshold
= _ESU_pt->
m_diagnose_claim_threshold
;
51
this->
m_ID_KE
= _ESU_pt->
m_ID_KE
;
52
this->
m_max_delay
= _ESU_pt->
m_max_delay
;
53
this->
m_operator
= _ESU_pt->
m_operator
;
54
this->
m_procedure_name
= _ESU_pt->
m_procedure_name
;
55
this->
m_procedure_step_name
= _ESU_pt->
m_procedure_step_name
;
56
57
for
(
auto
&
e
: _ESU_pt->
m_symptom_list
)
58
{
59
auto
symptom_pt = std::make_unique<EventSymptomUnit>();
60
symptom_pt->CopyEventSymptomUnitFromAnotherWithoutPointer(
e
.get());
61
this->
m_symptom_list
.push_back(std::move(symptom_pt));
62
}
63
}
64
65
void
EventSchemaUnit::BuildConnectionsForThisESU
(
void
* _pt)
66
{
67
ReasonMachine
* RM_pt;
68
RM_pt = (
ReasonMachine
*)_pt;
69
map<string, ProcedureStep *>::iterator procedure_map_itr;
70
/*
71
ProcedureStep * m_procedure_step_pt;
72
KnowledgeElement * m_event_KE_pt;
73
vector<EventSymptomUnit *> m_symptom_list;
74
75
string m_ID_KE;
76
string m_procedure_step_name;
77
string m_procedure_name;
78
*/
79
if
(this->
m_procedure_name
.compare(
"NONE"
) != 0 && this->
m_procedure_step_name
.compare(
"NONE"
) != 0)
80
{
81
procedure_map_itr =
g_sim
.
All_procedure
.
procedure_map
.find(this->
m_procedure_name
+ this->
m_procedure_step_name
);
82
if
(procedure_map_itr !=
g_sim
.
All_procedure
.
procedure_map
.end())
83
{
84
this->
m_procedure_step_pt
= procedure_map_itr->second;
85
}
86
else
87
{
88
this->
ErrorMessage
(
"Could not find this procedure step: "
+ this->
m_procedure_name
+ this->
m_procedure_step_name
);
89
return
;
90
}
91
}
92
93
if
(this->
m_ID_KE
.compare(
""
) != 0)
94
{
95
this->
m_event_KE_pt
= RM_pt->
FindKnowledgeElementByID
(this->
m_ID_KE
);
96
if
(this->
m_event_KE_pt
== NULL)
97
{this->
ErrorMessage
(
"this->m_event_KE_pt == NULL"
);
return
;}
98
}
99
100
for
(
auto
&
e
: this->
m_symptom_list
)
101
{
e
->BuildConnectionsForThisEventSymptomUnit(_pt);}
102
103
}
104
105
void
EventSchemaUnit::ErrorMessage
(
string
str)
106
{
107
cout <<
r5pars_
.timesno <<
" "
<< str <<
" in EventSchemaUnit"
<<
'\n'
;
108
ofstream fout(
"err messages.txt"
, ios::app);
109
fout <<
r5pars_
.timesno <<
" "
<< str <<
'\n'
;
110
fout.close();
111
}
EventSchemaUnit.h
ReasonMachine.h
Diagnostic reasoning engine — knowledge representation, mental model, and inference.
g_sim
SimulationContext g_sim
Global simulation context: the single instance, defined in SimulationContext.cpp.
Definition:
SimulationContext.cpp:7
e
document e
Definition:
VisualizationServer.cpp:968
EventSchemaUnit
Definition:
EventSchemaUnit.h:20
EventSchemaUnit::EventSchemaUnit
EventSchemaUnit()
Definition:
EventSchemaUnit.cpp:16
EventSchemaUnit::ConvertESUinfoToString
void ConvertESUinfoToString()
Definition:
EventSchemaUnit.cpp:35
EventSchemaUnit::m_symptom_list
std::vector< std::unique_ptr< EventSymptomUnit > > m_symptom_list
Definition:
EventSchemaUnit.h:33
EventSchemaUnit::m_procedure_step_name
std::string m_procedure_step_name
Definition:
EventSchemaUnit.h:36
EventSchemaUnit::m_procedure_step_pt
ProcedureStep * m_procedure_step_pt
Definition:
EventSchemaUnit.h:31
EventSchemaUnit::~EventSchemaUnit
virtual ~EventSchemaUnit()
Definition:
EventSchemaUnit.cpp:25
EventSchemaUnit::m_event_KE_pt
KnowledgeElement * m_event_KE_pt
Definition:
EventSchemaUnit.h:32
EventSchemaUnit::m_operator
int m_operator
Definition:
EventSchemaUnit.h:29
EventSchemaUnit::m_diagnose_claim_threshold
float m_diagnose_claim_threshold
Definition:
EventSchemaUnit.h:27
EventSchemaUnit::CopyESUInfoWithoutPointerFromAnother
void CopyESUInfoWithoutPointerFromAnother(EventSchemaUnit *)
Definition:
EventSchemaUnit.cpp:47
EventSchemaUnit::m_max_delay
float m_max_delay
Definition:
EventSchemaUnit.h:28
EventSchemaUnit::m_procedure_name
std::string m_procedure_name
Definition:
EventSchemaUnit.h:37
EventSchemaUnit::m_ID_KE
std::string m_ID_KE
Definition:
EventSchemaUnit.h:35
EventSchemaUnit::ErrorMessage
void ErrorMessage(std::string)
Definition:
EventSchemaUnit.cpp:105
EventSchemaUnit::BuildConnectionsForThisESU
void BuildConnectionsForThisESU(void *)
Definition:
EventSchemaUnit.cpp:65
IDElement
Definition:
IDElement.h:12
IDElement::CopyIDElementToRestartInfo
void CopyIDElementToRestartInfo(IDElement *)
Definition:
IDElement.cpp:23
IDElement::m_ID
std::string m_ID
Definition:
IDElement.h:16
Procedures::procedure_map
std::map< std::string, ProcedureStep * > procedure_map
Definition:
Procedures.h:72
ReasonMachine
Definition:
ReasonMachine.h:45
ReasonMachine::FindKnowledgeElementByID
KnowledgeElement * FindKnowledgeElementByID(std::string)
Definition:
ReasonMachine.cpp:2931
r5pars_
struct @0 r5pars_
SimulationContext::All_procedure
Procedures All_procedure
Emergency operating procedures.
Definition:
SimulationContext.h:50
src
ADSIDAC
ReasonMachine
EventSchemaUnit.cpp
Generated by
1.9.4