Home > matpower4.1 > remove_userfcn.m

remove_userfcn

PURPOSE ^

REMOVE_USERFCN Removes a userfcn from the list to be called for a case.

SYNOPSIS ^

function mpc = remove_userfcn(mpc, stage, fcn)

DESCRIPTION ^

REMOVE_USERFCN Removes a userfcn from the list to be called for a case.
   MPC = REMOVE_USERFCN(MPC, STAGE, FCN)

   A userfcn is a callback function that can be called automatically by
   MATPOWER at one of various stages in a simulation. This function removes
   the last instance of the userfcn for the given STAGE with the function
   handle specified by FCN.

   See also ADD_USERFCN, RUN_USERFCN, TOGGLE_RESERVES, TOGGLE_IFLIMS,
   RUNOPF_W_RES.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function mpc = remove_userfcn(mpc, stage, fcn)
0002 %REMOVE_USERFCN Removes a userfcn from the list to be called for a case.
0003 %   MPC = REMOVE_USERFCN(MPC, STAGE, FCN)
0004 %
0005 %   A userfcn is a callback function that can be called automatically by
0006 %   MATPOWER at one of various stages in a simulation. This function removes
0007 %   the last instance of the userfcn for the given STAGE with the function
0008 %   handle specified by FCN.
0009 %
0010 %   See also ADD_USERFCN, RUN_USERFCN, TOGGLE_RESERVES, TOGGLE_IFLIMS,
0011 %   RUNOPF_W_RES.
0012 
0013 %   MATPOWER
0014 %   $Id: remove_userfcn.m,v 1.9 2010/04/26 19:45:25 ray Exp $
0015 %   by Ray Zimmerman, PSERC Cornell
0016 %   Copyright (c) 2009-2010 by Power System Engineering Research Center (PSERC)
0017 %
0018 %   This file is part of MATPOWER.
0019 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0020 %
0021 %   MATPOWER is free software: you can redistribute it and/or modify
0022 %   it under the terms of the GNU General Public License as published
0023 %   by the Free Software Foundation, either version 3 of the License,
0024 %   or (at your option) any later version.
0025 %
0026 %   MATPOWER is distributed in the hope that it will be useful,
0027 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0028 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0029 %   GNU General Public License for more details.
0030 %
0031 %   You should have received a copy of the GNU General Public License
0032 %   along with MATPOWER. If not, see <http://www.gnu.org/licenses/>.
0033 %
0034 %   Additional permission under GNU GPL version 3 section 7
0035 %
0036 %   If you modify MATPOWER, or any covered work, to interface with
0037 %   other modules (such as MATLAB code and MEX-files) available in a
0038 %   MATLAB(R) or comparable environment containing parts covered
0039 %   under other licensing terms, the licensors of MATPOWER grant
0040 %   you additional permission to convey the resulting work.
0041 
0042 n = length(mpc.userfcn.(stage));
0043 
0044 if have_fcn('octave')
0045     fcn_info = functions(fcn);
0046     for k = n:-1:1
0047         cb_info = functions(mpc.userfcn.(stage)(k).fcn);
0048         if strcmp(cb_info.function, fcn_info.function)
0049             mpc.userfcn.(stage)(k) = [];
0050             break;
0051         end
0052     end
0053 else
0054     for k = n:-1:1
0055         if isequal(mpc.userfcn.(stage)(k).fcn, fcn)
0056             mpc.userfcn.(stage)(k) = [];
0057             break;
0058         end
0059     end
0060 end

Generated on Mon 26-Jan-2015 15:00:13 by m2html © 2005