You are on page 1of 59

INTRODUCTION TO MATLAB

Expt.No:1
Date :

OBJECTIVES

(i) To procure sufficient knowledge in MATLAB to solve the power system Problems.

(ii) To write a MATLAB program.

SOFTWARE REQUIRED

(i) MATLAB

1. INTRODUCTION TO MATLAB

MATLAB is a high performance language for technical computing. It integrates
computation, visualization and programming in an easy-to-use environment where problems and
solutions are expressed in familiar mathematical notation.

MATLAB is numeric computation software for engineering and scientific calculations.
MATLAB is primary tool for matrix computations. MATLAB is being used to simulate random
process, power system, control system and communication theory.

MATLAB comprising lot of optional tool boxes and block set like control system,
optimization, and power system and so on.

1.1. TYPICAL USES INCLUDE

 Math and computation.

 Algorithm development.

 Modeling, simulation and prototype.

 Data analysis, exploration and Visualization.

 Scientific and engineering graphics.

 Application development, including graphical user interface building.

MATLAB is a widely used tool in electrical engineering community. It can be used for simple
mathematical manipulation with matrices for understanding and teaching basic mathematical and
engineering concepts and even for studying and simulating actual power system and electrical system
in general. The original concept of a small and handy tool has evolved to become an engineering work
house. It is now accepted that MATLAB and its numerous tool boxes replace and/or enhance the usage
of traditional simulation tool for advanced engineering applications.

1

Engineering personnel responsible for studies of electrical power system, control system and
power electronics circuits will benefit from the MATLAB. To expertise in Electrical System
Simulation one should have a basic understanding of electric circuits, power system and power
electronics.

1.2. GETTING STARTED WITH MATLAB

To open the MATLAB applications double click the Matlab icon on the desktop. This will open
the MATLAB window space with Matlab prompt as shown in the fig.1.

Fig-1: MATLAB window space

To quit from MATLAB type…

>> quit
(Or)
>>exit
To select the (default) current directory click ON the icon […] and browse for the folder named
“D:\SIMULAB\xxx”, where xxx represents roll number of the individual candidate in which a folder
should be created already.

When you start MATLAB you are presented with a window from which you can enter
commands interactively. Alternatively, you can put your commands in an M- file and execute it at the
MATLAB prompt. In practice you will probably do a little of both. One good approach is to
incrementally create your file of commands by first executing them.
M-files can be classified into following 2 categories,

i) Script M-files – Main file contains commands and from which functions can
also be called.
ii) Function M-files – Function file that contains function command at the first
line of the M-file.
M-files to be created by you should be placed in your default directory. The M-files developed
can be loaded into the work space by just typing the M-file name.

2

To load and run a M-file named “ybus.m” in the workspace.

>>ybus

These M-files of commands must be given the file extension of “.m”. However M-files are not
limited to being a series of commands that you don’t want to type at the MATLAB window, they can
also be used to create user defined function. It turns out that a MATLAB tool box is usually nothing
more than a grouping of M-files that someone created to perform a special type of analysis like control
system design and power system analysis. Any of the matlab commands (eg: sqrt) is really an M-file.

One of the more generally useful matlab tool boxes is simulink – a drag and-drop dynamic
system simulation environment. This will be used extensively in laboratory, forming the heart of the
computer aided control system design (CACSD) methodology that is used.
>>simulink
At the matlab prompt type simulink and brings up the “Simulink Library Browser”. Each of the
items in the Simulink Library Browser are the top level of a hierarchy of palette of elements that you
can add to a simulink model of your own creation. At this time expand the “simulink” pallete as it
contains the majority of the elements you will use in this course. Simulink has built into it a variety of
integration algorithm for integrating the dynamic equations. You can place the dynamic equations of
your system into simulink in four ways.
1 Using integrators
2. Using transfer functions.
3. Using state space equations.
4. Using S- functions (the most versatile approach)
Once you have the dynamics in place you can apply inputs from the “sources” palettes and look
at the results in the “sinks” palette.

Finally the most important MATLAB features are its help. At the MATLAB Prompt simply
typing helpdesk gives you access to searchable help as well as all the MATLAB manuals.
>>helpdesk

To get the details about the command name sqrt, just type…

>>help sqrt

Where sqrt is the command name and you will get pretty good description in the MATLAB
window as follows.
/SQRT Square root.
SQRT(X) is the square root of the elements of X. Complex
results are produced if X is not positive.

See also SQRTM.

Overloaded methods
help sym/sqrt.m

3

1.3 MATLAB WORKSPACE
The workspace is the window where you execute MATLAB commands (Ref. figure-1). The best
way to probe the workspace is to type whos. This command shows you all the variables that are
currently in workspace. You should always change working directory to an appropriate location under
your user name.

Another useful workspace-like command is
>>clear all

It eliminates all the variables in your workspace. For example start MATLAB and execute the
following sequence of commands
>>a=2;
>>b=5;
>>whos
>>clear all
The first two commands loaded the two variables a and b to the workspace and assigned value
of 2 and 5 respectively. The clear all command clear the variables available in the work space. The
arrow keys are real handy in MATLAB. When typing in long expression at the command line, the up
arrow scrolls through previous commands and down arrow advances the other direction. Instead of
retyping a previously entered command just hit the up arrow until you find it. If you need to change it
slightly the other arrows let you position the cursor anywhere.

Finally any DOS command can be entered in MATLAB as long as it is preceded by any
exclamination mark.
>>!dir
1.4 MATLAB Data Types

The most distinguishing aspect of MATLAB is that it allows the user to manipulate vectors (like
5+j8) and matrices with the same ease as manipulating scalars (like5,8). Before diving into the actual
commands everybody must spend a few moments reviewing the main MATLAB data types. The three
most common data types you may see are,

1) arrays 2) strings 3) structures.
As for as MATLAB is concerned a scalar is also a 1 x 1 array. For example clear your
workspace and execute the commands.

>>a=4.2:
>>A=[1 4;6 3];
>>whos
Two things should be evident. First MATLAB distinguishes the case of a variable name and
that both a and A are considered arrays. Now let’s look at the content of A and a.

>>a
>>A

4

Again two things are important from this example. First anybody can examine the contents
of any variables simply by typing its name at the MATLAB prompt. Second, when typing in a matrix
space between elements separate columns, whereas semicolon separate rows. For practice create the
matrix in your workspace by typing it in all the MATLAB prompt.

>>B= [3 0 -1; 4 4 2;7 2 11];
(use semicolon(;) to represent the end of a row)
>>B
Arrays can be constructed automatically. For instance to create a time vector where the time
points start at 0 seconds and go up to 5 seconds by increments of 0.001

>>mytime =0:0.001:5;
Automatic construction of arrays of all ones can also be created as follows,
>>myone=ones (3,2)
Note:
Any MATLAB command can be terminated by a semicolon, which suppressed any echo
information to the screen.

1.5 Scalar versus Array Mathematical Operation

Since MATLAB treats everything as an array, you can add matrices as easily as scalars.
Example:
>>clear all
>> a=4;
>> A=7;
>>alpha=a+A;
>>b= [1 2; 3 4];
>>B= [6 5; 3 1];
>>beta=b+B
Of course cannot violate the rules of matrix algebra which can be understood from the following
example.
>>clear all
>>b=[1 2;3 4];
>>B=[6 7];
>>beta=b*B
In contrast to matrix algebra rules, the need may arise to divide, multiply, raise to a
power one vector by another, element by element. The typical scalar commands are used for this “+,-,/,
*, ^” except you put a “.” in front of the scalar command. That is, if you need to multiply the elements
of [1 2 3 4] by [6 7 8 9], just type...

>>[1 2 3 4].*[6 7 8 9]

5

6 . >>clear all >>t=0:10:360. To see a plot of y versus t simply type. specifically the use of handle graphics.y) To add label. legend. >>legend (‘Signal’).7 PLOTTING MATLAB’s potential in visualizing data is pretty amazing. grid and title use >>xlabel (‘Time in sec’).Yields the sum of 1^2+3^2+5^2+7^2+9^2 1. MATLAB supports a variety of conditional statements and looping statements. The helpdesk provides access to a pdf manual on handle graphics for those really interested in it. >>ylabel (‘Voltage in volts’) >>title (‘Sinusoidal O/P’). To explore these simply type >>help if >>help for >>help while Example : >>if z=0 >>y=0 >>else >>y=1/z >>end Looping : >>for n=1:2:10 >>s=s+n^2 >>end . >>y=sin (pi/180 * t). One of the nice features is that with the simplest of commands you can have quite a bit of capability.6 Conditional Statements Like most Programming languages.1. >>plot(t. Graphs can be plotted and can be saved in different formulas. The commands above provide the most plotting capability and represent several shortcuts to the low-level approach to generating MATLAB plots.

2 Otherwise the same function can be called for any times from any script file provided the function M- file is available in the current directory. admin. MATLAB functions allow you much capability to expand MATLAB’s usefulness.(arguments) and provides some output. y=[0. 1 0. We will just touch on function here as you may find them beneficial later.2 0. Using an editor. Concerned with the “Power System Simulation Laboratory”.A function is a generalized input/output device. ans = 0. >>z=[5 2 4. That is you can give some input. list the expressions used in the problem and then build your own MATLAB program or function.2] which is the reciprocal of each elements.m”. The commands and functions that comprise the new function must be put in a file whose name defines the name of the new function. 1 4 5] >>admin(z) The output will be. initially solve the Power System Problems manually.5 0. With this introduction anybody can start programming in MATLAB and can be updated themselves by using various commands and functions available.8 Functions As mentioned earlier. type the following commands and save as “admin.25 0.m”.25 0. with a filename extension of '. 7 . a M-file can be used to store a sequence of commands or a user-defined function.1.25 1 0.25.m : function y = admin(z) y = 1. 1 4 5] as input.2 0. We will start by looking at the help on functions : >>help function We will create our own function that given an input matrix returns a vector containing the admittance matrix(y) of given impedance matrix(z)’ z=[5 2 4.m'. To perform the same name the function “admin” and noted that “admin” must be stored in a function M-file named “admin./z return Simply call the function admin from the workspace as follows.5 0. the output would be.

Result: 8 .

GMD= (D12.No:2 Date : AIM To determine the positive sequence line parameters L and C per phase per kilometer of a three phase single and double circuit transmission lines for different conductor arrangements .7788 r Where. COMPUTATION OF TRANSMISSION LINES PARAMETERS Expt. ALGORITHM: Step 1: Start the Program. D23. inductance.0556/ ln (Deq / r) μF/km Where. capacitance and conductance.7788 r Capacitance: A general formula for evaluating capacitance per phase in micro farad per km of a transmission line is given by C = 0. GMD is the “Geometric mean distance” which is same as that defined for inductance under various cases. Step 3: From the formula given calculate GMD. Dm = geometric mean distance (GMD) Ds = geometric mean radius (GMR) Single phase 2 wire system GMD = D GMR = re-1/4 = r' = 0. SOFTWARE REQUIRED: MATLAB 7. 9 . The resistance of the conductor is best determined from the manufactures data. the inductances and capacitances can be evaluated using the formula. The inductance and capacitance are due to the effect of magnetic and electric fields around the conductor.2 ln (Dm / Ds) mH / KM Where.6 THEORY Transmission line has four parameters namely resistance. Step 5: End the Program. D23 and D13. D13)1/3 Step 4: Calculate the Value of Impedance and Capacitance of the line. r = radius of conductor & GMR = re-1/4 = r' = 0. r = radius of conductor Three phase – symmetrical spacing GMD = D GMR = re-1/4 = r' Where. Step 2: Get the input values for distance between the conductors and bundle spacing of D12. FORMULAS: Inductance: The general formula: L = 0.

(a) Determine the inductance and capacitance per phase per kilometer of the above three lines. inductance=0.2*Y capacitance=0.008374 mf/ph/km EXERCISE: 2 A 345-kV double-circuit three-phase transposed line is composed of two AC SR. 4.625cm Calculate the inductance and capacitance of the transposed conductors.377882 mH/ph/km The capacitance per phase per km is 0. Output of the program The inductance per phase per km is 1. (b) Verify the results using the MATLAB program. 45/7 Bobolink conductors per phase with vertical conductor configuration as show in figure.capacitance). D31=input('enter the distance between D31in cm: ').427 inch and a GMR of 0. D23=input('enter the distance between D23in cm: ').PROCEDURE: 1. Execute the program by either pressing Tools – Run. 2. Ds=0.564 inch. Type and save the program in the editor window. d=input('enter the value of d: ').0556/(log(Deq/r)) fprintf('\n The inductance per phase per km is %f mH/ph/km \n'. fprintf('\n The capacitance per phase per km is %f mf/ph/km \n'.000-cmil. The bundle spacing in 18 inch.7788*r. View the results EXERCISE: 1 A three phase transposed line has its conductors placed at a distance of 11M. 11 M & 22 M. Find the inductance and capacitance per phase per Kilometer of the Line. PROGRAM: %3 phase single circuit D12=input('enter the distance between D12in cm: ').New – M – File 3. Enter the command window of the MATLAB. The Following commands 10 .inductance). The conductors have a diameter of 3. r=d/2. x=D12*D23*D31. 1. 5. The conductors have a diameter of 1.431. Deq=nthroot(x. Create a new M – file by selecting File .3). Y=log(Deq/Ds).

377882 mH/ph/km The capacitance per phase per km is 0.0556/(log(Deq/r)) fprintf('\n The inductance per phase per km is %f mH/ph/km \n'. inductance=0. D23=input('enter the distance between D23in cm: '). d=input('enter the value of d: ').3).2*Y capacitance=0. 11 . Ds=0. r=d/2. Output of the program The inductance per phase per km is 1.7788*r. Deq=nthroot(x. fprintf('\n The capacitance per phase per km is %f mf/ph/km \n'.capacitance). Y=log(Deq/Ds). x=D12*D23*D31.008374 mf/ph/km RESULT: Thus the positive sequence line parameters L and c per phase per kilometer of a three phase single and double circuit transmission lines for different conductor arrangement were determined and verified with MATLAB software.PROGRAM: %3 phase double circuit %3 phase single circuit D12=input('enter the distance between D12in cm: '). D31=input('enter the distance between D31in cm: ').inductance).

the inductances and capacitances can be evaluated using the formula. MODELLING OF TRANSMISSION LINES PARAMETER Expt. r = radius of conductor & GMR = re-1/4 = r' = 0. The inductance and capacitance are due to the effect of magnetic and electric fields around the conductor.2 ln (Dm / Ds) mH / KM Where.7788 r Capacitance: A general formula for evaluating capacitance per phase in micro farad per km of a transmission line is given by C = 0. GMD is the “Geometric mean distance” which is same as that defined for inductance under various cases.No:3 Date : AIM: To understand the modeling and performance of medium lines SOFTWARE REQUIRED: MATLAB 7. FORMULAS: Inductance: The general formula: L = 0.6 THEORY: Transmission line has four parameters namely resistance. The resistance of the conductor is best determined from the manufactures data. ALGORITHM: Step 1: Start the Program. Step 2: Get the input values for conductors. Step 5: To find Receiving end Current and Sending end Voltage and Current. Step 3: To find the admittance (y) and impedance (z). Step 6: To find the Power factor and sending ending power and Regulation. inductance. 12 . Dm = geometric mean distance (GMD) Ds = geometric mean radius (GMR) Single phase 2 wire system GMD = D GMR = re-1/4 = r' = 0. r = radius of conductor Three phase – symmetrical spacing GMD = D GMR = re-1/4 = r' Where. Step 4: To find Receiving end Voltage and Receiving end Power. capacitance and conductance.0556/ ln (Deq / r) μF/km Where.7788 r Where.

Type and save the program in the editor window. S33 = S(3). rB = sqrt(rb*Db1b2).54*d/100.a2). Create a new M – file by selecting File .b1). H23 = H(2). DSA=sqrt(Dsb*Da1a2).c2). 2.c2).c1). Da1c1 = abs(a1 . b2 = S22/2 + j*0. H = input('Enter row vector [H12. GMRL=(DSA*DSB*DSC)^(1/3) GMRC = (rA*rB*rC)^(1/3) L=0. H23] = '). c2 = S33/2 . S33] = '). Db2c1 = abs(b2 . 4. S22. Da2c2 = abs(a2 . DBC=(Db1c1*Db1c2*Db2c1*Db2c2)^.b2). 13 . Dc1c2 = abs(c1 . r = 2.0556/log(GMD/GMRC) % micro F/km RESULT: Thus the modeling of transmission line was done and the sending end parameter. Da2b2 = abs(a2 . b1 = -S22/2 + j*0. 5. d = input('Bundle spacing in inch = '). DSB=sqrt(Dsb*Db1b2).b2). Da1c2 = abs(a1 .54*r/100.c1).PROCEDURE: 1. H12 = H(1). DAB=(Da1b1*Da1b2* Da2b1*Da2b2)^0.b2). a2 = S11/2 + j*H12. Da1b2 = abs(a1 . Execute the program by either pressing Tools – Run. GMD=(DAB*DBC*DCA)^(1/3) Ds = 2.2*log(GMD/GMRL) % mH/km C = 0.25.c2). c1 = -S33/2 . rA = sqrt(rb*Da1a2). r=dia/2. S22 = S(2). DSC=sqrt(Dsb*Dc1c2).c2).54*Ds/100. Da1a2 = abs(a1 .b1). d = 2. Ds = input('Geometric Mean Radius in inch = '). rC = sqrt(rb*Dc1c2).j*H23. Enter the command window of the MATLAB. regulation& efficiency were determined and verified using MATLAB software. S11 = S(1). dia = input('Conductor diameter in inch = ').j*H23. Da2b1 = abs(a2 . Dsb = (d*Ds)^(1/2). Db1c1 = abs(b1 . a1 = -S11/2 + j*H12. Db2c2 = abs(b2 .25. Db1c2 = abs(b1 . View the results PROGRAM: %3 phase double circuit S = input('Enter row vector [S11. Db1b2 = abs(b1 .c2). Da2c1 = abs(a2 .25.New – M – File 3. rb = (d*r)^(1/2).c1). DCA=(Da1c1*Da1c2*Da2c1*Da2c2)^.c1). Da1b1 = abs(a1 .

In one method we can form the bus admittance matrix and than taking its inverse to get the bus impedance matrix. In most of the power system studies it is required to form y. yid ydi ……… ydd where.6 THEORY: FORMATION OF Y BUS MATRIX Bus admittance is often used in power system studies. SOFTWARE REQUIRED: MATLAB 7.bus matrix of the system by considering certain power system parameters depending upon the type of analysis..equivalent. Y-bus may be formed by inspection method only if there is no mutual coupling between the lines. The bus impedance matrix can be determined by two methods. FORMATION OF BUS ADMITTANCE AND IMPEDANCE MATRICES Expt. The off diagonal elements are unaffected. Generalized Y-bus = yii ………. Shunt impedances are added to diagonal element corresponding to the buses at which these are connected. The bus impedance matrix is very useful in fault analysis. In another method the bus impedance matrix can be directly formed from the reactance diagram and this method requires the knowledge of the modifications of existing bus impedance matrix due to addition of new bus or addition of a new line (or impedance) between existing buses. 14 . ALGORITHM: Step 1: Start the Program.No:4 Date : AIM: To determine the bus admittance and impedance matrices for the given power system network. The equivalent circuit of Tap changing transformers is included while forming Y-bus matrix. Every transmission line should be represented by . Step 2: Enter the busdata Matrix in command window. Yii = Self admittance Ydi = Transfer admittance FORMATION OF Z BUS MATRIX: In bus impedance matrix the elements on the main diagonal are called driving point impedance and the off-diagonal elements are called the transfer impedance of the buses or nodes. Step 3: Calculate the Formulae Y=ybus(busdata) Y= ybus(z) Zbus = inv(Y) Step 4: Format the Admittance Y bus Matrix.

Create a new M – file by selecting File . Step 6: End the Program. EXERCISE: (i) Determine the Y bus matrix for the power system network shown in fig. Execute the program by pressing Tools – Run.New – M – File 3. Type and save the program in the editor window. Enter the command window of the MATLAB. 15 . FLOW CHART: PROCEDURE: 1. 5. 2. View the results. (ii) Check the results obtained in using MATLAB. 4. Step 5: Format the Impedance Z bus Matrix.

26 0.10 0.10 0.08 0. (i) Determine Z bus matrix for the power system network shown in fig.03 2 3 0.02 1 5 0.025 3 5 0.05 0.25 0.20 0. (ii) Check the results obtained using MATLAB.07 0.02 2 6 0.20 0.01 4 5 0.10 0.30 0.30 0.20 0.10 0.03 16 .02 0.40 0.025 3 6 0.02 1 4 0. Line data From To R X B/2 Bus Bus 1 2 0.30 0.2.01 2 5 0.05 0.10 0.03 2 4 0.20 0.12 0.04 5 6 0.05 0.

y = 1. % Make B imaginary. % Initialise YBus..fb(k)) = ybus(fb(k).. % To bus number.x. % no...r...tb(k)) = -y(k).b\n\n') linedata = input('Enter line data : '). b = i*b..5). of buses.3). X. for m=1:nbus for n=1:nbranch if fb(n) == m | tb(n) == m ybus(m... % no. ybus(tb(k). % Resistance. % To get inverse of each element. end % Formation of Diagonal Elements. % Z matrix.. % Ground Admittance.4). FORMATION OF BUS ADMITTANCE AND IMPEDANCE MATRIX % Program to form Admittance and Impedance Bus Formation.. r = linedata(:. % Formation of the Off Diagonal Elements. B/2....tb(k)). ybus = zeros(nbus.1)..nbus).... % Reactance.. z = r + i*x. for k=1:nbranch ybus(fb(k). % Bus Impedance Matrix zbus 17 . % From bus number. nbus = max(max(fb).2).. clc fprintf('FORMATION OF BUS ADMITTANCE AND IMPEDANCE MATRIX\n\n') fprintf('Enter linedata in order of from bus. tb = linedata(:.max(tb)).m) = ybus(m...m) + y(n) + b(n).. x = linedata(:.. of branches../z. b = linedata(:. R.to bus. end end end ybus = ybus % Bus Admittance Matrix zbus = inv(ybus).. fb = linedata(:.. nbranch = length(fb)....

OUTPUT RESULT: Thus the bus Impedance and admittance matrix for the given system were determined and verified using MATLAB. 18 .

D = 0. Create a new Model by selecting File . Enter the command window of the MATLAB. PROCEDURE: 1. i. An isolated power station has the following parameters Turbine time constant.New – Model. 5. A change in system load cases a change in the speed of all rotating masses (Turbine – generator rotor systems) of the system leading to change in system frequency.8 (a) Use the Routh – Hurwitz array to find the range of R for control system stability.reference set points of selected (regulating) generator – turbine units. This function is referred to as load – frequency control (LFC). 2. LOAD – FREQUENCY DYNAMICS OF SINGLE AREA POWER SYSTEMS Expt. 4. 19 . THEORY: Active power control is one of the important control actions to be perform to be normal operation of the system to match the system generation with the continuously changing system load in order to maintain the constancy of system frequency to a fine tolerance level. Governor time constant. After forming the block diagram.5sec. The speed change form synchronous speed initiates the governor control (primary control) action result in the entire participating generator – turbine units taking up the change in load. Double click the scope and view the result. Governor speed regulation = R per unit The load varies by 0. This is one of the foremost requirements in proving quality power supply.e. EXERCISE 1. The primary objectives of automatic generation control (AGC) are to regulate system frequency to the set nominal value and also to regulate the net interchange of each area to the scheduled value by adjusting the outputs of the regulating units. 3. Pick up the blocks from the simulink library browser and form a block diagram. Restoration of frequency to nominal value requires secondary control action which adjusts the load .8 percent for a 1 percent change in frequency. g = 0. stabilizing system frequency. save the block diagram. H = 5sec.2sec Generator inertia constant. T = 0.No:5 Date : AIM: To become familiar with modeling and analysis of the frequency and tie-line flow dynamics of a power system without and with load frequency controllers (LFC) and to design better controllers for getting better responses.

Load change 60 MW. Governer speed regulation 2.5 HZ per unit MW. (ii)Use MATLAB to obtain the time domain performance specifications and the frequency deviation step response. Governer time constant 0.016 PU MW / Hz. (c) The governor speed regulation is set to R = 0. WITH OUT INTEGRAL CONTROLLER WITH INTEGRAL CONTROLLER EXERCISE: 1 1. Inertia constant 5 sec. 20 .2 sec. Nominal frequency 50 Hz.05 per unit.5 sec.The turbine rated output is 250MW at nominal frequency of 60Hz. Damping co efficient 0. A sudden load change of 50 MW (ΔPL = 0. (b) Use MATLAB to obtain the root locus plot.8 percent for a 1 percent change in frequency. An isolated power system has the following parameter Turbine rated output 300 MW. (i) Find the steady state frequency deviation in Hz. Determine the steady state frequency deviation in Hz (i) Find the steady state frequency deviation in Hz. The load varies by 0.2 per unit) occurs. Turbine time constant 0.

21 . Turbine time constant 0. Damping co efficient 0. The system is equipped with secondary integral control loop and the integral controller gain is Kf = 1.5 HZ per unit MW. Load change 60 MW.(ii) Use MATLAB to obtain the time domain performance specifications and the frequency deviation step response. EXERCISE: 2 2. An isolated power system has the following parameter Turbine rated output 300 MW.5 sec. Nominal frequency 50 Hz. Governer time constant 0. Obtain the frequency deviation for a step response RESULT: Modeling and analysis of the frequency and tie-line flow dynamics of a single area power system without and with load frequency controllers (LFC) was studied and responses are simulated using simulation software.2 sec.016 PU MW / Hz. Governer speed regulation 2. Inertia constant 5 sec.

This is one of the foremost requirements in proving quality power supply. 4. Restoration of frequency to nominal value requires secondary control action which adjusts the load . This function is referred to as load – frequency control (LFC). 3. The primary objectives of automatic generation control (AGC) are to regulate system frequency to the set nominal value and also to regulate the net interchange of each area to the scheduled value by adjusting the outputs of the regulating units. THEORY: Active power control is one of the important control actions to be perform to be normal operation of the system to match the system generation with the continuously changing system load in order to maintain the constancy of system frequency to a fine tolerance level.No:6 Date : AIM: To become familiar with modelling and analysis of the frequency and tie-line flow dynamics of a two area power system without and with load frequency controllers (LFC) and to design better controllers for getting better responses. 2. A change in system load cases a change in the speed of all rotating masses (Turbine – generator rotor systems) of the system leading to change in system frequency. After forming the block diagram. Pick up the blocks from the simulink library browser and form a block diagram. stabilizing system frequency. 5. Enter the command window of the MATLAB. Double click the scope and view the result. The speed change form synchronous speed initiates the governor control (primary control) action result in the entire participating generator – turbine units taking up the change in load. LOAD – FREQUENCY DYNAMICS OF TWO AREA POWER SYSTEMS Expt. 22 .reference set points of selected (regulating) generator – turbine units. Create a new Model by selecting File . PROCEDURE: 1.New – Model. save the block diagram.

0625 Frequency –sens .9 Inertia Constant H1=5 H2=4 Base Power 1000MVA 1000MVA Governor Time Constant g1 = 0. Area 1 2 Speed Regulation R1=0. EXERCISE: 1.u. A load change of 187. D1=0.5 MW occurs in area1. A Two.6sec The units are operating in parallel at the nominal frequency of 60Hz.6 D2=0.05 R2=0.3sec Turbine Time Constant T1 =0. SIMULINK BLOCK DIAGRAM: 23 . (a) Determine the new steady state frequency and the change in the tie-line flow.load coeff.5sec T1 =0.2sec g1 = 0. The synchronizing power coefficient is computed from the initial operating condition and is given to be Ps = 2 p.area system connected by a tie line has the following parameters on a 1000 MVA common base. (b) Construct the SIMULINK block diagram and obtain the frequency deviation response for the condition in part (a).

RESULT: Modeling and analysis of the frequency and tie-line flow dynamics of a two area power system without and with load frequency controllers (LFC) was studied and responses are simulated using simulation software. TRANSIENT AND SMALL SIGNAL STABILITY ANALYSIS – SINGLE MACHINE INFINITE BUS SYSTEM 24 .

types of controllers etc. occurs the power balance is upset and the generating units rotors experience either acceleration or deceleration.jQe = Et* Voltage behind transient condition E1 = Et + j Xd1It Voltage of infinite bus EB = Et .f)) S* Stator Current It = Et* Pe .. The generating units run at synchronous speed and system frequency. X3 = X1 + X2 25 .6 THEORY Stability: Stability problem is concerned with the behavior of power system when it is subjected to disturbance and is classified into small signal stability problem if the disturbances are small and transient stability problem when the disturbances are large. FORMULA Reactive power Qe = sin(cos-1(p. change in field voltage. normal operating condition.Expt. loss of generation etc.j( X3 + Xtr )It X1 X2 where. the nature of system response to small disturbance depends on the operating conditions. (b) Rotor oscillations of increasing magnitude due to lack of sufficient damping torque. voltage. When a large disturbance such as three phase fault. (a) Steady increase in rotor angle due to lack of synchronizing torque. Instability that may result from small disturbance may be of two forms. loss of load. Transient stability: When a power system is under steady state. In the former case the system is said to be stable and in the later case it is said to be unstable. the system may be subjected to small disturbances such as variation in load and generation.No:7 Date : AIM To become familiar with various aspects of the transient and small signal stability analysis of Single-Machine-Infinite Bus (SMIB) system PROGRAM REQUIRED: MATLAB 7. The system may come back to a steady state condition maintaining synchronism or it may break into subsystems or one or more machines may pull out of synchronism. change in mechanical toque etc. Small signal stability: When a power system is under steady state. current and power flows are steady. the transmission system strength.. the load plus transmission loss equals to the generation in the system.

o Pm Pe = sinmax Critical Clearing Angle Pm( max . Create a new M – file by selecting File .o) tcr =  fo Pm Secs PROCEDURE 1.P2maxcos o Coscr = P3max . Enter the command window of the MATLAB. EB Prefault Operation: X1 X2 X = j Xd1+ jXtr + X1 + X2 E1 x EB Power Pe = sino X Pe * X o = sin-1 E1 * EB During Fault Condition: Pe = PEii = 0 Find out X from the equivalent circuit during fault condition Post fault Condition: Find out X from the equivalent circuit during post fault condition E1 x EB Power Pe = sino X max =  .P2max Critical Clearing Time 2H (cr .New – M – File 26 . 2. Angular separation between E1 and EB o =  E1 .o ) + P3maxcos max .

27 . A 60Hz synchronous generator having inertia constant H = 5 MJ/MVA and a direct axis transient reactance Xd1 = 0.When the fault is cleared. Reactances are marked on the diagram on a common system base.3 per unit is connected to an infinite bus through a purely reactive circuit as shown in figure. . View the results. The generator is delivering real power P e = 0. 3. Execute the program by pressing Tools – Run 5. both lines are intact. Determine the critical clearing angle and the critical fault clearing time. EXERCISE 1.074 per unit to the infinite bus at a voltage of V = 1 per unit. 4.8 per unit and Q = 0. a)A temporary three-phase fault occurs at the sending end of the line at point F. b)Verify the result using MATLAB program. Type and save the program.

RESULT Transient and small signal stability analysis of Single-Machine-Infinite Bus (SMIB) system was studied and simulated using simulation software. SOFTWARE REQUIRED: MATLAB 7.6 THEORY Mathematical Model for Economic Dispatch of Thermal Units Without Transmission Loss Statement of Economic Dispatch Problem: 28 .No:8 Date : AIM: To understand the fundamentals of economic dispatch and solve the problem using classical method with and without line losses. ECONOMIC DISPATCH IN POWER SYSTEMS USING MATLAB Expt.

2.……. k = 1. bi and ci are constants Necessary conditions for the existence of solution to ED problem: The ED problem given by the equations (1) to (4). FT =  Fi (PGi ) (2) i=1 and satisfies the power balance constraint N =  PGi –PD = 0 (3) i=1 and the operating limits PGi. This economic dispatch problem is mathematically stated as an optimization problem.(2) and (3) may be restated as an unconstrained optimization problem by augmenting the objective function (1) with the constraint  multiplied by LaGrange multiplier. By omitting the inequality constraints (4) tentatively. [ PGi – PD] (6) i=1 i=1 The necessary conditions for the existence of solution to (6) are given by L / PGi = 0 = dFi (PGi) / dPGi . In a power system. . i = 1. i = 1. ) =  Fi(PGi) . with negligible transmission loss and with N number of spinning thermal generating units the total system load PD at a particular interval can be met by different sets of generation schedules {PG1(k) .max (4) The units production cost function is usually approximated by quadratic function Fi (PGi) = ai PG2i + bi PGi + ci . 2. . To determine : The set of generation schedules. the reduce ED problem (1). PG2(k) . which minimize the system operating cost. PGi . ………………PGN(K) }. their production cost functions. L as N N Min : L (PG1 …….……. i = 1.N (5) where ai .. the system operator has to choose the set of schedules. their operating limits and the system load PD..……. Given : The number of available generating units N. which is essentially the sum of the production cost of all the generating units.PGN .  to obtained the LaGrange function..N (7) N L /  = 0 =  PGi – PD (8) 29 .2………N (1) Which minimize the total production cost.NS Out of these NS set of generation schedules.2.min  PGi  PGi. N Min .

min  PGi  PGi. Execute the program by either pressing Tools – Run. 4. i=1 The solution to ED problem can be obtained by solving simultaneously the necessary conditions (7) and (8) which state that the economic generation schedules not only satisfy the system power balance equation (8) but also demand that the incremental cost rates of all the units be equal be equal to  which can be interpreted as “incremental cost of received power”. PROCEDURE: 1. . Step 2: Get the Input Values of Alpha. 2. EXERCISE: 30 . Step 3: Use the Intermediate Variable as Lammda. Enter the command window of the MATLAB. 5.New – M – File 3. . Bata and Gamma.2…………….N (10) Incremental fuel cost N N = PD + ( bi/2ai ) /  (1/2ai) (11) i=1 i=1 ALGORITHM: Step 1: Start the Program.max  for PGi = PGi. i=1. When the inequality constraints (4) are included in the ED problem the necessary condition (7) gets modified as dFi (PGi) / dPGi =  for PGi. Type and save the program. Create a new M – file by selecting File . Step 5: To find Total Cost and Economic Cost of Generator.max  for PGi = PGi. Step 4: Iterate the Variables up to Feasible Solution. Step 6: End the Program. View the results.mi ____(9) Economic Schedule PGi = ( -bi)/ 2ai . .

004 P12.Neglecting line losses and generator limits.^2) OUTPUT Enter estimated value of lambda= 10 lambda P1 P1 P3 delta p delta lambda 10.009].3. Verify the result using MATLAB program.p(3). 1.0000 150. a=[.dellambda]) lambda=lambda+dellambda. 400. end lambda p totalcost=sum(c+b. J=sum(ones(length(a). P3 in MW The total load . fprintf('\n') disp(['lambda P1 P1 P3 delta p delta lambda']) iter=0.0000 0 0 lambda = 8. 5.0000 250. while abs(delp)>=0.3 P1 + 0. p=(lambda-b). dellambda=delp/J. delp=Pd-sum(p).*p+a. disp([lambda.004.p(2).*p.006 P22. find the optimal dispatch and the total cost in $/h by analytical method.delp. c=[500.5000 31 .8333 -1.0000 587. lambda=input('Enter estimated value of lambda=').5000 400. delp=10. PROGRAM: clc.5000 375.5 P2 + 0.p(1). warning off. b=[5.0000 233.009 P32.5.5000 8. P1 in MW C2 = 400 + 5.001 iter=iter+1./(2*a).006. Pd=800.8 P3 + 0. PD is 800MW. The fuel cost functions for three thermal plants in $/h are given by C1 = 500 + 5. 5. .8]. clear all./(2*a)). . P2 in MW C3 = 200 +5. 200].3333 -395.1).

x=0.5 P2 + 0. b=[4. PD is 975MW.8 P3 + 0.5 5. Verify the result using MATLAB program.009 P32.3 P1 + 0. c=[640 580 820].0056 .0000 150. for i=1:n Pg(i)=(lambda-b(i))/(2*a(i)).004 P12. a=[.0045 .p= 400. Generation limits 200  P1  450 MW 150  P2  350 MW 100  P3  225 MW Find the optimal dispatch and the total cost in $/h by analytical method.8]. Pgtotal=sum(Pg).0000 250. P2 in MW C3 = 200 + 5. y=y+(1/(2*a(i))). else 32 . for i=1:n x=x+(b(i)/(2*a(i))).6825e+003 EXERCISE: 2. demand=925. The fuel cost functions for three thermal plants in $/h are given by C1 = 500 + 5. PROGRAM clear clc n=3. P1 in MW C2 = 400 + 5.0000 totalcost = 6. Pmin=[200 250 125]. Pg(i). lambda=(demand+x)/y Pgtotal=0. Pmax=[350 450 225].2 5. P3 in MW The total load . y=0.006 P22 . end Pg for i=1:n if(Pmin(i)<=Pg(i)&&Pg(i)<=Pmax(i)).0079].

for i=2:n x1=x1+(b(i)/(2*a(i))). end Pg if Pgtotal~=demand demandnew=demand-Pg(1) x1=0. end end Pgtotal=sum(Pg).4361 178.1598 demandnew = 575 33 . end lambdanew=(demandnew+x1)/y1 for i=2:n Pg(i)=(lambdanew-b(i))/(2*a(i)). end end end Pg OUTPUT lambda = 8. y1=0. if(Pg(i)<=Pmin(i)) Pg(i)=Pmin(i).4361 178.6149 Pg = 367.1598 Pg = 350.0000 379.4040 379. else Pg(i)=Pmax(i). y1=y1+(1/(2*a(i))).

No:9 Date : AIM To become familiar with various aspects of the transient stability analysis of Multi -Machine- Infinite Bus (SMIB) system PROGRAM REQUIRED: MATLAB 7.0000 390.4758 RESULT: Economic load dispatch for the given problem was solved using classical method with and without line losses and verified using MATLAB software.6 THEORY Stability : Stability problem is concerned with the behavior of power system when it is subjected to disturbance and is classified into small signal stability problem if the disturbances are small and transient stability problem when the disturbances are large.lambdanew = 8.5242 184. 34 .7147 Pg = 350. The generating units run at synchronous speed and system frequency. TRANSIENT STABILITY ANALYSIS – MULTI MACHINE INFINITE BUS SYSTEM Expt. Transient stability: When a power system is under steady state. the load plus transmission loss equals to the generation in the system.

The system may come back to a steady state condition maintaining synchronism or it may break into subsystems or one or more machines may pull out of synchronism. X3 = X1 + X2 Angular separation between E1 and EB o =  E1 . occurs the power balance is upset and the generating units rotors experience either acceleration or deceleration. Rotor oscillations of increasing magnitude due to lack of sufficient damping torque. EB Prefault Operation: X1 X2 X = j Xd1+ jXtr + X1 + X2 E1 x EB Power Pe = sino X Pe * X o = sin -1 E1 * EB During Fault Condition: 35 . types of controllers etc. voltage.jQe = Et* Voltage behind transient condition E1 = Et + j Xd1It Voltage of infinite bus EB = Et . Small signal stability: When a power system is under steady state. Steady increase in rotor angle due to lack of synchronizing torque. In the former case the system is said to be stable and in the later case it is said to be unstable.j( X3 + Xtr )It X1 X2 where. the system may be subjected to small disturbances such as variation in load and generation. When a large disturbance such as three phase fault. the transmission system strength. change in field voltage. 1. change in mechanical toque etc. current and power flows are steady.. Instability that may result from small disturbance may be of two forms. normal operating condition. the nature of system response to small disturbance depends on the operating conditions. FORMULA Reactive power Qe = sin(cos-1(p. loss of load.f)) S* Stator Current It = Et* Pe . 2. loss of generation etc..

60 Hz power system with the following system modelling requirements: I. Create a new M – file by selecting File . Classical model for all synchronous machines. EXERCISE: 1. 4.o ) + P3maxcos max .o) tcr =  fo Pm Secs PROCEDURE 1.P2maxcos o Coscr = P3max . Enter the command window of the MATLAB. Pe = PEii = 0 Find out X from the equivalent circuit during fault condition Post fault Condition Find out X from the equivalent circuit during post fault condition E1 x EB Power Pe = sino X max =  . 2.P2max Critical Clearing Time 2H (cr . Type and save the program. 36 .o Pm Pe = sinmax Critical Clearing Angle Pm( max . View the results. 3-machine.New – M – File 3. models for excitation and speed governing systems not included. Execute the program by pressing Tools – Run 5. Transient stability analysis of a 9-bus.

Angular speed deviations of machines 1. E = 1.17. eacfault (Pm. X3) For( b) Pm = 0.8. X3 = 0. X3 = 0.65. E.8. X2 = 1. Observe the system for 2.65.0 sec.(a) Simulate a three-phase fault at the end of the line from bus 5 to bus 7 near bus 7 at time = 0. X1.8.65.Active power variation of machines 1. X2. PROGRAM : For (a) Pm = 0. X3) 37 .083 sec) . V.Relative angles of machines 2 and 3 with respect to machine 1 . eacfault (Pm.17. X2 = inf. X1 = 0. V. X1 = 0. E = 1.0. (c) Determine the critical clearing time by progressively increasing the fault clearing time. E. X2.0 seconds (b) Obtain the following time domain plots: . V = 1. 2 and 3 from synchronous speed . X1.0. Assume that the fault is cleared successfully by opening the line 5-7 after 5 cycles ( 0.8. 2 and 3. V = 1.

6 THEORY: The GAUSS – SEIDEL method is an iterative algorithm for solving a set of non-linear load flow equations. in particular. the mathematical formulation of power flow model in complex form and a simple method of solving power flow problems of small sized system using Gauss-Seidel iterative algorithm. SOLUTION OF POWER FLOW USING GAUSS-SEIDEL METHOD Expt.No:10 Date : AIM: To understand. SOFTWARE REQUIRED: MATLAB7.RESULT Transient stability analysis of Multi-Machine-Infinite Bus (SMIB) system was studied and simulated using simulation software. The non-linear load flow equation is given by 38 .

1 Pp – j Qp p-1 n Vpk+1 = .05pu. 3. Step 3: Calculate the Y bus impedance Matrix. 5. Enter the command window of the MATLAB.Load Mw. Step 4: Calculate P and Q by using formula. Q= Gen MVA – Load MVA. 4.i)*V(i)). The scheduled loads at buses 2 and 3 are marked on 39 .k)*V(k) Step 7: Check the condition for type if type(i)==2. PROCEDURE: 1. Execute the program by pressing Tools – Run. Step 5: Check the condition for the loop For i=2: bus and assume sum Yv =0. Calculate Q(i) Q(i)=-imag (conj(V(i))*(sum Yv+ Ybus (i. Step 2: Get the input Value. 2. View the results. Step 6: Check the Condition of for loop if for K=i:n bus and check if i=k and calculate sum Yv= sum Yv + Ybus (i. The magnitude at bus 1 is adjusted to 1. Create a new M – file by selecting File . Step 10: Iteration incremented Step 11: Find the angle Value angle=180/Pi*angle(v) Step 12: End the Program. Ypq Vq . EXERCISE: The figure shows the single line diagram of a simple 3 bus power system with generator at bus- 1. Type and save the program in the editor Window. Vq k+1 k Ypp (Vpk)* q = 1 q=p+1 The reactive power of bus-p is given by p-1 n QPk+1 =(-1) x Im (Vpk)*  Ypq Vqk+1 +  Ypq Vqk q=1 q=p ALGORITHM: Step 1: Start the Program. P= Gen Mw.New – M – File.i)*(P(i)-jQ(i)/Conj(V(i))-sum Yv). Step 8: Check the condition for Q(i) by using if loop If Q(i)< Qmin(i) Q(i)<=Qmin(i) Else Q(i)= Qmax(i) Step 9: Check the Condition for type V(i)=1/Ybus(i.

y(i)=sa(i).%+h(i). 1) Find the slack bus real and reactive power.k1)+y(i).5-4j].k1)=Ybus(k1. Ybus(k2. The base value is 100kVA.k1)=Ybus(k1. Line impedances are marked in p. Determine the phasor values of the voltage at the load bus 2 and 3.nb). k2=eb(i) .2-4j 1. end 40 . Ybus(k1. Ybus(k1. Ybus(k2. PROGRAM: %GAUSS SEDIAL clc clear all sb=[1 1 2 4 3]. % input('Enter the ending bus = ') nl=5. %input('Enter the value of series impedance =') Ybus=zeros(nb. The line charging susceptances are neglected.2-3j .%+h(i). %input(' Enter the number of buses= ') sa=[1-5j 1.k2)=Ybus(k2.k2)=-y(i).k2)+y(i).k2).1-2j 1. %input('Enter the starting bus = ') eb=[2 3 4 3 2]. %input(' Enter the number of lines= ') nb=4.u. the diagram. for i=1:nl k1=sb(i). 2) Verify the result using MATLAB.

Vt(p)=((C1-A1+B1)/Ybus(p.p)). Qmax=.4 .q)*Vt(q).04 1 1]. else Q=Qmax.5 . end Vt(p)=1.1j]. end B=0. end if(Pg~=0&&Qg==0)%for Generator bus for q=1:p-1 A=Ybus(p. end C1=((PG(p)-(QG(p)))/Vt(p)). Qmin=. for q=1:p-1 A1=Ybus(p. for i=1:nb Pg=PG(i).q)*V(q). Qg=QG(i). 41 .q))*V(q))).2]. if(Pg==0&&Qg==0)%for slackbus p=1.06 1. for q=p+1:nb B1=B1-(((Ybus(p. V=[1.q)*V(q). Q=-imag(c) if(Qmin<=Q&&Q<=Qmax)%check for Q limt Qg=Q*j.q)*V(q). elseif(Pg~=0&&Qg~=0)%for load bus A2=0. QG=[0 0 .05. disp('it is load bus') Qg=Q*j end QG(p)=Qg. Vt(p)=V(p).12. for q=p:nb B=B+Ybus(p. end B1=0. end c=V(p)*(A+B). else if(Q<=Qmin) Q=Qmin.Ybus PG=[0 .3j . for q=1:p-1 A2=A2-Ybus(p. Vt(p)=V(p) .

q))*V(q))). end 42 . Vt(p)=((C2+A2+B2)/Ybus(p. end C2=(-PG(p)+(QG(p))/V(p)). for q=p+1:nb B2=B2-(((Ybus(p. end B2=0.p)) end p=p+1.

START INPUT No. Qmin(i) = ? 8) Reactive Power maximum limits. = ? FORMULATE Ybus using relevant rules INPUT 3) Slack bus Voltage V(1) = ? 4) Real power specified. i = 2.…n INPUT 7) Reactive Power minimum limits. of buses. P(i) = ? (for PQ and PV buses) 5) Reactive Power specified. n =? Line parameters. e =? 10) Acceleration factor. Vmspec(i) = ? (for PV buses only) where. a =? G 43 . Qmax(i) = ? for PV buses only INPUT 9) Tolerance Limit.3. Q(i) = ? (for PQ buses only) 6) Voltage magnitude.

3..k+1) = ? Increment Ref.k+1) + a(V(i.k+1) => V V(I. G INITIAL GUESS V(i.n SET Iteration Count.k+1)-V(I.k) NO Is BusFinished? YE S M N 44 .U for i = 2. delVmax = 1 DO WHILE delVmax <= e FOR i = 2 to n (Bus count) IS YE PV Bus S COMPUTE NO V(I.k+1)-V(i.0 P. k = 1. : Equn.=> C k = k+1 P ACCELERATE V(i.1) = 1+j0.k)) COMPUTE delV(i) = V(i..

P(1) = ? Ref. => 6&7 STOP 45 . Equn. => A COMPUTE REAL POWER LOSS = ? REACTIVE POWER LOSS = ? Ref. Equn.M N FIND delVmax = max(delV) NO IS delVmax <=e YES COMPUTE Slack bus Power.

0000i 2. it is load bus Qg = 0 + 0.0061 .0000i 2.5000 + 4.0000 + 5.0.5.2000 + 4.0000i -1.6000 -11.1200i Vt = 1.0000i -1.0000i -0.0000i -1.0148i 0. OUTPUT FOR GAUSS SEIDAL LOAD FLOW METHOD Ybus = 2.0.2000 + 4.0000i 0 -1.0000i -0.0600 1.0000i 2.0397i 1.2000 .2000 + 3.9.3000 .0000i -1.0476 + 0.1000 + 2.0000i 0 -1.5000 + 4. 46 .0000i -1.0165i RESULT Load flow solution for the given problem was solved using Gauss-Seidal method and verified using MATLAB software.0000i -1.9000 -11.1000 + 2.1456.9899 .2000 + 3.0000i Q= 0.0000 + 5.

ALGORITHM: Step 1: Start the Program. Qmax.1) (ii) Set if type(i)==3 (iii) End the Loop. (iii) End the Loop. de. SOLUTION OF POWER FLOW USING NEWTON-RAPHSON METHOD Expt. Bpq = Conductance and Susceptance of admittance Ypq respectively. V.ep (fq Gpq . type . 47 . n PP =  ep(eq Gpq + fq Bpq) + fp (fq Gpq . The load flow equations for Newton Raphson method are non-linear equations in terms of real and imaginary part of bus voltages. Qg.eq Bpq) q=1 Vp2 = ep2 + fp2 where.eq Bpq) q=1 n QP =  fp (eq Gpq + fq Bpq) . Step 2: Declare the Variable gbus=6.6 THEORY: The Newton Raphson method of load flow analysis is an iterative method which approximates the set of non-linear simultaneous equations to a set of linear simultaneous equations using Taylor’s series expansion and the terms are limited to first order approximation. Ql. ybus=6. Step 3: Read the Variable for bus.Q dQ= Zeros(npq. Pg.No:11 Date : AIM: To determine the power flow analysis using Newton – Raphson method SOFTWARE REQUIRED: MATLAB 7. for k=1:nbus then calculate P(i) & Q(i) End the Loop Step 6: To check the Q limit Violation (i) Set if iter<=7 && iter>2 (ii) Set for n=2: nbus Calculate Q(G). Qmin. Step 7: Change from specified Value (i) Declare dPa= Psp-P dQa= Qsp. Pl. Step 4: To calculate P and Q Step 5: Set for loop for i=1:nbus. ep = Real part of Vp fp = Imaginary part of Vp Gpq. V(n) for Qmin or Qmax .

Step 10: Find Derivative of Reactive power injections with voltage for J4 & Real power injections with angles for J2. Step 11: Form Jacobian Matrix J= [J1 J2.02 p. V1=1.J3 J4] Step 12: Find line current flow & line Losses. Verify the result using MATLAB PROGRAM: 48 . Reactive Real load Reactive Load Real power Voltage Bus Power demand.u and a total shunt admittance of j0.04 2 0 0 0. . Step 9: Find Derivative of Reactive power injections with angles for J3.5 0.Consider the 3 bus system each of the 3 line bus a series impedance of 0.5 1 Unspecified 3 1.08 p. QD Generation. PG Specified Generation. Step 8: Find Derivative of Real power injections with angles for Jacobian J1. PD demand. Step 13: Display the output. The specified quantities at the bus are given below. EXERCISE: 1. Step 14: End the Program.04 2.02 + j0.u.6 0 QG3 =  V3 = 1. QG 1 2 1 .

y(i)=(sa(i)).k1)+y(i). Pg=[0 0.25].q)*sin(del(p)-angle(Ybus(p. %input('Enter the starting bus = ') eb=[2 3 3].667-5j]. Qspe(p)=Qg(p)-Qd(p). end end P. Ybus(k1. P=[0 0 0]. Pspe(p)=Pg(p)-Pd(p).k1)=Ybus(k1. delQ(p)=Qspe(p)-Q(p).q)*cos(del(p)+angle(Ybus(p. Pspe. % input('Enter the ending bus = ') nl=3. %Calculation of J1 P2=[0 0 0]. end Ybus Ybusmag=abs(Ybus). Ybus(k2.k2)+y(i). %input('Enter the value of series impedance =') Ybus=zeros(nb.k2)=Ybus(k2.k2)=-y(i).nb). for p=2:nb for q=1:nb P(p)=P(p)+(v(p)*v(q)*Ybusmag(p. delP(p)=Pspe(p)-P(p). k2=eb(i). Qd=[0 0 0. Pd=[0 0 0. delQ.75j 5-15j 1. Qg=[0 0 0]. Q=[0 0 0]. for i=1:nl k1=sb(i). Q(p)=(Q(p)+(v(p)*v(q)*Ybusmag(p. del=[0 0 0]. Ybusang=angle(Ybus)*(180/pi).q))-del(q)))). Qspe. delP. %input(' Enter the number of lines= ') nb=3.%NEWTON RAPHSON METHOD clc clear all sb=[1 1 2]. %input(' Enter the number of buses= ') sa=[1.6].k1)=Ybus(k1. Ybus(k2. for p=2:nb for q=2:nb if(p==q) 49 . Q.25-3.q))-del(q))).k2).06 1 1].2 0]. Ybus(k1. % Calculation of P and Q v=[1.

PV(p.q)=Q1+Q2(q).j))-del(j)). for p=2:nb for q=2:nb if(p==q) Q1=2*v(p)*Ybusmag(p. end end else Pdel(p. QV(p. P1=2*v(p)*Ybusmag(p.q)*sin(-angle(Ybus(p. end end else QV(p.q)*sin(del(p)-angle(Ybus(p.q)=P1+P2(q).0 0 0].j)*sin(del(q)-angle(Ybus(q.q)-v(j)*v(q)*Ybusmag(q.q))). for p=2:nb for q=2:nb if(p==q) for j=1:nb if(j~=p) Pdel(p.q))-del(q)).j))-del(j)). end end end PV.0 0 0].j))-del(j)).q)*cos(del(p)+angle(Ybus(p. for j=1:nb if (j~=p) Q2(q)=Q2(q)+v(j)*Ybusmag(q. % Calculation of J2 Pdel=[0 0 0.q)=Pdel(p.q)*sin(del(p)+angle(Ybus(p. %Calculation of J3 Q2=[0 0 0].q))-del(q)). for j=1:nb if (j~=p) P2(q)=P2(q)+v(j)*Ybusmag(q.q)=v(p)*Ybusmag(p.q))-del(q)). end end end Pdel.q)=v(p)*Ybusmag(p. end end end QV.q)*cos(angle(Ybus(p. for p=2:nb for q=2:nb 50 .j)*sin(del(q)-angle(Ybus(p.q)=-v(p)*v(q)*Ybusmag(p.0 0 0.q))).j)*cos(del(q)+angle(Ybus(q.0 0 0. %Calculation of J4 Qdel=[0 0 0. end end else PV(p.

:)=[ ].:)=[ ].1)=[ ]. delQ(1:1)=[]. Qdel(:.1)=[ ]. if(p==q) for j=1:nb if(j~=p) Qdel(p.:)=[ ].j))-del(j)). Qdel(1.1)=[ ]. delnew(i)=del(j)+vdel(i+2). J=[PV Pdel.delQ'] vdel=inv(J)*delpq %Find new v&del for i=1:nb-1 for j=2:nb vnew(i)=v(j)+vdel(i). %Jacobian matrix PV(1. QV(:.q)+v(j)*v(q)*Ybusmag(q.QV Qdel] %Find the change in v&del delP(1:1)=[].j)*cos(del(q)+angle(Ybus(p.q))-del(q)). QV(1. delpq=[delP'.1)=[ ]. end end else Qdel(p. Pdel(1.q)*cos(del(p)+angle(Ybus(p.q)=Qdel(p. Pdel(:. end end end Qdel.:)=[ ].q)=-v(p)*v(q)*Ybusmag(p. end end VNEW=[v(1) vnew] DELNEW=[del(1) delnew] 51 . PV(:.

2500 + 3.8.6670 6.0410 DELNEW = 0 0.6500 vdel = 0. 52 .0000 -2.0575 1.6670 + 5. OUTPUT FOR NEWTON RAPHSON LOAD FLOW METHOD Ybus = 6.6670 8.0000i -1.0000 +15.9170 .9000 8.0000 -1.9920 1.0000i J= 2.3000 0.2750 -0.7500i -1.0000 19.2250 0.6670 -5.1000 1.7500i 2.0201 RESULT Thus the power flow for the given problem was solved using Newton Raphson method and verified using MATLAB software.7500i -1.6670 -20.0088 -0.0000i -1.8420 -1.0088 -0.2500 -18.0201 VNEW = 1.9750 -5.0000i -5.6670 + 5.9670 delpq = 0.6670 -6.5250 -5.0000 +15.0600 1.7500i -5.3670 -5.0000i 6.0410 0.0575 0.2500 + 3.0000 20.

Compute all line currents. PROBLEM: For the given network determine the fault current when fault occurs at bus no.06j 4 1 3 0. Line No.r2)=-(1/linez(i)). y(r1.02j Reactance of generator G1=0.r1)=y(r1.r2)=y(r2. 5.No:12 Date : AIM: To develop a program to carry out simulation study of symmetrical three phase short circuit on the given power system.1j Machine Data and Transformer Data: Reactance of Transformer T1=0. 6. 7.r2). 2. SYMMETRICAL SHORT CIRCUIT ANALYSIS Expt.i)=0. machine data and transformer data. Starting bus Ending bus Series impedance 1 1 2 0.2j ALGORITHM : 1.05j 2 1 2 0. end %formation of ybus matrix for i=1:nl r1=sb(i). 3.of lines') sb=input('enter the starting bus number') eb=input('enter the ending bus number') linez=input('enter the line impedance') for i=1:nb y(i. PROGRAM: disp('symmetrical fault analysis') nb=input('enter the no. of buses') nl=input('enter the no.Compute the bus voltage at all the buses. r2=eb(i).Compute the ybus matrix.r1)+(1/linez(i)). Compute the fault current at the faulted bus. z(i.1 also determine the voltage at all the buses and all line currents. Print the result.25j Reactance of generator G2=0.r1)=y(r1. Form the zbus matrix by inverting the ybus matrix.1j Reactance of Transformer T2=0. y(r2.i)=0. 53 .Read the line data. y(r1. 4.r2)+(1/linez(i)). y(r2.05j 3 2 3 0.

end v %i-line current value for j=1:nl l=sb(j).3) y disp('formation of zbus matrix') z=inv(y) %Espec-Specified voltage Espec(1)=complex(1.3)=(1/(G(2)+T(2)))+y(3.i=1.i)). m=eb(j). %zf-Fault impedance zf=0.1)=(1/(G(1)+T(1)))+y(1.1) y(3. end i OUTPUT: symmetrical fault analysis 54 . %If-fault current If=(Espec(1))/(z(i.i)+zf) %v-fault voltage value for j=1:nb v(j)=Espec(1)-(If*z(j.end G(1)=input('enter generator 1 impedance value') G(2)=input('enter generator 2 impedance value') T(1)=input('enter Transformer 1 impedance value') T(2)=input('enter Transformer 2 impedance value') y(1.0). i(j)=(v(l)-v(m))/(linez(j)).

2381i formation of zbus matrix z= 0 + 0.1i] linez = 0 + 0.6667i 0 +16.0000i 0 +10.2381i y= 0 -52.2i G= 0 + 0.6667i 0 -30.0000i 0 +16.05i 0.25i G= 0 + 0.6667i 0 -26.0000i 0 +20.7313i 55 .enter the no.4627 0.0000i 0 +20.8571i 0 +20.0175i 0 + 0.0000i 0 +20.0200i enter Transformer 2 impedance value0.0150i 0 + 0.0000i 0 -56.1000i 0 + 0.2000i enter generator 2 impedance value0.1000i enter generator 1 impedance value0.0279i 0 + 0.6667i 0 +16.of lines4 nl = 4 enter the starting bus number[1 1 2 1] sb = 1 1 2 1 enter the ending bus number[2 2 3 3] eb = 2 2 3 3 enter the line impedance[0.0291i 0 + 0.0000i 0 +10.1i T= 0 + 0.8571i 0 +20.0500i 0 + 0.0000i 0 +10.05i 0.0210i 0 + 0.06i 0.0000i 0 +16.0000i 0 -56.6667i 0 +10.2000i enter Transformer 1 impedance value0.6667i y= 0 -52.2537i 0 .6667i 0 +10.8571i 0 +20.6667i 0 -30.6667i 0 +10.0600i 0 + 0.08i T= 0 + 0.2500i 0 + 0.0000i 0 -56.0175i 0 + 0.3731 i= 0 + 9.1.4925i 0 + 3.2500i 0 + 0. of buses3 nb = 3 enter the no.0000i 0 +16.0800i y= 0 -52.0504i If = 0 -35.8422i v= 0 0.0500i 0 + 0.0150i 0 + 0.0210i 0 + 0.2537i 0 + 9.6667i 0 +16.1000i 0 + 0.

56 .RESULT: A program was developed to analysis symmetrical three phase short circuit on a given power system and the output was verified.

004. ELECTROMAGNETIC TRANSIENTS IN POWER SYSTEMS Ex. 57 .1 FORMULA USED: Case (i): REACTIVE TERMINATION: LINE TERMINATED BY INDUCTOR: Case (ii): LINE TERMINATED BY CAPACITANCE: Case (iii): LINE TERMINATED BY A RESISTANCE EQUAL TO SURGE IMPEDANCE: ef(s) = E Case (iv): OPEN CIRCUITED LINE: et = 2ef er = e r=-if PROGRAM: %line terminated by inductor for voltage Ef=10000.:13 Date: AIM: To plot the electromagnetic transients in the power system using MATLAB SOFTWARE REQUIRED: MATLAB 6. Zc=400. No. L=0.

d1. 58 .'r').d1. Zc=400.It.00001:0. plot(t. t=0:0. d1=[1 Zc/L].t). plot(t. n1=[(2*Ef/Zc) 0]. Er=Et-Ef.'r').'b'). plot(t.d1. It=step(n1. t=0:0. t=0:0.'r'). %line terminated by capacitor for current Ef=10000.0001.000000009.000000009. C=0.Er. plot(t.0001. Zc=400.00001:0. plot(t.'b'). %line terminated by capacitor for voltage Ef=10000.Et. n1=[2*Ef/(Zc*C)].Et. Er=Et-Ef. C=0. hold on.0001. hold on.n1=[2*Ef 0].Er. d1=[1 1/(Zc*C)]. Et=step(n1.t). d1=[1 1/(Zc*C)].t).00001:0. Et=step(n1. hold on.

%line terminated by inductor for current Ef=10000. plot(t. tf(n1.d2.004. Ir=It-If. d2=[1 (Zc/L)].'b'). 59 .'r'). Ir=It-If. If=Ef/Zc. RESULT: Thus the electromagnetic transients in power system have been studied using matlab. n2=[2*Ef/L].00001:0. Zc=400.d1) t=0:0. d1=[1 Zc/L]. If=Ef/Zc. n1=[2*Ef 0]. It=step(n2. L=0. plot(t. hold on.Ir.It.0001.t).