pspice vs ngspice

Hello. I asked this question in an electronics mailing list that I am subscribed to, but I guess the moderator went on vacation or something. It was never sent out. So I will post my question here. It's a good forum anyway, since it deals with some sort of pspice issue (either an error on my part or an error in the software, I don't know which.)

So, here is the question:

Hey all! I am struggling my way through my introductory book. I have to spend 30 minutes on every one out of three problems figuring out where I went wrong :) But enough whining about it. I have a question about pspice for Windows (student version.)

On this one in particular, I was having trouble getting the right answer, so I poked it into Linux/ngspice, and got an answer different than me, and different than the book. So I poked it into pspice for Windows (student version) and got different answers still.

This is where I learned about current sources, arrows and +/- signs with regards to ngspice and pspice. After I fixed my circuit in ngspice, it gives me answers that correspond with the book.

I just worked the problem by hand again, and got answers that also correspond with the book.

Thus, my multi-question mail has now dropped to one or two questions:

1) Is pspice wrong? It must be, I think. But I'd like somebody to verify. 2) If so, did I do something wrong? Or is there an error in their simulation code?

Since it's a pain in the butt to post all of the details in an email, I have set up a web location to review:

formatting link

original_problem.jpg - The page with the original problem. It's problem 3.15 pspice.jpg - screen shot of the schematic, and the voltages/currents ngspice.jpg - screen shot of the schematic in ngspice

The ngspice output files

------------------------ ngspice_problem_3_15.cir ngspice_problem_3_15.out ngspice_problem_3_15.sch

Reply to
David Logan
Loading thread data ...

Thanks for the info! The reason why I gave ngspice a chance and not pspice is quite simple. ngspice said "um, I don't know what these values are. Type something intelligent in." pspice was happy to take what I entered. Thus, I assumed pspice knew how to handle them.

I'll keep that in mind for the future. Thanks!

David Logan

Helmut Sennewald wrote:

Reply to
David Logan

[snip]

PSpice treats "/" as additional or appended text, UNLESS written as {1/5}, then computation is done

...Jim Thompson

--
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC\'s and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
I love to cook with wine.      Sometimes I even put it in the food.
Reply to
Jim Thompson

"David Logan" schrieb im Newsbeitrag news:moKdnTZwCZL_Za snipped-for-privacy@comcast.com...

Hello David, you made an obvious mistake with the values of your resistors. A value has to be a number and not a mathematical expression. You tried with values like 1/3, 1/5 and 1/6. This can't work in SPICE. PSICE has treated all your resistors as 1 Ohm resistors. Why have you given NGSPICE a chance with with 0.333333, 0.2 and 0.166666? That's not fair. Give NGSPICE the same bad try with 1/3, 1/5 and 1/6. I assume you will get an error message.

Be aware that the sign of the reported current through resistors may depend on the orientation. Resistors have also a "polarity" in some SPICE programs.

No!

See my explanantion above.

Enter numbers like 0.333333, 0.2 and 0.166667 for the resistor values.

Thanks for the good explanation and the screenshots. They really helped to understand what you have tried to simulate.

You should try LTspice. It is similar in features to PSPICE, but it's totally free and unlimited regarding circuit size.

LTSPICE can be downloaded from here:

formatting link
SwitcherCAD = LTspice

The user group for LTspice:

formatting link

Best Regards, Helmut

------------ LTSPICE schematic -------------

Schematic for LTspice Copy the following text into a file named op_3_15.asc .

Version 4 SHEET 1 880 680 WIRE 80 96 80 -32 WIRE 80 160 80 96 WIRE 80 304 80 240 WIRE 144 96 80 96 WIRE 256 -32 80 -32 WIRE 288 96 224 96 WIRE 288 160 288 96 WIRE 288 304 80 304 WIRE 288 304 288 240 WIRE 288 336 288 304 WIRE 352 96 288 96 WIRE 496 -32 336 -32 WIRE 496 96 432 96 WIRE 496 96 496 -32 WIRE 496 160 496 96 WIRE 496 304 288 304 WIRE 496 304 496 240 FLAG 288 336 0 SYMBOL res 64 144 R0 SYMATTR InstName R1 SYMATTR Value 0.166666667 SYMBOL res 272 144 R0 SYMATTR InstName R2 SYMATTR Value 0.2 SYMBOL current 496 240 R180 WINDOW 0 -52 77 Left 0 WINDOW 3 -47 6 Left 0 SYMATTR InstName I1 SYMATTR Value 4 SYMBOL res 336 112 R270 WINDOW 0 32 56 VTop 0 WINDOW 3 0 56 VBottom 0 SYMATTR InstName R3 SYMATTR Value 0.3333333333 SYMBOL voltage 128 96 R270 WINDOW 0 32 56 VTop 0 WINDOW 3 -32 56 VBottom 0 SYMATTR InstName V1 SYMATTR Value 10 SYMBOL current 256 -32 R270 WINDOW 0 32 40 VTop 0 WINDOW 3 -32 40 VBottom 0 SYMATTR InstName I2 SYMATTR Value 2 TEXT 72 -112 Left 0 !.OP

Reply to
Helmut Sennewald

"Jim Thompson" schrieb im Newsbeitrag news: snipped-for-privacy@4ax.com...

Hello Jim, thanks for this tip. It works in LTspice as well. Expressions in curly braces {} are correctly evaluated in PSPICE and LTspice.

Best Regards, Helmut

Reply to
Helmut Sennewald

That's absolutely right. I'm running Linux, which is why I'm using geda (which doesn't work so well), gschem, gnetlist and ngspice.

I am also running pspice for windows, student version, because:

1) Primary reason--my book uses pspice, and shows me how to use electronic modelling software via pspice.

2) The linux software is seriously lacking in documentation, so I figure as I learn how to use pspice, I will simultaneously learn how to use the Linux tools.

3) To compare pspice and ngspice for accuracy, to make sure that I get the same results from both. Since the book will have pspice examples and answers, this is possible.

But my ultimate goal is be an electronics expert using Linux tools.

David Logan

Stuart Brors> Hi Helmut --

Reply to
David Logan

Hi Helmut --

Helmut Sennewald wrote: [ . . . . snip!. . . .] : You should try LTspice. It is similar in features to PSPICE, but it's : totally free and unlimited regarding circuit size.

: LTSPICE can be downloaded from here: :

formatting link
SwitcherCAD = LTspice

: The user group for LTspice: :

formatting link

I use and love LTSpice on my Windoze box at work, so I have no argument with your LTSpice advertisement. Howver, it does merit pointing out that ngspice is *also* totally free for download, and unlimited w.r.t. circuit size. Moreover, in contrast to LTSpice, ngspice is open-source, meaning that students can see the code, play with it, and modify it if they want.

Finally, the OP apparently is running gEDA on Linux (look at his screen shots), and generating SPICE netlists with it for ngspice. That may explain why he is running ngspice, since it is Linux native. Yes, LTSpice does run on Linux under wine, but it's not a Linux native program.

It's great to see the gEDA stuff being used by students!

Stuart

Reply to
Stuart Brorson

Thanks for all of that. I will review the links you gave. In all fairness, I suspect part of the problem I consider the documentation insufficient is because I don't yet know how to use electronics modelling software in general yet, and Linux software package documentation is usually lacking, especially for complicated software.

I have a question with before I give my replies. The question is: When you say you are interested in hearing about gEDA, does that mean just gEDA, or does also mean gschem, gnetlist and ngspice?

gEDA itself is crashing on me when I try to do certain things, so I quit using gEDA, and was just using the individual tools. If you are interested in specifics (regardless of the answer to the above question), show me the forum to post the bugs and the forum to post the whines, and I will be happy to do so.

By the way, I have been a professional programmer for about 15 years, just so you know a bit of my background.

David Logan

Stuart Brors> : That's absolutely right. I'm running Linux, which is why I'm using geda

Reply to
David Logan

David Logan wrote: : That's absolutely right. I'm running Linux, which is why I'm using geda : (which doesn't work so well), gschem, gnetlist and ngspice.

It's good to see that you are using gEDA, bad to hear that it's not working so well.

Since I'm one of the folks working on it, perhaps you could help us out a little bit. When you say "[it] doesn't work so well", please list two or three specific things which you think don't work well. Specific bug reports provide us with things to work on; therefore I'd be interested in hearing about the top two or three complaints you have about gEDA.

[. . . . snip . . . .]

: 2) The linux software is seriously lacking in documentation, so I figure : as I learn how to use pspice, I will simultaneously learn how to use the : Linux tools.

There is some truth to this, but have you looked in your ${GEDA_INSTALL_DIR}/share/doc/geda-doc directory? There's lots of stuff there. Also, for gEDA/SPICE specific info you can look here:

formatting link

For ngspice commands, many people use this reference:

formatting link

Finally, posting questions on the geda-user mailing list is a good way to get help if you have problems with the software. The mailing lists are here:

formatting link

: But my ultimate goal is be an electronics expert using Linux tools.

Welcome abord!

Stuart

Reply to
Stuart Brorson

David Logan wrote: : Thanks for all of that. I will review the links you gave. In all : fairness, I suspect part of the problem I consider the documentation : insufficient is because I don't yet know how to use electronics : modelling software in general yet, and Linux software package : documentation is usually lacking, especially for complicated software.

: I have a question with before I give my replies. The question is: When : you say you are interested in hearing about gEDA, does that mean just : gEDA, or does also mean gschem, gnetlist and ngspice?

Aaah, I see part of the problem already.

gEDA = The gEDA project. This includes gschem, gnetlist, ngspice, and so on.

geda = The gEDA project's project manager. An unfortunate choice for it's name, but we're saddled with it now. A better name might have been "gmanager" or something like that. Oh well.

: gEDA itself is crashing on me when I try to do certain things, so I quit : using gEDA, and was just using the individual tools.

You mean the project manager "geda" crashed on you, right? I don't use the project manager at all & instead use the individual tools. Geda (the project manager) is old, and hasn't been updated recently. It might have some bugs.

The core tools "gschem", "gnetlist", and "gattrib" are under constant developement, as are several of the other smaller utilities. They tend to be bug-free, and very functional (except for gattrib, which awaits some features related to net and pin attributes).

: If you are : interested in specifics (regardless of the answer to the above : question), show me the forum to post the bugs and the forum to post the : whines, and I will be happy to do so.

Mailing lists:

formatting link

Bug reports:

formatting link

(click through to "jitterbug")

: By the way, I have been a professional programmer for about 15 years, : just so you know a bit of my background.

Cool! Any interest in hacking gEDA?

Stuart

Reply to
Stuart Brorson

Yes, the project manager crashed. It is unfortunate that a cohesive environment doesn't exist like in pspice. One written with Qt would probably be good.

I always have an interest. It's the time I don't have :)

David Logan

Reply to
David Logan

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.