Home > matpower5.0 > extras > sdp_pf > recoverFromW.m

recoverFromW

PURPOSE ^

RECOVERFROMW Carries out a trace operation on the decomposed matrices

SYNOPSIS ^

function [quantity] = recoverFromW(sdpmat, Wref_dd, Wref_qq, Wref_dq, matidx_dd, matidx_qq, matidx_dq, W, maxclique)

DESCRIPTION ^

RECOVERFROMW Carries out a trace operation on the decomposed matrices
   [QUANTITY] = RECOVERFROMW(SDPMAT, WREF_DD, WREF_QQ, WREF_DQ, MATIDX_DD, MATIDX_QQ, MATIDX_DQ, W, SDPVAR, MAXCLIQUE)

   Calculates trace(sdpmat*W) for the decomposed matrices.

   Inputs:
       SDPMAT : A 2*nbus by 2*nbus matrix.
       WREF_DD : Matrix with three columns. The first column is a 
           numbering 1:size(Wref_dd,1). The second and third columns 
           indicate the row and column indices of the elements of the 
           matrix sdpmat, with the row of Wref_dd corresponding to the 
           index of matidx_dd. That is, the element of sdpmat located in 
           row Wref_dd(i,1), column Wref_dd(i,2) corresponds to 
           matidx_dd(i).
       WREF_QQ : Similar to Wref_dd, except for the qq entries of sdpmat.
       WREF_DQ : Similar to Wref_dd, except for the dq entries of sdpmat.
       MATIDX_DD : Matrix with three columns. Row i of matidx_dd indicates
           the location of sdpmat(Wref_dd(i,1), Wref_dd(i,2)). The first
           column indicates the index of the corresponding matrix. The
           second and third columns indicate the row and column,
           respectively, of the corresponding matrix. 
       MATIDX_QQ : Similar to matidx_dd, except corresponding to the qq 
           entries of sdpmat.
       MATIDX_DQ : Similar to matidx_dd, except corresponding to the dq 
           entries of sdpmat.
       W : Cell array of decomposed W matrices corresponding to maxclique.
       SDPVAR : SDP variable (sdpvar) that will be multiplied by sdpmat
           and added to the decomposed A matrices.
       MAXCLIQUE : Cell array of the buses in each maximal clique.

   Outputs:
       QUANTITY : trace(sdpmat*W), the equivalent to a trace operation on
           the 2*nbus by 2*nbus W matrix using the decomposed matrices.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [quantity] = recoverFromW(sdpmat, Wref_dd, Wref_qq, Wref_dq, matidx_dd, matidx_qq, matidx_dq, W, maxclique)
0002 %RECOVERFROMW Carries out a trace operation on the decomposed matrices
0003 %   [QUANTITY] = RECOVERFROMW(SDPMAT, WREF_DD, WREF_QQ, WREF_DQ, MATIDX_DD, MATIDX_QQ, MATIDX_DQ, W, SDPVAR, MAXCLIQUE)
0004 %
0005 %   Calculates trace(sdpmat*W) for the decomposed matrices.
0006 %
0007 %   Inputs:
0008 %       SDPMAT : A 2*nbus by 2*nbus matrix.
0009 %       WREF_DD : Matrix with three columns. The first column is a
0010 %           numbering 1:size(Wref_dd,1). The second and third columns
0011 %           indicate the row and column indices of the elements of the
0012 %           matrix sdpmat, with the row of Wref_dd corresponding to the
0013 %           index of matidx_dd. That is, the element of sdpmat located in
0014 %           row Wref_dd(i,1), column Wref_dd(i,2) corresponds to
0015 %           matidx_dd(i).
0016 %       WREF_QQ : Similar to Wref_dd, except for the qq entries of sdpmat.
0017 %       WREF_DQ : Similar to Wref_dd, except for the dq entries of sdpmat.
0018 %       MATIDX_DD : Matrix with three columns. Row i of matidx_dd indicates
0019 %           the location of sdpmat(Wref_dd(i,1), Wref_dd(i,2)). The first
0020 %           column indicates the index of the corresponding matrix. The
0021 %           second and third columns indicate the row and column,
0022 %           respectively, of the corresponding matrix.
0023 %       MATIDX_QQ : Similar to matidx_dd, except corresponding to the qq
0024 %           entries of sdpmat.
0025 %       MATIDX_DQ : Similar to matidx_dd, except corresponding to the dq
0026 %           entries of sdpmat.
0027 %       W : Cell array of decomposed W matrices corresponding to maxclique.
0028 %       SDPVAR : SDP variable (sdpvar) that will be multiplied by sdpmat
0029 %           and added to the decomposed A matrices.
0030 %       MAXCLIQUE : Cell array of the buses in each maximal clique.
0031 %
0032 %   Outputs:
0033 %       QUANTITY : trace(sdpmat*W), the equivalent to a trace operation on
0034 %           the 2*nbus by 2*nbus W matrix using the decomposed matrices.
0035 
0036 %   MATPOWER
0037 %   $Id: recoverFromW.m 2272 2014-01-17 14:15:47Z ray $
0038 %   by Daniel Molzahn, PSERC U of Wisc, Madison
0039 %   Copyright (c) 2013-2014 by Power System Engineering Research Center (PSERC)
0040 %
0041 %   This file is part of MATPOWER.
0042 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0043 %
0044 %   MATPOWER is free software: you can redistribute it and/or modify
0045 %   it under the terms of the GNU General Public License as published
0046 %   by the Free Software Foundation, either version 3 of the License,
0047 %   or (at your option) any later version.
0048 %
0049 %   MATPOWER is distributed in the hope that it will be useful,
0050 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0051 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0052 %   GNU General Public License for more details.
0053 %
0054 %   You should have received a copy of the GNU General Public License
0055 %   along with MATPOWER. If not, see <http://www.gnu.org/licenses/>.
0056 %
0057 %   Additional permission under GNU GPL version 3 section 7
0058 %
0059 %   If you modify MATPOWER, or any covered work, to interface with
0060 %   other modules (such as MATLAB code and MEX-files) available in a
0061 %   MATLAB(R) or comparable environment containing parts covered
0062 %   under other licensing terms, the licensors of MATPOWER grant
0063 %   you additional permission to convey the resulting work.
0064 
0065 [Ykvec] = mat2vec(sdpmat, Wref_dd, Wref_qq, Wref_dq, matidx_dd, matidx_qq, matidx_dq);
0066 
0067 Wmats = unique(Ykvec(:,1));
0068 quantity = 0;
0069 for m=1:length(Wmats)
0070     Ykvec_rows = find(Ykvec(:,1) == Wmats(m));
0071     quantity = quantity + trace(W{Wmats(m)} * sparse(Ykvec(Ykvec_rows,2),Ykvec(Ykvec_rows,3),Ykvec(Ykvec_rows,4),2*length(maxclique{Wmats(m)}),2*length(maxclique{Wmats(m)})));
0072 end

Generated on Mon 26-Jan-2015 15:21:31 by m2html © 2005