PSLAB
PSLAB
LABORATORY MANUAL
For
CONTENTS
S.NO.
TITLE OF EXPERIMENT
PAGE.NO
E1
1-4
E2
5-6
E3
7-8
E4
9-12
E5
13-14
E6
15-17
E7
18-20
E8
21-23
E9
24-26
E10
27-29
1. Introduction to MATLAB:
MATLAB is a widely used numerical computation package. It serves both as a simple
calculator and as a sophisticated tool for making long complicated calculations and
plot graphs of different functions depending upon requirement. Models of dynamic
systems can be built easily using SIMULINK.
Some Benefits of MATLAB are:
Simple to use
Fast computations are possible
Wide working range
Solution of matrix of any order
Desired operations are performed in matrices
Different Programming languages can be used
Simulation is possible
Matrix computations
Vector Analysis
Differential Equations computations
Integration
Computer language programming
Simulation
2-D & 3-D Plotting
Further Reading:
1. Modern Power System Analysis, 4th Edition by Nagrath & Kothari
2. Introduction to MATLAB by Rudra Pratap
3. MATLAB User Manual by Mathworks
2. Basic Commands:
Some basic MATLAB commands are given as follows. Type these at the command
prompt to verify.
Addition: A+B
Division: A/B
Range : A: B
Subtraction: A-B
Multiplication: A*B
Power: A^B
Power of individual element: A. ^B
Square-Root: A=sqrt (B) where A & B are any arbitrary integers
Creating a Vector:
Lets create a simple vector with 9 elements called a.
a = [1 2 3 4 6 4 3 4 5]
a=
1
2
3
4
Now let's add 2 to each element of our vector, a, and store the result in a new
vector.Notice how MATLAB requires no special handling of vector or matrix math.
Adding an element to a Vector:
b=a+2
b=
3
4
5
6
8
Creating a matrix:
One area in which MATLAB excels is matrix computation. Creating a matrix is as
easy as making a vector, using semicolons (;) to separate the rows of a matrix.
A = [1 2 0; 2 5 -1; 4 10 -1]
A=
1
2
0
2
5
-1
4
10
-1
Adding a new Row:
A(4,:)=[7 8 9]
ans=
1
2
0
2 5 -1
4 10 -1
7 8
9
Adding a new Column:
A(:,4)=[7 8 9]
ans=
1 2
0 7
2 5 -1 8
4 10 -1 9
Transpose:
We can easily find the transpose of the matrix A.
A = [1 2 0; 2 5 -1; 4 10 -1]
A'
=
1
2
0
2
5
-1
4
10
-1
Matrix Multiplication:
Now let's multiply these two matrices together. Note again that MATLAB doesn't
require you to deal with matrices as a collection of numbers. MATLAB knows when
you are dealing with matrices and adjusts your calculations accordingly.
A = [1 1 1; 2 2 2; 3 3 3]
B = [4 4 4; 5 5 5; 6 6 6]
C =A*B
C=
15
30
45
15
30
45
15
30
45
4
10
18
Inverse:
Let's find the inverse of a matrix
A = [1 2 0; 2 5 -1; 4 10 -1]
X=inv(A)
X=
5 2 -2
-2 -1
1
0 -2
1
... and then illustrate the fact that a matrix times its inverse is the identity
matrix.
I = inv (A) * A
I=
1 0
0
0 1
0
0 0
1
Commands used:
Result:
***************
Solve the problem theoretically. Vary the length of the long transmission
line in steps of 10 KM from zero (receiving end) to 5000KM (sending end),
and plot the sending end voltage phasor using MATLAB.
THEORY:
THEORETICAL SOLUTION:
MATLAB PROGRAM:
%Program to illustrate Ferranti effect
%it simulates the effect by varying the length of transmission line from
%zero(receiving end) to 5000km in steps of 10km
%and plots the sending end voltage phasor
clc
clear all
VR=220e3/sqrt(3);
alpha=0.163e-3;
beta=1.0683e-3;
L=5000;
k=1;
for i=0:10:L,
VS=(VR/2)*exp(alpha*i)*exp(j*beta*i)+(VR/2)*exp(-alpha*i)*exp(-j*beta*i);
X(k)=real(VS);
Y(k)=imag(VS);
k=k+1;
p(k)=VS;
q(k)=i;
end
figure(1);
plot(p,q)
figure(2);
plot(X,Y)
EXPECTED OUTPUT:
x 10
15
x 10
2
X: 200
Y: 1.242e+005
Resultant Voltage in KV
-2
-4
-6
10
-8
-10
-12
-1.5
-1
-0.5
0
0.5
Real part of sending end voltage VS in volts
1.5
5
x 10
500
1000
1500
3500
4000
4500
5000
Commands used:
RESULT:
***************
EXPECTED OUTPUT:
|IS| using shortline & nominalpi methods
190
1
Shortline
Nominalpi
180
X: 300
Y: 164
Shortline
Nominalpi
0.9
Sending end P.f
170
|IS| in A
X: 300
Y: 0.9881
0.95
160
150
0.85
0.8
X: 300
Y: 0.7455
140
0.75
X: 300
Y: 128.1
130
0.7
120
100
300
400
Length of line in Km
500
600
0.65
1.65
200
x 10
5.7
Shortline
Nominalpi
1.6
100
x 10
200
300
400
Length of line in Km
500
600
5.6
|VS| in V
1.5
1.55
X: 300
Y: 1.451e+005
1.45
X: 300
Y: 1.375e+005
1.4
1.35
5.4
X: 300
Y: 5.323e+007
5.3
X: 300
Y: 5.221e+007
5.2
5.1
1.3
1.25
5.5
100
200
300
400
Length of line in Km
500
600
100
200
300
400
Length of line in Km
500
600
Commands used:
RESULT:
***************
Department of E.E.E., Sir C.R.Reddy College of Engineering, Eluru, AP
Page 8 of 29
Bus
Pi , pu
Qi , pu
Vi , pu
Remarks
1.04 0 0
Slack bus
0.5
-0.2
PQ bus
-1.0
0.5
PQ bus
0.3
-0.1
PQ bus
YBUS
3 j9
2 j 6
= 1 j3
2.00 j6
3.666 j11
1.00 j3
0.666 j 2
0.666 j 2
3.666 j11
1.00 j3
2.00 j6
0
1 j3
2 j6
3 j9
THEORY:
THEORETICAL SOLUTION:
MATLAB PROGRAM:
% Load flow using gauss siedel method
clc
clear
n=4;
V=[1.04 1 1 1];
Y=[3-j*9
-2+j*6
-1+j*3 0
-1+j*3
-2+j*6
3-j*9];
type=ones(n,1);
typechanged=zeros(n,1);
Qlimitmax=zeros(n,1);
Qlimitmin=zeros(n,1);
Vmagfixed=zeros(n,1);
type(2)=2;
Qlimitmax(2)=1.0;
Qlimitmin(2)=-0.2;
Vmagfixed(2)=1.04;
diff=10;
noofiter=1;
Vprev=V;
while (diff>0.00001 | noofiter==1),
Department of E.E.E., Sir C.R.Reddy College of Engineering, Eluru, AP
Page 10 of 29
abs(V);
abs(Vprev);
Vprev=V;
P=[inf 0.5 -1 0.3];
Q=[inf -0.3 0.5 -0.1];
S=[inf 0.5-j*0.2 -1.0+j*0.5 0.3-j*0.1];
for i=2:n,
if type(i)==2 |typechanged(i)==1,
if (Q(i)>Qlimitmax(i)| Q(i)<Qlimitmin(i))
if (Q(i)<Qlimitmin(i))
Q(i)=Qlimitmin(i);
else
Q(i)=Qlimitmax(i);
end
type(i)=1;
typechanged(i)=1;
else
type(i)=2;
typechanged(i)=0;
end
end
sumyv=0;
for k=1:n,
if(i~=k)
Department of E.E.E., Sir C.R.Reddy College of Engineering, Eluru, AP
Page 11 of 29
sumyv=sumyv+Y(i,k)*V(k);
end
end
V(i)=(1/Y(i,i))*((P(i)-j*Q(i))/conj(V(i))-sumyv)
if type(i)==2 & typechanged(i)~=1,
V(i)=PolarTorect(Vmagfixed(i),angle(V(i)*180/pi))
end
end
diff=max(abs(abs(V(2:n))-abs(Vprev(2:n))));
noofiter=noofiter+1
end
EXPECTED OUTPUT:
no of iterations
1
2
3
4
5
6
7
8
9
10
11
12
13
14
V1
1.04
1.04
1.04
1.04
1.04
1.04
1.04
1.04
1.04
1.04
1.04
1.04
1.04
1.04
V2
1.0191 + 0.0464i
1.0290 + 0.0269i
1.0335 + 0.0223i
1.0360 + 0.0193i
1.0374 + 0.0176i
1.0382 + 0.0167i
1.0386 + 0.0161i
1.0388 + 0.0158i
1.0390 + 0.0157i
1.0390 + 0.0156i
1.0391 + 0.0155i
1.0391 + 0.0155i
1.0391 + 0.0155i
1.0391 + 0.0155i
V3
1.0280 - 0.0870i
1.0352 - 0.0934i
1.0401 - 0.0999i
1.0427 - 0.1034i
1.0442 - 0.1053i
1.0450 - 0.1064i
1.0455 - 0.1070i
1.0457 - 0.1074i
1.0459 - 0.1076i
1.0460 - 0.1077i
1.0460 - 0.1078i
1.0460 - 0.1078i
1.0460 - 0.1078i
1.0461 - 0.1078i
V4
1.0250 - 0.0092i
1.0334 - 0.0208i
1.0385 - 0.0269i
1.0413 - 0.0304i
1.0429 - 0.0324i
1.0437 - 0.0335i
1.0442 - 0.0341i
1.0445 - 0.0344i
1.0446 - 0.0346i
1.0447 - 0.0347i
1.0448 - 0.0348i
1.0448 - 0.0348i
1.0448 - 0.0348i
1.0448 - 0.0349i
Commands used:
RESULT:
*********************
dF1
= 0.2P1+40
dP1
and
dF2
= 0.25P2+30
dP2
Assume that both units are operating at all times, and total load varies from 40 MW to 250
MW, and the maximum and minimum loads on each unit are to be 125 MW and 20 MW
respectively. How will the load be shared between the two units as the system load varies
over the full range? What are the corresponding values of the plant incremental costs?
Solve the problem theoretically and verify using MATLAB.
THEORY:
THEORETICAL SOLUTION:
MATLAB PROGRAM:
% the demand is taken as 231.25 MW, n is no of generators, Pd stands for load
%demand; alpha and beta arrays denote alpha beta coefficients for given
%generators
clc
clear all
if Pg(i)>Pgmax(i)
Pg(i)=Pgmax(i);
end
if Pg(i)<Pgmin(i)
Pg(i)=Pgmin(i);
end
end
if (sum(Pg)-Pd)<0
lamdaprev=lamda;
lamda=lamda+deltalamda;
else
lamdaprev=lamda;
lamda=lamda-deltalamda;
end
end
disp('The final value of Lamda is')
lamdaprev
disp('The distribution of load shared by two units is')
Pg
EXPECTED OUTPUT:
The final value of Lamda is
lamdaprev = 61.2500
The distribution of load shared by two units is
Pg =
106.2500
125.0000
Commands used:
RESULT:
****************
Department of E.E.E., Sir C.R.Reddy College of Engineering, Eluru, AP
Page 14 of 29
Solve the problem theoretically. Use the data in the following MATLAB program
THEORY:
THEORETICAL SOLUTION:
MATLAB PROGRAM:
% this program finds the optimal loading of generators including penalty factors
% Pd stands for load demand, alpha and beta arrays denote alpha beta coefficients
%for given generators, and n is the no of generators
clc
clear
n=2;Pd=237.04;
alpha=[0.020 0.04];
beta=[16 20];
% initial guess for lamda is 20;tolerance is eps and increment in lamda is deltalamda
Department of E.E.E., Sir C.R.Reddy College of Engineering, Eluru, AP
Page 15 of 29
0];
noofiter=0;PL=0;Pg = zeros(n,1);
while abs(sum(Pg)-Pd-PL)>eps
for i=1:n,
sigma=B(i,:)*Pg-B(i,i)*Pg(i);
Pg(i)=(1-beta(i)/(lamda-(2*sigma)))/(alpha(i)/lamda+2*B(i,i));
%PL=Pg'*B*Pg;
if Pg(i)>Pgmax (i)
Pg(i)=Pgmax (i);
end
if Pg(i)<Pgmin(i)
Pg(i)=Pgmin(i);
end
end
PL = Pg'*B*Pg;
if (sum(Pg)-Pd-PL)<0
lamdaprev=lamda;
lamda=lamda+deltalamda;
else
lamdaprev=lamda;
lamda=lamda-deltalamda;
end
noofiter=noofiter + 1;
Pg;
end
25
Commands used:
RESULT:
************
pa=pm-pmax*sin(delta);
ddelta=ddelta+(delT^2*(pa/m));
delta=(delta*180/pi+ddelta)*(pi/180);
deltadeg=delta*180/pi;
t=t+delT;
time(i)=t;
ang(i)=deltadeg;
i=i+1;
end
end
EXPECTED OUTPUT:
swing equation by point by point method
200
180
160
angle in degrees
140
120
100
80
60
40
20
0
0.1
0.2
0.3
time in seconds
0.4
0.5
Commands used:
RESULT:
*************
Kg=10
Tg=0.4
R=3
Kt=0.1
Tt=0.5
Kp=100
Tp=20
PD=0.01 pu
An integral controller with gain Ki=0.09 is now used to reduce steady state error.
What is the dynamic response of the system with and without the controller?
Obtain the dynamic response of the system with and without the PI
controller by developing a SIMULINK model and verify the responses
THEORY:
THEORETICAL MODEL:
THEORETICAL SOLUTION:
Transfer Fcn6
-0.09
Constant
Subtract2
Subtract
Transfer Fcn3
0.4s+1
10
1/3
Gain
Step
Transfer Fcn
0.4s+1
10
0.1
Transfer Fcn1
0.5s+1
1/3
Gain1
Transfer Fcn4
0.5s+1
0.1
Subtract1
Step1
100
Subtract3
Transfer Fcn2
20s+1
100
Transfer Fcn5
20s+1
Scope1
EXPECTED OUTPUT:
X: 20
Y: -0.0002159
-0.01
-0.02
X: 20
Y: -0.02915
-0.03
-0.04
-0.05
10
12
Time in sec
14
16
18
20
Blocks used:
RESULT:
**********
Ksg=1
Tsg=0.4
R=3
Kt=1
Tt=0.5
Kps=100
Tps=10
Ki=0.07
Tr=0.05
0.425s
Develop a SIMULINK model for two area load frequency control with PI controller
and obtain the frequency deviations in both areas and tie-line power deviations for a
load change of 1pu in Area-2
THEORY:
THEORETICAL MODEL:
THEORETICAL SOLUTION:
0.425
Transfer Fcn8
T ransfer Fcn9
Transfer Fcn2
T ransfer Fcn
0.4s+1
1/3
-0.07
Scope
Step
0.5s+1
Transfer Fcn3
Transfer Fcn4
10s+1
100
Scope2
0.05
Scope1
Step2
10s+1
100
Transfer Fcn5
Transfer Fcn12
Gain
-1
T ransfer Fcn6
0.5s+1
1
0.4s+1
T ransfer Fcn7
1/3
Transfer Fcn10
-0.07
Transfer Fcn1
0.425
Transfer Fcn11
SIMULINK MODEL:
EXPECTED OUTPUT:
2
1
0
-1
-2
-3
-4
-5
-6
-7
20
40
60
80
100
120
140
160
180
200
1.5
1
0.5
0
-0.5
-1
-1.5
-2
-2.5
-3
20
40
60
80
100
120
140
160
180
200
Blocks used:
RESULT:
**********
THEORETICAL SOLUTION:
This
experiment
is
solution
of
swing
equation
of
experiment
implemented in SIMULINK.
SIMULINK MODEL:
SUBSYSTEM DETAILS:
SUBSYSTEM1 DETAILS:
EXPECTED OUTPUT:
Blocks used:
RESULT:
**********