47 const std::string& _commonHeaderName
140 LOG(
LVL_DEBUG ) <<
"Integrator: setNonlinearFeedback... " << endl;
147 feedb_expr << feedb_;
198 for(
uint k1 = 0; k1 <
NX; k1++ ) {
199 for(
uint k2 = 0; k2 < numStages*
NF; k2++ ) {
207 for(
uint i = 0; i < feedb_.getDim(); i++ ) {
234 LOG(
LVL_DEBUG ) <<
"Integrator: setInputSystem... " << endl;
260 for( i = 0; i < numStages*
NX; i++ ) {
261 for( j = 0; j < NX+
NU+numStages*
NF; j++ ) {
300 LOG(
LVL_DEBUG ) <<
"Integrator: prepareInputSystem... " << endl;
377 uint run5, run6, run7;
378 std::string tempString;
443 if(
NU > 0 ||
NOD > 0 ) {
469 loop->addStatement( std::string(
"if( run > 0 ) {\n") );
474 loop->addStatement( loopTemp1 );
476 loop->addStatement( std::string(
"}\nelse{\n") );
480 loop->addStatement( std::string(
"}\n") );
493 loop->addStatement( loopTemp1 );
511 if( liftMode == 2 ) {
514 for( run6 = 0; run6 <
numStages; run6++ ) {
517 loop->addStatement( loopKsens02 );
521 for( run5 = 0; run5 <
numStages; run5++ ) {
524 loop->addStatement( loopKsens04 );
528 if( liftMode == 2 ) {
529 loop->addStatement( std::string(
"if(") + run.
getName() +
" == 0) {\n" );
532 loop->addStatement(
rk_A == eyeMF );
533 if( liftMode == 2 ) loop->addStatement( std::string(
"}\n") );
539 DMatrix zeroV = zeros<double>(1,NX*(NX+
NU));
544 for( run5 = 0; run5 <
numStages; run5++ ) {
545 if( liftMode == 1 ) {
552 for( run5 = 0; run5 <
numStages; run5++ ) {
560 if( liftMode == 1 ) {
568 for( run6 = 0; run6 <
NX; run6++ ) {
569 for( run7 = 0; run7 < numStages*
NF; run7++ ) {
576 for( run5 = 0; run5 <
NF; run5++ ) {
582 if( liftMode == 2 ) {
590 if( liftMode == 2 ) {
593 for( run5 = 0; run5 <
NF; run5++ ) {
596 if( liftMode == 2 ) loopF.
addStatement( std::string(
"}\n") );
597 loop->addStatement( loopF );
600 if( liftMode == 2 ) {
601 loop->addStatement( std::string(
"if(") + run.
getName() +
" == 0) {\n" );
604 if( liftMode == 2 ) loop->addStatement( std::string(
"}\n") );
608 for( run5 = 0; run5 <
numStages; run5++ ) {
613 for( run5 = 0; run5 <
numStages; run5++ ) {
614 if( liftMode == 1 ) {
620 loop->addStatement( loopFsens );
625 for( run5 = 0; run5 <
numStages; run5++ ) {
631 for( run6 = 0; run6 <
numStages; run6++ ) {
634 loop->addStatement( loopKsens03 );
637 for( run5 = 0; run5 <
numStages; run5++ ) {
640 loop->addStatement( loopKsens );
647 for( run5 = 0; run5 <
numStages; run5++ ) {
651 loop->addStatement( loopKsens1 );
655 for( run6 = 0; run6 <
numStages; run6++ ) {
656 for( run5 = 0; run5 <
NX; run5++ ) {
667 loop->addStatement(
"}\n" );
755 reset_int.
setDoc(
"The internal memory of the integrator can be reset." );
758 integrate.
doc(
"Performs the integration and sensitivity propagation for one shooting interval." );
ExportVariable rk_diffsPrev1
#define LOG(level)
Just define a handy macro for getting the logger.
Lowest level, the debug level.
ExportVariable getRow(const ExportIndex &idx) const
returnValue addArgument(const ExportArgument &_argument1, const ExportArgument &_argument2=emptyConstExportArgument, const ExportArgument &_argument3=emptyConstExportArgument, const ExportArgument &_argument4=emptyConstExportArgument, const ExportArgument &_argument5=emptyConstExportArgument, const ExportArgument &_argument6=emptyConstExportArgument, const ExportArgument &_argument7=emptyConstExportArgument, const ExportArgument &_argument8=emptyConstExportArgument, const ExportArgument &_argument9=emptyConstExportArgument)
Allows to export a tailored lifted implicit Runge-Kutta integrator with forward sensitivity generatio...
Allows to setup and evaluate output functions based on SymbolicExpressions.
returnValue initializeDDMatrix()
ExportVariable getGlobalExportVariable() const
double getFirstTime() const
virtual ExportVariable getAuxVariable() const
ExportVariable getTranspose() const
GenericMatrix & appendCols(const GenericMatrix &_arg)
ExportAcadoFunction feedb
Expression getRow(const uint &rowIdx) const
std::vector< Grid > outputGrids
UserInteraction * userInteraction
returnValue get(OptionsName name, int &value) const
virtual ExportVariable getGlobalExportVariable(const uint factor) const
Allows to pass back messages to the calling function.
returnValue initializeCoefficients()
Expression forwardDerivative(const Expression &arg1, const Expression &arg2)
ExportLinearSolver * solver
virtual returnValue evaluateAllStatesImplicitSystem(ExportStatementBlock *block, const ExportIndex &k_index, const ExportVariable &Ah, const ExportVariable &C, const ExportIndex &stage, const ExportIndex &i, const ExportIndex &tmp_index)
returnValue addComment(const std::string &_comment)
Block< Derived > block(Index startRow, Index startCol, Index blockRows, Index blockCols)
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
virtual returnValue solveInputSystem(ExportStatementBlock *block, const ExportIndex &index1, const ExportIndex &index2, const ExportIndex &index3, const ExportIndex &k_index, const ExportVariable &Ah)
Allows to export code of a for-loop.
Expression getCols(const uint &colIdx1, const uint &colIdx2) const
ExportAcadoFunction sens_input
string toString(T const &value)
GenericMatrix & appendRows(const GenericMatrix &_arg)
virtual ~FeedbackLiftedIRKExport()
ExportVariable getElement(const ExportIndex &rowIdx, const ExportIndex &colIdx) const
ExportVariable rk_diffsTemp2
ForwardIRKExport & operator=(const ForwardIRKExport &arg)
#define CLOSE_NAMESPACE_ACADO
ExportVariable getSubMatrix(const ExportIndex &rowIdx1, const ExportIndex &rowIdx2, const ExportIndex &colIdx1, const ExportIndex &colIdx2) const
GenericMatrix< double > DMatrix
Defines a scalar-valued index variable to be used for exporting code.
virtual returnValue copy(const ImplicitRungeKuttaExport &arg)
GenericMatrix getCols(unsigned _start, unsigned _end) const
virtual returnValue getFunctionDeclarations(ExportStatementBlock &declarations) const
virtual returnValue getCode(ExportStatementBlock &code)
Base class for all variables within the symbolic expressions family.
virtual returnValue setup()
returnValue prepareInputSystem(ExportStatementBlock &code)
virtual returnValue setDoc(const std::string &_doc)
std::string commonHeaderName
ExportVariable rk_dk1_tmp
virtual ExportFunction & doc(const std::string &_doc)
static std::string fcnPrefix
ExportVariable getCols(const ExportIndex &idx1, const ExportIndex &idx2) const
Expression multipleForwardDerivative(const Expression &arg1, const Expression &arg2, const Expression &seed)
virtual returnValue getFunctionDeclarations(ExportStatementBlock &declarations) const
ExportVariable rk_auxSolver
Allows to export Gaussian elimination for solving linear systems of specific dimensions.
ExportVariable makeRowVector() const
const std::string getNameSolveReuseFunction()
ExportVariable rk_stageValues
Encapsulates all user interaction for setting options, logging data and plotting results.
Allows to export code of an arbitrary function.
virtual uint getDim() const
virtual DMatrix formMatrix(const DMatrix &mass, const DMatrix &jacobian)
returnValue addStatement(const ExportStatement &_statement)
virtual returnValue updateInputSystem(ExportStatementBlock *block, const ExportIndex &index1, const ExportIndex &index2, const ExportIndex &tmp_index)
returnValue setReuse(const bool &reuse)
std::string getFullName() const
unsigned getNumRows() const
returnValue addLinebreak(uint num=1)
FeedbackLiftedIRKExport(UserInteraction *_userInteraction=0, const std::string &_commonHeaderName="")
ExportFunction & setReturnValue(const ExportVariable &_functionReturnValue, bool _returnAsPointer=false)
unsigned getNumCols() const
uint getNumIntervals() const
virtual returnValue setup()=0
virtual returnValue getDataDeclarations(ExportStatementBlock &declarations, ExportStruct dataStruct=ACADO_ANY) const
returnValue prepareOutputEvaluation(ExportStatementBlock &code)
DifferentialStateDerivative dx
std::string getName() const
ExportVariable getRows(const ExportIndex &idx1, const ExportIndex &idx2) const
returnValue addDeclaration(const ExportVariable &_data, ExportStruct _dataStruct=ACADO_ANY)
ExportAcadoFunction lin_input
double getLastTime() const
returnValue setInputSystem()
const std::string getNameSolveFunction()
#define BEGIN_NAMESPACE_ACADO
ExportVariable error_code
ExportVariable rk_rhsTemp
returnValue clearStaticCounters()
Allows to export a tailored implicit Runge-Kutta integrator with forward sensitivity generation for f...
returnValue addFunction(const ExportFunction &_function)
ExportVariable rk_diffsNew1
virtual returnValue clear()
virtual returnValue setNonlinearFeedback(const DMatrix &C, const Expression &feedb)
virtual returnValue getCode(ExportStatementBlock &code)=0
ExportVariable rk_dk2_tmp
virtual returnValue getDataDeclarations(ExportStatementBlock &declarations, ExportStruct dataStruct=ACADO_ANY) const
Allows to export code for a block of statements.
ExportArgument getAddress(const ExportIndex &_rowIdx, const ExportIndex &_colIdx=emptyConstExportIndex) const
GenericMatrix getRows(unsigned _start, unsigned _end) const
returnValue init(const uint newDim, const bool &reuse=true, const bool &unrolling=false)
ExportVariable getCol(const ExportIndex &idx) 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)
ExportFunction & addIndex(const ExportIndex &_index)
#define ACADOERROR(retval)
virtual bool equidistantControlGrid() const
Defines a matrix-valued variable to be used for exporting code.
FeedbackLiftedIRKExport & operator=(const FeedbackLiftedIRKExport &arg)
returnValue addFunctionCall(const std::string &_fName, const ExportArgument &_argument1=emptyConstExportArgument, const ExportArgument &_argument2=emptyConstExportArgument, const ExportArgument &_argument3=emptyConstExportArgument, const ExportArgument &_argument4=emptyConstExportArgument, const ExportArgument &_argument5=emptyConstExportArgument, const ExportArgument &_argument6=emptyConstExportArgument, const ExportArgument &_argument7=emptyConstExportArgument, const ExportArgument &_argument8=emptyConstExportArgument, const ExportArgument &_argument9=emptyConstExportArgument)
ExportAcadoFunction sens_fdb
Allows to setup and evaluate differential equations (ODEs and DAEs) based on SymbolicExpressions.
std::string getName() const