# Spice, transient analysis, Gaussian excitation

M

#### Michael Zedler

Jan 1, 1970
0
Hello,

For a transient simulation I want to specify the input signal as, e.g.,
a modulated Gaussian pulse. How can I do that? I'm using MacSpice.

Background:
My aim is to simulate a lumped element circuit that models 'free space'
and then visualize wave propagation. So space is discretized into cubes,
each modelled e.g. by http://tinyurl.com/2nqy88 and then 100*100*100
cells create the simulation volume. I've created the respective netlist
using a script which works nicely.

So now I want to impress between two nodes an input signal that is a
modulated gaussian pulse and 'measure' the voltages across the circuit
in order to get the data for visualizing wave propagation.

Any pointers welcome!

Michael

T

#### Tom Bruhns

Jan 1, 1970
0
Hello,

For a transient simulation I want to specify the input signal as, e.g.,
a modulated Gaussian pulse. How can I do that? I'm using MacSpice.

Background:
My aim is to simulate a lumped element circuit that models 'free space'
and then visualize wave propagation. So space is discretized into cubes,
each modelled e.g. byhttp://tinyurl.com/2nqy88and then 100*100*100
cells create the simulation volume. I've created the respective netlist
using a script which works nicely.

So now I want to impress between two nodes an input signal that is a
modulated gaussian pulse and 'measure' the voltages across the circuit
in order to get the data for visualizing wave propagation.

Any pointers welcome!

Michael

(?? previous attempt at a reply didn't show up...sorry if this ends up
being a duplicate.)

I assume by "modulated gaussian pulse" you mean something of the form
A*sin(2*pi*f*t)*exp(-k*(t-t0)^2)). If that's the case, you can do it
in SPICE3-based simulators with the B nonlinear dependent source
component. Dunno if your MacSpice has that or not. It's easy to
generate a variable that's proportional to time: the current through
an inductor connected to a constant voltage source, or the voltage
across a capacitor connected to a constant current source. Start the
inductor current or capacitor voltage with zero initial condition.

Cheers,
Tom

M

#### Michael Zedler

Jan 1, 1970
0
Tom said:
I assume by "modulated gaussian pulse" you mean something of the form
A*sin(2*pi*f*t)*exp(-k*(t-t0)^2)). If that's the case, you can do it
in SPICE3-based simulators with the B nonlinear dependent source
component. Dunno if your MacSpice has that or not. It's easy to
generate a variable that's proportional to time: the current through
an inductor connected to a constant voltage source, or the voltage
across a capacitor connected to a constant current source. Start the
inductor current or capacitor voltage with zero initial condition.

Many thanks, MacSpice supports the 'B' source type. As I'm a complete
neophyte to text-based spice (used ADS/Spectre with a GUI before), is
the following input file ok?

--
nice little test

..control
tran .5ns 100ns
plot v(1) v(3)
..endc

Bin 1 0
V=sin(v(10)*2*3.141*.7e9)*exp(-v(10))*exp(-(v(10)-15e-9)*(v(10)-15e-9)*1e17)
l1 1 2 10n
l2 2 3 10n
c1 2 0 10p
r1 3 0 500

..ic v(10)=0
Itime 10 0 dc -1
Ctime 10 0 1
Rtime 10 0 1T
..end
--

Another question, for the real simulation which has some 24 million
nodes, I want to write the transient voltages of some 1 million nodes to
text files for then postprocessing them with perl/awk and then matlab.
What is the best way to write out the data, so that a node with name
'name' is written to 'name.transient'? '.print' and '.save' don't seem
to take an argument specifying where to write to ;-/

Best,
Michael

M

#### Michael Zedler

Jan 1, 1970
0
Michael said:
Another question, for the real simulation which has some 24 million
nodes, I want to write the transient voltages of some 1 million nodes to
text files for then postprocessing them with perl/awk and then matlab.
What is the best way to write out the data, so that a node with name
'name' is written to 'name.transient'? '.print' and '.save' don't seem
to take an argument specifying where to write to ;-/

found it, it's the 'write' command.

Michael

T

#### Tom Bruhns

Jan 1, 1970
0
Many thanks, MacSpice supports the 'B' source type. As I'm a complete
neophyte to text-based spice (used ADS/Spectre with a GUI before), is
the following input file ok?

--
nice little test

.control
tran .5ns 100ns
plot v(1) v(3)
.endc

Bin 1 0
V=sin(v(10)*2*3.141*.7e9)*exp(-v(10))*exp(-(v(10)-15e-9)*(v(10)-15e-9)*1e17)
l1 1 2 10n
l2 2 3 10n
c1 2 0 10p
r1 3 0 500

.ic v(10)=0
Itime 10 0 dc -1
Ctime 10 0 1
Rtime 10 0 1T
.end
--

Another question, for the real simulation which has some 24 million
nodes, I want to write the transient voltages of some 1 million nodes to
text files for then postprocessing them with perl/awk and then matlab.
What is the best way to write out the data, so that a node with name
'name' is written to 'name.transient'? '.print' and '.save' don't seem
to take an argument specifying where to write to ;-/

Best,
Michael

Yeah, that seems to work for me in LTSpice. I think you got it. As
you can see, the B component lets you do a really wide range of
stuff. LTSpice adds some other functions, too, that can be useful,
like random. And I see you found out how to write a file.

Cheers,
Tom

M

#### Michael Zedler

Jan 1, 1970
0
Tom said:
Yeah, that seems to work for me in LTSpice. I think you got it. As
you can see, the B component lets you do a really wide range of
stuff. LTSpice adds some other functions, too, that can be useful,
like random. And I see you found out how to write a file.

Hi Tom,

Thanks for your help. Moving from the trivial first test case slowly to
my real problem I encounter two problems:
1) singular matrix errors (that I hopefully correctly cured by
inserting 1TOhm resistors to ground)
2) an instability that leads to an aborting TRAN simulation. Well,
theory says that the circuit simulation must be stable as only passive
components are used... but, hey, we're in numerical approaches ;-) Any
idea what to do in this case?

Michael

--
One Dimensional wave propagation

..control
tran 1ns 100ns
* plot propagating wave
plot v(1)-v(2) v(3)-v(4) v(5)-v(6) v(7)-v(8) v(9)-v(10) v(11)-v(12)
..endc

..subckt zseries 1 3
l 1 2 4n
c 2 3 6.3325p
r 2 0 1T
..ends

..subckt yparallel 1 2
l 1 2 4n
c 1 2 6.3325p
..ends

..subckt acell 1 7 2 8
Xy1 13 17 yparallel
Xy2 14 17 yparallel
Xy3 15 17 yparallel
Xy4 16 17 yparallel

Xz1p 1 13 zseries
Xz1n 7 16 zseries
Xz5p 5 16 zseries
Xz5n 11 15 zseries
Xz4p 4 16 zseries
Xz4n 10 14 zseries
Xz2n 8 14 zseries
Xz2p 2 15 zseries
Xz6n 12 14 zseries
Xz6p 6 13 zseries
Xz3p 3 15 zseries
Xz3n 9 13 zseries

* short circuit for periodic continuation along two dimensions
r1 3 4 1f
r2 9 10 1f
r3 5 6 1f
r4 11 12 1f

* avoid singular matrices
ra 7 0 1T
rb 8 0 1T
rc 9 0 1T
rd 10 0 1T
re 11 0 1T
rf 12 0 1T
rf 17 0 1T
..ends

* helper stuff to get v(100000000) as the time variable
..ic v(100000000)=0
Itime 100000000 0 dc -1
Ctime 100000000 0 1
Rtime 100000000 0 1T

X1 1 2 3 4 acell
X2 3 4 5 6 acell
X3 5 6 7 8 acell
X4 7 8 9 10 acell
X5 9 10 11 12 acell

Bin 1 2
V=sin(v(100000000)*2*3.1416*1.5e9)*exp(-v(100000000))*exp(-(v(100000000)-15e-9)*(v(100000000)-15e-9)*3.1416*3.1416/2*1e16)
..end
--

K

#### Kevin Aylward

Jan 1, 1970
0
Michael said:
Hi Tom,

Thanks for your help. Moving from the trivial first test case slowly
to my real problem I encounter two problems:
1) singular matrix errors (that I hopefully correctly cured by
inserting 1TOhm resistors to ground)
2) an instability that leads to an aborting TRAN simulation. Well,
theory says that the circuit simulation must be stable as only passive
components are used... but, hey, we're in numerical approaches ;-) Any
idea what to do in this case?

Michael

--
One Dimensional wave propagation

.control
tran 1ns 100ns
* plot propagating wave
plot v(1)-v(2) v(3)-v(4) v(5)-v(6) v(7)-v(8) v(9)-v(10) v(11)-v(12)
.endc

.subckt zseries 1 3
l 1 2 4n
c 2 3 6.3325p
r 2 0 1T
.ends

.subckt yparallel 1 2
l 1 2 4n
c 1 2 6.3325p
.ends

.subckt acell 1 7 2 8
Xy1 13 17 yparallel
Xy2 14 17 yparallel
Xy3 15 17 yparallel
Xy4 16 17 yparallel

Xz1p 1 13 zseries
Xz1n 7 16 zseries
Xz5p 5 16 zseries
Xz5n 11 15 zseries
Xz4p 4 16 zseries
Xz4n 10 14 zseries
Xz2n 8 14 zseries
Xz2p 2 15 zseries
Xz6n 12 14 zseries
Xz6p 6 13 zseries
Xz3p 3 15 zseries
Xz3n 9 13 zseries

* short circuit for periodic continuation along two dimensions
r1 3 4 1f
r2 9 10 1f
r3 5 6 1f
r4 11 12 1f

Oh dear...
* avoid singular matrices

Avoids floating nodes, which have an undefined voltage.
ra 7 0 1T
rb 8 0 1T
rc 9 0 1T
rd 10 0 1T
re 11 0 1T
rf 12 0 1T
rf 17 0 1T
.ends

* helper stuff to get v(100000000) as the time variable
.ic v(100000000)=0
Itime 100000000 0 dc -1
Ctime 100000000 0 1
Rtime 100000000 0 1T

X1 1 2 3 4 acell
X2 3 4 5 6 acell
X3 5 6 7 8 acell
X4 7 8 9 10 acell
X5 9 10 11 12 acell

Bin 1 2
V=sin(v(100000000)*2*3.1416*1.5e9)*exp(-v(100000000))*exp(-(v(100000000)-15e-9)*(v(100000000)-15e-9)*3.1416*3.1416/2*1e16)
.end

Ahhmm.. Just off the cuff inspection, those 1 femto ohm resisters are going
to cause you big trouble indeed. Well on the way to creating a singular
matrix.

Spice wont handle the numerical precision of even 1 f ohm (1e-15) to 1 ohm,
let alone to 1 Tohm. You need to make sure that component values don't span
more than about 12-13 decimal digits in range.

C

#### [email protected]

Jan 1, 1970
0
Another question, for the real simulation which has some 24 million
nodes, I want to write the transient voltages of some 1 million nodes to
text files for then postprocessing them with perl/awk and then matlab.

The chance of MacSpice handling this problem, and producing useful
results is negligible. It is the wrong tool for this job.

Charles

J

#### joseph2k

Jan 1, 1970
0
Tom said:
(?? previous attempt at a reply didn't show up...sorry if this ends up
being a duplicate.)

I assume by "modulated gaussian pulse" you mean something of the form
A*sin(2*pi*f*t)*exp(-k*(t-t0)^2)). If that's the case, you can do it
in SPICE3-based simulators with the B nonlinear dependent source
component. Dunno if your MacSpice has that or not. It's easy to
generate a variable that's proportional to time: the current through
an inductor connected to a constant voltage source, or the voltage
across a capacitor connected to a constant current source. Start the
inductor current or capacitor voltage with zero initial condition.

Cheers,
Tom

Gosh, i was going to suggest a peice-wise-liner (PWL) approximation. It
could be written with a script, and you could study the value of the coarse
to fine adjustments of the script created waveform on the simulation
result.

M

#### Michael Zedler

Jan 1, 1970
0
The chance of MacSpice handling this problem, and producing useful
results is negligible. It is the wrong tool for this job.

Hm... Can you suggest a better approach? In case you mean that I'd have
to use some commercial Spice - no problem, I'd be able to let another
department run the job. Or do you mean that *in general* a transient
simulation with 24e6 nodes (but containing only passive elements) is
impossible?

I'll do intermediate size problems before the full 3D one, anyway. I'll
see when MacSpice chokes ;-)
1D propagation: 24e2 nodes
2D propagation: 24e4 nodes

Cheers,
Michael

K

#### Kevin Aylward

Jan 1, 1970
0
Michael said:
Hm... Can you suggest a better approach? In case you mean that I'd
have to use some commercial Spice - no problem, I'd be able to let
another department run the job. Or do you mean that *in general* a
transient simulation with 24e6 nodes (but containing only passive
elements) is impossible?

Not impossible, but expensive. Standard commercial spices just are not
designed for matrixes that large. Thee are fast out there that quote 1B
transistor handling, but they cost two arms and a leg.

C

#### [email protected]

Jan 1, 1970
0
Hm... Can you suggest a better approach?

Yes, use a piece of software designed for modelling e/m propagation in
free space, not one designed for modelling integrated circuits. Ansoft
is probably your best starting point.
In case you mean that I'd have
to use some commercial Spice - no problem, I'd be able to let another
department run the job. Or do you mean that *in general* a transient
simulation with 24e6 nodes (but containing only passive elements) is
impossible?

I would expect it to be impossible unless your Spice has a memory
address space of more than 32bits which, AFAIK, few do. If it does you
will find that it is extremely difficult to run the simulation because
the solution/integration method used by a traditional Spice doesn't
work well for inductances (they are not common elements in ic design)
I'll do intermediate size problems before the full 3D one, anyway. I'll
see when MacSpice chokes ;-)
1D propagation: 24e2 nodes
2D propagation: 24e4 nodes

Let us know how you get on.

Best of luck

Charles

Replies
2
Views
3K
Replies
1
Views
1K
Replies
0
Views
645
Replies
9
Views
1K
Replies
0
Views
4K