0% found this document useful (0 votes)
94 views44 pages

PS Coding Solution

Uploaded by

justchill151012
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
94 views44 pages

PS Coding Solution

Uploaded by

justchill151012
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

Appendix

Experiment:1
To write a computer program for plotting instantaneous voltage, current
and power in ac circuits.

Ex.1: Consider a single-phase circuit with a resistive load. The circuit parameters are as
follows:
• Voltage amplitude (Vm) = 100 V
• Frequency (f) = 50 Hz
• Resistance (R) = 50 ohms
Write a Scilab/MATLAB code to generate and plot the instantaneous current, voltage,
Real power time varying component,Pr, and reactive power time varying component,
Px,over one cycle of the AC waveform. Assume a sinusoidal waveform for the
voltage.

% Define circuit parameters


Vm = 100; % Voltage amplitude (V)
f = 50; % Frequency (Hz)
R = 50; % Resistance (ohms)

% Generate time vector


T = 1/f; % Time period of one cycle (s)
t = linspace(0, T, 1000); % Time vector for one cycle

% Calculate instantaneous current and voltage


I = Vm / R * sin(2 * pi * f * t); % Current waveform (A)
V = Vm * sin(2 * pi * f * t); % Voltage waveform (V)

% Calculate real power and reactive power

Pr = V .* I; % Real powertime varying component (VA)


Px = zeros(size(P)); % Reactive power time varying component(VA) for resistive load

% Plot the waveforms


figure;
subplot(2, 2, 1);
plot(t, V);
xlabel('Time (s)');
ylabel('Voltage (V)');
title('Instantaneous Voltage');

subplot(2, 2, 2);
plot(t, I);
xlabel('Time (s)');
ylabel('Current (A)');
title('Instantaneous Current');

subplot(2, 2, 3);
plot(t, Pr);
xlabel('Time (s)');

ylabel('Real Power time varying component(VA)');

title('Real Power time varying component');

subplot(2, 2, 4);
plot(t, Px);
xlabel('Time (s)');

ylabel('Reactive Power time varying component(VA)');

title('Reactive Power time varying component(Resistive Load)');


Ex.2: Consider a single-phase circuit with an inductive load. The circuit parameters are as
follows:
● Voltage amplitude (Vm) = 120 V
● Frequency (f) = 60 Hz
● Inductance (L) = 0.1 H
● Resistance (R) = 10 ohms
Write a Scilab/MATLAB code to generate and plot the instantaneous current, voltage,
real power, and reactive power over one cycle of the AC waveform. Assume a
sinusoidal waveform for the voltage.
clc

clear all

close all

% Circuit Parameters

Vm = 120; % Voltage amplitude (V)

f = 60; % Frequency (Hz)

L = 0.1; % Inductance (H)

R = 10; % Resistance (ohms)


w=2*pi*f;

Z=sqrt(R^2+(w*L)^2)

% Time vector

t = linspace(0, 1/f, 1000); % 1000 samples over one cycle

ThV=0;

ThI=atan((w*L)/R);

theta= (ThV-ThI)

% Instantaneous voltage waveform

v= Vm.*cos(w*t+ThV);

% Instantaneous current waveform

Im=Vm/Z;

i= Im.*cos((w*t)+theta);

V=Vm/sqrt(2);

I=Im/sqrt(2);

% Real power

P = v.*i;

Pr= V.*I.*cos(theta).*(1+cos(2.*(w*t)+ThV)) %real power time varying


component of p

Px= V.*I.*sin(theta).*sin(2.*(w*t+ThV))

; % reactive power time varying component of p

% Plotting

figure;

subplot(2,2,1);

plot(t, v);

xlabel('Time (s)');

ylabel('Voltage (V)');

title('Instantaneous Voltage');

subplot(2,2,2);

plot(t, i);

xlabel('Time (s)');
ylabel('Current (A)');

title('Instantaneous Current');

subplot(2,2,3);

plot(t, P);

xlabel('Time (s)');

ylabel('Real Power time varying component(VA)');

title('Real Powertime varying component(VA)');

subplot(2,2,4);

plot(t, Px);

xlabel('Time (s)');

ylabel('Reactive Power time varying component(VA)');

title('Reactive time varying component(VA)');

Ex.3: Consider a single-phase circuit with an inductive load. The circuit parameters are as
follows:
● Voltage amplitude (Vm) = 100 V
● Frequency (f) = 50 Hz
● Inductance (L) = 0.1 H
● Resistance (R) = 50 ohms
● Capacitance(C)=0.01 F
Write a Scilab/MATLAB code to generate and plot the instantaneous current, voltage,
real power, and reactive power over one cycle of the AC waveform. Assume a
sinusoidal waveform for the voltage.
% Circuit Parameters
Vm = 100; % Voltage amplitude (V)
f = 50; % Frequency (Hz)
L = 0.1; % Inductance (H)
R = 50; % Resistance (ohms)
C = 0.01; % Capacitance (F)

% Time vector
t = linspace(0, 1/f, 1000); % 1000 samples over one cycle

% Instantaneous voltage waveform


v = Vm*sin(2*pi*f*t);

% Instantaneous current waveform


i = (Vm/(R^2 + (2*pi*f*L - 1/(2*pi*f*C))^2)^0.5) * sin(2*pi*f*t - atan((2*pi*f*L -
1/(2*pi*f*C))/R));

% Real power
P = v.*i;

% Reactive power
Q = (Vm^2/(R^2 + (2*pi*f*L - 1/(2*pi*f*C))^2)^0.5) * sin(atan((2*pi*f*L -
1/(2*pi*f*C))/R) - 2*pi*f*t + atan((2*pi*f*L - 1/(2*pi*f*C))/R));

% Plotting
figure;
subplot(2,2,1);
plot(t, v);
xlabel('Time (s)');
ylabel('Voltage (V)');
title('Instantaneous Voltage');

subplot(2,2,2);
plot(t, i);
xlabel('Time (s)');
ylabel('Current (A)');
title('Instantaneous Current');

subplot(2,2,3);
plot(t, P);
xlabel('Time (s)');
ylabel('Real Power (W)');
title('Real Power');

subplot(2,2,4);
plot(t, Q);
xlabel('Time (s)');
ylabel('Reactive Power (VAR)');
title('Reactive Power');
Ex4
Two loads connected in parallel are supplied from a single-phase 240-V rms
source. The two loads draw a total real power of 400 kW at a power factor
of 0.8 lagging. One of the loads draws 120 kW at a power factor of 0.96
leading. Find the complex power of the other load.
MATLAB problem :
% Given :
Vrms = 240; % RMS voltage in volts
P_total = 400e3; % Total real power in watts
pf_total = 0.8; % Power factor (lagging) for the total load
P1 = 120e3; % Real power of one load in watts
pf1 = 0.96; % Power factor (leading) of one load

% Apparent power of the total load


S_total = P_total / pf_total;
% Apparent power of load 1
S1 = P1 / pf1;
% Calculating the apparent power of the other load
S2 = S_total - S1;
% Results
disp(['The complex power of the other load is: ', num2str(S2), ' VA']);

Ex.5:
A balanced three-phase source supplies a balanced Y-connected load with
an impedance of Z = 300 * (36.87 + 1i) per phase.
The instantaneous phase voltages are given by:
van = 2800 * cos(wt)
vbn = 2800 * cos(wt - 120)
vcn = 2800 * cos(wt - 240)
Using Scilab/MATLAB, plot the instantaneous powers for each phase (pa,
pb, pc) and their sum (total three-phase real power) versus time (wt) over a
range of 0 to 2pi with an increment of 0.01pi on the same graph.
Z = 300 * (36.87 + 1i); % Impedance per phase
V_rms = 2800 / sqrt(2); % RMS phase voltage

%Matlab code:
% Given
Z = 300 * (36.87 + 1i); % Impedance per phase
V_rms = 2800 / sqrt(2); % RMS phase voltage
t = 0:0.01*pi:2*pi;
w=2*pi*50;
wt=w.*t;
% Instantaneous phase voltages
van = 2800 .* cos(wt);
vbn = 2800 .* cos(wt - 120);
vcn = 2800 .* cos(wt - 240);

% Calculate instantaneous powers for each phase


pa = abs(van.^2 / Z);
pb = abs(vbn.^2 / Z);
pc = abs(vcn.^2 / Z);

% Total three-phase real power


ptotal = pa + pb + pc;
% Plotting
figure;
% Subplot for Phase A
subplot(2, 2, 1);
plot(t, pa, 'r', 'LineWidth', 2);
xlabel('Time');
ylabel('Instantaneous Power');
title('Phase A');
grid on;

% Subplot for Phase B


subplot(2, 2, 2);
plot(t, pb, 'g', 'LineWidth', 2);
xlabel('Time');
ylabel('Instantaneous Power');
title('Phase B');
grid on;

% Subplot for Phase C


subplot(2, 2, 3);
plot(t, pc, 'b', 'LineWidth', 2);
xlabel('Time');
ylabel('Instantaneous Power');
title('Phase C');
grid on;

% Subplot for Total Three-Phase Power


subplot(2, 2, 4);
plot(t, ptotal, 'k', 'LineWidth', 2);
xlabel('Time');
ylabel('Total Three-Phase Power');
title('Total Three-Phase Real Power');
grid on;
Experiment:2
To write computer program for voltage regulation and efficiency of short, medium and long
transmission line.

Consider transmission line with following parametric data:

Frequency (f): 50 Hz
Transmission line length (d): 300 km
Total series resistance (R): 40 ohm
Total series reactance (XL): j120 ohms
Total shunt admittance (Y): 10^(-3) mho

Receiving-end load:
Load power (P): 50 MW
Load voltage (V): 220 kV
Power factor (pf): 0.8 lagging

Find the sending-end voltage, current, power and power factor using computer program for
following mathematical models:
(a) Short line approximation,

(b) nominal- method,

(c) Exact transmission line equation


Solution:

(a) Short line approximation


>> % Given Data
f = 60; % Frequency (Hz)
d = 200e3; % Transmission line length (m)
Z = 30 + 1j*100; % Total series impedance (ohms)
Y = 5e-4; % Total shunt admittance (mho)
P = 40e6; % Load power (W)
V = 240e3; % Load voltage (V)
pf = 0.9; % Power factor (lagging)

% Convert load power to VA (apparent power)


S = P / pf;

% Short Line Approximation


Vr=220e3
pf=0.8
Pr=50e6
R=40
Xl=125
Y=i*1e-3

Vr_ph=Vr/sqrt(3)
Ir=Pr/(pf*sqrt(3)*Vr)
Ir_ang=-acos(0.8)
Z=R+i*Xl

Ir_v=Ir*cos(Ir_ang) + i*Ir*sin(Ir_ang)
Vs_ph=Vr_ph+Ir_v*Z
Vs_m=abs(Vs_ph)
Vs_line=Vs_m*sqrt(3)
Is=Ir
Is_ang=Ir_ang
ss_v=3*Vs_ph*conj(Ir_v)
Ps=real(ss_v)
VR=(Vs_m-Vr_ph)*100/Vr_ph
eta=Pr*100/real(ss_v)

% display results
fprintf('Short line approximation')
fprintf(' \n \n Phase value of sending end voltage is %.2f kV at angel %.2f
\n',Vs_m/1e3,angle(Vs_ph)*180/pi)
fprintf(' Sending end active power is %.2f MW \n',Ps/1e6)
fprintf(' Voltage regulation is %.2f percent \n',VR)
fprintf(' Efficiency is %.2f percent \n \n \n',eta)

%Short line approximation

Phase value of sending end voltage is 145.10 kV at angel 4.93


Sending end active power is 53.23 MW
Voltage regulation is 14.24 percent
Efficiency is 93.93 percent
% nominal- method,

Vr_ph=Vr/sqrt(3)
Ir=Pr/(pf*sqrt(3)*Vr)
Ir_ang=-acos(0.8)
Z=R+i*Xl

Ir_v=Ir*cos(Ir_ang) + i*Ir*sin(Ir_ang)

A=1+Y*Z/2
D=A
B=Z
C=Y*(1+Y*Z/4)

Vs_ph=A*Vr_ph+B*Ir_v
Is_v=C*Vr_ph+D*Ir_v

Vs_m=abs(Vs_ph)
Vs_line=Vs_m*sqrt(3)
Is=abs(Is_v)
Is_ang=angle(Is_v)
ss_v=3*Vs_ph*conj(Is_v)
Ps=real(ss_v)
VR=(Vs_m-Vr_ph)*100/Vr_ph
eta=Pr*100/real(ss_v)

% display results
fprintf('Nominal PI method')
fprintf(' \n \n Phase value of sending end voltage is %.2f kV at angel %.2f
\n',Vs_m/1e3,angle(Vs_ph)*180/pi)
fprintf(' Sending end active power is %.2f MW \n',Ps/1e6)
fprintf(' Voltage regulation is %.2f percent \n',VR)
fprintf(' Efficiency is %.2f percent \n \n \n',eta)

%Nominal PI method

Phase value of sending end voltage is 137.45 kV at angel 6.27


Sending end active power is 52.21 MW
Voltage regulation is 8.21 percent
Efficiency is 95.76 percent

(c) Exact transmission line equation

Vr_ph=Vr/sqrt(3)
Ir=Pr/(pf*sqrt(3)*Vr)
Ir_ang=-acos(0.8)
Z=R+i*Xl

Ir_v=Ir*cos(Ir_ang) + i*Ir*sin(Ir_ang)

Zc=sqrt(Z/Y)

yl=sqrt(Y*Z)
A=cosh(yl)
D=A
B=Zc*sinh(yl)
C=sinh(yl)/Zc
Vs_ph=A*Vr_ph+B*Ir_v
Is_v=C*Vr_ph+D*Ir_v
Vs_m=abs(Vs_ph)
Vs_line=Vs_m*sqrt(3)
Is=abs(Is_v)
Is_ang=angle(Is_v)
ss_v=3*Vs_ph*conj(Is_v)
Ps=real(ss_v)
VR=(Vs_m-Vr_ph)*100/Vr_ph
eta=Pr*100/real(ss_v)
% display results
fprintf('exact method')
fprintf(' \n \n Phase value of sending end voltage is %.2f kV at angel %.2f
\n',Vs_m/1e3,angle(Vs_ph)*180/pi)
fprintf(' Sending end active power is %.2f MW \n',Ps/1e6)
fprintf(' Voltage regulation is %.2f percent \n',VR)
fprintf(' Efficiency is %.2f percent \n \n \n',eta)

%Exact method

Phase value of sending end voltage is 137.06 kV at angel 6.20


Sending end active power is 52.30 MW
Voltage regulation is 7.91 percent
Efficiency is 95.60 percent
Experiment #3

To analyze effect of ferranti effect on the performance of transmission line

Ex1:

Write a computer program to analyze following data and plot A vs line length and receiving
end voltage vs line length

Vs = 765e3; % Source voltage in volts

L = 0.329 / (2*pi*60); % Inductance of the transmission line in H

C = (4.978 / (2*pi*60)) * 1e-6; % Capacitance of the transmission line in F

beta = 2*pi*50*sqrt(L*C); % Propagation constant of the transmission line

ll = 0:0.001:600;

% Given parameters

Vs = 765e3; % Source voltage in volts

L = 0.329 / (2*pi*60); % Inductance of the transmission line in H

C = (4.978 / (2*pi*60)) * 1e-6; % Capacitance of the transmission line in F

beta = 2*pi*50*sqrt(L*C); % Propagation constant of the transmission line

ll = 0:0.001:600; % Range of line lengths in kilometers

% Calculate parameter A of the transmission line

A = cos(beta * ll);

% Plot for parameter A of the transmission line

subplot(2,1,1)
plot(ll, A)

title('Parameter A of the Transmission Line')

xlabel('Line Length (km)')

ylabel('Parameter A')

grid on

% Calculate receiving end voltage using Ferranti effect

Vrnl = Vs ./ A;

% Plot for Ferranti effect

subplot(2,1,2)

plot(ll, Vrnl)

title('Ferranti Effect')

xlabel('Line Length (km)')

ylabel('Receiving End Voltage')

grid on

Ex.2

Write a computer program to analyze following data and Display Distance (km), | Receiving-end
Voltage (kV) | Angle (degrees),

VL = 230; % Load voltage (in kV)

ZL = 0.8 + 2j; % Load impedance (in ohms)

VS = 500; % Sending-end voltage (in kV)

ZT = 0.15 + 0.4j; % Transmission line impedance (in ohms)

d = [50, 100, 150, 200, 250]; % Distance of the transmission line (in km)
f = 50;

% Constants

VL = [220, 230, 240]; % Load voltages (in kV)

ZL = 0.8 + 2j; % Load impedance (in ohms)

VS = 500; % Sending-end voltage (in kV)

ZT = 0.15 + 0.4j; % Transmission line impedance (in ohms)

d = 150; % Distance of the transmission line (in km)

f = 50; % Frequency (in Hz)

% Calculation

% Convert the distance from kilometers to miles

d_miles = d * 0.621371;

% Preallocate arrays to store results

VL_ferranti = zeros(size(VL));

angle_ferranti = zeros(size(VL));

% Loop over different load voltages

for i = 1:length(VL)

% Calculate the Ferranti effect

VL_miles = VS - (ZT + ZL) * (I * d_miles / 100) * (1 / (2 * pi * f));

% Convert the voltage from miles to kilometers

VL_ferranti(i) = VL_miles / 0.621371;

angle_ferranti(i) = angle(VL_ferranti(i)) * (180 / pi);

end

% Display the results


fprintf('Load Voltages (kV): 220 230 240\n');

fprintf('Receiving-end voltages (kV) after considering the Ferranti effect:\n');

fprintf('%.2f %.2f %.2f\n', abs(VL_ferranti));

fprintf('Angles of the receiving-end voltages (degrees) after considering the Ferranti


effect:\n');

fprintf('%.2f %.2f %.2f\n', angle_ferranti);

% Constants

VS = 345; % Sending-end voltage (in kV)

ZT = 0.25 + 0.6j; % Transmission line impedance (in ohms)

d = 100; % Distance of the transmission line (in km)

f = 60; % Frequency (in Hz)

% Calculate the receiving-end voltage for different load conditions

load_conditions = [0.5, 0.8, 1, 1.2]; % Load conditions as a percentage of the sending-end


load

VL = zeros(1, numel(load_conditions)); % Array to store the receiving-end voltages

for i = 1:numel(load_conditions)

% Load impedance as a percentage of the sending-end load

ZL = (load_conditions(i) * VS) / 100;

% Convert the distance from kilometers to miles

d_miles = d * 0.621371;

% Calculate the Ferranti effect

VL_miles = VS - (ZT + ZL) * (I * d_miles / 100) * (1 / (2 * pi * f));

% Convert the voltage from miles to kilometers

VL(i) = VL_miles / 0.621371;

end
% Display the results

fprintf('Sending-end voltage (VS): %.2f kV\n', VS);

fprintf('Transmission line impedance (ZT): %.2f + %.2fj ohms\n', real(ZT), imag(ZT));

fprintf('Distance of the transmission line (d): %d km\n', d);

fprintf('Frequency (f): %d Hz\n', f);

fprintf('Load conditions: %.1f%%, %.1f%%, %.1f%%, %.1f%%\n', load_conditions(1),


load_conditions(2), load_conditions(3), load_conditions(4));

fprintf('Receiving-end voltages (VL): %.2f kV, %.2f kV, %.2f kV, %.2f kV\n', abs(VL(1)),
abs(VL(2)), abs(VL(3)), abs(VL(4)));

fprintf('Phase angles of receiving-end voltages (VL): %.2f degrees, %.2f degrees, %.2f
degrees, %.2f degrees\n', angle(VL(1)) * (180 / pi), angle(VL(2)) * (180 / pi), angle(VL(3)) *
(180 / pi), angle(VL(4)) * (180 / pi));

Experiment #4

To Evaluate performance of transmission line using sending end power


circle diagram and receiving end power circle diagram

Ex.1 %% Exp_3 To plot circle diagram


% Nagrath kothari example 5.10
clc
clear all
close all
x0=[0,0]; % Origin
%% given data
beta=84.2
alpha=0.7
A=0.896
B=138.7
Vr=275
Vs=Vr

% calculate first vector 1, |A/B|*Vr^2 arg( Beta-alpha)


ang=(180+(beta-alpha))*pi/180
M=A*Vr^2/B
[x,y]=pol2cart(ang,M) % convert polar to cart
x1=[x,y]
X=[x0(1) x1(1)]
Y=[x0(2) x1(2)] % X and Y coordinates to plot vector
figure1 = figure; % new figure
line([0,0],[-600,200],'color','g') % draw axis
line([-200,600],[0,0],'color','g')
plot(X,Y) % plot vector 1
grid on
% draw circle with radius r form 0 to 90 degrees with x1 as
center
% x1 = tip of vector 1
r=Vr*Vs/B
th=0:0.1:pi/2
hold on
plot(X(2)+r*cos(th),Y(2)+r*sin(th),'r:')
% refrence line horizontal to x1
line([X(2),X(2)+r],[Y(2),Y(2)],'color','g')
hold off

%% formate figure
title('Receiving end circle diagram')
xlabel('Real power axis(MW)')
ylabel('Reactive power axis (MVAR)')
axis('square')
% insert text
text(0,Y(2)+r*sin(pi/2),'\leftarrow Operating point')
text(-10,Y(2)+r*sin(pi/2)-30,'\uparrow')
text(-175,Y(2)+r*sin(pi/2)-30,'Req. MVAR')
text(-150,-70,'Beta-alpha')
text(-20,-350,'|A/B||Vr|^2')
text(200,-450,' r=|Vs||Vr|/|B|')

% end of code %
Ex.2.

Write a computer problem to draw power circle diagram and solve the following:
A 275 kV, three-phase line has the following line parameters:

A=093 angle 1.5°, B=115 angle 77°

If the receiving-end voltage is 275 kV, determine:

(a) The sending-end voltage required if a load of 250 MW at 0.85 lagging pf

is being delivered at the receiving-end.

(b) The maximum power that can be delivered if the sending-end voltage is

held at 295 kV.

(c) The additional MVA that has to be provided at the receiving-end when

delivering 400 MVA at 0.8 lagging pf, the supply voltage being

maintained at 295 kV.

%% Exp_3 To plot circle diagram


% Nagrath kothari example 5.11
clc
clear all
close all
%% part a)
x0=[0,0]; % Origin
% given data
beta=77
alpha=1.5
A=0.93
B=115
Vr=275

% calculate first vector 1, |A/B|*Vr^2 arg( Beta-alpha)


ang=(180+(beta-alpha))*pi/180
M=A*Vr^2/B
[x,y]=pol2cart(ang,M) % convert polar to cart
x1=[x,y]
X=[x0(1) x1(1)]
Y=[x0(2) x1(2)] % X and Y coordinates to plot vector
figure1 = figure;
plot(X,Y,'LineWidth',1) % plot vector 1
line([0,0],[-600,200],'color','g') % draw axis
line([-200,600],[0,0],'color','g')
grid on

% consider operating point as 250 MW and 0.85 lag pf


P=250
pf=0.85
ang=acos(pf)
M=P/pf %load MVA
[a,b]=pol2cart(ang,M) % convert pol to cart
x2=[a,b] % coordinates of vector 2
hold on
X1=[x0(1) x2(1)]
Y1=[x0(2) x2(2)] % X and Y coordinates to plot vector
plot(X1,Y1,'k','LineWidth',1) % plot vector 2
r=sqrt(sum((x2-x1).^2)) % calculate r = distance between x1 and x2
X2=[x1(1) x2(1)]
Y2=[x1(2) x2(2)] % X and Y coordinates to plot vector
plot(X2,Y2,'r','LineWidth',1) % plot vector 3
Vs=r*B/Vr % calculate Vs
hold off

%% format figure
title('Receiving end circle diagram (a)')
xlabel('Real power axis(MW)')
ylabel('Reactive power axis (MVAR)')
axis('square')
% insert text
text(x2(1),x2(2),'\leftarrow Operating point')
text(-150,-70,'Beta-alpha')
text(-180,-230,'|A/B||Vr|^2')
text(50,-350,' r=|Vs||Vr|/|B|')
str=num2str(r)
text(100,-270,str)
str=['Vs = ' num2str(Vs)]
text(400,50,str)

%% part b)
x0=[0,0];
beta=77
alpha=1.5
A=0.93
B=115
Vr=275
%Vs=Vr
ang=(180+(beta-alpha))*pi/180
M=A*Vr^2/B
[x,y]=pol2cart(ang,M)
x1=[x,y]
X=[x0(1) x1(1)]
Y=[x0(2) x1(2)]
figure1 = figure;
plot(X,Y,'LineWidth',1)
line([0,0],[-600,200],'color','g')
line([-200,600],[0,0],'color','g')
grid on
title('Receiving end circle diagram (b)')
xlabel('Real power axis(MW)')
ylabel('Reactive power axis (MVAR)')
axis('square')
text(-150,-70,'Beta-alpha')
text(-180,-230,'|A/B||Vr|^2')

% draw circle with x1 as center ans r = Vs*Vr/B


Vs=295
r=Vr*Vs/B
th=0:0.1:pi/2
hold on
plot(X(2)+r*cos(th),Y(2)+r*sin(th),'r:','LineWidth',1.5)
line([X(2),X(2)+r],[Y(2),Y(2)],'color','g')
text(X(2)+r*cos(0),Y(2)+r*sin(0),'\leftarrow Operating point')
Pmax=r+X(2)
str=['Max P = ' num2str(Pmax)]
text(150,-550,str)
hold off
Experiment #5

To analyze and simulate transient in electrical power systems represented


by series R-L circuit
Ex1.

In the circuit of Fig.5.1. let R = 0.125Ω , L = 10 mH, and the source voltage be given by:

v(t) = 151 sin(377t+α).

Determine the current response after closing the switch for the following cases.

(a) No dc offset.
(b) For maximum de offset.

clc
clear all
close all
r=0.125
l=0.01
f=60
Vm=151
gama=atan(2*pi*f*l/r)
alpha1=gama
alpha2=gama-(pi/2)
Z=r+(i*2*pi*f*l)
w=2*pi*f
t=0:0.001:3
tau=l/r
Im= abs(Vm/Z)
i1= Im.*sin((w.*t)+alpha1-gama)-(Im.*exp(-t./tau).*sin(alpha1-gama))
i2= Im.*sin((w.*t)+alpha2-gama)-(Im.*exp(-t./tau).*sin(alpha2-gama))
subplot(2,1,1), plot(t,i1)
xlabel('t, sec'), ylabel('i(t), ampere')
subplot(2,1,2), plot(t,i2)
xlabel('t, sec'), ylabel('i(t), ampere')
Ex.2

Write computer program for the following data:


Vs=230 V
R = 0.001Ω
L=0.36 mH
f= 50 Hz

Determine the current response after closing the switch for the following cases.

(a) No dc offset.
(b) For maximum de offset.

clear all
close all
clc
Vrms=230; % rms value of the voltage source %
Vmax=sqrt(2)*Vrms; % peak value of the voltage source %
f=50; % source frequency in Hz %
r=0.001; % resistance of the transmission line %
l=0.36e-3; % inductance of the transmission line in mH %
tc=l/r; % time constant of the rl series circuit %
w=2*pi*f; % angular frequency in radian per seconds %
x=w*l; % reactance of the transmission line ohms %
z=r+x*1i; % impedance of the transmission line in ohms %
zmag=abs(z); % magnitude of the impedance of the transmission line%
theta=angle(z); % phase angle of the transmission line %
alpha=0; % alpha in radian %
t=0:0.0001:2.5;
Iac=(Vmax/zmag)*sin((w*t)+alpha-theta) % sinusoidal component of the
current %
Idc=-(Vmax/zmag)*exp((-r*t)/l)*sin(alpha-theta); % dc offset component of
the current %
It=Iac+Idc; % current as a function of time in RL circuit %

% verificatoin of "Doubling Effect" for alpha = 0 degree, theta


aprroximately 90 degree %

It_m=Vmax/zmag; % peak value of steady state current %


It_m2=It_m*2 % two times the peak value of steady state current %
It_max=max(It) % checking peak value of the fault current %
subplot(3,1,1)
plot(t,Iac)
xlabel('time in seconds')
ylabel('current in ampere')
title('sinusoidal component of the fault current')
grid on
subplot(3,1,2)
plot(t,Idc)
xlabel('time in seconds')
ylabel('current in ampere')
title('dc offset component of the fault current')
grid on
subplot(3,1,3)
plot(t,It)
xlabel('time in seconds')
ylabel('current in ampere')
title('current as a function of time in RL circuit')
grid on

Result

It_m2 = 5.7518e+003

It_max = 5.6729e+003
Experiment #6

To analyze and simulate a three phase fault on the terminal of an unloaded


synchronous generator.
Ex1.
Analyze and plot instantaneous fault current, rms value of the fault current and for the
unloaded synchronous machine for the following numerical data.

Vrms = 230 V
Xd’’ = 0.15 Ω
Xd’ = 0.24 Ω
Xd = 1.1 Ω
α =0
Td’’ = 0.035 S
Td’ = 2.0 S
f = 50 Hz

clear all
close all
clc
Vrms=230; % rms value of the voltage source %
Vm=sqrt(2)*Vrms; % peak value of the voltage source %
Xdst=0.15; % subtransient reactance in ohms %
Xdt=0.24; % subtransient reactance in ohms %
Xd=1.1; % transient reactance in ohms %
alpha=0; % alpha in radian %
Tdst=0.035/1; % direct axis short-circuit subtransient time constant in seconds %
Tdt=2.0/1; % direct axis short-circuit transient time constant in seconds %
f=60; % system frequency in Hz %
w=2*pi*f; % angular frequency in radian per second %
t=0:0.001:15;

% instantaneous fault current in unloaded synchronous machine %


Iac=Vm*((((1/Xdst)-(1/Xdt))*exp(-t/Tdst))+(((1/Xdt)-(1/Xd))*exp(-t/Tdt))+(1/Xd)).*(sin(((w*t)+
alpha-(pi/2))));
figure(1)
plot(t,Iac)
xlabel('time in seconds')
ylabel('current in ampere')
title('instantaneous fault current in unloaded synchronous machine')
grid on

% rms value of the fault current in unloaded synchronous machine %


Iac_rms=Vrms*((((1/Xdst)-(1/Xdt))*exp(-t/Tdst))+(((1/Xdt)-(1/Xd))*exp(-t/Tdt))+(1/Xd));
figure(2)
plot(t,Iac_rms)
xlabel('time in seconds')
ylabel('current in ampere')
title('rms value of fault current in unloaded synchronous machine')
grid on
Experiment #7

To develop a program for formulation of the ZBUS matrix.

Excercise:

Use a separate sheet of paper to write a program for the following numerical problem data also
paste the result of the program.

Consider the 4-bus system of Fig.7.3,


Buses 1 and 2 are generator buses and 3 and 4 are load buses.
The generators are rated l l kv, 100 MVA, with transient reactance of l0 % each.
Both the transformers are 11/110 kV, 100 MVA with a leakage reactance of 5%.
The reactance of the lines to a base of 100 MVA, 110 kV are indicated on the figure.

Obtain the short circuit solution for a three-phase solid fault on bus 4 (load bus).
Assume prefault voltages to be 1 pu and prefault currents to be zero.
1,Fig.7.3 on-line diagram

YBUS data:

From To R XL G
Bus Bus

1 2 0 0.2 0.15

1 3 0 0.15 0

1 4 0 0.1 0

2 3 0 0.1 0

2 4 0 0.15 0

Solution:

Computer program:

%% Zbus formation program


clc;
clear all;
%% Read data from excel sheet
data=[1,2,0,0.2,0.15;1,3,0,0.15,0;1,4,0,0.1,0;2,3,0,0.1,0;2,4,0,0.15,0];
fb=data(:,1);
tb=data(:,2);
z=data(:,3) + i.*data(:,4);
y=1./z;
g=1/(i*data(:,5));
nbus=max([max(fb),max(tb)]);
ybus=zeros(nbus);
branch=length(fb);
%% Fromaion of Ybus
for k=1:branch
i=fb(k);
j=tb(k);
ybus(i,j)=-y(k);
ybus(j,i)=-y(k);
ybus(i,i)=ybus(i,i)+y(k)+g(k);
ybus(j,j)=ybus(j,j)+y(k)+g(k);
end
display(ybus);
zbus=inv(ybus)
% now for falut at bus no. 4. we get
Vo=1; % intitial bus voltage
Zrr=zbus(4,4) ;
If=Vo/Zrr
% bus voltages
del_V=zbus*[0 ;0; 0 ;If];
fprintf('Bus voltage obtained in matrix form are')
V=1 - del_V

Result:

ybus =

0 -28.3333i 0 + 5.0000i 0 + 6.6667i 0 +10.0000i


0 + 5.0000i 0 -28.3333i 0 +10.0000i 0 + 6.6667i
0 + 6.6667i 0 +10.0000i 0 -16.6667i 0
0 +10.0000i 0 + 6.6667i 0 0 -16.6667i

zbus =

0 + 0.0903i 0 + 0.0597i 0 + 0.0719i 0 + 0.0781i


0 + 0.0597i 0 + 0.0903i 0 + 0.0781i 0 + 0.0719i
0 + 0.0719i 0 + 0.0781i 0 + 0.1356i 0 + 0.0744i
0 + 0.0781i 0 + 0.0719i 0 + 0.0744i 0 + 0.1356i

If =

0 - 7.3740i
Bus voltage obtained in matrix form are
V=

0.4244
0.4695
0.4515
0

Experiment #8

To write a computer program for obtaining symmetrical components for a


given set of unbalanced phasors. .
Exercise:
Ex1.

Write a computer program to analyze unbalanced phasors. Compute and plot symmetrical
components using above expressions for the following data:

with power frequency of 50 Hz

%% Matlab code for symmetrical components


clear all
clf
clc
close all
% define matrix A %
a=exp(1i*((2*pi)/3));
a2=a*a;
A=[1 1 1;1 a2 a;1 a a2];
% input data %
Varms=30;
Vbrms=230;
Vcrms=100;
Vap=0.01;
Vbp=-30;
Vcp=180;
Vaph=Vap*(pi/180);
Vbph=Vbp*(pi/180);
Vcph=Vcp*(pi/180);
Va=Varms*sqrt(2)*exp(1i*Vaph);
Vb=Vbrms*sqrt(2)*exp(1i*Vbph);
Vc=Vcrms*sqrt(2)*exp(1i*Vcph);
Vabc=[Va; Vb; Vc];
xlmx=max(Vabc);
% representation of symmetrical componets in time domain
f=50;
w=2*pi*f;
t=-0.02:0.00001:0.04;
Vaa=Varms*sqrt(2)*sin((w*t)+(Vaph));
Vbb=Vbrms*sqrt(2)*sin((w*t)+(Vbph));
Vcc=Vcrms*sqrt(2)*sin((w*t)+(Vcph));
Va0=(1/3)*(Vaa+Vbb+Vcc);
Va1=(1/3)*(Vaa+(Vbrms*sqrt(2)*sin((w*t)+(Vbph)+((2*pi)/3)))+(Vcrms*sqrt(2)*sin((w*t)+(Vcp
h)+((4*pi)/3))));
Va2=(1/3)*(Vaa+(Vbrms*sqrt(2)*sin((w*t)+(Vbph)+((4*pi)/3)))+(Vcrms*sqrt(2)*sin((w*t)+(Vcp
h)+((2*pi)/3))));
figure(1)
subplot(4,1,1)
plot(t,Vaa,t,Vbb,t,Vcc)
ylim([-abs(xlmx) abs(xlmx)])

title('unbalanced three phase voltage')


grid on
subplot(4,1,2)
plot(t,Va0)
ylim([-abs(xlmx) abs(xlmx)])
title('zero sequence voltage')
grid on
subplot(4,1,3)
plot(t,Va1)
ylim([-abs(xlmx) abs(xlmx)])
title('positive sequence voltage')
grid on
subplot(4,1,4)
plot(t,Va2)
ylim([-abs(xlmx) abs(xlmx)])
title('negative sequence voltage')
grid on
% Calculation of Symmetrical components of Phase A %

Va012=inv(A)*[Va; Vb; Vc];


figure(2)
plot([0 Va012(1)],'r')
title('Symmetrical components of Phase A')
xlim([-abs(xlmx) abs(xlmx)])
ylim([-abs(xlmx) abs(xlmx)])
axis ('square')
hold on
plot([0 Va012(2)],'g')
xlim([-abs(xlmx) abs(xlmx)])
ylim([-abs(xlmx) abs(xlmx)])
axis ('square')
hold on
plot([0 Va012(3)],'b')
xlim([-abs(xlmx) abs(xlmx)])
ylim([-abs(xlmx) abs(xlmx)])
axis ('square')
legend('Va0','Va1','Va2')
grid on
% Calculation of unbalanced phasors from symmetrical components %
Vabc1=A*Va012;
hold off
figure(3)
subplot(2,2,1)
plot([0 Vabc1(1)],'r')
title('Unbalance phase voltage')
xlim([-abs(xlmx) abs(xlmx)])
ylim([-abs(xlmx) abs(xlmx)])
axis ('square')
hold on
plot([0 Vabc1(2)],'g')
xlim([-abs(xlmx) abs(xlmx)])
ylim([-abs(xlmx) abs(xlmx)])
axis ('square')
hold on
plot([0 Vabc1(3)],'b')
xlim([-abs(xlmx) abs(xlmx)])
ylim([-abs(xlmx) abs(xlmx)])
axis ('square')
legend('Va','Vb','Vc')
grid on
% Calculation of positive negative and zero sequence component %
Vb0=Va012(1);
Vb1=a2*Va012(2);
Vb2=a*Va012(3);
Vb012=[Vb0 Vb1 Vb2];
Vc0=Va012(1);
Vc1=a*Va012(2);
Vc2=a2*Va012(3);
Vc012=[Vc0 Vc1 Vc2];
% plot of zero sequence set %
hold off
subplot(2,2,2)
plot([0 Va012(1)],'r')
title('zero sequence set')
xlim([-abs(xlmx) abs(xlmx)])
ylim([-abs(xlmx) abs(xlmx)])
axis ('square')
hold on
plot([0 Vb012(1)],'g')
xlim([-abs(xlmx) abs(xlmx)])
ylim([-abs(xlmx) abs(xlmx)])
axis ('square')
hold on
plot([0 Vc012(1)],'b')
xlim([-abs(xlmx) abs(xlmx)])
ylim([-abs(xlmx) abs(xlmx)])
axis ('square')
legend('Va0','Vb0','Vc0')
grid on
hold off
subplot(2,2,3)
plot([0 Va012(2)],'r')
title('positive sequence set')
xlim([-abs(xlmx) abs(xlmx)])
ylim([-abs(xlmx) abs(xlmx)])
axis ('square')
hold on
plot([0 Vb012(2)],'g')
xlim([-abs(xlmx) abs(xlmx)])
ylim([-abs(xlmx) abs(xlmx)])
axis ('square')
hold on
plot([0 Vc012(2)],'b')
xlim([-abs(xlmx) abs(xlmx)])
ylim([-abs(xlmx) abs(xlmx)])
axis ('square')
legend('Va1','Vb1','Vc1')
grid on
hold off
subplot(2,2,4)
plot([0 Va012(3)],'r')
title('negative sequence set')
xlim([-abs(xlmx) abs(xlmx)])
ylim([-abs(xlmx) abs(xlmx)])
axis ('square')
hold on
plot([0 Vb012(3)],'g')
xlim([-abs(xlmx) abs(xlmx)])
ylim([-abs(xlmx) abs(xlmx)])
axis ('square')
hold on
plot([0 Vc012(3)],'b')
xlim([-abs(xlmx) abs(xlmx)])
ylim([-abs(xlmx) abs(xlmx)])
axis ('square')
legend('Va2','Vb2','Vc2')
grid on
Experiment #9
To write a computer program for animation of traveling waves of a long
transmission line.
Exercise:

Write a computer program for the animation of traveling wave having following data of
numerical:

Consider a transmission line with length of 400 km having sending end voltage 220 kV, 50 Hz,
3-phase transmissionline having defined by line parameters r = 0.125 Ω/km, x = 0.4 Ω/km, and y
= 2.8X10-06 mho/km.
With α = 0.163X10-3 and β = 1.068X103

Solution:

clc
clear all
close all
% length of transmission line
len=400
% varry length of Tx line from 0 to len
x=0:0.1:len
% given data
Vr=220
Zc=400
Ir=00 % no load condition
alpha=0.163e-3*15 %assuming higher value for understanding purpose
beta=1.068e-3*50 %assuming higher value for understanding purpose
gma=alpha+i*beta
A1=((Vr+Zc*Ir)/2)
A2=((Vr-Zc*Ir)/2)
w=2*pi*50

%run for loop for each instant of time


for t=0:0.0001:0.2
% incedent wave
V1_x=sqrt(2)*A1*exp(alpha*x).*cos(w*t+beta*x);
% reflected wave
V2_x=sqrt(2)*A2*exp(-alpha*x).*cos(w*t-beta*x);
subplot(3,3,[1 2])
plot(x,V1_x)
axis([0,len,-4e2 4e2])
title('Incident wave "Vx1"')
ylabel('Voltage (kV)')
subplot(3,3,[4 5])
plot(x,V2_x)
axis([0,len,-2e2 2e2])
title('Reflected wave "Vx2"')
ylabel('Voltage (kV)')
subplot(3,3,[7 8])
plot(x,V1_x+V2_x)
axis([0,len,-5e2 5e2])
title('Vx1 + Vx2')
xlabel('distance (km)')
ylabel('Voltage (kV)')

%% calculate Volatge at 1) sending end 2) midpoint 3) receiving end


V1_200=sqrt(2)*A1*exp(alpha*len/2).*cos(w*t+beta*len/2);
V2_200=sqrt(2)*A2*exp(-alpha*len/2).*cos(w*t-beta*len/2);
V1_0=sqrt(2)*A1*exp(alpha*00).*cos(w*t+beta*00);
V2_0=sqrt(2)*A2*exp(-alpha*00).*cos(w*t-beta*00);
V1_400=sqrt(2)*A1*exp(alpha*len).*cos(w*t+beta*len);
V2_400=sqrt(2)*A2*exp(-alpha*len).*cos(w*t-beta*len);
% plot these voltages
subplot(3,3,[3,6,9])
plot([0,0],[V1_200+V2_200,0])
hold on
plot([-1,-1],[V1_0+V2_0,0],'r')
plot([1,1],[V1_400+V2_400,0],'g')
axis([-3,3,-5e2 5e2])
title('Voltage at different instants')
ylabel('Voltage (kV)')
set(gca,'XTick',[-1 0 1] );
set(gca,'XTickLabel',{'Vr' 'Vm' 'Vs'});
%legend('Vs','Vm','Vr')
grid on
hold off
% pause simulation for some time to see effects
pause(0.02)
end

Fig. 9.1. Animation of travelling waves


Experiment # 10

To verify power invariance for symmetrical components using computer


program

Exercise:

Write a computer program to verify power invariance for symmetrical components for the
following data:

unbalanced voltage input for phase a, b, c

Va = 568.3121 + j369.9066
Vb = -305.6848 - j406.7205
Vc = -222.6273 + j36.8139

unbalanced current input for phase a, b, c

Ia = 1.7754 + j0.8157
Ib = -4.0194 - j13.1284
Ic = -5.8983 - j5.6112

clear all
close all
clc

% Define constant "a" as complex exponential of 2*pi/3 radians


a=exp(1j*(2*pi/3));
a2=a*a;

% Create matrix A with elements [1 1 1; 1 a^2 a; 1 a a^2] to transform unbalanced voltage and
current to symmetrical components
A=[1 1 1;1 a2 a;1 a a2];

% Define unbalanced voltage inputs Va, Vb, and Vc as complex numbers


Vap=(11.3)*(pi/180);
Vbp=(-141.39)*(pi/180);
Vcp=(136.24)*(pi/180);
Va=661.17*exp(1j*Vap);
Vb=525.25*exp(1j*Vbp);
Vc=221.43*exp(1j*Vcp);

% Define unbalanced current inputs Ia, Ib, and Ic as complex numbers


Iap=(103.56)*(pi/180);
Ibp=(-156.8)*(pi/180);
Icp=(-168.55)*(pi/180);
Ia=4.265*exp(1j*Iap);
Ib=17.20*exp(1j*Ibp);
Ic=12.99*exp(1j*Icp);

% Calculate symmetrical components of unbalanced voltage using matrix multiplication of


inverse of A and unbalanced voltage inputs
Vabc=[Va; Vb; Vc];
V012=inv(A)*Vabc;

% Calculate symmetrical components of unbalanced current using matrix multiplication of


inverse of A and unbalanced current inputs
Iabc=[Ia; Ib; Ic];
I012=inv(A)*Iabc;

% Calculate complex power using unbalanced voltage and current inputs


S1=Va*conj(Ia)+Vb*conj(Ib)+Vc*conj(Ic);

% Calculate complex power using symmetrical components


S2=3*(sum(V012.*conj(I012)));

% Verify power invariance for symmetrical components


if abs(S1 - S2) < 1e-6
disp('Power invariance for symmetrical components verified.')
else
disp('Error: Power invariance for symmetrical components not verified.')
end

You might also like