User-interface to formulate and solve model predictive control problems. The class RealTimeAlgorithm serves as a user-interface to formulate and solve model predictive control problems. Usage: >> RealTimeAlgorithm(ocp, samplingTime); Parameters: ocp link to an OCP object [acado.OCP] samplingTime sampling time [NUMERIC] Example: >> ocp = acado.OCP(0.0, 1.0, 20); >> samplingtime = 0.5; >> algo = acado.RealTimeAlgorithm(ocp, samplingtime); 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: 2010
0001 %User-interface to formulate and solve model predictive control problems. 0002 % The class RealTimeAlgorithm serves as a user-interface to formulate and solve 0003 % model predictive control problems. 0004 % 0005 % Usage: 0006 % >> RealTimeAlgorithm(ocp, samplingTime); 0007 % 0008 % Parameters: 0009 % ocp link to an OCP object [acado.OCP] 0010 % samplingTime sampling time [NUMERIC] 0011 % 0012 % Example: 0013 % >> ocp = acado.OCP(0.0, 1.0, 20); 0014 % >> samplingtime = 0.5; 0015 % >> algo = acado.RealTimeAlgorithm(ocp, samplingtime); 0016 % 0017 % Licence: 0018 % This file is part of ACADO Toolkit - (http://www.acadotoolkit.org/) 0019 % 0020 % ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. 0021 % Copyright (C) 2008-2009 by Boris Houska and Hans Joachim Ferreau, K.U.Leuven. 0022 % Developed within the Optimization in Engineering Center (OPTEC) under 0023 % supervision of Moritz Diehl. All rights reserved. 0024 % 0025 % ACADO Toolkit is free software; you can redistribute it and/or 0026 % modify it under the terms of the GNU Lesser General Public 0027 % License as published by the Free Software Foundation; either 0028 % version 3 of the License, or (at your option) any later version. 0029 % 0030 % ACADO Toolkit is distributed in the hope that it will be useful, 0031 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0032 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0033 % Lesser General Public License for more details. 0034 % 0035 % You should have received a copy of the GNU Lesser General Public 0036 % License along with ACADO Toolkit; if not, write to the Free Software 0037 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 0038 % 0039 % Author: David Ariens 0040 % Date: 2010 0041 % 0042 classdef RealTimeAlgorithm < acado.OptimizationAlgorithmBase & acado.ControlLaw 0043 properties(SetAccess='protected') 0044 samplingTime = 0; 0045 end 0046 0047 methods 0048 function obj = RealTimeAlgorithm(varargin) 0049 0050 global ACADO_; 0051 ACADO_.count_optalgo = ACADO_.count_optalgo+1; 0052 obj.name = strcat(obj.name, num2str(ACADO_.count_optalgo)); 0053 0054 if (nargin == 2 && isa(varargin{1}, 'acado.OCP') && isa(varargin{2}, 'numeric')) 0055 obj.ocp = varargin{1}; 0056 obj.samplingTime = acado.DoubleConstant(varargin{2}); 0057 else 0058 error('ERROR: Invalid RealTimeAlgorithm call. See <a href="matlab: help acado.RealTimeAlgorithm">help acado.RealTimeAlgorithm</a>'); 0059 end 0060 0061 ACADO_.helper.addInstruction(obj); 0062 0063 end 0064 0065 getInstructions(obj, cppobj, get) 0066 0067 end 0068 0069 end 0070