Home > matlab > acado > packages > +acado > @OptimizationAlgorithmBase > getSetInitInstructions.m

getSetInitInstructions

PURPOSE ^

Used to generate CPP file (called by getInstructions of child classes of

SYNOPSIS ^

function getSetInitInstructions(obj, cppobj)

DESCRIPTION ^

Used to generate CPP file (called by getInstructions of child classes of
optimizationalgorithmbase

  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 getSetInitInstructions(obj, cppobj)
0002 %Used to generate CPP file (called by getInstructions of child classes of
0003 %optimizationalgorithmbase
0004 %
0005 %  Licence:
0006 %    This file is part of ACADO Toolkit  - (http://www.acadotoolkit.org/)
0007 %
0008 %    ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
0009 %    Copyright (C) 2008-2009 by Boris Houska and Hans Joachim Ferreau, K.U.Leuven.
0010 %    Developed within the Optimization in Engineering Center (OPTEC) under
0011 %    supervision of Moritz Diehl. All rights reserved.
0012 %
0013 %    ACADO Toolkit is free software; you can redistribute it and/or
0014 %    modify it under the terms of the GNU Lesser General Public
0015 %    License as published by the Free Software Foundation; either
0016 %    version 3 of the License, or (at your option) any later version.
0017 %
0018 %    ACADO Toolkit is distributed in the hope that it will be useful,
0019 %    but WITHOUT ANY WARRANTY; without even the implied warranty of
0020 %    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0021 %    Lesser General Public License for more details.
0022 %
0023 %    You should have received a copy of the GNU Lesser General Public
0024 %    License along with ACADO Toolkit; if not, write to the Free Software
0025 %    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0026 %
0027 %    Author: David Ariens
0028 %    Date: 2010
0029 %
0030 
0031     
0032     for i=1:length(obj.set_n)
0033         fprintf(cppobj.fileMEX,sprintf('    %s.set( %s, %s );\n', obj.name, obj.set_n{i}, stringIntDouble(obj.set_v{i})));               
0034     end
0035 
0036     if (~isempty(obj.initdiffstates))     %init diff states
0037         fprintf(cppobj.fileMEX,sprintf('    %s.initializeDifferentialStates( %s );\n', obj.name, obj.initdiffstates.name));  
0038     end
0039     
0040     if (~isempty(obj.initalgstates))     %init alg states
0041         fprintf(cppobj.fileMEX,sprintf('    %s.initializeAlgebraicStates( %s );\n', obj.name, obj.initalgstates.name));  
0042     end
0043     
0044     if (~isempty(obj.initcontrols))     %init controls
0045         fprintf(cppobj.fileMEX,sprintf('    %s.initializeControls( %s );\n', obj.name, obj.initcontrols.name));  
0046     end
0047 
0048     if (~isempty(obj.initparameters))     %init parameters
0049         fprintf(cppobj.fileMEX,sprintf('    %s.initializeParameters( %s );\n', obj.name, obj.initparameters.name));  
0050     end
0051 
0052     if (~isempty(obj.initdisturbances))    %init disturbances
0053         fprintf(cppobj.fileMEX,sprintf('    %s.initializeDisturbances( %s );\n', obj.name, obj.initdisturbances.name));  
0054     end
0055 
0056 
0057 end

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