| |
libFAUDES
Sections
Index
|
diag_languagediagnosis.hGo to the documentation of this file.00001 /** @file diag_languagediagnosis.h 00002 Functions to check a system's diagnosability with respect to a specification automaton and compute a language-diagnoser. 00003 */ 00004 00005 #ifndef DIAG_LANGUAGEDIAGNOSIS_H 00006 #define DIAG_LANGUAGEDIAGNOSIS_H 00007 00008 #include <vector> 00009 #include "corefaudes.h" 00010 #include "statemin.h" 00011 #include "diag_generator.h" 00012 #include "diag_eventdiagnosis.h" 00013 #include "op_obserververification.h" 00014 00015 #include "diag_debug.h" 00016 00017 namespace faudes { 00018 00019 /////////////////////////////////////////////////////////////////////////////// 00020 // Functions for specification framework 00021 /////////////////////////////////////////////////////////////////////////////// 00022 /** @name Functions (diagnosability with respect to a specification) */ 00023 /** @{ doxygen group */ 00024 00025 /** 00026 Tests a system's diagnosability with respect to a given specification. 00027 @param rGen 00028 Input generator. 00029 @param rSpec 00030 Specification automaton. 00031 @param rReportString 00032 User-readable information of violating condition (in case of negative test result). 00033 @return 00034 True if input generator is diagnosable. 00035 @ingroup DiagnosisPlugIn 00036 */ 00037 bool IsLanguageDiagnosableX(const cGenerator& rGen, const cGenerator& rSpec, std::string& rReportString); 00038 00039 /** @} doxygen group */ 00040 00041 /** 00042 Compute G_o for a generator that marks the faulty behaviour of a plant. 00043 Every specification violation will be labelled with label "F". 00044 @param rGenMarkedNonSpecBehaviour 00045 Input generator that specifies specification violations by marked states. 00046 @param rGobs 00047 Output variable for G_o. 00048 */ 00049 void ComputeGobs(const cGenerator& rGenMarkedNonSpecBehaviour, diagGenerator& rGobs); 00050 00051 /** 00052 Compute the reachability from a state of a generator that marks its faulty behaviour. 00053 States are said to be reachable if they can be reached through a trace that consists 00054 of arbitrarily many unobservable events followed by one observable event. 00055 @param rGen 00056 Input generator. 00057 @param rUnobsEvents 00058 Unobservable events in the generators alphabet. 00059 @param State 00060 A state of the generators state set. 00061 @param rReachabilityMap 00062 Output variable for the reachability. Maps occurring observable events to the reachable generator states and a label that contains information about specification violations. 00063 */ 00064 void ComputeReachability(const cGenerator& rGen, const EventSet& rUnobsEvents, Idx State, 00065 std::map<Idx,std::multimap<Idx,DiagLabelSet> >& rReachabilityMap); 00066 00067 /** 00068 Auxiliary function for ComputeReachability(const cGenerator&, 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). 00069 @param rGen 00070 Input generator. 00071 @param rUnobsEvents 00072 Unobservable events in the generators alphabet. 00073 @param State 00074 The current state within the trace. 00075 @param done 00076 Progress. 00077 @param rReachabilityMap 00078 Output variable for the reachability. Maps occurring observable events to the reachable generator states and a label that contains information about specification violations. 00079 */ 00080 void ComputeReachabilityRecursive(const cGenerator& rGen, const EventSet& rUnobsEvents, Idx State, StateSet done, 00081 std::map<Idx,std::multimap<Idx,DiagLabelSet> >& rReachabilityMap); 00082 00083 /** 00084 * Function definition for run-time interface 00085 */ 00086 void IsLanguageDiagnosable(const cGenerator& rGen, const cGenerator& rSpec, bool& rRes, std::string& rReportString); 00087 00088 00089 /** 00090 * Function definition for run-time interface 00091 */ 00092 void IsLanguageDiagnosable(const cGenerator& rGen, const cGenerator& rSpec, bool& rRes); 00093 00094 enum VerifierStateLabel{NORMAL,CONFUSED,BLOCK}; 00095 00096 struct VerifierState{ 00097 Idx mSpec1State; 00098 Idx mSpec2State; 00099 Idx mPlantState; 00100 VerifierStateLabel mLabel; 00101 00102 00103 VerifierState(Idx state1 = 0, Idx state2 = 0, Idx state3 = 0, VerifierStateLabel label = NORMAL){ mSpec1State = state1; mSpec2State = state2; mPlantState = state3; mLabel = label; } 00104 00105 bool operator< (const VerifierState& rOther) const{ 00106 if(mSpec1State < rOther.mSpec1State) 00107 return true; 00108 else if(mSpec1State > rOther.mSpec1State) 00109 return false; 00110 if(mSpec2State < rOther.mSpec2State) 00111 return true; 00112 else if(mSpec2State > rOther.mSpec2State) 00113 return false; 00114 if(mPlantState < rOther.mPlantState) 00115 return true; 00116 else 00117 return false; 00118 } 00119 }; 00120 00121 /** 00122 * Test function to verify language-diagnosability 00123 */ 00124 bool IsLanguageDiagnosable(const cGenerator& rGen, const cGenerator rSpec, std::string& rReportString); 00125 00126 /** @name Functions (verification and computation of loop-preserving observers) */ 00127 /** @{ doxygen group */ 00128 00129 /** 00130 * Verifies a loop-preserving observer. 00131 * @param rGen 00132 * Original generator. 00133 * @param rHighAlph 00134 * Abstraction alphabet. 00135 * @return 00136 * True if natural projection is a loop-preserving observer 00137 * @ingroup DiagnosisPlugIn 00138 */ 00139 bool IsLoopPreservingObserver(const cGenerator& rGen, const EventSet& rHighAlph); 00140 00141 /** 00142 * Computes a loop-preserving observer with minimal state size of the abstraction 00143 * @param rGen 00144 * Original generator 00145 * @param rInitialHighAlph 00146 % Initial abstraction alphabet 00147 * @param rHighAlph 00148 * Resulting abstraction alphabet 00149 * @ingroup DiagnosisPlugIn 00150 */ 00151 void ComputeLoopPreservingObserver(const cGenerator& rGen, const EventSet& rInitialHighAlph, EventSet& rHighAlph); 00152 00153 /** @} doxygen group */ 00154 00155 /** Wrapper function for rti */ 00156 void IsLoopPreservingObserver(const cGenerator& rGen, const EventSet& rHighAlph, bool& rRes); 00157 00158 /** rec_ComputeLoopPreservingObserver(rGen, rInitialHighAlph, rHighAlph, rDdffVector, numberEvents, currentNumberEvents, currentLocation, hosenEvents) */ 00159 bool rec_ComputeLoopPreservingObserver(const cGenerator& rGen, const EventSet& rInitialHighAlph, EventSet& rHighAlph, 00160 const std::vector<Idx>& rDdffVector, Idx numberEvents, Idx currentNumberEvents, Idx currentLocation, EventSet chosenEvents); 00161 00162 00163 /** @name Functions (diagnoser computation) */ 00164 /** @{ doxygen group */ 00165 00166 /** 00167 * Compute a standard diagnoser from an input generator and a specification. 00168 * @param rGen 00169 * Input plant 00170 * @param rSpec 00171 * Specification generator. 00172 * @param rDiagGen 00173 * Diagnoser generator for output. 00174 * @ingroup DiagnosisPlugIn 00175 */ 00176 void ComputeLanguageDiagnoser(const cGenerator& rGen, const cGenerator& rSpec, diagGenerator& rDiagGen); 00177 00178 /** @} doxygen group */ 00179 00180 } // namespace faudes 00181 00182 #endif |
libFAUDES 2.14g --- 2009-12-3 --- c++ source docu by doxygen 1.5.6