syn_1_simple.cpp

Go to the documentation of this file.
00001 /** @file syn_1_simple.cpp
00002 
00003 Tutorial, std monolitic synthesis. 
00004 
00005 
00006 This tutorial uses a very simple example to illustrate the 
00007 std monolithic controller synthesis
00008 as originally proposed by Ramadge and Wonham.
00009 
00010 
00011 @ingroup Tutorials 
00012 
00013 @include syn_1_simple.cpp
00014 
00015 */
00016 
00017 #include "libfaudes.h"
00018 
00019 
00020 // we make the faudes namespace available to our program
00021 using namespace faudes;
00022 
00023 
00024 
00025 
00026 /////////////////
00027 // main program
00028 /////////////////
00029 
00030 int main() {
00031 
00032 
00033   // Compose plant dynamics from two very simple machines 
00034   Generator tempgen, machinea, machineb;
00035   System cplant; 
00036  
00037   tempgen.Read("data/verysimplemachine.gen");
00038   tempgen.Version("1",machinea);
00039   tempgen.Version("2",machineb);
00040   Parallel(machinea,machineb,cplant);
00041 
00042   // Declare controllable events
00043   EventSet contevents;
00044   contevents.Insert("alpha_1");
00045   contevents.Insert("alpha_2");
00046   cplant.SetControllable(contevents);
00047 
00048   // Write to file
00049   cplant.Write("tmp_cplant12.gen");
00050 
00051   // Report to console
00052   std::cout << "################################\n";
00053   std::cout << "# tutorial, plant model \n";
00054   cplant.DWrite();
00055   std::cout << "################################\n";
00056 
00057   // Read specification 
00058   Generator specification;
00059   specification.Read("data/buffer.gen");
00060   InvProject(specification,cplant.Alphabet()); 
00061   specification.Name("simple machines specification");
00062 
00063   // Write to file
00064   specification.Write("tmp_specification12.gen");
00065 
00066   // Report to console
00067   std::cout << "################################\n";
00068   std::cout << "# tutorial, specification \n";
00069   specification.DWrite();
00070   std::cout << "################################\n";
00071 
00072   // Run synthesis algorithm
00073   System supervisor;
00074   SupConNB(cplant,specification,supervisor);
00075   supervisor.Name("simple machines supervisor");
00076   supervisor.Write("tmp_supervisor12.gen");
00077 
00078   // Report to console
00079   std::cout << "################################\n";
00080   std::cout << "# tutorial, supervisor\n";
00081   supervisor.DWrite();
00082   std::cout << "################################\n";
00083 
00084   return 0;
00085 }
00086 

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