38 #include <acado/code_generation/templates/templates.hpp> 105 const std::string& _realString,
106 const std::string& _intString,
113 string moduleName, modulePrefix;
143 std::string fileName( dirName );
144 fileName +=
"/" + moduleName +
"_integrator.c";
157 int generateMatlabInterface;
161 if ( (
bool)generateMatlabInterface == true ) {
162 std::string integrateInterface = dirName;
163 integrateInterface +=
"/" + moduleName +
"_integrate.c";
169 mexInterfaceMake.
dictionary[
"@MODULE_NAME@" ] = moduleName;
170 mexInterfaceMake.
dictionary[
"@MODULE_PREFIX@" ] = modulePrefix;
171 integrateInterface = dirName + std::string(
"/make_" + moduleName +
"_integrator.m");
174 mexInterfaceMake.
setup( MAKE_MEX_INTEGRATOR,integrateInterface,
"",
"real_t",
"int",16,
"%" );
194 cout <<
"--> Exporting remaining files... ";
199 dirName +
string(
"/") + moduleName +
"_auxiliary_sim_functions.h",
200 dirName +
string(
"/") + moduleName +
"_auxiliary_sim_functions.c",
207 int generateMakeFile;
209 if ( (
bool)generateMakeFile == true )
301 std::vector<Grid> newGrids_;
327 if ( ( f.
getNUI( ) > 0 ) ||
362 const std::string& _fileName,
363 const std::string& _resultsFile,
364 const std::vector<std::string>& outputFiles,
366 const uint jumpReference
374 string moduleName, modulePrefix;
378 std::vector<Grid> outputGrids;
379 std::vector<Expression> outputExpressions;
380 std::vector<std::string> outputNames;
384 if( outputFiles.size() != outputGrids.size() || (outputFiles.size() != outputExpressions.size() && outputFiles.size() != outputNames.size()) ) {
388 std::string fileName( _dirName );
389 fileName +=
"/" + _fileName;
394 main <<
"#include \"" + moduleName +
"_auxiliary_sim_functions.h\"\n";
396 main.
addComment(
"SOME CONVENIENT DEFINTIONS:" );
397 main.
addComment(
"---------------------------------------------------------------" );
398 main.
addStatement( (std::string)
" #define JUMP " +
toString(jumpReference) +
" /* jump for the output reference */\n" );
402 main.
addStatement( (std::string)
" #define RESULTS_NAME \"" + _resultsFile +
"\"\n" );
403 for( i = 0; i < (int)outputGrids.size(); i++ ) {
404 main.
addStatement( (std::string)
" #define OUTPUT" +
toString(i) +
"_NAME \"" + outputFiles[i] +
"\"\n" );
408 main.
addComment(
"---------------------------------------------------------------" );
410 main.
addComment(
"GLOBAL VARIABLES FOR THE ACADO REAL-TIME ALGORITHM:" );
411 main.
addComment(
"---------------------------------------------------" );
412 main.
addStatement(
" " + modulePrefix +
"workspace " + moduleName +
"Workspace;\n" );
413 main.
addStatement(
" " + modulePrefix +
"variables " + moduleName +
"Variables;\n" );
417 main.
addComment(
"A TEMPLATE FOR TESTING THE INTEGRATOR:" );
418 main.
addComment(
"----------------------------------------------------" );
421 main.
addComment( 3,
"INTRODUCE AUXILIARY VAIRABLES:" );
422 main.
addComment( 3,
"------------------------------" );
423 main.
addStatement(
" FILE *file, *controls, *initStates;\n" );
424 for( i = 0; i < (int)outputGrids.size(); i++ ) {
428 for( i = 0; i < (int)outputGrids.size(); i++ ) {
429 if( !DERIVATIVES ) main.
addStatement( (std::string)
" const int dimOut" +
toString(i) +
" = " + modulePrefix +
"_NOUT[" +
toString(i) +
"];\n" );
430 else main.
addStatement( (std::string)
" const int dimOut" +
toString(i) +
" = " + modulePrefix +
"_NOUT[" +
toString(i) +
"]*(1+" + modulePrefix +
"_NX+" + modulePrefix +
"_NU);\n" );
432 if( !DERIVATIVES ) main.
addStatement(
" real_t x[" + modulePrefix +
"_NX+" + modulePrefix +
"_NXA+" + modulePrefix +
"_NU];\n" );
433 else main.
addStatement(
" real_t x[(" + modulePrefix +
"_NX+" + modulePrefix +
"_NXA)*(1+" + modulePrefix +
"_NX+" + modulePrefix +
"_NU)+" + modulePrefix +
"_NU];\n" );
435 for( i = 0; i < (int)outputGrids.size(); i++ ) {
438 main.
addStatement(
" real_t u[" + modulePrefix +
"_NU];\n" );
440 for( i = 0; i < (int)outputGrids.size(); i++ ) {
443 if( TIMING ==
true ) {
446 if( !DERIVATIVES ) main.
addStatement(
" real_t xT[" + modulePrefix +
"_NX+" + modulePrefix +
"_NXA+" + modulePrefix +
"_NU];\n" );
447 else main.
addStatement(
" real_t xT[(" + modulePrefix +
"_NX+" + modulePrefix +
"_NXA)*(1+" + modulePrefix +
"_NX+" + modulePrefix +
"_NU)+" + modulePrefix +
"_NU];\n" );
449 main.
addStatement(
" const " + modulePrefix +
"workspace nullWork2 = {0};\n" );
450 main.
addStatement(
" " + moduleName +
"Workspace = nullWork2;\n" );
454 main.
addComment( 3,
"----------------------------------------" );
455 main.
addStatement(
" initStates = fopen( INIT_NAME,\"r\" );\n" );
456 main.
addStatement(
" for( j = 0; j < " + modulePrefix +
"_NX+" + modulePrefix +
"_NXA; j++) {\n" );
457 main.
addStatement(
" nil = fscanf( initStates, \"%lf\", &x[j] );\n" );
462 main.
addStatement(
" for( i = 0; i < (" + modulePrefix +
"_NX+" + modulePrefix +
"_NXA); i++ ) {\n" );
463 main.
addStatement(
" for( j = 0; j < " + modulePrefix +
"_NX; j++ ) {\n" );
465 main.
addStatement(
" x[" + modulePrefix +
"_NX+" + modulePrefix +
"_NXA+i*" + modulePrefix +
"_NX+j] = 1;\n" );
467 main.
addStatement(
" x[" + modulePrefix +
"_NX+" + modulePrefix +
"_NXA+i*" + modulePrefix +
"_NX+j] = 0;\n" );
471 main.
addStatement(
" for( i = 0; i < (" + modulePrefix +
"_NX+" + modulePrefix +
"_NXA); i++ ) {\n" );
472 main.
addStatement(
" for( j = 0; j < " + modulePrefix +
"_NU; j++ ) {\n" );
473 main.
addStatement(
" x[" + modulePrefix +
"_NX+" + modulePrefix +
"_NXA+(" + modulePrefix +
"_NX+" + modulePrefix +
"_NXA)*" + modulePrefix +
"_NX+i*" + modulePrefix +
"_NU+j] = 0;\n" );
481 main.
addComment( 3,
"----------------------------------------" );
482 main.
addStatement(
" file = fopen(RESULTS_NAME,\"w\");\n" );
483 for( i = 0; i < (int)outputGrids.size(); i++ ) {
486 main.
addStatement(
" controls = fopen(CONTROLS_NAME,\"r\");\n" );
487 main.
addStatement(
" for( i = 0; i < " + modulePrefix +
"_N; i++ ) {\n" );
488 main.
addStatement(
" fprintf(file, \"%.16f \", i*h);\n" );
489 if( !DERIVATIVES ) main.
addStatement(
" for( j = 0; j < " + modulePrefix +
"_NX+" + modulePrefix +
"_NXA; j++) {\n" );
490 else main.
addStatement(
" for( j = 0; j < (" + modulePrefix +
"_NX+" + modulePrefix +
"_NXA)*(1+" + modulePrefix +
"_NX+" + modulePrefix +
"_NU); j++) {\n" );
491 main.
addStatement(
" fprintf(file, \"%.16f \", x[j]);\n" );
495 if( !DERIVATIVES ) main.
addStatement(
" nil = fscanf( controls, \"%lf\", &x[" + modulePrefix +
"_NX+" + modulePrefix +
"_NXA] );\n" );
496 else main.
addStatement(
" nil = fscanf( controls, \"%lf\", &x[(" + modulePrefix +
"_NX+" + modulePrefix +
"_NXA)*(1+" + modulePrefix +
"_NX+" + modulePrefix +
"_NU)] );\n" );
497 main.
addStatement(
" for( j = 0; j < " + modulePrefix +
"_NU; j++) {\n" );
498 if( !DERIVATIVES ) main.
addStatement(
" nil = fscanf( controls, \"%lf\", &x[" + modulePrefix +
"_NX+" + modulePrefix +
"_NXA+j] );\n" );
499 else main.
addStatement(
" nil = fscanf( controls, \"%lf\", &x[(" + modulePrefix +
"_NX+" + modulePrefix +
"_NXA)*(1+" + modulePrefix +
"_NX+" + modulePrefix +
"_NU)+j] );\n" );
502 if( TIMING ==
true ) {
504 if( !DERIVATIVES ) main.
addStatement(
" for( j=0; j < " + modulePrefix +
"_NX+" + modulePrefix +
"_NXA+" + modulePrefix +
"_NU; j++ ) {\n" );
505 else main.
addStatement(
" for( j=0; j < (" + modulePrefix +
"_NX+" + modulePrefix +
"_NXA)*(1+" + modulePrefix +
"_NX+" + modulePrefix +
"_NU)+" + modulePrefix +
"_NU; j++ ) {\n" );
511 std::string integrate(
" integrate( x" );
512 for( i = 0; i < (int)outputGrids.size(); i++ ) {
513 integrate += string(
", out") +
toString(i);
515 integrate +=
", reset";
519 for( i = 0; i < (int)outputGrids.size(); i++ ) {
520 main.
addStatement( (std::string)
" for( j = 0; j < " + modulePrefix +
"_NMEAS[" +
toString(i) +
"]; j=j+JUMP ) {\n" );
529 main.
addStatement(
" fprintf(file, \"%.16f \", " + modulePrefix +
"_N*h);\n" );
530 if( !DERIVATIVES ) main.
addStatement(
" for( j = 0; j < " + modulePrefix +
"_NX+" + modulePrefix +
"_NXA; j++) {\n" );
531 else main.
addStatement(
" for( j = 0; j < (" + modulePrefix +
"_NX+" + modulePrefix +
"_NXA)*(1+" + modulePrefix +
"_NX+" + modulePrefix +
"_NU); j++) {\n" );
532 main.
addStatement(
" fprintf(file, \"%.16f \", x[j]);\n" );
537 for( i = 0; i < (int)outputGrids.size(); i++ ) {
541 if( TIMING ==
true ) {
543 main.
addStatement(
" start = 1.0*theclock.tv_sec + 1.0e-6*theclock.tv_usec;\n" );
545 main.
addStatement(
" for( i=0; i < CALLS_TIMING; i++ ) {\n" );
546 main.
addStatement(
" for( j=0; j < (" + modulePrefix +
"_NX+" + modulePrefix +
"_NXA); j++ ) {\n" );
549 integrate = std::string(
" integrate( x" );
550 for( i = 0; i < (int)outputGrids.size(); i++ ) {
551 integrate += string(
", out") +
toString(i);
553 integrate +=
", reset";
558 main.
addStatement(
" end = 1.0*theclock.tv_sec + 1.0e-6*theclock.tv_usec;\n" );
561 main.
addStatement(
" printf( \"\\n\\n AVERAGE DURATION OF ONE INTEGRATION STEP: %.3g μs\\n\\n\", 1e6*time/STEPS_TIMING );\n" );
573 const std::string& _fileName
581 string moduleName, modulePrefix;
588 std::vector<Grid> outputGrids;
591 std::string fileName = _dirName;
592 fileName += string(
"/") + _fileName;
597 main.
addStatement(
"#include \"" + moduleName +
"_auxiliary_sim_functions.h\"\n" );
599 main.
addComment(
"SOME CONVENIENT DEFINTIONS:" );
600 main.
addComment(
"---------------------------------------------------------------" );
603 for( i = 0; i < (int)outputGrids.size(); i++ ) {
608 main.
addComment(
"---------------------------------------------------------------" );
610 main.
addComment(
"GLOBAL VARIABLES FOR THE ACADO REAL-TIME ALGORITHM:" );
611 main.
addComment(
"---------------------------------------------------" );
612 main.
addStatement(
" " + modulePrefix +
"workspace " + moduleName +
"Workspace;\n" );
613 main.
addStatement(
" " + modulePrefix +
"variables " + moduleName +
"Variables;\n" );
617 main.
addComment(
"A TEMPLATE FOR TESTING THE INTEGRATOR:" );
618 main.
addComment(
"----------------------------------------------------" );
621 main.
addComment( 3,
"INTRODUCE AUXILIARY VAIRABLES:" );
622 main.
addComment( 3,
"------------------------------" );
624 for( i = 0; i < (int)outputGrids.size(); i++ ) {
629 main.
addStatement(
" real_t x[" + modulePrefix +
"_NX+" + modulePrefix +
"_NXA];\n" );
630 main.
addStatement(
" real_t xRef[" + modulePrefix +
"_NX+" + modulePrefix +
"_NXA];\n" );
631 for( i = 0; i < (int)outputGrids.size(); i++ ) {
636 main.
addStatement(
" real_t maxErr, meanErr, maxErrX, meanErrX, maxErrXA, meanErrXA, temp;\n" );
637 main.
addStatement(
" const " + modulePrefix +
"workspace nullWork2 = {0};\n" );
638 main.
addStatement(
" " + moduleName +
"Workspace = nullWork2;\n" );
641 main.
addComment( 3,
"START EVALUATION RESULTS:" );
642 main.
addComment( 3,
"----------------------------------------" );
645 main.
addStatement(
" file = fopen(RESULTS_NAME,\"r\");\n" );
647 if( DERIVATIVES ) main.
addStatement(
" for( i = 0; i < (" + modulePrefix +
"_NX+" + modulePrefix +
"_NXA)*(1+" + modulePrefix +
"_NX+" + modulePrefix +
"_NU)+1; i++ ) {\n" );
648 else main.
addStatement(
" for( i = 0; i < " + modulePrefix +
"_NX+" + modulePrefix +
"_NXA+1; i++ ) {\n" );
649 main.
addStatement(
" nil = fscanf( file, \"%lf\", &temp );\n" );
650 main.
addStatement(
" nil = fscanf( ref, \"%lf\", &temp );\n" );
654 main.
addStatement(
" for( i = 1; i <= " + modulePrefix +
"_N; i++ ) {\n" );
655 main.
addStatement(
" nil = fscanf( file, \"%lf\", &temp );\n" );
656 main.
addStatement(
" nil = fscanf( ref, \"%lf\", &temp );\n" );
659 main.
addStatement(
" for( j = 0; j < " + modulePrefix +
"_NX; j++ ) {\n" );
660 main.
addStatement(
" nil = fscanf( file, \"%lf\", &x[j] );\n" );
661 main.
addStatement(
" nil = fscanf( ref, \"%lf\", &xRef[j] );\n" );
662 main.
addStatement(
" temp = fabs(x[j] - xRef[j])/fabs(xRef[j]);\n" );
663 main.
addStatement(
" if( temp > maxErrX ) maxErrX = temp;\n" );
664 main.
addStatement(
" if( isnan(x[j]) ) maxErrX = sqrt(-1);\n" );
668 main.
addStatement(
" for( j = 0; j < " + modulePrefix +
"_NXA; j++ ) {\n" );
669 main.
addStatement(
" nil = fscanf( file, \"%lf\", &x[" + modulePrefix +
"_NX+j] );\n" );
670 main.
addStatement(
" nil = fscanf( ref, \"%lf\", &xRef[" + modulePrefix +
"_NX+j] );\n" );
671 main.
addStatement(
" temp = fabs(x[" + modulePrefix +
"_NX+j] - xRef[" + modulePrefix +
"_NX+j])/fabs(xRef[" + modulePrefix +
"_NX+j]);\n" );
672 main.
addStatement(
" if( temp > maxErrXA ) maxErrXA = temp;\n" );
673 main.
addStatement(
" if( isnan(x[" + modulePrefix +
"_NX+j]) ) maxErrXA = sqrt(-1);\n" );
677 main.
addStatement(
" printf( \"MAX ERROR AT %.3f s: %.4e %.4e \\n\", i*h, maxErrX, maxErrXA );\n" );
680 main.
addStatement(
" printf( \"MAX ERROR AT %.3f s: %.4e \\n\", i*h, maxErrX );\n" );
686 main.
addStatement(
" for( j = 0; j < (" + modulePrefix +
"_NX+" + modulePrefix +
"_NXA)*(" + modulePrefix +
"_NX+" + modulePrefix +
"_NU); j++ ) {\n" );
687 main.
addStatement(
" nil = fscanf( file, \"%lf\", &temp );\n" );
688 main.
addStatement(
" nil = fscanf( ref, \"%lf\", &temp );\n" );
692 main.
addStatement(
" meanErrX = meanErrX/" + modulePrefix +
"_N;\n" );
693 main.
addStatement(
" meanErrXA = meanErrXA/" + modulePrefix +
"_N;\n" );
696 main.
addStatement(
" printf( \"TOTAL MEAN ERROR: %.4e %.4e \\n\", meanErrX, meanErrXA );\n" );
699 main.
addStatement(
" printf( \"TOTAL MEAN ERROR: %.4e \\n\", meanErrX );\n" );
702 for( i = 0; i < (int)outputGrids.size(); i++ ) {
704 main.
addStatement( (std::string)
" printf( \" OUTPUT FUNCTION " +
toString(i+1) +
":\\n\" );\n" );
709 main.
addStatement( (std::string)
" for( i = 1; i <= " + modulePrefix +
"_N*" + modulePrefix +
"_NMEAS[" +
toString(i) +
"]; i++ ) {\n" );
710 main.
addStatement( (std::string)
" nil = fscanf( output" +
toString(i) +
", \"%lf\", &temp );\n" );
711 main.
addStatement( (std::string)
" nil = fscanf( refOutput" +
toString(i) +
", \"%lf\", &temp );\n" );
714 main.
addStatement( (std::string)
" for( j = 0; j < " + modulePrefix +
"_NOUT[" +
toString(i) +
"]; j++ ) {\n" );
718 main.
addStatement(
" if( temp > maxErr ) maxErr = temp;\n" );
719 main.
addStatement( (std::string)
" if( isnan(out" +
toString(i) +
"[j]) ) maxErr = sqrt(-1);\n" );
726 main.
addStatement( (std::string)
" for( j = 0; j < " + modulePrefix +
"_NOUT[" +
toString(i) +
"]*(" + modulePrefix +
"_NX+" + modulePrefix +
"_NU); j++ ) {\n" );
727 main.
addStatement( (std::string)
" nil = fscanf( output" +
toString(i) +
", \"%lf\", &temp );\n" );
728 main.
addStatement( (std::string)
" nil = fscanf( refOutput" +
toString(i) +
", \"%lf\", &temp );\n" );
732 main.
addStatement( (std::string)
" meanErr = meanErr/(" + modulePrefix +
"_N*" + modulePrefix +
"_NMEAS[" +
toString(i) +
"]);\n" );
734 main.
addStatement(
" printf( \"TOTAL MEAN ERROR: %.4e \\n\", meanErr );\n" );
747 const std::string& initStates,
748 const std::string& controls,
749 const std::string& results,
750 const std::string& ref
756 std::string test( moduleName +
"_test.c" );
759 Grid integrationGrid;
761 std::vector<Grid> outputGrids;
796 nil = system( (dirName +
"/./" + moduleName +
"_compare").c_str() );
804 const std::string& _fileName,
805 const std::string& _realString,
806 const std::string& _intString,
810 string moduleName, modulePrefix;
817 int useSinglePrecision;
821 fileName = _dirName +
"/" + _fileName;
824 map<string, pair<string, string> >
options;
829 options[ modulePrefix +
"_N" ] = make_pair(
toString(
getN() ),
"Number of control/estimation intervals.");
830 options[ modulePrefix +
"_NX" ] = make_pair(
toString(
getNX() ),
"Number of differential variables.");
831 options[ modulePrefix +
"_NXD" ] = make_pair(
toString(
getNDX() ),
"Number of differential derivative variables.");
832 options[ modulePrefix +
"_NXA" ] = make_pair(
toString(
getNXA() ),
"Number of algebraic variables.");
833 options[ modulePrefix +
"_NU" ] = make_pair(
toString(
getNU() ),
"Number of control variables.");
834 options[ modulePrefix +
"_NOD" ] = make_pair(
toString(
getNOD() ),
"Number of online data values.");
835 options[ modulePrefix +
"_NUMOUT" ] = make_pair(
toString( nOutV.
getDim() ),
"Number of output functions.");
838 std::ostringstream acado_nout;
840 std::ostringstream acado_nmeas;
842 options[ modulePrefix +
"_OUTPUTS_DEFINED" ] = make_pair(
"\n" + acado_nout.str() + acado_nmeas.str(),
"Dimension and measurements of the output functions per shooting interval.");
849 stringstream variables;
853 variablesBlock.exportCode(variables, _realString, _intString, _precision);
856 stringstream workspace;
860 workspaceBlock.
exportCode(workspace, _realString, _intString, _precision);
863 stringstream functions;
867 functionsBlock.
exportCode(functions, _realString);
871 options, variables.str(), workspace.str(), functions.str());
878 const std::string& _fileName,
879 const std::string& _realString,
880 const std::string& _intString,
884 string moduleName, modulePrefix;
889 makefile.
dictionary[
"@MODULE_NAME@" ] = moduleName;
890 makefile.
dictionary[
"@MODULE_PREFIX@" ] = modulePrefix;
892 std::string fileName( _dirName );
893 fileName +=
"/" + _fileName;
896 makefile.
setup( MAKEFILE_INTEGRATOR,fileName,
"",
"real_t",
"int",16,
"#" );
905 if(
hasOutputs() && outputReference.size() == 0 ) {
938 nil = system((
string(
"make clean -s -C ") + _dirName).c_str());
939 nil = system((
string(
"make -s -C ") + _dirName).c_str());
940 nil = system((_dirName +
"/./" + moduleName +
"_test").c_str());
virtual returnValue setTimingCalls(uint _timingCalls)
BooleanType exportRhs() const
returnValue executeTest(const std::string &_dirName)
returnValue collectDataDeclarations(ExportStatementBlock &declarations, ExportStruct dataStruct=ACADO_ANY) const
virtual returnValue setup(const std::string &_templateName, const std::string &_fileName, const std::string &_commonHeaderName="", const std::string &_realString="real_t", const std::string &_intString="int", int _precision=16, const std::string &_commentString=std::string())
returnValue setIntegrationGrid(const Grid &_ocpGrid, const uint _numSteps)
UserInteraction & operator=(const UserInteraction &rhs)
virtual returnValue getCode(ExportStatementBlock &code)=0
std::map< std::string, std::string > dictionary
virtual BooleanType isDiscretized() const
DVector getNumMeas() const
virtual returnValue printDetails(bool details)
DVector getDimOutputs() const
returnValue getOutputExpressions(std::vector< Expression > &outputExpressions_) const
Allows to export a tailored Runge-Kutta integrator for fast model predictive control.
#define ACADOINFO(retval)
returnValue setStatus(BlockStatus _status)
BEGIN_NAMESPACE_ACADO const double EPS
Allows to pass back messages to the calling function.
A class for generating some helper functions.
BooleanType modelDimensionsSet() const
returnValue addComment(const std::string &_comment)
returnValue getModel(DifferentialEquation &_f) const
virtual returnValue setReference(const std::string &reference, const std::vector< std::string > &outputReference=*(new std::vector< std::string >()))
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
virtual returnValue setTimingSteps(uint _timingSteps)
Allows to conveniently handle (one-dimensional) grids consisting of time points.
DVector getDimOutputs() const
string toString(T const &value)
returnValue configure(const uint firstOrder, const uint online, const uint debugMode, const uint timingCalls, const uint numStages)
#define CLOSE_NAMESPACE_ACADO
virtual returnValue exportCode(std::ostream &stream, const std::string &_realString="real_t", const std::string &_intString="int", int _precision=16) const
returnValue collectFunctionDeclarations(ExportStatementBlock &declarations) 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
virtual returnValue getFunctionDeclarations(ExportStatementBlock &declarations) const =0
AlgorithmBase * createAlgorithm(UserInteraction *_userInteraction, const std::string &_commonHeaderName, const AlgorithmType &id)
Allows to export files containing automatically generated algorithms for fast model predictive contro...
std::string commonHeaderName
User-interface to automatically generate simulation algorithms for fast optimal control.
Allows export of template files.
User-interface to automatically generate algorithms for fast model predictive control.
returnValue exportEvaluation(const std::string &_dirName, const std::string &_fileName) const
returnValue setN(const uint N_)
IntegratorExport * integrator
virtual returnValue getDataDeclarations(ExportStatementBlock &declarations, ExportStruct dataStruct=ACADO_ANY) const =0
virtual returnValue exportDataDeclaration(std::ostream &stream, const std::string &_realString="real_t", const std::string &_intString="int", int _precision=16) const
static std::string fcnPrefix
returnValue getIntegrationGrid(Grid &integrationGrid_) const
returnValue getOutputGrids(std::vector< Grid > &outputGrids_) 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)
BooleanType hasOutputs() const
static std::string fcnPrefix
BooleanType hasOutputs() const
returnValue acadoCreateFolder(const std::string &name)
returnValue addStatement(const ExportStatement &_statement)
std::vector< std::string > _outputFiles
returnValue clearIntegrationGrid()
returnValue addLinebreak(uint num=1)
uint getNumOutputs() const
virtual returnValue setModelData(const ModelData &data)
DVector getNumMeas() const
returnValue checkConsistency() const
#define BEGIN_NAMESPACE_ACADO
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
std::vector< std::string > _refOutputFiles
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
static ExportAlgorithmFactory & instance()
returnValue getNameOutputs(std::vector< std::string > &names) const
virtual returnValue configure()
Allows to export code for a block of statements.
SIMexport(const uint simIntervals=1, const double totalTime=1.0)
SIMexport & operator=(const SIMexport &arg)
virtual returnValue exportCode() const
static std::string varPrefix
#define ACADOERROR(retval)
virtual bool equidistantControlGrid() const
Defines a matrix-valued variable to be used for exporting code.
returnValue copy(const SIMexport &arg)
Allows to setup and evaluate differential equations (ODEs and DAEs) based on SymbolicExpressions.
static const uint factorRef