Allows to export code of an ACADO function. More...
#include <export_acado_function.hpp>
Public Member Functions | |
virtual ExportStatement * | clone () const |
ExportAcadoFunction () | |
ExportAcadoFunction (const Function &_f, const std::string &_name="acadoFcn") | |
ExportAcadoFunction (const std::string &_name) | |
virtual returnValue | exportCode (std::ostream &stream, const std::string &_realString="real_t", const std::string &_intString="int", int _precision=16) const |
virtual returnValue | exportDataDeclaration (std::ostream &stream, const std::string &_realString="real_t", const std::string &_intString="int", int _precision=16) const |
virtual returnValue | exportForwardDeclaration (std::ostream &stream, const std::string &_realString="real_t", const std::string &_intString="int", int _precision=16) const |
unsigned | getFunctionDim (void) |
ExportVariable | getGlobalExportVariable () const |
returnValue | init (const Function &_f, const std::string &_name="acadoFcn", const uint _numX=0, const uint _numXA=0, const uint _numU=0, const uint _numP=0, const uint _numDX=0, const uint _numOD=0) |
virtual bool | isDefined () const |
bool | isExternal () const |
returnValue | setGlobalExportVariable (const ExportVariable &var) |
virtual | ~ExportAcadoFunction () |
Protected Attributes | |
bool | external |
std::tr1::shared_ptr< Function > | f |
ExportVariable | globalVar |
unsigned | numDX |
unsigned | numOD |
unsigned | numP |
unsigned | numU |
unsigned | numX |
unsigned | numXA |
Allows to export code of an ACADO function.
The class ExportAcadoFunction allows to export code of an ACADO function.
Definition at line 50 of file export_acado_function.hpp.
Default constructor.
Definition at line 45 of file export_acado_function.cpp.
ExportAcadoFunction::ExportAcadoFunction | ( | const Function & | _f, |
const std::string & | _name = "acadoFcn" |
||
) |
Constructor which takes the differential equation to be exported as well as the name of the exported ODE.
[in] | _f | Differential equation to be exported. |
[in] | _name | Name of exported ODE function. |
Definition at line 60 of file export_acado_function.cpp.
ExportAcadoFunction::ExportAcadoFunction | ( | const std::string & | _name | ) |
Constructor which takes name of a function only.
This way, we can define an "external symbolic function" with the following prototype:
* void (const real_t* in, real_t* out); *
[in] | _name | Name of exported ODE function. |
Definition at line 67 of file export_acado_function.cpp.
ExportAcadoFunction::~ExportAcadoFunction | ( | ) | [virtual] |
Destructor.
Definition at line 74 of file export_acado_function.cpp.
ExportStatement * ExportAcadoFunction::clone | ( | ) | const [virtual] |
Clone constructor (deep copy).
Reimplemented from ExportFunction.
Definition at line 78 of file export_acado_function.cpp.
returnValue ExportAcadoFunction::exportCode | ( | std::ostream & | stream, |
const std::string & | _realString = "real_t" , |
||
const std::string & | _intString = "int" , |
||
int | _precision = 16 |
||
) | const [virtual] |
Exports source code of the ODE function into given file. Its appearance can can be adjusted by various options.
[in] | string | Name of file to be used to export function. |
[in] | _realString | std::string to be used to declare real variables. |
[in] | _intString | std::string to be used to declare integer variables. |
[in] | _precision | Number of digits to be used for exporting real values. |
Reimplemented from ExportFunction.
Definition at line 148 of file export_acado_function.cpp.
returnValue ExportAcadoFunction::exportDataDeclaration | ( | std::ostream & | stream, |
const std::string & | _realString = "real_t" , |
||
const std::string & | _intString = "int" , |
||
int | _precision = 16 |
||
) | const [virtual] |
Exports data declaration of the ODE function into given file. Its appearance can can be adjusted by various options.
[in] | stream | Name of file to be used to export function. |
[in] | _realString | std::string to be used to declare real variables. |
[in] | _intString | std::string to be used to declare integer variables. |
[in] | _precision | Number of digits to be used for exporting real values. |
Reimplemented from ExportFunction.
Definition at line 111 of file export_acado_function.cpp.
returnValue ExportAcadoFunction::exportForwardDeclaration | ( | std::ostream & | stream, |
const std::string & | _realString = "real_t" , |
||
const std::string & | _intString = "int" , |
||
int | _precision = 16 |
||
) | const [virtual] |
Exports forward declaration of the ODE function into given file. Its appearance can can be adjusted by various options.
[in] | file | Name of file to be used to export statement. |
[in] | _realString | std::string to be used to declare real variables. |
[in] | _intString | std::string to be used to declare integer variables. |
[in] | _precision | Number of digits to be used for exporting real values. |
Reimplemented from ExportFunction.
Definition at line 126 of file export_acado_function.cpp.
unsigned ExportAcadoFunction::getFunctionDim | ( | void | ) |
Get output dimension of the ACADO function.
Definition at line 173 of file export_acado_function.cpp.
Set global export variable - a variable that holds intermediate values.
Definition at line 180 of file export_acado_function.cpp.
returnValue ExportAcadoFunction::init | ( | const Function & | _f, |
const std::string & | _name = "acadoFcn" , |
||
const uint | _numX = 0 , |
||
const uint | _numXA = 0 , |
||
const uint | _numU = 0 , |
||
const uint | _numP = 0 , |
||
const uint | _numDX = 0 , |
||
const uint | _numOD = 0 |
||
) |
Initializes ODE function export by taking the differential equation to be exported as well as the name of the exported ODE.
[in] | _f | Differential equation to be exported. |
[in] | _name | Name of exported ODE function. |
[in] | _numX | The number of states that are needed to evaluate the system of differential equations (needed when the number of equations is not equal to the number of given states). |
[in] | _numXA | The number of algebraic states in the input for the evaluation of the system of equations. |
[in] | _numU | The number of control inputs given for the evaluation of the system of equations. |
[in] | _numP | The number of parameters given for the evaluation of the system of equations. |
[in] | _numDX | The number of differential state derivatives given for the evaluation of the system of equations. |
Definition at line 83 of file export_acado_function.cpp.
bool ExportAcadoFunction::isDefined | ( | ) | const [virtual] |
Returns whether function has been defined.
Reimplemented from ExportFunction.
Definition at line 164 of file export_acado_function.cpp.
bool ExportAcadoFunction::isExternal | ( | ) | const |
A helper function to check whether a function is external.
Definition at line 203 of file export_acado_function.cpp.
Get global export variable - a variable that holds intermediate values.
Definition at line 185 of file export_acado_function.cpp.
bool ExportAcadoFunction::external [protected] |
Flag indicating whether the symbolic function is external or not.
Definition at line 200 of file export_acado_function.hpp.
std::tr1::shared_ptr< Function > ExportAcadoFunction::f [protected] |
ACADO function to be exported.
Definition at line 196 of file export_acado_function.hpp.
ExportVariable ExportAcadoFunction::globalVar [protected] |
A variable that holds intermediate values.
Definition at line 198 of file export_acado_function.hpp.
unsigned ExportAcadoFunction::numDX [protected] |
The number of differential state derivatives given for the evaluation of the system of equations.
Definition at line 192 of file export_acado_function.hpp.
unsigned ExportAcadoFunction::numOD [protected] |
The number of "online data" objects.
Definition at line 194 of file export_acado_function.hpp.
unsigned ExportAcadoFunction::numP [protected] |
The number of parameters given for the evaluation of the system of equations.
Definition at line 189 of file export_acado_function.hpp.
unsigned ExportAcadoFunction::numU [protected] |
The number of control inputs given for the evaluation of the system of equations (similar to numX).
Definition at line 187 of file export_acado_function.hpp.
unsigned ExportAcadoFunction::numX [protected] |
The number of states that are needed to evaluate the system of differential equations. If this number isn't specified, then it will be set to the number of equations (minus the number of algebraic states).
Definition at line 181 of file export_acado_function.hpp.
unsigned ExportAcadoFunction::numXA [protected] |
The number of algebraic states in the input for the evaluation of the system of equations (similar to numX).
Definition at line 184 of file export_acado_function.hpp.