230 lines
7.3 KiB
C++
230 lines
7.3 KiB
C++
/*
|
|
* This file is part of ACADO Toolkit.
|
|
*
|
|
* ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
|
|
* Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau,
|
|
* Milan Vukov, Rien Quirynen, KU Leuven.
|
|
* Developed within the Optimization in Engineering Center (OPTEC)
|
|
* under supervision of Moritz Diehl. All rights reserved.
|
|
*
|
|
* ACADO Toolkit is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 3 of the License, or (at your option) any later version.
|
|
*
|
|
* ACADO Toolkit is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with ACADO Toolkit; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
* \file include/acado/integrators/erk_export.hpp
|
|
* \author Rien Quirynen
|
|
* \date 2012
|
|
*/
|
|
|
|
|
|
#ifndef ACADO_TOOLKIT_ERK_EXPORT_HPP
|
|
#define ACADO_TOOLKIT_ERK_EXPORT_HPP
|
|
|
|
#include <acado/code_generation/integrators/rk_export.hpp>
|
|
|
|
|
|
BEGIN_NAMESPACE_ACADO
|
|
|
|
|
|
/**
|
|
* \brief Allows to export a tailored explicit Runge-Kutta integrator for fast model predictive control.
|
|
*
|
|
* \ingroup NumericalAlgorithms
|
|
*
|
|
* The class ExplicitRungeKuttaExport allows to export a tailored explicit Runge-Kutta integrator
|
|
* for fast model predictive control.
|
|
*
|
|
* \author Rien Quirynen
|
|
*/
|
|
class ExplicitRungeKuttaExport : public RungeKuttaExport
|
|
{
|
|
//
|
|
// PUBLIC MEMBER FUNCTIONS:
|
|
//
|
|
|
|
public:
|
|
|
|
/** Default constructor.
|
|
*
|
|
* @param[in] _userInteraction Pointer to corresponding user interface.
|
|
* @param[in] _commonHeaderName Name of common header file to be included.
|
|
*/
|
|
ExplicitRungeKuttaExport( UserInteraction* _userInteraction = 0,
|
|
const std::string& _commonHeaderName = ""
|
|
);
|
|
|
|
/** Copy constructor (deep copy).
|
|
*
|
|
* @param[in] arg Right-hand side object.
|
|
*/
|
|
ExplicitRungeKuttaExport( const ExplicitRungeKuttaExport& arg
|
|
);
|
|
|
|
/** Destructor.
|
|
*/
|
|
virtual ~ExplicitRungeKuttaExport( );
|
|
|
|
|
|
/** Initializes export of a tailored integrator.
|
|
*
|
|
* \return SUCCESSFUL_RETURN
|
|
*/
|
|
virtual returnValue setup( );
|
|
|
|
|
|
/** Assigns Differential Equation to be used by the integrator.
|
|
*
|
|
* @param[in] rhs Right-hand side expression.
|
|
*
|
|
* \return SUCCESSFUL_RETURN
|
|
*/
|
|
|
|
virtual returnValue setDifferentialEquation( const Expression& rhs );
|
|
|
|
|
|
/** .
|
|
*
|
|
* @param[in] .
|
|
*
|
|
* \return SUCCESSFUL_RETURN
|
|
*/
|
|
virtual returnValue setLinearInput( const DMatrix& M1, const DMatrix& A1, const DMatrix& B1 );
|
|
|
|
|
|
/** .
|
|
*
|
|
* @param[in] .
|
|
*
|
|
* \return SUCCESSFUL_RETURN
|
|
*/
|
|
virtual returnValue setLinearOutput( const DMatrix& M3, const DMatrix& A3, const Expression& rhs );
|
|
|
|
|
|
/** .
|
|
*
|
|
* @param[in] .
|
|
*
|
|
* \return SUCCESSFUL_RETURN
|
|
*/
|
|
virtual returnValue setLinearOutput( const DMatrix& M3, const DMatrix& A3, const std::string& _rhs3, const std::string& _diffs_rhs3 );
|
|
|
|
|
|
/** Adds all data declarations of the auto-generated integrator to given list of declarations.
|
|
*
|
|
* @param[in] declarations List of declarations.
|
|
*
|
|
* \return SUCCESSFUL_RETURN
|
|
*/
|
|
virtual returnValue getDataDeclarations( ExportStatementBlock& declarations,
|
|
ExportStruct dataStruct = ACADO_ANY
|
|
) const;
|
|
|
|
|
|
/** Adds all function (forward) declarations of the auto-generated integrator to given list of declarations.
|
|
*
|
|
* @param[in] declarations List of declarations.
|
|
*
|
|
* \return SUCCESSFUL_RETURN
|
|
*/
|
|
virtual returnValue getFunctionDeclarations( ExportStatementBlock& declarations
|
|
) const;
|
|
|
|
|
|
|
|
/** Exports source code of the auto-generated integrator into the given directory.
|
|
*
|
|
* @param[in] code Code block containing the auto-generated integrator.
|
|
*
|
|
* \return SUCCESSFUL_RETURN
|
|
*/
|
|
virtual returnValue getCode( ExportStatementBlock& code
|
|
);
|
|
|
|
|
|
/** Sets up the output with the grids for the different output functions. \n
|
|
* \n
|
|
* \param outputGrids_ The vector containing a grid for each output function. \n
|
|
* \param rhs The expressions corresponding the output functions. \n
|
|
* \n
|
|
* \return SUCCESSFUL_RETURN
|
|
*/
|
|
virtual returnValue setupOutput( const std::vector<Grid> outputGrids_,
|
|
const std::vector<Expression> rhs );
|
|
|
|
|
|
/** Sets up the output with the grids for the different output functions. \n
|
|
* \n
|
|
* \param outputGrids_ The vector containing a grid for each output function. \n
|
|
* \param _outputNames The names of the output functions. \n
|
|
* \param _diffs_outputNames The names of the functions, evaluating the derivatives of the outputs. \n
|
|
* \param _dims_output The dimensions of the output functions. \n
|
|
* \n
|
|
* \return SUCCESSFUL_RETURN
|
|
*/
|
|
virtual returnValue setupOutput( const std::vector<Grid> outputGrids_,
|
|
const std::vector<std::string> _outputNames,
|
|
const std::vector<std::string> _diffs_outputNames,
|
|
const std::vector<uint> _dims_output );
|
|
|
|
|
|
/** Sets up the output with the grids for the different output functions. \n
|
|
* \n
|
|
* \param outputGrids_ The vector containing a grid for each output function. \n
|
|
* \param _outputNames The names of the output functions. \n
|
|
* \param _diffs_outputNames The names of the functions, evaluating the derivatives of the outputs. \n
|
|
* \param _dims_output The dimensions of the output functions. \n
|
|
* \param _outputDependencies A separate dependency matrix for each output. \n
|
|
* \n
|
|
* \return SUCCESSFUL_RETURN
|
|
*/
|
|
virtual returnValue setupOutput( const std::vector<Grid> outputGrids_,
|
|
const std::vector<std::string> _outputNames,
|
|
const std::vector<std::string> _diffs_outputNames,
|
|
const std::vector<uint> _dims_output,
|
|
const std::vector<DMatrix> _outputDependencies );
|
|
|
|
|
|
protected:
|
|
|
|
|
|
/** Returns the largest global export variable.
|
|
*
|
|
* \return SUCCESSFUL_RETURN
|
|
*/
|
|
virtual ExportVariable getAuxVariable() const;
|
|
|
|
|
|
protected:
|
|
|
|
|
|
};
|
|
|
|
CLOSE_NAMESPACE_ACADO
|
|
|
|
|
|
#include <acado/code_generation/integrators/lifted_erk_export.hpp>
|
|
#include <acado/code_generation/integrators/erk_adjoint_export.hpp>
|
|
#include <acado/code_generation/integrators/erk_fob_export.hpp>
|
|
#include <acado/code_generation/integrators/erk_3sweep_export.hpp>
|
|
#include <acado/code_generation/integrators/erk_export.ipp>
|
|
|
|
|
|
#endif // ACADO_TOOLKIT_ERK_EXPORT_HPP
|
|
|
|
// end of file.
|