Electronics > Projects, Designs, and Technical Stuff
LTSpice XVII sweeping or stepping subckt parameters
chris_leyson:
I'm trying to do monte carlo and/or worst case analysis for a digital transistor and I would like to step the resistor values over their tolerance range but after googling for a day I've got nowhere. Last resort would be removing the resistors from the sub circuit and just save the transistor model into standard.bjt and then tweak external resistors. Do I need to edit the model and add a PARAM variable to the following, R1 2 Base Rb 10k, R2 Base 3 Re 10k ? DTC114EE sub circuit, courtesy of ROHM below.
--- Code: ---* DTC114EE DIGITAL NPN BJT model
* Date: 2007/01/11
* BJT with resistors
*****************C B E
.SUBCKT DTC114EE 1 2 3
R1 2 Base Rb 10k
R2 Base 3 Re 10k
Q1 1 Base 3 QDTC1
.MODEL Rb RES
+ R=1
.MODEL Re RES
+ R=1
.MODEL QDTC1 NPN
+ IS=20.000E-15
+ BF=198.80
+ VAF=15
+ IKF=.28787
+ ISE=20.001E-15
+ NE=1.6289
+ BR=8.4556
+ VAR=100
+ IKR=.2645
+ ISC=8.0686E-12
+ NC=2.3678
+ NK=.75224
+ RE=.2
+ RB=10.670
+ RC=1.1274
+ CJE=11.342E-12
+ MJE=.38289
+ CJC=4.0230E-12
+ MJC=.34629
+ TF=500.00E-12
+ XTF=580.91
+ VTF=195.13
+ ITF=19.351
+ TR=200.00E-9
+ XTB=1.5000
.ENDS DTC114EE
--- End code ---
Ian.M:
That's what you *should* do if you want it clean. See LTspice help file: '.PARAM -- User-Defined Parameters' for an example of passing parameters to a subcircuit. You'd probably also want to parameterize the gain.
Its already been half-way set up for it with:
--- Code: ---.MODEL Rb RES
+ R=1
.MODEL Re RES
+ R=1
--- End code ---
The '1' in those two model statements is a unity multiplier for the values in the R1 and R2 component lines respectively.
Try:
--- Code: ---* DTC114EE DIGITAL NPN BJT model
* Date: 2007/01/11 mod. 2020/09/04 Ian.M
* BJT with resistors, parameterized for Monte Carlo
*****************C B E
.SUBCKT DTC114EE 1 2 3
.params Krb=1 Kre=1 Kbeta=1 ; default to unit multiplier
R1 2 Base Rb 10k
R2 Base 3 Re 10k
Q1 1 Base 3 QDTC1
.MODEL Rb RES
+ R={Krb}
.MODEL Re RES
+ R={Kre}
.MODEL QDTC1 NPN
+ IS=20.000E-15
+ BF={198.80*Kbeta}
+ VAF=15
+ IKF=.28787
+ ISE=20.001E-15
+ NE=1.6289
+ BR=8.4556
+ VAR=100
+ IKR=.2645
+ ISC=8.0686E-12
+ NC=2.3678
+ NK=.75224
+ RE=.2
+ RB=10.670
+ RC=1.1274
+ CJE=11.342E-12
+ MJE=.38289
+ CJC=4.0230E-12
+ MJC=.34629
+ TF=500.00E-12
+ XTF=580.91
+ VTF=195.13
+ ITF=19.351
+ TR=200.00E-9
+ XTB=1.5000
.ENDS DTC114EE
--- End code ---
Then you can pass in per-instance parameters to your DTC114EE model, set in the generic Component Attribute Editor:
e.g.
--- Code: ---Krb=1.1 Kre=0.9 Kbeta=0.8
--- End code ---
which gives you a DTC114EE with its series base resistor 10% high, its shunt base resistor 10% low and 20% below nominal gain, or for your specific application you'd need to use multipliers derived from your Monte Carlo or Worst Case functions.
Jay_Diddy_B:
Hi,
Here is one solution:
and the results:
I have attached the LTspice model
Regards,
Jay_Diddy_B
parameter sweep digital transistor.asc (1.79 kB - downloaded 72 times.)
Ian.M:
Yes, but my way you don't need to know at the schematic level that the internal R1 (Rb)and R2 (Rbe) are meant to be 10K, just use:
--- Code: ---Krb=mc(1,0.1) Kre=mc(1,0.1)
--- End code ---
Jay_Diddy_B:
Hi,
@Ian.M
+1
Both will get the job done for the OP.
I have expanded my version to include BF variation:
I would encourage you to but the model on the schematic, so that it is portable.
Jay_Diddy_B
parameter sweep digital transistor with BF.asc (2.09 kB - downloaded 80 times.)
Navigation
[0] Message Index
[#] Next page
Go to full version