DiaDes  0.1
DIAgnosis of Discrete-Event System
Enumerations | Functions | Variables
Diagnoser.cc File Reference
#include <fstream>
#include <sstream>
#include <unordered_set>
#include <diades/automata/Event.hh>
#include <diades/automata/ClassicalDiagnoser.hh>
#include <diades/automata/CppGenerator.hh>
#include "CmdInterface.hh"

Go to the source code of this file.

Enumerations

enum  Option {
  OUTPUT =0, VERBOSE =1, EVENTS =2, NOTEVENTS =3,
  HELP =4, STATEABSTRACTIONS = 5, EVENT = 0, HELP = 1,
  OUTPUT =0, HELP = 0, EVENTS = 1, EVENTNB = 2,
  STATES = 3, STATENB = 4, TRANSITIONS = 5, TRANSITIONNB = 6,
  OBSERVABLES = 7, OBSERVABLENB = 8, UNOBSERVABLES = 9, UNOBSERVABLENB =10,
  INITIALSTATES = 11, INITIALSTATENB = 12, NAME = 13, STATISTICS = 14,
  STATEMIN = 0, STATEMAX = 1, OBSMIN = 2, OBSMAX = 3,
  EVTMIN = 4, EVTMAX = 5, SEED = 6, DIRNAME = 7,
  LATEXFILENAME = 8, TOPOLOGYFILENAME = 9, OBSINTERACTIONMIN = 10, OBSINTERACTIONMAX = 11,
  NODEBEHAVIOUR = 12, HELP = 13, OUTPUTDEGREEMAX = 14, PETRINET = 15,
  STATISTICS =0, HELP =1, FAULTS = 2, NOFAILURES =0,
  FAILURES =1, OBSERVABLES =2, HDFILE =3, DOTFILE =4,
  CPPFILE =5, WITHSILENTCLOSURE =6, HELP =7, FAULTMAX =0,
  SEED =1, HELP =2, HELP =0, FAULTS = 0,
  ALGORITHMS = 1, HELP = 0, EVENTS = 1, TIMEDEVENTS = 2,
  OBSERVATIONS = 3, TIMEDOBSERVATIONS = 4, FAULTS = 5, OBSMIN = 0,
  OBSMAX = 1, TIMEMIN = 2, TIMEMAX = 3, NOEVT = 4,
  SEED = 5, XML = 6, GENERATEFAULTS = 7, HELP = 8,
  INTERACTIVE = 9, PTALOG = 10, NBSIM = 11, HELP =0,
  COMPONENTS =0, EVENTS =1, NUMBER =2, CONNECTIONWITHEVENT =3,
  HELP =4
}
 

Functions

vector< string > fileExtensions (numberOfFileExtensions)
 
vector< string > options (numberOfOptions)
 
vector< bool > isSet (numberOfOptions, false)
 
void initialiseOptions ()
 
bool getFailuresFromFileModel (const string &infileName, unordered_set< Event > &failures, string &log)
 
int main (int argc, char *argv[])
 

Variables

unsigned numberOfOptions = 8
 
unsigned numberOfFileExtensions = 1
 
string description ="DiaDes: Diagnoser computation\nLAAS-CNRS, 2006-2012, 7 avenue du Colonel Roche, Toulouse, France\nContact: yannick.pencole@laas.fr\n\nUsage: diagnoser\n\t [--with-silent-closure]\n\t [--no-failures | --failures evt1 [evt2 ...]]\n\t [--observables obs1 [obs2 ...]]\n\t [--hd filename1]\n\t [--dot filename2]\n\tinfile.des_comp \n\n\nCompute an explicit representation of the diagnoser from the model \ninfile.des_comp and saves it into modelName.diagnoser (diades format). \nThe diagnoser can be extended with the silent closure or not. \nIf --no-failures is set, it returns a state observer. If --observables \n(resp. --failures) is set, then only the listed events are considered as observable \n(resp. faulty). The tag --hd exports the diagnoser is HyDiag format, the tag --dot \nexports the diagnoser in graphviz format, the tag --cpp exports the diagnoser \nin standalone and compilable C++ file. The option --help displays this message"
 

Detailed Description

This file is the main file of the command Diagnoser.

Usage: diagnoser [--with-silent-closure]  [--no-failure | --failures evt1 [evt2 ...]]
 [--observables obs1 [obs2 ...]] [--hd filename1] [--dot filename2]
infile.comp_des

This program computes a deterministic diagnoser. If no option is provided it computes the classical one with the observable events from the model and the failure events from the model (no communicating event is observable). The result is saved in modelName.diagnoser. Here are the options:

  1. –with-silent-closure the diagnoser is computed with silent closure (in this case the diagnoser state also contains the set of states in which the system could be after the occurrence of non-observable events AFTER the occurrence of the LAST observable event.
  2. –no-failures the diagnoser is computed without any failure consideration (in this case, it is an observer defined from the given observable events
  3. –failures list of events from the model that will be considered as a failure event in the diagnoser
  4. –observables list of events from the model that will be considered as a observable event in the diagnoser
  5. –output filename Name of the output file
Todo:

Validation of the option interface of the command

Force the writing of an interactive diagnoser in a ".diagnoser" suffixed file

Author
Dmitry Kamenetsky and Yannick Pencole
Version
1.0

Definition in file Diagnoser.cc.

Enumeration Type Documentation

◆ Option

enum Option
Enumerator
OUTPUT 
VERBOSE 
EVENTS 
NOTEVENTS 
HELP 
STATEABSTRACTIONS 
EVENT 
HELP 
OUTPUT 
HELP 
EVENTS 
EVENTNB 
STATES 
STATENB 
TRANSITIONS 
TRANSITIONNB 
OBSERVABLES 
OBSERVABLENB 
UNOBSERVABLES 
UNOBSERVABLENB 
INITIALSTATES 
INITIALSTATENB 
NAME 
STATISTICS 
STATEMIN 
STATEMAX 
OBSMIN 
OBSMAX 
EVTMIN 
EVTMAX 
SEED 
DIRNAME 
LATEXFILENAME 
TOPOLOGYFILENAME 
OBSINTERACTIONMIN 
OBSINTERACTIONMAX 
NODEBEHAVIOUR 
HELP 
OUTPUTDEGREEMAX 
PETRINET 
STATISTICS 
HELP 
FAULTS 
NOFAILURES 
FAILURES 
OBSERVABLES 
HDFILE 
DOTFILE 
CPPFILE 
WITHSILENTCLOSURE 
HELP 
FAULTMAX 
SEED 
HELP 
HELP 
FAULTS 
ALGORITHMS 
HELP 
EVENTS 
TIMEDEVENTS 
OBSERVATIONS 
TIMEDOBSERVATIONS 
FAULTS 
OBSMIN 
OBSMAX 
TIMEMIN 
TIMEMAX 
NOEVT 
SEED 
XML 
GENERATEFAULTS 
HELP 
INTERACTIVE 
PTALOG 
NBSIM 
HELP 
COMPONENTS 
EVENTS 
NUMBER 
CONNECTIONWITHEVENT 
HELP 

Definition at line 47 of file Diagnoser.cc.

Function Documentation

◆ fileExtensions()

vector<string> fileExtensions ( numberOfFileExtensions  )

◆ getFailuresFromFileModel()

bool getFailuresFromFileModel ( const string &  infileName,
unordered_set< Event > &  failures,
string &  log 
)

get the failure events from the model in "oldmodel" format

Returns
true if success, if not 'log' contains some pieces of information about the errors

Name acquisition

Parsing State Part but useless

Definition at line 386 of file Diagnoser.cc.

References fileExtensions().

Referenced by initialiseOptions(), and main().

◆ initialiseOptions()

void initialiseOptions ( )

◆ isSet()

vector<bool> isSet ( numberOfOptions  ,
false   
)

Referenced by main().

◆ main()

int main ( int  argc,
char *  argv[] 
)

Main function of the program diagnoser

Basically, this function analyses the parameters to initiate the diagnoser computation.

Parameters
argcthe number of parameters
argvthe list of parameters
Returns
0 if success

Definition at line 95 of file Diagnoser.cc.

References Diades::Automata::ObservableMask::addMask(), CPPFILE, description, DOTFILE, FAILURES, fileExtensions(), Diades::CmdInterface::fileSuffixOk(), Diades::Automata::generateCppCode(), getFailuresFromFileModel(), HDFILE, HELP, initialiseOptions(), isSet(), Diades::Utils::log(), NOFAILURES, numberOfOptions, OBSERVABLES, options(), Diades::CmdInterface::printCommandLineError(), printUsage(), Diades::Utils::saveLog(), and WITHSILENTCLOSURE.

◆ options()

vector<string> options ( numberOfOptions  )

Referenced by initialiseOptions(), and main().

Variable Documentation

◆ description

string description ="DiaDes: Diagnoser computation\nLAAS-CNRS, 2006-2012, 7 avenue du Colonel Roche, Toulouse, France\nContact: yannick.pencole@laas.fr\n\nUsage: diagnoser\n\t [--with-silent-closure]\n\t [--no-failures | --failures evt1 [evt2 ...]]\n\t [--observables obs1 [obs2 ...]]\n\t [--hd filename1]\n\t [--dot filename2]\n\tinfile.des_comp \n\n\nCompute an explicit representation of the diagnoser from the model \ninfile.des_comp and saves it into modelName.diagnoser (diades format). \nThe diagnoser can be extended with the silent closure or not. \nIf --no-failures is set, it returns a state observer. If --observables \n(resp. --failures) is set, then only the listed events are considered as observable \n(resp. faulty). The tag --hd exports the diagnoser is HyDiag format, the tag --dot \nexports the diagnoser in graphviz format, the tag --cpp exports the diagnoser \nin standalone and compilable C++ file. The option --help displays this message"

Definition at line 57 of file Diagnoser.cc.

Referenced by main().

◆ numberOfFileExtensions

unsigned numberOfFileExtensions = 1

Definition at line 50 of file Diagnoser.cc.

◆ numberOfOptions

unsigned numberOfOptions = 8

Definition at line 49 of file Diagnoser.cc.

Referenced by main().