Maker Pro
Maker Pro

SPICE AC analysis -- multiplying or dividing signals

J

Joel Kolstad

Jan 1, 1970
0
Does anyone know how, in SPICE (LTSpice, SIMetrix, etc.), one goes about
multiplying or dividing two voltages in an AC analysis?

I have an arbitrary voltage generator device ("B"), but for non-linear
equations such as V(node1)*V(node2), there's some linearization that occurs
and I usually just get 0v output as a result rather than a multiplication.

After simulation I have no problem *graphing* something like
V(node1)*V(node2), but what I wanted was to create a new node that presented
that signal...

Thanks,
---Joel Kolstad
 
J

Jim Thompson

Jan 1, 1970
0
Does anyone know how, in SPICE (LTSpice, SIMetrix, etc.), one goes about
multiplying or dividing two voltages in an AC analysis?

I have an arbitrary voltage generator device ("B"), but for non-linear
equations such as V(node1)*V(node2), there's some linearization that occurs
and I usually just get 0v output as a result rather than a multiplication.

After simulation I have no problem *graphing* something like
V(node1)*V(node2), but what I wanted was to create a new node that presented
that signal...

Thanks,
---Joel Kolstad

Better explanation ?:)

...Jim Thompson
 
H

Helmut Sennewald

Jan 1, 1970
0
Joel Kolstad said:
Does anyone know how, in SPICE (LTSpice, SIMetrix, etc.), one goes about
multiplying or dividing two voltages in an AC analysis?

Hello Joel,

It's impossible to multiply or divide two AC-signals in a useful way for
..AC-analysis.
Multiplying two AC-signals would result in doubling the frequency.
This is not the concept of the AC-analysis in SPICE. AC-analysis is a pure
linear analysis by definition.

Best regards,
Helmut
 
J

Jim Thompson

Jan 1, 1970
0
Hello Joel,

It's impossible to multiply or divide two AC-signals in a useful way for
.AC-analysis.
Nonsense.

Multiplying two AC-signals would result in doubling the frequency.

Nonsense again. .AC analysis produces magnitude and phase numbers,
NOT sinusoids.
This is not the concept of the AC-analysis in SPICE. AC-analysis is a pure
linear analysis by definition.

Yes, it is linear, but you can do mathematical analysis (at least in
PSpice Probe) on the results.

(It can get tricky, shifting results by so many dB's for example, but
it can be done.)
Best regards,
Helmut


...Jim Thompson
 
J

Joel Kolstad

Jan 1, 1970
0
Hi Helmut,

Helmut Sennewald said:
It's impossible to multiply or divide two AC-signals in a useful way for
.AC-analysis.
Multiplying two AC-signals would result in doubling the frequency.
This is not the concept of the AC-analysis in SPICE. AC-analysis is a pure
linear analysis by definition.

Hmm... I think I see what you mean. However, I don't want to perform
"instantaneous" mixing, as you suggest, I just want to multiple two phasors
(complex numbers) together at each frequency point to get a new one. I'm
thinking there's no way to set up the matrix in AC analysis to try to solve
for V(node1)*V(node2), yet of course once V(node1) and V(node2) are known it's
trivial to calculate V(node1)*V(node2) using the post processor. I guess I'll
settle for that.

I suppose this is why the traditional "voltage controlled voltage source" can
only multiple by a constant...

---Joel
 
J

Joel Kolstad

Jan 1, 1970
0
Hi Jim,

Jim Thompson said:
Yes, it is linear, but you can do mathematical analysis (at least in
PSpice Probe) on the results.

The approach you're taking is what I want to do, I just wanted to create a
voltage source repsenting that result. The idea was to be able to drop a
"Probe - dB", "Probe - magnitude", etc. sort of part on that voltage source.

---Joel
 
J

Jim Thompson

Jan 1, 1970
0
Hi Jim,



The approach you're taking is what I want to do, I just wanted to create a
voltage source repsenting that result. The idea was to be able to drop a
"Probe - dB", "Probe - magnitude", etc. sort of part on that voltage source.

---Joel

What simulator are you using? I have a macro for PSpice Probe for
shifting results, but I suspect it only works in PSpice.

...Jim Thompson
 
J

Jim Thompson

Jan 1, 1970
0
Hi Helmut,



Hmm... I think I see what you mean. However, I don't want to perform
"instantaneous" mixing, as you suggest, I just want to multiple two phasors
(complex numbers) together at each frequency point to get a new one. I'm
thinking there's no way to set up the matrix in AC analysis to try to solve
for V(node1)*V(node2), yet of course once V(node1) and V(node2) are known it's
trivial to calculate V(node1)*V(node2) using the post processor. I guess I'll
settle for that.

I suppose this is why the traditional "voltage controlled voltage source" can
only multiple by a constant...

---Joel

Multiplying two complex numbers together can be done with PSpice
_behavioral_ controlled sources, NOT your plain vanilla E-source.

...Jim Thompson
 
J

Joel Kolstad

Jan 1, 1970
0
Hi Jim,

Jim Thompson said:
What simulator are you using?

SIMetrix. We do have a copy of PSpice around, but I prefer the SIMetrix
interface (since with PSpice for the schematic part we're using Capture -- I
imagine you'd suggest that's part of the problem :) ).

---Joel
 
H

Helmut Sennewald

Jan 1, 1970
0
Joel Kolstad said:
Hi Helmut,



Hmm... I think I see what you mean. However, I don't want to perform
"instantaneous" mixing, as you suggest, I just want to multiple two
phasors (complex numbers) together at each frequency point to get a new
one.

Hello Joel,

I exactly know what you wnat to do. Believe me, your idea is not possible
with the concept of the .AC-analysis in SPICE.
You can do what you need in the waveform viewer of LTspice of course.

Best regards,
Helmut
 
J

Jim Thompson

Jan 1, 1970
0
Hi Jim,



SIMetrix. We do have a copy of PSpice around, but I prefer the SIMetrix
interface (since with PSpice for the schematic part we're using Capture -- I
imagine you'd suggest that's part of the problem :) ).

---Joel

Yep ;-)

But I believe PSpice macros may work with (or be adaptable to)
SIMetrix.

Macro:

VdBnorm(A,B)=VdB(A)*PWR(10,(B/20))

...Jim Thompson
 
J

Jim Thompson

Jan 1, 1970
0
Hello Joel,

I exactly know what you wnat to do. Believe me, your idea is not possible
with the concept of the .AC-analysis in SPICE.
You can do what you need in the waveform viewer of LTspice of course.

Best regards,
Helmut

You can certainly do phasor multiplication with behavioral sources in
PSpice.

...Jim Thompson
 
H

Helmut Sennewald

Jan 1, 1970
0
Jim Thompson said:
You can certainly do phasor multiplication with behavioral sources in
PSpice.

...Jim Thompson


Hello Jim,

please show me a SPICE netlist which can do that.
We don't talk about PROBE.

Best regards,
Helmut
 
J

Jim Thompson

Jan 1, 1970
0
Newsbeitrag news:p[email protected]... [snip]
You can certainly do phasor multiplication with behavioral sources in
PSpice.

...Jim Thompson


Hello Jim,

please show me a SPICE netlist which can do that.
We don't talk about PROBE.

Best regards,
Helmut

Ebeh nodeP nodeN VALUE {expression to suit your fancy}

and given that

R(V(A)) = real part of V(A)

IMG(V(A)) = imaginary part of V(A)

what are you having a problem with?

...Jim Thompson
 
H

Helmut Sennewald

Jan 1, 1970
0
Jim Thompson said:
Newsbeitrag news:p[email protected]... [snip]
You can certainly do phasor multiplication with behavioral sources in
PSpice.

...Jim Thompson


Hello Jim,

please show me a SPICE netlist which can do that.
We don't talk about PROBE.

Best regards,
Helmut

Ebeh nodeP nodeN VALUE {expression to suit your fancy}

and given that

R(V(A)) = real part of V(A)

IMG(V(A)) = imaginary part of V(A)

what are you having a problem with?

...Jim Thompson

Hello Jim,

I still don't understand how your expression could look in the example above
to perform a multiplication of two node voltages each having AC voltages in
the
..AC-simulation.
In LTspice you can't write anything like IM(V(A)) in an expression of a
B-source.

Best regards,
Helmut
 
J

Jim Thompson

Jan 1, 1970
0
Jim Thompson said:
Newsbeitrag news:p[email protected]... [snip]

You can certainly do phasor multiplication with behavioral sources in
PSpice.

...Jim Thompson


Hello Jim,

please show me a SPICE netlist which can do that.
We don't talk about PROBE.

Best regards,
Helmut

Ebeh nodeP nodeN VALUE {expression to suit your fancy}

and given that

R(V(A)) = real part of V(A)

IMG(V(A)) = imaginary part of V(A)

what are you having a problem with?

...Jim Thompson

Hello Jim,

I still don't understand how your expression could look in the example above
to perform a multiplication of two node voltages each having AC voltages in
the
.AC-simulation.
In LTspice you can't write anything like IM(V(A)) in an expression of a
B-source.

Best regards,
Helmut

It seems to work here in PSpice, but it's "IMG", not "IM"

I haven't tried it, but the multiplication may require multiple steps
to accomplish.

(1) Separate out the real and imaginary parts
(2) Do the appropriate multiplications
(3) Sum appropriate parts to get the resultant real and imaginary
terms

...Jim Thompson
 
J

Joel Kolstad

Jan 1, 1970
0
Hi Jim,

Jim Thompson said:
I haven't tried it, but the multiplication may require multiple steps
to accomplish.

With my original problem -- getting S parameters out of SPICE -- I ended up
having to use an AC source to accomplish subtraction. Something like

B1 n+ n- V=2/5*node-1

....didn't work, whereas just "V=2/5*node" did... hence the solution mentioned.

I'm a pretty happy campy... I can now drop down "port" parts that have
terminals on them, one providing S11, the other providing S21... I then drop
one something like a dB probe marker, and I'm set.

Thanks for the suggestions,
---Joel
(Happily abusing SPICE by trying to make it into a linear RF simulator...)
 
J

Jim Thompson

Jan 1, 1970
0
Hi Jim,



With my original problem -- getting S parameters out of SPICE -- I ended up
having to use an AC source to accomplish subtraction. Something like

B1 n+ n- V=2/5*node-1

...didn't work, whereas just "V=2/5*node" did... hence the solution mentioned.

I'm a pretty happy campy... I can now drop down "port" parts that have
terminals on them, one providing S11, the other providing S21... I then drop
one something like a dB probe marker, and I'm set.

Thanks for the suggestions,
---Joel
(Happily abusing SPICE by trying to make it into a linear RF simulator...)

Surf around, particularly on the PSpice sites. I vaguely recall a
cute way to get S-parameters.

I may have already downloaded a copy. I'll look.

...Jim Thompson
 
M

Mike Engelhardt

Jan 1, 1970
0
Jim,

I think you're missing Helmut's point. In the simulation,
the behavior source's are linearized just like any other
non-linear devices like diodes and transistors. Yes, you
can multiply a signal path and see the gain of the complex
signal through the path. But that's as close as you can
get to "You can certainly do phasor multiplication with
behavioral sources in PSpice." That is, you can do
the complex multiplication with behavioral sources but
only if one of the products is *real*. I.e., your statement
is incorrect. Division is only possible if the divisor is
real. Helmut is just trying to help because this is a point
that I think just about every gets confused about in SPICE
..ac analysis along the learning curve, but it seems impossible
to explain to someone -- or at least just not worth it.
It's one of those things that people seem to have to figure
out for themselves.

To the OP, one industry-standard way to get S-parameters out
of a SPICE simulation is with hspice's .net statement. It
will compute S-, H-, Z-, and Y- matrices of a two-port
linear network. A super-set of this command is availible
in LTspice if you don't have a copy of hspice. The pertaine
example case is installed by default as
C:\Program Files\LTC\SwCADIII\examples\Educational\S-param.asc

Regards,

--Mike

Jim Thompson said:
Newsbeitrag news:p[email protected]... [snip]
You can certainly do phasor multiplication with behavioral sources in
PSpice.

...Jim Thompson


Hello Jim,

please show me a SPICE netlist which can do that.
We don't talk about PROBE.

Best regards,
Helmut

Ebeh nodeP nodeN VALUE {expression to suit your fancy}

and given that

R(V(A)) = real part of V(A)

IMG(V(A)) = imaginary part of V(A)

what are you having a problem with?

...Jim Thompson
 
Top