Electronics-Related.com
Forums

Headphone amp simulation

Started by garyr May 26, 2014
On Mon, 26 May 2014 12:40:42 -0700, "garyr" <garyr@fidalgo.net> wrote:

>[snip] > >> LTspice doesn't like those last "TEXT" lines, complaining of a syntax >> >> problem. >> >> >> >> Anyone (everyone :-) more familiar with LTspice than me, how should >> >> those library calls be corrected? >> >> > > >I'm guessing that is just the line break in "Program files" >make it single lines and it should work (if you have the libs in the same >place) > > >-Lasse > >I moved the lib files and get the same error. If I change the opamp to an >LT1055 and delete the .include statement the simulation runs (the 3rd >harmonic is -38 dB), so it would appear that the problem is with the TL082 >subcircuit. > >Netlist of TL082 version follows. > >Version 4 >SHEET 1 880 680 >WIRE 0 144 -48 144 >WIRE 160 160 64 160 >WIRE 208 160 208 128 >WIRE 0 176 -16 176 >WIRE -16 208 -16 176 >WIRE -512 240 -512 224 >WIRE -512 240 -576 240 >WIRE -576 256 -576 240 >WIRE -512 288 -512 240 >WIRE -240 288 -336 288 >WIRE -144 288 -176 288 >WIRE -48 288 -48 144 >WIRE -48 288 -64 288 >WIRE -16 288 -48 288 >WIRE 208 288 208 176 >WIRE 208 288 64 288 >WIRE 368 288 208 288 >WIRE -336 304 -336 288 >WIRE 368 304 368 288 >WIRE 208 320 208 288 >WIRE 160 400 112 400 >WIRE 208 400 208 368 >WIRE 112 432 112 400 >WIRE 208 432 208 416 >FLAG -16 208 0 >FLAG 368 384 0 >FLAG -336 384 0 >FLAG -576 256 0 >FLAG -512 144 V+ >FLAG 208 80 V+ >FLAG 32 128 V+ >FLAG -512 368 V- >FLAG 32 192 V- >FLAG 208 512 V- >FLAG 112 432 V- >FLAG 368 288 out >FLAG -336 288 in >SYMBOL res 80 272 R90 >WINDOW 0 0 56 VBottom 2 >WINDOW 3 32 56 VTop 2 >SYMATTR InstName R1 >SYMATTR Value 50k >SYMBOL res -48 272 R90 >WINDOW 0 0 56 VBottom 2 >WINDOW 3 35 66 VTop 2 >SYMATTR InstName R2 >SYMATTR Value 10k >SYMBOL res 384 400 R180 >WINDOW 0 36 76 Left 2 >WINDOW 3 36 40 Left 2 >SYMATTR InstName R3 >SYMATTR Value 32 >SYMBOL res 224 528 R180 >WINDOW 0 36 76 Left 2 >WINDOW 3 36 40 Left 2 >SYMATTR InstName R4 >SYMATTR Value 6.8 >SYMBOL cap -176 272 R90 >WINDOW 0 0 32 VBottom 2 >WINDOW 3 32 32 VTop 2 >SYMATTR InstName C1 >SYMATTR Value 1&#4294967295; >SYMBOL voltage -512 128 R0 >WINDOW 123 0 0 Left 2 >WINDOW 39 0 0 Left 2 >SYMATTR InstName V1 >SYMATTR Value 6 >SYMBOL voltage -512 272 R0 >WINDOW 123 0 0 Left 2 >WINDOW 39 0 0 Left 2 >SYMATTR InstName V2 >SYMATTR Value 6 >SYMBOL voltage -336 288 R0 >WINDOW 123 24 124 Left 2 >WINDOW 39 0 0 Left 2 >WINDOW 3 38 72 Left 2 >SYMATTR Value SINE(0 0.2 1e3) >SYMATTR InstName V3 >SYMBOL nmos4 160 80 R0 >SYMATTR InstName M1 >SYMATTR Value DN2540 >SYMBOL nmos4 160 320 R0 >SYMATTR InstName M2 >SYMATTR Value DN2540 >SYMBOL Opamps\\opamp2 32 96 R0 >SYMATTR InstName U2 >SYMATTR Value TL082 >TEXT -536 496 Left 2 !.lib C:\\myLTClib\\DN2540.lib >TEXT -536 464 Left 2 !.tran 0.1 startup uic >TEXT -536 528 Left 2 !.include C:\\myLTClib\\TL082.lib >
I did this... TEXT -536 496 Left 2 !.lib C:\PSpice\DeviceLib\Supertex\Supertex.lib TEXT -536 464 Left 2 !.tran 0.1 startup uic TEXT -536 528 Left 2 !.lib C:\PSpice\DeviceLib\TxInst\TI_OpAmps_Comparators.lib Then LTspice says... Timestep too small. Looks like TI model is poorly crafted... which is not unusual. ...Jim Thompson -- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | #BringBackOurBalls
On Sun, 25 May 2014 20:10:10 -0700, "garyr" <garyr@fidalgo.net> wrote:

>I tried to create an LTspice simulation of Jim Thompson's headphone amp >(5/21/14 5:16 PM post). I got the supertex models from supertex.com and the >TL082 model from TI. When run it produces the error message: > >Fatal Error: Port(pin) count mismatch between the definition of subcircuit >"tl082" and instance: "xu2" > The instance has more connection terminals than the definition. >
This runs quite nicely... Version 4 SHEET 1 880 680 WIRE 0 144 -48 144 WIRE 160 160 64 160 WIRE 208 160 208 128 WIRE 0 176 -16 176 WIRE -16 208 -16 176 WIRE -512 240 -512 224 WIRE -512 240 -576 240 WIRE -576 256 -576 240 WIRE -512 288 -512 240 WIRE -240 288 -336 288 WIRE -144 288 -176 288 WIRE -48 288 -48 144 WIRE -48 288 -64 288 WIRE -16 288 -48 288 WIRE 208 288 208 176 WIRE 208 288 64 288 WIRE 368 288 208 288 WIRE -336 304 -336 288 WIRE 368 304 368 288 WIRE 208 320 208 288 WIRE 160 400 112 400 WIRE 208 400 208 368 WIRE 112 432 112 400 WIRE 208 432 208 416 FLAG -16 208 0 FLAG 368 384 0 FLAG -336 384 0 FLAG -576 256 0 FLAG -512 144 V+ FLAG 208 80 V+ FLAG 32 128 V+ FLAG -512 368 V- FLAG 32 192 V- FLAG 208 512 V- FLAG 112 432 V- FLAG 368 288 out FLAG -336 288 in SYMBOL res 80 272 R90 WINDOW 0 0 56 VBottom 2 WINDOW 3 32 56 VTop 2 SYMATTR InstName R1 SYMATTR Value 50k SYMBOL res -48 272 R90 WINDOW 0 0 56 VBottom 2 WINDOW 3 35 66 VTop 2 SYMATTR InstName R2 SYMATTR Value 10k SYMBOL res 384 400 R180 WINDOW 0 36 76 Left 2 WINDOW 3 36 40 Left 2 SYMATTR InstName R3 SYMATTR Value 32 SYMBOL res 224 528 R180 WINDOW 0 36 76 Left 2 WINDOW 3 36 40 Left 2 SYMATTR InstName R4 SYMATTR Value 6.8 SYMBOL cap -176 272 R90 WINDOW 0 0 32 VBottom 2 WINDOW 3 32 32 VTop 2 SYMATTR InstName C1 SYMATTR Value 1&#4294967295; SYMBOL voltage -512 128 R0 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName V1 SYMATTR Value 6 SYMBOL voltage -512 272 R0 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName V2 SYMATTR Value 6 SYMBOL voltage -336 288 R0 WINDOW 123 24 124 Left 2 WINDOW 39 0 0 Left 2 WINDOW 3 38 72 Left 2 SYMATTR Value SINE(0 0.2 1e3) SYMATTR InstName V3 SYMBOL nmos4 160 80 R0 SYMATTR InstName M1 SYMATTR Value DN2540 SYMBOL nmos4 160 320 R0 SYMATTR InstName M2 SYMATTR Value DN2540 SYMBOL Opamps\\opamp2 32 96 R0 SYMATTR InstName U2 SYMATTR Value MyTL081 TEXT -536 496 Left 2 !.lib C:\\PSpice\\DeviceLib\\Supertex\\Supertex.lib TEXT -536 464 Left 2 !.tran 0.1 startup uic TEXT -536 528 Left 2 !.lib C:\PSpice\SymbolLib\mylib.lib You'll need to change library calls and create library for MyTL081 (unwrap as neessary)... ****************************************************************** * MyTL081 OPERATIONAL AMPLIFIER "MACROMODEL" SUBCIRCUIT (+/-15V) **** .SUBCKT MyTL081 INP INN VCC VEE OUT .PARAM GDC=200K GBW=3 SLEW=13 ROUT=100 VP=14 VN=-14 PM=45 .PARAM PI=3.141593 PMR={PM/180*PI} GBR={GBW*1E6*2*PI} DELT={(90-PM)/90} .PARAM OMEGAZ={GBR/DELT} PROCPM={(1-TAN(PMR/2))/(1+TAN(PMR/2))} L={(PROCPM-DELT)/GBR/GBR/(PROCPM-(1/DELT))} .PARAM R={(1-OMEGAZ*OMEGAZ*L)/OMEGAZ} G1 0 N2 N1 0 1 G2 N2 0 N2 N3 1 R1 N3 OUTINT {ROUT} R2 N2 0 {GDC} R3 N5 N4 {R/(sqrt(L))} ;{R} E1 N3 0 VALUE {LIMIT(V(N2),{VN},{VP})} E2 N1 0 VALUE {LIMIT(V(N4),{-(SLEW)/(2*PI*GBW)},{SLEW/(2*PI*GBW)})} E3 N5 0 INP INN 1 RE3 N5 0 100K E4 0 N6 INP INN 1 RE4 N6 0 100K C1 0 N2 {1/(2*PI*GBW*1E6)} C2 N4 N7 {sqrt(L)} ;1 L1 N7 N6 {sqrt(L)} ;{L} DP OUTINT PDV D VFP PDV OUT 0 VFN OUT NDV 0 DN NDV OUTINT D FP VCC 0 VFP 1 FN 0 VEE VFN 1 IQ VCC VEE 1.4mA .MODEL D D .ENDS MyTL081 ****************************************************************** You will note that this model (created by Yours Truly :) has none of that polynomial nonsense. ...Jim Thompson -- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | #BringBackOurBalls
[snip]
> > You'll need to change library calls and create library for MyTL081 > (unwrap as neessary)... > > ****************************************************************** > * MyTL081 OPERATIONAL AMPLIFIER "MACROMODEL" SUBCIRCUIT (+/-15V) > **** > .SUBCKT MyTL081 INP INN VCC VEE OUT > .PARAM GDC=200K GBW=3 SLEW=13 ROUT=100 VP=14 VN=-14 PM=45 > .PARAM PI=3.141593 PMR={PM/180*PI} GBR={GBW*1E6*2*PI} > DELT={(90-PM)/90} > .PARAM OMEGAZ={GBR/DELT} PROCPM={(1-TAN(PMR/2))/(1+TAN(PMR/2))} > L={(PROCPM-DELT)/GBR/GBR/(PROCPM-(1/DELT))} > .PARAM R={(1-OMEGAZ*OMEGAZ*L)/OMEGAZ} > G1 0 N2 N1 0 1 > G2 N2 0 N2 N3 1 > R1 N3 OUTINT {ROUT} > R2 N2 0 {GDC} > R3 N5 N4 {R/(sqrt(L))} ;{R} > E1 N3 0 VALUE {LIMIT(V(N2),{VN},{VP})} > E2 N1 0 VALUE {LIMIT(V(N4),{-(SLEW)/(2*PI*GBW)},{SLEW/(2*PI*GBW)})} > E3 N5 0 INP INN 1 > RE3 N5 0 100K > E4 0 N6 INP INN 1 > RE4 N6 0 100K > C1 0 N2 {1/(2*PI*GBW*1E6)} > C2 N4 N7 {sqrt(L)} ;1 > L1 N7 N6 {sqrt(L)} ;{L} > DP OUTINT PDV D > VFP PDV OUT 0 > VFN OUT NDV 0 > DN NDV OUTINT D > FP VCC 0 VFP 1 > FN 0 VEE VFN 1 > IQ VCC VEE 1.4mA > .MODEL D D > .ENDS MyTL081 > ****************************************************************** > > You will note that this model (created by Yours Truly :) has none of > that polynomial nonsense. > > ...Jim Thompson > -- > | James E.Thompson | mens | > | Analog Innovations | et | > | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | > | San Tan Valley, AZ 85142 Skype: Contacts Only | | > | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | > | E-mail Icon at http://www.analog-innovations.com | 1962 | > > #BringBackOurBalls
Success using your subcircuit! Vout was 2 volts pp. The 2nd harmonic was -63 dB, the 3rd -45, all others below -65.I used Blackman-Harris weighting, transformed 1 second of data, 3-point binomial smoothing before windowing and FFT. Without smoothing the 2nd harmonic was -45 dB, the 3rd -51, all others below -65.
On Mon, 26 May 2014 16:12:25 -0700, "garyr" <garyr@fidalgo.net> wrote:

>[snip] >> >> You'll need to change library calls and create library for MyTL081 >> (unwrap as neessary)... >> >> ****************************************************************** >> * MyTL081 OPERATIONAL AMPLIFIER "MACROMODEL" SUBCIRCUIT (+/-15V) >> **** >> .SUBCKT MyTL081 INP INN VCC VEE OUT >> .PARAM GDC=200K GBW=3 SLEW=13 ROUT=100 VP=14 VN=-14 PM=45 >> .PARAM PI=3.141593 PMR={PM/180*PI} GBR={GBW*1E6*2*PI} >> DELT={(90-PM)/90} >> .PARAM OMEGAZ={GBR/DELT} PROCPM={(1-TAN(PMR/2))/(1+TAN(PMR/2))} >> L={(PROCPM-DELT)/GBR/GBR/(PROCPM-(1/DELT))} >> .PARAM R={(1-OMEGAZ*OMEGAZ*L)/OMEGAZ} >> G1 0 N2 N1 0 1 >> G2 N2 0 N2 N3 1 >> R1 N3 OUTINT {ROUT} >> R2 N2 0 {GDC} >> R3 N5 N4 {R/(sqrt(L))} ;{R} >> E1 N3 0 VALUE {LIMIT(V(N2),{VN},{VP})} >> E2 N1 0 VALUE {LIMIT(V(N4),{-(SLEW)/(2*PI*GBW)},{SLEW/(2*PI*GBW)})} >> E3 N5 0 INP INN 1 >> RE3 N5 0 100K >> E4 0 N6 INP INN 1 >> RE4 N6 0 100K >> C1 0 N2 {1/(2*PI*GBW*1E6)} >> C2 N4 N7 {sqrt(L)} ;1 >> L1 N7 N6 {sqrt(L)} ;{L} >> DP OUTINT PDV D >> VFP PDV OUT 0 >> VFN OUT NDV 0 >> DN NDV OUTINT D >> FP VCC 0 VFP 1 >> FN 0 VEE VFN 1 >> IQ VCC VEE 1.4mA >> .MODEL D D >> .ENDS MyTL081 >> ****************************************************************** >> >> You will note that this model (created by Yours Truly :) has none of >> that polynomial nonsense. >> >> ...Jim Thompson
[snip]
> >Success using your subcircuit! Vout was 2 volts pp. The 2nd harmonic was -63 >dB, the 3rd -45, all others below -65.I used Blackman-Harris weighting, >transformed 1 second of data, 3-point binomial smoothing before windowing >and FFT. Without smoothing the 2nd harmonic was -45 dB, the 3rd -51, all >others below -65. >
I'm trying to establish myself in the business of creating behavioral Spice models... models that work properly... _and_ match the real device and the datasheet. Recently I successfully completed my first commercial behavioral modeling contract.... and I'm hoping for more... it's fun stuff ;-) ...Jim Thompson -- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | #BringBackOurBalls
"Jim Thompson" <To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> wrote in
message news:oaj7o9tqh696a3lodtri7i5m3uov8o44va@4ax.com...
> On Mon, 26 May 2014 16:12:25 -0700, "garyr" <garyr@fidalgo.net> wrote: > >>[snip] >>> >>> You'll need to change library calls and create library for MyTL081 >>> (unwrap as neessary)...
[snip]
>>> You will note that this model (created by Yours Truly :) has none of >>> that polynomial nonsense. >>> >>> ...Jim Thompson > [snip] >> >>Success using your subcircuit! Vout was 2 volts pp. The 2nd harmonic >>was -63 >>dB, the 3rd -45, all others below -65.I used Blackman-Harris weighting, >>transformed 1 second of data, 3-point binomial smoothing before windowing >>and FFT. Without smoothing the 2nd harmonic was -45 dB, the 3rd -51, all >>others below -65. >> > > I'm trying to establish myself in the business of creating behavioral > Spice models... models that work properly... _and_ match the real > device and the datasheet. > > Recently I successfully completed my first commercial behavioral > modeling contract.... and I'm hoping for more... it's fun stuff ;-) > > ...Jim Thompson > -- > | James E.Thompson | mens | > | Analog Innovations | et | > | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | > | San Tan Valley, AZ 85142 Skype: Contacts Only | | > | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | > | E-mail Icon at http://www.analog-innovations.com | 1962 | > > #BringBackOurBalls
Many thanks for your help.
On Mon, 26 May 2014 17:51:21 -0700, "garyr" <garyr@fidalgo.net> wrote:

> >"Jim Thompson" <To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> wrote in >message news:oaj7o9tqh696a3lodtri7i5m3uov8o44va@4ax.com... >> On Mon, 26 May 2014 16:12:25 -0700, "garyr" <garyr@fidalgo.net> wrote: >> >>>[snip] >>>> >>>> You'll need to change library calls and create library for MyTL081 >>>> (unwrap as neessary)... >[snip] >>>> You will note that this model (created by Yours Truly :) has none of >>>> that polynomial nonsense. >>>> >>>> ...Jim Thompson >> [snip] >>> >>>Success using your subcircuit! Vout was 2 volts pp. The 2nd harmonic >>>was -63 >>>dB, the 3rd -45, all others below -65.I used Blackman-Harris weighting, >>>transformed 1 second of data, 3-point binomial smoothing before windowing >>>and FFT. Without smoothing the 2nd harmonic was -45 dB, the 3rd -51, all >>>others below -65. >>> >> >> I'm trying to establish myself in the business of creating behavioral >> Spice models... models that work properly... _and_ match the real >> device and the datasheet. >> >> Recently I successfully completed my first commercial behavioral >> modeling contract.... and I'm hoping for more... it's fun stuff ;-) >> >> ...Jim Thompson
[snip]
> >Many thanks for your help. > >
You are quite welcome! ...Jim Thompson -- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | #BringBackOurBalls
On Monday, May 26, 2014 5:02:56 PM UTC-4, Jim Thompson wrote:
> On Sun, 25 May 2014 20:10:10 -0700, "garyr" <garyr@fidalgo.net> wrote: >=20 >=20 >=20 > >I tried to create an LTspice simulation of Jim Thompson's headphone amp >=20 > >(5/21/14 5:16 PM post). I got the supertex models from supertex.com and =
the
>=20 > >TL082 model from TI. When run it produces the error message: >=20 > > >=20 > >Fatal Error: Port(pin) count mismatch between the definition of subcircu=
it
>=20 > >"tl082" and instance: "xu2" >=20 > > The instance has more connection terminals than the definition. >=20 > > >=20 >=20 >=20 > This runs quite nicely... >=20 >=20 >=20 > Version 4 >=20 > SHEET 1 880 680 >=20 > WIRE 0 144 -48 144 >=20 > WIRE 160 160 64 160 >=20 > WIRE 208 160 208 128 >=20 > WIRE 0 176 -16 176 >=20 > WIRE -16 208 -16 176 >=20 > WIRE -512 240 -512 224 >=20 > WIRE -512 240 -576 240 >=20 > WIRE -576 256 -576 240 >=20 > WIRE -512 288 -512 240 >=20 > WIRE -240 288 -336 288 >=20 > WIRE -144 288 -176 288 >=20 > WIRE -48 288 -48 144 >=20 > WIRE -48 288 -64 288 >=20 > WIRE -16 288 -48 288 >=20 > WIRE 208 288 208 176 >=20 > WIRE 208 288 64 288 >=20 > WIRE 368 288 208 288 >=20 > WIRE -336 304 -336 288 >=20 > WIRE 368 304 368 288 >=20 > WIRE 208 320 208 288 >=20 > WIRE 160 400 112 400 >=20 > WIRE 208 400 208 368 >=20 > WIRE 112 432 112 400 >=20 > WIRE 208 432 208 416 >=20 > FLAG -16 208 0 >=20 > FLAG 368 384 0 >=20 > FLAG -336 384 0 >=20 > FLAG -576 256 0 >=20 > FLAG -512 144 V+ >=20 > FLAG 208 80 V+ >=20 > FLAG 32 128 V+ >=20 > FLAG -512 368 V- >=20 > FLAG 32 192 V- >=20 > FLAG 208 512 V- >=20 > FLAG 112 432 V- >=20 > FLAG 368 288 out >=20 > FLAG -336 288 in >=20 > SYMBOL res 80 272 R90 >=20 > WINDOW 0 0 56 VBottom 2 >=20 > WINDOW 3 32 56 VTop 2 >=20 > SYMATTR InstName R1 >=20 > SYMATTR Value 50k >=20 > SYMBOL res -48 272 R90 >=20 > WINDOW 0 0 56 VBottom 2 >=20 > WINDOW 3 35 66 VTop 2 >=20 > SYMATTR InstName R2 >=20 > SYMATTR Value 10k >=20 > SYMBOL res 384 400 R180 >=20 > WINDOW 0 36 76 Left 2 >=20 > WINDOW 3 36 40 Left 2 >=20 > SYMATTR InstName R3 >=20 > SYMATTR Value 32 >=20 > SYMBOL res 224 528 R180 >=20 > WINDOW 0 36 76 Left 2 >=20 > WINDOW 3 36 40 Left 2 >=20 > SYMATTR InstName R4 >=20 > SYMATTR Value 6.8 >=20 > SYMBOL cap -176 272 R90 >=20 > WINDOW 0 0 32 VBottom 2 >=20 > WINDOW 3 32 32 VTop 2 >=20 > SYMATTR InstName C1 >=20 > SYMATTR Value 1=EF=BF=BD >=20 > SYMBOL voltage -512 128 R0 >=20 > WINDOW 123 0 0 Left 2 >=20 > WINDOW 39 0 0 Left 2 >=20 > SYMATTR InstName V1 >=20 > SYMATTR Value 6 >=20 > SYMBOL voltage -512 272 R0 >=20 > WINDOW 123 0 0 Left 2 >=20 > WINDOW 39 0 0 Left 2 >=20 > SYMATTR InstName V2 >=20 > SYMATTR Value 6 >=20 > SYMBOL voltage -336 288 R0 >=20 > WINDOW 123 24 124 Left 2 >=20 > WINDOW 39 0 0 Left 2 >=20 > WINDOW 3 38 72 Left 2 >=20 > SYMATTR Value SINE(0 0.2 1e3) >=20 > SYMATTR InstName V3 >=20 > SYMBOL nmos4 160 80 R0 >=20 > SYMATTR InstName M1 >=20 > SYMATTR Value DN2540 >=20 > SYMBOL nmos4 160 320 R0 >=20 > SYMATTR InstName M2 >=20 > SYMATTR Value DN2540 >=20 > SYMBOL Opamps\\opamp2 32 96 R0 >=20 > SYMATTR InstName U2 >=20 > SYMATTR Value MyTL081 >=20 > TEXT -536 496 Left 2 !.lib >=20 > C:\\PSpice\\DeviceLib\\Supertex\\Supertex.lib >=20 > TEXT -536 464 Left 2 !.tran 0.1 startup uic >=20 > TEXT -536 528 Left 2 !.lib C:\PSpice\SymbolLib\mylib.lib >=20 >=20 >=20 > You'll need to change library calls and create library for MyTL081 >=20 > (unwrap as neessary)... >=20 >=20 >=20 > ****************************************************************** >=20 > * MyTL081 OPERATIONAL AMPLIFIER "MACROMODEL" SUBCIRCUIT (+/-15V) >=20 > **** >=20 > .SUBCKT MyTL081 INP INN VCC VEE OUT=20 >=20 > .PARAM GDC=3D200K GBW=3D3 SLEW=3D13 ROUT=3D100 VP=3D14 VN=3D-14 PM=3D45 >=20 > .PARAM PI=3D3.141593 PMR=3D{PM/180*PI} GBR=3D{GBW*1E6*2*PI} >=20 > DELT=3D{(90-PM)/90} >=20 > .PARAM OMEGAZ=3D{GBR/DELT} PROCPM=3D{(1-TAN(PMR/2))/(1+TAN(PMR/2))} >=20 > L=3D{(PROCPM-DELT)/GBR/GBR/(PROCPM-(1/DELT))} >=20 > .PARAM R=3D{(1-OMEGAZ*OMEGAZ*L)/OMEGAZ} >=20 > G1 0 N2 N1 0 1 >=20 > G2 N2 0 N2 N3 1 >=20 > R1 N3 OUTINT {ROUT} >=20 > R2 N2 0 {GDC} >=20 > R3 N5 N4 {R/(sqrt(L))} ;{R} >=20 > E1 N3 0 VALUE {LIMIT(V(N2),{VN},{VP})} >=20 > E2 N1 0 VALUE {LIMIT(V(N4),{-(SLEW)/(2*PI*GBW)},{SLEW/(2*PI*GBW)})} >=20 > E3 N5 0 INP INN 1 >=20 > RE3 N5 0 100K >=20 > E4 0 N6 INP INN 1=20 >=20 > RE4 N6 0 100K >=20 > C1 0 N2 {1/(2*PI*GBW*1E6)} >=20 > C2 N4 N7 {sqrt(L)} ;1 >=20 > L1 N7 N6 {sqrt(L)} ;{L} >=20 > DP OUTINT PDV D >=20 > VFP PDV OUT 0 >=20 > VFN OUT NDV 0 >=20 > DN NDV OUTINT D >=20 > FP VCC 0 VFP 1 >=20 > FN 0 VEE VFN 1 >=20 > IQ VCC VEE 1.4mA >=20 > .MODEL D D >=20 > .ENDS MyTL081 >=20 > ****************************************************************** >=20 >=20 >=20 > You will note that this model (created by Yours Truly :) has none of >=20 > that polynomial nonsense.
It is strange that none of the SPICE versions I have known and used(HSpice, NGSpice) do not handle polynomials very=20 well. Now it appears that LTSpice suffers from the same disease.
>=20 > =09 >=20 > ...Jim Thompson >=20 > --=20 >=20 > | James E.Thompson | mens | >=20 > | Analog Innovations | et | >=20 > | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | >=20 > | San Tan Valley, AZ 85142 Skype: Contacts Only | | >=20 > | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | >=20 > | E-mail Icon at http://www.analog-innovations.com | 1962 | >=20 > =20 >=20 > #BringBackOurBalls
On Monday, May 26, 2014 7:29:40 PM UTC-4, Jim Thompson wrote:
> On Mon, 26 May 2014 16:12:25 -0700, "garyr" <garyr@fidalgo.net> wrote: > > > > >[snip] > > >> > > >> You'll need to change library calls and create library for MyTL081 > > >> (unwrap as neessary)... > > >> > > >> ****************************************************************** > > >> * MyTL081 OPERATIONAL AMPLIFIER "MACROMODEL" SUBCIRCUIT (+/-15V) > > >> **** > > >> .SUBCKT MyTL081 INP INN VCC VEE OUT > > >> .PARAM GDC=200K GBW=3 SLEW=13 ROUT=100 VP=14 VN=-14 PM=45 > > >> .PARAM PI=3.141593 PMR={PM/180*PI} GBR={GBW*1E6*2*PI} > > >> DELT={(90-PM)/90} > > >> .PARAM OMEGAZ={GBR/DELT} PROCPM={(1-TAN(PMR/2))/(1+TAN(PMR/2))} > > >> L={(PROCPM-DELT)/GBR/GBR/(PROCPM-(1/DELT))} > > >> .PARAM R={(1-OMEGAZ*OMEGAZ*L)/OMEGAZ} > > >> G1 0 N2 N1 0 1 > > >> G2 N2 0 N2 N3 1 > > >> R1 N3 OUTINT {ROUT} > > >> R2 N2 0 {GDC} > > >> R3 N5 N4 {R/(sqrt(L))} ;{R} > > >> E1 N3 0 VALUE {LIMIT(V(N2),{VN},{VP})} > > >> E2 N1 0 VALUE {LIMIT(V(N4),{-(SLEW)/(2*PI*GBW)},{SLEW/(2*PI*GBW)})} > > >> E3 N5 0 INP INN 1 > > >> RE3 N5 0 100K > > >> E4 0 N6 INP INN 1 > > >> RE4 N6 0 100K > > >> C1 0 N2 {1/(2*PI*GBW*1E6)} > > >> C2 N4 N7 {sqrt(L)} ;1 > > >> L1 N7 N6 {sqrt(L)} ;{L} > > >> DP OUTINT PDV D > > >> VFP PDV OUT 0 > > >> VFN OUT NDV 0 > > >> DN NDV OUTINT D > > >> FP VCC 0 VFP 1 > > >> FN 0 VEE VFN 1 > > >> IQ VCC VEE 1.4mA > > >> .MODEL D D > > >> .ENDS MyTL081 > > >> ****************************************************************** > > >> > > >> You will note that this model (created by Yours Truly :) has none of > > >> that polynomial nonsense. > > >> > > >> ...Jim Thompson > > [snip] > > > > > >Success using your subcircuit! Vout was 2 volts pp. The 2nd harmonic was -63 > > >dB, the 3rd -45, all others below -65.I used Blackman-Harris weighting, > > >transformed 1 second of data, 3-point binomial smoothing before windowing > > >and FFT. Without smoothing the 2nd harmonic was -45 dB, the 3rd -51, all > > >others below -65. > > > > > > > I'm trying to establish myself in the business of creating behavioral > > Spice models... models that work properly... _and_ match the real > > device and the datasheet. > > > > Recently I successfully completed my first commercial behavioral > > modeling contract.... and I'm hoping for more... it's fun stuff ;-) > > > > ...Jim Thompson > > -- >
You might want to look into Verilog-AMS and on a higher level of abstraction SystemC-AMS.
> | James E.Thompson | mens | > > | Analog Innovations | et | > > | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | > > | San Tan Valley, AZ 85142 Skype: Contacts Only | | > > | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | > > | E-mail Icon at http://www.analog-innovations.com | 1962 | > > > > #BringBackOurBalls
On Mon, 26 May 2014 20:16:48 -0700 (PDT), dakupoto@gmail.com wrote:

>On Monday, May 26, 2014 7:29:40 PM UTC-4, Jim Thompson wrote: >> On Mon, 26 May 2014 16:12:25 -0700, "garyr" <garyr@fidalgo.net> wrote: >> >> >> >> >[snip] >> >> >> >> >> >> You'll need to change library calls and create library for MyTL081 >> >> >> (unwrap as neessary)... >> >> >> >> >> >> ****************************************************************** >> >> >> * MyTL081 OPERATIONAL AMPLIFIER "MACROMODEL" SUBCIRCUIT (+/-15V) >> >> >> **** >> >> >> .SUBCKT MyTL081 INP INN VCC VEE OUT >> >> >> .PARAM GDC=200K GBW=3 SLEW=13 ROUT=100 VP=14 VN=-14 PM=45 >> >> >> .PARAM PI=3.141593 PMR={PM/180*PI} GBR={GBW*1E6*2*PI} >> >> >> DELT={(90-PM)/90} >> >> >> .PARAM OMEGAZ={GBR/DELT} PROCPM={(1-TAN(PMR/2))/(1+TAN(PMR/2))} >> >> >> L={(PROCPM-DELT)/GBR/GBR/(PROCPM-(1/DELT))} >> >> >> .PARAM R={(1-OMEGAZ*OMEGAZ*L)/OMEGAZ} >> >> >> G1 0 N2 N1 0 1 >> >> >> G2 N2 0 N2 N3 1 >> >> >> R1 N3 OUTINT {ROUT} >> >> >> R2 N2 0 {GDC} >> >> >> R3 N5 N4 {R/(sqrt(L))} ;{R} >> >> >> E1 N3 0 VALUE {LIMIT(V(N2),{VN},{VP})} >> >> >> E2 N1 0 VALUE {LIMIT(V(N4),{-(SLEW)/(2*PI*GBW)},{SLEW/(2*PI*GBW)})} >> >> >> E3 N5 0 INP INN 1 >> >> >> RE3 N5 0 100K >> >> >> E4 0 N6 INP INN 1 >> >> >> RE4 N6 0 100K >> >> >> C1 0 N2 {1/(2*PI*GBW*1E6)} >> >> >> C2 N4 N7 {sqrt(L)} ;1 >> >> >> L1 N7 N6 {sqrt(L)} ;{L} >> >> >> DP OUTINT PDV D >> >> >> VFP PDV OUT 0 >> >> >> VFN OUT NDV 0 >> >> >> DN NDV OUTINT D >> >> >> FP VCC 0 VFP 1 >> >> >> FN 0 VEE VFN 1 >> >> >> IQ VCC VEE 1.4mA >> >> >> .MODEL D D >> >> >> .ENDS MyTL081 >> >> >> ****************************************************************** >> >> >> >> >> >> You will note that this model (created by Yours Truly :) has none of >> >> >> that polynomial nonsense. >> >> >> >> >> >> ...Jim Thompson >> >> [snip] >> >> > >> >> >Success using your subcircuit! Vout was 2 volts pp. The 2nd harmonic was -63 >> >> >dB, the 3rd -45, all others below -65.I used Blackman-Harris weighting, >> >> >transformed 1 second of data, 3-point binomial smoothing before windowing >> >> >and FFT. Without smoothing the 2nd harmonic was -45 dB, the 3rd -51, all >> >> >others below -65. >> >> > >> >> >> >> I'm trying to establish myself in the business of creating behavioral >> >> Spice models... models that work properly... _and_ match the real >> >> device and the datasheet. >> >> >> >> Recently I successfully completed my first commercial behavioral >> >> modeling contract.... and I'm hoping for more... it's fun stuff ;-) >> >> >> >> ...Jim Thompson >> >> -- >> >You might want to look into Verilog-AMS and on >a higher level of abstraction SystemC-AMS. >
[snip]
>> >> >> #BringBackOurBalls
Why? It won't run on any conventional simulator. ...Jim Thompson -- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | #BringBackOurBalls
On Mon, 26 May 2014 20:13:57 -0700 (PDT), dakupoto@gmail.com wrote:

>On Monday, May 26, 2014 5:02:56 PM UTC-4, Jim Thompson wrote: >> On Sun, 25 May 2014 20:10:10 -0700, "garyr" <garyr@fidalgo.net> wrote: >> >> >> >> >I tried to create an LTspice simulation of Jim Thompson's headphone amp >> >> >(5/21/14 5:16 PM post). I got the supertex models from supertex.com and the >> >> >TL082 model from TI. When run it produces the error message: >> >> > >> >> >Fatal Error: Port(pin) count mismatch between the definition of subcircuit >> >> >"tl082" and instance: "xu2" >> >> > The instance has more connection terminals than the definition. >> >> > >> >> >> >> This runs quite nicely... >> >> >> >> Version 4 >> >> SHEET 1 880 680 >> >> WIRE 0 144 -48 144 >> >> WIRE 160 160 64 160 >> >> WIRE 208 160 208 128 >> >> WIRE 0 176 -16 176 >> >> WIRE -16 208 -16 176 >> >> WIRE -512 240 -512 224 >> >> WIRE -512 240 -576 240 >> >> WIRE -576 256 -576 240 >> >> WIRE -512 288 -512 240 >> >> WIRE -240 288 -336 288 >> >> WIRE -144 288 -176 288 >> >> WIRE -48 288 -48 144 >> >> WIRE -48 288 -64 288 >> >> WIRE -16 288 -48 288 >> >> WIRE 208 288 208 176 >> >> WIRE 208 288 64 288 >> >> WIRE 368 288 208 288 >> >> WIRE -336 304 -336 288 >> >> WIRE 368 304 368 288 >> >> WIRE 208 320 208 288 >> >> WIRE 160 400 112 400 >> >> WIRE 208 400 208 368 >> >> WIRE 112 432 112 400 >> >> WIRE 208 432 208 416 >> >> FLAG -16 208 0 >> >> FLAG 368 384 0 >> >> FLAG -336 384 0 >> >> FLAG -576 256 0 >> >> FLAG -512 144 V+ >> >> FLAG 208 80 V+ >> >> FLAG 32 128 V+ >> >> FLAG -512 368 V- >> >> FLAG 32 192 V- >> >> FLAG 208 512 V- >> >> FLAG 112 432 V- >> >> FLAG 368 288 out >> >> FLAG -336 288 in >> >> SYMBOL res 80 272 R90 >> >> WINDOW 0 0 56 VBottom 2 >> >> WINDOW 3 32 56 VTop 2 >> >> SYMATTR InstName R1 >> >> SYMATTR Value 50k >> >> SYMBOL res -48 272 R90 >> >> WINDOW 0 0 56 VBottom 2 >> >> WINDOW 3 35 66 VTop 2 >> >> SYMATTR InstName R2 >> >> SYMATTR Value 10k >> >> SYMBOL res 384 400 R180 >> >> WINDOW 0 36 76 Left 2 >> >> WINDOW 3 36 40 Left 2 >> >> SYMATTR InstName R3 >> >> SYMATTR Value 32 >> >> SYMBOL res 224 528 R180 >> >> WINDOW 0 36 76 Left 2 >> >> WINDOW 3 36 40 Left 2 >> >> SYMATTR InstName R4 >> >> SYMATTR Value 6.8 >> >> SYMBOL cap -176 272 R90 >> >> WINDOW 0 0 32 VBottom 2 >> >> WINDOW 3 32 32 VTop 2 >> >> SYMATTR InstName C1 >> >> SYMATTR Value 1&#65533; >> >> SYMBOL voltage -512 128 R0 >> >> WINDOW 123 0 0 Left 2 >> >> WINDOW 39 0 0 Left 2 >> >> SYMATTR InstName V1 >> >> SYMATTR Value 6 >> >> SYMBOL voltage -512 272 R0 >> >> WINDOW 123 0 0 Left 2 >> >> WINDOW 39 0 0 Left 2 >> >> SYMATTR InstName V2 >> >> SYMATTR Value 6 >> >> SYMBOL voltage -336 288 R0 >> >> WINDOW 123 24 124 Left 2 >> >> WINDOW 39 0 0 Left 2 >> >> WINDOW 3 38 72 Left 2 >> >> SYMATTR Value SINE(0 0.2 1e3) >> >> SYMATTR InstName V3 >> >> SYMBOL nmos4 160 80 R0 >> >> SYMATTR InstName M1 >> >> SYMATTR Value DN2540 >> >> SYMBOL nmos4 160 320 R0 >> >> SYMATTR InstName M2 >> >> SYMATTR Value DN2540 >> >> SYMBOL Opamps\\opamp2 32 96 R0 >> >> SYMATTR InstName U2 >> >> SYMATTR Value MyTL081 >> >> TEXT -536 496 Left 2 !.lib >> >> C:\\PSpice\\DeviceLib\\Supertex\\Supertex.lib >> >> TEXT -536 464 Left 2 !.tran 0.1 startup uic >> >> TEXT -536 528 Left 2 !.lib C:\PSpice\SymbolLib\mylib.lib >> >> >> >> You'll need to change library calls and create library for MyTL081 >> >> (unwrap as neessary)... >> >> >> >> ****************************************************************** >> >> * MyTL081 OPERATIONAL AMPLIFIER "MACROMODEL" SUBCIRCUIT (+/-15V) >> >> **** >> >> .SUBCKT MyTL081 INP INN VCC VEE OUT >> >> .PARAM GDC=200K GBW=3 SLEW=13 ROUT=100 VP=14 VN=-14 PM=45 >> >> .PARAM PI=3.141593 PMR={PM/180*PI} GBR={GBW*1E6*2*PI} >> >> DELT={(90-PM)/90} >> >> .PARAM OMEGAZ={GBR/DELT} PROCPM={(1-TAN(PMR/2))/(1+TAN(PMR/2))} >> >> L={(PROCPM-DELT)/GBR/GBR/(PROCPM-(1/DELT))} >> >> .PARAM R={(1-OMEGAZ*OMEGAZ*L)/OMEGAZ} >> >> G1 0 N2 N1 0 1 >> >> G2 N2 0 N2 N3 1 >> >> R1 N3 OUTINT {ROUT} >> >> R2 N2 0 {GDC} >> >> R3 N5 N4 {R/(sqrt(L))} ;{R} >> >> E1 N3 0 VALUE {LIMIT(V(N2),{VN},{VP})} >> >> E2 N1 0 VALUE {LIMIT(V(N4),{-(SLEW)/(2*PI*GBW)},{SLEW/(2*PI*GBW)})} >> >> E3 N5 0 INP INN 1 >> >> RE3 N5 0 100K >> >> E4 0 N6 INP INN 1 >> >> RE4 N6 0 100K >> >> C1 0 N2 {1/(2*PI*GBW*1E6)} >> >> C2 N4 N7 {sqrt(L)} ;1 >> >> L1 N7 N6 {sqrt(L)} ;{L} >> >> DP OUTINT PDV D >> >> VFP PDV OUT 0 >> >> VFN OUT NDV 0 >> >> DN NDV OUTINT D >> >> FP VCC 0 VFP 1 >> >> FN 0 VEE VFN 1 >> >> IQ VCC VEE 1.4mA >> >> .MODEL D D >> >> .ENDS MyTL081 >> >> ****************************************************************** >> >> >> >> You will note that this model (created by Yours Truly :) has none of >> >> that polynomial nonsense. >It is strange that none of the SPICE >versions I have known and used(HSpice, >NGSpice) do not handle polynomials very >well. Now it appears that LTSpice suffers >from the same disease. > >> >> >> >> ...Jim Thompson
[snip] It think it's more like that the authors have no clue. There's nothing inherently wrong with a polynomial representation. ...Jim Thompson -- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | #BringBackOurBalls