Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes

User-interface to automatically generate simulation algorithms for fast optimal control. More...

#include <sim_export.hpp>

Inheritance diagram for SIMexport:
Inheritance graph
[legend]

List of all members.

Public Member Functions

returnValue exportAcadoHeader (const std::string &_dirName, const std::string &_fileName, const std::string &_realString="real_t", const std::string &_intString="int", int _precision=16) const
virtual returnValue exportAndRun (const std::string &dirName, const std::string &initStates, const std::string &controls, const std::string &results=std::string("results.txt"), const std::string &ref=std::string("ref.txt"))
virtual returnValue exportCode (const std::string &dirName, const std::string &_realString="real_t", const std::string &_intString="int", int _precision=16)
SIMexportoperator= (const SIMexport &arg)
virtual returnValue printDetails (bool details)
virtual returnValue setReference (const std::string &reference, const std::vector< std::string > &outputReference=*(new std::vector< std::string >()))
virtual returnValue setTimingSteps (uint _timingSteps)
 SIMexport (const uint simIntervals=1, const double totalTime=1.0)
 SIMexport (const SIMexport &arg)
virtual ~SIMexport ()

Protected Member Functions

returnValue checkConsistency () const
returnValue clear ()
returnValue collectDataDeclarations (ExportStatementBlock &declarations, ExportStruct dataStruct=ACADO_ANY) const
returnValue collectFunctionDeclarations (ExportStatementBlock &declarations) const
returnValue copy (const SIMexport &arg)
returnValue executeTest (const std::string &_dirName)
returnValue exportEvaluation (const std::string &_dirName, const std::string &_fileName) const
returnValue exportMakefile (const std::string &_dirName, const std::string &_fileName, const std::string &_realString="real_t", const std::string &_intString="int", int _precision=16) const
returnValue exportTest (const std::string &_dirName, const std::string &_fileName, const std::string &_resultsFile, const std::vector< std::string > &_outputFiles, const bool &TIMING=false, const uint jumpReference=1) const
virtual returnValue setTimingCalls (uint _timingCalls)
returnValue setup ()

Protected Attributes

std::string _controls
std::string _initStates
std::vector< std::string > _outputFiles
std::string _ref
std::vector< std::string > _refOutputFiles
std::string _results
IntegratorExportintegrator
bool PRINT_DETAILS
bool referenceProvided
double T
uint timingCalls
uint timingSteps

Static Protected Attributes

static const uint factorRef = 10

Detailed Description

User-interface to automatically generate simulation algorithms for fast optimal control.

The class SIMexport is a user-interface to automatically generate tailored simulation algorithms for fast optimal control. It takes an optimal control problem (OCP) formulation and generates code based on given user options, e.g specifying the integrator and the number of integration steps. In addition to the export of such a simulation algorithm, the performance of this integrator will be evaluated on accuracy of the results and the time complexity.

Author:
Rien Quirynen

Definition at line 60 of file sim_export.hpp.


Constructor & Destructor Documentation

BEGIN_NAMESPACE_ACADO SIMexport::SIMexport ( const uint  simIntervals = 1,
const double  totalTime = 1.0 
)

Default constructor.

Parameters:
[in]simIntervalsThe number of simulation intervals.
[in]totalTimeThe total simulation time.

Definition at line 55 of file sim_export.cpp.

SIMexport::SIMexport ( const SIMexport arg)

Copy constructor (deep copy).

Parameters:
[in]argRight-hand side object.

Definition at line 75 of file sim_export.cpp.

SIMexport::~SIMexport ( ) [virtual]

Destructor.

Definition at line 82 of file sim_export.cpp.


Member Function Documentation

Checks whether OCP formulation is compatible with code export capabilities.

Returns:
SUCCESSFUL_RETURN,
RET_INVALID_OBJECTIVE_FOR_CODE_EXPORT,
RET_ONLY_ODE_FOR_CODE_EXPORT,
RET_NO_DISCRETE_ODE_FOR_CODE_EXPORT,
RET_ONLY_STATES_AND_CONTROLS_FOR_CODE_EXPORT,
RET_ONLY_EQUIDISTANT_GRID_FOR_CODE_EXPORT,
RET_ONLY_BOUNDS_FOR_CODE_EXPORT

Definition at line 300 of file sim_export.cpp.

returnValue SIMexport::clear ( ) [protected]

Frees internal dynamic memory to yield an empty function.

Returns:
SUCCESSFUL_RETURN

Definition at line 236 of file sim_export.cpp.

returnValue SIMexport::collectDataDeclarations ( ExportStatementBlock declarations,
ExportStruct  dataStruct = ACADO_ANY 
) const [protected, virtual]

Collects all data declarations of the auto-generated sub-modules to given list of declarations.

Parameters:
[in]declarationsList of declarations.
Returns:
SUCCESSFUL_RETURN,
RET_UNABLE_TO_EXPORT_CODE

Implements ExportModule.

Definition at line 320 of file sim_export.cpp.

returnValue SIMexport::collectFunctionDeclarations ( ExportStatementBlock declarations) const [protected, virtual]

Collects all function (forward) declarations of the auto-generated sub-modules to given list of declarations.

Parameters:
[in]declarationsList of declarations.
Returns:
SUCCESSFUL_RETURN,
RET_UNABLE_TO_EXPORT_CODE

Implements ExportModule.

Definition at line 331 of file sim_export.cpp.

returnValue SIMexport::copy ( const SIMexport arg) [protected]

Copies all class members from given object.

Parameters:
[in]argRight-hand side object.
Returns:
SUCCESSFUL_RETURN

Definition at line 218 of file sim_export.cpp.

returnValue SIMexport::executeTest ( const std::string &  _dirName) [protected]

Compiles the exported source files and runs the corresponding test.

Parameters:
[in]_dirNameName of directory in which the files are exported.
Returns:
SUCCESSFUL_RETURN

Definition at line 888 of file sim_export.cpp.

returnValue SIMexport::exportAcadoHeader ( const std::string &  _dirName,
const std::string &  _fileName,
const std::string &  _realString = "real_t",
const std::string &  _intString = "int",
int  _precision = 16 
) const [virtual]

Exports main header file for using the exported algorithm.

Parameters:
[in]_dirNameName of directory to be used to export file.
[in]_fileNameName of file to be exported.
[in]_realStringstd::string to be used to declare real variables.
[in]_intStringstd::string to be used to declare integer variables.
[in]_precisionNumber of digits to be used for exporting real values.
Returns:
SUCCESSFUL_RETURN

Implements ExportModule.

Definition at line 772 of file sim_export.cpp.

returnValue SIMexport::exportAndRun ( const std::string &  dirName,
const std::string &  initStates,
const std::string &  controls,
const std::string &  results = std::string( "results.txt" ),
const std::string &  ref = std::string( "ref.txt" ) 
) [virtual]

Exports all files of the auto-generated code into the given directory and runs the test to evaluate the performance of the exported integrator.

Parameters:
[in]dirNameName of directory to be used to export files.
[in]initStatesName of the file containing the initial values of all the states.
[in]controlsName of the file containing the control values over the OCP grid.
[in]resultsName of the file in which the integration results will be written.
[in]refName of the file in which the reference will be written, to which the results of the integrator will be compared.
Returns:
SUCCESSFUL_RETURN

Definition at line 718 of file sim_export.cpp.

returnValue SIMexport::exportCode ( const std::string &  dirName,
const std::string &  _realString = "real_t",
const std::string &  _intString = "int",
int  _precision = 16 
) [virtual]

Exports all files of the auto-generated code into the given directory.

Parameters:
[in]dirNameName of directory to be used to export files.
[in]_realStringstd::string to be used to declare real variables.
[in]_intStringstd::string to be used to declare integer variables.
[in]_precisionNumber of digits to be used for exporting real values.
Returns:
SUCCESSFUL_RETURN

Implements ExportModule.

Definition at line 103 of file sim_export.cpp.

returnValue SIMexport::exportEvaluation ( const std::string &  _dirName,
const std::string &  _fileName 
) const [protected]

Exports the file evaluating the performance of the exported integrator, based on its results from the test and the corresponding reference results.

Parameters:
[in]_dirNameName of directory to be used to export file.
[in]_fileNameName of file to be exported.
Returns:
SUCCESSFUL_RETURN

Definition at line 548 of file sim_export.cpp.

returnValue SIMexport::exportMakefile ( const std::string &  _dirName,
const std::string &  _fileName,
const std::string &  _realString = "real_t",
const std::string &  _intString = "int",
int  _precision = 16 
) const [protected]

Exports GNU Makefile for compiling the exported MPC algorithm.

Parameters:
[in]_dirNameName of directory to be used to export file.
[in]_fileNameName of file to be exported.
[in]_realStringstd::string to be used to declare real variables.
[in]_intStringstd::string to be used to declare integer variables.
[in]_precisionNumber of digits to be used for exporting real values.
Returns:
SUCCESSFUL_RETURN

Definition at line 845 of file sim_export.cpp.

returnValue SIMexport::exportTest ( const std::string &  _dirName,
const std::string &  _fileName,
const std::string &  _resultsFile,
const std::vector< std::string > &  _outputFiles,
const bool &  TIMING = false,
const uint  jumpReference = 1 
) const [protected]

Exports test file with template main function for using the exported simulation algorithm.

Parameters:
[in]_dirNameName of directory to be used to export file.
[in]_fileNameName of file to be exported.
[in]_resultsFileName of the file in which the integration results will be written.
[in]_outputFilesNames of the files in which the output results will be written.
[in]TIMINGA boolean that is true when timing results are desired.
[in]jumpReferenceThe reference factor if the reference output results are computed.
Returns:
SUCCESSFUL_RETURN

Definition at line 341 of file sim_export.cpp.

SIMexport & SIMexport::operator= ( const SIMexport arg)

Assignment operator (deep copy).

Parameters:
[in]argRight-hand side object.

Definition at line 88 of file sim_export.cpp.

returnValue SIMexport::printDetails ( bool  details) [virtual]

This function sets a boolean if the exported simulation code should print all the details about the results or not.

Parameters:
[in]detailstrue if the exported simulation code should print all the details, otherwise false
Returns:
SUCCESSFUL_RETURN

Definition at line 881 of file sim_export.cpp.

returnValue SIMexport::setReference ( const std::string &  reference,
const std::vector< std::string > &  outputReference = *(new std::vector<std::string>()) 
) [virtual]

This function should be used if the user wants to provide the file containing the reference solution, to which the results of the integrator are compared.

Parameters:
[in]referenceName of the file containing the reference.
[in]outputReferenceThe names of the files containing the reference for the output results if any.
Returns:
SUCCESSFUL_RETURN

Definition at line 861 of file sim_export.cpp.

returnValue SIMexport::setTimingCalls ( uint  _timingCalls) [protected, virtual]

This function sets the number of calls performed for the timing results.

Parameters:
[in]_timingCallsThe new number of calls performed for the timing results.
Returns:
SUCCESSFUL_RETURN

Definition at line 899 of file sim_export.cpp.

returnValue SIMexport::setTimingSteps ( uint  _timingSteps) [virtual]

This function sets the number of integration steps performed for the timing results.

Parameters:
[in]_timingStepsThe new number of integration steps performed for the timing results.
Returns:
SUCCESSFUL_RETURN

Definition at line 874 of file sim_export.cpp.

returnValue SIMexport::setup ( ) [protected]

Sets-up code export and initializes underlying export modules.

Returns:
SUCCESSFUL_RETURN,
RET_INVALID_OPTION,
RET_INVALID_OBJECTIVE_FOR_CODE_EXPORT,
RET_ONLY_ODE_FOR_CODE_EXPORT,
RET_NO_DISCRETE_ODE_FOR_CODE_EXPORT,
RET_ONLY_STATES_AND_CONTROLS_FOR_CODE_EXPORT,
RET_ONLY_EQUIDISTANT_GRID_FOR_CODE_EXPORT,
RET_ONLY_BOUNDS_FOR_CODE_EXPORT,
RET_UNABLE_TO_EXPORT_CODE

Definition at line 246 of file sim_export.cpp.


Member Data Documentation

std::string SIMexport::_controls [protected]

Name of the file containing the control values over the OCP grid.

Definition at line 333 of file sim_export.hpp.

std::string SIMexport::_initStates [protected]

Name of the file containing the initial values of all the states.

Definition at line 332 of file sim_export.hpp.

std::vector<std::string> SIMexport::_outputFiles [protected]

Names of the files in which the outputs will be written for the integrator.

Definition at line 338 of file sim_export.hpp.

std::string SIMexport::_ref [protected]

Name of the file in which the reference will be written, to which the results of the integrator will be compared.

Definition at line 335 of file sim_export.hpp.

std::vector<std::string> SIMexport::_refOutputFiles [protected]

Names of the files in which the outputs will be written for the reference.

Definition at line 337 of file sim_export.hpp.

std::string SIMexport::_results [protected]

Name of the file in which the integration results will be written.

Definition at line 334 of file sim_export.hpp.

const uint SIMexport::factorRef = 10 [static, protected]

The used factor in the number of integration steps to get the reference.

Definition at line 329 of file sim_export.hpp.

Module for exporting a tailored integrator.

Definition at line 324 of file sim_export.hpp.

bool SIMexport::PRINT_DETAILS [protected]

True if the user wants all the details about the results being printed.

Definition at line 327 of file sim_export.hpp.

bool SIMexport::referenceProvided [protected]

True if the user provided a file with the reference solution.

Definition at line 326 of file sim_export.hpp.

double SIMexport::T [protected]

The total simulation time.

Definition at line 323 of file sim_export.hpp.

The number of calls to the exported function for the timing results.

Definition at line 321 of file sim_export.hpp.

The number of integration steps performed for the timing results.

Definition at line 330 of file sim_export.hpp.


The documentation for this class was generated from the following files:


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Sat Jun 8 2019 19:40:25