1. 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.
    Dismiss Notice

LM317 Spice Model?

Discussion in 'General Electronics Chat' started by adamthole, Oct 19, 2005.

  1. adamthole

    adamthole New Member

    Joined:
    Apr 24, 2005
    Messages:
    133
    Likes:
    0
    Location:
    Indiana, United States
    I'm working on a power supply simulation and I can't find an LM317 spice model. I've searched and found the code for what I think is the spice model, but I couldn't get it to work correctly. I am using MultiSim 8, and SwitcherCad III. The model for either or both would be awesome or instructions on how to import the spice code into a component on either would be awesome.

    Thanks!
     
  2. Optikon

    Optikon New Member

    Joined:
    Sep 23, 2003
    Messages:
    1,729
    Likes:
    2
    Location:
    Cleveland, OH, U.S.A.
    Hopefully you can cut & paste. This is Texas Instruments' transistor level model. It is most accurate.

    .SUBCKT LM317/TI in adj out
    * PEI 08/98 p62
    J1 in out 4 JN
    Q2 5 5 6 QPL .1
    Q3 5 8 9 QNL .2
    Q4 8 5 7 QPL .1
    Q5 81 8 out QNL .2
    Q6 out 81 10 QPL .2
    Q7 12 81 13 QNL .2
    *Q8 10 5 11 QPL .2
    Q8 10A 5 11 QPL .2
    Q9 14 12 10 QPL .2
    Q10 16 5 17 QPL .2
    Q11 16 14 15 QNL .2 OFF
    Q12 out 20 16 QPL .2
    Q13 in 19 20 QNL .2
    Q14 19 5 18 QPL .2
    Q15 out 21 19 QPL .2
    Q16 21 22 16 QPL .2
    Q17 21 out 24 QNL .2
    Q18 22 22 16 QPL .2
    Q19 22 out 241 QNL .2
    Q20 out 25 16 QPL .2
    Q21 25 26 out QNL .2
    Q22A 35 35 in QPL .2
    Q22B 16 35 in QPL .2
    Q23 35 16 30 QNL .2
    Q24A 27 40 29 QNL .2
    Q24B 27 40 28 QNL .2
    Q25 in 31 41 QNL 5
    Q26 in 41 32 QNL 50
    D1 out 4 DZ
    D2 33 in DZ
    D3 29 34 DZ
    R1 in 6 310
    R2 in 7 310
    R3 in 11 190
    R4 in 17 82
    R5 in 18 5.6K
    R6 4 8 100K
    R7 8 81 130
    *R8 10 12 12.4K
    R8 10A 12 12.4K
    R9 9 out 180
    R10 13 out 4.1K
    R11 14 out 5.8K
    R12 15 out 72
    R13 20 out 5.1K
    R14 adj 24 12K
    R15 24 241 2.4K
    R16 16 25 6.7K
    R17 16 40 12K
    R18 30 41 130
    R19 16 31 370
    R20 26 27 13K
    R21 27 40 400
    R22 out 41 160
    R23 33 34 18K
    R24 28 29 160
    R25 28 32 3
    R26 32 out .1
    C1 21 out 30PF
    C2 21 adj 30PF
    C3 25 26 5PF
    CBS1 5 out 2PF
    CBS2 35 out 1PF
    CBS3 22 out 1PF
    .MODEL JN NJF (BETA=1E-4 VTO=-7)
    .MODEL DZ D(BV=6.3)
    .MODEL QNL NPN (EG=1.22 BF=80 RB=100 CCS=1.5PF TF=.3NS TR=6NS
    + CJE=2PF CJC=1PF VAF=100 IS=1E-22 NF=1.2)
    .MODEL QPL PNP (BF=40 RB=20 TF=.6NS TR=10NS CJE=1.5PF CJC=1PF VAF=50
    + IS=1E-22 NF=1.2)
    .ENDS LM317/TI
     
  3. Optikon

    Optikon New Member

    Joined:
    Sep 23, 2003
    Messages:
    1,729
    Likes:
    2
    Location:
    Cleveland, OH, U.S.A.
    I have behavioral model as well if you need only basic functionality and faster sim time.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. adamthole

    adamthole New Member

    Joined:
    Apr 24, 2005
    Messages:
    133
    Likes:
    0
    Location:
    Indiana, United States

    Thanks for the model. I cut and pasted it into Multisim, and I got no errors when I ran the program...however my circuit didn't work correctly (no voltage at output). I probably assigned the pins to the wrong locations. Is their a good tutorial for importing spice code into multisim somewhere? I did some searches and just got ewb's site talking about how great multisim is.

    I would also like to understand the spice code itself, any good site you reccomend for a brief overview of that?

    Thanks!
     
  6. audioguru

    audioguru Well-Known Member Most Helpful Member

    Joined:
    Mar 16, 2004
    Messages:
    32,437
    Likes:
    933
    Location:
    Canada, of course!
    ONLINE
    Maybe Spice knows that if an LM317 is trying to dissipate more heat than its heatsink can cool, then it shuts-down with zero volts on the output.
     
  7. adamthole

    adamthole New Member

    Joined:
    Apr 24, 2005
    Messages:
    133
    Likes:
    0
    Location:
    Indiana, United States
  8. simon.harpham@ieee.org

    simon.harpham@ieee.org New Member

    Joined:
    Dec 3, 2009
    Messages:
    1
    Likes:
    0
    simon.harpham@ieee.org

    You might like to try changing the saturation current for QNL and QNP models from IS=1E-22 to IS=6E-13. You will then get the correct reference voltage of 1.25V.

    Although this model is supposed to be for the LM317K (TO3 version) you will find that its limiting current is about 0.7 amps with the netlist given, rather than the 1.5A expected, therefore it is closer to the LM317H, E or MDT versions.

    You will also have to add a reversed biased 1N4001 across the Adj to output pins to get the correct hard limiting behaviour.
     
  9. 1JAMES

    1JAMES New Member

    Joined:
    Apr 17, 2011
    Messages:
    1
    Likes:
    0
    Lm317

    I was able to fine lm317 after a long search
    in ver. 11 click on (place alaog) then (select all families) scroll down
    hope this helps
     
  10. Zabb Csaba

    Zabb Csaba New Member

    Joined:
    Jun 20, 2014
    Messages:
    28
    Likes:
    0
    Location:
    Hungary
    LM317 spice model:

    .SUBCKT LM317 1 2 3
    * IN OUT ADJ
    IADJ 1 4 50U
    VREF 4 3 1.25
    RC 1 14 0.742
    DBK 14 13 D1
    CBC 13 15 2.479N
    RBC 15 5 247
    QP 13 5 2 Q1
    RB2 6 5 124
    DSC 6 11 D1
    ESC 11 2 POLY(2) (13,5) (6,5) 2.85
    + 0 0 0 -70.1M
    DFB 6 12 D1
    EFB 12 2 POLY(2) (13,5) (6,5) 3.92
    + -135M 0 1.21M -70.1M
    RB1 7 6 1
    EB 7 2 8 2 2.56
    CPZ 10 2 0.796U
    DPU 10 2 D1
    RZ 8 10 0.104
    RP 9 8 100
    EP 9 2 4 2 103.6
    RI 2 4 100MEG
    .MODEL Q1 NPN (IS=30F BF=100
    + VAF=14.27 NF=1.604)
    .MODEL D1 D (IS=30F N=1.604)
    .ENDS LM317
     
    Last edited: Jun 20, 2014
  11. crutschow

    crutschow Well-Known Member Most Helpful Member

    Joined:
    Mar 14, 2008
    Messages:
    10,592
    Likes:
    477
    Location:
    L.A., USA Zulu -8
    In my LTspice model I found that changing the saturation current for QNL and QNP models to IS=6E-16 gave the correct reference of 1.25V.

    I also reduced the value of R26 to .06 ohms to get an output short-circuit current of about 1.5A

    I think my model is the same as the one Optikon posted.
     
    Last edited: Jun 21, 2014
  12. crutschow

    crutschow Well-Known Member Most Helpful Member

    Joined:
    Mar 14, 2008
    Messages:
    10,592
    Likes:
    477
    Location:
    L.A., USA Zulu -8
    I believe you're just trying to emphasize one of the limitations of a Spice simulation. :rolleyes: Since there's no way to put the thermal impedance of a device and its heatsink into Spice it obviously can't simulate the thermal current limit of the device. But LTspice certainly can calculate and display the power dissipation of the device so you can design the heatsink accordingly. It can even calculate the average power for an input voltage with significant ripple.
     
    Last edited: Jun 21, 2014
  13. eTech

    eTech Active Member

    Joined:
    Apr 25, 2012
    Messages:
    561
    Likes:
    43
    Hi

    I couldn't get either of these suggestions to work on the spice subckt in post #2:confused:

    eT:)
     
  14. crutschow

    crutschow Well-Known Member Most Helpful Member

    Joined:
    Mar 14, 2008
    Messages:
    10,592
    Likes:
    477
    Location:
    L.A., USA Zulu -8
    Here's my LTspice LM317 file that works for me.

    LM317.sub
     

    Attached Files:

Share This Page