help-gnucap
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

## [Help-gnucap] subcircuits & scaling

 From: Geordie McBain Subject: [Help-gnucap] subcircuits & scaling Date: Fri, 20 Jan 2012 19:34:02 +1100

```Hello.  I work with Paul, and I'm following up on the questions from
the recent thread `subcircuits and speed'.

To make things quantitative, I've taken a textbook example of a lossy
transmission line (C. A. Holt 1963 Introduction to Electromagnetic
Fields and Waves, New York: Wiley, p. 490):

%<---Holt (1963, p. 490)---
A 100-mile telephone line has a series resistance of 4 ohms/mile, an
inductance of 3 mh/mile, a leakage conductance of 1 umho/mile, and a
shunt capacitance of 0.015 uf/mile, at an angular frequency of omega =
5000.  At the sending end there is a generator supplying 100 volts
peak, at 5000 radians per second, in series with a resistance of 300
ohms.  The load at the receiving end consists of a 200-ohm resistor.
--->%

and implemented it in Gnucap either using a subcircuit (tlh.ckt)

%<---tlh.ckt---
TELEPHONE LINE (Holt 1963, p. 490)

.subckt SEGMENT inlet outlet
R inlet 1 0.1953125
L 1 outlet 0.000146484375
Y outlet 0 4.8828125e-08
C outlet 0 7.32421875e-10
.ends

Vg 0 1 ac 100
Rg 1 2 300
X1 2 4 SEGMENT
X2 4 6 SEGMENT
X3 6 8 SEGMENT
...
X2048 4096 4098 SEGMENT
Rr 4098 0 200

.print ac VM(2) VP(2) IM(Vg) Ip(Vg) VM(Rr) Vp(Rr) IM(Rr) Ip(Rr)
.ac 795.774715459 > tlh.dat
.status
--->%

or flat (tlf.ckt)

%<---tlf.ckt---
TELEPHONE LINE (Holt 1963, p. 490)

Vg 0 1 ac 100
Rg 1 2 300

R1 2 3 0.1953125
L1 3 4 0.000146484375
Y1 4  0  4.8828125e-08
C1 4  0  7.32421875e-10

R2 4 5 0.1953125
L2 5 6 0.000146484375
Y2 6  0  4.8828125e-08
C2 6  0  7.32421875e-10

R3 6 7 0.1953125
L3 7 8 0.000146484375
Y3 8  0  4.8828125e-08
C3 8  0  7.32421875e-10
...

R2048 4096 4097 0.1953125
L2048 4097 4098 0.000146484375
Y2048 4098  0  4.8828125e-08
C2048 4098  0  7.32421875e-10

Rr 4098 0 200

.print ac VM(2) VP(2) IM(Vg) Ip(Vg) VM(Rr) Vp(Rr) IM(Rr) Ip(Rr)
.ac 795.774715459 > tlf.dat
.status
--->%

These were generated by two Python scripts, which let me easily vary
the longitudinal discretization.  Of course both give identical
results for the voltage and current through the source and receiver,
and in good agreement with Holt's analytical answer based on the
telegrapher differential equation.

The overall timings when the 100-mile line is cut into N segments are like:

N  hierarchical/s flat/s

128    0.03             ---
256    0.19             ---
512    1.40             0.24
1024    9.14             0.73
2048  70.82             4.06
4096   ---                20.97
8192   ---                87.43

so it looks like cubic for subcircuits but quadratic for flat, which
corresponds with Paul's anecdotal observations.  The breakdowns of
this for N=2048 from the .status command are included in the *.out
files, attached.

We will look into the tip that `the best way to improve the run time
is to make plugins that implement the combinations you use as single
elements without internal nodes', though we've no idea how to do that
as yet.  Is it documented somewhere?  Although the above is a textbook
example, the components we're interested are pretty similar (although
we originally defined them with parameters as the resistance,
inductance, etc., varied while the form

Thanks very much for providing Gnucap under the GPL, and for
considering our query.

Geordie McBain
```

reply via email to

 [Prev in Thread] Current Thread [Next in Thread]