0% found this document useful (0 votes)
68 views14 pages

Revised Main

This document describes a script that estimates the transmission line parameters of an untransposed line using PMU measurements. It contains functions for obtaining simulated PMU measurements with added noise, and for analyzing the results. The script performs multiple parameter estimations using the Lowe and Di-Shi methods and analyzes the deviation from the true parameters with increasing levels of measurement noise.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views14 pages

Revised Main

This document describes a script that estimates the transmission line parameters of an untransposed line using PMU measurements. It contains functions for obtaining simulated PMU measurements with added noise, and for analyzing the results. The script performs multiple parameter estimations using the Lowe and Di-Shi methods and analyzes the deviation from the true parameters with increasing levels of measurement noise.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

clear

close all

%This script estimates the Transmission Line Parameters of an

%untransposed Line using the methods proposed by Di-Shi & Lowe. A

%sensitivity analysis is conducted to evaluate the performance of the

%untransposed methods when noise is present in the PMU measurements

%There are a total of three functions that are called upon in this script.

%The names and purpose of these functions are as follows:

% TL_parameters -- contains the distributed transmission line parameter

% values as calculated by ATP. The lumped parameter values are found by

% multiplying by a user selected line length

%create_measurements -- this function creates a set of PMU measurements

%using the transmission line parameter values. It also adds noise to the

%measurements based on selections made by the user

%analyze -- this function analyzes the results of the parameter

%estimations. It finds the mean, standard deviation, and percent deviation

%for every parameter. This information is passed back to the script for

%plotting purposes

%BEGIN-----------------------------------------------------------------
----

%enter the number of successive estimations that are performed

%take the mean/std of the result to use for analysis

num_est = 1;

%enter number of measurements to be used per estimation

num_meas = 500;

%enter type of noise present in measurements (1 = bias, 2 = random)

type = 1;

%enter the percent deviation in noise

% PSD = (0:0.001:0.02)';
PSD = 0;

%enter which measurement has the noise

%1 = VS %2 = IS %3 = VR %4 = IR

%5 = ALL

pick = 5;

%enter whether or not data should be recorded ( 1 = yes, 2 = no)

write = 2;

%initialize matrices that hold parameters value for each estimation

Shi_R = zeros(num_est,6);

Shi_X = zeros(num_est,6);

Shi_B = zeros(num_est,6);

Lowe_R = zeros(num_est,6);

Lowe_X = zeros(num_est,6);

Lowe_B = zeros(num_est,6);

deter = zeros(num_est, 1);

%initialize matrices that hold percent deviation values for plotting

Shi_PDR = zeros(length(PSD),6);

Shi_PDX = zeros(length(PSD),6);

Shi_PDB = zeros(length(PSD),6);

Lowe_PDR = zeros(length(PSD),6);

Lowe_PDX = zeros(length(PSD),6);

Lowe_PDB = zeros(length(PSD),6);

detmn = zeros(length(PSD),1);

%ESTIMATE--------------------------------------------------------------
------

for m = 1:length(PSD)

end

for e = 1:num_est

%obtain PMU measurements

[VabcS, IabcS, VabcR, IabcR] =


create_measurements(num_meas,type,PSD(m,1),pick);

%initalize loop variables

k = 0; %counter variable
X = zeros(num_meas*6,36);

Y = zeros(num_meas*6,1);

S = zeros(num_meas*12,18);

W = zeros(num_meas*12,1);

end

for n = 1:num_meas

%assign receiving end voltages and current values

Var = VabcR(n,1);

Vbr = VabcR(n,2);

Vcr = VabcR(n,3);

Iar = IabcR(n,1);

Ibr = IabcR(n,2);

Icr = IabcR(n,3);

Vas = VabcS(n,1);

Vbs = VabcS(n,2);

Vcs = VabcS(n,3);

%initialize matrices that hold parameters value for each estimation

Shi_R = zeros(num_est,6);

Shi_X = zeros(num_est,6);

Shi_B = zeros(num_est,6);

Lowe_R = zeros(num_est,6);

Lowe_X = zeros(num_est,6);

Lowe_B = zeros(num_est,6);

deter = zeros(num_est, 1);

%initialize matrices that hold percent deviation values for plotting

Shi_PDR = zeros(length(PSD),6);

Shi_PDX = zeros(length(PSD),6);

Shi_PDB = zeros(length(PSD),6);

Lowe_PDR = zeros(length(PSD),6);

Lowe_PDX = zeros(length(PSD),6);

Lowe_PDB = zeros(length(PSD),6);

detmn = zeros(length(PSD),1);
end

%ESTIMATE--------------------------------------------------------------
------

for m = 1:length(PSD)

end

for e = 1:num_est

%obtain PMU measurements

[VabcS, IabcS, VabcR, IabcR] =


create_measurements(num_meas,type,PSD(m,1),pick);

%initalize loop variables

k = 0; %counter variable

X = zeros(num_meas*6,36);

Y = zeros(num_meas*6,1);

S = zeros(num_meas*12,18);

W = zeros(num_meas*12,1);

end

for n = 1:num_meas

%assign receiving end voltages and current values

Var = VabcR(n,1);

Vbr = VabcR(n,2);

Vcr = VabcR(n,3);

Iar = IabcR(n,1);

Ibr = IabcR(n,2);

Icr = IabcR(n,3);

Vas = VabcS(n,1);

Vbs = VabcS(n,2);

Vcs = VabcS(n,3);

Ias = IabcS(n,1);

Ibs = IabcS(n,2);

Ics = IabcS(n,3);

%index variables increment to fill coeff. & measurement matrices

%(Lowe Method)

index1 = 1 + k*6;
index2 = 2 + k*6;

index3 = 3 + k*6;

index4 = 4 + k*6;

index5 = 5 + k*6;

index6 = 6 + k*6;

%index variables (Di-Shi Method)

ind1 = 1 + k*12;

ind2 = 2 + k*12;

ind3 = 3 + k*12;

ind4 = 4 + k*12;

ind5 = 5 + k*12;

ind6 = 6 + k*12;

ind7 = 7 + k*12;

ind8 = 8 + k*12;

ind9 = 9 + k*12;

ind10 = 10 + k*12;

ind11 = 11 + k*12;

ind12 = 12 + k*12;

%fill coeff. and measurement matrices (Lowe Method)

X(index1,:) = [Var Vbr Vcr zeros(1,6) Iar Ibr Icr zeros(1,24)];

X(index2,:) = [zeros(1,3) Var Vbr Vcr zeros(1,6) Iar Ibr Icr zeros(1,21)];

X(index3,:) = [zeros(1,6) Var Vbr Vcr zeros(1,6) Iar Ibr Icr zeros(1,18)];

X(index4,:) = [zeros(1,18) Var Vbr Vcr zeros(1,6) Iar Ibr Icr zeros(1,6)];

X(index5,:) = [zeros(1,21) Var Vbr Vcr zeros(1,6) Iar Ibr Icr zeros(1,3)];

X(index6,:) = [zeros(1,24) Var Vbr Vcr zeros(1,6) Iar Ibr Icr];

Y(index1,1) = Vas;

Y(index2,1) = Vbs;

Y(index3,1) = Vcs;

Y(index4,1) = Ias;

Y(index5,1) = Ibs;

Y(index6,1) = Ics;

%fill coeff. and measurement matrices (Di-Shi)


S(ind1,:) = [ real(Vas) - real(Var), imag(Var) - imag(Vas), 0, 0, 0, 0,
real(Vbs) - real(Vbr), imag(Vbr) - imag(Vbs), real(Vcs) - real(Vcr),
imag(Vcr) - imag(Vcs), 0, 0, imag(Var)/2, 0, 0, imag(Vbr)/2, imag(Vcr)/2,
0];

S(ind2,:) = [ 0, 0, real(Vbs) - real(Vbr), imag(Vbr) - imag(Vbs), 0, 0,


real(Vas) - real(Var), imag(Var) - imag(Vas), 0, 0, real(Vcs) - real(Vcr),
imag(Vcr) - imag(Vcs), 0, imag(Vbr)/2, 0, imag(Var)/2, 0, imag(Vcr)/2];

S(ind3,:) = [ 0, 0, 0, 0, real(Vcs) - real(Vcr), imag(Vcr) - imag(Vcs), 0,


0, real(Vas) - real(Var), imag(Var) - imag(Vas), real(Vbs) - real(Vbr),
imag(Vbr) - imag(Vbs), 0, 0, imag(Vcr)/2, 0, imag(Var)/2, imag(Vbr)/2];

S(ind4,:) = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - imag(Var)/2 - imag(Vas)/2,


0, 0, - imag(Vbr)/2 - imag(Vbs)/2, - imag(Vcr)/2 - imag(Vcs)/2, 0];

S(ind5,:) = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - imag(Vbr)/2 - imag(Vbs)/2,


0, - imag(Var)/2 - imag(Vas)/2, 0, - imag(Vcr)/2 - imag(Vcs)/2];

S(ind6,:) = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - imag(Vcr)/2 -
imag(Vcs)/2, 0, - imag(Var)/2 - imag(Vas)/2, - imag(Vbr)/2 - imag(Vbs)/2];

S(ind7,:) = [ imag(Vas) - imag(Var), real(Vas) - real(Var), 0, 0, 0, 0,


imag(Vbs) - imag(Vbr), real(Vbs) - real(Vbr), imag(Vcs) - imag(Vcr),
real(Vcs) - real(Vcr), 0, 0, -real(Var)/2, 0, 0, -real(Vbr)/2, -real(Vcr)/2,
0];

S(ind8,:) = [ 0, 0, imag(Vbs) - imag(Vbr), real(Vbs) - real(Vbr), 0, 0,


imag(Vas) - imag(Var), real(Vas) - real(Var), 0, 0, imag(Vcs) - imag(Vcr),
real(Vcs) - real(Vcr), 0, -real(Vbr)/2, 0, -real(Var)/2, 0, -real(Vcr)/2];

S(ind9,:) = [ 0, 0, 0, 0, imag(Vcs) - imag(Vcr), real(Vcs) - real(Vcr), 0,


0, imag(Vas) - imag(Var), real(Vas) - real(Var), imag(Vbs) - imag(Vbr),
real(Vbs) - real(Vbr), 0, 0, -real(Vcr)/2, 0, -real(Var)/2, -real(Vbr)/2];

S(ind10,:) = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, real(Var)/2 + real(Vas)/2,


0, 0, real(Vbr)/2 + real(Vbs)/2, real(Vcr)/2 + real(Vcs)/2, 0];

S(ind11,:) = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, real(Vbr)/2 + real(Vbs)/2,


0, real(Var)/2 + real(Vas)/2, 0, real(Vcr)/2 + real(Vcs)/2];

S(ind12,:) = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, real(Vcr)/2 + real(Vcs)/2,


0, real(Var)/2 + real(Vas)/2, real(Vbr)/2 + real(Vbs)/2];

W(ind1,1) = real(Iar);

W(ind2,1) = real(Ibr);

W(ind3,1) = real(Icr);

W(ind4,1) = real(Ias) - real(Iar);

W(ind5,1) = real(Ibs) - real(Ibr);

W(ind6,1) = real(Ics) - real(Icr);

W(ind7,1) = imag(Iar);

W(ind8,1) = imag(Ibr);
W(ind9,1) = imag(Icr);

W(ind10,1) = imag(Ias) - imag(Iar);

W(ind11,1) = imag(Ibs) - imag(Ibr);

W(ind12,1) = imag(Ics) - imag(Icr);

%increment counter

k = k+1;

end

%Lowe
Method--------------------------------------------------------------

%use matrix inversion to solve for ABCD variables

beta = X\Y;

A1 = beta(1,1);

A2 = beta(2,1);

A3 = beta(3,1);

A4 = beta(4,1);

A5 = beta(5,1);

A6 = beta(6,1);

A7 = beta(7,1);

A8 = beta(8,1);

A9 = beta(9,1);

B1 = beta(10,1);

B2 = beta(11,1);

B3 = beta(12,1);

B4 = beta(13,1);

B5 = beta(14,1);

B6 = beta(15,1);

B7 = beta(16,1);

B8 = beta(17,1);

B9 = beta(18,1);

C1 = beta(19,1);

C2 = beta(20,1);

C3 = beta(21,1);
C4 = beta(22,1);

C5 = beta(23,1);

C6 = beta(24,1);

C7 = beta(25,1);

C8 = beta(26,1);

C9 = beta(27,1);

D1 = beta(28,1);

D2 = beta(29,1);

D3 = beta(30,1);

D4 = beta(31,1);

D5 = beta(32,1);

D6 = beta(33,1);

D7 = beta(34,1);

D8 = beta(35,1);

D9 = beta(36,1);

A = [A1 A2 A3;

A4 A5 A6;

A7 A8 A9];

B = [B1 B2 B3;

B4 B5 B6;

B7 B8 B9];

C = [C1 C2 C3;

C4 C5 C6;

C7 C8 C9];

D = [D1 D2 D3;

D4 D5 D6;

D7 D8 D9];

ABCD = [A B;C D];

%solve for series impedance

Zabc_Lowe = B;

Za = B1;

Zb = B5;
Zc = B9;

Zab = B2;

Zac = B3;

Zbc = B6;

Yabc_Lowe = 2*(A - eye(3))/(Zabc_Lowe);

%Di-Shi
Method-------------------------------------------------------------

%solve for the inverse series impedance matrix

%solve for the shunt admittance matrix

theta = (S'*S)\(S'*W);

Ga = theta(1,1);

Ta = theta(2,1);

Gb = theta(3,1);

Tb = theta(4,1);

Gc = theta(5,1);

Tc = theta(6,1);

Gab = theta(7,1);

Tab = theta(8,1);

Gac = theta(9,1);

Tac = theta(10,1);

Gbc = theta(11,1);

Tbc = theta(12,1);

Ba = theta(13,1);

Bb = theta(14,1);

Bc = theta(15,1);

Bab = theta(16,1);

Bac = theta(17,1);

Bbc = theta(18,1);

ya = Ga + 1i*Ta;

yb = Gb + 1i*Tb;

yc = Gc + 1i*Tc;

yab = Gab + 1i*Tab;


yac = Gac + 1i*Tac;

ybc = Gbc + 1i*Tbc;

yp = [ya yab yac;

yab yb ybc;

yac ybc yc];

Zabc_Shi = inv(yp);

Yabc_Shi = 1i*[Ba Bab Bac;

Bab Bb Bbc;

Bac Bbc Bc];

%gather reuslts from current estimation

Result_Shi_Z = [Zabc_Shi(1,1);Zabc_Shi(2,2);Zabc_Shi(3,3); ...

Zabc_Shi(1,2);Zabc_Shi(1,3);Zabc_Shi(2,3)];

Result_Shi_Y = [Yabc_Shi(1,1);Yabc_Shi(2,2);Yabc_Shi(3,3); ...

Yabc_Shi(1,2);Yabc_Shi(1,3);Yabc_Shi(2,3)];

Result_Lowe_Z = [Zabc_Lowe(1,1);Zabc_Lowe(2,2);Zabc_Lowe(3,3); ...

Zabc_Lowe(1,2);Zabc_Lowe(1,3);Zabc_Lowe(2,3)];

Result_Lowe_Y = [Yabc_Lowe(1,1);Yabc_Lowe(2,2);Yabc_Lowe(3,3); ...

Yabc_Lowe(1,2);Yabc_Lowe(1,3);Yabc_Lowe(2,3)];

%store parameters values from current estimation

Shi_R(e,:) = transpose(real(Result_Shi_Z));

Shi_X(e,:) = transpose(imag(Result_Shi_Z));

Shi_B(e,:) = transpose(imag(Result_Shi_Y));

Lowe_R(e,:) = transpose(real(Result_Lowe_Z));

Lowe_X(e,:) = transpose(imag(Result_Lowe_Z));

Lowe_B(e,:) = transpose(imag(Result_Lowe_Y));

deter(e,1) = det(ABCD);

%call function to analyze results

[meanS, meanL, stdS, stdL, pdS, pdL] = analyze(Shi_R, Shi_X, Shi_B, Lowe_R,
Lowe_X, Lowe_B);

%store results percent deviation for given PSD

Shi_PDR(m,:) = pdS(1,:);

Shi_PDX(m,:) = pdS(2,:);
Shi_PDB(m,:) = pdS(3,:);

Lowe_PDR(m,:) = pdL(1,:);

Lowe_PDX(m,:) = pdL(2,:);

Lowe_PDB(m,:) = pdL(3,:);

detmn(m,1) = mean(deter);

disp(m)

%plot------------------------------------------------------------------
---

if type ~= 3

%set line width

lw = 2.25;

if pick == 1

xtitle = 'Error in V_{abc}^S (%)';

elseif pick == 2

xtitle = 'Error in I_{abc}^S (%)';

elseif pick == 3

xtitle = 'Error in V_{abc}^R (%)';

elseif pick == 4

xtitle = 'Error in I_{abc}^R (%)';

elseif pick == 5

xtitle = 'Error in All Measurements (%)';

end

%plot percent deivation for each parameter value

figure(1);

subplot(3,2,1)

hold all

grid on

xlabel(xtitle)

ylabel('Error of R (%)')

plot(PSD,Shi_PDR(:,1),'LineWidth',lw,'Color','r')

plot(PSD,Shi_PDR(:,2),'LineWidth',lw,'Color','g')

plot(PSD,Shi_PDR(:,3),'LineWidth',lw,'Color','b')
plot(PSD,Shi_PDR(:,4),'LineWidth',lw,'Color','c')

plot(PSD,Shi_PDR(:,5),'LineWidth',lw,'Color','m')

plot(PSD,Shi_PDR(:,6),'LineWidth',lw,'Color','k')

%legend('Ra','Rb','Rc','Rab','Rac','Rbc')

set(gca,'XMinorTick','on','YMinorTick','on')

%set(legend,'Location','EastOutside')

subplot(3,2,3)

hold all

grid on

xlabel(xtitle)

ylabel('Error of X (%)')

plot(PSD,Shi_PDX(:,1),'LineWidth',lw,'Color','r')

plot(PSD,Shi_PDX(:,2),'LineWidth',lw,'Color','g')

plot(PSD,Shi_PDX(:,3),'LineWidth',lw,'Color','b')

plot(PSD,Shi_PDX(:,4),'LineWidth',lw,'Color','c')

plot(PSD,Shi_PDX(:,5),'LineWidth',lw,'Color','m')

plot(PSD,Shi_PDX(:,6),'LineWidth',lw,'Color','k')

%legend('Xa','Xb','Xc','Xab','Xac','Xbc')

set(gca,'XMinorTick','on','YMinorTick','on')

%set(legend,'Location','EastOutside')

subplot(3,2,5)

hold all

grid on

xlabel(xtitle)

ylabel('Error of B (%)')

plot(PSD,Shi_PDB(:,1),'LineWidth',lw,'Color','r')

plot(PSD,Shi_PDB(:,2),'LineWidth',lw,'Color','g')

plot(PSD,Shi_PDB(:,3),'LineWidth',lw,'Color','b')

plot(PSD,Shi_PDB(:,4),'LineWidth',lw,'Color','c')

plot(PSD,Shi_PDB(:,5),'LineWidth',lw,'Color','m')

plot(PSD,Shi_PDB(:,6),'LineWidth',lw,'Color','k')

%legend('Ba','Bb','Bc','Bab','Bac','Bbc')
set(gca,'XMinorTick','on','YMinorTick','on')

%set(legend,'Location','EastOutside')

subplot(3,2,2)

hold all

grid on

xlabel(xtitle)

ylabel('Error of R (%)')

plot(PSD,Lowe_PDR(:,1),'LineWidth',lw,'Color','r')

plot(PSD,Lowe_PDR(:,2),'LineWidth',lw,'Color','g')

plot(PSD,Lowe_PDR(:,3),'LineWidth',lw,'Color','b')

plot(PSD,Lowe_PDR(:,4),'LineWidth',lw,'Color','c')

plot(PSD,Lowe_PDR(:,5),'LineWidth',lw,'Color','m')

plot(PSD,Lowe_PDR(:,6),'LineWidth',lw,'Color','k')

%legend('Ra','Rb','Rc','Rab','Rac','Rbc')

set(gca,'XMinorTick','on','YMinorTick','on')

%set(legend,'Location','EastOutside')

subplot(3,2,4)

hold all

grid on

xlabel(xtitle)

ylabel('Error of X (%)')

plot(PSD,Lowe_PDX(:,1),'LineWidth',lw,'Color','r')

plot(PSD,Lowe_PDX(:,2),'LineWidth',lw,'Color','g')

plot(PSD,Lowe_PDX(:,3),'LineWidth',lw,'Color','b')

plot(PSD,Lowe_PDX(:,4),'LineWidth',lw,'Color','c')

plot(PSD,Lowe_PDX(:,5),'LineWidth',lw,'Color','m')

plot(PSD,Lowe_PDX(:,6),'LineWidth',lw,'Color','k')

%legend('Xa','Xb','Xc','Xab','Xac','Xbc')

set(gca,'XMinorTick','on','YMinorTick','on')

%set(legend,'Location','EastOutside')

subplot(3,2,6)

hold all
grid on

xlabel(xtitle)

ylabel('Error of B (%)')

plot(PSD,Lowe_PDB(:,1),'LineWidth',lw,'Color','r')

plot(PSD,Lowe_PDB(:,2),'LineWidth',lw,'Color','g')

plot(PSD,Lowe_PDB(:,3),'LineWidth',lw,'Color','b')

plot(PSD,Lowe_PDB(:,4),'LineWidth',lw,'Color','c')

plot(PSD,Lowe_PDB(:,5),'LineWidth',lw,'Color','m')

plot(PSD,Lowe_PDB(:,6),'LineWidth',lw,'Color','k')

%legend('Ba','Bb','Bc','Bab','Bac','Bbc')

set(gca,'XMinorTick','on','YMinorTick','on')

%set(legend,'Location','EastOutside')

%write to excel

data = [Shi_PDR Shi_PDX Shi_PDB Lowe_PDR Lowe_PDX Lowe_PDB detmn];

if type == 1

filename = 'bias_noise.xlsx';

elseif type == 2

filename = 'random_noise.xlsx';

end

if write == 1

xlswrite(filename,data,pick)

elseif write == 2

end

%----------------------------------------------------------------------
---

else

end

You might also like