Home > matlab > acado > packages > +acado > @Controller > Controller.m

Controller

PURPOSE ^

Calculates the control inputs of the Process based on the Process outputs.

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

Calculates the control inputs of the Process based on the Process outputs.
 The class Controller is one of the two main building-blocks within the SimulationEnvironment 
 and complements the Process. It contains an online control law (e.g. a DynamicFeedbackLaw 
 comprising a RealTimeAlgorithm) for obtaining the control inputs of the Process. 
 A state/parameter estimator as well as a ReferenceTrajectory can optionally be used 
 to provide estimated quatities and a reference values to the control law.

  Usage:
    >> Controller(controllaw[, reference]);

  Parameters:
    controllaw     Control law.             [acado.RealTimeAlgorithm]
    reference      Reference generator.     [acado.ReferenceTrajectory]

  Example:
    algo = acado.RealTimeAlgorithm(ocp, 0.05);
    zeroReference = acado.StaticReferenceTrajectory();
    controller = acado.Controller( algo,zeroReference );

  See also:
    acado.RealTimeAlgorithm
    acado.ReferenceTrajectory

  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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 %Calculates the control inputs of the Process based on the Process outputs.
0002 % The class Controller is one of the two main building-blocks within the SimulationEnvironment
0003 % and complements the Process. It contains an online control law (e.g. a DynamicFeedbackLaw
0004 % comprising a RealTimeAlgorithm) for obtaining the control inputs of the Process.
0005 % A state/parameter estimator as well as a ReferenceTrajectory can optionally be used
0006 % to provide estimated quatities and a reference values to the control law.
0007 %
0008 %  Usage:
0009 %    >> Controller(controllaw[, reference]);
0010 %
0011 %  Parameters:
0012 %    controllaw     Control law.             [acado.RealTimeAlgorithm]
0013 %    reference      Reference generator.     [acado.ReferenceTrajectory]
0014 %
0015 %  Example:
0016 %    algo = acado.RealTimeAlgorithm(ocp, 0.05);
0017 %    zeroReference = acado.StaticReferenceTrajectory();
0018 %    controller = acado.Controller( algo,zeroReference );
0019 %
0020 %  See also:
0021 %    acado.RealTimeAlgorithm
0022 %    acado.ReferenceTrajectory
0023 %
0024 %  Licence:
0025 %    This file is part of ACADO Toolkit  - (http://www.acadotoolkit.org/)
0026 %
0027 %    ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
0028 %    Copyright (C) 2008-2009 by Boris Houska and Hans Joachim Ferreau, K.U.Leuven.
0029 %    Developed within the Optimization in Engineering Center (OPTEC) under
0030 %    supervision of Moritz Diehl. All rights reserved.
0031 %
0032 %    ACADO Toolkit is free software; you can redistribute it and/or
0033 %    modify it under the terms of the GNU Lesser General Public
0034 %    License as published by the Free Software Foundation; either
0035 %    version 3 of the License, or (at your option) any later version.
0036 %
0037 %    ACADO Toolkit is distributed in the hope that it will be useful,
0038 %    but WITHOUT ANY WARRANTY; without even the implied warranty of
0039 %    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0040 %    Lesser General Public License for more details.
0041 %
0042 %    You should have received a copy of the GNU Lesser General Public
0043 %    License along with ACADO Toolkit; if not, write to the Free Software
0044 %    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0045 %
0046 %    Author: David Ariens
0047 %    Date: 2010
0048 %
0049 classdef Controller < acado.SimulationBlock   
0050     properties (SetAccess='private')
0051         controllaw;
0052         reference;
0053         name = 'controller';
0054         
0055         init_is_set;
0056         init_startTime;
0057         init_x0;
0058         init_p;
0059         init_y_ref;
0060         
0061         step_startTime;
0062         step_x0;
0063         step_y_ref;
0064         
0065         do_one_step = 0;
0066     end
0067     
0068     methods
0069         function obj = Controller(varargin)
0070             
0071             checkActiveModel;
0072             global ACADO_;
0073             ACADO_.count_other = ACADO_.count_other+1;
0074             obj.name = strcat(obj.name, num2str(ACADO_.count_other));
0075             
0076             if (nargin == 2 && isa(varargin{1}, 'acado.ControlLaw') && isa(varargin{2}, 'acado.ReferenceTrajectory') ) 
0077                 obj.controllaw = varargin{1};   
0078                 obj.reference = varargin{2};
0079                 
0080             elseif (nargin == 1 && isa(varargin{1}, 'acado.ControlLaw')) 
0081                 obj.controllaw = varargin{1};   
0082 
0083             else
0084                error('ERROR: Invalid Controller call. <a href="matlab: help acado.Controller">help acado.Controller</a>'); 
0085             end
0086             
0087             ACADO_.helper.addInstruction(obj);  
0088             
0089             
0090         end
0091         
0092         getInstructions(obj, cppobj, get)
0093         init(obj, varargin)
0094         step(obj, varargin)
0095         
0096     end
0097     
0098 end

www.acadotoolkit.org/matlab
Generated on Tue 01-Jun-2010 20:14:12 by m2html © 2005