unit21.mws

ORDINARY DIFFERENTIAL EQUATIONS POWERTOOL

Unit 21 -- Application: Electrical Circuit

Prof. Douglas B. Meade

Industrial Mathematics Institute

Department of Mathematics

University of South Carolina

Columbia, SC 29208

URL: http://www.math.sc.edu/~meade/

E-mail: meade@math.sc.edu

Copyright © 2001 by Douglas B. Meade

All rights reserved

-------------------------------------------------------------------

>

Outline of Unit 21

>

Initialization

> restart;

> with( DEtools ):

> with( plots ):

> with( linalg ):

Warning, the name changecoords has been redefined

Warning, the name adjoint has been redefined

Warning, the protected names norm and trace have been redefined and unprotected

>

21.A Electrical Circuit

21.A-1 Model for a General RLC Circuit

Consider an RLC series circuit with resistance R (ohm), inductance L (henry), and capacitance C (farad). Denote the electric charge by q (coulomb). The current in the circuit is the instantaneous rate of change of the charge:

> charge := i(t) = diff( q(t), t );

charge := i(t) = diff(q(t),t)

>

The unit for current is ampere. One of Kirchoff's Laws states that the sum of the instantaneous voltage drops (changes in potential) around a closed circuit must be zero. That is,

> KirchoffLaw := E[R] + E[L] + E[C] - E[emf] = 0;

KirchoffLaw := E[R]+E[L]+E[C]-E[emf] = 0

>

where E[R] , E[L] , and E[C] are the voltage drops across the resistor, inductor, and capacitor, respectively, and E[emf] is the voltage drop produced by an attached electromotive force.

According to Ohm's Law, the voltage drop across a resistor is proportional to the current with constant of proportionality R :

> E[R] := R*i(t);

E[R] := R*i(t)

>

Faraday's Law states that the voltage drop across the inductor is proportional to the instantaneous rate of chage of the current, with L as the proportionality constant:

> E[L] := L*diff(i(t),t);

E[L] := L*diff(i(t),t)

>

The voltage drop across a capacitor is proportional to the electric charge on the capacitor, with constant of proportionality 1/C :

> E[C] := 1/C * q(t);

E[C] := q(t)/C

>

21.A-2 Solution for the General RLC Circuit

When the modeling assumptions for the potential drop across each component in the circuit are inserted into Kirchoff's Law, the resulting ODE is

> KirchoffLaw;

R*i(t)+L*diff(i(t),t)+q(t)/C-E[emf] = 0

>

To put this into the form of a second-order ODE for the charge

> odeQ := eval( KirchoffLaw, {charge,E[emf]=e(t)} );

odeQ := R*diff(q(t),t)+L*diff(q(t),`$`(t,2))+q(t)/C...

>

The corresponding initial conditions are

> icQ := q(0)=q0, D(q)(0)=i0;

icQ := q(0) = q0, D(q)(0) = i0

>

The solution to this generic IVP is

> infolevel[dsolve] := 3:

> solQ := dsolve( { odeQ, icQ }, q(t) );

> infolevel[dsolve] := 0:

Methods for second order ODEs:

Trying to isolate the derivative d^2q/dt^2...

Successful isolation of d^2q/dt^2

-> Trying classification methods

trying a quadrature

trying high order exact linear fully integrable

trying differential order: 2; linear nonhomogeneous with symmetry [0,1]

trying 2nd order linear exact nonhomogeneous

trying a double symmetry of the form [xi=0, eta=F(x)]

trying linear constant coefficient

linear constant coefficient successful

solQ := q(t) = Int(-e(u)*C*exp(1/2*(C*R+sqrt(-C*(-R...
solQ := q(t) = Int(-e(u)*C*exp(1/2*(C*R+sqrt(-C*(-R...
solQ := q(t) = Int(-e(u)*C*exp(1/2*(C*R+sqrt(-C*(-R...
solQ := q(t) = Int(-e(u)*C*exp(1/2*(C*R+sqrt(-C*(-R...

>

The current can be found by differentiation:

> solI := eval( charge, solQ );

solI := i(t) = -e(t)*C*exp(1/2*(C*R+sqrt(-C*(-R^2*C...
solI := i(t) = -e(t)*C*exp(1/2*(C*R+sqrt(-C*(-R^2*C...
solI := i(t) = -e(t)*C*exp(1/2*(C*R+sqrt(-C*(-R^2*C...
solI := i(t) = -e(t)*C*exp(1/2*(C*R+sqrt(-C*(-R^2*C...
solI := i(t) = -e(t)*C*exp(1/2*(C*R+sqrt(-C*(-R^2*C...
solI := i(t) = -e(t)*C*exp(1/2*(C*R+sqrt(-C*(-R^2*C...

>

The same expressions for the charge and current can be derived as the solution to the first-order system of ODEs formed by Kirchoff's Law and the constitutive relation between current and charge. The appropriate first-order IVP is

> sysQI := odeQ, charge;

sysQI := R*diff(q(t),t)+L*diff(q(t),`$`(t,2))+q(t)/...

> icQI := q(0)=q0, i(0)=i0;

icQI := q(0) = q0, i(0) = i0

>

with solution

> solQI := dsolve( { sysQI, icQI }, { q(t), i(t) } );

solQI := {q(t) = Int(-e(u)*C*exp(1/2*u*(C*R+sqrt(C*...
solQI := {q(t) = Int(-e(u)*C*exp(1/2*u*(C*R+sqrt(C*...
solQI := {q(t) = Int(-e(u)*C*exp(1/2*u*(C*R+sqrt(C*...
solQI := {q(t) = Int(-e(u)*C*exp(1/2*u*(C*R+sqrt(C*...
solQI := {q(t) = Int(-e(u)*C*exp(1/2*u*(C*R+sqrt(C*...
solQI := {q(t) = Int(-e(u)*C*exp(1/2*u*(C*R+sqrt(C*...
solQI := {q(t) = Int(-e(u)*C*exp(1/2*u*(C*R+sqrt(C*...
solQI := {q(t) = Int(-e(u)*C*exp(1/2*u*(C*R+sqrt(C*...
solQI := {q(t) = Int(-e(u)*C*exp(1/2*u*(C*R+sqrt(C*...
solQI := {q(t) = Int(-e(u)*C*exp(1/2*u*(C*R+sqrt(C*...
solQI := {q(t) = Int(-e(u)*C*exp(1/2*u*(C*R+sqrt(C*...
solQI := {q(t) = Int(-e(u)*C*exp(1/2*u*(C*R+sqrt(C*...
solQI := {q(t) = Int(-e(u)*C*exp(1/2*u*(C*R+sqrt(C*...
solQI := {q(t) = Int(-e(u)*C*exp(1/2*u*(C*R+sqrt(C*...
solQI := {q(t) = Int(-e(u)*C*exp(1/2*u*(C*R+sqrt(C*...
solQI := {q(t) = Int(-e(u)*C*exp(1/2*u*(C*R+sqrt(C*...

>

That the two forms of the solutions are the same is a little difficult to verify with Maple:

> simplify( eval( q(t), solQ ) - eval( q(t), solQI ) );

C*(-Int(e(u)*exp(1/2*(C*R+sqrt(-C*(-R^2*C+4*L)))*u/...
C*(-Int(e(u)*exp(1/2*(C*R+sqrt(-C*(-R^2*C+4*L)))*u/...
C*(-Int(e(u)*exp(1/2*(C*R+sqrt(-C*(-R^2*C+4*L)))*u/...
C*(-Int(e(u)*exp(1/2*(C*R+sqrt(-C*(-R^2*C+4*L)))*u/...

>

> collect( simplify( eval( i(t), solI ) - eval( i(t), solQI ) ), {R,C,L} );

1/2*((-4*Int(e(u)*exp(1/2*u*(C*R+sqrt(-C*(-R^2*C+4*...
1/2*((-4*Int(e(u)*exp(1/2*u*(C*R+sqrt(-C*(-R^2*C+4*...
1/2*((-4*Int(e(u)*exp(1/2*u*(C*R+sqrt(-C*(-R^2*C+4*...
1/2*((-4*Int(e(u)*exp(1/2*u*(C*R+sqrt(-C*(-R^2*C+4*...
1/2*((-4*Int(e(u)*exp(1/2*u*(C*R+sqrt(-C*(-R^2*C+4*...
1/2*((-4*Int(e(u)*exp(1/2*u*(C*R+sqrt(-C*(-R^2*C+4*...
1/2*((-4*Int(e(u)*exp(1/2*u*(C*R+sqrt(-C*(-R^2*C+4*...
1/2*((-4*Int(e(u)*exp(1/2*u*(C*R+sqrt(-C*(-R^2*C+4*...
1/2*((-4*Int(e(u)*exp(1/2*u*(C*R+sqrt(-C*(-R^2*C+4*...
1/2*((-4*Int(e(u)*exp(1/2*u*(C*R+sqrt(-C*(-R^2*C+4*...
1/2*((-4*Int(e(u)*exp(1/2*u*(C*R+sqrt(-C*(-R^2*C+4*...
1/2*((-4*Int(e(u)*exp(1/2*u*(C*R+sqrt(-C*(-R^2*C+4*...

>

As partial verification of the equivalence of the solutions, note that the charge obtained from the first-order system satisfies the appropriate second-order ODE:

> odetest( op(select( has, solQI, q(t) )), odeQ );

0

21.A-3 Special Case #1: LC Circuit

If the circuit does not have a resistor, R = 0 , then the solutions "simplify" to

> LCsolQI := simplify( eval( solQI, R=0 ) );

LCsolQI := {q(t) = 1/2*(-C*Int(e(u)*exp(u*sqrt(-C*L...
LCsolQI := {q(t) = 1/2*(-C*Int(e(u)*exp(u*sqrt(-C*L...
LCsolQI := {q(t) = 1/2*(-C*Int(e(u)*exp(u*sqrt(-C*L...
LCsolQI := {q(t) = 1/2*(-C*Int(e(u)*exp(u*sqrt(-C*L...

>

Note that C > 0 and L > 0 imply that the exponentials in this problem all involve imaginary exponents, the real-valued solutions will involve sine and cosine. In particular, there is no transient solution for an LC circuit. Given that the second-order ODE for the charge in an LC circuit reduces to

> eval( odeQ, R=0 );

L*diff(q(t),`$`(t,2))+q(t)/C-e(t) = 0

>

which is equivalent to an undamped oscillator, this is not surprising.

>

21.A-4 Special Case #2: RC Circuit

If the circuit does not have an inductor, L = 0 , it is not possible to obtain the solutions by simply inserting L = 0 into the general solution to the RLC circuit

> simplify( eval( solQI, L=0 ) );

Error, (in eval/_definite) division by zero

>

The problem is that when L = 0 the ODE for the charge is no longer of second order.

> RCodeQ := eval( odeQ, L=0 );

RCodeQ := R*diff(q(t),t)+q(t)/C-e(t) = 0

>

The solution is

> RCsolQ := expand( dsolve( { RCodeQ, q(0)=q0 }, q(t) ) );

RCsolQ := q(t) = Int(e(u)*exp(u/(C*R)),u = 0 .. t)/...

> RCsolI := i(t) = expand( diff( rhs(RCsolQ), t ) );

RCsolI := i(t) = -Int(e(u)*exp(u/(C*R)),u = 0 .. t)...

>

Here, because C*R > 0 , the denominators all tend to infinity as t -> infinity . This means that the initial charge in the system has no bearing on the long-time behavior of the solution. If the exponentially growing term in the integrand for the particular solution survives in a form that exactly cancels the exponential growth in the denominator, then the steady-state solution for the charge will be nontrivial. For example,

> collect( value( eval( { RCsolQ, RCsolI }, e=1 ) ), exp );

{q(t) = C+(-C+q0)/exp(t/(C*R)), i(t) = (1/R-q0/(C*R...

>

21.A-5 Special Case #3: RL Circuit

If the circuit does not have a capacitor, 1/C = 0 , it is possible to obtain the charge on the circuit by simply taking a limit of the general solution to the RLC circuit

> RLsolQ := simplify( map( limit, solQ, C=infinity ), symbolic );

RLsolQ := q(t) = -(int(e(u)*exp(u*R/L),u = 0 .. t)*...

>

This substitution works because the ODE for the charge is still of second-order, with two distinct eigenvalues:

> RLodeQ := limit( odeQ, C=infinity );

RLodeQ := R*diff(q(t),t)+L*diff(q(t),`$`(t,2))-e(t)...

>

Note that while the formal substitution C = infinity yields the same ODE

> eval( odeQ, C=infinity );

R*diff(q(t),t)+L*diff(q(t),`$`(t,2))-e(t) = 0

>

this substitution cannot be used directly on the solution

> eval( solQ, C=infinity );

q(t) = Int(-e(u)*infinity/(sqrt(-infinity*(-R^2*inf...
q(t) = Int(-e(u)*infinity/(sqrt(-infinity*(-R^2*inf...

>

but the charge in an LR circuit can be obtained as the limit of the generic solution for an RLC circuit as C -> infinity :

> simplify( map( limit, solQ, C=infinity ), symbolic );

q(t) = -(int(e(u)*exp(u*R/L),u = 0 .. t)*exp(-t*R/L...

>

The corresponding current is

> RLsolI := i(t) = expand( diff( rhs(RLsolQ), t ) );

RLsolI := i(t) = int(e(u)*exp(u*R/L),u = 0 .. t)/(L...

>

Careful inspection of the expression for the charge in the circuit verifies that this solution is obtained from a second-order ODE with eigenvalues lambda = 0 and lambda = -R/L . The presence of a zero eigenvalue implies that the initial charge and current in the circuit impact the solution for all time. Moreover, because R/L > 0, only the portion of the general solution to the homogeneous term corresponding to the negative exponential is guaranteed to be transient.

>

[Back to ODE Powertool Table of Contents]

>