diag_decentralizeddiagnosis.h

Go to the documentation of this file.
00001 /** @file diag_decentralizeddiagnosis.h
00002 Functions to check a system's decentralized diagnosability.
00003 */
00004 
00005 #ifndef DIAG_DECENTRALIZEDDIAGNOSIS_H
00006 #define DIAG_DECENTRALIZEDDIAGNOSIS_H
00007 
00008 #include <vector>
00009 #include "corefaudes.h"
00010 #include "op_include.h"
00011 #include "diag_generator.h"
00012 #include "diag_languagediagnosis.h"
00013 #include "diag_attrdiagstate.h"
00014 #include "diag_attrfailureevents.h"
00015 #include "diag_attrfailuretypes.h"
00016 #include "diag_attrlabelset.h"
00017 
00018 #include "diag_debug.h"
00019 
00020 namespace faudes {
00021 
00022 //////////////////////////////////////////////////////////////////////////////////
00023 // Verifier State for Co-diagnosability
00024 /////////////////////////////////////////////////////////////////////////////////
00025 
00026 struct CoVerifierState{
00027   std::vector<Idx> mSpec1State;
00028   Idx mSpec2State;
00029   Idx mPlantState;
00030   VerifierStateLabel mLabel;
00031   
00032   
00033   CoVerifierState(Idx number = 0, Idx state2 = 0, Idx state3 = 0, VerifierStateLabel label = NORMAL){ mSpec1State = std::vector<Idx>(number); mSpec2State = state2; mPlantState = state3; mLabel = label; }
00034   CoVerifierState(const CoVerifierState& rOther){ mSpec1State = rOther.mSpec1State; mSpec2State = rOther.mSpec2State; mPlantState = rOther.mPlantState; mLabel = rOther.mLabel;}
00035 
00036   bool operator<  (const CoVerifierState&   rOther) const{
00037     for(Idx i = 0; i < mSpec1State.size(); i++){
00038       if(mSpec1State.at(i) < rOther.mSpec1State.at(i) )
00039         return true;
00040       else if(mSpec1State.at(i) > rOther.mSpec1State.at(i) )
00041         return false;
00042     }
00043     if(mSpec2State < rOther.mSpec2State)
00044       return true;
00045     else if(mSpec2State > rOther.mSpec2State)
00046       return false;
00047     if(mPlantState < rOther.mPlantState)
00048       return true;
00049     else 
00050       return false;
00051   }
00052 };
00053 
00054 
00055 ///////////////////////////////////////////////////////////////////////////////
00056 // Functions for decentralized diagnosability
00057 ///////////////////////////////////////////////////////////////////////////////
00058 
00059 /** @name Functions (decentralized diagnosability) */
00060 /** @{ doxygen group */
00061 
00062 
00063 /**
00064 Checks co-diagnosability for a system G with respect to the specification K  and the local observation alphabets rAlphabets. 
00065 @param rGen
00066   Plant automaton.
00067 @param rSpec
00068   Specification automaton.
00069 @param rAlphabets
00070   Local observation alphabets (for decentralized diagnosis)
00071 @param rReportString
00072   User-readable information of violating condition (in case of negative test result). 
00073 @return
00074   True if system G is co-diagnosable.
00075 @ingroup DiagnosisPlugIn
00076 */
00077 bool IsCoDiagnosable(const System& rGen, const Generator& rSpec, const std::vector<const EventSet*>& rAlphabets, std::string& rReportString);
00078 
00079 /** @} doxygen group */
00080 
00081 
00082 
00083 /**
00084 Computes decentralized diagnosers for multiple local sites. 
00085 @param rGen
00086   Plant automaton.
00087 @param rSpec
00088   Specification automaton.
00089 @param rAlphabets
00090   Observable events of the local sites. 
00091 @param rDiags
00092   Decentralized diagnosers
00093 @param rReportString
00094   User-readable information of violating condition (in case of negative test result). 
00095 @exception Exception
00096   - Number of alphabets does not equal number of local sites (id 305).
00097 @return
00098   True if system G is co-diagnosable.
00099   The result is allocated on the heap, ownership is with the calling function.
00100 @ingroup DiagnosisPlugIn
00101 */
00102 bool DecentralizedDiagnoser(const System& rGen, const Generator& rSpec, const std::vector<const EventSet*>& rAlphabets, std::vector<Diagnoser*>& rDiags, std::string& rReportString);
00103 
00104 /** @name Functions (modular diagnoser computation) */
00105 /** @{ doxygen group */
00106 
00107 /** Function that computes decentralized diagnosers for the respective subsystems of a composed (modular) system
00108   * @param rGens
00109   * Local subsystem automata
00110 @param rSpec
00111   Specification automaton.
00112 @param rDiags
00113   Decentralized diagnosers
00114 @param rReportString
00115   User-readable information of violating condition (in case of negative test result). 
00116 @exception Exception
00117   - Number of modular components does not equal number of decentralized diagnosers (id 306).
00118  @ingroup DiagnosisPlugIn
00119   */
00120 void DecentralizedModularDiagnoser(const std::vector<const System*>& rGens, const Generator& rSpec, std::vector<Diagnoser*>& rDiags, std::string& rReportString);
00121 
00122 /** @} doxygen group */
00123 
00124 /**
00125  * Function definition for run-time interface 
00126  */
00127 bool IsCoDiagnosable(const System& rGen, const Generator& rSpec, const EventSetVector& rAlphabets);
00128 
00129 /**
00130  * Function definition for run-time interface 
00131  */
00132 bool DecentralizedDiagnoser(const System& rGen, const Generator& rSpec, const EventSetVector& rAlphabets, GeneratorVector& rDiags);
00133 
00134 /**
00135  * Function definition for run-time interface 
00136  */
00137 void DecentralizedModularDiagnoser(const SystemVector& rGens, const Generator& rSpec, GeneratorVector& rDiags);
00138 
00139 
00140 ///////////////////////////////////////////////////////////////////////////////
00141 // Further Auxiliary Functions  
00142 ///////////////////////////////////////////////////////////////////////////////
00143 
00144 /**
00145 Parallel composition of multiple generators.
00146 @param rGens
00147   STL-vector of generators.
00148 @param rResGen
00149   Output variable for the resulting product generator.
00150 */
00151 void cParallel(const std::vector<const System*>& rGens, System& rResGen);
00152 
00153 
00154 } // namespace faudes
00155 
00156 #endif

libFAUDES 2.23h --- 2014.04.03 --- c++ api documentaion by doxygen