G.N.I.T.S. – EEE DEPARTMENT BASIC ELECTRICAL SIMULATION LAB Experiment No: 1 Cass: III year B.Tech EEE I st Semester Exp - 1 1 of 3 BASIC OPERATIONS ON MATRICES AIM: Generate a matrix and perform basic operations on matrices using MATLAB software. Software Required: MATLAB software Theory: MATLAB is a MATrix laboratory, It is widely used to solve different types of scientific problems. The basic data structure is a complex double precision matrix. MATLAB treats all variables as matrices. Vectors are special forms of matrices and contain only one row or one column. A matrix with one row is called row vector and a matrix with single column is called column vector. A matrix with only one row and one column is a scalar. A matrix can be generated and portion of a matrix can be extracted and stored in a smaller matrix by specifying the the rows and columns to extract. Following are some of the matrix building functions. zeros(M,N) MxN matrix of zeros ones(M,N) MxN matrix of ones eye(M) identity matrix of size M. rand(M,N) MxN matrix of uniformly distributed random. numbers on (0,1) Following are some of the commands on matrix and operations . det(A) -determinant of a square matrix A. inv(A) - inverse of a matrix A. rank(A) - rank of a matrix A. eig(A) - eigenvalues and eigenvectors of Vector A. size(a) – size of matrix A PROCEDURE:- Open MATLAB Open new M-file Type the program Save in current directory Compile and Run the program For the output see command window\ Figure window
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
G.N.I.T.S. – EEE DEPARTMENT
BASIC ELECTRICAL SIMULATION LAB
Experiment No: 1 Cass: III year B.Tech EEE Ist Semester
Exp - 1 1 of 3
BASIC OPERATIONS ON MATRICES
AIM: Generate a matrix and perform basic operations on matrices using MATLAB software.
Software Required: MATLAB software
Theory:
MATLAB is a MATrix laboratory, It is widely used to solve different types of scientific problems. The basic data structure is a complex double
precision matrix.
MATLAB treats all variables as matrices. Vectors are special forms of
matrices and contain only one row or one column. A matrix with one row is
called row vector and a matrix with single column is called column vector. A matrix with only one row and one column is a scalar.
A matrix can be generated and portion of a matrix can be extracted
and stored in a smaller matrix by specifying the the rows and columns to
extract.
Following are some of the matrix building functions.
zeros(M,N) MxN matrix of zeros ones(M,N) MxN matrix of ones
eye(M) identity matrix of size M.
rand(M,N) MxN matrix of uniformly distributed random. numbers on (0,1)
Following are some of the commands on matrix and operations . det(A) -determinant of a square matrix A.
inv(A) - inverse of a matrix A.
rank(A) - rank of a matrix A.
eig(A) - eigenvalues and eigenvectors of Vector A. size(a) – size of matrix A
PROCEDURE:-
Open MATLAB
Open new M-file Type the program
Save in current directory
Compile and Run the program For the output see command window\ Figure window
G.N.I.T.S. – EEE DEPARTMENT
BASIC ELECTRICAL SIMULATION LAB
Experiment No: 1 Cass: III year B.Tech EEE Ist Semester
Exp - 1 2 of 3
PROGRAM -1:
clc;
% Creating a row vector A=[1 2 3]
% by using "," between the each element
B= [ 2.3, 4.5, 7.8 ]
% Creating a column vector
X =[1; 2; 3]
% Creating a matrix Q=[1 2 3; 4 5 6;7 8 9]
% Creating a Long array ( series vector) t = 1:10
% series vector with increments k =-2:0.5:1
t =linspace(1,10,4)
% Creating a matrix with series vector
B = [1:4; 5:8]
PROGRAM -2:
% Extracting an elements from the matrix.
A = [1,2,3;4,5,6;7,8,9]
x = A( 3 , 1)
% Extracting a column from the matrix.
y= A( : , 2)
% Extracting a row from the matrix.
G.N.I.T.S. – EEE DEPARTMENT
BASIC ELECTRICAL SIMULATION LAB
Experiment No: 1 Cass: III year B.Tech EEE Ist Semester
Exp - 1 3 of 3
y= A(3 ,: )
% Extracting a sub matrix from a Matrix. B=A(2 : 2 , 1 : 3)
PROGRAM -3:
% addition of two matrices
clc; A=[1 2 3; 4 5 6;7 8 9]
B= [ 5 3 2; -2 -4 0; -9 3 2 ]
C= A+B
% multiplications of two matrices
D= A*B
% Division of two matrices
E=A/B
% Inverse of Matrix
inv(B)
F= A*inv(B)
% Element byelement Multiplication;
A=[1 2 3];
B= [ 10 10 10 ] ; C= A.*B
% Element by element division;
A=[1 2 3]; B= [ 10 10 10 ] ;
D= A./B
Results :
Lab In –Charge HOD –EEE
G.N.I.T.S. – EEE DEPARTMENT
BASIC ELECTRICAL SIMULATION LAB
Experiment No: 2 Cass: III year B.Tech EEE Ist Semester
Exp - 2 1 of 7
Generation of various signals and sequences. Aim:
Generate various signals and sequences (Periodic and aperiodic), such as
Unit Impulse, Unit Step, Square, Saw tooth, Triangular, Sinusoidal, Ramp, Sinc.
Software Required: Matlab software.
Theory:
Unit impulse signal: The Ideal impulse function, is a function that is zero
everywhere but infinitely high at the origin. However, the area of the impulse
is finite . It is defined as δ(t) = 1 at t=0
=0 other wise
Unit step signal:The unit step function, also known as the Heaviside
function, is defined as such:
u(t) = 0 if t<0
=1 if t>=0
Sinc signal: The Sinc function is defined in the following manner:
x
xxc
sin)(sin if x≠0 and
sinc(x) = 1 at x=0
Following are some of the MATLAB functions used to plot the graphs.
Plot(Y): Plots the columns of Y versus their index if Y is a real number.
Plot(x,y): Plots all lines defined by vector X versus vector Y pairs. Stem(x,y):
A two-dimensional stem plot displays data as lines extending from a
baseline along the x-axis. A circle (the default) or other marker whose y-position represents the data value terminates each stem.
Subplot(m,n)
subplot divides the current figure into rectangular panes that are numbered row wise.
Subplot(m,n,p)
subplot(m,n,p) breaks the figure window into an m-by-n matrix
of small axes. P is a number that specifies the position of the pane
Since u(t), u(t-1) and u(t-2) have values of „1‟ and they just represent the time shifts and
directions of ramp functions, they can be dropped in this expression. Laplace transform of
above equation becomes
𝐴.1
𝑠− 2. 𝐴 .
𝑒−𝑠
𝑠2+ 𝐴.
𝑒−2𝑠
𝑠2
1.PROGRAM FOR PULSE WAVE SYNTHISIS
clear all;
close all;
clc
% WAVE FORM SYNTHISIS OF A PULSE WAVE FORM
syms f t s;
a=2;
b=5;
f1=heaviside(t-a) % unit step function starts at 'a
' sec
f2=-heaviside(t-b) % unit step function startts at
'b' sec
f=f1+f2
FS=laplace(f)
2.PROGRAM FOR TRIANGULAR WAVE SYNTHISIS
clear all;
close all;
clc
% WAVE FORM SYNTHISIS OF A PULSE WAVE FORM
syms f t s;
clc
G.N.I.T.S. – EEE DEPARTMENT
BASIC ELECTRICAL SIMULATION LAB
Experiment No: 6 Cass: III year B.Tech EEE Ist Semester
Exp - 6 4 of 5
A=1;
f1=A*t*heaviside(t) % Ramp function starts at 't=0 '
f2=-2*A*(t-1)*heaviside(t-1) % ramp function at 't=2' sec
f3=A*(t-2)*heaviside(t-2)
f=f1+f2+f3
FS=laplace(f)
Figure(a) Simulink diagram for Pulse waveform
G.N.I.T.S. – EEE DEPARTMENT
BASIC ELECTRICAL SIMULATION LAB
Experiment No: 6 Cass: III year B.Tech EEE Ist Semester
Exp - 6 5 of 5
Figure(b) Simulink diagram for Triangular waveform
Results
Lab In –Charge HOD –EEE
G.N.I.T.S. – EEE DEPARTMENT
BASIC ELECTRICAL SIMULATION LAB
Experiment No: 7 Cass: III year B.Tech EEE Ist Semester
Exp - 7 1 of 3
Pole zero Map and root locus design
AIM: 1) To obtain the Pole-zero plots for the given transfer functions.
a) 𝐺(𝑠) = 𝑠2+4.𝑠+3
(𝑠+5).(𝑠2+4.𝑠+7)
b) 𝐺(𝑠) = 2(𝑠+8)
𝑠(𝑠+3).(𝑠+6)2
2) To Design the (amplifier gain ) controller for the given system through pole zero map /
root locus such that settling time ts < 5sec and damping ratio = 0.6.
Verify the output response by Simulink.
Figure (1)
Theory:
pzmap(sys):
Plots the pole-zero map of the continuous- or discrete-time LTI model sys. For
SISO systems, pzmap plots the transfer function poles and zeros. For MIMO
systems, it plots the system poles and transmission zeros. The poles are plotted as
x's and the zeros are plotted as o's.
rlocus(sys)
rlocus computes the root locus of a SISO open-loop model. The root locus
gives the closed-loop pole trajectories as a function of the feedback gain k
(assuming negative feedback). Root loci are used to study the effects of varying
feedback gains on closed-loop pole locations.
G.N.I.T.S. – EEE DEPARTMENT
BASIC ELECTRICAL SIMULATION LAB
Experiment No: 7 Cass: III year B.Tech EEE Ist Semester
Exp - 7 2 of 3
1.A) PROGRAM:
num = [1 4 3]
den= conv ([1 5], [3 4 7])
g = tf (num,den)
[z,p,k] = tf2zp(num,den)
pzmap (g)
1.B) PROGRAM:
p = [0 -3 -6 -6 ]
z = [-8]
k = 2
GS= zpk(z,p,k)
Pzmap(GS)
2. PROGRAM FOR DESIGN OF CONTROLLER/Amplifier Gain
% To obtain the Transfer function
num1 = [60]
den1 = conv ([1 6],[1 2 0])
GS = tf ( num1 , den1 )
% To Draw the root locus/Pole zero MAP
figure (1)
rlocus (GS)
axis ([-3 3 -4 4])
sgrid (0.6,10)
% To find the controller gain
[ k , p ] = rlocfind (GS)
% Obtain the closed loop step response
Cloop = feedback (k*GS , 1)
figure(2)
step ( Cloop );
grid
G.N.I.T.S. – EEE DEPARTMENT
BASIC ELECTRICAL SIMULATION LAB
Experiment No: 7 Cass: III year B.Tech EEE Ist Semester
Exp - 7 3 of 3
Figure (2) : Simulink diagram for step response
Assignment:
Obtain Transfer function of the systems.
1. Poles = -1+i, -1-i, -4. Zeros = -2,-5, gain = 1
2. Poles = -1+4i, -1-4i, -5. Zeros = -8,-5, gain = .75
Results
Lab In –Charge HOD –EEE
G.N.I.T.S. – EEE DEPARTMENT
BASIC ELECTRICAL SIMULATION LAB
Experiment No: 8 Cass: III year B.Tech EEE Ist Semester
Exp - 8 1 of 3
Harmonic analysis of non sinusoidal wave forms
AIM: To generate a non sinusoidal wave and to measure the total harmonic distortion of
the non sinusoidal wave
Theory:
Harmonic is multiple of the fundamental frequency and it can be voltage and current in
an electric power system are a result of non-linear electric loads.
In a normal alternating current power system, the current varies sinusoidally at a specific
frequency, usually 50 or 60 hertz. When a linear electrical load is connected to the system, it
draws a sinusoidal current at the same frequency as the voltage .
When a non-linear load, such as a rectifier is connected to the system, it draws a current
that is not necessarily sinusoidal. The current waveform can become quite complex,
depending on the type of load and its interaction with other components of the system.
complex the current waveform can be deconstruct it into a series of simple sinusoids by
Fourier series analysis. The sinusoids start at the power system fundamental
frequency and occur at integer multiples of the fundamental frequency.
Fourier seris and Fourier Transform
Fourier discovered that such a complex signal could be decomposed into an infinite
series made up of cosine and sine terms and a whole bunch of coefficients which can
(surprisingly) be readily determined.
)2
sin()2
cos(2
1)(
11
0T
ntb
T
ntaatf
n
n
n
n
=
=
++=
• The coefficients are “readily” determined by integration.
−
−
=
=
2/
2/
2/
2/
)2
sin()(2
)2
cos()(2
T
Tn
T
Tn
dtT
nttf
Tb
dtT
nttf
Ta
fft(x):
Y = fft(X) returns the discrete Fourier transform (DFT) of vector X, computed with a fast Fourier transform (FFT) algorithm. If X is a matrix, fft returns the Fourier transform of each column of the matrix
Experiment No: 8 Cass: III year B.Tech EEE Ist Semester
Exp - 8 2 of 3
Total harmonic distortion
The total harmonic distortion (THD) is a measurement of the harmonic distortion present in a signal and is defined as the ratio of the sum of the powers of all harmonic components to the power of the fundamental frequency
𝑇𝐻𝐷 = √𝑉2
2+𝑉3
2+𝑉4
2+…………….𝑉𝑛
2
𝑉1
where Vn is the RMS voltage of nth harmonic and n = 1 is the fundamental frequency.
1. PROGRAM FOR HORMONIC DISTORTION ANALYSIS
clear all
clc
fs=1000; % sampling frequency signal
Ts=1/fs
TT =3/50; % Total time
f=50;
V=230;
Vm=sqrt(2)*V
t=0:0.001:0.06
v1=Vm*sin(2*pi*f*t) % Fundamental component of signal
v2=(Vm/2)*sin(2*pi*2*f*t) % 2nd harmonic of signal
v3=(Vm/3)*sin(2*pi*3*f*t) % 3 rd harmonic of signal
Experiment No: 9 Cass: III year B.Tech EEE Ist Semester
Exp - 9
4 of 4
Figure 1. Simulink diagram for step response of under damped case
Figure 2. Simulink diagram for analysis of step response for different dampings.
Results : Lab In –Charge HOD –EEE
Continuous
powergui
V=3
Scope3R=1 L=1mH
i+-
Current Measurement
C=10 u F3
Breaker2
Continuous
powergui
V=3
V=2
V=1
Scope3
R=8
R=4.472
R=1
L=1mH2
L=1mH1
L=1mH
i+-
Current Measurement2
i+-
Current Measurement1
i+-
Current Measurement
C=10 u F3
C=10 u F2
C=10 u F1
Breaker3
Breaker2
Breaker1
G.N.I.T.S. – EEE DEPARTMENT
BASIC ELECTRICAL SIMULATION LAB
Experiment No: 10 Cass: III year B.Tech EEE Ist Semester
Exp - 10 1 of 6
Three phase power measurement
AIM: To Measure the power by two watt meters method for balance and unbalanced loads
Theory:
Two Wattmeter Method:
In two wattmeter method, a three phase balanced voltage is applied to a balanced three phase load where the current in each phase is assumed lagging or leading by an angle of Ø behind the corresponding phase voltage. The schematic diagram for the measurement of three phase power using two wattmeter method is shown below.
From the figure, it is obvious that current through the Current Coil (CC) of Wattmeter W1 = IR , current though Current Coil of wattmeter W2 = IB whereas the potential difference seen by the Pressure Coil (PC) of wattmeter W1= VRB (Line Voltage) and potential difference seen by Pressure Coil of wattmeter W2 = VYB. The phasor diagram of the above circuit is drawn by taking VR as reference phasor as shown below.
Experiment No: 10 Cass: III year B.Tech EEE Ist Semester
Exp - 10 2 of 6
From the above phasor diagram,
Angle between the current IR and voltage VRB = (30° – Ø)
Angle between current IY and voltage VYB = (30° + Ø)
Therefore, Active power measured by wattmeter W1 = VRB IR Cos (30° – Ø)
Similarly, Active power measured by wattmeter W2 = VYB IY Cos(30° + Ø)
As the load is balanced, therefore magnitude of line voltage will be same irrespective of phase taken i.e. VRY, VYB and VRB all will have same magnitude. Also for Star / Y connection line current and phase current are equal, say IR = IY = IB = I
Let VRY = VYB = VRB = VL
Therefore,
W1 = VRB IR Cos (30° – Ø)
= VL IL Cos(30° – Ø)
In the same manner,
W2 = VL IL Cos(30° + Ø)
G.N.I.T.S. – EEE DEPARTMENT
BASIC ELECTRICAL SIMULATION LAB
Experiment No: 10 Cass: III year B.Tech EEE Ist Semester
Exp - 10 3 of 6
Hence, total power measured by watt meters for the balanced three phase load is given as,
W = W1 + W2
= VL IL Cos(30° – Ø) + VL IL Cos(30° + Ø)
= VL IL [Cos(30° – Ø) + Cos(30° + Ø)]
=√3 VL IL Cos Ø
Therefore, total power measured by watt meters W = √3 VL IL Cos Ø
Case1: When the Load is balanced (star connected )
VL=400 V
Vph = 400/sqrt(3) = 230.94 V
Z1 = 100 +j100 ohm
Z2 =100+j100 ohm
Z3=100+j100 ohm
IL = Vph/Zph = 230.94/(100+j100)
= 230.94/141.42 =1.64 A at -45
P= sqrt(3) Vl.IL. cos(phi) = 803. watts
Case2: When the Load is unbalanced balanced (star connected )
Z1=10 ohms
Z2 = 100+j10 ohms
Z3 = -j20 ohms
VR = 122.4 ∟0 V
VY = 122.4 ∟-120 V
VB = 122.4 ∟+120 V
G.N.I.T.S. – EEE DEPARTMENT
BASIC ELECTRICAL SIMULATION LAB
Experiment No: 10 Cass: III year B.Tech EEE Ist Semester
Exp - 10 4 of 6
IR =10.28 ∟30 A
IB = 9.20 ∟-149.90 A
IY =1.09 ∟-155.7 A
Total power P = (IR )2 *10 + (IY )2 *10
P = (10.28 )2 *10 + (1.09 )2 *100
P = 1056 +118.81 = 1174.81
Simulink procedure:
1. Model the Load resistors through (sim powersystem >> Elements >> Series
RLC branch.(set the values of R,L,C of the load)
2. Model the Voltage sources through (sim powersystem >> Electrical sources. (
set the values of Max Voltage ,frequency)
3. Model the voltage and current measurements through (sim powersystem >>
Measurements.
4. Model the watt meters through (sim powersystem >> Extra Library >>
Measurements.
5. Connect the watt meter-1 , current coil( ‘I’ input of watt meter) to R phase and
voltage input to RY lines
6. Connect the watt meter-2 , current coil( ‘I’ input of watt meter) to B phase and
voltage input to BR lines
7. Connect each block as shown in figure.
8. Model the power gui from simpower system.
G.N.I.T.S. – EEE DEPARTMENT
BASIC ELECTRICAL SIMULATION LAB
Experiment No: 10 Cass: III year B.Tech EEE Ist Semester
Exp - 10 5 of 6
G.N.I.T.S. – EEE DEPARTMENT
BASIC ELECTRICAL SIMULATION LAB
Experiment No: 10 Cass: III year B.Tech EEE Ist Semester