Home > matpower5.1 > extras > se > isobservable.m

isobservable

PURPOSE ^

ISOBSERVABLE Test for observability.

SYNOPSIS ^

function TorF = isobservable(H, pv, pq)

DESCRIPTION ^

ISOBSERVABLE  Test for observability.
   returns 1 if the system is observable, 0 otherwise.
   created by Rui Bo on Jan 9, 2010

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function TorF = isobservable(H, pv, pq)
0002 %ISOBSERVABLE  Test for observability.
0003 %   returns 1 if the system is observable, 0 otherwise.
0004 %   created by Rui Bo on Jan 9, 2010
0005 
0006 %   MATPOWER
0007 %   Copyright (c) 2009-2015 by Power System Engineering Research Center (PSERC)
0008 %   by Rui Bo
0009 %
0010 %   $Id: isobservable.m 2644 2015-03-11 19:34:22Z ray $
0011 %
0012 %   This file is part of MATPOWER.
0013 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0014 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0015 
0016 %% options
0017 tol     = 1e-5; % mpopt.pf.tol;
0018 check_reason = 1;    % check reason for system being not observable
0019                     % 0: no check
0020                     % 1: check (NOTE: may be time consuming due to svd calculation)
0021 
0022 %% test if H is full rank
0023 [m, n]  = size(H);
0024 r       = rank(H);
0025 if r < min(m, n)
0026     TorF = 0;
0027 else
0028     TorF = 1;
0029 end
0030 
0031 %% look for reasons for system being not observable
0032 if check_reason && ~TorF
0033     %% look for variables not being observed
0034     idx_trivialColumns = [];
0035     varNames = {};
0036     for j = 1:n
0037         normJ = norm(H(:, j), inf);
0038         if normJ < tol % found a zero column
0039             idx_trivialColumns = [idx_trivialColumns j];
0040             varName = getVarName(j, pv, pq);
0041             varNames{length(idx_trivialColumns)} = varName;
0042         end
0043     end
0044 
0045     if ~isempty(idx_trivialColumns) % found zero-valued column vector
0046         fprintf('Warning: The following variables are not observable since they are not related with any measurement!');
0047         varNames
0048         idx_trivialColumns
0049     else % no zero-valued column vector
0050         %% look for dependent column vectors
0051         for j = 1:n
0052             rr = rank(H(:, 1:j));
0053             if rr ~= j % found dependent column vector
0054                 %% look for linearly depedent vector
0055                 colJ = H(:, j); % j(th) column of H
0056                 varJName = getVarName(j, pv, pq);
0057                 for k = 1:j-1
0058                     colK = H(:, k);
0059                     if rank([colK colJ]) < 2 % k(th) column vector is linearly dependent of j(th) column vector
0060                         varKName = getVarName(k, pv, pq);
0061                         fprintf('Warning: %d(th) column vector (w.r.t. %s) of H is linearly dependent of %d(th) column vector (w.r.t. %s)!\n', j, varJName, k, varKName);
0062                         return;
0063                     end
0064                 end
0065             end
0066         end
0067     fprintf('Warning: No specific reason was found for system being not observable.\n');
0068     end
0069 end

Generated on Fri 20-Mar-2015 18:23:34 by m2html © 2005