


The class DifferentialEquation allows to setup and evaluate differential equations (ODEs) based on SymbolicExpressions.
Usage:
>> DifferentialEquation();
>> DifferentialEquation(tStart, tEnd);
Parameters:
tStart start of the time horizon of the diff eq [NUMERIC / PARAMETER]
tEnd end of the time horizon of the diff eq [NUMERIC / PARAMETER]
Example:
>> f = acado.DifferentialEquation();
>> f = acado.DifferentialEquation(0.0, 10.0);
See also:
acado.DifferentialEquation.add Adds a differential equation in symbolic syntax
acado.DifferentialEquation.linkMatlabODE Links a matlab black box model
acado.DifferentialEquation.linkMatlabDAE
acado.DifferentialEquation.linkCFunction Links a c function
Licence:
This file is part of ACADO Toolkit - (http://www.acadotoolkit.org/)
ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
Copyright (C) 2008-2009 by Boris Houska and Hans Joachim Ferreau, K.U.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
Author: David Ariens
Date: 2009-2010


0001 %The class DifferentialEquation allows to setup and evaluate differential equations (ODEs) based on SymbolicExpressions. 0002 % 0003 % Usage: 0004 % >> DifferentialEquation(); 0005 % >> DifferentialEquation(tStart, tEnd); 0006 % 0007 % Parameters: 0008 % tStart start of the time horizon of the diff eq [NUMERIC / PARAMETER] 0009 % tEnd end of the time horizon of the diff eq [NUMERIC / PARAMETER] 0010 % 0011 % Example: 0012 % >> f = acado.DifferentialEquation(); 0013 % >> f = acado.DifferentialEquation(0.0, 10.0); 0014 % 0015 % See also: 0016 % acado.DifferentialEquation.add Adds a differential equation in symbolic syntax 0017 % acado.DifferentialEquation.linkMatlabODE Links a matlab black box model 0018 % acado.DifferentialEquation.linkMatlabDAE 0019 % acado.DifferentialEquation.linkCFunction Links a c function 0020 % 0021 % Licence: 0022 % This file is part of ACADO Toolkit - (http://www.acadotoolkit.org/) 0023 % 0024 % ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. 0025 % Copyright (C) 2008-2009 by Boris Houska and Hans Joachim Ferreau, K.U.Leuven. 0026 % Developed within the Optimization in Engineering Center (OPTEC) under 0027 % supervision of Moritz Diehl. All rights reserved. 0028 % 0029 % ACADO Toolkit is free software; you can redistribute it and/or 0030 % modify it under the terms of the GNU Lesser General Public 0031 % License as published by the Free Software Foundation; either 0032 % version 3 of the License, or (at your option) any later version. 0033 % 0034 % ACADO Toolkit is distributed in the hope that it will be useful, 0035 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0036 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0037 % Lesser General Public License for more details. 0038 % 0039 % You should have received a copy of the GNU Lesser General Public 0040 % License along with ACADO Toolkit; if not, write to the Free Software 0041 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 0042 % 0043 % Author: David Ariens 0044 % Date: 2009-2010 0045 % 0046 classdef DifferentialEquation < acado.Function 0047 properties(SetAccess='private') 0048 tStart; 0049 tEnd; 0050 0051 %MATLAB ODE/DAE/Jac 0052 matlabODE_fcnHandle = ''; 0053 matlabDAE_fcnHandle = ''; 0054 matlabJacobian_fcnHandle = ''; 0055 matlablinkcount = 0; 0056 0057 cfunction_file = ''; 0058 cfunction_function = ''; 0059 0060 % Differential eq 0061 differentialList = {}; 0062 end 0063 0064 methods 0065 function obj = DifferentialEquation(varargin) 0066 checkActiveModel; 0067 0068 if (nargin == 2) 0069 0070 if (isa(varargin{1}, 'acado.Expression')) 0071 obj.tStart = varargin{1}; 0072 else 0073 obj.tStart = acado.DoubleConstant(varargin{1}); 0074 end 0075 0076 if (isa(varargin{2}, 'acado.Expression')) 0077 obj.tEnd = varargin{2}; 0078 else 0079 obj.tEnd = acado.DoubleConstant(varargin{2}); 0080 end 0081 0082 end 0083 0084 global ACADO_; 0085 obj.matlablinkcount = ACADO_.count_function; 0086 0087 end 0088 0089 0090 linkMatlabODE(obj, varargin) 0091 linkMatlabJacobian(obj, fcnHandle) 0092 linkCFunction(obj, fcnfile, fcnname) 0093 ODE(obj, varargin) 0094 add(obj, varargin) 0095 getInstructions(obj, cppobj, get) 0096 0097 function r = getHeader(obj) 0098 0099 if (~isempty(obj.tStart) && ~isempty(obj.tEnd)) 0100 r = sprintf('DifferentialEquation %s(%s, %s)',obj.name, obj.tStart.name, obj.tEnd.name); 0101 0102 else 0103 r = sprintf('DifferentialEquation %s',obj.name); 0104 end 0105 0106 end 0107 end 0108 0109 end 0110