ngSpice error when modeling transistors

ngSpice error when modeling transistors

Anonymous
Not applicable
912 Views
6 Replies
Message 1 of 7

ngSpice error when modeling transistors

Anonymous
Not applicable

I don't use ngSpice much but I wanted to model a small circuit. It works fine(Operating Point and DC Analysis) when I use voltage sources and passive components, but as soon as I drop in a transistor I get an error. I mapped the NPN transistor(e.g. a 2N2369A) using the QNPN.mdl found in the Spice/Examples folder. When I do, I get a PPsyntax error and it doesn't give me a line in the netlist where the error occurred. I have several questions about how ngSpice handles these models:

1. Is the Spice/Examples folder the right place to obtain the model?

2. I copied the QNPN.mdl to my local folder(in Projects) before using it. If I map to it and don't rename the model locally it will overwrite the copy of QNPN. Then what happens if I want to add another NPN transistor of a different type?

3. If I do rename it to something like 2N2369A.mdl then the simulation cannot find it.

4. It wouldn't seem that a single QNPN.mdl could cover all different parameters of a variety of transistors(Small Signal, Power, RF, etc.).

 

I found lots online concerning ngSpice but nothing concerning it's implementation in Eagle. The Eagle manual only has a few examples with no explanation of errors and their solutions. It should be improved to describe the implementation in Autodesk Eagle.

 

I'm sure my problem is just due to my lack of familiarity with ngSpice in Eagle and I'd appreciate any hints.

0 Likes
913 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable

I also notice a line in the Eagle 9.6.2 manual that refers to an ngSpice manual but there is no such manual in the documentation directory.

0 Likes
Message 3 of 7

RichardHammerl
Community Manager
Community Manager

Hi @Anonymous 

 

the ngspice manual is in the EAGLE installation folder, e.g. c:\EAGLE-9.6.2\ngspice.  It's the ngspice-26-manual.pdf.

 

I hope this helps.

Richard Hammerl

Autodesk
0 Likes
Message 4 of 7

RichardHammerl
Community Manager
Community Manager

Hi @Anonymous 

 

 


1. Is the Spice/Examples folder the right place to obtain the model?


This is the default folder for all models coming with EAGLE. You can map to them, if it suits your purpose.

 

2. I copied the QNPN.mdl to my local folder(in Projects) before using it. If I map to it and don't rename the model locally it will overwrite the copy of QNPN. Then what happens if I want to add another NPN transistor of a different type?


Self-made models should go into this user folder. This okay. Use different names for your models. 

 

3. If I do rename it to something like 2N2369A.mdl then the simulation cannot find it.

It should be available for simulation. Did you correctly assign the the model?  

 


4. It wouldn't seem that a single QNPN.mdl could cover all different parameters of a variety of transistors(Small Signal, Power, RF, etc.).

 

You can have a model for each variant. 

 

Hope this helps.

 

Richard Hammerl

Autodesk
0 Likes
Message 5 of 7

Anonymous
Not applicable

But how do you tailor the basic model to have the correct parameters for a particular variant? KICAD provides a detailed step-by-step process of obtaining the manufacturer's data for a specific device in the form of a .lib file that is then added to the basic ngSpice model. Eagle 9.6.2 says nothing about that nor does it store any of these as far as I can tell. Therefore, I have no confidence in attempting to run an AC Sweep using these models.

Anyway, I solved my syntax errors. I was actually trying to avoid such errors by keeping net names simple and not trying to use the exclamation point "!" to form a "barred" active low net signal. So I used names such as pulse- or OE+ and this is what ngSpice was objecting to. It's irritating that ngSpice would not show me the line number in the netlist file where it found the errors. It would have saved a lot of time.

Also, it was imperative that the models were obtained from the library ngspice-simulation.lbr in the form of BJT_NPN and not the QNPN.mdl found in the folder SPICE MODELS\Examples.

0 Likes
Message 6 of 7

holger.vogt
Advocate
Advocate

Unfortunately ngspice provided with EAGLE 9.6.2 is fairly old (ngspice-26 from 2014). If you manage to upgrade ngspice (see http://ngspice.sourceforge.net/download.html#eagle ), ngspice-35 will acknowledge - and + in net names and also provide better error messages.

Message 7 of 7

Anonymous
Not applicable

Thanks very much for the update link.

0 Likes