¿ªÔÆÌåÓý

New Feature Released & Opamp Modeling


 

I put up a version of LTspice today with a
new feature. There's a new symbol attribute
called ModelFile. This lets you specify a
file to include as a library file whenever
this symbol is included. However, the symbol
is still edit-able. This let's you enter
parameters to pass to the subcircuit.

There's two example symbols of the use of
these feature included, 1pole.asy and
2pole.asy in the opamp directory. These
are somewhat ideal opamps with allow the
following parameters to be entered to
model a specific opamp:

Avol open loop DC gain.
GBW open loop gain-bandwidth product
Slew slew rate
Ilimit output current limit
rail how close output can get to the rail
Vos input offset voltage
en equiv. input voltage noise
enk equiv. input voltage noise corner freq
in equiv. input current noise
ink equiv. input current noise corner freq

The model draws all current from the voltage
supplies and has a signal internal node.
Output stage emitter followers are set to 100
Ohms, but you can change that if you need a
more ideal opamp.

The 2pole version has two internal nodes and
an additional parameter, phimargin, which
specifies the 2nd pole in terms of the (approx
-imate) phase margin in degrees.

Input bias, input common mode range and PSRR
are not modeled.

Let me know if you find these things useful.

--Mike

__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!


Jonathan Kirwan
 

On Mon, 24 Mar 2003 14:59:23 -0800 (PST), you wrote:

I put up a version of LTspice today with a
new feature. There's a new symbol attribute
called ModelFile. This lets you specify a
file to include as a library file whenever
this symbol is included. However, the symbol
is still edit-able. This let's you enter
parameters to pass to the subcircuit.
<snip>
Let me know if you find these things useful.
Yes! I'll be using it immediately. Thanks!

Jon


Jonathan Kirwan
 

On Mon, 24 Mar 2003 15:43:54 -0800, you wrote:

On Mon, 24 Mar 2003 14:59:23 -0800 (PST), you wrote:

I put up a version of LTspice today with a
new feature. There's a new symbol attribute
called ModelFile. This lets you specify a
file to include as a library file whenever
this symbol is included. However, the symbol
is still edit-able. This let's you enter
parameters to pass to the subcircuit.
<snip>
Let me know if you find these things useful.
Yes! I'll be using it immediately. Thanks!

Jon
Okay, tried it and like it.

Originally, when I started using LT Spice, I wanted to add a new
symbol for the PUJT type of device. You gave me an example of
this which went a very long way in teaching me about using spice
(I was, and still largely am a neophyte in nearly every sense of
that.) This new feature you've added allowed me to create a
PUJT.LIB file and link it to the symbol (.asy) which you made
for me back in January. Now LT Spice naturally finds the model
without me having to specifically write a .include for it.
Thanks.

In the above case, it would be nice if LT Spice would put a
"Select Subcircuit" button on the dialog box which comes up when
I right-click on the symbol (if the .ASY symbol is an X type)
and provide me a list of .SUBCKT entries it found in the
specified library file. In that case, the PUJT.LIB case, this
means it would pop up 2N6027 and 2N6028, for example, and offer
those as options.

I haven't used spice enough to apprehend the implications of
doing that, but it's a suggestion which pops into my mind given
my limited use, to date.

Anyway, thanks much!

Jon


Reinier Gerritsen
 

-----Original Message-----
From: Panama Mike [mailto:panamatex@...]
Sent: 24 maart, 2003 23:59
To: LTspice@...
Subject: Re: [LTspice] New Feature Released & Opamp Modeling


I put up a version of LTspice today with a
new feature. There's a new symbol attribute
called ModelFile. This lets you specify a
file to include as a library file whenever
this symbol is included. However, the symbol
is still edit-able. This let's you enter
parameters to pass to the subcircuit.

There's two example symbols of the use of
these feature included, 1pole.asy and
2pole.asy in the opamp directory. These
are somewhat ideal opamps with allow the
following parameters to be entered to
model a specific opamp:

Avol open loop DC gain.
GBW open loop gain-bandwidth product
Slew slew rate
Ilimit output current limit
rail how close output can get to the rail
Vos input offset voltage
en equiv. input voltage noise
enk equiv. input voltage noise corner freq
in equiv. input current noise
ink equiv. input current noise corner freq

The model draws all current from the voltage
supplies and has a signal internal node.
Output stage emitter followers are set to 100
Ohms, but you can change that if you need a
more ideal opamp.

The 2pole version has two internal nodes and
an additional parameter, phimargin, which
specifies the 2nd pole in terms of the (approx
-imate) phase margin in degrees.

Input bias, input common mode range and PSRR
are not modeled.

Let me know if you find these things useful.

--Mike

Thanks Mike,

The opamp model is just what I needed.

In the unlikely event that you have nothing to do, please think about a few
thinks:

- display of node numbers in the schematic: no need to remember or label if
you want to make an expression using node voltages.
- a quick way to probe voltages across components. Perhaps alt + left mouse
button?
- a way to store multiple analysis commands. If I use .tran and .ac
commands, only the parameters of the last one is saved, the other gets lost
on exit of the program.

Thanks for you great software and support.

Reinier Gerritsen
The Netherlands


cadencespectre
 

--- In LTspice@..., "Reinier Gerritsen" <r.gerritsen@c...>
wrote:

SNIP

- a way to store multiple analysis commands. If I use .tran and .ac
commands, only the parameters of the last one is saved, the other
gets lost
on exit of the program.

Thanks for you great software and support.

Reinier Gerritsen
The Netherlands
Hoi Reinier,

It is possible to save multiple analysis commands. First place a
simulation command on the sheet. When you add a second simulation
command with Simulate -> Edit Simulation Command (or right mouse
button -> Edit Simulation Command), and place the command on the
sheet, you'll see the "." in the first comman will change to ";".
E.g. you'll get:

.tran 10n
;ac dec 51 100 10G
;dc temp -40 125 2

If you save this schematic, and reopen it, you can choose using
Simulate -> Edit Simulation Command (or right mouse button -> Edit
Simulation Command).
It only works for different analysis types. I.e. you can't choose
between e.g. multiple .tran commands (however you can uncomment them).
Of course you can place these lines on the schematic manually.

Regards,

Ronnie (Also from the Netherlands :-) )


 

Jon,

In the above case, it would be nice if LT Spice
would put a "Select Subcircuit" button on the
dialog box which comes up when I right-click on
the symbol (if the .ASY symbol is an X type)
and provide me a list of .SUBCKT entries it
found in the specified library file. In that
case, the PUJT.LIB case, this means it would pop
up 2N6027 and 2N6028, for example, and offer
those as options.
Yes, this is something that's been needed for a
long time. So I implemented it today. To use
it make a symbol with prefix 'X'. Make ModelFile
point to a library contianing subcircuits. Give
the symbol a SpiceModel that coincides with the
name of a subcircuit in ModelFile. Those
conditions will cause the editor for the
SpiceModel to be replaced with a drop list of
subcircuits in the file pointed to by ModelFile.

I modified the symbols 1pole.asy and 2pole.asy
to put the subcircuit names as the SpiceModel
attribute instead of the value so that you can
see it work(Though there's only one subcircuit
in the list to choose from). It's possible
that old schematics drafted with yesterday's
version don't work, just delete and replace the
1pole and 2pole instances to fix.

--Mike

__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!


Jonathan Kirwan
 

On Tue, 25 Mar 2003 15:19:26 -0800 (PST), you wrote:

Jon,

In the above case, it would be nice if LT Spice
would put a "Select Subcircuit" button on the
dialog box which comes up when I right-click on
the symbol (if the .ASY symbol is an X type)
and provide me a list of .SUBCKT entries it
found in the specified library file. In that
case, the PUJT.LIB case, this means it would pop
up 2N6027 and 2N6028, for example, and offer
those as options.
Yes, this is something that's been needed for a
long time. So I implemented it today. To use
it make a symbol with prefix 'X'. Make ModelFile
point to a library contianing subcircuits. Give
the symbol a SpiceModel that coincides with the
name of a subcircuit in ModelFile. Those
conditions will cause the editor for the
SpiceModel to be replaced with a drop list of
subcircuits in the file pointed to by ModelFile.

I modified the symbols 1pole.asy and 2pole.asy
to put the subcircuit names as the SpiceModel
attribute instead of the value so that you can
see it work(Though there's only one subcircuit
in the list to choose from). It's possible
that old schematics drafted with yesterday's
version don't work, just delete and replace the
1pole and 2pole instances to fix.
Thanks. Just tested and it seems to work okay. Now what I'm
wondering about is what is displayed on the schematic. Should I
remove "visibility" for the Value attribute and add "visibility"
for the SpiceModel attribute on the underlying .ASY symbol?

Jon


Jonathan Kirwan
 

On Wed, 26 Mar 2003 00:49:55 -0800, you wrote:

Thanks. Just tested and it seems to work okay. Now what I'm
wondering about is what is displayed on the schematic. Should I
remove "visibility" for the Value attribute and add "visibility"
for the SpiceModel attribute on the underlying .ASY symbol?
I guess I'm asking this because the .ASY I currently use
automatically displays the Value attribute. But the new
drop-down for the SpiceModel only changes the SpiceModel
attribute (perhaps, as it should.) Since this isn't normally
displayed on the schematic, so far as I've seen anyway,
selecting a new model doesn't change what appears on the
schematic. So I have to manually change the Value attribute, as
well, in order to match (so it appears.)

For example, if I select 2N6028 in the drop-down for SpiceModel
*and* then manually change the Value attribute to match,
everything works well. If I then set the Value attribute to
"junk," leaving the SpiceModel to 2N6028, I get "Error: Unknown
subckt called in: xu1 n001 n002 n003 2N6028 junk" If I then try
and change the Value attribute to 2N6027 (which is also present
in the .LIB file I have, but which is *not* a match for the
current SpiceModel, which is 2N6028), then I get the error, "Too
many parameters for subcircuit type "2n6027" (instance: xu1)"

Just to let you know.

Jon


 

Jon,

...For example, if I select 2N6028 in the drop-down
for SpiceModel *and* then manually change the Value
attribute to match, everything works well...
You probably want to make the Model and Instance name
visible in the .asy file and nothing else. THE VALUE
SHOULD BE LEFT BLANK in both the .asy and instance,
unless you want to add parameters to pass to the
subckt. These should be of the form "eta=5.3"

Attached is a .asy file and .sub file that work
together
to demonstate being able to use the drop list to
to select a subckt in the .sub file. You will have
to fix line wrap.

--- .asy ---
Version 4
SymbolType CELL
LINE Normal -32 -32 32 0
LINE Normal -32 32 32 0
LINE Normal -32 -32 -32 32
LINE Normal -28 -16 -20 -16
LINE Normal -28 16 -20 16
LINE Normal -24 20 -24 12
LINE Normal 0 -32 0 -16
LINE Normal 0 32 0 16
LINE Normal 4 -20 12 -20
LINE Normal 8 -24 8 -16
LINE Normal 4 20 12 20
WINDOW 0 16 -32 Left 0
WINDOW 38 47 28 Center 0
SYMATTR Prefix X
SYMATTR Description Parameterized Single Pole Opamp.
En and in are equivalent voltage and current noises.
Enk and ink are the respective corner frequencies.
SYMATTR Value2 Avol=10Meg GBW=10Meg Slew=10Meg
SYMATTR SpiceLine ilimit=25m rail=0 Vos=0
SYMATTR SpiceLine2 en=0 enk=0 in=0 ink=0
SYMATTR ModelFile genopamp.sub
SYMATTR SpiceModel 1pole
PIN -32 16 NONE 0
PINATTR PinName In+
PINATTR SpiceOrder 1
PIN -32 -16 NONE 0
PINATTR PinName In-
PINATTR SpiceOrder 2
PIN 0 -32 NONE 0
PINATTR PinName V+
PINATTR SpiceOrder 3
PIN 0 32 NONE 0
PINATTR PinName V-
PINATTR SpiceOrder 4
PIN 32 0 NONE 0
PINATTR PinName OUT
PINATTR SpiceOrder 5

--- .sub ---
* Copyright Linear Technology Corp. 1998, 1999,
2000, 2001, 2002, 2003. All rights reserved.
*
.subckt 1pole 1 2 3 4 5
S1 5 3 N002 5 Q
S2 4 5 5 N002 Q
A1 2 1 0 0 0 0 N002 0 OTA G={Avol/Rout} ref={Vos}
Iout={slew*Cout} Cout={Cout} en={en} enk={enk} in={in}
ink={ink} Vhigh=1e308 Vlow=-1e308
C3 5 4 1p
C4 3 5 1p
S3 N002 0 4 N002 C
S4 0 N002 N002 3 C
R2 N002 4 {2*Rout} noiseless
R1 3 N002 {2*Rout} noiseless
R3 3 1 1G noiseless
R4 3 2 1G noiseless
R5 2 4 1G noiseless
R6 1 4 1G noiseless
.model C SW(Ron=100 Roff=1T Vt=0 Vh=-1 noiseless)
.param Rout=100Meg
.param Cout={Avol/GBW/2/pi/Rout}
.model Q SW(Ron=10 Roff=10Meg Vt=0 Vh=-.1 Vser={Rail}
ilimit={Ilimit} noiseless)
.param Avol=10Meg GBW=10Meg Slew=10Meg ilimit=25m
rail=0 Vos=0
.param en=0 enk=0 in=0 ink=0
.ends 1pole

.subckt 2pole 1 2 3 4 5
S1 5 3 N002 5 Q
S2 4 5 5 N002 Q
A1 2 1 0 0 0 0 N003 0 OTA G={Avol/Rout} ref={Vos}
Iout={slew*Cout} Cout={Cout} en={en} enk={enk} in={in}
ink={ink} Vhigh=1e308 Vlow=-1e308 Rout={Rout}
C3 5 4 1p
C4 3 5 1p
S3 N002 0 4 N002 C
S4 0 N002 N002 3 C
R3 3 2 1G noiseless
G1 0 N002 N003 0 {1/Rout}
R1 3 N002 {2*Rout} noiseless
R2 N002 4 {2*Rout} noiseless
C1 N002 0 {X*Cout/Avol}
S5 0 N003 N003 3 C
S6 N003 0 4 N003 C
R4 3 1 1G noiseless
R5 1 4 1G noiseless
R6 2 4 1G noiseless
.model C SW(Ron=100 Roff=1T Vt=0 Vh=-1 noiseless)
.param Rout=100Meg
.param Cout={Avol/GBW/2/pi/Rout}
.model Q SW(Ron=10 Roff=10Meg Vt=0 Vh=-.1 Vser={Rail}
ilimit={Ilimit} noiseless)
.param Avol=10Meg GBW=10Meg Slew=10Meg rail=0 Vos=0
ilimit=25m
.param en=0 enk=0 in=0 ink=0 phimargin=45
.param X
table(phimargin,29.4,3.5,32.1,2.9,33.8,2.6,35.8,2.3,38.1,2,40.9,1.7,43.2,1.5,45.9,1.3,49.2,1.1,53.2,0.9,58.2,0.7,64.7,0.5,73,0.3,86.1,0.05)
.ends 2pole


__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!


Jonathan Kirwan
 

On Wed, 26 Mar 2003 08:30:09 -0800 (PST), you wrote:

You probably want to make the Model and Instance name
visible in the .asy file and nothing else. THE VALUE
SHOULD BE LEFT BLANK in both the .asy and instance,
unless you want to add parameters to pass to the
subckt. These should be of the form "eta=5.3"

Attached is a .asy file and .sub file that work
together
to demonstate being able to use the drop list to
to select a subckt in the .sub file. You will have
to fix line wrap.
Okay, thanks. I'm beginning to get some of it. However, now
this leads me to some more questions...

First, I went back to look at a symbol you provided me, some
time ago, for the PUJT (called PUT.ASY.) It included two text
attribute elements, InstName and Value, which I could see by
right-clicking on them. However, I noticed that I could not
change the attribute element type for them.

So I went and tried creating a new symbol. (I've avoiding doing
this, so far.) Then I looked around through the menus for a way
to add those same attributes, InstName and Value, to my new
symbol. I couldn't find them anywhere. Nada.

So I looked in the help for InstName. Nothing. I tried ctrl-W
and ctrl-A and played around with those. Nope, nothing I could
figure out there, either. I just couldn't figure out how you
added those two attributes to the visible part of the diagram.

So I looked at the ASCII text of PUT.ASY and noticed these
lines:

WINDOW 0 24 0 Left 0
WINDOW 3 24 72 Left 0

What's interesting to me is that I had *NO IDEA* what these are
for and I couldn't find any documentation on them, either. So I
just guessed that the first number might relate to type of
attribute and played around by changing it. I got the following
list, working the numbers up to about 40:

0 InstName
1 Type
2 RefName
3 Value
4
5 QArea
6
7
8 Width
9 Length
10 Multi
11
.
.
.
37
38 SpiceModel
39 SpiceLine
40 SpiceLine2
41
.
.
.

Then I went and looked at your newly posted example and noticed
this:

WINDOW 0 16 -32 Left 0
WINDOW 38 47 28 Center 0

Ah hah!! "38" is there, exactly what you were referring to.

Mike!? How do I add that, using the symbol editor GUI? Do I
have to hand-edit those things into the .ASY file? Or am I just
being an ignorant user who should know better?

Jon


 

Jon,

...So I looked at the ASCII text of PUT.ASY and
noticed these lines:

WINDOW 0 24 0 Left 0
WINDOW 3 24 72 Left 0
...
I'd recommend using the graphical symbol editor.
Attribute visibility is covered in help in
Schematic Capture=>Creating New Symbols=>
Attribute Visibility.

--Mike

__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!


Jonathan Kirwan
 

On Wed, 26 Mar 2003 11:12:51 -0800 (PST), you wrote:

...So I looked at the ASCII text of PUT.ASY and
noticed these lines:

WINDOW 0 24 0 Left 0
WINDOW 3 24 72 Left 0
...
I'd recommend using the graphical symbol editor.
Attribute visibility is covered in help in
Schematic Capture=>Creating New Symbols=>
Attribute Visibility.
Yes, I thought I'd already tried that but apparently I hadn't.
Sorry about that -- defective user, I guess.

By the way, your help file describes this as:

"You can edit the visibility of attributes using the menu
command Edit=>Attributes=>Edit Window. After you select an
attribute with this dialog you will then be able to position it
as you wish with respect to the symbol."

However, it's really:

Edit=>Attributes=>Attribute Window

There is no "Edit Window" selection there, I believe.

Also, as I discovered, there are some items not present in the
attribute window which appears, using ctrl-W:

2 RefName
5 QArea
8 Width
9 Length
10 Multi

Are there others I've missed? Are these documented? Is there a
reason why these do not appear in the ctrl-W list?

Jon


 

Jon,

...Edit=>Attributes=>Edit Window...
However, it's really:

Edit=>Attributes=>Attribute Window
Thank you very much for pointing this out.

Also, as I discovered, there are some items
not present in the attribute window which
appears, using ctrl-W:

2 RefName
5 QArea
8 Width
9 Length
10 Multi

Are there others I've missed? Are these
documented? Is there a reason why these
do not appear in the ctrl-W list?
There are a couple hundred symbol attributes.
There's even an undocumented attribute
compiler. These attributes are used when
LTspice reads some other EDA formats used
inhouse. However, these formats are non-
standard, customized versions of commercial
syntaxs and have no usage outside of LT.
I only document what I think is useful(and
feel I can let people rely on.) While
there are useful undocumented features
that come out in formums like this user
group, I'm afraid those symbol attributes
will be a red herring for you and could
cause erratic program operation.

--Mike

__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!