Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00035 #ifndef ACADO_TOOLKIT_SIM_EXPORT_HPP
00036 #define ACADO_TOOLKIT_SIM_EXPORT_HPP
00037 
00038 #include <acado/code_generation/export_module.hpp>
00039 #include <acado/ocp/model_container.hpp>
00040 
00041 BEGIN_NAMESPACE_ACADO
00042 
00043 class IntegratorExport;
00044 
00060 class SIMexport : public ExportModule, public ModelContainer
00061 {
00062     
00063     
00064     
00065     public:
00066 
00072                 SIMexport(      const uint simIntervals = 1,
00073                                         const double totalTime = 1.0 );
00074 
00079                 SIMexport(      const SIMexport& arg
00080                                         );
00081 
00084                 virtual ~SIMexport( );
00085 
00090         SIMexport& operator=(   const SIMexport& arg
00091                                                                 );
00092 
00093 
00103         virtual returnValue exportCode( const std::string& dirName,
00104                                                                                 const std::string& _realString = "real_t",
00105                                                                                 const std::string& _intString = "int",
00106                                                                                 int _precision = 16
00107                                                                                 );
00108 
00109 
00120                 returnValue exportAcadoHeader(  const std::string& _dirName,
00121                                                                                 const std::string& _fileName,
00122                                                                                 const std::string& _realString = "real_t",
00123                                                                                 const std::string& _intString = "int",
00124                                                                                 int _precision = 16
00125                                                                                 ) const;
00126 
00127 
00140         virtual returnValue exportAndRun(       const std::string& dirName,
00141 
00142                                                                                         const std::string& initStates,
00143 
00144                                                                                         const std::string& controls,
00145                                                                                         const std::string& results = std::string( "results.txt" ),
00146                                                                                         const std::string& ref = std::string( "ref.txt" )
00147                                                                                 );
00148                         
00149                         
00158                 virtual returnValue setReference(       const std::string& reference, const std::vector<std::string>& outputReference = *(new std::vector<std::string>())
00159                                                                                 );
00160                         
00161                         
00168                 virtual returnValue setTimingSteps( uint _timingSteps
00169                                                                                 );
00170                                                                                 
00171                         
00179                 virtual returnValue printDetails( bool details );
00180 
00181 
00182 
00183     protected:
00184 
00191                 returnValue copy(       const SIMexport& arg
00192                                                         );
00193 
00198                 returnValue clear( );
00199 
00200 
00213                 returnValue setup( );
00214 
00215 
00226                 returnValue checkConsistency( ) const;
00227 
00228 
00237                 returnValue collectDataDeclarations(    ExportStatementBlock& declarations,
00238                                                                                                 ExportStruct dataStruct = ACADO_ANY
00239                                                                                                 ) const;
00240 
00249                 returnValue collectFunctionDeclarations(        ExportStatementBlock& declarations
00250                                                                                                         ) const;
00251 
00252 
00265                 returnValue exportTest( const std::string& _dirName,
00266                                                                 const std::string& _fileName,
00267                                                                 const std::string& _resultsFile,
00268                                                                 const std::vector<std::string>& _outputFiles,
00269                                                                 const bool& TIMING = false,
00270                                                                 const uint jumpReference = 1
00271                                                                                 ) const;
00272 
00281                 returnValue exportEvaluation(   const std::string& _dirName,
00282                                                                                 const std::string& _fileName
00283                                                                                 ) const;
00284 
00295                 returnValue exportMakefile(     const std::string& _dirName,
00296                                                                         const std::string& _fileName,
00297                                                                         const std::string& _realString = "real_t",
00298                                                                         const std::string& _intString = "int",
00299                                                                         int _precision = 16
00300                                                                         ) const;
00301 
00308         returnValue executeTest( const std::string& _dirName );
00309 
00316         virtual returnValue setTimingCalls( uint _timingCalls
00317                                                                                 );
00318 
00319     protected:
00320 
00321         uint timingCalls;                                               
00323         double T;                                                               
00324                 IntegratorExport*  integrator;                  
00326                 bool referenceProvided;                 
00327                 bool PRINT_DETAILS;                             
00329                 static const uint factorRef = 10;               
00330                 uint timingSteps;                                               
00332                 std::string _initStates;                                                
00333                 std::string _controls;                                          
00334                 std::string _results;                                           
00335                 std::string _ref;                                                       
00337                 std::vector<std::string> _refOutputFiles;       
00338                 std::vector<std::string> _outputFiles;          
00340 };
00341 
00342 
00343 CLOSE_NAMESPACE_ACADO
00344 
00345 
00346 #endif  // ACADO_TOOLKIT_SIM_EXPORT_HPP
00347 
00348