26 std::cout <<
"################################\n";
27 std::cout <<
"# decentralized language-diagnosability (system 1)\n";
28 std::cout <<
"# a) read data \n";
31 plant =
System(
"data/diag_system_4_decentralized1.gen");
32 spec =
System(
"data/diag_specification_4_decentralized1.gen");
35 plant.
Write(
"tmp_diag_system_4_decentralized1.gen");
36 spec.
Write(
"tmp_diag_specification_4_decentralized1.gen");
39 plant.
GraphWrite(
"tmp_demo_system_4_decentralized1.png");
40 spec.
GraphWrite(
"tmp_demo_specification_4_decentralized1.png");
44 alph1 =
new EventSet(
"data/diag_obsAlph_4_decentralized1_1.alph");
45 alph2 =
new EventSet(
"data/diag_obsAlph_4_decentralized1_2.alph");
51 std::cout <<
"# b) run decentralized diagnosability test (expect result FAIL)\n";
56 std::cout <<
"The overall system G is co-diagnosable with respect to overall specification K." << std::endl;
58 std::cout <<
"The overall system G is not co-diagnosable with respect to overall specification K." << std::endl;
64 diagVector.
At(0).
Write(
"tmp_diag_diagnoser_4_decentralized1_1.gen");
65 diagVector.
At(1).
Write(
"tmp_diag_diagnoser_4_decentralized1_2.gen");
67 diagVector.
At(0).
GraphWrite(
"tmp_demo_diagnoser_4_decentralized1_1.png");
68 diagVector.
At(1).
GraphWrite(
"tmp_demo_diagnoser_4_decentralized1_2.png");
78 std::cout <<
"################################\n";
79 std::cout <<
"# decentralized language-diagnosability (system 2)\n";
80 std::cout <<
"# a) read data \n";
83 plant =
System(
"data/diag_system_4_decentralized2.gen");
84 spec =
System(
"data/diag_specification_4_decentralized2.gen");
87 plant.
Write(
"tmp_diag_system_4_decentralized2.gen");
88 spec.
Write(
"tmp_diag_specification_4_decentralized2.gen");
91 plant.
GraphWrite(
"tmp_demo_system_4_decentralized2.png");
92 spec.
GraphWrite(
"tmp_demo_specification_4_decentralized2.png");
96 alph1 =
new EventSet(
"data/diag_obsAlph_4_decentralized2_1.alph");
97 alph2 =
new EventSet(
"data/diag_obsAlph_4_decentralized2_2.alph");
102 std::cout <<
"# b) run decentralized diagnosability test (expect result FAIL)\n";
107 std::cout <<
"The overall system G is co-diagnosable with respect to overall specification K." << std::endl;
108 std::cout << report << std::endl;
110 std::cout <<
"The overall system G is not co-diagnosable with respect to overall specification K." << std::endl;
111 std::cout <<
"The overall system G is not co-diagnosable with respect to overall specification K." << std::endl;
112 std::cout << report << std::endl;
118 diagVector.
At(0).
Write(
"tmp_diag_diagnoser_4_decentralized2_1.gen");
119 diagVector.
At(1).
Write(
"tmp_diag_diagnoser_4_decentralized2_2.gen");
121 diagVector.
At(0).
GraphWrite(
"tmp_demo_diagnoser_4_decentralized2_1.png");
122 diagVector.
At(1).
GraphWrite(
"tmp_demo_diagnoser_4_decentralized2_2.png");
131 std::cout <<
"################################\n";
132 std::cout <<
"# decentralized language-diagnosability (system 3)\n";
133 std::cout <<
"# a) read data \n";
136 plant =
System(
"data/diag_system_2_language.gen");
137 spec =
System(
"data/diag_specification_2_language.gen");
140 plant.
GraphWrite(
"tmp_demo_system_2_language.png");
141 spec.
GraphWrite(
"tmp_demo_specification_2_language.png");
150 alphVector.
Append(alph1 );
151 alphVector.
Append(alph2 );
154 std::cout <<
"# b) run decentralized diagnosability test (expect result FAIL)\n";
159 std::cout <<
"The overall system G is co-diagnosable with respect to overall specification K." << std::endl;
160 std::cout << report << std::endl;
162 std::cout <<
"The overall system G is not co-diagnosable with respect to overall specification K." << std::endl;
163 std::cout << report << std::endl;
175 std::cout <<
"################################\n";
176 std::cout <<
"# decentralized language-diagnosability (system sf/c1)\n";
177 std::cout <<
"# a) read data \n";
181 sf =
System(
"data/diag_system_4_decentralized_sf.gen");
182 c1 =
System(
"data/diag_system_4_decentralized_c1.gen");
185 sf.
Write(
"tmp_diag_system_4_decentralized_sf.gen");
186 c1.
Write(
"tmp_diag_system_4_decentralized_c1.gen");
188 sf.
GraphWrite(
"tmp_demo_system_4_decentralized_sf.png");
189 c1.
GraphWrite(
"tmp_demo_system_4_decentralized_c1.png");
190 sfc1Spec =
Generator(
"data/diag_specification_4_decentralized_sfc1.gen");
195 plant.
GraphWrite(
"tmp_demo_system_4_decentralized_sfc1.png");
196 spec.
GraphWrite(
"tmp_demo_specification_4_decentralized_sfc1.png");
204 alphVector.
Append(alph1 );
205 alphVector.
Append(alph2 );
208 std::cout <<
"# b) run decentralized diagnosability test (expect result PASS)\n";
213 std::cout <<
"The overall system G is co-diagnosable with respect to overall specification K." << std::endl;
214 std::cout << report << std::endl;
216 std::cout <<
"The overall system G is not co-diagnosable with respect to overall specification K." << std::endl;
217 std::cout << report << std::endl;
226 diagVector.
At(0).
Write(
"tmp_diag_diagnoser_4_decentralized_sf.gen");
227 diagVector.
At(1).
Write(
"tmp_diag_diagnoser_4_decentralized_c1.gen");
229 diagVector.
At(0).
GraphWrite(
"tmp_demo_diagnoser_4_decentralized_sf.png");
230 diagVector.
At(1).
GraphWrite(
"tmp_demo_diagnoser_4_decentralized_c1.png");
240 std::cout <<
"################################\n";
241 std::cout <<
"# Abstraction-based decentralized language-diagnosability (system sf/c1)\n";
242 std::cout <<
"# a) read data \n";
247 abstAlph.
Read(
"data/diag_abstAlph_4_decentralized_sf.alph",
"Alphabet");
249 std::cout <<
"The abstraction for SF is a loop-preserving observer" << std::endl;
251 std::cout <<
"The abstraction for SF is not a loop-preserving observer" << std::endl;
253 sfAbst.
Write(
"tmp_diag_system_4_decentralized_sf_abstracted.gen");
254 sfAbst.
GraphWrite(
"tmp_demo_system_4_decentralized_sf_abstracted.png");
255 abstAlph.
Read(
"data/diag_abstAlph_4_decentralized_c1.alph",
"Alphabet");
257 std::cout <<
"The abstraction for C1 is a loop-preserving observer" << std::endl;
259 std::cout <<
"The abstraction for C1 is not a loop-preserving observer" << std::endl;
262 c1Abst.
Write(
"tmp_diag_system_4_decentralized_c1_abstracted.gen");
263 c1Abst.
GraphWrite(
"tmp_demo_system_4_decentralized_c1_abstracted.png");
264 sfc1Spec =
Generator(
"data/diag_specification_4_decentralized_sfc1.gen");
269 plant.
GraphWrite(
"tmp_demo_system_4_decentralized_sfc1_abstracted.png");
270 spec.
GraphWrite(
"tmp_demo_specification_4_decentralized_sfc1_abstract.png");
280 std::cout <<
"# b) run decentralized diagnosability test (expect result PASS)\n";
285 std::cout <<
"The overall system G is co-diagnosable with respect to overall specification K." << std::endl;
286 std::cout << report << std::endl;
288 std::cout <<
"The overall system G is not co-diagnosable with respect to overall specification K." << std::endl;
289 std::cout << report << std::endl;
#define FAUDES_TEST_DUMP(mes, dat)
Test protocol record macro ("mangle" filename for platform independance)
Set of indices with symbolic names.
bool Insert(const Idx &rIndex)
Add an element by index.
virtual const T & At(const Position &pos) const
Access element.
const TaEventSet< EventAttr > & Alphabet(void) const
Return const reference to alphabet.
Generator with controllability attributes.
EventSet ObservableEvents(void) const
Get EventSet with observable events.
void Read(const std::string &rFileName, const std::string &rLabel="", const Type *pContext=0)
Read configuration data from file with label specified.
void Write(const Type *pContext=0) const
Write configuration data to console.
virtual void Append(const Type &rElem)
Append specified entry.
virtual void Clear(void)
Clear all vector.
void GraphWrite(const std::string &rFileName, const std::string &rOutFormat="", const std::string &rDotExec="dot") const
Produce graphical representation of this generator.
NameSet EventSet
Convenience typedef for plain event sets.
void DecentralizedModularDiagnoser(const std::vector< const System * > &rGens, const Generator &rSpec, std::vector< Diagnoser * > &rDiags, std::string &rReportString)
Function that computes decentralized diagnosers for the respective subsystems of a composed (modular)...
bool IsLoopPreservingObserver(const System &rGen, const EventSet &rHighAlph)
Verifies a loop-preserving observer.
bool DecentralizedDiagnoser(const System &rGen, const Generator &rSpec, const std::vector< const EventSet * > &rAlphabets, std::vector< Diagnoser * > &rDiags, std::string &rReportString)
Computes decentralized diagnosers for multiple local sites.
vGenerator Generator
Plain generator, api typedef for generator with no attributes.
TcGenerator< AttributeVoid, AttributeVoid, AttributeCFlags, AttributeVoid > System
Convenience typedef for std System.
void aParallel(const Generator &rGen1, const Generator &rGen2, Generator &rResGen)
Parallel composition.
void aProject(const Generator &rGen, const EventSet &rProjectAlphabet, Generator &rResGen)
Deterministic projection.
Includes all libFAUDES headers, incl plugings
libFAUDES resides within the namespace faudes.
bool IsCoDiagnosable(const System &rGen, const Generator &rSpec, const vector< const EventSet * > &rAlphabets, std::string &rReportString)