|
|
||||||
|
diag_languagediagnosis.cpp
Go to the documentation of this file.
34 map<Idx,multimap<Idx,DiagLabelSet> > reachMap; // maps executable events to all reachable states and occuring relative failure types
62 for (initStateIt = rGenMarkedNonSpecBehaviour.InitStatesBegin(); initStateIt != rGenMarkedNonSpecBehaviour.InitStatesEnd(); initStateIt++) {
67 // create newAttr with state index of current initial state of rGenMarkedNonSpecBehaviour and label "N"
71 // if newAttr equals any existing state attribute then use this state and make it an initial state
76 FD_DD("Statelabel " << *initStateIt << "N already exists at state " << *stateIt << " --> make it init state.");
108 FD_DD("_" << rGenMarkedNonSpecBehaviour.EventName(it->first) << " ("<< it->second.size() << " state estimates)");
139 // if newAttr equals any existing state attribute then we create a transition to this very state
159 FD_DD("Create new state " << nextDState << " and transition " << currDState << " --" << rGenMarkedNonSpecBehaviour.EventName(it->first) << "--> " << nextDState);
207 void ComputeReachabilityRecursive(const System& rGen, const EventSet& rUnobsEvents, Idx State, StateSet done,
213 multimap<Idx,DiagLabelSet> stateFailureTypeMap; // maps generator states onto occurred failures types (=labels), part of rReachabilityMap
244 for (mmLabelIt = stateFailureTypeMap.begin(); mmLabelIt != stateFailureTypeMap.end(); mmLabelIt++) {
260 for (mmLabelIt = stateFailureTypeMap.lower_bound(tIt->X2); mmLabelIt != stateFailureTypeMap.upper_bound(tIt->X2); mmLabelIt++) {
393 newDAttr.AddStateLabelMap(rcmap.Arg1State(*lit), sestimate.DiagnoserStateMap().Attribute(*lit));
409 FD_DD("LanguageDiagnoser(): insert diag transition " << rDiagGen.TStr(Transition(dstate,ev,*sit)));
427 FD_DD("LanguageDiagnoser(): insert diag transition " << rDiagGen.TStr(Transition(dstate,ev,newDState)));
467 VerifierState newVerifierState = VerifierState(rSpec.InitState(), rSpec.InitState(), rGen.InitState(),NORMAL);
484 FD_DD("currentState: " + ToStringInteger(currentState.first) + " VerifierState: (" + rSpec.StateName(currentState.second.mSpec1State) + "," + rSpec.StateName(currentState.second.mSpec2State) + "," + rGen.StateName(currentState.second.mPlantState) + "," + ToStringInteger(currentState.second.mLabel) + ")");
494 newVerifierState = VerifierState(tIt->X2, currentState.second.mSpec2State, currentState.second.mPlantState, NORMAL);
497 newVerifierState = VerifierState(tIt->X2, currentState.second.mSpec2State, currentState.second.mPlantState, CONFUSED);
523 newVerifierState = VerifierState(currentState.second.mSpec1State, currentState.second.mSpec2State, X2, CONFUSED);
526 if(tIt == rSpec.TransRelEnd(currentState.second.mSpec2State,*eIt) ){ // violation of the specification
527 newVerifierState = VerifierState(currentState.second.mSpec1State, currentState.second.mSpec2State, X2, CONFUSED);
547 if(newVerifierState.mLabel == NORMAL || (currentState.second.mLabel == CONFUSED && newVerifierState.mPlantState == currentState.second.mPlantState) ){ // normal behavior or confused behavior extended in the specification (rule 3 or 4)
563 if(tIt != rSpec.TransRelEnd(currentState.second.mSpec1State, *eIt) && plantIt != rGen.TransRelEnd(currentState.second.mPlantState, *eIt) ){ // event occurs in the potentially confused specification and in the plant
564 if(currentState.second.mLabel == NORMAL && specIt != rSpec.TransRelEnd(currentState.second.mSpec2State, *eIt) ){ // no confusion (rule 6)
569 newVerifierState = VerifierState(tIt->X2, currentState.second.mSpec2State, plantIt->X2, CONFUSED);
573 newVerifierState = VerifierState(tIt->X2, currentState.second.mSpec2State, plantIt->X2, CONFUSED);
597 if(rGen.TransRelBegin(currentState.second.mPlantState) == rGen.TransRelEnd(currentState.second.mPlantState) && currentState.second.mLabel == CONFUSED){
629 if(tIt != verifier.TransRelEnd(*stIt, negEvent) && sccIt->Exists(tIt->X2) ){ // there is a transition with negEvent within the SCC
687 void LoopPreservingObserver(const System& rGen, const EventSet& rInitialHighAlph, EventSet& rHighAlph){
688 // Verify if the projection with the given initial alphabet is already a loop-preserving observer
702 for(Idx numberEvents = 1; numberEvents <= diffVector.size(); numberEvents++){// number events that are chosen in this step
707 if(rec_ComputeLoopPreservingObserver(rGen,rInitialHighAlph,rHighAlph,diffVector,numberEvents,currentNumberEvents,currentLocation,chosenEvents) == true)
715 bool rec_ComputeLoopPreservingObserver(const System& rGen, const EventSet& rInitialHighAlph, EventSet& rHighAlph, const std::vector<Idx>& rDiffVector, Idx numberEvents, Idx currentNumberEvents, Idx currentLocation, EventSet chosenEvents){
719 FD_DD("currentNumberEvents: " + ToStringInteger(currentNumberEvents) + "currentLocation: " + ToStringInteger(i) + " event: " + SymbolTable::GlobalEventSymbolTablep()->Symbol(rDiffVector[i]));
728 else if(rDiffVector.size() - 1 - i < numberEvents - currentNumberEvents){ // not enough events left to find numberEvents
733 valid = rec_ComputeLoopPreservingObserver(rGen,rInitialHighAlph,rHighAlph,rDiffVector,numberEvents,currentNumberEvents + 1,i + 1, chosenEvents);
Implements state estimates for the current status of the generator. Definition: diag_attrdiagstate.h:21 std::string Str(void) const Pretty printable string of mDiagnoserStateMap. Definition: diag_attrdiagstate.cpp:88 const TaIndexSet< DiagLabelSet > & DiagnoserStateMap(void) const Get mDiagnoserStateMap. Definition: diag_attrdiagstate.cpp:43 void AddStateLabelMap(Idx gstate, const DiagLabelSet &labels) Add state estimates to mDiagnoserStateMap. Definition: diag_attrdiagstate.cpp:71 Implements the label representation for state estimates. Definition: diag_attrlabelset.h:19 NameSet::Iterator Iterator Convenience definition of NameSet::Iterator. Definition: diag_attrlabelset.h:43 Idx Arg1State(Idx s12) const Definition: cfl_parallel.cpp:768 TBaseSet< Transition, TransSort::X1EvX2 >::Iterator Iterator Iterator on transition. Definition: cfl_transset.h:269 bool InsEvent(Idx index) Add an existing event to alphabet by index. Definition: cfl_agenerator.h:1094 const TaStateSet< StateAttr > & States(void) const Return reference to state set. Definition: cfl_agenerator.h:1363 const TaEventSet< EventAttr > & Alphabet(void) const Return const reference to alphabet. Definition: cfl_agenerator.h:1358 bool SetTransition(Idx x1, Idx ev, Idx x2) Add a transition to generator by indices. Definition: cfl_agenerator.h:1197 void StateAttribute(Idx index, const StateAttr &rAttr) Set attribute for existing state. Definition: cfl_agenerator.h:1327 void InjectAlphabet(const EventSet &rNewalphabet) Set mpAlphabet without consistency check. Definition: cfl_agenerator.h:1074 const Attr & Attribute(const Idx &rElem) const Definition: cfl_indexset.h:528 EventSet UnobservableEvents(void) const Get EventSet with unobservable events. Definition: cfl_cgenerator.h:1251 EventSet ObservableEvents(void) const Get EventSet with observable events. Definition: cfl_cgenerator.h:1239 Provides the structure and methods to build and handle diagnosers. Definition: diag_generator.h:26 void InsStateLabelMapping(Idx dStateIndex, Idx gStateIndex, Idx labelIndex) Inserts a generator state estimate to a diagnoser state. Definition: diag_generator.h:298 Triple (X1,Ev,X2) to represent current state, event and next state. Definition: cfl_transset.h:57 void DWrite(const Type *pContext=0) const Write configuration data to console, debugging format. Definition: cfl_types.cpp:225 std::string ToString(const std::string &rLabel="", const Type *pContext=0) const Write configuration data to a string. Definition: cfl_types.cpp:169 void Write(const Type *pContext=0) const Write configuration data to console. Definition: cfl_types.cpp:139 StateSet::Iterator StatesBegin(void) const Iterator to Begin() of state set. Definition: cfl_generator.cpp:1057 StateSet::Iterator InitStatesBegin(void) const Iterator to Begin() of mInitStates. Definition: cfl_generator.cpp:1150 bool SetTransition(Idx x1, Idx ev, Idx x2) Add a transition to generator by indices. Definition: cfl_generator.cpp:1626 Idx InsMarkedState(void) Create new anonymous state and set as marked state. Definition: cfl_generator.cpp:1318 EventSet ActiveEventSet(Idx x1) const Return active event set at state x1. Definition: cfl_generator.cpp:1938 TransSet::Iterator TransRelBegin(void) const Iterator to Begin() of transition relation. Definition: cfl_generator.cpp:1067 void ClrTransition(Idx x1, Idx ev, Idx x2) Remove a transition by indices. Definition: cfl_generator.cpp:1660 void InsEvents(const EventSet &events) Add new named events to generator. Definition: cfl_generator.cpp:1210 bool MarkedStatesEmpty(void) const Check if set of marked states are empty. Definition: cfl_generator.cpp:668 bool ExistsTransition(const std::string &rX1, const std::string &rEv, const std::string &rX2) const Test for transition given by x1, ev, x2. Definition: cfl_generator.cpp:1124 void InjectMarkedStates(const StateSet &rNewMarkedStates) Replace mMarkedStates with StateSet given as parameter without consistency checks. Definition: cfl_generator.cpp:1535 void SetInitState(Idx index) Set an existing state as initial state by index. Definition: cfl_generator.cpp:1432 TransSet ActiveTransSet(Idx x1) const Return active transition set at state x1. Definition: cfl_generator.cpp:1948 std::string TStr(const Transition &rTrans) const Return pretty printable transition (eg for debugging) Definition: cfl_generator.cpp:3841 StateSet::Iterator StatesEnd(void) const Iterator to End() of state set. Definition: cfl_generator.cpp:1062 TransSet::Iterator TransRelEnd(void) const Iterator to End() of transition relation. Definition: cfl_generator.cpp:1072 bool ExistsEvent(Idx index) const Test existence of event in alphabet. Definition: cfl_generator.cpp:1756 void SetMarkedState(Idx index) Set an existing state as marked state by index. Definition: cfl_generator.cpp:1507 Idx InsInitState(void) Create new anonymous state and set as initial state. Definition: cfl_generator.cpp:1287 bool InsEvent(Idx index) Add an existing event to alphabet by index. Definition: cfl_generator.cpp:1198 StateSet::Iterator InitStatesEnd(void) const Iterator to End() of mInitStates. Definition: cfl_generator.cpp:1155 void GraphWrite(const std::string &rFileName, const std::string &rOutFormat="", const std::string &rDotExec="dot") const Produce graphical representation of this generator. Definition: cfl_generator.cpp:3847 bool ExistsMarkedState(Idx index) const Test existence of state in mMarkedStates. Definition: cfl_generator.cpp:1806 Functions to check a system's diagnosability with respect to a specification automaton and compute a ... void LanguageDiagnoser(const System &rGen, const System &rSpec, Diagnoser &rDiagGen) Compute a standard diagnoser from an input generator and a specification. Definition: diag_languagediagnosis.cpp:275 void LoopPreservingObserver(const System &rGen, const EventSet &rInitialHighAlph, EventSet &rHighAlph) Computes a loop-preserving observer with minimal state size of the abstraction. Definition: diag_languagediagnosis.cpp:687 bool IsLoopPreservingObserver(const System &rGen, const EventSet &rHighAlph) Verifies a loop-preserving observer. Definition: diag_languagediagnosis.cpp:645 void SelfLoop(Generator &rGen, const EventSet &rAlphabet) Self-loop all states. Definition: cfl_regular.cpp:1003 bool ComputeScc(const Generator &rGen, const SccFilter &rFilter, std::list< StateSet > &rSccList, StateSet &rRoots) Compute strongly connected components (SCC) Definition: cfl_graphfncts.cpp:347 void Parallel(const Generator &rGen1, const Generator &rGen2, Generator &rResGen) Parallel composition. Definition: cfl_parallel.cpp:32 void LanguageComplement(Generator &rGen, const EventSet &rAlphabet) Language complement wrt specified alphabet. Definition: cfl_regular.cpp:462 bool IsObs(const Generator &rLowGen, const EventSet &rHighAlph) Verification of the natural observer property. Definition: op_obserververification.cpp:38 void ComputeReachability(const System &rGen, const EventSet &rUnobsEvents, Idx State, map< Idx, multimap< Idx, DiagLabelSet > > &rReachabilityMap) Definition: diag_languagediagnosis.cpp:180 void ComputeReachabilityRecursive(const System &rGen, const EventSet &rUnobsEvents, Idx State, StateSet done, map< Idx, multimap< Idx, DiagLabelSet > > &rReachabilityMap) Definition: diag_languagediagnosis.cpp:207 void ComputeGobs(const System &rGenMarkedNonSpecBehaviour, Diagnoser &rGobs) Compute G_o for a generator that marks the faulty behaviour of a plant. Definition: diag_languagediagnosis.cpp:27 bool IsLanguageDiagnosable(const System &rGen, const System rSpec, std::string &rReportString) Test function to verify language-diagnosability. Definition: diag_languagediagnosis.cpp:445 void LabelPropagation(const DiagLabelSet &lastLabel, const DiagLabelSet &failureTypes, DiagLabelSet &newLabel) Generate a new label. Definition: diag_eventdiagnosis.cpp:1020 bool rec_ComputeLoopPreservingObserver(const System &rGen, const EventSet &rInitialHighAlph, EventSet &rHighAlph, const std::vector< Idx > &rDiffVector, Idx numberEvents, Idx currentNumberEvents, Idx currentLocation, EventSet chosenEvents) rec_ComputeLoopPreservingObserver(rGen, rInitialHighAlph, rHighAlph, rDdffVector, numberEvents,... Definition: diag_languagediagnosis.cpp:715 Definition: diag_languagediagnosis.h:90 libFAUDES 2.32b --- 2024.03.01 --- c++ api documentaion by doxygen |