35
TLINE CWEB OUTPUT 1 TLINE Lossless Transmission Line Simulation via the Finite Difference–Time Domain Technique Electromagnetic Simulations Laboratory February 16, 2005 Technical Report # 31 J. Richie Updated: January 2007 Summary This report details the program tline that simulates waves on a transmission line using a one-dimensional finite-difference time-domain (FDTD) algorithm on the voltage and current. This code can be used to prepare video clips of the wave motion along the transmission line, and to provide the AC steady state information regarding up to three sections of line/load. Parallel connections such as stub tuners are not available. Future Considerations Direct implementation of resistances The “Big” Problem Lossy Lines Reactive Loads Stub Matching Networks Multiple (λ/4) matching sections

TLINE - Marquette

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: TLINE - Marquette

TLINE CWEB OUTPUT 1

TLINE

Lossless Transmission Line Simulation

via

the Finite Difference–Time Domain Technique

Electromagnetic Simulations Laboratory February 16, 2005Technical Report # 31 J. Richie

Updated: January 2007

Summary

This report details the program tline that simulates waves on a transmission line using a one-dimensionalfinite-difference time-domain (FDTD) algorithm on the voltage and current. This code can be used to preparevideo clips of the wave motion along the transmission line, and to provide the AC steady state informationregarding up to three sections of line/load. Parallel connections such as stub tuners are not available.

Future Considerations

• Direct implementation of resistances• The “Big” Problem• Lossy Lines• Reactive Loads• Stub Matching Networks• Multiple (λ/4) matching sections

Page 2: TLINE - Marquette

2 THEORY TLINE §1

1. Theory.

There are a number of options when considering simulation of the voltage and current on a uniformtransmission line. SPICE is capable of transmission line simulation, either as an ideal (lossless) delay line[1], or using an RLC model [2]. Computer modeling and analysis of digital transmission lines is discussed ingreat detail in [3].

In addition, a set of two programs specifically for educational purposes have been reported. The first iscapable of animating transients on transmission lines for educational purposes [4]. The second program is aninteractive solver for the engineering parameters of a transmission line with stubs and loads using sinusoidalexcitations [5].

In this work, the use of the finite difference method is described using the simulation of transmission linesas an example application. This application is also discussed in [6].

This section begins with the development of the finite difference equations used for the first order coupledtransmission line equations. The stability and implementation of the difference equations is presented,followed by details regarding the source and boundary conditions. The post processing performed at thistime is limited; however, it is described at the conclusion of this section.

2. Finite Difference Equations.

The transmission line equations can be derived from the distributed parameter model that uses R, L, G,and C:

−dv

dx= Ri + L

dI

dt(1.a)

and

− di

dx= Gv + C

dv

dt(1.b)

where v = v(x, t), i = i(x, t) are the voltage and current, respectively, along the transmission line. We shallassume a lossless line, i.e., R = G = 0.

n-1/2

n+1/2

n

i i+1/2 i+1

(a)

n

n+1

n+1/2

i-1/2 i i+1/2

(b)

Figure 1: Difference schemes for eqn.(2). The boxes represent known values, and the circles indicate theupdated value.

Page 3: TLINE - Marquette

§2 TLINE FINITE DIFFERENCE EQUATIONS 3

Let x = i∆x = i and t = n∆t = n, then, the marching-on-in-time method can be used to compute thenext time step for I, and a half time step later, V is computed, then another half time step later I, and soon. Using central finite differences for the derivatives in (1.a,b), we obtain [7]:

−V n(i + 1) − V n(i)

∆x= −L

In+1/2(i + 1/2) − In−1/2(i + 1/2)

∆t(2.a)

where both sides are evaluated at (n, i + 1/2), and

−In+1/2(i + 1/2) − In+1/2(i − 1/2)

∆x= −C

V n+1(i) − V n(i)

∆t(2.b)

where both sides are evaluated at (n + 1/2, i).

In (2), eqn. (2a) is used to update In+1/2(i + 1/2) using data from time n and n − 1/2, and eqn. (2b)follows (2a) to update V n+1(i). See Figures 1.a and 1.b to see the finite difference scheme corresponding to(2.a,b).

Eqns. (2) can be rearranged to indicate the calculation necessary to compute the next time step, givenprevious time steps:

In+1/2(i + 1/2) = In−1/2(i + 1/2) − ∆t

L∆x[V n(i + 1) − V n(i)] (3.a)

and

V n+1(i) = V n(i) − ∆t

C∆x

[

In+1/2(i + 1/2) − In+1/2(i − 1/2)]

(3.b)

In general, a “marching-on-in-time” technique is used to simulate the voltage and current. First, thevoltages are updated at time n + 1, and the currents are updated a half time-step later, at n + 1/2. In thenext section, the relationships required to perform suitable time-stepping are discussed.

Page 4: TLINE - Marquette

4 STABILITY TLINE §3

3. Stability.

The stability of the calculation is important because with inappropriate time step and/or inappropriate∆x the iterations can quickly diverge to inaccurate results.

Generally, the condition to insure stability of FD-TD calculations is:

∆t ≤ ∆x

vph(4)

where vph is the phase velocity of the wave along the x direction. Note that the condition when (4) is anequality is denoted as the magic time step. In general, the FD-TD technique introduces a (usually) smallnumerical dispersion, related to the stability condition (4).

In the code, the parameters tfact and lfact are used. lfact is the number of cells per wavelength(λ/∆x). Since the wavelength is not easily defined for waveforms in the time domain, a maximum validfrequency of 100 MHz has been chosen. Generally, 20 cells per wavelength are used.

For the lossless transmission line, and for the non-dispersive one-dimensional case in general, use of themagic time step results in no numerical dispersion. ∆t is chosen initially to satisfy the magic time step. Theparameter tfact is used to quantify how much ∆t and the magic time step differ:

∆t =tfact

lfact

λ

vph=

tfact

lfact

1

f(5)

It has been found that the stability of the computations is very dependent on the relative values ofdielectric constant. For a wave traveling from left to right, when the wave reaches a boundary and enters amedium with a higher dielectric constant, the results at the magic time step diverge.

The code has been written to check for divergent results, and reduce ∆t by the parameter tfact if thefields diverge. This makes the code adaptive, in a sense. What is done in the code, is to check for excessivelylarge values of voltage or current. If excessively large values are identified, the simulation is aborted, thetime step is decreased, and the simulation begins. This process continues until the simulation is completedwith no excessive values identified.

4. Implementation.

Figure 2 shows the one dimensional geometry. Values of x and the corresponding physical parameters arelabelled above the horizontal axis and i values (x = i∆x) are below the axis. The problem space consists ofthree regions, from i = 0 to i1, from i1 to i2, and from i2 to imax.

i

0 i1 i2 imax

R1, dx1, vph1 R2, dx2, vph2 R3, dx3, vph3

Figure 2: Geometry for three-region problems. At i = imax, an open circuit or a short circuit can also beimplemented.

Page 5: TLINE - Marquette

§4 TLINE IMPLEMENTATION 5

Three separate regions have been chosen for all simulations. Two regions can easily be incorporated byusing the same parameters for two of the three regions. Three regions were chosen to allow a wide varietyof simulations, such as:

• transmission line and a load resistance;• source with an impedance Rg, a transmission line, and a load;• transmission line, quarter-wave transformer, and a load;• transmission line, half-wave window, and a load;

For each region, the user enters values (for each section of line) for the impedance, phase velocity, andlength (in meters).

Generally, the values of i1, i2, and imax are determined from ∆x, the spatial increment. Then, to insurestability, ∆t is chosen using (4), where ∆t is the same in all regions. The spatial increment must be chosen toprovide sufficient accuracy, usually ∆x ≤ λ/20, where λ is the smallest wavelength. The smallest wavelengthis related to the maximum frequency, assumed to be 100 MHz in the simulations. Then, the minimumwavelength is determined using:

λmin =vph

fmax= 20∆xmax (6)

where fmax is 100 MHz.

The value of ∆t is computed using (5), where the largest phase velocity is used. ∆t is constant for all i.The value of ∆t is decreased if divergent results are obtained (see section on stability). Once ∆t is found,∆x in each region can be computed. The length (in meters) for each region is then used to determine i1, i2,and imax.

This implementation of FD-TD does not enable a full-wave analysis; results for multiple frequencies cannot be gleaned from a single simulation. Therefore, only the present time step and one previous time stepmust be stored in memory. This results in less possible information, while allowing the software to run usingless computational resources.

Page 6: TLINE - Marquette

6 ITERATION PROCESS TLINE §5

n-1

n+1

n

V (i)

I(i + 1)

V (i + 1)

(a)

n-1

n+1

n

I(i)

V (i)

I(i + 1)

(b)

Figure 3: Difference schemes for eqn.(8). The boxes represent data used, and the circles indicate where theequations are evaluated. (a): I for the n + 1 time step is updated first; (b): V is updated using I values atn + 1.

5. Iteration Process.

The iteration process is based on (3), repeated here:

In+1/2(i + 1/2) = In−1/2(i + 1/2) − re [V n(i + 1) − V n(i)] (7.a)

V n+1(i) = V n(i) − rh

[

In+1/2(i + 1/2) − In+1/2(i − 1/2)]

(7.b)

where

re =∆t

L∆xrh =

∆t

C∆x(8)

Since re and rh depend on the region, arrays are used to store re and rh for every value of i.

The half-steps in the iteration process are inconvenient. It is necessary to adjust the half-steps in thecurrent. For I, In+1/2(i + 1/2) becomes In+1(i + 1). Then, (7) becomes:

In+1(i + 1) = In(i + 1) − re [V n(i + 1) − V n(i)] (8.a)

V n+1(i) = V n(i) − rh

[

In+1(i + 1) − In+1(i)]

(8.b)

The iteration molecule for I is shown in Figure 3a. Once all I values are updated at time n + 1, theiteration molecule for V shown in Figure 3b is used to update all V values.

Page 7: TLINE - Marquette

§6 TLINE SOURCE 7

6. Source.

The source of the wave on the transmission line has been implemented using two possibilities: a sinusoidfor all time, and a Gaussian pulse. The sinusoid begins at t = 0, and is a sine curve with user-input frequency.

The Gaussian pulse shape, Sg, is given by:

Sg(n) = e−(n−No)2/N2

d (13)

where n is the present time step, No is the time where the pulse is at its peak, and Nd is the variance(describing the width) of the pulse.

The gaussian pulse must begin sufficiently small at t = 0, since FD-TD methods do not accurately modelabrupt changes in the source. The Gaussian pulse is implemented with a value for No that is at least threetimes Nd [8]. This insures that no numerical ringing is introduced in the results.

In the finite difference-time domain method, the source can be considered “hard” or “soft”. A hard sourceimplies that the value of the voltage or current is set to precisely the value of the source. In the soft sourcecase, the voltage or current at the source is added to the value obtained in the time-stepping algorithm. Byutilizing a soft source, the reflected wave is allowed to propagate through the source. A hard source is onlyrecommended if no reflection back to the source can be guaranteed [9].

Page 8: TLINE - Marquette

8 BOUNDARY CONDITIONS TLINE §7

7. Boundary Conditions.

In all numerical techniques in electromagnetics that utilize partial differential equations (rather thanintegral equations), the boundary of the solution space must be prepared to avoid numerical reflection atthe edges of the problem. Here, we incorporate Mur’s implementation of absorbing boundary conditions(ABC’s), derived from the Engquist-Majda equations [10],[11].

The Engquist-Majda equations are “one-way wave equations”. One-way wave equations allow propagationin only ‘some’ directions and can thus be used to set up the absorption of waves at boundaries. The equationsare found by factoring the partial differential equation operator and were implemented by Mur in Cartesiancoordinates.

0

x

y

α

Figure 4.

α measured off x axis.

Consider the scalar wave equation in Cartesian coordinates:

∂2U

∂x2+

∂2U

∂y2− 1

c2

∂2U

∂t2= 0 (14)

and let us define

L =∂2

∂x2+

∂2

∂y2− 1

c2

∂2

∂t2= D2

x + D2y − 1

c2D2

t (15)

thus, we have LU = 0.

To factor the operator, L, we state without proof that:

LU = L+L−U = 0 (16)

where:

L− = Dx − Dt

c

1 − S2 S =Dy

(Dt/c)(17)

Note that L+ is the same except a + sign is used before the radical. In addition, the Dx is placed in frontwhen factoring the operator so that a condition for an x = c boundary is derived. The operator L− is usedat the smallest x (usually x = 0) for waves propagating in the −x direction, and L+ is used at x = xmax for+x propagating waves.

The relation L−U = 0 will absorb a plane wave propagating toward the boundary x = 0 for any angle α,as shown in Figure 4. However, the operator L−, with the radical, is a “pseudodifferential operator”, and isnot a local operator. It is difficult to incorporate L− directly.

The operator is approximated by performing a Taylor series expansion on the radical in (17). One termand two term approximations have been reported in the literature. In the one-term approximation,

1 − S2 → 1 (18)

which results in:

L− = Dx − Dt

c

∂U

∂x− 1

c

∂U

∂t= 0 (19)

For the two term approximation,√

1 − S2 → 1 − 1

2S2 (20)

which results in:

L− =∂2

∂x∂t− 1

c

∂2

∂2t+

c

2

∂2

∂y2

Page 9: TLINE - Marquette

§7 TLINE BOUNDARY CONDITIONS 9

L−U =∂2U

∂x∂t− 1

c

∂2U

∂2t+

c

2

∂2U

∂y2(21)

For the transmission line implementation here, these equations are applied to V and I at the grid outerboundaries.

The Mur finite difference scheme is an implementation of the ABC’s derived previously. The two-termcase is very useful for two-dimensional simulations, and the one-term case can be derived by removing they-derivative terms. The one-term approximation is sufficient for one-dimensional problems.

Presently, the code incorporates the following difference scheme. At x = 0,

V n+10 = V n

1 +vph∆t − ∆x

vph∆t + ∆x

[

V n+11 − V n

0

]

(22)

where it should be noted that all values of V n+1i have been computed except the boundary value, V n+1

0 . Atx = xmax, the only change is related to the subscripts for the indices, i.e., the edge value goes from 0 to imax

and the 1 becomes imax − 1.

bdry

n+1

n

I0 V0 I1 V1

(a)

bdry

n+1

n

Vimax−1 IimaxVimax

(b)

Figure 5: Difference schemes for eqn.(22), the boundary conditions. The boxes represent data used, andthe circles indicate where the equations are evaluated. (a): x = 0 condition; (b): x = xmax condition.

Consider the boundary at x = 0, shown in Figure 5a. In simulation, I0 is zero, always. The value of I0 isnot needed, and is never updated. The boundary condition is applied to V n+1

0 , where most of the V and Ivalues at n + 1 have been computed. The iteration molecule for (22) is shown in Figure 5a. The boundaryand iteration molecule for (22) at x = xmax is shown in Figure 5b. In iteration, In

imaxand V n

imax−1 are thelast values updated. The boundary condition is applied to Vimax

, using (22) as shown in Figure 5b.

n

n+1

0 1

∂U∂t

∂U∂t

∂U∂x

∂U∂x

Figure 6.

Geometry for (23),(24)

To derive (22), one must do a finite difference approximation to the differ-ential equation in (19). This is accomplished by using

∂U

∂t=

1

2

∂U

∂t

i=0

+1

2

∂U

∂t

i=1

(23)

and∂U

∂x=

1

2

∂U

∂x

n

+1

2

∂U

∂x

n+1

(24)

and applying central differences. Figure 6 illustrates the finite differencescheme for the derivatives in (23) and (24). In Figure 6, the derivativesare evaluated using data from the grid points in boxes either vertically orhorizontally displaced from the label of the derivative.

Page 10: TLINE - Marquette

10 POST PROCESSING TLINE §8

8. Post Processing.

Presently, the post-processing that is done consists of writing snapshots of the V and I arrays to files alongwith a gnuplot script that incorporates these snapshots into a video clip. Extreme values of the V and Iarrays are automatically tracked so that a common scale is used for each gnuplot graph. The gnuplot graphscan be generated as encapsulated postscript files and displayed in sequence using the animation utility ofImageMagick (image manipulation software under the FSF license).

In addition, the code computes the number of time steps it will take for the wave to travel from one endof the problem space to the other. This time is multiplied by 50 to determine the final iteration time step.The final time step is then multiplied by 47/50. When the wave has traveled the length of the problem space47 times, the maximum absolute values at each cell are recorded. This is done by comparing the presentvalue during each iteration with the maximum value recorded at that location.

The maximum values are then used to compute and print the voltage standing wave ratio on each sectionof the line. A data file is also written that records the maximum value of V and I at each location.

Page 11: TLINE - Marquette

§9 TLINE RESULTS AND DISCUSSION 11

9. Results and Discussion.

In this section, the code is evaluated. The tests described here are:

• Open circuit load on a single transmission line;

• Standing wave ratio (VSWR) on a line that is terminated in an unmatched (real) impedance;

• Time step (tfact) considerations and dispersion;

• Two examples of quarter-wave transformers:

— where the load impedance is larger than the line impedance;

— where the line impedance is larger than the load impedance;

In all simulations, the cell size corresponds to 20 cells per wavelength.

10. Open Circuit Load.

Figure 7 shows the magnitude of the voltage along a transmission line that is open circuited at the loadend. The line is 18 m long, has a characteristic impedance (Ro) of 50 Ω, and the vph = 200 × 106. Thevalues of Ro and vph are chosen to be similar to RG58U cable. The signal is at a frequency of 30 MHz.

x

|E|

0 3 6 9 12 15 18

0

0.25

0.5

0.75

1

Figure 7. V under open load condition.

In Figure 7, the source is at the left end, and the open circuit load is at the right end. The VSWR alongthe line is reported by tline as between 20 and 60. Certainly, the open circuit condition is easily seen inFigure 7 by the maximum in the voltage at the load end.

Page 12: TLINE - Marquette

12 VSWR AND DISPERSION TLINE §11

11. VSWR and Dispersion.

Figure 8 shows the Voltage Standing Wave Ratio (VSWR) along a tranmsission line with characteristicimpedance (Ro) of 50 Ω, and the vph = 200 × 106. The values of Ro and vph are chosen to be similar toRG58U cable. The value of RL is varied from 5 to 300 Ω. The signal is at a frequency of 30 MHz.

RL

VSWR

0 50 100 150 200 250 300

1

3

5

7

9

11

Exact

tline

Figure 8. VSWR for a 50Ω line with variable RL.

Figure 8 demonstrates that the VSWR calculated does reach 1 at 50 Ω, and the simulation results matchthe exact value for RL < Ro. As RL increases past Ro, the simulation results do not agree with theory.

The reason for the discrepancy is related to the value of tfact. Recall that the software tests for divergenceand lowers the value of tfact until the simulation has successfully completed, i.e., steady state has beenreached with no divergent values of V or I. Simulations with RL < Ro do not require any changes to tfact.

However, when RL > Ro, tfact is reduced. When tfact is reduced from the magic time step, dispersionis introduced. The dispersion results in changes to the pulse shape. For example, Figure 9 shows the pulseshape of a Gaussian pulse under three different tfact values (or equivalently, for three different dispersionrates).

Page 13: TLINE - Marquette

§11 TLINE VSWR AND DISPERSION 13

-0.2

0

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

2

3 3.2 3.4 3.6 3.8 4 4.2 4.4

"tf1.out" using 1:2"tf9.out" using 1:2"tf8.out" using 1:2

Figure 9. Gaussian pulse shapes with differing dispersion factors.

In Figure 10, the value of tfact is plotted vs. RL from the VSWR simulations. Also shown in Figure 10is the value of VSWR on the load section of line, which should have a VSWR of one in this case. As thevalue of tfact is forced smaller to avoid divergent results, the value of VSWR on the matched section rises.

RL

0 50 100 150 200 250 300

0.5

0.75

1

1.25

1.5

0.5

0.75

1

1.25

1.5

tfactor

VSWR

Figure 10. tfact and VSWR on matched line from VSWR data.

Page 14: TLINE - Marquette

14 QUARTER-WAVE TRANSFORMERS TLINE §12

12. Quarter-Wave Transformers.

The code essentially uses three sections of transmission line to perform the simulations. On the left endof the lines a source is placed, and the line is matched by a generator impedance so that the waves do notreflect off the source. On the right end of the lines, the user can choose an open circuit, a short circuit, or amatched condition. Figure 11 shows the 3 sections.

Source Load

Ro R1 RL

.

Figure 11. The geometry used for the λ/4 matches.

First Example: Load Impedance Smaller Than Characteristic Impedance

Here, RL = 32Ω, Ro = 50Ω, all phase velocities are 2 × 108 m/s, the matching section, R1 has animpedance of

R1 =√

32 × 50 = 40Ω

and, since λ = 6.666 m on the line at 30 MHz, the quarter wave section is 1.666 m long.

The simulation was performed at a variety of frequencies from 20 to 50 MHz. The VSWR on the firstsection of line (connected to the source) would ideally have VSWR=1 at 30 MHz, and VSWR would increaseas the frequency deviates from 30 MHz. The results of the simulation are shown in Figure 12.

Freq. (MHz)

VSWR

20 25 30 35 40 45 50

1

1.1

1.2

1.3

1.4

1.5

Figure 12.VSWR for QWT: dotted is exact, solid is tline .

Page 15: TLINE - Marquette

§12 TLINE QUARTER-WAVE TRANSFORMERS 15

Second Example: Load Impedance Larger Than Characteristic Impedance

Here, RL = 128Ω, Ro = 50Ω, all phase velocities are 2 × 108 m/s, the matching section, R1 has animpedance of

R1 =√

128 × 50 = 80Ω

and, since λ = 6.666 m on the line at 30 MHz, the quarter wave section is 1.666 m long.

The simulation was performed at a variety of frequencies from 20 to 50 MHz. The VSWR on the firstsection of line (connected to the source) would ideally have VSWR=1 at 30 MHz, and VSWR would increaseas the frequency deviates from 30 MHz. The results of the simulation are shown in Figure 13.

Freq. (MHz)

VSWR

20 25 30 35 40 45 50

1

1.25

1.5

1.75

2

2.25

Figure 13.VSWR for QWT: dotted is exact, solid is tline .

Discussion

In both examples, the tline simulation results are slightly shifted in frequency compared to the exactVSWR values. This is believed to be due to the discretization of the line. Discretizing the line causes thelength of the line to be slightly different than the actually required line length.

In the first example, no dispersion is encountered because the impedances are from larger to smaller asone moves from the source to the load. However, in the second example, the effect of dispersion couldbe significant. Careful inspection of Figure 13 reveals a slight curvature in the tline simulation results forfrequencies above 30 MHz. The effect of dispersion in the second example is very small.

Page 16: TLINE - Marquette

16 CODE DESCRIPTION TLINE §13

13. Code Description.

The code is listed and described here. First, the makefile is provided, followed by header files andmain for the code. Each function that is listed in the prototypes of main is a separate file and follow mainin the order of the prototype list.

Major sections of the code listing are:

• Makefile to illustrate how the code is compiled and how the documentation is assembled;

• Header Files which hold global variables and #define statements;

• Main to illustrate an overview of the code;

• Solver that computes the fields in time;

• Post Processing to illustrate how the engineering parameters or video clips are assembled;

An index is also provided at the very end of this report.

The documentation is assembled using a set of files, including the web file, tline.w, and a file tline.jrd,holding a variety of files that are parsed out of tline.jrd as needed, such as commands to build the graphicsin the documentation. The mfile.* files are used to typeset the makefile.

The libcpp.a library [12] is also used for file manipulation (opening, closing, etc.). The libccp.a

library has been developed as part of the software used in the Electromagnetic Simulations Laboratory (ESL)at Marquette University.

Page 17: TLINE - Marquette

§14 TLINE MAKEFILE 17

14. Makefile.

Here is the makefile for the code and the documentation.

#

# Makefile for tline

#

CC=g++ -g

LOCAL=/home/richiej/bin/local

INCLS=$(LOCAL)/include

LIBS=$(LOCAL)/lib

#

OBJS= main.o inputs.o setup.o iterat.o vswr.o print.o scripts.o

#

all: tline tline.ps

#

tline: $(OBJS)

$(CC) -L$(LIBS) -o tline $(OBJS) -lcpp -lm

#

# compiling the OBJ’s

#

main.o: main.cc

$(CC) -I$(INCLS) -c main.cc

inputs.o: inputs.cc

$(CC) -I$(INCLS) -c inputs.cc

setup.o: setup.cc

$(CC) -I$(INCLS) -c setup.cc

iterat.o: iterat.cc

$(CC) -I$(INCLS) -c iterat.cc

vswr.o: vswr.cc

$(CC) -I$(INCLS) -c vswr.cc

print.o: print.cc

$(CC) -I$(INCLS) -c print.cc

scripts.o: scripts.cc

$(CC) -I$(INCLS) -c scripts.cc

#

# Section to create documentation

#

tline.ps: tline.dvi

dvips -t letter -f tline.dvi >tline.ps

tline.dvi: tline.tex makefile.tex tline.w alpha.tex 2pa.tex

2pb.tex geo.tex 8pa.tex 8pb.tex bc1.tex bc2.tex

upic.tex $(HOME)/admin/lib/jr.bib results.jrd

tex tline; bibtex tline; tex tline ; tex tline

tline.tex: tline.w

cweave tline.w;

#

# graphics

#

2pa.tex: 2pa.pic

gpic -t 2pa.pic >2pa.tex

Page 18: TLINE - Marquette

18 MAKEFILE TLINE §14

2pa.pic: tline.jrd

awk -F "|" ’$$1=="2pa" print $$2’ tline.jrd > 2pa.pic

2pb.tex: 2pb.pic

gpic -t 2pb.pic >2pb.tex

2pb.pic: tline.jrd

awk -F "|" ’$$1=="2pb" print $$2’ tline.jrd > 2pb.pic

geo.tex: geo.pic

gpic -t geo.pic >geo.tex

geo.pic: tline.jrd

awk -F "|" ’$$1=="geo" print $$2’ tline.jrd > geo.pic

8pa.tex: 8pa.pic

gpic -t 8pa.pic >8pa.tex

8pa.pic: tline.jrd

awk -F "|" ’$$1=="8pa" print $$2’ tline.jrd > 8pa.pic

8pb.tex: 8pb.pic

gpic -t 8pb.pic >8pb.tex

8pb.pic: tline.jrd

awk -F "|" ’$$1=="8pb" print $$2’ tline.jrd > 8pb.pic

alpha.tex: alpha.pic

gpic -t alpha.pic > alpha.tex

alpha.pic: tline.jrd

awk -F "|" ’$$1=="alpha" print $$2’ tline.jrd >alpha.pic

bc1.tex: bc1.pic

gpic -t bc1.pic >bc1.tex

bc1.pic: tline.jrd

awk -F "|" ’$$1=="bc1" print $$2’ tline.jrd > bc1.pic

bc2.tex: bc2.pic

gpic -t bc2.pic >bc2.tex

bc2.pic: tline.jrd

awk -F "|" ’$$1=="bc2" print $$2’ tline.jrd > bc2.pic

upic.tex: upic.pic

gpic -t upic.pic >upic.tex

upic.pic: tline.jrd

awk -F "|" ’$$1=="upic" print $$2’ tline.jrd > upic.pic

#

# Makefile typeset

#

makefile.tex: makefile

sed -f mfile.sed makefile>makefile.tmp;

awk -f mfile.awk -F "|" makefile.tmp >makefile.tex

#

# Admin Section

#

move: tline

mv tline $(HOME)/sims/fd1d

clean:

rm -f *.o tline *.out * *.tex *.dvi

*.idx *.log *.scn *.toc *.jpg *.eps

*.tmp *.pic *.ps tline.tibx jr.ref INDEX

*.blg *.aux *.bbl

tar:

tar -cf tline3.tar

Page 19: TLINE - Marquette

§14 TLINE MAKEFILE 19

*.cc *.h makefile mfile.* tline.w tline.jrd

pack: clean tar

gzip -9 tline3.tar;

mv tline3.tar.gz /home/richiej/tar/pack/tline3.tgz

15. Header file. Filename: fd1d.h

This is the header file, fd1d.h. This file contains all the global variables. The file is included in all codefiles except main.

extern double V [2][5005]; /∗ electric field ∗/extern double I[2][5005]; /∗ magnetic field ∗/extern double re [5005], rh [5005]; /∗ major iteration parameters ∗/;; /∗ miscellaneous iteration parameters ∗/;

extern double eta0 , Vp1 , Vp2 , Vp3 , dt , dx1 , dx2 , dx3 , R1, R2, R3;extern double l1 , l2 , l3 , freq , tstart , tstop , Vmax , Imax , Vmin , Imin ;extern int k1 , k2 , kmax , Nmax , OpenShortFlag , TimeFreqFlag , SourceFlag ;

16. Header file. Filename: std-defs.h

This is the header file, std-defs.h. This file contains a few definitions (#define statements) that areconvenient to make the code more easily read. The file is included in all code files.

#define COMPLEXstd ::complex < double >#define CIN std ::cin#define COUT std ::cout

Page 20: TLINE - Marquette

20 MAIN TLINE §17

17. Main. Filename: main.cc

This is the main function, or entry point to the code. Functions listed here are listed in later sections ofthe documentation.

The main function consists of a large do loop. This loop is used to allow for re-initiation of the solutionif divergent results are detected.

#include <stdio.h>

#include <iostream>

#include <stdlib.h>

#include <math.h>

#include "cpp−fcns.h"

#include "std−def.h" /∗

Prototypes

∗/void inputs (void);void setup(double lfact ,double tfact );void iterate (int n);void vswr (double ∗e);void printout (int n, int count );void scripts (int count ); /∗

Global Variables

∗/double V [2][5005]; /∗ electric field ∗/double I[2][5005]; /∗ magnetic field ∗/double re [5005], rh [5005]; /∗ major iteration parameters ∗/;; /∗ miscellaneous iteration parameters ∗/;

double eta0 , Vp1 , Vp2 , Vp3 , dt , dx1 , dx2 , dx3 , R1, R2, R3;double l1 , l2 , l3 , freq , tstart , tstop , Vmax , Imax , Vmin , Imin ;int k1 , k2 , kmax , Nmax , OpenShortFlag , TimeFreqFlag , SourceFlag ; /∗

Main/Entry point for software

∗/int main ( )

int i, k, n, count , Nhold ;double tfact , lfact , tfSave , time ;double Emax [5005], Hmax [5005];char fileOut [NAME_SIZE];std ::fstream fout ; /∗

input section

∗/inputs ( );lfact = 20.;

Page 21: TLINE - Marquette

§17 TLINE MAIN 21

tfact = 1.0;COUT ≪ "# tfact = " ≪ tfact ≪ "\n\n"; /∗

. . . . . . . . . . . . . . . . . . . . . . . Beginning of do loop

∗/do

tfSave = tfact ; /∗

set up parameters

∗/setup(lfact , tfact ); /∗

set up max and min for plots

∗/Vmax = −999;Vmin = 999;Imax = −999;Imin = 999; /∗

set up iterations

∗/n = 0;count = 11;Nhold = int(double(Nmax ) ∗ double(47./50.));COUT ≪ "# Begin holding max at n = " ≪ Nhold ≪ "\n";for (k = 0; k < 5005; k++)

Emax [k] = 0.;Hmax [k] = 0.;

/∗

Iteration Loop

∗/for (n = 0; n < Nmax ; n++)

iterate (n); /∗

test for divergence

∗/for (k = 1; k < kmax ; k++)

if (fabs (V [0][k]) > 1000) COUT ≪ "# Results diverged.\n\n";tfact = tfact − 0.001;COUT ≪ "# tfact = " ≪ tfact ≪ "\n\n";n = Nmax + 2; /∗ to break off simulations ∗/

if (TimeFreqFlag ≡ 1)

time = (double) n ∗ dt ;if ((¬(n % 3)) ∧ (time > tstart ) ∧ (time < tstop))

; /∗ printout is used to get video clips ∗/printout (n, count );count ++;

Page 22: TLINE - Marquette

22 MAIN TLINE §17

if (TimeFreqFlag ≡ 0) /∗

record max values after reaching steady state

∗/if (n > Nhold )

for (k = 1; k < kmax ; k++) if (fabs (V [0][k]) > Emax [k]) Emax [k] = fabs (V [0][k]);if (fabs (I[0][k]) > Hmax [k]) Hmax [k] = fabs (I[0][k]);

while (tfact 6= tfSave ); /∗

. . . . . . . . . . . . . . . . . . . . . . . . . End of do loop

∗/if (TimeFreqFlag ≡ 1) scripts (count ); /∗ scripts is used to get video clips ∗/if (TimeFreqFlag ≡ 0)

; /∗

here, print out the max values

∗/sprintf (fileOut , "VImax.out");OpenOutputFile (fileOut , fout );for (k = 1; k < kmax ; k++)

fout ≪ k ≪ " " ≪ Emax [k] ≪ " " ≪ Hmax [k] ≪ "\n";fout .close ( );vswr (Emax );

return 0;

Page 23: TLINE - Marquette

§18 TLINE INPUTS 23

18. Inputs. Filename: inputs.cc

This portion of the code is used to obtain the input information from the user. The variables thatare obtained are all global variables (listed in fd1d.h). In addition, the length of one wavelength at 30 MHzfor each section of line is printed to aid in assembling sections of line that are specific wavelengths, such asa quarter wave section of line. The data is obtained using getinputd and getinputi, from the libcpp.a

library [12].

#include <iostream>

#include "cpp−fcns.h"

#include <math.h>

#include "fd1d.h"

#include "std−def.h"

void inputs (void)

double pi , mu0 , eps0 , v1 , v2 , v3 , f , c;

pi = 4. ∗ atan (1.);mu0 = 4. ∗ pi ∗ 1. · 10−7;eps0 = 8.854 · 10−12;TimeFreqFlag = getinputi ("# Enter 1 for time domain, 0 for frequency domain results");if (TimeFreqFlag ≡ 1) SourceFlag = getinputi ("# Gaussian (1) or sinusoidal source (0)");if (TimeFreqFlag ≡ 0) SourceFlag = 0;COUT ≪ "# Enter the Characteristic Impedances (real):\n\n";R1 = getinputd ("# R_0");R2 = getinputd ("# R_1");R3 = getinputd ("# R_L");COUT ≪ "# Enter the phase velocities:\n\n";Vp1 = getinputd ("# Vp1");Vp2 = getinputd ("# Vp2");Vp3 = getinputd ("# Vp3");COUT ≪ "\n# Wavelength (in meters at 30 MHz) for each section:\n\n";f = 30. · 106;COUT ≪ "# Section 1: " ≪ Vp1 /f ≪ "\n";COUT ≪ "# Section 2: " ≪ Vp2 /f ≪ "\n";COUT ≪ "# Section 3: " ≪ Vp3 /f ≪ "\n";COUT ≪ "\n# Enter the line lengths (in meters):\n\n";l1 = getinputd ("# length 1");l2 = getinputd ("# length 2");l3 = getinputd ("# length 3");if (SourceFlag ≡ 0)

freq = getinputd ("\n# Enter the center frequency (for sine source, in MHz)");freq = freq ∗ 1. · 106;

if (TimeFreqFlag ≡ 1) COUT ≪ "\n# T_1 is " ≪ l1 /Vp1 ≪ "\n";COUT ≪ "# T_2 is " ≪ l2 /Vp2 ≪ "\n";COUT ≪ "# T_3 is " ≪ l3 /Vp3 ≪ "\n";tstart = getinputd ("# input start time");tstop = getinputd ("# input stop time");

Page 24: TLINE - Marquette

24 INPUTS TLINE §18

COUT ≪ "# TERMINATION:\n";;COUT ≪ "# Enter 1 for open circuit,\n";COUT ≪ "# Enter −1 for short circuit,\n";OpenShortFlag = getinputi ("# Enter 0 for neither");COUT ≪ "\n";return;

19. Solver.

In this major section of the documentation, the code is listed that performs the task of computing thefields. The iterations are performed in a marching-on-in-time fashion.

This section holds the code for setup and iterate, two major functions in the code. In the future, thefunction iterate should also be broken to include functions just for the source and just for the boundaryconditions.

Page 25: TLINE - Marquette

§20 TLINE SETUP 25

20. setup. Filename: setup.cc

This section of the code sets up the simulations as described in part C, Implementation, of the Theorysection.

#include <stdlib.h>

#include <iostream>

#include <math.h>

#include "fd1d.h"

#include "std−def.h"

#define pi M_PI

void setup(double lfact ,double tfact )

int i, n, k;double fmax , c, lambda , tmp , eLrge , induct , cap , Nreal ;

fmax = 100. · 106; /∗

set up dx’s and dt. First, base dt on largest vph and maximum frequency of 100 MHz

∗/eLrge = Vp1 ;if (Vp2 > eLrge ) eLrge = Vp2 ;if (Vp3 > eLrge ) eLrge = Vp3 ;lambda = eLrge/fmax ;tmp = lambda/lfact ;dt = tfact ∗ tmp/eLrge ; /∗

find dx1 and number of time steps to travel to end of length 1

∗/lambda = Vp1 /fmax ;dx1 = lambda/lfact ;Nreal = l1 /(Vp1 ∗ dt ); /∗

find dx2 and number of time steps to travel to end of length 2

∗/lambda = Vp2 /fmax ;dx2 = lambda/lfact ;Nreal += l2 /(Vp2 ∗ dt ); /∗

find dx3 and number of time steps to travel to end of length 3

∗/lambda = Vp3 /fmax ;dx3 = lambda/lfact ;Nreal += l3 /(Vp3 ∗ dt ); /∗

assume steady state reached after 50 traverses of line

∗/Nmax = int(50. ∗ Nreal ); /∗

print summary information so far

∗/

Page 26: TLINE - Marquette

26 SETUP TLINE §20

COUT ≪ "# Nmax = " ≪ Nmax ≪ "\n";COUT ≪ "# dt = " ≪ dt ≪ "\n";COUT ≪ "# dx1 = " ≪ dx1 ≪ "\n";COUT ≪ "# dx2 = " ≪ dx2 ≪ "\n";COUT ≪ "# dx3 = " ≪ dx3 ≪ "\n"; /∗

here, set k values

∗/k1 = int(l1 /dx1 );k2 = int(l2 /dx2 + k1 );kmax = int(l3 /dx3 + k2 );if (kmax > 5000) COUT ≪ "\n\n\nkmax too large\n\n";exit (1);

COUT ≪ "# k1 = " ≪ k1 ≪ ", k2 = " ≪ k2 ≪ ", kmax = " ≪ kmax ≪ "\n"; /∗

fill the re and rh arrays

∗/induct = R1/Vp1 ;cap = 1./(R1 ∗ Vp1 );COUT ≪ "inductance/capacitance for section A: " ≪ induct ≪ " " ≪ cap ≪ "\n";for (i = 0; i < k1 ; i++)

re [i] = dt/(induct ∗ dx1 );rh [i] = dt/(cap ∗ dx1 );

induct = R2/Vp2 ;cap = 1./(R2 ∗ Vp2 );COUT ≪ "inductance/capacitance for section B: " ≪ induct ≪ " " ≪ cap ≪ "\n";for (i = k1 ; i < k2 ; i++)

re [i] = dt/(induct ∗ dx2 );rh [i] = dt/(cap ∗ dx2 );

induct = R3/Vp3 ;cap = 1./(R3 ∗ Vp3 );COUT ≪ "inductance/capacitance for section C: " ≪ induct ≪ " " ≪ cap ≪ "\n";for (i = k2 ; i < kmax ; i++)

re [i] = dt/(induct ∗ dx3 );rh [i] = dt/(cap ∗ dx3 );

/∗ eta for source ∗/eta0 = R1; /∗

initialize V and I arrays

∗/for (k = 0; k < kmax ; k++)

V [0][k] = 0.;I[0][k] = 0.;V [1][k] = 0.;I[1][k] = 0.;

Page 27: TLINE - Marquette

§21 TLINE ITERATE 27

21. iterate. Filename: iterat.cc

Here is the iteration process, as written in Section 5, the Iteration Process. The source and boundarycondition implementation are separate functions to allow various scenarios.

#include <math.h>

#include "fd1d.h"

#include "std−def.h"

#define pi M_PI

void iterate (int n)

int k;double No , Nd ;

No = 15.;Nd = 5.;; /∗

update I values

∗/for (k = 1; k < kmax ; k++)

I[1][k + 1] = I[0][k + 1] − re [k] ∗ (V [0][k + 1] − V [0][k]);if ((k ≡ 2)) /∗ Source is added here ∗/

if (SourceFlag ≡ 0) I[1][k + 1] += 0.01 ∗ sin (2. ∗ pi ∗ freq ∗ (double) n ∗ dt );if (SourceFlag ≡ 1) I[1][k + 1] += 0.03 ∗ exp(−(n − No) ∗ (n − No)/(Nd ∗ Nd ));

if (OpenShortFlag ≡ 1) I[1][kmax − 1] = 0.; /∗ to implement an open circuit ∗/; /∗

update V values

∗/for (k = 1; k < kmax ; k++)

V [1][k] = V [0][k] − rh [k] ∗ (I[1][k + 1] − I[1][k]);if ((k ≡ 2)) /∗ Source is added here, can generator resistance be included? ∗/

if (SourceFlag ≡ 0) V [1][k] += 0.01 ∗ eta0 ∗ sin (2. ∗ pi ∗ freq ∗ (double) n ∗ dt );if (SourceFlag ≡ 1) V [1][k] += 0.03 ∗ eta0 ∗ exp(−(n − No) ∗ (n − No)/(Nd ∗ Nd ));

; /∗

apply boundary conditions

∗/V [1][kmax ] = V [0][kmax − 1] + ((Vp3 ∗ dt − dx3 )/(Vp3 ∗ dt + dx3 )) ∗ (V [1][kmax − 1] − V [0][kmax ]);V [1][1] = V [0][2] + ((Vp1 ∗ dt − dx1 )/(Vp1 ∗ dt + dx1 )) ∗ (V [1][2] − V [0][1]);; /∗

test for short circuit boundary condition at load end

∗/

Page 28: TLINE - Marquette

28 ITERATE TLINE §21

if (OpenShortFlag ≡ −1) V [1][kmax − 1] = 0.; /∗

V[1][kmax-1]=75.*I[1][kmax-1]; implements (correctly) a load resistor of 75 ohms. This

can be implemented in the future to allow true load resistances.

∗/; /∗

update values

∗/for (k = 1; k < kmax ; k++)

V [0][k] = V [1][k];I[0][k] = I[1][k];

22. Post Processing.

The post processing that is available depends on whether a time domain or a frequency domain solutionis requested. For time domain simulations, snapshots are printed and a gnuplot script is generated, suitablefor the creation of a video clip.

For frequency domain simulations, the VSWR on each section of the line is printed to standard output.In addition, the maximum values of V and I are printed to a file for each location along the transmissionline.

Page 29: TLINE - Marquette

§23 TLINE VSWR 29

23. VSWR. FIlename: vswr.cc

This portion of the code computes the voltage standing wave ratio (VSWR) on each section of the line.

#include <iostream>

#include "fd1d.h"

#include "std−def.h"

void vswr (double ∗e)

int i, k, index [4];double max , min , val ;

index [0] = 3;index [1] = k1 ;index [2] = k2 ;index [3] = kmax ;for (i = 0; i < 3; i++)

max = 0.;min = 999.;for (k = index [i] + 1; k < index [i + 1] − 1; k++)

val = ∗(e + k);if (val > max ) max = val ;if (val < min ) min = val ;

COUT ≪ "\n\n# −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−\n";COUT ≪ "\n# Section " ≪ i + 1 ≪ "\n\n";COUT ≪ "# Maximum Voltage is " ≪ max ≪ ", Minimum Voltage is " ≪ min ≪ "\n\n";if (min > 0) COUT ≪ "# VSWR = " ≪ max /min ≪ "\n\n";if (min ≡ 0) COUT ≪ "# VSWR is infinite\n\n";

return;

Page 30: TLINE - Marquette

30 PRINTOUT TLINE §24

24. Printout. Filename: print.cc

This is the code that prints the data to a sequence of files that can be used to develop computer videoclips.

#include <stdio.h>

#include <iostream>

#include "fd1d.h"

#include "std−def.h"

#include "cpp−fcns.h"

void printout (int n, int count )

int k;double xval ;char fileOut [NAME_SIZE];std ::fstream fout ;

sprintf (fileOut , "%d.out", count );OpenOutputFile (fileOut , fout );for (k = 0; k < kmax ; k++)

if (k < k1 ) xval = dx1 ∗ (double) k;if ((k ≥ k1 ) ∧ (k < k2 )) xval = dx1 ∗ (k1 − 1.) + (k − (k1 − 1.)) ∗ dx2 ;if (k ≥ k2 ) xval = dx1 ∗ (k1 − 1.) + dx2 ∗ (k2 − k1 ) + (k − (k2 − 1.)) ∗ dx3 ;fout ≪ xval ≪ " " ≪ V [0][k] ≪ " " ≪ I[0][k] ≪ "\n";if (V [0][k] > Vmax ) Vmax = V [0][k];if (V [0][k] < Vmin ) Vmin = V [0][k];if (I[0][k] > Imax ) Imax = I[0][k];if (I[0][k] < Imin ) Imin = I[0][k];

fout .close ( );

Page 31: TLINE - Marquette

§25 TLINE SCRIPTS 31

25. scripts. Filename: scripts.cc

This is the code that prints gnuplot files that can be used to animate the data from the simulation.

#include <stdio.h>

#include <iostream>

#include "cpp−fcns.h"

#include "fd1d.h"

#include "std−def.h"

void scripts (int count )

int k;char vfile [NAME_SIZE], ifile [NAME_SIZE], vfilg [NAME_SIZE], ifilg [NAME_SIZE];std ::fstream vfout , ifout , vfjpg , ifjpg ;

sprintf (vfile , "v.plt");OpenOutputFile (vfile , vfout );sprintf (ifile , "i.plt");OpenOutputFile (ifile , ifout );sprintf (vfilg , "v−jpg.plt");OpenOutputFile (vfilg , vfjpg );sprintf (ifilg , "i−jpg.plt");OpenOutputFile (ifilg , ifjpg );Vmax = Vmax ∗ 1.05;Vmin = Vmin ∗ 1.05;Imax = Imax ∗ 1.05;Imin = Imin ∗ 1.05;vfout ≪ "set yrange [" ≪ Vmin ≪ ":" ≪ Vmax ≪ "]\n";vfout ≪ "# set nokey\n";vfjpg ≪ "set yrange [" ≪ Vmin ≪ ":" ≪ Vmax ≪ "]\n";vfjpg ≪ "set term postscript eps monochrome \n";ifout ≪ "set yrange [" ≪ Imin ≪ ":" ≪ Imax ≪ "]\n";ifout ≪ "# set nokey\n";ifjpg ≪ "set yrange [" ≪ Imin ≪ ":" ≪ Imax ≪ "]\n";ifjpg ≪ "set term postscript eps monochrome \n";for (k = 11; k < count ; k++)

vfout ≪ "plot \"" ≪ k ≪ ".out\" using 1:2 with lines\n";vfout ≪ "pause 1\n";ifout ≪ "plot \"" ≪ k ≪ ".out\" using 1:3 with lines\n";ifout ≪ "pause 1\n";vfjpg ≪ "set output \"" ≪ k ≪ "v.eps\n";vfjpg ≪ "plot \"" ≪ k ≪ ".out\" using 1:2 with lines\n";ifjpg ≪ "set output \"" ≪ k ≪ "i.eps\n";ifjpg ≪ "plot \"" ≪ k ≪ ".out\" using 1:3 with lines\n";

vfout .close ( );ifout .close ( );

Page 32: TLINE - Marquette

32 REFERENCES TLINE §26

26. References.

[1] P. W. Tuinenga, Spice: A Guide to Circuit Simulation and Analysis Using PSpice. Englewood Cliffs,New Jersey: Prentice Hall, 3 ed., 1995.

[2] T. Quarles, A. R. Newton, D. O. Pederson, and A. Sangiovanni-Vincentelli, SPICE3 Version 3f3 User’s

Manual. University of California, Berkeley, CA, 1993.

[3] K. D. Granzow, Digital Transmission Lines: Computer Modelling and Analysis. New York, NY: OxfordUniversity Press, 1998.

[4] C. W. Trueman, “Animating transmission-line transients with bounce,” IEEE Trans. Educ., vol. 46,pp. 115–123, Feb. 2003.

[5] C. W. Trueman, “Interactive transmission line computer program for undergraduate teaching,” IEEE

Trans. Educ., vol. 43, pp. 1–14, Feb. 2000.

[6] D. B. Davidson, Computational Electromagnetics for RF and Microwave Engineering. New York, NY:Cambridge University Press, 2005.

[7] M. N. O. Sadiku, Numerical Techniques in Electromagnetics. New York, NY: CRC Press, second ed.,2000.

[8] A. Taflove, Computational Electrodynamics: The Finite-Difference Time-Domain Method. Boston,Massachusetts: Artech House, 1995.

[9] W. L. Stutzman and G. A. Thiele, Antenna Theory and Design. New York, NY: John Wiley Sons,second ed., 1998.

[10] B. Engquist and A. Majda, “Absorbing boundary conditions for the numerical simulation of waves,”Mathematics of Computation, vol. 31, pp. 629–651, 1977.

[11] G. Mur, “Absorbing boundary conditions for the finite-difference approximation of the time-domainelectromagnetic field equations,” IEEE Trans. Electromagn. Compat., vol. 23, pp. 377–382, 1981.

[12] J. E. Richie, “LCPP: A library for input and output operations,” Tech. Rep. 15, Marquette University,Electromagnetic Simulations Laboratory, Milwaukee, WI, Mar. 2004.

Page 33: TLINE - Marquette

§27 TLINE INDEX 33

27. Index.

atan : 18.c: 18, 20.cap : 20.cin : 16.CIN: 16.close : 17, 24, 25.COMPLEX: 16.complex : 16.count : 17, 24, 25.cout : 16.COUT: 16, 17, 18, 20, 23.dt : 15, 17, 20, 21.dx1 : 15, 17, 20, 21, 24.dx2 : 15, 17, 20, 24.dx3 : 15, 17, 20, 21, 24.e: 17, 23.eLrge : 20.Emax : 17.eps0 : 18.eta0 : 15, 17, 20, 21.exit : 20.exp : 21.f : 18.fabs : 17.fileOut : 17, 24.fmax : 20.fout : 17, 24.freq : 15, 17, 18, 21.fstream: 17, 24, 25.getinputd : 18.getinputi : 18.Hmax : 17.I: 15, 17.i: 17, 20, 23.ifile : 25.ifilg : 25.ifjpg : 25.ifout : 25.Imax : 15, 17, 24, 25.Imin : 15, 17, 24, 25.index : 23.induct : 20.inputs : 17, 18.iterate : 17, 21.k: 17, 20, 21, 23, 24, 25.kmax : 15, 17, 20, 21, 23, 24.k1 : 15, 17, 20, 23, 24.k2 : 15, 17, 20, 23, 24.lambda : 20.

lfact : 17, 20.l1 : 15, 17, 18, 20.l2 : 15, 17, 18, 20.l3 : 15, 17, 18, 20.M_PI: 20, 21.main : 17.max : 23.min : 23.mu0 : 18.n: 17, 20, 21, 24.NAME_SIZE: 17, 24, 25.Nd : 21.Nhold : 17.Nmax : 15, 17, 20.No : 21.Nreal : 20.OpenOutputFile : 17, 24, 25.OpenShortFlag : 15, 17, 18, 21.pi : 18, 20, 21.printout : 17, 24.re : 15, 17, 20, 21.rh : 15, 17, 20, 21.R1: 15, 17, 18, 20.R2: 15, 17, 18, 20.R3: 15, 17, 18, 20.scripts : 17, 25.setup : 17, 20.sin : 21.SourceFlag : 15, 17, 18, 21.sprintf : 17, 24, 25.std: 16, 17, 24, 25.tfact : 17, 20.tfSave : 17.time : 17.TimeFreqFlag : 15, 17, 18.tmp : 20.tstart : 15, 17, 18.tstop : 15, 17, 18.V : 15, 17.val : 23.vfile : 25.vfilg : 25.vfjpg : 25.vfout : 25.Vmax : 15, 17, 24, 25.Vmin : 15, 17, 24, 25.Vp1 : 15, 17, 18, 20, 21.Vp2 : 15, 17, 18, 20.Vp3 : 15, 17, 18, 20, 21.

Page 34: TLINE - Marquette

34 INDEX TLINE §27

vswr : 17, 23.v1 : 18.v2 : 18.v3 : 18.xval : 24.

Page 35: TLINE - Marquette

TLINE

Section PageTheory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2

Finite Difference Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2Stability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 4Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 4Iteration Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 6Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 7Boundary Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 8Post Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 10

Results and Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 11Open Circuit Load . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 11VSWR and Dispersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 12Quarter-Wave Transformers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 14

Code Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 16Makefile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 17Header file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 19Header file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 19Main . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 20

Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 23Solver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 24

setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 25iterate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 27

Post Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 28VSWR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 29Printout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 30scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 31

References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 32Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 33