Home > matpower7.1 > extras > syngrid > lib > sgvm_get_max_iter.m

sgvm_get_max_iter

PURPOSE ^

SGVM_GET_MAX_ITER get the maximum iteration based on the AC solver.

SYNOPSIS ^

function maxit = sgvm_get_max_iter(mpopt, default)

DESCRIPTION ^

SGVM_GET_MAX_ITER get the maximum iteration based on the AC solver.
   MAXIT = SGVM_GET_MAX_ITER(MPOPT, DEFAULT)

   If a number is not returned, i.e. maxiter is not set the DEFAULT is
   used.
   If DEFAULT is not given 150 is return. Note that this may NOT be the
   actual default that will be used by the algorithm!!!!

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function maxit = sgvm_get_max_iter(mpopt, default)
0002 %SGVM_GET_MAX_ITER get the maximum iteration based on the AC solver.
0003 %   MAXIT = SGVM_GET_MAX_ITER(MPOPT, DEFAULT)
0004 %
0005 %   If a number is not returned, i.e. maxiter is not set the DEFAULT is
0006 %   used.
0007 %   If DEFAULT is not given 150 is return. Note that this may NOT be the
0008 %   actual default that will be used by the algorithm!!!!
0009 
0010 %   SynGrid
0011 %   Copyright (c) 2018, Power Systems Engineering Research Center (PSERC)
0012 %   by Eran Schweitzer, Arizona State University
0013 %
0014 %   This file is part of SynGrid.
0015 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0016 
0017 if nargin < 2
0018     default = 150;
0019 end
0020 
0021 try
0022   switch mpopt.opf.ac.solver
0023     case {'DEFAULT', 'MIPS'}
0024       maxit = mpopt.mips.max_it;
0025     case 'IPOPT'
0026       maxit = mpopt.ipopt.opts.max_iter;
0027     case 'KNITRO'
0028       maxit = mpopt.knitro.maxit;
0029     case 'FMINCON'
0030       maxit = mpopt.fmincon.max_it;
0031   end
0032 catch
0033     maxit = default;
0034 end

Generated on Fri 09-Oct-2020 11:21:31 by m2html © 2005