discrete_export.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ACADO Toolkit.
3  *
4  * ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
5  * Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau,
6  * Milan Vukov, Rien Quirynen, KU Leuven.
7  * Developed within the Optimization in Engineering Center (OPTEC)
8  * under supervision of Moritz Diehl. All rights reserved.
9  *
10  * ACADO Toolkit is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 3 of the License, or (at your option) any later version.
14  *
15  * ACADO Toolkit is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with ACADO Toolkit; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  *
24  */
25 
26 
27 
35 
36 using namespace std;
37 
39 
40 //
41 // PUBLIC MEMBER FUNCTIONS:
42 //
43 
45  const std::string& _commonHeaderName
46  ) : IntegratorExport( _userInteraction,_commonHeaderName )
47 {
48 }
49 
50 
52  ) : IntegratorExport( arg )
53 {
54  copy( arg );
55 }
56 
57 
59 {
60  clear( );
61 }
62 
63 
65 {
66  if( rhs_.getDim() > 0 ) {
67  OnlineData dummy0;
68  Control dummy1;
69  DifferentialState dummy2;
70  AlgebraicState dummy3;
72  dummy0.clearStaticCounters();
73  dummy1.clearStaticCounters();
74  dummy2.clearStaticCounters();
75  dummy3.clearStaticCounters();
76  dummy4.clearStaticCounters();
77 
78  NX2 = rhs_.getDim() - NXA;
79  x = DifferentialState("", NX1+NX2, 1);
80  z = AlgebraicState("", NXA, 1);
82  u = Control("", NU, 1);
83  od = OnlineData("", NOD, 1);
84 
86  f << rhs_;
87 
89  for( uint i = 0; i < rhs_.getDim(); i++ ) {
90  g << forwardDerivative( rhs_(i), x );
91  g << forwardDerivative( rhs_(i), u );
92  // There are not supposed to be algebraic states or differential state derivatives !
93  }
94 
95  return (rhs.init(f, "rhs", NX, NXA, NU, NP, NDX, NOD) &
96  diffs_rhs.init(g, "diffs", NX, NXA, NU, NP, NDX, NOD));
97  }
98  return SUCCESSFUL_RETURN;
99 }
100 
101 
103  ExportStruct dataStruct
104  ) const
105 {
107  declarations.addDeclaration( max,dataStruct );
108  declarations.addDeclaration( rk_xxx,dataStruct );
109  declarations.addDeclaration( reset_int,dataStruct );
110 
111  declarations.addDeclaration( rk_diffsPrev1,dataStruct );
112  declarations.addDeclaration( rk_diffsPrev2,dataStruct );
113  declarations.addDeclaration( rk_diffsPrev3,dataStruct );
114 
115  declarations.addDeclaration( rk_diffsNew1,dataStruct );
116  declarations.addDeclaration( rk_diffsNew2,dataStruct );
117  declarations.addDeclaration( rk_diffsNew3,dataStruct );
118  declarations.addDeclaration( rk_diffsTemp3,dataStruct );
119 
120  return SUCCESSFUL_RETURN;
121 }
122 
123 
125  ) const
126 {
127  declarations.addDeclaration( integrate );
128 
129  if( NX2 != NX ) declarations.addDeclaration( fullRhs );
130  else declarations.addDeclaration( rhs );
131 
132  return SUCCESSFUL_RETURN;
133 }
134 
135 
137 {
138  int sensGen;
139  get( DYNAMIC_SENSITIVITY,sensGen );
141 
142  int useOMP;
143  get(CG_USE_OPENMP, useOMP);
144  ExportStruct structWspace;
145  structWspace = useOMP ? ACADO_LOCAL : ACADO_WORKSPACE;
146 
147  LOG( LVL_DEBUG ) << "Preparing to export DiscreteTimeExport... " << endl;
148 
149  ExportIndex run( "run" );
150  ExportIndex i( "i" );
151  ExportIndex j( "j" );
152  ExportIndex k( "k" );
153  ExportIndex tmp_index("tmp_index");
154  diffsDim = NX*(NX+NU);
155  inputDim = NX*(NX+NU+1) + NU + NOD;
156  // setup INTEGRATE function
157  rk_index = ExportVariable( "rk_index", 1, 1, INT, ACADO_LOCAL, true );
158  rk_eta = ExportVariable( "rk_eta", 1, inputDim, REAL );
159  if( equidistantControlGrid() ) {
160  integrate = ExportFunction( "integrate", rk_eta, reset_int );
161  }
162  else {
163  integrate = ExportFunction( "integrate", rk_eta, reset_int, rk_index );
164  }
166  rk_eta.setDoc( "Working array to pass the input values and return the results." );
167  reset_int.setDoc( "The internal memory of the integrator can be reset." );
168  rk_index.setDoc( "Number of the shooting interval." );
169  error_code.setDoc( "Status code of the integrator." );
170  integrate.doc( "Performs the integration and sensitivity propagation for one shooting interval." );
171  integrate.addIndex( run );
172  integrate.addIndex( i );
173  integrate.addIndex( j );
174  integrate.addIndex( k );
175  integrate.addIndex( tmp_index );
176  rhs_in = ExportVariable( "x", inputDim-diffsDim, 1, REAL, ACADO_LOCAL );
177  rhs_out = ExportVariable( "f", NX, 1, REAL, ACADO_LOCAL );
178  fullRhs = ExportFunction( "full_rhs", rhs_in, rhs_out );
179  rhs_in.setDoc( "The state and parameter values." );
180  rhs_out.setDoc( "Right-hand side evaluation." );
181  fullRhs.doc( "Evaluates the right-hand side of the full model." );
182  rk_xxx = ExportVariable( "rk_xxx", 1, inputDim-diffsDim, REAL, structWspace );
183  if( grid.getNumIntervals() > 1 || !equidistantControlGrid() ) {
184  rk_diffsPrev1 = ExportVariable( "rk_diffsPrev1", NX1, NX1+NU, REAL, structWspace );
185  rk_diffsPrev2 = ExportVariable( "rk_diffsPrev2", NX2, NX1+NX2+NU, REAL, structWspace );
186  rk_diffsPrev3 = ExportVariable( "rk_diffsPrev3", NX3, NX+NU, REAL, structWspace );
187  }
188  rk_diffsNew1 = ExportVariable( "rk_diffsNew1", NX1, NX1+NU, REAL, structWspace );
189  rk_diffsNew2 = ExportVariable( "rk_diffsNew2", NX2, NX1+NX2+NU, REAL, structWspace );
190  rk_diffsNew3 = ExportVariable( "rk_diffsNew3", NX3, NX+NU, REAL, structWspace );
191  rk_diffsTemp3 = ExportVariable( "rk_diffsTemp3", NX3, NX1+NX2+NU, REAL, structWspace );
192 
193  ExportVariable numInt( "numInts", 1, 1, INT );
194  if( !equidistantControlGrid() ) {
195  ExportVariable numStepsV( "numSteps", numSteps, STATIC_CONST_INT );
196  integrate.addStatement( std::string( "int " ) + numInt.getName() + " = " + numStepsV.getName() + "[" + rk_index.getName() + "];\n" );
197  }
198 
199  integrate.addStatement( rk_xxx.getCols( NX,inputDim-diffsDim ) == rk_eta.getCols( NX+diffsDim,inputDim ) );
201  // evaluate sensitivities linear input:
202  if( NX1 > 0 ) {
203  for( uint i1 = 0; i1 < NX1; i1++ ) {
204  for( uint i2 = 0; i2 < NX1; i2++ ) {
205  integrate.addStatement( rk_diffsNew1.getSubMatrix(i1,i1+1,i2,i2+1) == A11(i1,i2) );
206  }
207  for( uint i2 = 0; i2 < NU; i2++ ) {
208  integrate.addStatement( rk_diffsNew1.getSubMatrix(i1,i1+1,NX1+i2,NX1+i2+1) == B11(i1,i2) );
209  }
210  }
211  }
212  // evaluate sensitivities linear output:
213  if( NX1 > 0 ) {
214  for( uint i1 = 0; i1 < NX3; i1++ ) {
215  for( uint i2 = 0; i2 < NX3; i2++ ) {
216  integrate.addStatement( rk_diffsNew3.getSubMatrix(i1,i1+1,NX-NX3+i2,NX-NX3+i2+1) == A33(i1,i2) );
217  }
218  }
219  }
221 
222  // integrator loop:
223  ExportForLoop tmpLoop( run, 0, grid.getNumIntervals() );
224  ExportStatementBlock *loop;
225  if( equidistantControlGrid() ) {
226  loop = &tmpLoop;
227  }
228  else {
229  loop = &integrate;
230  loop->addStatement( std::string("for(") + run.getName() + " = 0; " + run.getName() + " < " + numInt.getName() + "; " + run.getName() + "++ ) {\n" );
231  }
232 
233  loop->addStatement( rk_xxx.getCols( 0,NX ) == rk_eta.getCols( 0,NX ) );
234 
235  if( grid.getNumIntervals() > 1 || !equidistantControlGrid() ) {
236  // Set rk_diffsPrev:
237  loop->addStatement( std::string("if( run > 0 ) {\n") );
238  if( NX1 > 0 ) {
239  ExportForLoop loopTemp1( i,0,NX1 );
240  loopTemp1.addStatement( rk_diffsPrev1.getSubMatrix( i,i+1,0,NX1 ) == rk_eta.getCols( i*NX+NX+NXA,i*NX+NX+NXA+NX1 ) );
241  if( NU > 0 ) loopTemp1.addStatement( rk_diffsPrev1.getSubMatrix( i,i+1,NX1,NX1+NU ) == rk_eta.getCols( i*NU+(NX+NXA)*(NX+1),i*NU+(NX+NXA)*(NX+1)+NU ) );
242  loop->addStatement( loopTemp1 );
243  }
244  if( NX2 > 0 ) {
245  ExportForLoop loopTemp2( i,0,NX2 );
246  loopTemp2.addStatement( rk_diffsPrev2.getSubMatrix( i,i+1,0,NX1+NX2 ) == rk_eta.getCols( i*NX+NX+NXA+NX1*NX,i*NX+NX+NXA+NX1*NX+NX1+NX2 ) );
247  if( NU > 0 ) loopTemp2.addStatement( rk_diffsPrev2.getSubMatrix( i,i+1,NX1+NX2,NX1+NX2+NU ) == rk_eta.getCols( i*NU+(NX+NXA)*(NX+1)+NX1*NU,i*NU+(NX+NXA)*(NX+1)+NX1*NU+NU ) );
248  loop->addStatement( loopTemp2 );
249  }
250  if( NX3 > 0 ) {
251  ExportForLoop loopTemp3( i,0,NX3 );
252  loopTemp3.addStatement( rk_diffsPrev3.getSubMatrix( i,i+1,0,NX ) == rk_eta.getCols( i*NX+NX+NXA+(NX1+NX2)*NX,i*NX+NX+NXA+(NX1+NX2)*NX+NX ) );
253  if( NU > 0 ) loopTemp3.addStatement( rk_diffsPrev3.getSubMatrix( i,i+1,NX,NX+NU ) == rk_eta.getCols( i*NU+(NX+NXA)*(NX+1)+(NX1+NX2)*NU,i*NU+(NX+NXA)*(NX+1)+(NX1+NX2)*NU+NU ) );
254  loop->addStatement( loopTemp3 );
255  }
256  loop->addStatement( std::string("}\n") );
257  }
258 
259  // evaluate states:
260  if( NX1 > 0 ) {
261  loop->addFunctionCall( lin_input.getName(), rk_xxx, rk_eta.getAddress(0,0) );
262  }
263  if( NX2 > 0 ) {
264  loop->addFunctionCall( getNameRHS(), rk_xxx, rk_eta.getAddress(0,NX1) );
265  }
266  if( NX3 > 0 ) {
267  loop->addFunctionCall( getNameOutputRHS(), rk_xxx, rk_eta.getAddress(0,NX1+NX2) );
268  }
269 
270  // evaluate sensitivities
271  if( NX2 > 0 ) {
272  loop->addFunctionCall( getNameDiffsRHS(), rk_xxx, rk_diffsNew2.getAddress(0,0) );
273  }
274  if( NX3 > 0 ) {
275  loop->addFunctionCall( getNameOutputDiffs(), rk_xxx, rk_diffsTemp3.getAddress(0,0) );
276  ExportForLoop loop1( i,0,NX3 );
277  ExportForLoop loop2( j,0,NX1+NX2 );
278  loop2.addStatement( rk_diffsNew3.getSubMatrix(i,i+1,j,j+1) == rk_diffsTemp3.getSubMatrix(i,i+1,j,j+1) );
279  loop1.addStatement( loop2 );
280  loop2 = ExportForLoop( j,0,NU );
281  loop2.addStatement( rk_diffsNew3.getSubMatrix(i,i+1,NX+j,NX+j+1) == rk_diffsTemp3.getSubMatrix(i,i+1,NX1+NX2+j,NX1+NX2+j+1) );
282  loop1.addStatement( loop2 );
283  loop->addStatement( loop1 );
284  }
285 
286  // computation of the sensitivities using chain rule:
287  if( grid.getNumIntervals() > 1 || !equidistantControlGrid() ) {
288  loop->addStatement( std::string( "if( run == 0 ) {\n" ) );
289  }
290  // PART 1
291  updateInputSystem(loop, i, j, tmp_index);
292  // PART 2
293  updateImplicitSystem(loop, i, j, tmp_index);
294  // PART 3
295  updateOutputSystem(loop, i, j, tmp_index);
296 
297  if( grid.getNumIntervals() > 1 || !equidistantControlGrid() ) {
298  loop->addStatement( std::string( "}\n" ) );
299  loop->addStatement( std::string( "else {\n" ) );
300  // PART 1
301  propagateInputSystem(loop, i, j, k, tmp_index);
302  // PART 2
303  propagateImplicitSystem(loop, i, j, k, tmp_index);
304  // PART 3
305  propagateOutputSystem(loop, i, j, k, tmp_index);
306  loop->addStatement( std::string( "}\n" ) );
307  }
308 
309  // end of the integrator loop.
310  if( !equidistantControlGrid() ) {
311  loop->addStatement( "}\n" );
312  }
313  else {
314  integrate.addStatement( *loop );
315  }
316  // PART 1
317  if( NX1 > 0 ) {
318  DMatrix zeroR = zeros<double>(1, NX2+NX3);
319  ExportForLoop loop1( i,0,NX1 );
320  loop1.addStatement( rk_eta.getCols( i*NX+NX+NXA+NX1,i*NX+NX+NXA+NX ) == zeroR );
321  integrate.addStatement( loop1 );
322  }
323  // PART 2
324  DMatrix zeroR = zeros<double>(1, NX3);
325  if( NX2 > 0 ) {
326  ExportForLoop loop2( i,NX1,NX1+NX2 );
327  loop2.addStatement( rk_eta.getCols( i*NX+NX+NXA+NX1+NX2,i*NX+NX+NXA+NX ) == zeroR );
328  integrate.addStatement( loop2 );
329  }
330 
331  LOG( LVL_DEBUG ) << "done" << endl;
332 
333  return SUCCESSFUL_RETURN;
334 }
335 
336 
338  )
339 {
340  int useOMP;
341  get(CG_USE_OPENMP, useOMP);
342  if ( useOMP ) {
344  max.setName( "auxVar" );
345  max.setDataStruct( ACADO_LOCAL );
346  if( NX2 > 0 ) {
349  }
350  if( NX3 > 0 ) {
353  }
354 
356 
357  stringstream s;
358  s << "#pragma omp threadprivate( "
359  << max.getFullName() << ", "
360  << rk_xxx.getFullName();
361  if( NX1 > 0 ) {
362  if( grid.getNumIntervals() > 1 || !equidistantControlGrid() ) s << ", " << rk_diffsPrev1.getFullName();
363  s << ", " << rk_diffsNew1.getFullName();
364  }
365  if( NX2 > 0 || NXA > 0 ) {
366  if( grid.getNumIntervals() > 1 || !equidistantControlGrid() ) s << ", " << rk_diffsPrev2.getFullName();
367  s << ", " << rk_diffsNew2.getFullName();
368  }
369  if( NX3 > 0 ) {
370  if( grid.getNumIntervals() > 1 || !equidistantControlGrid() ) s << ", " << rk_diffsPrev3.getFullName();
371  s << ", " << rk_diffsNew3.getFullName();
372  s << ", " << rk_diffsTemp3.getFullName();
373  }
374  s << " )" << endl << endl;
375  code.addStatement( s.str().c_str() );
376  }
377 
378  if( NX1 > 0 ) {
379  code.addFunction( lin_input );
380  code.addStatement( "\n\n" );
381  }
382 
383  if( NX2 > 0 ) {
384  code.addFunction( rhs );
385  code.addStatement( "\n\n" );
386  code.addFunction( diffs_rhs );
387  code.addStatement( "\n\n" );
388  }
389 
390  if( NX3 > 0 ) {
391  code.addFunction( rhs3 );
392  code.addStatement( "\n\n" );
393  code.addFunction( diffs_rhs3 );
394  code.addStatement( "\n\n" );
395  }
396 
397  if( !equidistantControlGrid() ) {
398  ExportVariable numStepsV( "numSteps", numSteps, STATIC_CONST_INT );
399  code.addDeclaration( numStepsV );
400  code.addLinebreak( 2 );
401  }
402  double h = (grid.getLastTime() - grid.getFirstTime())/grid.getNumIntervals();
403  code.addComment(std::string("Fixed step size:") + toString(h));
404 
405  code.addFunction( integrate );
406 
407  return SUCCESSFUL_RETURN;
408 }
409 
410 
412 
413  return RET_INVALID_OPTION;
414 }
415 
416 
417 returnValue DiscreteTimeExport::setupOutput( const std::vector<Grid> outputGrids_, const std::vector<Expression> _rhs ) {
418 
419  return ACADOERROR( RET_INVALID_OPTION );
420 }
421 
422 
423 returnValue DiscreteTimeExport::setupOutput( const std::vector<Grid> outputGrids_,
424  const std::vector<std::string> _outputNames,
425  const std::vector<std::string> _diffs_outputNames,
426  const std::vector<uint> _dims_output ) {
427 
428  return ACADOERROR( RET_INVALID_OPTION );
429 }
430 
431 
432 returnValue DiscreteTimeExport::setupOutput( const std::vector<Grid> outputGrids_,
433  const std::vector<std::string> _outputNames,
434  const std::vector<std::string> _diffs_outputNames,
435  const std::vector<uint> _dims_output,
436  const std::vector<DMatrix> _outputDependencies ) {
437 
438  return ACADOERROR( RET_INVALID_OPTION );
439 }
440 
441 
443  )
444 {
445  if( this != &arg )
446  {
447  clear( );
449  copy( arg );
450  }
451  return *this;
452 }
453 
454 
455 
456 // PROTECTED:
457 
458 //
459 // Register the integrator
460 //
461 
463  const std::string &_commonHeaderName )
464 {
465  return new DiscreteTimeExport(_userInteraction, _commonHeaderName);
466 }
467 
468 
470 {
471  ExportVariable max;
472  if( NX1 > 0 ) {
474  }
475  if( NX2 > 0 ) {
476  if( rhs.getGlobalExportVariable().getDim() >= max.getDim() ) {
478  }
479  if( diffs_rhs.getGlobalExportVariable().getDim() >= max.getDim() ) {
481  }
482  }
483  if( NX3 > 0 ) {
484  if( rhs3.getGlobalExportVariable().getDim() >= max.getDim() ) {
486  }
487  if( diffs_rhs3.getGlobalExportVariable().getDim() >= max.getDim() ) {
489  }
490  }
491 
492  return max;
493 }
494 
495 
497  )
498 {
499  rhs = arg.rhs;
500  diffs_rhs = arg.diffs_rhs;
501 
502  // ExportVariables
503  rk_ttt = arg.rk_ttt;
504  rk_xxx = arg.rk_xxx;
505 
506  // ExportFunctions
507  integrate = arg.integrate;
508 
509  return SUCCESSFUL_RETURN;
510 }
511 
512 
513 
515 
516 // end of file.
ExportVariable rk_diffsPrev1
#define LOG(level)
Just define a handy macro for getting the logger.
Lowest level, the debug level.
virtual returnValue copy(const DiscreteTimeExport &arg)
ExportVariable getAuxVariable() const
ExportVariable getGlobalExportVariable() const
virtual returnValue setupOutput(const std::vector< Grid > outputGrids_, const std::vector< Expression > rhs)
double getFirstTime() const
virtual returnValue updateImplicitSystem(ExportStatementBlock *block, const ExportIndex &index1, const ExportIndex &index2, const ExportIndex &tmp_index)
ExportAcadoFunction diffs_rhs
ExportVariable rk_index
ExportVariable rk_diffsPrev3
Allows to pass back messages to the calling function.
DifferentialState x
Expression forwardDerivative(const Expression &arg1, const Expression &arg2)
returnValue addComment(const std::string &_comment)
virtual returnValue propagateImplicitSystem(ExportStatementBlock *block, const ExportIndex &index1, const ExportIndex &index2, const ExportIndex &_index3, const ExportIndex &tmp_index)
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
Definition: acado_types.hpp:42
ExportVariable rk_diffsPrev2
ExportVariable rhs_out
Allows to export code of a for-loop.
string toString(T const &value)
returnValue setName(const std::string &_name)
Definition: export_data.cpp:61
const std::string getNameOutputDiffs() const
virtual returnValue getFunctionDeclarations(ExportStatementBlock &declarations) const
#define CLOSE_NAMESPACE_ACADO
ExportVariable rk_diffsNew3
ExportVariable getSubMatrix(const ExportIndex &rowIdx1, const ExportIndex &rowIdx2, const ExportIndex &colIdx1, const ExportIndex &colIdx2) const
const std::string getNameDiffsRHS() const
Defines a scalar-valued index variable to be used for exporting code.
ExportAcadoFunction rhs3
ExportVariable rhs_in
Base class for all variables within the symbolic expressions family.
Definition: expression.hpp:56
virtual returnValue getDataDeclarations(ExportStatementBlock &declarations, ExportStruct dataStruct=ACADO_ANY) const
virtual returnValue setDoc(const std::string &_doc)
ExportVariable rk_eta
ExportAcadoFunction diffs_rhs3
ExportStruct
virtual returnValue getCode(ExportStatementBlock &code)
virtual ExportFunction & doc(const std::string &_doc)
DiscreteTimeExport(UserInteraction *_userInteraction=0, const std::string &_commonHeaderName="")
const std::string getNameOutputRHS() const
ExportVariable getCols(const ExportIndex &idx1, const ExportIndex &idx2) const
virtual returnValue setNARXmodel(const uint delay, const DMatrix &parms)
virtual returnValue setup()
const std::string getNameRHS() const
virtual returnValue propagateOutputSystem(ExportStatementBlock *block, const ExportIndex &index1, const ExportIndex &index2, const ExportIndex &index3, const ExportIndex &tmp_index)
ExportVariable reset_int
Allows to export a tailored discrete-time &#39;integrator&#39; for fast model predictive control.
ExportVariable rk_diffsTemp3
Encapsulates all user interaction for setting options, logging data and plotting results.
Allows to export code of an arbitrary function.
virtual uint getDim() const
returnValue setDataStruct(ExportStruct _dataStruct)
Definition: export_data.cpp:80
virtual returnValue propagateInputSystem(ExportStatementBlock *block, const ExportIndex &index1, const ExportIndex &index2, const ExportIndex &index3, const ExportIndex &tmp_index)
returnValue addStatement(const ExportStatement &_statement)
virtual returnValue updateInputSystem(ExportStatementBlock *block, const ExportIndex &index1, const ExportIndex &index2, const ExportIndex &tmp_index)
ExportFunction integrate
std::string getFullName() const
ExportFunction fullRhs
returnValue addLinebreak(uint num=1)
virtual ~DiscreteTimeExport()
Allows to export a tailored integrator for fast model predictive control.
ExportFunction & setReturnValue(const ExportVariable &_functionReturnValue, bool _returnAsPointer=false)
ExportVariable rk_diffsNew2
DiscreteTimeExport & operator=(const DiscreteTimeExport &arg)
uint getNumIntervals() const
returnValue setGlobalExportVariable(const ExportVariable &var)
ExportVariable rk_xxx
DifferentialStateDerivative dx
std::string getName() const
returnValue addDeclaration(const ExportVariable &_data, ExportStruct _dataStruct=ACADO_ANY)
ExportAcadoFunction lin_input
double getLastTime() const
ExportVariable rk_ttt
virtual returnValue setDifferentialEquation(const Expression &rhs)
#define BEGIN_NAMESPACE_ACADO
ExportVariable error_code
returnValue clearStaticCounters()
Definition: expression.hpp:398
returnValue addFunction(const ExportFunction &_function)
IntegratorExport & operator=(const IntegratorExport &arg)
ExportVariable rk_diffsNew1
virtual returnValue clear()
IntegratorExport * createDiscreteTimeExport(UserInteraction *_userInteraction, const std::string &_commonHeaderName)
Allows to export code for a block of statements.
ExportArgument getAddress(const ExportIndex &_rowIdx, const ExportIndex &_colIdx=emptyConstExportIndex) const
virtual returnValue updateOutputSystem(ExportStatementBlock *block, const ExportIndex &index1, const ExportIndex &index2, const ExportIndex &tmp_index)
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.
ExportAcadoFunction rhs
Allows to setup and evaluate differential equations (ODEs and DAEs) based on SymbolicExpressions.
std::string getName() const
Definition: export_data.cpp:86
uint getDim() const


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:34:32