Professional Documents
Culture Documents
INTRODUCTION TO MATLAB
Expt.No:
Date :
OBJECTIVES
SOFTWARE REQUIRED
(i) MATLAB
1. INTRODUCTION TO MATLAB
MATLAB comprising lot of optional tool boxes and block set like control system,
optimization, and power system and so on.
Algorithm development.
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.
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.
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.
>> 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,
>>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.
Overloaded methods
help sym/sqrt.m
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,
>>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
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.
>>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.
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]
>>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
- Yields the sum of 1^2+3^2+5^2+7^2+9^2
1.7 PLOTTING
MATLAB’s potential in visualizing data is pretty amazing. One of the nice features is that
with the simplest of commands you can have quite a bit of capability.
Graphs can be plotted and can be saved in different formulas.
>>clear all
>>t=0:10:360;
>>y=sin (pi/180 * t);
To see a plot of y versus t simply type,
>>plot(t,y)
To add label, legend, grid and title use
The commands above provide the most plotting capability and represent several shortcuts
to the low-level approach to generating MATLAB plots, specifically the use of handle graphics.
The helpdesk provides access to a pdf manual on handle graphics for those really interested in it.
1.8 Functions
As mentioned earlier, a M-file can be used to store a sequence of commands or a user-
defined function. The commands and functions that comprise the new function must be put in a
file whose name defines the name of the new function, with a filename extension of '.m'.A function
is a generalized input/output device. That is you can give some input.(arguments) and provides
some output. MATLAB functions allow you much capability to expand MATLAB’s usefulness.
We will just touch on function here as you may find them beneficial later.
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;
1 4 5] as input, the output would be,
With this introduction anybody can start programming in MATLAB and can be
updated themselves by using various commands and functions available. Concerned with the
“Power System Simulation Laboratory”, initially solve the Power System Problems manually, list
the expressions used in the problem and then build your own MATLAB program or function.
RESULT:
AIM
To determine the positive sequence line parameters L and C per phase per kilometre
of a three phase single and double circuit transmission lines for different conductor
arrangements and to understand modeling and performance of medium lines.
Line Parameters
Transmission line has four electrical parameters - resistance, inductance,
capacitance and conductance. The inductance and capacitance are due to the
effect of magnetic and electric fields around the conductor. The shunt
conductance characterizes the leakage current through insulators, which is
very small and can be neglected. The parameters R, L and C are essential for
the development of the transmission line models to be used in power system
analysis both during planning and operation stages.
INDUCTANCE
The inductance is computed from flux linkage per ampere. In the case of the
three phase lines, the inductance of each phase is not the same if
conductors are not spaced equilaterally. A different inductance in each
phase results in unbalanced circuit. Conductors are transposed in order to
balance the inductance of the phases and the average inductance per phase is
given by simple formulas, which depends on conductor configuration and
PROCEDURE
Enter the command window of the MATLAB.
Create a new M – file by selecting File - New – M – File.
Type and save the program in the editor window.
Execute the program by pressing Tools – Run.
View the results.
EXERCISE
1.A 500kv 3φ transposed line is composed of one ACSR 1,272,000-cmil, 45/7 bittern
conductor per phase with horizontal conductor configuration as show in fig.1. The conductors
have a diameter of 1.345in and a GMR of 0.5328in. Find the inductance and capacitance per
phase per kilometer of the line and justify the result using MATLAB.
A D12=35’ B D 23=35’ C
D =70’
Fig.1
2.The transmission line is replaced by two ACSR 636,000-cmil, 24/7 Rook conductors which
have the same total cross-sectional area of aluminum as one bittern conductor. The line
spacing as measured from the centre of the bundle is the same as before and is shown in fig.2.
The conductors have a diameter of 0.977in and a GMR of 0.3924in.Bundle spacing is 18in
.Find the inductance and capacitance per phase per kilometer of the line and justify the result
using MATLAB.
18” A B C
D12=35’ D 23=35’
D13=70’
Fig.2
3.A 345- KV double –circuit three- phase transposed line is composed of two ACSR,
1,431,000-cmil, 45/7 Bobolink conductors per phase with vertical conductor configuration as
shown in fig.3. The conductors have a diameter of 1.427in and a GMR of 0.564 in .the
bundle spacing in 18in. find the inductance and capacitance per phase per kilometer of the
line and justify the result using MATLAB.
a S11=11m
c’ H12 = 7m
b S22=16.5m b’
H12 = 6.5m
S33=12.5m
c a’
Fig.3
PROGRAM 1:
Dab= input('Enter Dab value’);
Dbc= input('Enter Dbc value’);
Dca= input('Enter Dac value’);
GMD=(Dab*Dbc*Dca)^(1/3);
GMRL= input('Enter GMRL(GMR) Value in ft (inch/12): ');
disp('Value of L in mH/KM:’);
L = 0.2*log(GMD/GMRL)
dia= input('Enter conductor diameter in in’);
r=dia/2; GMRC=r/12;
disp('Value of C in µF/KM:’);
C = 0.0556/log(GMD/GMRC)
PROGRAM 2:
Dab= input('Enter Dab value:’);
Dbc= input('Enter Dbc value:’);
Dca= input('Enter Dac value:’);
GMD=(Dab*Dbc*Dca)^(1/3);
dia=input('Enter conductor diameter in in’);
r=dia/2;
d=input('Enter Bundle Spacing in inch’);
Ds=input('Enter GMR(Ds) in inch’);
GMRL=(sqrt(d*Ds))/12;
GMRC=(sqrt(d*r))/12;
disp('Value of L in mH/KM:’);
L = 0.2*log(GMD/GMRL)
disp('Value of C in µF/KM:’);
C = 0.0556/log(GMD/GMRC)
PROGRAM 3 :
S = input('Enter row vector [S11, S22, S33] = ');
H = input('Enter row vector [H12, H23] = ');
d = input('Bundle spacing in inch = ');
dia = input('Conductor diameter in inch = '); r=dia/2;
Ds = input('Geometric Mean Radius in inch = ');
S11 = S(1); S22 = S(2); S33 = S(3); H12 = H(1); H23 = H(2);
a1 = -S11/2 + j*H12;
b1 = -S22/2 + j*0;
c1 = -S33/2 - j*H23;
a2 = S11/2 + j*H12;
b2 = S22/2 + j*0;
c2 = S33/2 - j*H23;
Da1b1 = abs(a1 - b1); Da1b2 = abs(a1 - b2);
Da1c1 = abs(a1 - c1); Da1c2 = abs(a1 - c2);
Db1c1 = abs(b1 - c1); Db1c2 = abs(b1 - c2);
Da2b1 = abs(a2 - b1); Da2b2 = abs(a2 - b2);
Da2c1 = abs(a2 - c1); Da2c2 = abs(a2 - c2);
Db2c1 = abs(b2 - c1); Db2c2 = abs(b2 - c2);
Da1a2 = abs(a1 - a2);
Db1b2 = abs(b1 - b2);
Dc1c2 = abs(c1 - c2);
DAB=(Da1b1*Da1b2* Da2b1*Da2b2)^0.25;
DBC=(Db1c1*Db1c2*Db2c1*Db2c2)^.25;
DCA=(Da1c1*Da1c2*Da2c1*Da2c2)^.25;
GMD=(DAB*DBC*DCA)^(1/3)
Ds = 2.54*Ds/100; r = 2.54*r/100; d = 2.54*d/100;
Dsb = (d*Ds)^(1/2); rb = (d*r)^(1/2);
DSA=sqrt(Dsb*Da1a2); rA = sqrt(rb*Da1a2);
DSB=sqrt(Dsb*Db1b2); rB = sqrt(rb*Db1b2);
DSC=sqrt(Dsb*Dc1c2); rC = sqrt(rb*Dc1c2);
GMRL=(DSA*DSB*DSC)^(1/3)
GMRC = (rA*rB*rC)^(1/3)
L=0.2*log(GMD/GMRL) % mH/km
C = 0.0556/log(GMD/GMRC) % micro F/km
RESULT
Thus the positive sequence line parameters L and C per phase per kilometre of a three
phase single and double circuit transmission lines for different conductor arrangements were
determined and verified with MATLAB software.
The value of L and C obtained from MATLAB program are:
Case1: L= C=
Case2: L= C=
Case3: L= C=
AIM
To understand modeling and performance of Short, Medium and Long transmission
lines.
THEORY
The important considerations in the design and operation of a transmission line are the
determination of voltage drop, line losses and efficiency of transmission. These values are
greatly influenced by the line constants R, L and C of the transmission line. For instance, the
voltage drop in the line depends upon the values of above three line constants. Similarly, the
resistance of transmission line conductors is the most important cause of power loss in the line
and determines the transmission efficiency.
A transmission line has three constants R, L and C distributed uniformly along the
whole length of the line. The resistance and inductance form the series impedance. The
capacitance existing between conductors for 1-phase line or from a conductor to neutral for a 3-
phase line forms a shunt path throughout the length of the line.
When the length of an overhead transmission line is upto about 50km and the line
voltage is comparatively low (< 20 kV), it is usually considered as a short transmission line.
When the length of an overhead transmission line is about 50-150 km and the line
voltage is moderatly high (>20 kV < 100 kV), it is considered as a medium transmission line.
Voltage Regulation:
The difference in voltage at the receiving end of a transmission line between conditions of
no load and full load is called voltage regulation and is expressed as a percentage of the receiving
end voltage.
The phasor diagram of the line for lagging load power factor is shown in Fig. (ii). From the
right angled traingle ODC, we get,
2 2
(OC) = (OD)2 + (DC)
2 2
VS = (OE + ED)2 + (DB + BC)
2 2
= (VR cos ϕR + IR) + (VR sinϕR + IXL)
An approximate expression for the sending end voltage VS can be obtained as follows. Draw
perpendicular from B and C on OA produced as shown in Fig. 2. Then OC is nearly equal to
OF i.e.,
OC = OF = OA + AF = OA + AG + GF
= OA + AG + BH
VS = VR + I R cos ϕR + I XL sin ϕR
Nominal T Method
In this method, the whole line capacitance is assumed to be concentrated at the middle
point of the line and half the line resistance and reactance are lumped on its either side as
shown in Fig.1, Therefore in this arrangement, full charging current flows over half the line.
Fig.1
Let IR = load current per phase
R = resistance per phase
XL = inductive reactance per phase
C = capacitance per phase
cos ϕR = receiving end power factor (lagging)
VS = sending end voltage/phase
V1 = voltage across capacitor C
The phasor diagram for the circuit is shown in Fig.2. Taking the receiving end voltage VR as
the reference phasor, we have,
Fig.2
Nominal π Method
In this method, capacitance of each conductor (i.e., line to neutral) is divided into two
halves; one half being lumped at the sending end and the other half at the receiving end as
shown in Fig.3. It is obvious that capacitance at the sending end has no effect on the line
drop. However, it’s charging current must be added to line current in order to obtain the total
sending end current.
Fig.3
IR = load current per phase
R = resistance per phase
XL = inductive reactance per phase
C = capacitance per phase
cos R = receiving end power factor (lagging)
VS = sending end voltage per phase
The phasor diagram for the circuit is shown in Fig.4. Taking the receiving end voltage as the
reference phasor, we have,
VR = VR + j 0
Load current, IR = IR (cos R - j sin R)
A 220- KV, 3φ transmission line is 40 km long. The resistance per phase is 0.15 Ω per km
and the inductance per phase is 1.3623 mH per km. The shunt capacitance is negligible. Use
the short line model to find the voltage and power at the sending end and the voltage
regulation and efficiency when the line supplying a three phase load of
a) 381 MVA at 0.8 power factor lagging at 220 KV.
b) 381 MVA at 0.8 power factor leading at 220 KV.
RESULT
Thus the program for modeling of transmission line was executed by using
MATLAB and the output was verified with theoretical calculation.
The value of the voltage regulation and efficiency obtained from the MATLAB
program are
SHORT TRANSMISSION LINE
FOR LAGGING PF: FOR LEADING PF:
OBJECTIVES
To determine the bus admittance and impedance matrices for the given
power system network.
SOFTWARE REQUIRED
MATLAB.
THEORETICAL BACKGROUND
Network Description of a Multimode Power System
The bus admittance matrix Y and bus impedance matrix Z are the two
important network descriptions of interconnected power system. The
injected bus currents and bus voltages of a power system under steady
state condition can be related through these matrices as
Y V= I
Z I =V