Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

LTspice queries

Status
Not open for further replies.

alec_t

Well-Known Member
Most Helpful Member
1) If I draw a schematic where the only transistor type is a default NPN bjt, the auto-generated netlist includes the lines
.model NPN NPN
.model PNP PNP
Why does LTS feel the need to add the apparently spurious reference to PNP?

2) I have a model defined in a .sub file. A transient analysis in a sim using the model converges providing I use the global directive '.options gmin=1e-8'. I would like to add this gmin limitation to the model file itself, rather than have to apply it globally, but the .options directive is ignored if within the file. Is there a workaround?
 
1) If I draw a schematic where the only transistor type is a default NPN bjt, the auto-generated netlist includes the lines
.model NPN NPN
.model PNP PNP
Why does LTS feel the need to add the apparently spurious reference to PNP?

These are not spurious references.

The .model syntax is:

.model <modelname> <type> (params)

"modelname" can be any name you assign to the component but must be unique, and it is assigned to the "value" attribute of the symbol. It is used to "lookup" the model definition.
"type" is the name of the spice defined component type, such as NPN, PNP, SW or any of the supported component types.

For the example you've shown, the first NPN is the modelname, the second NPN is the model type and is the default definition for an NPN transistor. So any transistor with a "modelname"
of "NPN will be associated with the NPN model definition.

2) I have a model defined in a .sub file. A transient analysis in a sim using the model converges providing I use the global directive '.options gmin=1e-8'. I would like to add this gmin limitation to the model file itself, rather than have to apply it globally, but the .options directive is ignored if within the file. Is there a workaround?

The option statement is a transient analysis directive, so it can only be placed outside of the .subckt definition.
 
These are not spurious references.
Thanks. I fully understand the NPN reference, but that wasn't what I was asking about. Why the PNP reference when the circuit contains no PNP device?
The option statement is a transient analysis directive, so it can only be placed outside of the .subckt definition.
That was what I found. Is there a workaround to enable gmin to be set within the definition, i.e to make gmin a local parameter rather than global?
 
Last edited:
Thanks. I fully understand the NPN reference, but that wasn't what I was asking about. Why the PNP reference when the circuit contains no PNP device?

I tried duplicating that behavior on my system but it doesn't place "spurious" references.
Are you using the latest version?

That was what I found. Is there a workaround to enable gmin to be set within the definition, i.e to make gmin a local parameter rather than global?

It can't be placed in a subcircuit definition, its a simulation directive.
You can place it outside the subcircuit def with other sim options...

Example:

.subckt opamp 1 2 3
....
....
.ends opamp
*
.options gmin=1e-10
.end

But I don't recommend it...
eT
 
I tried duplicating that behavior on my system but it doesn't place "spurious" references. Are you using the latest version?
Strange. Yes, latest version.
Here's a simple .asc. If you run it and go to View/Netlist you will see that a non-existent PNP gets referenced.
 

Attachments

  • Draft13.asc
    741 bytes · Views: 252
Strange. Yes, latest version.
Here's a simple .asc. If you run it and go to View/Netlist you will see that a non-existent PNP gets referenced.

Ok...I must have missed it when I tried the first time....but it seems to be adding it now.

All I did was open a new schematic, added an NPN, then viewed the netlist. Both models showed up.

And it doesn't matter if you add an NPN or PNP, it adds both models. o_O

Very odd...:confused:

eT
 
Ok...I found out what causes this to happen

Goto:
Control Panel->Netlist Options->Semiconductor Models

Default Devices[*] <---uncheck this, it will keep it from adding the default models
but if you add a transistor with a model name of NPN or PNP
it will produce error. So you either have to "Pick New Transistor"
from the menu, define an "NPN" or "PNP" .model on the
on the schematic, or use a .subcircuit file.

Default Libraries[*] <---leave this checked so it can use the existing libraries

eT
 
Thanks for the info.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top