Home > matlab > acado > packages > +acado > @SimulationEnvironment > init.m

init

PURPOSE ^

Initialization

SYNOPSIS ^

function init(obj, varargin)

DESCRIPTION ^

Initialization

  Usage:
    >> init( r )

  Parameters:
    r   MATRIX with Initialization values     [NUMERIC 1 x n matrix]

  Example:
    >> sim = acado.SimulationEnvironment( 0.0,3.0,process,controller );
    >> r = zeros(1,4);
    >> sim.init( r );

  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:

SOURCE CODE ^

0001 function init(obj, varargin)
0002 %Initialization
0003 %
0004 %  Usage:
0005 %    >> init( r )
0006 %
0007 %  Parameters:
0008 %    r   MATRIX with Initialization values     [NUMERIC 1 x n matrix]
0009 %
0010 %  Example:
0011 %    >> sim = acado.SimulationEnvironment( 0.0,3.0,process,controller );
0012 %    >> r = zeros(1,4);
0013 %    >> sim.init( r );
0014 %
0015 %  Licence:
0016 %    This file is part of ACADO Toolkit  - (http://www.acadotoolkit.org/)
0017 %
0018 %    ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
0019 %    Copyright (C) 2008-2009 by Boris Houska and Hans Joachim Ferreau, K.U.Leuven.
0020 %    Developed within the Optimization in Engineering Center (OPTEC) under
0021 %    supervision of Moritz Diehl. All rights reserved.
0022 %
0023 %    ACADO Toolkit is free software; you can redistribute it and/or
0024 %    modify it under the terms of the GNU Lesser General Public
0025 %    License as published by the Free Software Foundation; either
0026 %    version 3 of the License, or (at your option) any later version.
0027 %
0028 %    ACADO Toolkit is distributed in the hope that it will be useful,
0029 %    but WITHOUT ANY WARRANTY; without even the implied warranty of
0030 %    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0031 %    Lesser General Public License for more details.
0032 %
0033 %    You should have received a copy of the GNU Lesser General Public
0034 %    License along with ACADO Toolkit; if not, write to the Free Software
0035 %    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0036 %
0037 %    Author: David Ariens
0038 %    Date: 2010
0039 %
0040 
0041 if (length(varargin) == 1) 
0042     r = varargin{1};
0043     [rm, rn] = size(r);
0044     
0045     if (rm ~= 1)
0046         error('ERROR: Invalid init(r) call. <a href="matlab: help acado.SimulationEnvironment.init">help acado.SimulationEnvironment.init</a>'); 
0047     end
0048     
0049     obj.initvector = acado.Vector(r);
0050 
0051     
0052 else 
0053    error('ERROR: Invalid init call. <a href="matlab: help acado.SimulationEnvironment.init">help acado.SimulationEnvironment.init</a>'); 
0054 end
0055 
0056 end

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