Maker Pro
Maker Pro

How to perform pole zero analysis with spice3f?

H

habib.bouaziz-viallet

Jan 1, 1970
0
Le Thu, 11 Jan 2007 20:18:10 +0100, Helmut Sennewald a écrit :
"habib.bouaziz-viallet" <[email protected]>
schrieb im Newsbeitrag


Hello Habib,

You reported in a previous reply the result of the PZ-analysis.
How have you achieved that?
I see an error message about PZ-analysis in your report above.
Yes you're right Helmut, there is an error when lauching ngspice in
batch-mode, but in interactive mode, PZ analysis work with print all
command, believe me. Just read documentation about PZ analysis within
ngspice (? .pz and ? .print).

See what i did with the (very simple) Hugo's circuit :


habib@aldebaran:~/GNU-TOOLS/ng-spice-rework-17/tests/polezero$ ngspice
.......

ngspice 425 -> source test.cir

Circuit: test

ngspice 426 -> pz 1 0 3 0 vol pz
Doing analysis at TEMP = 300.150000 and TNOM = 300.150000

No. of Data Rows : 1
ngspice 427 -> print all
pole(1) = -2.61803e+00,0.000000e+00
pole(2) = -3.81966e-01,0.000000e+00
zero(1) = -3.33333e-01,0.000000e+00
ngspice 428 ->

Best regards,
Helmut

Cheers, Habib
 
habib.bouaziz-viallet schreef:
Le Thu, 11 Jan 2007 20:18:10 +0100, Helmut Sennewald a écrit :

Yes you're right Helmut, there is an error when lauching ngspice in
batch-mode, but in interactive mode, PZ analysis work with print all
command, believe me. Just read documentation about PZ analysis within
ngspice (? .pz and ? .print).

See what i did with the (very simple) Hugo's circuit :


habib@aldebaran:~/GNU-TOOLS/ng-spice-rework-17/tests/polezero$ ngspice
......

ngspice 425 -> source test.cir

Circuit: test

ngspice 426 -> pz 1 0 3 0 vol pz
Doing analysis at TEMP = 300.150000 and TNOM = 300.150000

No. of Data Rows : 1
ngspice 427 -> print all
pole(1) = -2.61803e+00,0.000000e+00
pole(2) = -3.81966e-01,0.000000e+00
zero(1) = -3.33333e-01,0.000000e+00
ngspice 428 ->
I discovered a bug when running make after ./configure:
/home/coolens/rommel/ng-spice-rework-17/src/frontend/misccoms.c:241:
undefined reference to `history_file'
collect2: ld returned 1 exit status
make[3]: *** [ngspice] Error 1
make[3]: Leaving directory
`/home/coolens/rommel/ng-spice-rework-17/src'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory
`/home/coolens/rommel/ng-spice-rework-17/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory
`/home/coolens/rommel/ng-spice-rework-17'
make: *** [all] Error 2

There is a variable in src/frontend/misccoms.c, called history_file
which is not referenced

regards,

hugo
 
habib.bouaziz-viallet schreef:
Le Thu, 11 Jan 2007 20:18:10 +0100, Helmut Sennewald a écrit :

Yes you're right Helmut, there is an error when lauching ngspice in
batch-mode, but in interactive mode, PZ analysis work with print all
command, believe me. Just read documentation about PZ analysis within
ngspice (? .pz and ? .print).

See what i did with the (very simple) Hugo's circuit :
When testing software I always start with _very_ simple circuits, the
problems I'm facing with ngspice wouldn't disappear using a complex
circuit...I suppose
 
J

Jim Thompson

Jan 1, 1970
0
I'm curious about the usefulness of PZ analysis.

Doesn't a Bode plot (with phase) tell you what you need to know?

Once upon a time (33 years ago) I had a need to convert Bode to PZ, to
ease the quick making of active filters, but I see no need anymore.

...Jim Thompson
 
S

Stuart Brorson

Jan 1, 1970
0
: I discovered a bug when running make after ./configure:

: There is a variable in src/frontend/misccoms.c, called history_file
: which is not referenced

This is a bug. However, my question is: what configure options did
you use? If you configure with --with-readline?

Stuart
 
H

habib.bouaziz-viallet

Jan 1, 1970
0
Le Fri, 12 Jan 2007 07:54:06 -0700, Jim Thompson a écrit :
I'm curious about the usefulness of PZ analysis.

Doesn't a Bode plot (with phase) tell you what you need to know?

Once upon a time (33 years ago) I had a need to convert Bode to PZ, to
ease the quick making of active filters, but I see no need anymore.

...Jim Thompson

Hey Jim, the discussion was not about the usefullness of PZ, but the
ability of ngpice to perform that kind of calculation.

PS : a man who enjoy wines is not a really bad man.
 
J

Jim Thompson

Jan 1, 1970
0
Le Fri, 12 Jan 2007 07:54:06 -0700, Jim Thompson a écrit :


Hey Jim, the discussion was not about the usefullness of PZ, but the
ability of ngpice to perform that kind of calculation.

PS : a man who enjoy wines is not a really bad man.

Of course not. I'm really a teddy-bear, except for my Genghis Khan
tendencies ;-)

...Jim Thompson
 
Stuart Brorson schreef:
: I discovered a bug when running make after ./configure:

: There is a variable in src/frontend/misccoms.c, called history_file
: which is not referenced

This is a bug. However, my question is: what configure options did
you use? If you configure with --with-readline?

Stuart
../configure --with-readline=yes --enable-xspice

and to complete the picture: I use Debian Sarge and installed the
following packages already trying to make install ngspice correctly:
libxaw7-dev
libreadline5-dev
libreadline5-dbg

regards,
hugo
 
J

Joel Kolstad

Jan 1, 1970
0
Jim Thompson said:
I'm curious about the usefulness of PZ analysis.

Doesn't a Bode plot (with phase) tell you what you need to know?

Not in my experience with passive filter design. If you have a reasonably
high-order filter (e.g., 4+), a bode plot shows up that your filter isn't
behaving exactly as you want, but a pole-zero listing (or, better still, plot)
makes it much more obvious how you have to change component values to get the
filter response to be what you want it to be.

There's a filter design program out there -- NuHertz Filter, by Jeff Kahler,
who's actually right down there in Phoenix with you -- that dynamically
updatesa filter's response as you drag poles and zeroes around in the S plane;
it's quite handy at times.

---Joel
 
J

Jim Thompson

Jan 1, 1970
0
NuHertz Filter

What I want is to enter a pass-band, stop-band, ripple, etc., then
have the program spit out groups of Laplace expressions, each with
order no higher than 3 ;-)

...Jim Thompson
 
J

Joel Kolstad

Jan 1, 1970
0
Jim Thompson said:
What I want is to enter a pass-band, stop-band, ripple, etc., then
have the program spit out groups of Laplace expressions, each with
order no higher than 3 ;-)

It'll spit out the complete transfer function, and you can then use Matlab or
a freebie alternative to do the partial fraction decomposition into bi-quads
or similar.
 
[email protected] schreef:
I'm trying to perform pole zero analysis with spice3f.
This is the circuit file:
test
vin 1 0 dc 0 ac 1
r1 1 2 1
c1 2 0 1
r2 1 3 1
c2 3 2 1
.print ac v(3)
.pz 1 0 3 0 VOL PZ
.ac dec 20 10m 10k
.end

When I run Spice3F5 I always get the message:
Error: no data saved for pole-zero analysis; analysis not run
My conclusions so far concerning the current version of
ngspice:"ng-spice-rework-17"
1. There is a bug in the source concerning an unreferened variable
history_file in src/frontend/misccoms.c
2. The versions I got working do perform pz analysis only in
interactive mode
When trying to perform pz analysis in batch mode i.e. "ngspice
<inputfile.cir" ngspice refuses to perform pz analysis and complains as
follows:
Error: no data saved for pole-zero analysis; analysis not run

regards,
hugo
 
H

Helmut Sennewald

Jan 1, 1970
0
"habib.bouaziz-viallet" <[email protected]>
schrieb im Newsbeitrag
Le Thu, 11 Jan 2007 20:18:10 +0100, Helmut Sennewald a écrit :

Yes you're right Helmut, there is an error when lauching ngspice in
batch-mode, but in interactive mode, PZ analysis work with print all
command, believe me. Just read documentation about PZ analysis within
ngspice (? .pz and ? .print).

See what i did with the (very simple) Hugo's circuit :


habib@aldebaran:~/GNU-TOOLS/ng-spice-rework-17/tests/polezero$ ngspice
......

ngspice 425 -> source test.cir

Circuit: test

ngspice 426 -> pz 1 0 3 0 vol pz
Doing analysis at TEMP = 300.150000 and TNOM = 300.150000

No. of Data Rows : 1
ngspice 427 -> print all
pole(1) = -2.61803e+00,0.000000e+00
pole(2) = -3.81966e-01,0.000000e+00
zero(1) = -3.33333e-01,0.000000e+00
ngspice 428 ->



Cheers, Habib


Hello Habib,

I have now installed Suse-Linux 10.2, downloaded NGSPICE and compiled it.
The pz-analysis runs fine with your instructions.
I compared the result of the PZ-analysis with the original circuit response
in LTspice.
E1 A 0 1 0 Laplace=(s+3.33333e-1)/((s+2.61803)*(s+3.81966e-1))
The Laplace version with the values from the PZ-analysis match perfectly the
result
from the circuit with the resistors and capacitors. (The difference is only
a contant
factor of 3 in the absolute amplitude.)
I also tried a more difficult example with R1 replaced by an inductor with
1H.
The result from the pz-analysis also matched the result from the circuit.

Habib, again thanks for your outstanding help.

Best regards,
Helmut
 
Helmut Sennewald schreef:
"habib.bouaziz-viallet" <[email protected]>
schrieb im Newsbeitrag



Hello Habib,

I have now installed Suse-Linux 10.2, downloaded NGSPICE and compiled it.
The pz-analysis runs fine with your instructions.
can you try to run it in batch mode too? ngspice <input_file
I'm curious to see whether ngspice can perform pz analysis this way
too?
I compared the result of the PZ-analysis with the original circuit response
in LTspice.
E1 A 0 1 0 Laplace=(s+3.33333e-1)/((s+2.61803)*(s+3.81966e-1))
may I suggest to replace it by
E1 A 0 1 0 Laplace=(1+3*s)/(1+3*s+s*s)

regards,
hugo
 
H

Helmut Sennewald

Jan 1, 1970
0
...
Can you try to run it in batch mode too? ngspice <input_file
I'm curious to see whether ngspice can perform pz analysis this way
too?

Hello Hugo,

NGSPICE failed to run the PZ-analysis in batch mode.

ngspice <pz1.cir
"Error: no data saved for pole-zero analysis; analysis not run"

Btw, I have one error message more when I start NGSPICE, but this
doesn't matter because I have been only interested in the numbers
from the PZ-analysis. So I simply have ignored it.
"external error: no graphics interface; please check compiling instructions"

I normally use LTspice for my SPICE-work. NGSPICE comes
into play for PZ-analysis because LTspice doesn't have this feature.
Just for your info, I am the moderator of the Yahoo-group of LTspice.
may I suggest to replace it by
E1 A 0 1 0 Laplace=(1+3*s)/(1+3*s+s*s)
regards,
hugo

Thanks for this idea.

I don't have a real need for PZ-analysis until now, but I think it's a good
educational feature and it seems to work very well with NGSPICE.

Best regards,
Helmut

 
S

Stuart Brorson

Jan 1, 1970
0
: My conclusions so far concerning the current version of
: ngspice:"ng-spice-rework-17"

: 1. There is a bug in the source concerning an unreferened variable
: history_file in src/frontend/misccoms.c

: 2. The versions I got working do perform pz analysis only in
: interactive mode
: When trying to perform pz analysis in batch mode i.e. "ngspice
: <inputfile.cir" ngspice refuses to perform pz analysis and complains as
: follows:
: Error: no data saved for pole-zero analysis; analysis not run

These are interesting. Why don't you file a bug report to the NGSpice
bug tracker on SourceForge?

http://sourceforge.net/tracker/?group_id=38962&atid=423915

Stuart
 
H

habib.bouaziz-viallet

Jan 1, 1970
0
Le Sun, 14 Jan 2007 00:57:00 +0100, Helmut Sennewald a écrit :
"habib.bouaziz-viallet" <[email protected]>
schrieb im Newsbeitrag



Hello Habib,

I have now installed Suse-Linux 10.2, downloaded NGSPICE and compiled it.
The pz-analysis runs fine with your instructions.
I compared the result of the PZ-analysis with the original circuit response
in LTspice.
I have heard about LTSpice. Since you're running Linux, please point me
somewhere i can download/install LTSpice package. After gooooogling
LTSpice Linux, i have no precise informations about.
E1 A 0 1 0 Laplace=(s+3.33333e-1)/((s+2.61803)*(s+3.81966e-1)) The
Laplace version with the values from the PZ-analysis match perfectly the
result
from the circuit with the resistors and capacitors. (The difference is
only a contant
factor of 3 in the absolute amplitude.) I also tried a more difficult
example with R1 replaced by an inductor with 1H. The result from the
pz-analysis also matched the result from the circuit.

Habib, again thanks for your outstanding help.
Since i'm using ngspice for years, i'm please to help ng-spice users.
Best regards,
Helmut

Habib
 
Stuart Brorson schreef:
: My conclusions so far concerning the current version of
: ngspice:"ng-spice-rework-17"

: 1. There is a bug in the source concerning an unreferened variable
: history_file in src/frontend/misccoms.c

: 2. The versions I got working do perform pz analysis only in
: interactive mode
: When trying to perform pz analysis in batch mode i.e. "ngspice
: <inputfile.cir" ngspice refuses to perform pz analysis and complains as
: follows:
: Error: no data saved for pole-zero analysis; analysis not run

These are interesting. Why don't you file a bug report to the NGSpice
bug tracker on SourceForge?

http://sourceforge.net/tracker/?group_id=38962&atid=423915 OK, done that
Stuart
I still wonder whether the refusal to perform pz analysis in batch mode
is really a bug, maybe an extra command line should be added to the
inputfile to save the necessary data, but I don't have a clue which
command that could be. Maybe someone else knows?

regards,
hugo
 
I'm trying know to plot the pole zero diagram like this:
source inputfile
run
plot pole(1) pole(2) ylimit -1 1 xlimit -10 0

I hoped to see the poles displayed with a "x" and the zero with a "o"
Unfortunately that seems not the way to do it. I do get a grid with the
correctly scaled axis but I can't distinguish the poles and zeroes on
it. Is this possible with ngspice?

regards,
hugo
 
Top