DiaDes  0.1
DIAgnosis of Discrete-Event System
Typedefs | Enumerations | Functions | Variables
Diagnose.cc File Reference
#include <iostream>
#include <fstream>
#include <list>
#include <string>
#include <set>
#include <boost/accumulators/accumulators.hpp>
#include <boost/accumulators/statistics/stats.hpp>
#include <boost/accumulators/statistics/min.hpp>
#include <boost/accumulators/statistics/max.hpp>
#include <boost/accumulators/statistics/mean.hpp>
#include <boost/accumulators/statistics/variance.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <utils/CmdInterface.hh>
#include <automata/Event.hh>
#include <automata/ObservableComponent.hh>
#include <automata/ClassicalDiagnoser.hh>
#include <automata/SyncRulesLoad.hh>
#include <automata/Diagnosis.hh>
#include <automata/History.hh>
#include <FaultDiagnosis.hh>
#include <io/xml/automata/Simulation.hh>

Go to the source code of this file.

Typedefs

typedef pair< time_duration, EventEventOccurrence
 

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
}
 
enum  FileExtension {
  DESCOMP =0, DESCOMP =0, RULES =1, DESCOMP =0,
  DESCOMP =0, RULES =1, XML =2, ABSTRACTION = 3,
  DIAGNOSER = 4, DESCOMP =0, ARCHV = 0, DESCOMP =0,
  RULES =1, XML =2, DESCOMP = 0, RULES = 1,
  XML =0, RULES =0
}
 
enum  Algotype {
  Unknown, Comp, Model, Abstract,
  Diagnoser
}
 

Functions

vector< string > fileExtensions (numberOfFileExtensions)
 
vector< string > options (numberOfOptions)
 
vector< bool > isSet (numberOfOptions, false)
 
void initialiseOptions ()
 
void readParameters (int argc, char *argv[], Algotype &type, list< string > &modelFiles, set< Event > &faults)
 
void readScenario (const string &filename, list< EventOccurrence > &simulation, list< EventOccurrence > &observations)
 
void runDiagnosis (FaultDiagnosis &faultDiagnosis, const list< EventOccurrence > &observations, bool statistics)
 
int main (int argc, char *argv[])
 

Variables

unsigned numberOfOptions = 3
 
unsigned numberOfFileExtensions = 5
 
string description ="Usage:\t diagnose --help\n\t diagnose [--statistics] [--faults evt1 evt2] file1.des_comp file2.des_comp [file3.des_comp...] sync.rules scenario.xml\n\t diagnose [--statistics] [--faults evt1 evt2] file1.des_comp scenario.xml\n\t diagnose [--statistics] [--faults evt1 evt2] file.des_comp file.abstraction scenario.xml\n\t diagnose [--statistics] [--faults evt1 evt2] file.diagnoser scenario.xml\n\n\n\t Diagnose the sequence of observations given in the scenarios. Print on the\n\t standard output the final diagnosis. Write the diagnostic history in\n\t a file 'history.archv' and the perfect diagnosis in 'perfect_history.archv'.\n\t The events listed after the --faults option are considered as faults.\n\n\t If the input models are a set of models, 'diagnose' uses a component-based\n\t algorithm. If the input model is a global one, 'diagnose' uses a global \n\t model algorithm. If the input model is a diagnoser, 'diagnose' uses a diagnoser\n\t algorithm.\n\t Options: --statistics write some statistics in a file 'output.statistics'."
 

Detailed Description

This file is the main file of the command diagnose.

    Usage: diagnose --help
               diagnose [--statistics] [--faults evt1 evt2] file1.des_comp file2.des_comp  [file3.des_comp...] sync.rules scenario.xml
               diagnose [--statistics] [--faults evt1 evt2] file1.des_comp  scenario.xml
                   diagnose [--statistics] [--faults evt1 evt2] file.des_comp file.abstraction scenario.xml
                   diagnose [--statistics] [--faults evt1 evt2] file.diagnoser scenario.xml


                   Diagnose the sequence of observations given in the scenarios. Print on the
                   standard output the final diagnosis. Write the diagnostic history in
                   a file history.archv and the perfect diagnosis in perfectHistory.archv.
                   The events listed after the --faults option are considered as faults.
                   
                   If the input models are a set of models, 'diagnose' uses a component-based
                   algorithm. If the input model is a global one, 'diagnose' uses a global model
                   algorithm. If the input model is a diagnoser, 'diagnose' uses a diagnoser
                   algorithm.
                   Options: --statistics write some statistics in a file 'output.statistics'."

Definition in file Diagnose.cc.

Typedef Documentation

◆ EventOccurrence

typedef pair<time_duration,Event> EventOccurrence

Definition at line 82 of file Diagnose.cc.

Enumeration Type Documentation

◆ Algotype

enum Algotype
Enumerator
Unknown 
Comp 
Model 
Abstract 
Diagnoser 

Definition at line 84 of file Diagnose.cc.

◆ FileExtension

Enumerator
DESCOMP 
DESCOMP 
RULES 
DESCOMP 
DESCOMP 
RULES 
XML 
ABSTRACTION 
DIAGNOSER 
DESCOMP 
ARCHV 
DESCOMP 
RULES 
XML 
DESCOMP 
RULES 
XML 
RULES 

Definition at line 56 of file Diagnose.cc.

◆ 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 55 of file Diagnose.cc.

Function Documentation

◆ fileExtensions()

vector<string> fileExtensions ( numberOfFileExtensions  )

◆ initialiseOptions()

void initialiseOptions ( )

Definition at line 66 of file Diagnose.cc.

References ABSTRACTION, DESCOMP, DIAGNOSER, FAULTS, fileExtensions(), HELP, options(), RULES, STATISTICS, and XML.

Referenced by main().

◆ isSet()

vector<bool> isSet ( numberOfOptions  ,
false   
)

Referenced by main(), and readParameters().

◆ main()

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

◆ options()

vector<string> options ( numberOfOptions  )

◆ readParameters()

void readParameters ( int  argc,
char *  argv[],
Algotype type,
list< string > &  modelFiles,
set< Event > &  faults 
)

◆ readScenario()

void readScenario ( const string &  filename,
list< EventOccurrence > &  simulation,
list< EventOccurrence > &  observations 
)

Definition at line 372 of file Diagnose.cc.

References printError().

Referenced by main().

◆ runDiagnosis()

void runDiagnosis ( FaultDiagnosis faultDiagnosis,
const list< EventOccurrence > &  observations,
bool  statistics 
)

The algorithm took 'algorithmicTime' units of time to provide the result.

Two cases hold here:

  • either the algorithm was sleeping when the observation became available; in this case the algorithm wakes up at time 'occurrence.second' and works for the amount of time 'algorithmicTime' so when the algorithm terminates its clock is 'algorithmClock = occurrence.first + algorithmicTime'.
  • or the algorithm was still working on previous observations when this occurrence has occurred. In this case, it will operate only after it finishes with the others, so when the algorithm terminates its clock is 'algorithmClock = algorithmClock + algorithmicTime'.

Definition at line 391 of file Diagnose.cc.

References Diades::Automata::FaultDiagnosis::diagnose(), Diades::Automata::FaultDiagnosis::getDiagnosis(), Diades::Automata::History::initialTimePoint(), Diades::Automata::History::publishDiagnosis(), and Diades::Automata::History::publishObservation().

Referenced by main().

Variable Documentation

◆ description

string description ="Usage:\t diagnose --help\n\t diagnose [--statistics] [--faults evt1 evt2] file1.des_comp file2.des_comp [file3.des_comp...] sync.rules scenario.xml\n\t diagnose [--statistics] [--faults evt1 evt2] file1.des_comp scenario.xml\n\t diagnose [--statistics] [--faults evt1 evt2] file.des_comp file.abstraction scenario.xml\n\t diagnose [--statistics] [--faults evt1 evt2] file.diagnoser scenario.xml\n\n\n\t Diagnose the sequence of observations given in the scenarios. Print on the\n\t standard output the final diagnosis. Write the diagnostic history in\n\t a file 'history.archv' and the perfect diagnosis in 'perfect_history.archv'.\n\t The events listed after the --faults option are considered as faults.\n\n\t If the input models are a set of models, 'diagnose' uses a component-based\n\t algorithm. If the input model is a global one, 'diagnose' uses a global \n\t model algorithm. If the input model is a diagnoser, 'diagnose' uses a diagnoser\n\t algorithm.\n\t Options: --statistics write some statistics in a file 'output.statistics'."

Definition at line 64 of file Diagnose.cc.

Referenced by readParameters().

◆ numberOfFileExtensions

unsigned numberOfFileExtensions = 5

Definition at line 58 of file Diagnose.cc.

◆ numberOfOptions

unsigned numberOfOptions = 3

Definition at line 57 of file Diagnose.cc.