Home > matpower4.0 > extras > se > run_se.m

run_se

PURPOSE ^

RUN_SE Run state estimation.

SYNOPSIS ^

function [baseMVA, bus, gen, branch, success, et, z, z_est, error_sqrsum] = run_se(casename, measure, idx, sigma, type_initialguess, V0)

DESCRIPTION ^

RUN_SE  Run state estimation.
   [INPUT PARAMETERS]
   measure: measurements
   idx: measurement indices
   sigma: measurement variances
   [OUTPUT PARAMETERS]
   z: Measurement Vector. In the order of PF, PT, PG, Va, QF, QT, QG, Vm (if
   applicable), so it has ordered differently from original measurements
   z_est: Estimated Vector. In the order of PF, PT, PG, Va, QF, QT, QG, Vm
   (if applicable)
   error_sqrsum: Weighted sum of error squares
   created by Rui Bo on 2007/11/12

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [baseMVA, bus, gen, branch, success, et, z, z_est, error_sqrsum] = run_se(casename, measure, idx, sigma, type_initialguess, V0)
0002 %RUN_SE  Run state estimation.
0003 %   [INPUT PARAMETERS]
0004 %   measure: measurements
0005 %   idx: measurement indices
0006 %   sigma: measurement variances
0007 %   [OUTPUT PARAMETERS]
0008 %   z: Measurement Vector. In the order of PF, PT, PG, Va, QF, QT, QG, Vm (if
0009 %   applicable), so it has ordered differently from original measurements
0010 %   z_est: Estimated Vector. In the order of PF, PT, PG, Va, QF, QT, QG, Vm
0011 %   (if applicable)
0012 %   error_sqrsum: Weighted sum of error squares
0013 %   created by Rui Bo on 2007/11/12
0014 
0015 %   MATPOWER
0016 %   $Id: run_se.m,v 1.4 2010/04/26 19:45:26 ray Exp $
0017 %   by Rui Bo
0018 %   and Ray Zimmerman, PSERC Cornell
0019 %   Copyright (c) 1996-2010 by Power System Engineering Research Center (PSERC)
0020 %   Copyright (c) 2009-2010 by Rui Bo
0021 %
0022 %   This file is part of MATPOWER.
0023 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0024 %
0025 %   MATPOWER is free software: you can redistribute it and/or modify
0026 %   it under the terms of the GNU General Public License as published
0027 %   by the Free Software Foundation, either version 3 of the License,
0028 %   or (at your option) any later version.
0029 %
0030 %   MATPOWER is distributed in the hope that it will be useful,
0031 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0032 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0033 %   GNU General Public License for more details.
0034 %
0035 %   You should have received a copy of the GNU General Public License
0036 %   along with MATPOWER. If not, see <http://www.gnu.org/licenses/>.
0037 %
0038 %   Additional permission under GNU GPL version 3 section 7
0039 %
0040 %   If you modify MATPOWER, or any covered work, to interface with
0041 %   other modules (such as MATLAB code and MEX-files) available in a
0042 %   MATLAB(R) or comparable environment containing parts covered
0043 %   under other licensing terms, the licensors of MATPOWER grant
0044 %   you additional permission to convey the resulting work.
0045 
0046 %% read data & convert to internal bus numbering
0047 [baseMVA, bus, gen, branch] = loadcase(casename);
0048 [i2e, bus, gen, branch] = ext2int(bus, gen, branch);
0049 
0050 %% get bus index lists of each type of bus
0051 [ref, pv, pq] = bustypes(bus, gen);
0052 
0053 %% build admittance matrices
0054 [Ybus, Yf, Yt] = makeYbus(baseMVA, bus, branch);
0055 Ybus = full(Ybus);
0056 Yf = full(Yf);
0057 Yt = full(Yt);
0058 
0059 %% prepare initial guess
0060 if nargin < 6
0061     V0 = getV0(bus, gen, type_initialguess);
0062 else
0063     V0 = getV0(bus, gen, type_initialguess, V0);
0064 end
0065 
0066 %% run state estimation
0067 t0 = clock;
0068 [V, success, iterNum, z, z_est, error_sqrsum] = doSE(baseMVA, bus, gen, branch, Ybus, Yf, Yt, V0, ref, pv, pq, measure, idx, sigma);
0069 %% update data matrices with solution, ie, V
0070 % [bus, gen, branch] = updatepfsoln(baseMVA, bus, gen, branch, Ybus, V, ref, pv, pq);
0071 [bus, gen, branch] = pfsoln(baseMVA, bus, gen, branch, Ybus, Yf, Yt, V, ref, pv, pq);
0072 et = etime(clock, t0);
0073 
0074 %%-----  output results  -----
0075 %% convert back to original bus numbering & print results
0076 [bus, gen, branch] = int2ext(i2e, bus, gen, branch);
0077 %% output power flow solution
0078 outputpfsoln(baseMVA, bus, gen, branch, success, et, 1, iterNum);
0079 %% output state estimation solution
0080 outputsesoln(idx, sigma, z, z_est, error_sqrsum);
0081

Generated on Mon 26-Jan-2015 14:56:45 by m2html © 2005