Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members

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

#include <sim_export.hpp>

Inheritance diagram for SIMexport:
Inheritance graph
[legend]

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 ()
 
- Public Member Functions inherited from ExportModule
 ExportModule ()
 
virtual ~ExportModule ()
 
- Public Member Functions inherited from UserInteraction
virtual int addPlotWindow (PlotWindow &_window)
 
virtual int operator<< (PlotWindow &_window)
 
virtual int operator<< (LogRecord &_record)
 
UserInteractionoperator= (const UserInteraction &rhs)
 
 UserInteraction ()
 
 UserInteraction (const UserInteraction &rhs)
 
virtual ~UserInteraction ()
 
- Public Member Functions inherited from Options
returnValue addOptionsList ()
 
returnValue ensureConsistency ()
 
returnValue ensureConsistency ()
 
returnValue get (OptionsName name, int &value) const
 
returnValue get (OptionsName name, double &value) const
 
returnValue get (OptionsName name, std::string &value) const
 
returnValue get (uint idx, OptionsName name, int &value) const
 
returnValue get (uint idx, OptionsName name, double &value) const
 
returnValue get (uint idx, OptionsName name, std::string &value) const
 
uint getNumOptionsLists () const
 
Options getOptions (uint idx) const
 
Optionsoperator= (const Options &rhs)
 
Optionsoperator= (const Options &rhs)
 
 Options ()
 
 Options ()
 
 Options (const Options &rhs)
 
 Options (const Options &rhs)
 
 Options ()
 
 Options (const OptionsList &_optionsList)
 
returnValue print () const
 
returnValue print () const
 
returnValue printOptionsList () const
 
returnValue printOptionsList (uint idx) const
 
returnValue set (OptionsName name, int value)
 
returnValue set (OptionsName name, double value)
 
returnValue set (OptionsName name, const std::string &value)
 
returnValue set (uint idx, OptionsName name, int value)
 
returnValue set (uint idx, OptionsName name, double value)
 
returnValue set (uint idx, OptionsName name, const std::string &value)
 
returnValue setOptions (const Options &arg)
 
returnValue setOptions (uint idx, const Options &arg)
 
returnValue setToDefault ()
 
returnValue setToDefault ()
 
returnValue setToFast ()
 
returnValue setToFast ()
 
returnValue setToMPC ()
 
returnValue setToReliable ()
 
returnValue setToReliable ()
 
 ~Options ()
 
 ~Options ()
 
virtual ~Options ()
 
- Public Member Functions inherited from Logging
int addLogRecord (LogRecord &record)
 
returnValue getAll (LogName _name, MatrixVariablesGrid &values) const
 
returnValue getFirst (LogName _name, DMatrix &firstValue) const
 
returnValue getFirst (LogName _name, VariablesGrid &firstValue) const
 
returnValue getLast (LogName _name, DMatrix &lastValue) const
 
returnValue getLast (LogName _name, VariablesGrid &lastValue) const
 
returnValue getLogRecord (LogRecord &_record) const
 
uint getNumLogRecords () const
 
 Logging ()
 
int operator<< (LogRecord &record)
 
returnValue printLoggingInfo () const
 
returnValue printNumDoubles () const
 
returnValue setAll (LogName _name, const MatrixVariablesGrid &values)
 
returnValue setLast (LogName _name, const DMatrix &value, double time=-INFTY)
 
returnValue setLast (LogName _name, VariablesGrid &value, double time=-INFTY)
 
returnValue updateLogRecord (LogRecord &_record) const
 
virtual ~Logging ()
 
- Public Member Functions inherited from Plotting
int addPlotWindow (PlotWindow &_window)
 
uint getNumPlotWindows () const
 
returnValue getPlotWindow (uint idx, PlotWindow &_window) const
 
returnValue getPlotWindow (PlotWindow &_window) const
 
int operator<< (PlotWindow &_window)
 
Plottingoperator= (const Plotting &rhs)
 
virtual returnValue plot (PlotFrequency _frequency=PLOT_IN_ANY_CASE)
 
 Plotting ()
 
 Plotting (const Plotting &rhs)
 
virtual returnValue replot (PlotFrequency _frequency=PLOT_IN_ANY_CASE)
 
virtual ~Plotting ()
 
- Public Member Functions inherited from ModelContainer
uint addOutput (const OutputFcn &outputEquation_, const DVector &measurements)
 
uint addOutput (const OutputFcn &outputEquation_, const uint numberMeasurements)
 
uint addOutput (const std::string &output, const std::string &diffs_output, const uint dim, const DVector &measurements)
 
uint addOutput (const std::string &output, const std::string &diffs_output, const uint dim, const uint numberMeasurements)
 
uint addOutput (const std::string &output, const std::string &diffs_output, const uint dim, const DVector &measurements, const std::string &colInd, const std::string &rowPtr)
 
uint addOutput (const std::string &output, const std::string &diffs_output, const uint dim, const uint numberMeasurements, const std::string &colInd, const std::string &rowPtr)
 
BooleanType exportRhs () const
 
DVector getDimOutputs () const
 
const std::string getFileNameModel () const
 
returnValue getIntegrationGrid (Grid &_grid) const
 
returnValue getModel (DifferentialEquation &_f) const
 
ModelDatagetModelData ()
 
uint getN () const
 
uint getNDX () const
 
uint getNOD () const
 
uint getNP () const
 
uint getNU () const
 
DVector getNumMeas () const
 
uint getNX () const
 
uint getNXA () const
 
BooleanType hasDifferentialEquation () const
 
BooleanType hasEquidistantControlGrid () const
 
BooleanType hasOutputs () const
 
 ModelContainer ()
 
BooleanType modelDimensionsSet () const
 
returnValue setDimensions (uint _NX1, uint _NX2, uint _NX3, uint _NDX, uint _NDX3, uint _NXA, uint _NXA3, uint _NU, uint _NOD, uint _NP)
 
returnValue setDimensions (uint _NX1, uint _NX2, uint _NX3, uint _NDX, uint _NXA, uint _NU, uint _NOD, uint _NP)
 
returnValue setDimensions (uint _NX, uint _NDX, uint _NXA, uint _NU, uint _NOD, uint _NP)
 
returnValue setDimensions (uint _NX, uint _NU, uint _NOD, uint _NP)
 
returnValue setIntegrationGrid (const Grid &_ocpGrid, const uint _numSteps)
 
returnValue setLinearInput (const DMatrix &A1_, const DMatrix &B1_)
 
returnValue setLinearInput (const DMatrix &M1_, const DMatrix &A1_, const DMatrix &B1_)
 
returnValue setLinearOutput (const DMatrix &A3_, const OutputFcn &rhs_)
 
returnValue setLinearOutput (const DMatrix &M3_, const DMatrix &A3_, const OutputFcn &rhs_)
 
returnValue setLinearOutput (const DMatrix &A3_, const std::string &_rhs3, const std::string &_diffs_rhs3)
 
returnValue setLinearOutput (const DMatrix &M3_, const DMatrix &A3_, const std::string &_rhs3, const std::string &_diffs_rhs3)
 
returnValue setModel (const DifferentialEquation &_f)
 
returnValue setModel (const std::string &fileName, const std::string &_rhs_ODE, const std::string &_diffs_rhs_ODE)
 
returnValue setModelData (const ModelData &data)
 
returnValue setN (const uint N_)
 
returnValue setNARXmodel (const uint _delay, const DMatrix &_parms)
 
returnValue setNOD (const uint NOD_)
 
returnValue setNonlinearFeedback (const DMatrix &C_, const OutputFcn &feedb_)
 
returnValue setNP (const uint NP_)
 
returnValue setNU (const uint NU_)
 
returnValue setupOutput (const DVector &numberMeasurements)
 

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 Member Functions inherited from ExportModule
returnValue setupOptions ()
 
- Protected Member Functions inherited from UserInteraction
virtual returnValue getPlotDataFromMemberLoggings (PlotWindow &_window) const
 
BlockStatus getStatus () const
 
returnValue setStatus (BlockStatus _status)
 
- Protected Member Functions inherited from Options
returnValue addOption (OptionsName name, int value)
 
returnValue addOption (OptionsName name, double value)
 
returnValue addOption (OptionsName name, const std::string &value)
 
returnValue addOption (uint idx, OptionsName name, int value)
 
returnValue addOption (uint idx, OptionsName name, double value)
 
returnValue addOption (uint idx, OptionsName name, const std::string &value)
 
returnValue clearOptionsList ()
 
returnValue copy (const Options &rhs)
 
returnValue copy (const Options &rhs)
 
returnValue declareOptionsUnchanged ()
 
returnValue declareOptionsUnchanged (uint idx)
 
BooleanType haveOptionsChanged () const
 
BooleanType haveOptionsChanged (uint idx) const
 
- Protected Member Functions inherited from Logging
virtual returnValue setupLogging ()
 

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
 
- Protected Attributes inherited from ExportModule
std::string commonHeaderName
 
- Protected Attributes inherited from UserInteraction
BlockStatus status
 
- Protected Attributes inherited from Options
std::vector< OptionsListlists
 
- Protected Attributes inherited from Logging
std::vector< LogRecordlogCollection
 
int logIdx
 
- Protected Attributes inherited from Plotting
PlotCollection plotCollection
 
- Protected Attributes inherited from ModelContainer
ModelData modelData
 
uint NOD
 
uint NP
 
uint NU
 

Static Protected Attributes

static const uint factorRef = 10
 

Additional Inherited Members

- Public Attributes inherited from Options
real_t boundRelaxation
 
real_t boundTolerance
 
int dropBoundPriority
 
int_t dropBoundPriority
 
int dropEqConPriority
 
int_t dropEqConPriority
 
int dropIneqConPriority
 
int_t dropIneqConPriority
 
int enableCholeskyRefactorisation
 
int_t enableCholeskyRefactorisation
 
int enableDriftCorrection
 
int_t enableDriftCorrection
 
BooleanType enableDropInfeasibles
 
BooleanType enableEqualities
 
BooleanType enableFarBounds
 
BooleanType enableFlippingBounds
 
BooleanType enableFullLITests
 
BooleanType enableInertiaCorrection
 
BooleanType enableNZCTests
 
BooleanType enableRamping
 
BooleanType enableRegularisation
 
real_t epsDen
 
real_t epsFlipping
 
real_t epsIterRef
 
real_t epsLITests
 
real_t epsNum
 
real_t epsNZCTests
 
real_t epsRegularisation
 
real_t finalRamping
 
real_t growFarBounds
 
real_t initialFarBounds
 
real_t initialRamping
 
SubjectToStatus initialStatusBounds
 
real_t maxDualJump
 
real_t maxPrimalJump
 
int numRefinementSteps
 
int_t numRefinementSteps
 
int numRegularisationSteps
 
int_t numRegularisationSteps
 
PrintLevel printLevel
 
real_t rcondSMin
 
real_t terminationTolerance
 

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.

@param[in] simIntervals             The number of simulation intervals.
@param[in] totalTime                The total simulation time.

Definition at line 56 of file sim_export.cpp.

SIMexport::SIMexport ( const SIMexport arg)

Copy constructor (deep copy).

@param[in] arg              Right-hand side object.

Definition at line 76 of file sim_export.cpp.

SIMexport::~SIMexport ( )
virtual

Destructor.

Definition at line 83 of file sim_export.cpp.

Member Function Documentation

returnValue SIMexport::checkConsistency ( ) const
protected

Checks whether OCP formulation is compatible with code export capabilities.

\return SUCCESSFUL_RETURN, \n
        RET_INVALID_OBJECTIVE_FOR_CODE_EXPORT, \n
        RET_ONLY_ODE_FOR_CODE_EXPORT, \n
        RET_NO_DISCRETE_ODE_FOR_CODE_EXPORT, \n
        RET_ONLY_STATES_AND_CONTROLS_FOR_CODE_EXPORT, \n
        RET_ONLY_EQUIDISTANT_GRID_FOR_CODE_EXPORT, \n
        RET_ONLY_BOUNDS_FOR_CODE_EXPORT

Definition at line 318 of file sim_export.cpp.

returnValue SIMexport::clear ( )
protected

Frees internal dynamic memory to yield an empty function.

\return SUCCESSFUL_RETURN

Definition at line 252 of file sim_export.cpp.

returnValue SIMexport::collectDataDeclarations ( ExportStatementBlock declarations,
ExportStruct  dataStruct = ACADO_ANY 
) const
protectedvirtual

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 340 of file sim_export.cpp.

returnValue SIMexport::collectFunctionDeclarations ( ExportStatementBlock declarations) const
protectedvirtual

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 351 of file sim_export.cpp.

returnValue SIMexport::copy ( const SIMexport arg)
protected

Copies all class members from given object.

@param[in] arg              Right-hand side object.

\return SUCCESSFUL_RETURN

Definition at line 234 of file sim_export.cpp.

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

Compiles the exported source files and runs the corresponding test.

@param[in] _dirName                 Name of directory in which the files are exported.

\return SUCCESSFUL_RETURN

Definition at line 931 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.

@param[in] _dirName                 Name of directory to be used to export file.
@param[in] _fileName                Name of file to be exported.
@param[in] _realString              std::string to be used to declare real variables.
@param[in] _intString               std::string to be used to declare integer variables.
@param[in] _precision               Number of digits to be used for exporting real values.

\return SUCCESSFUL_RETURN

Implements ExportModule.

Definition at line 803 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 746 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.

@param[in] dirName                  Name of directory to be used to export files.
@param[in] _realString              std::string to be used to declare real variables.
@param[in] _intString               std::string to be used to declare integer variables.
@param[in] _precision               Number of digits to be used for exporting real values.

\return SUCCESSFUL_RETURN

Implements ExportModule.

Definition at line 104 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 572 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.

@param[in] _dirName                 Name of directory to be used to export file.
@param[in] _fileName                Name of file to be exported.
@param[in] _realString              std::string to be used to declare real variables.
@param[in] _intString               std::string to be used to declare integer variables.
@param[in] _precision               Number of digits to be used for exporting real values.

\return SUCCESSFUL_RETURN

Definition at line 877 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.

@param[in] _dirName                 Name of directory to be used to export file.
@param[in] _fileName                Name of file to be exported.
@param[in] _resultsFile             Name of the file in which the integration results will be written.
@param[in] _outputFiles             Names of the files in which the output results will be written.
@param[in] TIMING                   A boolean that is true when timing results are desired.
@param[in] jumpReference    The reference factor if the reference output results are computed.

\return SUCCESSFUL_RETURN

Definition at line 361 of file sim_export.cpp.

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

Assignment operator (deep copy).

@param[in] arg              Right-hand side object.

Definition at line 89 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 924 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 904 of file sim_export.cpp.

returnValue SIMexport::setTimingCalls ( uint  _timingCalls)
protectedvirtual

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

@param[in] _timingCalls             The new number of calls performed for the timing results.

\return SUCCESSFUL_RETURN

Definition at line 946 of file sim_export.cpp.

returnValue SIMexport::setTimingSteps ( uint  _timingSteps)
virtual

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

@param[in] _timingSteps             The new number of integration steps performed for the timing results.

\return SUCCESSFUL_RETURN

Definition at line 917 of file sim_export.cpp.

returnValue SIMexport::setup ( )
protected

Sets-up code export and initializes underlying export modules.

\return SUCCESSFUL_RETURN, \n
        RET_INVALID_OPTION, \n
        RET_INVALID_OBJECTIVE_FOR_CODE_EXPORT, \n
        RET_ONLY_ODE_FOR_CODE_EXPORT, \n
        RET_NO_DISCRETE_ODE_FOR_CODE_EXPORT, \n
        RET_ONLY_STATES_AND_CONTROLS_FOR_CODE_EXPORT, \n
        RET_ONLY_EQUIDISTANT_GRID_FOR_CODE_EXPORT, \n
        RET_ONLY_BOUNDS_FOR_CODE_EXPORT, \n
        RET_UNABLE_TO_EXPORT_CODE

Definition at line 262 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
staticprotected

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

Definition at line 329 of file sim_export.hpp.

IntegratorExport* SIMexport::integrator
protected

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.

uint SIMexport::timingCalls
protected

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

Definition at line 321 of file sim_export.hpp.

uint SIMexport::timingSteps
protected

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 Mon Jun 10 2019 12:35:26