diag_decentralizeddiagnosis.h
Go to the documentation of this file.
1/** @file diag_decentralizeddiagnosis.h
2Functions to check a system's decentralized diagnosability.
3*/
4
5#ifndef DIAG_DECENTRALIZEDDIAGNOSIS_H
6#define DIAG_DECENTRALIZEDDIAGNOSIS_H
7
8#include <vector>
9#include "corefaudes.h"
10#include "op_include.h"
11#include "diag_generator.h"
13#include "diag_attrdiagstate.h"
16#include "diag_attrlabelset.h"
17
18#include "diag_debug.h"
19
20namespace faudes {
21
22//////////////////////////////////////////////////////////////////////////////////
23// Verifier State for Co-diagnosability
24/////////////////////////////////////////////////////////////////////////////////
25
27 std::vector<Idx> mSpec1State;
31
32
33 CoVerifierState(Idx number = 0, Idx state2 = 0, Idx state3 = 0, VerifierStateLabel label = NORMAL){ mSpec1State = std::vector<Idx>(number); mSpec2State = state2; mPlantState = state3; mLabel = label; }
35
36 bool operator< (const CoVerifierState& rOther) const{
37 for(Idx i = 0; i < mSpec1State.size(); i++){
38 if(mSpec1State.at(i) < rOther.mSpec1State.at(i) )
39 return true;
40 else if(mSpec1State.at(i) > rOther.mSpec1State.at(i) )
41 return false;
42 }
43 if(mSpec2State < rOther.mSpec2State)
44 return true;
45 else if(mSpec2State > rOther.mSpec2State)
46 return false;
47 if(mPlantState < rOther.mPlantState)
48 return true;
49 else
50 return false;
51 }
52};
53
54
55///////////////////////////////////////////////////////////////////////////////
56// Functions for decentralized diagnosability
57///////////////////////////////////////////////////////////////////////////////
58
59/** @name Functions (decentralized diagnosability) */
60/** @{ doxygen group */
61
62
63/**
64Checks co-diagnosability for a system G with respect to the specification K and the local observation alphabets rAlphabets.
65@param rGen
66 Plant automaton.
67@param rSpec
68 Specification automaton.
69@param rAlphabets
70 Local observation alphabets (for decentralized diagnosis)
71@param rReportString
72 User-readable information of violating condition (in case of negative test result).
73@return
74 True if system G is co-diagnosable.
75@ingroup DiagnosisPlugIn
76*/
77extern FAUDES_API bool IsCoDiagnosable(const System& rGen, const Generator& rSpec, const std::vector<const EventSet*>& rAlphabets, std::string& rReportString);
78
79/** @} doxygen group */
80
81
82
83/**
84Computes decentralized diagnosers for multiple local sites.
85@param rGen
86 Plant automaton.
87@param rSpec
88 Specification automaton.
89@param rAlphabets
90 Observable events of the local sites.
91@param rDiags
92 Decentralized diagnosers
93@param rReportString
94 User-readable information of violating condition (in case of negative test result).
95@exception Exception
96 - Number of alphabets does not equal number of local sites (id 305).
97@return
98 True if system G is co-diagnosable.
99 The result is allocated on the heap, ownership is with the calling function.
100@ingroup DiagnosisPlugIn
101*/
102extern FAUDES_API bool DecentralizedDiagnoser(const System& rGen, const Generator& rSpec, const std::vector<const EventSet*>& rAlphabets, std::vector<Diagnoser*>& rDiags, std::string& rReportString);
103
104/** @name Functions (modular diagnoser computation) */
105/** @{ doxygen group */
106
107/** Function that computes decentralized diagnosers for the respective subsystems of a composed (modular) system
108 * @param rGens
109 * Local subsystem automata
110@param rSpec
111 Specification automaton.
112@param rDiags
113 Decentralized diagnosers
114@param rReportString
115 User-readable information of violating condition (in case of negative test result).
116@exception Exception
117 - Number of modular components does not equal number of decentralized diagnosers (id 306).
118 @ingroup DiagnosisPlugIn
119 */
120extern FAUDES_API void DecentralizedModularDiagnoser(const std::vector<const System*>& rGens, const Generator& rSpec, std::vector<Diagnoser*>& rDiags, std::string& rReportString);
121
122/** @} doxygen group */
123
124/**
125 * Function definition for run-time interface
126 */
127extern FAUDES_API bool IsCoDiagnosable(const System& rGen, const Generator& rSpec, const EventSetVector& rAlphabets);
128
129/**
130 * Function definition for run-time interface
131 */
132extern FAUDES_API bool DecentralizedDiagnoser(const System& rGen, const Generator& rSpec, const EventSetVector& rAlphabets, GeneratorVector& rDiags);
133
134/**
135 * Function definition for run-time interface
136 */
137extern FAUDES_API void DecentralizedModularDiagnoser(const SystemVector& rGens, const Generator& rSpec, GeneratorVector& rDiags);
138
139
140///////////////////////////////////////////////////////////////////////////////
141// Further Auxiliary Functions
142///////////////////////////////////////////////////////////////////////////////
143
144/**
145Parallel composition of multiple generators.
146@param rGens
147 STL-vector of generators.
148@param rResGen
149 Output variable for the resulting product generator.
150*/
151void cParallel(const std::vector<const System*>& rGens, System& rResGen);
152
153
154} // namespace faudes
155
156#endif
#define FAUDES_API
void DecentralizedModularDiagnoser(const std::vector< const System * > &rGens, const Generator &rSpec, std::vector< Diagnoser * > &rDiags, std::string &rReportString)
bool DecentralizedDiagnoser(const System &rGen, const Generator &rSpec, const std::vector< const EventSet * > &rAlphabets, std::vector< Diagnoser * > &rDiags, std::string &rReportString)
uint32_t Idx
bool IsCoDiagnosable(const System &rGen, const Generator &rSpec, const vector< const EventSet * > &rAlphabets, std::string &rReportString)
void cParallel(const std::vector< const System * > &rGens, System &rResGen)
CoVerifierState(const CoVerifierState &rOther)
bool operator<(const CoVerifierState &rOther) const
CoVerifierState(Idx number=0, Idx state2=0, Idx state3=0, VerifierStateLabel label=NORMAL)

libFAUDES 2.33k --- 2025.09.16 --- c++ api documentaion by doxygen