integrator_export.hpp
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 #ifndef ACADO_TOOLKIT_INTEGRATOR_EXPORT_HPP
36 #define ACADO_TOOLKIT_INTEGRATOR_EXPORT_HPP
37 
40 #include <acado/ocp/model_data.hpp>
42 
43 
45 
46 
58 {
59  //
60  // PUBLIC MEMBER FUNCTIONS:
61  //
62 
63  public:
64 
70  IntegratorExport( UserInteraction* _userInteraction = 0,
71  const std::string& _commonHeaderName = ""
72  );
73 
79  );
80 
83  virtual ~IntegratorExport( );
84 
90  );
91 
92 
97  virtual returnValue setup( ) = 0;
98 
99 
107  virtual returnValue setDifferentialEquation( const Expression& rhs ) = 0;
108 
109 
116  virtual returnValue setLinearInput( const DMatrix& M1, const DMatrix& A1, const DMatrix& B1 );
117 
118 
125  virtual returnValue setLinearOutput( const DMatrix& M3, const DMatrix& A3, const Expression& rhs );
126 
127 
134  virtual returnValue setNonlinearFeedback( const DMatrix& C, const Expression& feedb );
135 
136 
143  virtual returnValue setLinearOutput( const DMatrix& M3, const DMatrix& A3, const std::string& _rhs3, const std::string& _diffs_rhs3 );
144 
145 
154  virtual returnValue setModel( const std::string& _name_ODE,
155  const std::string& _name_diffs_ODE );
156 
157 
166  virtual returnValue setNARXmodel( const uint delay, const DMatrix& parms ) = 0;
167 
168 
175  virtual returnValue setModelData( const ModelData& data );
176 
177 
185  const ExportIndex& index1,
186  const ExportIndex& index2,
187  const ExportIndex& tmp_index );
188 
189 
197  const ExportIndex& index1,
198  const ExportIndex& index2,
199  const ExportIndex& index3,
200  const ExportIndex& tmp_index );
201 
202 
210  const ExportIndex& index1,
211  const ExportIndex& index2,
212  const ExportIndex& tmp_index );
213 
214 
222  const ExportIndex& index1,
223  const ExportIndex& index2,
224  const ExportIndex& _index3,
225  const ExportIndex& tmp_index );
226 
227 
235  const ExportIndex& index1,
236  const ExportIndex& index2,
237  const ExportIndex& tmp_index );
238 
239 
247  const ExportIndex& index1,
248  const ExportIndex& index2,
249  const ExportIndex& index3,
250  const ExportIndex& tmp_index );
251 
252 
259  virtual returnValue setGrid( const Grid& _grid );
260 
261 
269  ExportStruct dataStruct = ACADO_ANY
270  ) const = 0;
271 
272 
280  ) const = 0;
281 
282 
283 
291  ) = 0;
292 
293 
301  virtual returnValue setupOutput( const std::vector<Grid> outputGrids_,
302  const std::vector<Expression> rhs ) = 0;
303 
304 
314  virtual returnValue setupOutput( const std::vector<Grid> outputGrids_,
315  const std::vector<std::string> _outputNames,
316  const std::vector<std::string> _diffs_outputNames,
317  const std::vector<uint> _dims_output ) = 0;
318 
319 
330  virtual returnValue setupOutput( const std::vector<Grid> outputGrids_,
331  const std::vector<std::string> _outputNames,
332  const std::vector<std::string> _diffs_outputNames,
333  const std::vector<uint> _dims_output,
334  const std::vector<DMatrix> _outputDependencies ) = 0;
335 
336 
341  virtual returnValue getGrid( Grid& grid_ ) const;
342 
343 
348  virtual returnValue getNumSteps( DVector& _numSteps ) const;
349 
350 
355  virtual returnValue getOutputExpressions( std::vector<Expression>& outputExpressions_ ) const;
356 
357 
362  virtual returnValue getOutputGrids( std::vector<Grid>& outputGrids_ ) const;
363 
364 
369  virtual bool equidistantControlGrid( ) const;
370 
371 
372  const std::string getNameRHS() const;
373  const std::string getNameDiffsRHS() const;
374  virtual const std::string getNameFullRHS() const;
375 
376  const std::string getNameOutputRHS() const;
377  const std::string getNameOutputDiffs() const;
378 
379  const std::string getNameOUTPUT( uint index ) const;
380  const std::string getNameDiffsOUTPUT( uint index ) const;
381  uint getDimOUTPUT( uint index ) const;
382 
383 
384 
385  protected:
386 
387 
394  DMatrix expandOutputMatrix( const DMatrix& A3 );
395 
396 
403  virtual returnValue copy( const IntegratorExport& arg
404  );
405 
406 
411  virtual returnValue clear( );
412 
413 
420  uint getIntegrationInterval( double time );
421 
422 
427  virtual ExportVariable getAuxVariable() const = 0;
428 
429 
430  protected:
431 
437 
442 
445 
446  bool exportRhs;
447  bool crsFormat;
455 
461 
464 
474 
481 
488  std::vector<Grid> outputGrids;
489  std::vector<Expression> outputExpressions;
490  std::vector<DMatrix> outputDependencies;
491  std::vector<ExportAcadoFunction> outputs;
492  std::vector<ExportAcadoFunction> diffs_outputs;
494  std::vector<uint> num_outputs;
495 };
496 
499 
501 typedef std::shared_ptr< IntegratorExport > IntegratorExportPtr;
502 
504 
505 
506 #endif // ACADO_TOOLKIT_INTEGRATOR_EXPORT_HPP
507 
508 // end of file.
ExportVariable rk_diffsPrev1
virtual returnValue setLinearOutput(const DMatrix &M3, const DMatrix &A3, const Expression &rhs)
uint getIntegrationInterval(double time)
#define B1
virtual returnValue getCode(ExportStatementBlock &code)=0
virtual returnValue getNumSteps(DVector &_numSteps) const
std::shared_ptr< IntegratorExport > IntegratorExportPtr
Factory for creation of exported algorithms.
std::vector< Grid > outputGrids
Allows to export code of an ACADO function.
virtual returnValue updateImplicitSystem(ExportStatementBlock *block, const ExportIndex &index1, const ExportIndex &index2, const ExportIndex &tmp_index)
ExportAcadoFunction diffs_rhs
ExportVariable rk_index
std::vector< ExportAcadoFunction > outputs
ExportVariable rk_diffsPrev3
Allows to pass back messages to the calling function.
virtual returnValue setModel(const std::string &_name_ODE, const std::string &_name_diffs_ODE)
DifferentialState x
virtual returnValue setGrid(const Grid &_grid)
Block< Derived > block(Index startRow, Index startCol, Index blockRows, Index blockCols)
Definition: BlockMethods.h:56
std::vector< DMatrix > outputDependencies
const std::string getNameOUTPUT(uint index) const
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
std::vector< ExportAcadoFunction > diffs_outputs
virtual ExportVariable getAuxVariable() const =0
ExportVariable rk_diffsPrev2
Allows to conveniently handle (one-dimensional) grids consisting of time points.
Definition: grid.hpp:58
DMatrix expandOutputMatrix(const DMatrix &A3)
ExportVariable rhs_out
#define A1
const std::string getNameDiffsOUTPUT(uint index) const
const std::string getNameOutputDiffs() const
virtual returnValue setNonlinearFeedback(const DMatrix &C, const Expression &feedb)
ExportAlgorithmFactory< IntegratorExport, ExportIntegratorType > IntegratorExportFactory
ExportVariable rk_diffsTemp2
#define CLOSE_NAMESPACE_ACADO
ExportVariable rk_diffsNew3
Data class for defining models and everything that is related, to be passed to the integrator...
Definition: model_data.hpp:52
const std::string getNameDiffsRHS() const
Defines a scalar-valued index variable to be used for exporting code.
virtual returnValue setNARXmodel(const uint delay, const DMatrix &parms)=0
ExportAcadoFunction rhs3
virtual returnValue getFunctionDeclarations(ExportStatementBlock &declarations) const =0
IntegratorExport(UserInteraction *_userInteraction=0, const std::string &_commonHeaderName="")
ExportVariable rhs_in
Base class for all variables within the symbolic expressions family.
Definition: expression.hpp:56
Allows to export automatically generated algorithms for fast model predictive control.
ExportVariable rk_eta
virtual returnValue getDataDeclarations(ExportStatementBlock &declarations, ExportStruct dataStruct=ACADO_ANY) const =0
ExportAcadoFunction diffs_rhs3
ExportStruct
std::vector< Expression > outputExpressions
const std::string getNameOutputRHS() const
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
virtual returnValue setLinearInput(const DMatrix &M1, const DMatrix &A1, const DMatrix &B1)
Encapsulates all user interaction for setting options, logging data and plotting results.
Allows to export code of an arbitrary function.
virtual returnValue propagateInputSystem(ExportStatementBlock *block, const ExportIndex &index1, const ExportIndex &index2, const ExportIndex &index3, const ExportIndex &tmp_index)
virtual returnValue updateInputSystem(ExportStatementBlock *block, const ExportIndex &index1, const ExportIndex &index2, const ExportIndex &tmp_index)
ExportFunction integrate
ExportFunction fullRhs
virtual returnValue copy(const IntegratorExport &arg)
std::vector< uint > num_outputs
uint getDimOUTPUT(uint index) const
Allows to export a tailored integrator for fast model predictive control.
ExportVariable rk_diffsNew2
virtual returnValue setModelData(const ModelData &data)
ExportVariable rk_xxx
DifferentialStateDerivative dx
virtual returnValue getGrid(Grid &grid_) const
ExportAcadoFunction lin_input
virtual returnValue getOutputGrids(std::vector< Grid > &outputGrids_) const
ExportVariable rk_ttt
#define BEGIN_NAMESPACE_ACADO
virtual const std::string getNameFullRHS() const
ExportVariable error_code
virtual returnValue setupOutput(const std::vector< Grid > outputGrids_, const std::vector< Expression > rhs)=0
IntegratorExport & operator=(const IntegratorExport &arg)
ExportVariable rk_diffsNew1
virtual returnValue setup()=0
virtual returnValue setDifferentialEquation(const Expression &rhs)=0
virtual returnValue clear()
Allows to export code for a block of statements.
virtual returnValue getOutputExpressions(std::vector< Expression > &outputExpressions_) const
virtual returnValue updateOutputSystem(ExportStatementBlock *block, const ExportIndex &index1, const ExportIndex &index2, const ExportIndex &tmp_index)
virtual bool equidistantControlGrid() const
Defines a matrix-valued variable to be used for exporting code.
ExportAcadoFunction rhs


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