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
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 % Copyright (c) 1996-2015 by Power System Engineering Research Center (PSERC) 0017 % by Rui Bo 0018 % and Ray Zimmerman, PSERC Cornell 0019 % 0020 % $Id: run_se.m 2644 2015-03-11 19:34:22Z ray $ 0021 % 0022 % This file is part of MATPOWER. 0023 % Covered by the 3-clause BSD License (see LICENSE file for details). 0024 % See http://www.pserc.cornell.edu/matpower/ for more info. 0025 0026 %% read data & convert to internal bus numbering 0027 [baseMVA, bus, gen, branch] = loadcase(casename); 0028 [i2e, bus, gen, branch] = ext2int(bus, gen, branch); 0029 0030 %% get bus index lists of each type of bus 0031 [ref, pv, pq] = bustypes(bus, gen); 0032 0033 %% build admittance matrices 0034 [Ybus, Yf, Yt] = makeYbus(baseMVA, bus, branch); 0035 Ybus = full(Ybus); 0036 Yf = full(Yf); 0037 Yt = full(Yt); 0038 0039 %% prepare initial guess 0040 if nargin < 6 0041 V0 = getV0(bus, gen, type_initialguess); 0042 else 0043 V0 = getV0(bus, gen, type_initialguess, V0); 0044 end 0045 0046 %% run state estimation 0047 t0 = clock; 0048 [V, success, iterNum, z, z_est, error_sqrsum] = doSE(baseMVA, bus, gen, branch, Ybus, Yf, Yt, V0, ref, pv, pq, measure, idx, sigma); 0049 %% update data matrices with solution, ie, V 0050 % [bus, gen, branch] = updatepfsoln(baseMVA, bus, gen, branch, Ybus, V, ref, pv, pq); 0051 [bus, gen, branch] = pfsoln(baseMVA, bus, gen, branch, Ybus, Yf, Yt, V, ref, pv, pq); 0052 et = etime(clock, t0); 0053 0054 %%----- output results ----- 0055 %% convert back to original bus numbering & print results 0056 [bus, gen, branch] = int2ext(i2e, bus, gen, branch); 0057 %% output power flow solution 0058 outputpfsoln(baseMVA, bus, gen, branch, success, et, 1, iterNum); 0059 %% output state estimation solution 0060 outputsesoln(idx, sigma, z, z_est, error_sqrsum); 0061