DiaDes
0.1
DIAgnosis of Discrete-Event System
|
#include <string>
#include <vector>
#include <set>
#include <iostream>
#include <fstream>
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/positional_options.hpp>
#include <boost/program_options/variables_map.hpp>
#include <boost/program_options/parsers.hpp>
#include <utils/StringTools.hh>
#include <automata/Event.hh>
#include <automata/ObservableComponent.hh>
#include <automata/SpecialisedActiveDiagnoser.hh>
#include <sdmdl/SdmdlParser.hpp>
#include <sdmdl/SdmdlLexer.hpp>
#include <sdmdl/Unfolding.hh>
Go to the source code of this file.
Functions | |
string | tag (SpecialisedActiveDiagnoser::Tag tag) |
int | export2Hydiag (const SpecialisedActiveDiagnoser &diagnoser, const string &filename) |
int | initialiseModelFromDesComp (const string &filename, ObservableComponent &globalModel, const set< string > &shortNameFaults, unordered_map< string, string > &dictionary, set< string > &faults, set< string > &nominals) |
int | initialiseModelFromSdmdl (const string &filename, ObservableComponent &globalModel, VariableFactory &factory, const set< string > &shortNameIgnored, const set< string > &shortNameFaults, unordered_map< string, string > &dictionary, set< string > &faults, set< string > &nominals) |
int | initialiseDiagnosers (const ObservableComponent &model, const set< string > &faults, unordered_map< string, string > &dictionnary, unordered_map< string, SpecialisedActiveDiagnoser *> &activeDiagnoser) |
void | printUsage (const po::options_description &desc) |
int | main (int ac, char **av) |
This file is the main file of the command dd-active-diagnoser
Usage: dd-active-diagnoser --help | [file.sdmdl | file.des_comp] [--fault evt1]* [--ignored evt]* --had --dot Compute the active diagnoser of the file 'file.sdmdl' or the file 'file.des_comp' The events listed after '--fault' are considered as fault events. The events listed after '--ignored' are simply ignored INPUT events in the model 'file.sdmdl' (this option is simply ignored if the model is in 'des_comp' format. Any event that is in the model but not listed as a fault or as an ignored event is considered as a normal event.
Definition in file ActiveDiagnoser.cc.
int export2Hydiag | ( | const SpecialisedActiveDiagnoser & | diagnoser, |
const string & | filename | ||
) |
Export the active diagnoser in the had format (Hydiag Active Diagnoser format)
diagnoser | the diagnoser to export |
fileName | exported file |
Number_of_diagnoser_states Number_of_observable_events Initial_Belief_State_1 Belief_State_2 Belief_State_3 Belief_State_4 ... observable_event_1 observable_event_2 ... target_index_1_1 target_2_1 ... ... target_index_Number_of_observable_events_1 ...A belief state is a string without whitespaces An observable event is a string without whitespaces A belief state has index i if it is the ith belief state listed in the file. An observable event has index i if it is the i+1th belief state listed in the file. Therefore, the initial state has index 0, etc. The set of index ending the file describes a transition matrix. target_index_i_j denotes the index of the diagnoser state that is the target of the diagnoser state whose index is j when the observable event whose index is i occurs. If such index does not exist, it prints -1. Indexes start from 1. The format of Belief_State_i is
(q,N) or (q,Y) or (q,D) or (q,U)
where q is an integer that identifies the state of the active diagnoser and N,Y,D,U are the tags associated to the fault (N for NO, the fault is not there (Safe)) (Y for Yes, the fault is surely there (Sure)), (D for Discriminable, the fault might have occurred and a sequence of actions might be able to confirm or infirm this occurrence) (U for Undiscriminable, the fault might have occurred but it is impossible from now on to confirm or infirm its occurrence).
Definition at line 121 of file ActiveDiagnoser.cc.
References Diades::Automata::Component::behaviour(), Diades::Automata::Component::events(), initial, Diades::Automata::SpecialisedActiveDiagnoser::initialState(), Diades::Automata::SpecialisedActiveDiagnoser::isHole(), Diades::Automata::Component::numberOfStates(), Diades::Automata::Component::outputEventTransitionBegin(), Diades::Automata::Component::outputEventTransitionEnd(), Diades::Automata::Component::stateBegin(), Diades::Automata::Component::stateEnd(), states, tag(), and Diades::Automata::SpecialisedActiveDiagnoser::tag().
Referenced by main().
int initialiseDiagnosers | ( | const ObservableComponent & | model, |
const set< string > & | faults, | ||
unordered_map< string, string > & | dictionnary, | ||
unordered_map< string, SpecialisedActiveDiagnoser *> & | activeDiagnoser | ||
) |
Initialise a specialised diagnoser for each fault (see SAFEPROCESS article)
model | the global model (global automaton) that describes the bevaviour of the system |
faults | the set of fault events to deal with, one active diagnoser will be computed for each fault |
dictionary | the dictionary of event labels (if the model is in sdmdl format) |
activeDiagnoser | the resulting set of active diagnosers |
Definition at line 449 of file ActiveDiagnoser.cc.
References Diades::Utils::log(), and Diades::Automata::Component::name().
Referenced by main().
int initialiseModelFromDesComp | ( | const string & | filename, |
ObservableComponent & | globalModel, | ||
const set< string > & | shortNameFaults, | ||
unordered_map< string, string > & | dictionary, | ||
set< string > & | faults, | ||
set< string > & | nominals | ||
) |
Initialise the global model from a smdl description
filename | the filename of the sdmdl description |
globalModel | the resulting global model |
shortNameFaults | the set of events that are considered as faulty during the generation |
dictionary | the resulting mapping of event labels |
faults | the resulting set of fault event labels (long version) |
nominals | the resulting set of nominal event labels (long version) |
Definition at line 270 of file ActiveDiagnoser.cc.
References Diades::Automata::Component::events(), Diades::Automata::Component::import(), and Diades::Utils::log().
Referenced by main().
int initialiseModelFromSdmdl | ( | const string & | filename, |
ObservableComponent & | globalModel, | ||
VariableFactory & | factory, | ||
const set< string > & | shortNameIgnored, | ||
const set< string > & | shortNameFaults, | ||
unordered_map< string, string > & | dictionary, | ||
set< string > & | faults, | ||
set< string > & | nominals | ||
) |
Initialise the global model from a smdl description
filename | the filename of the sdmdl description |
globalModel | the resulting global model |
shortNameIgnored | the set of events that will be ignored dureing the generation |
shortNameFaults | the set of events that are considered as faulty during the generation |
dictionary | the resulting mapping of event labels |
faults | the resulting set of fault event labels (long version) |
nominals | the resulting set of nominal event labels (long version) |
Definition at line 329 of file ActiveDiagnoser.cc.
References Diades::Automata::Component::import(), Diades::Utils::log(), and verbose().
Referenced by main().
int main | ( | int | ac, |
char ** | av | ||
) |
The main function of the program 'dd-active-diagnoser'
ac | the number of options |
av | the program option line |
Definition at line 508 of file ActiveDiagnoser.cc.
References export2Hydiag(), Diades::Utils::getFileExtension(), initialiseDiagnosers(), initialiseModelFromDesComp(), initialiseModelFromSdmdl(), options(), printUsage(), and suffixes.
void printUsage | ( | const po::options_description & | desc | ) |
Print the usage of the program
desc | the current option descriptions |
Definition at line 481 of file ActiveDiagnoser.cc.
Referenced by getParameter(), main(), readParameters(), and setOptions().
string tag | ( | SpecialisedActiveDiagnoser::Tag | tag | ) |
tag | a give tag |
Definition at line 56 of file ActiveDiagnoser.cc.
Referenced by export2Hydiag().