Maker Pro
Maker Pro

SwitcherCad / Pspice SUBCKT calls?

R

Robert Baer

Jan 1, 1970
0
I see no way to add an arbitrary device and use X to call its use.
Not even if it happens to be a zener defined with a .SUBCKT ..
Good thing i kept my DOS version of TopSpice!
 
H

Helmut Sennewald

Jan 1, 1970
0
Robert Baer said:
I see no way to add an arbitrary device and use X to call its use.
Not even if it happens to be a zener defined with a .SUBCKT ..
Good thing i kept my DOS version of TopSpice!


Hello Robert,

LTspice can handle subcircuits of course.
Maybe you haven't correctly setup your subcircuit or symbol.

There are in general differences between the SPICE varieties
when it comes to parameter passing to subcircuits.
LTspice is mostly compatible to PSPICE regarding parameters.

Why haven't you posted your LTspice schematic and subcircuit?
Now I have to make some guess what you have done wrong.
I have assumed that you try to use Z-diode subcircuit models
from ONSEMI. They provide two models for each Z-diode.
Prefer to use the PSPICE compatible models(.lib) and not the
SPICE3 models(.sp3) from ONSEMI, because SPICE3 has a different
syntax for the model statement of resistors. Normally you don't
have or need .model statements for resistors.

PSPICE:
RBV 6 0 MDRBV 1749.5
..MODEL MDRBV RES TC1=-0.000940267

SPICE3:
RBV 6 0 1749.5 MDRBV
..MODEL MDRBV R TC1=-0.000940267

LTspice allows you to have the tempco in the same line.
RBV 6 0 1749.5 TC1=-0.000940267


I have made an example for you with a Z-diode(4.7V) from ONSEMI.
It is defined with a subcircuit. The only important thing with
the ONSEMI library is to use the PSPICE compatible ".lib"
file and not the SPICE3(.sp3) file.

Save the attached schematic file with name "zdiode_test.asc"
and save the model file as "bzx84b4v7lt1.lib".
Please keep both files in the same directory.
I have also attached a few instructions how to change symbols
which are designed for models so that they can be used for
subcircuits. So you don't have to draw an extra symbol.

Best regards,
Helmut


------ INSTRUCTIONS FOR SUBCIRCUIT( ZENER-)DIODES ------

1. Add a diode to the schematic.

2. Move the cursor over the placed diode.
Press <Ctrl>RightMouseButton
Change Prefix D to X
OK

Now this diode expects a ".SUBCKT ..." definition, because of the X.

3. Change the value D of the diode in your schematic to bzx84b4v7lt1.

4. Place the subcircuit definition in the schematic or load it from a file.

In the ladder case add a ".include bzx84b4v7lt1.lib" to the schematic.
Save the subcircuit definition file "bzx84b4v7lt1.lib" in the same directory
where your schematic has been saved.

------------------------------------------------------------


Schematic: zdiode_test.asc


Version 4
SHEET 1 1488 1540
WIRE -240 192 -240 128
WIRE -240 320 -240 272
WIRE -160 128 -240 128
WIRE 16 128 -160 128
WIRE 160 128 96 128
WIRE 160 192 160 128
WIRE 160 320 160 256
FLAG -240 320 0
FLAG 160 320 0
FLAG -160 128 vp
FLAG 160 128 vz
SYMBOL voltage -240 176 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V1
SYMATTR Value PULSE(0 10 5n 5n 5n 1u 2u)
SYMBOL res 0 144 R270
WINDOW 0 32 56 VTop 0
WINDOW 3 0 56 VBottom 0
SYMATTR InstName R1
SYMATTR Value 100
SYMBOL zener 176 256 R180
WINDOW 0 -20 72 Left 0
WINDOW 3 5 -5 Right 0
SYMATTR InstName D1
SYMATTR Value bzx84b4v7lt1
SYMATTR Prefix X
TEXT -248 16 Left 0 !.tran 10u
TEXT -256 -24 Left 0 !.include bzx84b4v7lt1.lib






Model from ONSEMI: bzx84b4v7lt1.lib


..SUBCKT bzx84b4v7lt1 2 1
**************************************
* Model Generated by MODPEX *
*Copyright(c) Symmetry Design Systems*
* All Rights Reserved *
* UNPUBLISHED LICENSED SOFTWARE *
* Contains Proprietary Information *
* Which is The Property of *
* SYMMETRY OR ITS LICENSORS *
*Commercial Use or Resale Restricted *
* by Symmetry License Agreement *
**************************************
* Model generated on Dec 11, 03
* MODEL FORMAT: PSpice
* anode cathode
*node: 2 1
* Forward Section
D1 2 1 MD1
..MODEL MD1 D IS=5.21532e-16 N=1 XTI=1 RS=0.5
+ CJO=1.3e-10 TT=1e-08
* Leakage Current
R 1 2 MDR 1e+07
..MODEL MDR RES TC1=0 TC2=0
* Breakdown
IZG 4 2 0.12
R4 4 2 2000
D3 2 4 MD3
..MODEL MD3 D IS=2.5e-12 N=2.70127 XTI=0 EG=0.1
D2 5 4 MD2
..MODEL MD2 D IS=2.5e-12 N=8.46982 XTI=0 EG=0.1
EV1 1 5 6 0 1
IBV 0 6 0.001
RBV 6 0 MDRBV 1749.5
..MODEL MDRBV RES TC1=-0.000940267
*-- PSpice DIODE MODEL DEFAULT PARAMETER
* VALUES ARE ASSUMED
*IS=1E-14 RS=0 N=1 TT=0 CJO=0
*VJ=1 M=0.5 EG=1.11 XTI=3 FC=0.5
*KF=0 AF=1 BV=inf IBV=1e-3 TNOM=27
..ENDS bzx84b4v7lt1
 
K

Ken Smith

Jan 1, 1970
0
I see no way to add an arbitrary device and use X to call its use.
Not even if it happens to be a zener defined with a .SUBCKT ..
Good thing i kept my DOS version of TopSpice!

Huh ?????

I use subcircuits to handle the IRF MOSFETs etc. In the schematic, they
look like a MOSFET symbol so the schematic is easy to understand but they,
in fact call out a SUBCKT in the net list. Is this the sort of thing you
are trying to do?
 
J

Jim Thompson

Jan 1, 1970
0
I see no way to add an arbitrary device and use X to call its use.
Not even if it happens to be a zener defined with a .SUBCKT ..
Good thing i kept my DOS version of TopSpice!

You must be doing something wrong.

Please give an example of what isn't working.

...Jim Thompson
 
R

Robert Baer

Jan 1, 1970
0
Helmut said:
Hello Robert,

LTspice can handle subcircuits of course.
Maybe you haven't correctly setup your subcircuit or symbol.

There are in general differences between the SPICE varieties
when it comes to parameter passing to subcircuits.
LTspice is mostly compatible to PSPICE regarding parameters.

Why haven't you posted your LTspice schematic and subcircuit?
Now I have to make some guess what you have done wrong.
I have assumed that you try to use Z-diode subcircuit models
from ONSEMI. They provide two models for each Z-diode.
Prefer to use the PSPICE compatible models(.lib) and not the
SPICE3 models(.sp3) from ONSEMI, because SPICE3 has a different
syntax for the model statement of resistors. Normally you don't
have or need .model statements for resistors.

PSPICE:
RBV 6 0 MDRBV 1749.5
.MODEL MDRBV RES TC1=-0.000940267

SPICE3:
RBV 6 0 1749.5 MDRBV
.MODEL MDRBV R TC1=-0.000940267

LTspice allows you to have the tempco in the same line.
RBV 6 0 1749.5 TC1=-0.000940267


I have made an example for you with a Z-diode(4.7V) from ONSEMI.
It is defined with a subcircuit. The only important thing with
the ONSEMI library is to use the PSPICE compatible ".lib"
file and not the SPICE3(.sp3) file.

Save the attached schematic file with name "zdiode_test.asc"
and save the model file as "bzx84b4v7lt1.lib".
Please keep both files in the same directory.
I have also attached a few instructions how to change symbols
which are designed for models so that they can be used for
subcircuits. So you don't have to draw an extra symbol.

Best regards,
Helmut


------ INSTRUCTIONS FOR SUBCIRCUIT( ZENER-)DIODES ------

1. Add a diode to the schematic.

2. Move the cursor over the placed diode.
Press <Ctrl>RightMouseButton
Change Prefix D to X
OK

Now this diode expects a ".SUBCKT ..." definition, because of the X.

3. Change the value D of the diode in your schematic to bzx84b4v7lt1.

4. Place the subcircuit definition in the schematic or load it from a file.

In the ladder case add a ".include bzx84b4v7lt1.lib" to the schematic.
Save the subcircuit definition file "bzx84b4v7lt1.lib" in the same directory
where your schematic has been saved.

------------------------------------------------------------


Schematic: zdiode_test.asc


Version 4
SHEET 1 1488 1540
WIRE -240 192 -240 128
WIRE -240 320 -240 272
WIRE -160 128 -240 128
WIRE 16 128 -160 128
WIRE 160 128 96 128
WIRE 160 192 160 128
WIRE 160 320 160 256
FLAG -240 320 0
FLAG 160 320 0
FLAG -160 128 vp
FLAG 160 128 vz
SYMBOL voltage -240 176 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V1
SYMATTR Value PULSE(0 10 5n 5n 5n 1u 2u)
SYMBOL res 0 144 R270
WINDOW 0 32 56 VTop 0
WINDOW 3 0 56 VBottom 0
SYMATTR InstName R1
SYMATTR Value 100
SYMBOL zener 176 256 R180
WINDOW 0 -20 72 Left 0
WINDOW 3 5 -5 Right 0
SYMATTR InstName D1
SYMATTR Value bzx84b4v7lt1
SYMATTR Prefix X
TEXT -248 16 Left 0 !.tran 10u
TEXT -256 -24 Left 0 !.include bzx84b4v7lt1.lib






Model from ONSEMI: bzx84b4v7lt1.lib


.SUBCKT bzx84b4v7lt1 2 1
**************************************
* Model Generated by MODPEX *
*Copyright(c) Symmetry Design Systems*
* All Rights Reserved *
* UNPUBLISHED LICENSED SOFTWARE *
* Contains Proprietary Information *
* Which is The Property of *
* SYMMETRY OR ITS LICENSORS *
*Commercial Use or Resale Restricted *
* by Symmetry License Agreement *
**************************************
* Model generated on Dec 11, 03
* MODEL FORMAT: PSpice
* anode cathode
*node: 2 1
* Forward Section
D1 2 1 MD1
.MODEL MD1 D IS=5.21532e-16 N=1 XTI=1 RS=0.5
+ CJO=1.3e-10 TT=1e-08
* Leakage Current
R 1 2 MDR 1e+07
.MODEL MDR RES TC1=0 TC2=0
* Breakdown
IZG 4 2 0.12
R4 4 2 2000
D3 2 4 MD3
.MODEL MD3 D IS=2.5e-12 N=2.70127 XTI=0 EG=0.1
D2 5 4 MD2
.MODEL MD2 D IS=2.5e-12 N=8.46982 XTI=0 EG=0.1
EV1 1 5 6 0 1
IBV 0 6 0.001
RBV 6 0 MDRBV 1749.5
.MODEL MDRBV RES TC1=-0.000940267
*-- PSpice DIODE MODEL DEFAULT PARAMETER
* VALUES ARE ASSUMED
*IS=1E-14 RS=0 N=1 TT=0 CJO=0
*VJ=1 M=0.5 EG=1.11 XTI=3 FC=0.5
*KF=0 AF=1 BV=inf IBV=1e-3 TNOM=27
.ENDS bzx84b4v7lt1
Thanks; i will try exactly as you suggested.
I attempted many variations, and it is possible that i got "close",
but not exactly as you described.
One of the possible problems was i tried to use a .LIB directive
(more familiar with TopSpice) than the .INCLUDE you mentioned.
And i did try embedding the .SUBCKT descriptions, but may not have
tried the variant you mentioned on the device itself.
 
R

Robert Baer

Jan 1, 1970
0
Ken said:
Huh ?????

I use subcircuits to handle the IRF MOSFETs etc. In the schematic, they
look like a MOSFET symbol so the schematic is easy to understand but they,
in fact call out a SUBCKT in the net list. Is this the sort of thing you
are trying to do?
I am trying a zener diode, but the method should be the same.
 
K

Ken Smith

Jan 1, 1970
0
Robert Baer said:
.LIB (more familiar with TopSpice) than the .INCLUDE you mentioned.

As far as I know, .LIB and .INCLUDE do exactly the same thing in ltspice.
I do something different from the method you are learning. Rather than
confusing things with another set of instructions, I'll come by and check
this thread again in tomorrow to see if you've got it working.
 
K

Ken Smith

Jan 1, 1970
0
I am trying a zener diode, but the method should be the same.

As I said elsewhere, I won't confuse matters by giving you another set of
instructions on how to do it differently. I'll check back tomorrow and
see how you are getting on.
 
H

Helmut Sennewald

Jan 1, 1970
0
Ken Smith said:
As far as I know, .LIB and .INCLUDE do exactly the same thing in ltspice.
I do something different from the method you are learning. Rather than
confusing things with another set of instructions, I'll come by and check
this thread again in tomorrow to see if you've got it working.
And i did try embedding the .SUBCKT descriptions, but may not have
tried the variant you mentioned on the device itself.
[email protected] forging knowledge


Hello Ken and Robert,

There is an important difference between .LIB and .INCLUDE in LTspice
and in other SPICE programs as well.

..LIB filename
-------------
Only extract subcircuits and models from the given file.
All lines which are not part of a subcircuit or a model
are omitted.


..INCLUDE filename
-----------------
Include evrey line of the given file into the netlist.


The filename may be any valid name your OS can accept.
The file extension (.lib, .mod, .sub, .xyz ...) has no special
meaning with the .lib and .include command.

Best regards,
Helmut

PS: .inc is the abbreviation of .include .
 
R

Robert Baer

Jan 1, 1970
0
Helmut said:
Hello Robert,

LTspice can handle subcircuits of course.
Maybe you haven't correctly setup your subcircuit or symbol.

There are in general differences between the SPICE varieties
when it comes to parameter passing to subcircuits.
LTspice is mostly compatible to PSPICE regarding parameters.

Why haven't you posted your LTspice schematic and subcircuit?
Now I have to make some guess what you have done wrong.
I have assumed that you try to use Z-diode subcircuit models
from ONSEMI. They provide two models for each Z-diode.
Prefer to use the PSPICE compatible models(.lib) and not the
SPICE3 models(.sp3) from ONSEMI, because SPICE3 has a different
syntax for the model statement of resistors. Normally you don't
have or need .model statements for resistors.

PSPICE:
RBV 6 0 MDRBV 1749.5
.MODEL MDRBV RES TC1=-0.000940267

SPICE3:
RBV 6 0 1749.5 MDRBV
.MODEL MDRBV R TC1=-0.000940267

LTspice allows you to have the tempco in the same line.
RBV 6 0 1749.5 TC1=-0.000940267


I have made an example for you with a Z-diode(4.7V) from ONSEMI.
It is defined with a subcircuit. The only important thing with
the ONSEMI library is to use the PSPICE compatible ".lib"
file and not the SPICE3(.sp3) file.

Save the attached schematic file with name "zdiode_test.asc"
and save the model file as "bzx84b4v7lt1.lib".
Please keep both files in the same directory.
I have also attached a few instructions how to change symbols
which are designed for models so that they can be used for
subcircuits. So you don't have to draw an extra symbol.

Best regards,
Helmut


------ INSTRUCTIONS FOR SUBCIRCUIT( ZENER-)DIODES ------

1. Add a diode to the schematic.

2. Move the cursor over the placed diode.
Press <Ctrl>RightMouseButton
Change Prefix D to X
OK

Now this diode expects a ".SUBCKT ..." definition, because of the X.

3. Change the value D of the diode in your schematic to bzx84b4v7lt1.

4. Place the subcircuit definition in the schematic or load it from a file.

In the ladder case add a ".include bzx84b4v7lt1.lib" to the schematic.
Save the subcircuit definition file "bzx84b4v7lt1.lib" in the same directory
where your schematic has been saved.

------------------------------------------------------------


Schematic: zdiode_test.asc


Version 4
SHEET 1 1488 1540
WIRE -240 192 -240 128
WIRE -240 320 -240 272
WIRE -160 128 -240 128
WIRE 16 128 -160 128
WIRE 160 128 96 128
WIRE 160 192 160 128
WIRE 160 320 160 256
FLAG -240 320 0
FLAG 160 320 0
FLAG -160 128 vp
FLAG 160 128 vz
SYMBOL voltage -240 176 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V1
SYMATTR Value PULSE(0 10 5n 5n 5n 1u 2u)
SYMBOL res 0 144 R270
WINDOW 0 32 56 VTop 0
WINDOW 3 0 56 VBottom 0
SYMATTR InstName R1
SYMATTR Value 100
SYMBOL zener 176 256 R180
WINDOW 0 -20 72 Left 0
WINDOW 3 5 -5 Right 0
SYMATTR InstName D1
SYMATTR Value bzx84b4v7lt1
SYMATTR Prefix X
TEXT -248 16 Left 0 !.tran 10u
TEXT -256 -24 Left 0 !.include bzx84b4v7lt1.lib






Model from ONSEMI: bzx84b4v7lt1.lib


.SUBCKT bzx84b4v7lt1 2 1
**************************************
* Model Generated by MODPEX *
*Copyright(c) Symmetry Design Systems*
* All Rights Reserved *
* UNPUBLISHED LICENSED SOFTWARE *
* Contains Proprietary Information *
* Which is The Property of *
* SYMMETRY OR ITS LICENSORS *
*Commercial Use or Resale Restricted *
* by Symmetry License Agreement *
**************************************
* Model generated on Dec 11, 03
* MODEL FORMAT: PSpice
* anode cathode
*node: 2 1
* Forward Section
D1 2 1 MD1
.MODEL MD1 D IS=5.21532e-16 N=1 XTI=1 RS=0.5
+ CJO=1.3e-10 TT=1e-08
* Leakage Current
R 1 2 MDR 1e+07
.MODEL MDR RES TC1=0 TC2=0
* Breakdown
IZG 4 2 0.12
R4 4 2 2000
D3 2 4 MD3
.MODEL MD3 D IS=2.5e-12 N=2.70127 XTI=0 EG=0.1
D2 5 4 MD2
.MODEL MD2 D IS=2.5e-12 N=8.46982 XTI=0 EG=0.1
EV1 1 5 6 0 1
IBV 0 6 0.001
RBV 6 0 MDRBV 1749.5
.MODEL MDRBV RES TC1=-0.000940267
*-- PSpice DIODE MODEL DEFAULT PARAMETER
* VALUES ARE ASSUMED
*IS=1E-14 RS=0 N=1 TT=0 CJO=0
*VJ=1 M=0.5 EG=1.11 XTI=3 FC=0.5
*KF=0 AF=1 BV=inf IBV=1e-3 TNOM=27
.ENDS bzx84b4v7lt1
I tried embedding the whole library (it is short) and it does not
work; error message is "not found".
The bad thing is that line is over 2000 characters long...
However, one could trim the line to have only the first .SUBCKT which
i tried to no avail.
.LIB and .INC also fail exactly the same way.

Version 4
SHEET 1 1192 2740
WIRE -32 192 -32 144
WIRE -32 400 -32 272
WIRE 16 144 -32 144
WIRE 16 304 16 144
WIRE 16 400 -32 400
WIRE 16 400 16 384
WIRE 144 144 16 144
WIRE 144 208 144 144
WIRE 144 304 144 272
WIRE 144 400 16 400
WIRE 144 400 144 384
WIRE 144 416 144 400
FLAG 144 416 0
SYMBOL current -32 272 R180
WINDOW 0 24 88 Left 0
WINDOW 3 24 0 Left 0
SYMATTR InstName I1
SYMATTR Value 20µA
SYMBOL zener 160 272 R180
WINDOW 0 24 72 Left 0
WINDOW 3 -105 -4 Left 0
SYMATTR InstName X
SYMATTR Value DDZ9689
SYMBOL res 128 288 R0
SYMATTR InstName R1
SYMATTR Value 0.001
SYMBOL res 0 288 R0
SYMATTR InstName R2
SYMATTR Value 1E9
TEXT -130 506 Left 0 !.dc I1 20uA 500uA 1uA
TEXT 288 8 Left 0 !*SRC=DDZ9689;Diodes;Zener <=10V; 5.10V 0.500W
Diodes Inc. zener\n.SUBCKT DDZ9689 1 2\n* Terminals A K\nD1
1 2 DF\nDZ 3 1 DR\nVZ 2 3 3.15\n.MODEL DF D ( IS=40.4p RS=34.9 N=1.10\n+
CJO=119p VJ=0.750 M=0.330 TT=50.1n )\n.MODEL DR D ( IS=8.08f RS=3.95k
N=3.00 )\n.ENDS\n \n*SRC=DDZ9689S;Diodes;Zener <=10V; 5.10V 0.200W
Diodes Inc. zener\n.SUBCKT DDZ9689S 1 2\n* Terminals A
K\nD1 1 2 DF\nDZ 3 1 DR\nVZ 2 3 3.08\n.MODEL DF D ( IS=16.2p RS=32.3
N=1.10\n+ CJO=119p VJ=0.750 M=0.330 TT=50.1n )\n.MODEL DR D ( IS=3.23f
RS=3.95k N=3.00 )\n.ENDS\n \n*SRC=DDZ9690;Diodes;Zener <=10V; 5.60V
0.500W Diodes Inc. zener\n.SUBCKT DDZ9690 1 2\n* Terminals
A K\nD1 1 2 DF\nDZ 3 1 DR\nVZ 2 3 3.79\n.MODEL DF D ( IS=36.8p RS=34.7
N=1.10\n+ CJO=92.6p VJ=0.750 M=0.330 TT=50.1n )\n.MODEL DR D ( IS=7.36f
RS=946 N=3.00 )\n.ENDS\n \n*SRC=DDZ9690S;Diodes;Zener <=10V; 5.60V
0.200W Diodes Inc. zener\n.SUBCKT DDZ9690S 1 2\n* Terminals
A K\nD1 1 2 DF\nDZ 3 1 DR\nVZ 2 3
3.72\n.MODEL DF D ( IS=14.7p RS=32.1 N=1.10\n+ CJO=92.6p VJ=0.750
M=0.330 TT=50.1n )\n.MODEL DR D ( IS=2.94f RS=946 N=3.00 )\n.ENDS\n
\n*SRC=DDZ9691;Diodes;Zener <=10V; 6.20V 0.500W Diodes Inc.
zener\n.SUBCKT DDZ9691 1 2\n* Terminals A K\nD1 1 2 DF\nDZ
3 1 DR\nVZ 2 3 5.31\n.MODEL DF D ( IS=33.2p RS=34.4 N=1.10\n+ CJO=79.4p
VJ=0.750 M=0.330 TT=50.1n )\n.MODEL DR D ( IS=6.65f RS=230 N=1.49
)\n.ENDS\n \n*SRC=DDZ9691S;Diodes;Zener <=10V; 6.20V 0.200W Diodes
Inc. zener\n.SUBCKT DDZ9691S 1 2\n* Terminals A K\nD1 1 2
DF\nDZ 3 1 DR\nVZ 2 3 5.28\n.MODEL DF D ( IS=13.3p RS=31.8 N=1.10\n+
CJO=79.4p VJ=0.750 M=0.330 TT=50.1n )\n.MODEL DR D ( IS=2.66f RS=230
N=1.49 )\n.ENDS\n \n*SRC=DDZ9692;Diodes;Zener <=10V; 6.80V 0.500W
Diodes Inc. zener\n.SUBCKT DDZ9692 1 2\n* Terminals A K\nD1
1 2 DF\nDZ 3 1 DR\nVZ 2 3 6.71\n.MODEL DF D ( IS=30.3p RS=34.1 N=1.10\n+
CJO=52.9p VJ=0.750 M=0.330 TT=50.1n )\n.MODEL DR D ( IS=6.06f RS=23.0
N=0.149 )\n.ENDS\n \n*SRC=DDZ9692S;Diodes;Zener <=10
V; 6.80V 0.200W Diodes Inc. zener\n.SUBCKT DDZ9692S 1 2\n*
Terminals A K\nD1 1 2 DF\nDZ 3 1 DR\nVZ 2 3 6.71\n.MODEL DF D (
IS=12.1p RS=31.5 N=1.10\n+ CJO=52.9p VJ=0.750 M=0.330 TT=50.1n )\n.MODEL
DR D ( IS=2.42f RS=23.0 N=0.149 )\n.ENDS\n \n*SRC=DDZ9694;Diodes;Zener
<-10V; 8.20V 0.500W Diodes Inc. zener\n.SUBCKT DDZ9694 1 2 ;
Note: same voltage as E-B of MMDT3904\n* Terminals A K\nD1 1
2 DF\nDZ 3 1 DR\nVZ 2 3 8.07\n.MODEL DF D ( IS=25.1p RS=33.6 N=1.10\n+
CJO=47.6p VJ=0.750 M=0.330 TT=50.1n )\n.MODEL DR D ( IS=5.02f RS=34.5
N=0.223 )\n.ENDS
 
H

Helmut Sennewald

Jan 1, 1970
0
I tried embedding the whole library (it is short) and it does not work;
error message is "not found".
The bad thing is that line is over 2000 characters long...
However, one could trim the line to have only the first .SUBCKT which i
tried to no avail.
.LIB and .INC also fail exactly the same way.
...

Hello Robert,

You have wrongly changed the value of the "InstName" to X instead
to change the "Prefix" to X.
The "InstName" is the reference designator whereas the "Prefix"
tells LTspice to search for a diode ".model ..." if it's D and
to look for a subcircuit if it's X.
LTspice looks in your circuit for a ".MODEL DDZ9689 D(....)" statement
but not for a ".SUBCKT DDZ9689 ...".
When you follow my previously given instructions above, then a
"Component Attribute Editor"-window pops up after you do the
<Ctrl>RightMousClick. Here change the value of the "Prefix"
from D to to X. Then press OK.
You should also change the "InstName"(reference designator) back to
D1 in your schematic as it was originally.

Please try the corrected circuit below.
I have splitted your design now into two files "zdio.asc" and
"z_diodes.lib" to avoid this super long line for the subcircuits.
It's simply more convenient to share the design this way when posting
it in an ASCII message.

Best regards,
Helmut



Schematic "zdio.asc"
--------------------


Version 4
SHEET 1 1200 2740
WIRE -32 192 -32 144
WIRE -32 400 -32 272
WIRE 16 144 -32 144
WIRE 16 304 16 144
WIRE 16 400 -32 400
WIRE 16 400 16 384
WIRE 144 144 16 144
WIRE 144 208 144 144
WIRE 144 304 144 272
WIRE 144 400 16 400
WIRE 144 400 144 384
WIRE 144 416 144 400
FLAG 144 416 0
SYMBOL current -32 272 R180
WINDOW 0 24 88 Left 0
WINDOW 3 24 0 Left 0
SYMATTR InstName I1
SYMATTR Value 20µA
SYMBOL zener 160 272 R180
WINDOW 0 4 67 Right 0
WINDOW 3 -90 -3 Left 0
SYMATTR InstName D1
SYMATTR Value DDZ9689
SYMATTR Prefix X
SYMBOL res 128 288 R0
SYMATTR InstName R1
SYMATTR Value 0.001
SYMBOL res 0 288 R0
SYMATTR InstName R2
SYMATTR Value 1E9
TEXT -58 66 Left 0 !.dc I1 20uA 500uA 1uA
TEXT -56 24 Left 0 !.lib z_diodes.lib




Z-Diode library file "z_diodes.lib"
----------------------------------


*SRC=DDZ9689;Diodes;Zener <=10V; 5.10V 0.500W Diodes Inc. zener
..SUBCKT DDZ9689 1 2
* Terminals A K
D1 1 2 DF
DZ 3 1 DR
VZ 2 3 3.15
..MODEL DF D ( IS=40.4p RS=34.9 N=1.10
+ CJO=119p VJ=0.750 M=0.330 TT=50.1n )
..MODEL DR D ( IS=8.08f RS=3.95k N=3.00 )
..ENDS

*SRC=DDZ9689S;Diodes;Zener <=10V; 5.10V 0.200W Diodes Inc. zener
..SUBCKT DDZ9689S 1 2
* Terminals A K
D1 1 2 DF
DZ 3 1 DR
VZ 2 3 3.08
..MODEL DF D ( IS=16.2p RS=32.3 N=1.10
+ CJO=119p VJ=0.750 M=0.330 TT=50.1n )
..MODEL DR D ( IS=3.23f RS=3.95k N=3.00 )
..ENDS

*SRC=DDZ9690;Diodes;Zener <=10V; 5.60V 0.500W Diodes Inc. zener
..SUBCKT DDZ9690 1 2
* Terminals A K
D1 1 2 DF
DZ 3 1 DR
VZ 2 3 3.79
..MODEL DF D ( IS=36.8p RS=34.7 N=1.10
+ CJO=92.6p VJ=0.750 M=0.330 TT=50.1n )
..MODEL DR D ( IS=7.36f RS=946 N=3.00 )
..ENDS

*SRC=DDZ9690S;Diodes;Zener <=10V; 5.60V 0.200W Diodes Inc. zener
..SUBCKT DDZ9690S 1 2
* Terminals A K
D1 1 2 DF
DZ 3 1 DR
VZ 2 3 3.72
..MODEL DF D ( IS=14.7p RS=32.1 N=1.10
+ CJO=92.6p VJ=0.750 M=0.330 TT=50.1n )
..MODEL DR D ( IS=2.94f RS=946 N=3.00 )
..ENDS

*SRC=DDZ9691;Diodes;Zener <=10V; 6.20V 0.500W Diodes Inc. zener
..SUBCKT DDZ9691 1 2
* Terminals A K
D1 1 2 DF
DZ 3 1 DR
VZ 2 3 5.31
..MODEL DF D ( IS=33.2p RS=34.4 N=1.10
+ CJO=79.4p VJ=0.750 M=0.330 TT=50.1n )
..MODEL DR D ( IS=6.65f RS=230 N=1.49 )
..ENDS

*SRC=DDZ9691S;Diodes;Zener <=10V; 6.20V 0.200W Diodes Inc. zener
..SUBCKT DDZ9691S 1 2
* Terminals A K
D1 1 2 DF
DZ 3 1 DR
VZ 2 3 5.28
..MODEL DF D ( IS=13.3p RS=31.8 N=1.10
+ CJO=79.4p VJ=0.750 M=0.330 TT=50.1n )
..MODEL DR D ( IS=2.66f RS=230 N=1.49 )
..ENDS

*SRC=DDZ9692;Diodes;Zener <=10V; 6.80V 0.500W Diodes Inc. zener
..SUBCKT DDZ9692 1 2
* Terminals A K
D1 1 2 DF
DZ 3 1 DR
VZ 2 3 6.71
..MODEL DF D ( IS=30.3p RS=34.1 N=1.10
+ CJO=52.9p VJ=0.750 M=0.330 TT=50.1n )
..MODEL DR D ( IS=6.06f RS=23.0 N=0.149 )
..ENDS

*SRC=DDZ9692S;Diodes;Zener <=10 V; 6.80V 0.200W Diodes Inc. zener
..SUBCKT DDZ9692S 1 2
* Terminals A K
D1 1 2 DF
DZ 3 1 DR
VZ 2 3 6.71
..MODEL DF D ( IS=12.1p RS=31.5 N=1.10
+ CJO=52.9p VJ=0.750 M=0.330 TT=50.1n )
..MODEL DR D ( IS=2.42f RS=23.0 N=0.149 )
..ENDS

*SRC=DDZ9694;Diodes;Zener <-10V; 8.20V 0.500W Diodes Inc. zener
..SUBCKT DDZ9694 1 2 ; Note: same voltage as E-B of MMDT3904
* Terminals A K
D1 1 2 DF
DZ 3 1 DR
VZ 2 3 8.07
..MODEL DF D ( IS=25.1p RS=33.6 N=1.10
+ CJO=47.6p VJ=0.750 M=0.330 TT=50.1n )
..MODEL DR D ( IS=5.02f RS=34.5 N=0.223 )
..ENDS
 
R

Robert Baer

Jan 1, 1970
0
--------- SNIPped for brevity ------
*That* is the magic! A Component Editor!!
Thanks; it works now.
I imported the subcircuit for the part i wanted to study this time
(makes the last line only 346 characters) and then "built" the circuit i
had in mind.
But it seems there may be something wrong with the model, so i added
the "short" you see to "home in" to the problem.
In TopSpice,the maximum temperature that works is 77C; the error
message at higher temperatures is meaningless to a user, only to the
original programmer.
In LTspice, it seems to work to about 105C and at 125C it runs
forever in a Newton-Rapheson(sp?? ) loop, and at 185C the zener voltage
is just plain wrong.
At 135C an error message is generated that may give a clue as to what
the problem in the model may be.
With this info, could you determine what is needed to fix it?

Version 4
SHEET 1 1408 2740
WIRE -32 192 -32 144
WIRE -32 400 -32 272
WIRE 16 144 -32 144
WIRE 16 304 16 144
WIRE 16 400 -32 400
WIRE 16 400 16 384
WIRE 32 144 16 144
WIRE 128 144 96 144
WIRE 144 400 16 400
WIRE 144 400 144 336
WIRE 144 416 144 400
WIRE 224 144 192 144
WIRE 272 336 144 336
WIRE 272 336 272 320
WIRE 288 336 272 336
WIRE 320 144 288 144
WIRE 320 240 272 240
WIRE 320 240 320 144
WIRE 384 176 384 144
WIRE 384 272 384 240
WIRE 384 336 352 336
FLAG 144 416 0
SYMBOL current -32 272 R180
WINDOW 0 24 88 Left 0
WINDOW 3 24 0 Left 0
SYMATTR InstName I1
SYMATTR Value 20µA
SYMBOL zener 96 128 R90
WINDOW 0 67 31 VBottom 0
WINDOW 3 70 21 VTop 0
SYMATTR InstName D1
SYMATTR Value DDZ9694
SYMATTR Prefix X
SYMBOL res 0 288 R0
SYMATTR InstName R2
SYMATTR Value 1E9
SYMBOL zener 192 128 R90
WINDOW 0 67 31 VBottom 0
WINDOW 3 95 24 VTop 0
SYMATTR InstName D2
SYMATTR Value DDZ9694
SYMATTR Prefix X
SYMBOL zener 288 128 R90
WINDOW 0 67 31 VBottom 0
WINDOW 3 70 21 VTop 0
SYMATTR InstName D3
SYMATTR Value DDZ9694
SYMATTR Prefix X
SYMBOL zener 320 160 R270
WINDOW 0 36 32 VTop 0
WINDOW 3 91 32 VBottom 0
SYMATTR InstName D4
SYMATTR Value DDZ9694
SYMATTR Prefix X
SYMBOL zener 368 176 R0
WINDOW 3 50 33 Left 0
SYMATTR InstName D5
SYMATTR Value DDZ9694
SYMATTR Prefix X
SYMBOL zener 368 272 R0
WINDOW 3 48 31 Left 0
SYMATTR InstName D6
SYMATTR Value DDZ9694
SYMATTR Prefix X
SYMBOL zener 352 320 R90
WINDOW 0 67 31 VBottom 0
WINDOW 3 70 21 VTop 0
SYMATTR InstName D7
SYMATTR Value DDZ9694
SYMATTR Prefix X
SYMBOL res 256 224 R0
SYMATTR InstName R1
SYMATTR Value .001
TEXT -58 66 Left 0 !.dc I1 20uA 500uA 1uA
TEXT -48 104 Left 0 !.TEMP 27 135
TEXT 528 112 Left 0 !*SRC=DDZ9694;Diodes;Zener <-10V; 8.20V 0.500W
Diodes Inc. zener\n.SUBCKT DDZ9694 1 2 ; Note: same voltage as E-B
of MMDT3904\n* Terminals A K\nD1 1 2 DF\nDZ 3 1 DR\nVZ 2 3
8.07\n.MODEL DF D ( IS=25.1p RS=33.6 N=1.10\n+ CJO=47.6p VJ=0.750
M=0.330 TT=50.1n )\n.MODEL DR D ( IS=5.02f RS=34.5 N=0.223 )\n.ENDS
 
H

Helmut Sennewald

Jan 1, 1970
0
----- Original Message -----
From: "Robert Baer" <[email protected]>
Newsgroups: sci.electronics.cad
Sent: Wednesday, July 27, 2005 10:31 PM
Subject: Re: SwitcherCad / Pspice SUBCKT calls?

--------- SNIPped for brevity ------
*That* is the magic! A Component Editor!!
Thanks; it works now.
I imported the subcircuit for the part i wanted to study this time
(makes the last line only 346 characters) and then "built" the circuit i
had in mind.
But it seems there may be something wrong with the model, so i added the
"short" you see to "home in" to the problem.
In TopSpice,the maximum temperature that works is 77C; the error message
at higher temperatures is meaningless to a user, only to the original
programmer.
In LTspice, it seems to work to about 105C and at 125C it runs forever
in a Newton-Rapheson(sp?? ) loop, and at 185C the zener voltage is just
plain wrong.
At 135C an error message is generated that may give a clue as to what
the problem in the model may be.
With this info, could you determine what is needed to fix it?

Hello Robert,

The problem has been caused by the low value of N in your diode model.
I assume it results in too large exponent values in the diode
equations used in SPICE. Normal diodes have N=1 to 2 .

Your model.
..MODEL DR D ( IS=5.02f RS=34.5 N=0.223 )

Please change N to at least 0.3.
..MODEL DR D ( IS=5.02f RS=34.5 N=0.3 )

The simulation has been ok with N=0.3 even for Temp=185C.

Best regards,
Helmut
 
R

Robert Baer

Jan 1, 1970
0
Helmut said:
----- Original Message -----
From: "Robert Baer" <[email protected]>
Newsgroups: sci.electronics.cad
Sent: Wednesday, July 27, 2005 10:31 PM
Subject: Re: SwitcherCad / Pspice SUBCKT calls?





Hello Robert,

The problem has been caused by the low value of N in your diode model.
I assume it results in too large exponent values in the diode
equations used in SPICE. Normal diodes have N=1 to 2 .

Your model.
.MODEL DR D ( IS=5.02f RS=34.5 N=0.223 )

Please change N to at least 0.3.
.MODEL DR D ( IS=5.02f RS=34.5 N=0.3 )

The simulation has been ok with N=0.3 even for Temp=185C.

Best regards,
Helmut
Thanks. Perhaps Diodes Inc gave the wrong value in their model.
Is there some electrical testing that could be used to determine N,
and is it relatively constant over current and /or temperature?
 
H

Helmut Sennewald

Jan 1, 1970
0
Robert Baer said:
Thanks. Perhaps Diodes Inc gave the wrong value in their model.
Is there some electrical testing that could be used to determine N, and
is it relatively constant over current and /or temperature?


Hello Robert,

Let's take a look to the datasheet curve on page 3 of 6 (bottom left).
http://www.diodes.com/products/catalog/search.php
DDZ9694

The model in question is for the diode DR used in Zener-region.

From the datsheet:
-----------------
delta_V = 0.17V, 1u->10m
Let's assume Rs=5Ohm as we see later.
delta_V_internal = 0.12V

Diode equations:
----------------
I1 = Is*exp(V1/(N*Vt))
I2 = Is*exp(V2/(N*Vt))
I2/I1= exp((V2-V1))/(N*Vt))
log(I2/I1)=(V2-V1)/(N*Vt)

N=(V2-V1)/(Vt*log(I2/I1))

Values from datsheet:

V2-V1 = 0.12V, I2/I1=1e4

N = 0.12/(0.025*log(10000))= 0.2/0.025*9.21)

N = 0.5

Rs=.15V/30m = 5Ohm


My guess:

----------------------------------
..MODEL DR D ( IS=5.02f RS=5 N=0.5)
----------------------------------

Sorry, I will not spend more effort into this diode model.

Best regards,
Helmut



The original model:

http://www.diodes.com/products/spicemodels/category.php?category-id=1

*SRC=DDZ9694;DI_DDZ9694;Diodes;Zener <=10V; 8.20V 0.500W Diodes Inc.
zener
*SYM=HZEN
..SUBCKT DI_DDZ9694 1 2
* Terminals A K
D1 1 2 DF
DZ 3 1 DR
VZ 2 3 8.07
..MODEL DF D ( IS=25.1p RS=33.6 N=1.10
+ CJO=47.6p VJ=0.750 M=0.330 TT=50.1n )
..MODEL DR D ( IS=5.02f RS=34.5 N=0.223 )
..ENDS
 
R

Robert Baer

Jan 1, 1970
0
Helmut said:
Hello Robert,

Let's take a look to the datasheet curve on page 3 of 6 (bottom left).
http://www.diodes.com/products/catalog/search.php
DDZ9694

The model in question is for the diode DR used in Zener-region.

From the datsheet:
-----------------
delta_V = 0.17V, 1u->10m
Let's assume Rs=5Ohm as we see later.
delta_V_internal = 0.12V

Diode equations:
----------------
I1 = Is*exp(V1/(N*Vt))
I2 = Is*exp(V2/(N*Vt))
I2/I1= exp((V2-V1))/(N*Vt))
log(I2/I1)=(V2-V1)/(N*Vt)

N=(V2-V1)/(Vt*log(I2/I1))

Values from datsheet:

V2-V1 = 0.12V, I2/I1=1e4

N = 0.12/(0.025*log(10000))= 0.2/0.025*9.21)

N = 0.5

Rs=.15V/30m = 5Ohm


My guess:

----------------------------------
.MODEL DR D ( IS=5.02f RS=5 N=0.5)
----------------------------------

Sorry, I will not spend more effort into this diode model.

Best regards,
Helmut



The original model:

http://www.diodes.com/products/spicemodels/category.php?category-id=1

*SRC=DDZ9694;DI_DDZ9694;Diodes;Zener <=10V; 8.20V 0.500W Diodes Inc.
zener
*SYM=HZEN
.SUBCKT DI_DDZ9694 1 2
* Terminals A K
D1 1 2 DF
DZ 3 1 DR
VZ 2 3 8.07
.MODEL DF D ( IS=25.1p RS=33.6 N=1.10
+ CJO=47.6p VJ=0.750 M=0.330 TT=50.1n )
.MODEL DR D ( IS=5.02f RS=34.5 N=0.223 )
.ENDS
Thanks for the good tutorial as how one gets N.
I will be getting some samples, so i can make measurements as
indicated, and calculate values that match reality and not some fakey
datasheet.
It seems that N can indeed change over temperature.
 
H

Helmut Sennewald

Jan 1, 1970
0
Robert Baer said:
Thanks for the good tutorial as how one gets N.
I will be getting some samples, so i can make measurements as indicated,
and calculate values that match reality and not some fakey datasheet.
It seems that N can indeed change over temperature.

Hello Robert,

I recommend to use 10uA and 1mA to evaluate N.
Higher current will result in a significant temperature rise
of the diode which may lead to a high measurement error.

Maybe a pulsed measuremet is necessary for higher currents like 10mA.

Best regards,
Helmut
 
R

Robert Baer

Jan 1, 1970
0
Helmut said:
Hello Robert,

I recommend to use 10uA and 1mA to evaluate N.
Higher current will result in a significant temperature rise
of the diode which may lead to a high measurement error.

Maybe a pulsed measuremet is necessary for higher currents like 10mA.

Best regards,
Helmut
Excellent point, most especially in making measurements above 125C.
 

Similar threads

B
Replies
6
Views
12K
Jim Thompson
J
I
Replies
5
Views
1K
colin
C
S
Replies
3
Views
1K
David Harmon
D
B
Replies
0
Views
915
Boris Mohar
B
Top