You are on page 1of 7

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/284162815

Solving Electrical Circuits Transient Problems with MATLAB® and


SIMPLORER®.

Article · May 2008

CITATIONS READS

2 6,021

3 authors:

Cosmas U. Ogbuka O.I. Okoro


University of Nigeria Michael Okpara University of Agriculture, Umudike
77 PUBLICATIONS 232 CITATIONS 149 PUBLICATIONS 1,095 CITATIONS

SEE PROFILE SEE PROFILE

Marcel U Agu
University of Nigeria
32 PUBLICATIONS 152 CITATIONS

SEE PROFILE

All content following this page was uploaded by Cosmas U. Ogbuka on 18 November 2015.

The user has requested enhancement of the downloaded file.


® ®
Solving Electrical Circuits Transient Problems with MATLAB and SIMPLORER .

C.U. Ogbuka, B.Eng., O.I. Okoro, Ph.D., and M.U. Agu, Ph.D.

Department of Electrical Engineering, University of Nigeria, Nsukka, Enugu State.

*
E-mail: ucogbuka@yahoo.com
oiokoro@hotmail.com
drmarcelagu@yahoo.co.uk

ABSTRACT the premier software for engineers and scientists.


MATLAB® is a high-level technical computing
In practical applications, the desired performance language and interactive environment for
characteristics of systems are specified in terms algorithm development, data visualization, data
of time-domain quantities; systems with energy analysis, and numeric computation. Using the
storage elements cannot respond instantaneously MATLAB® product, one can solve technical
and will exhibit transient response whenever they computing problems faster than with traditional
are suddenly subjected to inputs or disturbances. programming languages, such as C, C++, and
This paper adopted a procedural approach to FORTRAN [2].
circuit analysis in arriving at the state equations of
a sample complex circuit. The state equations SIMPLORER®, a trademark of Ansoft
were programmed in MATLAB® to generate Corporation, is a simulation package for electric
transient responses. The sample circuit was circuit simulations that allows one to easily and
simulated using SIMPLORER® as a comparative quickly model all components of an application.
alternative. The simulation results will be very Engineers can design and model with electric
useful to system engineers in studying the and electronic facts; control and mechanical
transient behaviors of electrical circuits. components; discontinuous processes; and
controls with electric circuits, block diagrams, and
(Keywords: A.C., alternating current, MATLAB®, state graph components [3].
SIMPLORER®, transient, circuit, modeling)

MODELING WITH MATLAB® AND


INTRODUCTION SIMPLORER®

Transient analysis of A.C. circuits is probably one


of the most difficult areas of interest in electrical Modeling with MATLAB®
engineering and, by its nature, involves higher
mathematical content when compared to other The task of modeling the transient behaviors of
areas of electrical engineering. The transient electrical circuits in MATLAB® entails developing
analysis is used to describe the circuit behavior as the analysis equations in state space form. The
a function of time before steady state is achieved. electrical circuit to be analyzed is represented in
This paper is aimed at showing, with the aid of differential equations formed with the aid of
MATLAB® and SIMPLORER®, how the transient Kirchoff’s Voltage and Current Laws as well as
behaviors of typical electrical circuits can be other associated relationships. State Space
obtained with relative ease. representation allows an nth order, continuous
system to be represented by a set of n-
MATLAB®, an acronym for ‘Matrix Laboratory’ is a simultaneous, first–order differential equations [4,
product of Math Works, Inc. It is a scientific 5] as shown in Equation 1.
software package designed to provide integrated
numeric computation and graphic visualization in •
high level programming language [1]. The x =Ax + Bu (1)
combination of analysis capabilities, flexibility,
reliability, and powerful graphics makes MATLAB®

The Pacific Journal of Science and Technology –149–


http://www.akamaiuniversity.us/PJST.htm Volume 9. Number 1. May-June 2008 (Spring)
where: Ch arg e(Q)
x=State Variable Vector Since, Current (i ) =
u=Input Vector Time(t )
A=Coefficient Matrix or System Matrix dQ
B=Input or Control or Driving Matrix i= ;
dt
di d 2Q
Modeling with SIMPLORER® = ;
dt dt 2
The task of simulation using SIMPLORER® Q = ∫ i (t )
involves creation of project using SSC
Commander, creation of model using the
graphical input tool schematic or the We assumed that all currents and charges are
SIMPLORER® text editor, evaluation and analysis zero at the instant of closure of switch, K.
of result using the simulator data and Day Post Therefore,
Processor applications respectively [3].
Q1 d 2Q1 d 2Q2
u− − i1R1 − L1 2 + L1 2 = 0
MATHEMATICAL DESCRIPTION C1 dt dt

For the purpose of transient analysis using Taking KVL around loop 2,
MATLAB®, a procedural approach is used to d 1 di
mathematically describe Figure 1. The resulting
differential equations are presented in State
− L1
dt
(i2 − i1 ) −
C2 ∫ i2 (t ) − L2 2 = 0
dt
(2)

Space form suitable for MATLAB® programming.


di2 di 1 di
− L1
dt
+ L1 1 −
dt C2 ∫ i2 (t ) − L2 2 = 0
dt
50uF 3KΩ 12uF

d 2Q2 d 2Q1 Q2 d 2Q2


C1 K C2 − L1 + L1 − − L2 = 0 (3)
dt 2 dt 2 C2 dt 2
L2
R1L1 1.2H 0.45H
Let
u ~
100sin(10t) i1 i2 x1 = Q1

x2 = Q1
• ••
x2 = Q1
Figure 1: A Sample A.C. Circuit. • •
x1 = Q1 = x2 (4)

Taking KVL around loop 1 : Also, let

1 d x3 = Q2
u−
C1 ∫ i1 (t ) − i1R1 − L1 (i1 − i2 ) = 0
dt •
x4 = Q2
• ••
x4 = Q2
1 di di
u−
C1 ∫ i1 (t ) − i1R1 − L1 1 + L1 2 = 0
dt dt
• •
x3 = Q2 = x4 (5)

The Pacific Journal of Science and Technology –150–


http://www.akamaiuniversity.us/PJST.htm Volume 9. Number 1. May-June 2008 (Spring)
1 • ⎡u 1 R 1 ⎤
Working in terms of x , Equations 2 and 3 u− x1 −R1x2 −L1 x2+L1⎢ − x1 − 1 x2 − x3⎥ = 0
become: C1 ⎣L2 L2C1 L2 L2C2 ⎦
1 • L L LR L
1 • •
u− x1 −R1x2 −L1 x2+ 1 u− 1 x1 − 1 1 x2 − 1 x3 = 0
u − x1 − R1 x2 − L1 x2 + L1 x4 = 0 (6) C1 L2 L2C1 L2 L2C2
C1
• 1 1 R 1 1 R 1
x2 = u− x1 − 1 x2 + u− x1 − 1 x2 − x3 = 0
L1 L1C1 L1 L2 L2C1 L2 L2C2
• • 1 •
− L1 x4 + L1 x2 − x3 − L2 x4 = 0 (7)
C2
Collecting like terms the following:

From Equation 6
• ⎡ L + L1 ⎤ ⎡ − L2 − L1 ⎤
x2 = ⎢ 2 ⎥u + ⎢ ⎥ x1 +
• u 1 R • ⎣ L1L2 ⎦ ⎣ L1L2C! ⎦
(11)
x2 = − x1 − 1 x2 + x4 (8)
⎡ − R1L2 − R1L1 ⎤
L1 L1C1 L1 1
⎢ ⎥ x2 − x3
⎣ L1L2 ⎦ L2C2

From Equation 7
Finally, putting Equations 4, 5, 10, 11 in State
Space form:
• • 1 L •
x2 = x4 + x3 + 2 x4 (9)
L1C2 L1
⎡• ⎤ ⎡ 0 1 0 0⎤ ⎡x1⎤ ⎡ 0 ⎤
x
⎢ ⎥1 ⎢ ⎥⎢ ⎥ ⎢ ⎥
Equating equation 8 and 9, ⎢ ⎥ ⎢−L −L −RL −RL ⎥⎢ ⎥ ⎢ ⎥
⎢• ⎥ ⎢ 2 1 1 2 1 1

1 ⎥ ⎢x2⎥ ⎢L2 +L1⎥
0

⎢x2⎥ L1L2C1 L1L2 L2C2 ⎥ ⎢ ⎥ ⎢ L1L2 ⎥
u 1 R • • 1 L • ⎢ ⎥= ⎢ ⎥⎢ ⎥ ⎢ ⎥
− x1 − 1 x2 + x4 = x4 + x3 + 2 x4 ⎢• ⎥ ⎢ ⎥ ⎢x ⎥ + ⎢ ⎥u
L1 L1C1 L1 L1C2 L1 ⎢x ⎥ ⎢ 0 1⎥ ⎢ ⎥ ⎢ 0 ⎥
3
0 0
L2 • u 1 R 1 ⎢ ⎥3 ⎢ ⎥⎢ ⎥ ⎢ ⎥
x4 = − x1 − 1 x2 − x3 ⎢ ⎥ ⎢ −R1
⎥⎢ ⎥ ⎢ ⎥
L1 L1 L1C1 L1 L1C2 ⎢• ⎥ ⎢ − 1 −
1 ⎥
0⎥ ⎢ ⎥ ⎢ 1 ⎥
• u 1 R 1 ⎣⎢x4⎦⎥ ⎢⎣ L2C1 L2 L2C2 ⎢
⎦ ⎢⎣x4⎥⎦ ⎣ L2 ⎦

x4 = − x1 − 1 x2 − x3 (10)
L2 L2C1 L2 L2C2
(12)

Substituting Equation 10 into Equation 6, we Table 1 shows the MATLAB® Function and
have: Calling files for Equation 12.

The Pacific Journal of Science and Technology –151–


http://www.akamaiuniversity.us/PJST.htm Volume 9. Number 1. May-June 2008 (Spring)
Table 1: MATLAB® Function and Calling files for RESPONSE CURVES
Equation 12.

FUNCTION FILE MATLAB® Response Curves

%Function file that defines equation 12


%and save as transient_analysis.m
%and represent the function as xdot=Ax+BU
function[xdot]= transient_analysis(t,x)
xdot=zeros(4,1);
x1=[x(1);x(2);x(3);x(4)];
L1=1.2;
R1=3000;
L2=0.45;
C1=50e-6;
C2=12e-6;
u=100*sin(10*t);
A=[0 1 0 0;(-L2-L1)/(L1*L2*C1) (-R1*L2-
R1*L1)/(L1*L2) -1/(L2*C2) 0;0 0 0 1;-1/(L2*C1) -
R1/L2 -1/(L2*C2) 0];
B=[0;(L2+L1)/(L1*L2);0;1/L2];
U=u;
xdot=A*x1+B*U;

CALLING FILE
%Calling program that evaluates equation12
%and save as transient_analysiscall
to=0;
tf=2;
tinterval=0.001;
x0=[0;0;0;0];
tspan=to:tinterval:tf;
[T,x]=ode23('transient_analysis',tspan,x0);
%Graph of loop currents against time
figure(1)
plot(T,x(:,2),'k')
grid on
title('Loop 1 Current Against Time')
xlabel('Time [sec.]')
ylabel('Current [A]') Figure 2: Circuit Response Curves using
figure(2) MATLAB®
plot(T,x(:,4),'k')
grid on
title(' Loop 2 Current Against Time') SIMPLORER® Response Curves
xlabel('Time [sec.]')
ylabel('Current [A]') A proper selection and initialization of the circuit
figure(3) components namely inductors L1 and L2,
plot(T,(x(:,4)-x(:,2)),'k') capacitors C1 and C2, resistor R1, Alternating emf
grid on 100sin(10t) and ground is made. A firm
title('Current through the 1.2H inductor Against connection is made, using the wire connector, to
Time') realize the circuit model as shown in Figure 1
xlabel('Time [sec.]') (except for the switch K since simulation starts at
ylabel('Current [A]') time zero).

The Pacific Journal of Science and Technology –152–


http://www.akamaiuniversity.us/PJST.htm Volume 9. Number 1. May-June 2008 (Spring)
A 2-D Digital Graph is selected and used to and students of electrical engineering who are
initialize the relevant circuit currents through C1 confronted with problems involving transients in
and C2 and inductor L1. The results are shown in electrical circuits should utilize these modern
Figure 3. tools in their analysis.

REFERENCES

40m C1.I [A] 1. Okoro O.I. 2005. Introduction to MATLAB and


SIMULINK for Engineers and Scientist. John
0 Jacob’s Classic Publishers Ltd.: Enugu, Nigeria.
-40m
2. http://www.mathworks.com/products/matlab/descri
1m C2.I [A]
ption1.html

0 3. Ansoft Corp. 2002. Simulation System Simplorer


® 6.0 User Manual, English Edition. Ansoft
-1m Corporation: Pittsburgh, PA.
40m L1.I [A]
4. Okoro, O.I. 2005. “Application of Numerical
0 Software in Electrical Machine Modeling”.
LAUTECH Journal of Engineering and
-40m Technology.

5. Ogata, K. 2003. Modern Control Engineering,


Fourth Edition. Pearson Education Press, Inc.:
New York, NY.

0 0.25 0.5 0.75 1 1.3 1.5 1.8 2 t [s]

ABOUT THE AUTHORS

Figure 3: Circuit Response Curves using Engr. C.U. Ogbuka graduated from the
SIMPLORER® Department of Electrical Engineering, University
of Nigeria, Nsukka with First Class Honors. He
was the best graduating student during the
2002/2003 academic session. He is currently
CONCLUSION pursuing his M.Eng. degree in Power Devices.
His research interest is in Electric drives and
The results have shown elegant ways of solving Power Electronics.
the problems associated with transients in
electrical circuits. It is evident from the work that in Dr.-Ing. O.I. Okoro received his B.Eng. and
addition to a good knowledge of MATLAB® M.Eng. degrees in Electrical Engineering from
programming, the MATLAB® approach requires a the University of Nigeria. He holds a Ph.D. in
sound mathematical background and knowledge Electrical Machines from the University of Kassel,
of the basic laws of circuit analysis. Germany under the DAAD scholarship program.
He is a registered Electrical Engineer (COREN)
The SIMPLORER® approach requires only a good and a corporate member of the Nigerian Society
understanding of the SIMPLORER® package, the of Engineers (MNSE) and the IEEE (MIEEE). He
ability to select and appropriately initialize circuit currently serves as the Head of the Department
components and achieve good connections for of Electrical Engineering at the University of
successful simulation. Although a faster response Nigeria, NSUKKA.
time was achieved with the MATLAB® approach,
the two approaches satisfactorily showed the Dr. M. U. Agu holds a Ph.D. in Power Electronics
transient behaviors of the A.C. circuit. It is, from the University of Toronto, Canada. He is an
therefore, recommended that system engineers Associate Professor in the Department of

The Pacific Journal of Science and Technology –153–


http://www.akamaiuniversity.us/PJST.htm Volume 9. Number 1. May-June 2008 (Spring)
Electrical Engineering, University of Nigeria,
Nsukka. His research interests include power
electronics and the control of electric drives. He is
a member of the NSE and IEEE.

SUGGESTED CITATION

C.U. Ogbuka, O.I. Okoro, and M.U. Agu. 2008.


“Solving Electrical Circuits Transient Problems
with MATLAB® and SIMPLORER®”. Pacific
Journal of Science and Technology. 9(1):149-154.

Pacific Journal of Science and Technology

The Pacific Journal of Science and Technology –154–


http://www.akamaiuniversity.us/PJST.htm Volume 9. Number 1. May-June 2008 (Spring)

View publication stats

You might also like