diag_languagediagnosis.h
Go to the documentation of this file.
1/** @file diag_languagediagnosis.h
2Functions to check a system's diagnosability with respect to a specification automaton and compute a language-diagnoser.
3*/
4
5#ifndef DIAG_LANGUAGEDIAGNOSIS_H
6#define DIAG_LANGUAGEDIAGNOSIS_H
7
8#include <vector>
9#include "corefaudes.h"
10#include "diag_generator.h"
11#include "diag_eventdiagnosis.h"
12#include "op_obserververification.h"
13
14#include "diag_debug.h"
15
16namespace faudes {
17
18///////////////////////////////////////////////////////////////////////////////
19// Functions for specification framework
20///////////////////////////////////////////////////////////////////////////////
21/** @name Functions (diagnosability with respect to a specification) */
22/** @{ doxygen group */
23
24/**
25Tests a system's diagnosability with respect to a given specification.
26@param rGen
27 Input generator.
28@param rSpec
29 Specification automaton.
30@param rReportString
31 User-readable information of violating condition (in case of negative test result).
32@return
33 True if input generator is diagnosable.
34@ingroup DiagnosisPlugIn
35*/
36extern FAUDES_API bool IsLanguageDiagnosableX(const System& rGen, const System& rSpec, std::string& rReportString);
37
38/** @} doxygen group */
39
40/**
41Compute G_o for a generator that marks the faulty behaviour of a plant.
42Every specification violation will be labelled with label "F".
43@param rGenMarkedNonSpecBehaviour
44 Input generator that specifies specification violations by marked states.
45@param rGobs
46 Output variable for G_o.
47*/
48extern FAUDES_API void ComputeGobs(const System& rGenMarkedNonSpecBehaviour, Diagnoser& rGobs);
49
50/**
51Compute the reachability from a state of a generator that marks its faulty behaviour.
52States are said to be reachable if they can be reached through a trace that consists
53of arbitrarily many unobservable events followed by one observable event.
54@param rGen
55 Input generator.
56@param rUnobsEvents
57 Unobservable events in the generators alphabet.
58@param State
59 A state of the generators state set.
60@param rReachabilityMap
61 Output variable for the reachability. Maps occurring observable events to the reachable generator states and a label that contains information about specification violations.
62*/
63extern FAUDES_API void ComputeReachability(const System& rGen, const EventSet& rUnobsEvents, Idx State,
64 std::map<Idx,std::multimap<Idx,DiagLabelSet> >& rReachabilityMap);
65
66/**
67Auxiliary function for ComputeReachability(const System&, const EventSet&, Idx State, std::map<Idx,std::multimap< Idx,DiagLabelSet> >&). Is recursively called for every occurring state on the trace (that consists of arbitrarily many unobservable events followed by one observable event).
68@param rGen
69 Input generator.
70@param rUnobsEvents
71 Unobservable events in the generators alphabet.
72@param State
73 The current state within the trace.
74@param done
75 Progress.
76@param rReachabilityMap
77 Output variable for the reachability. Maps occurring observable events to the reachable generator states and a label that contains information about specification violations.
78 */
79void ComputeReachabilityRecursive(const System& rGen, const EventSet& rUnobsEvents, Idx State, StateSet done,
80 std::map<Idx,std::multimap<Idx,DiagLabelSet> >& rReachabilityMap);
81
82
83/**
84 * Function definition for run-time interface
85 */
86extern FAUDES_API bool IsLanguageDiagnosable(const System& rGen, const System& rSpec);
87
89
95
96
97 VerifierState(Idx state1 = 0, Idx state2 = 0, Idx state3 = 0, VerifierStateLabel label = NORMAL){ mSpec1State = state1; mSpec2State = state2; mPlantState = state3; mLabel = label; }
98
99 bool operator< (const VerifierState& rOther) const{
100 if(mSpec1State < rOther.mSpec1State)
101 return true;
102 else if(mSpec1State > rOther.mSpec1State)
103 return false;
104 if(mSpec2State < rOther.mSpec2State)
105 return true;
106 else if(mSpec2State > rOther.mSpec2State)
107 return false;
108 if(mPlantState < rOther.mPlantState)
109 return true;
110 else
111 return false;
112 }
113};
114
115/**
116 * Test function to verify language-diagnosability
117 */
118extern FAUDES_API bool IsLanguageDiagnosable(const System& rGen, const System rSpec, std::string& rReportString);
119
120/** @name Functions (verification and computation of loop-preserving observers) */
121/** @{ doxygen group */
122
123/**
124 * Verifies a loop-preserving observer.
125 * @param rGen
126 * Original generator.
127 * @param rHighAlph
128 * Abstraction alphabet.
129 * @return
130 * True if natural projection is a loop-preserving observer
131 * @ingroup DiagnosisPlugIn
132*/
133extern FAUDES_API bool IsLoopPreservingObserver(const System& rGen, const EventSet& rHighAlph);
134
135/**
136 * Computes a loop-preserving observer with minimal state size of the abstraction
137 * @param rGen
138 * Original generator
139 * @param rInitialHighAlph
140 % Initial abstraction alphabet
141 * @param rHighAlph
142 * Resulting abstraction alphabet
143 * @ingroup DiagnosisPlugIn
144 */
145extern FAUDES_API void LoopPreservingObserver(const System& rGen, const EventSet& rInitialHighAlph, EventSet& rHighAlph);
146
147/** @} doxygen group */
148
149/** rec_ComputeLoopPreservingObserver(rGen, rInitialHighAlph, rHighAlph, rDdffVector, numberEvents, currentNumberEvents, currentLocation, hosenEvents) */
150extern FAUDES_API bool rec_ComputeLoopPreservingObserver(const System& rGen, const EventSet& rInitialHighAlph, EventSet& rHighAlph,
151 const std::vector<Idx>& rDdffVector, Idx numberEvents, Idx currentNumberEvents, Idx currentLocation, EventSet chosenEvents);
152
153
154/** @name Functions (diagnoser computation) */
155/** @{ doxygen group */
156
157/**
158 * Compute a standard diagnoser from an input generator and a specification.
159 * @param rGen
160 * Input plant
161 * @param rSpec
162 * Specification generator.
163 * @param rDiagGen
164 * Diagnoser generator for output.
165 * @ingroup DiagnosisPlugIn
166*/
167extern FAUDES_API void LanguageDiagnoser(const System& rGen, const System& rSpec, Diagnoser& rDiagGen);
168
169/** @} doxygen group */
170
171} // namespace faudes
172
173#endif
#define FAUDES_API
NameSet EventSet
void LanguageDiagnoser(const System &rGen, const System &rSpec, Diagnoser &rDiagGen)
void LoopPreservingObserver(const System &rGen, const EventSet &rInitialHighAlph, EventSet &rHighAlph)
FAUDES_API bool IsLanguageDiagnosableX(const System &rGen, const System &rSpec, std::string &rReportString)
bool IsLoopPreservingObserver(const System &rGen, const EventSet &rHighAlph)
TcGenerator< AttributeVoid, AttributeVoid, AttributeCFlags, AttributeVoid > System
uint32_t Idx
bool IsLanguageDiagnosable(const System &rGen, const System &rSpec)
TdiagGenerator< AttributeFailureTypeMap, AttributeDiagnoserState, AttributeCFlags, AttributeVoid > Diagnoser
void ComputeReachability(const System &rGen, const EventSet &rUnobsEvents, const EventSet &rFailures, Idx State, const AttributeFailureTypeMap &rAttrFTMap, map< Idx, multimap< Idx, DiagLabelSet > > &rReachabilityMap)
void ComputeReachabilityRecursive(const System &rGen, const EventSet &rUnobsEvents, const EventSet &rFailures, Idx State, const AttributeFailureTypeMap &rAttrFTMap, map< Idx, multimap< Idx, DiagLabelSet > > &rReachabilityMap, const DiagLabelSet FToccurred)
void ComputeGobs(const System &rOrigGen, const string &rFailureType, const EventSet &rFailureEvents, Diagnoser &rGobs)
bool rec_ComputeLoopPreservingObserver(const System &rGen, const EventSet &rInitialHighAlph, EventSet &rHighAlph, const std::vector< Idx > &rDiffVector, Idx numberEvents, Idx currentNumberEvents, Idx currentLocation, EventSet chosenEvents)
bool operator<(const VerifierState &rOther) const
VerifierState(Idx state1=0, Idx state2=0, Idx state3=0, VerifierStateLabel label=NORMAL)

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