Hallo all
Have sombody an LM317 HV with Spice fore me?
I only find the normale without spice.
Please help me
Rgds Ralph
i finde this ngspice Data to LT317:
*LM317 TI voltage regulator - pin order: In, Adj, Out
*TI adjustable voltage regulator pkg:TO-3
.SUBCKT LM317 1 2 3 Changes my be required on this line
J1 1 3 4 JN
Q2 5 5 6 QPL .1
Q3 5 8 9 QNL .2
Q4 8 5 7 QPL .1
Q5 81 8 3 QNL .2
Q6 3 81 10 QPL .2
Q7 12 81 13 QNL .2
Q8 10 5 11 QPL .2
Q9 14 12 10 QPL .2
Q10 16 5 17 QPL .2
Q11 16 14 15 QNL .2
Q12 3 20 16 QPL .2
Q13 1 19 20 QNL .2
Q14 19 5 18 QPL .2
Q15 3 21 19 QPL .2
Q16 21 22 16 QPL .2
Q17 21 3 24 QNL .2
Q18 22 22 16 QPL .2
Q19 22 3 241 QNL 2
Q20 3 25 16 QPL .2
Q21 25 26 3 QNL .2
Q22A 35 35 1 QPL 2
Q22B 16 35 1 QPL 2
Q23 35 16 30 QNL 2
Q24A 27 40 29 QNL .2
Q24B 27 40 28 QNL .2
Q25 1 31 41 QNL 5
Q26 1 41 32 QNL 50
D1 3 4 DZ
D2 33 1 DZ
D3 29 34 DZ
R1 1 6 310
R2 1 7 310
R3 1 11 190
R4 1 17 82
R5 1 18 5.6K
R6 4 8 100K
R7 8 81 130
R8 10 12 12.4K
R9 9 3 180
R10 13 3 4.1K
R11 14 3 5.8K
R12 15 3 72
R13 20 3 5.1K
R14 2 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 3 41 160
R23 33 34 18K
R24 28 29 160
R25 28 32 3
R26 32 3 .1
C1 21 3 30PF
C2 21 2 30PF
C3 25 26 5PF
CBS1 5 3 2PF
CBS2 35 3 1PF
CBS3 22 3 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)
.MODEL QPL PNP(BF=40 RB=20 TF=.6NS TR=10NS CJE=1.5PF CJC=1PF VAF=50)
.ENDS LM317 changes may be required on this line
They would likely need the source of the spice data to make a part. Many of the spice models have restrictive copyrights which make it illegal to distribute parts with the spice model in them (unless you make the changes for your own use and don’t distribute it.)
Peter
I find the Data at github, but i dont know how i must use it to build a Part with spice.
Here the Link to github:
Rgds Ralph
@fai would be the person to answer that. I know a little bit about adding spice models to parts but he is the expert. This is a fairly complex model and that may be a problem, also the copyright situation is unclear as the person on github is unlikely to be the author, it would be safer to find a manufacturers site with the data (and the associated copyright notices if any!) I would hesitate to add spice data to a part without a clear understanding of the copyright on the model (as I would be liable in the case of a legal challenge) the Fritzing team is in the same situation, they don’t want to get sued. You can do it for your own use usually (and if you don’t distribute it, there isn’t likely to be an issue) but it isn’t easy adding spice to parts (or for that matter making parts in general.)
Peter
Maybe a part with minimal or dummy spice data would be the way to go. It should not be that difficult to paste in updated spice data for your own use.
A ‘better’ solution would be to have a way to point Fritzing (or the specific part) to external spice models. Which would need code changes. Some design will be needed, to figure out how to cleanly pass the fritzing part information (from inspector) into the model. EG voltage.
I have no idea how to insert spice data even as a dummy.
But this part is important, and I think it’s not just me who needs it.
There are many users who use this part because it is simply good.
So how can I enter dummy data so that the part works in the simulator please.
Greetings Ralph
My information is that the spice data is just text, and needs to be in a ‘block’ in the fzp file (part of a Fritzing part). If a part is created (something that @vanepp does regularly) with that special block, then someone else could later edit the fzp file to paste in the ‘personal use’ model information to create a custom version of that part. Given what I saw here about copyright, each user would have to create their own part. The fzp file is xml, which is also ‘just text’.
It probably would not take a lot to automate that. A program to open the part file, insert the spice model (from a file the user provides), and create a new version of the part. As long as the part is already structured to accept it.
Hi,
I am busy this week and I cannot look at this at the moment. You can try to do it by yourself. Steps:
- Choose a part to add the spice code and save it as new part. To do this, right click in the icon on the part panel and select edit part and later save as new part. Then, the new part should appear in the mine bin.
- Export the new part. Go to the mine bin and right click on the part and select export part. Save it in a folder and you will have a .fzpz part.
- Unzip the .fzpz part using for example 7zip. Then, you will see all the SVG files and a fzp file.
- Add the Spice code in the fpz file. Use a text editor to edit the fpz file. See more instructions below about how to add the Spice code.
- After adding the spice code, zip all the SVGs and the fpz file together. And rename the zip extension to fzpz.
Regarding how to add spice code to the parts. In the pfz file, you will see the xml format like this:
<properties>
<property name="family">voltage source</property>
<property name="type">dc power supply</property>
<property name="voltage" showInLabel="yes">5V</property>
<property name="internal resistance">0.1Ω</property>
</properties>
<taxonomy>discreteParts.power.power.dcpower</taxonomy>
<description>A generic dc power symbol</description>
<spice>
<line>V{instanceTitle} {net connector1}_{instanceTitle}_aux {net connector0} DC {voltage}</line>
<line>R{instanceTitle} {net connector1}_{instanceTitle}_aux {net connector1} {internal resistance}</line>
</spice>
<views>
<iconView>
If there is no spice section, you should create one. For the LM317, you will likely find a subcircuit.
<spice>
*X317TI IN ADJ OUT_0 OUT_1 NAMEOFSUBCIRKUIT
<line>XLM317{instanceTitle} {net connector2} {net connector0} {net connector1} LM317</line>
<model>PASTE HERE ALL THE SUBCIRCUIT</line>
</spice>
Note that {net connector2} {net connector0} {net connector1} specifies the order of the legs and should match the order in the spice model. conector 1 should be the outputr leg, etc.
If you follow the example found here, it should look like:
<spice>
<line>X317TI{instanceTitle} {net connector2} {net connector0} {net connector1} {net connector1} LM317_TRANS</line>
<model>PASTE MODEL FROM https://www.ti.com/lit/zip/slvmc40
</model>
</spice>
Good luck!
Hy fai
when you find the Time to make this Pice then all is ok.
I am do not can make it, i try but nothing passt.
Rgds Ralph
Sorry, I do not have good news. (Edited, good news, see next message)
I had a quick look and it seems that both spice models that we found are PSPICE models. Fritzing uses ngspice, which offers a compatibility mode for PSPICE models. However, we need to activate it and currently there is no way of doing it in Fritzing 1.0.4. I will try to implement a switch to be able to select the compatibility mode, but it could take a while and after that it needs to be added to the release. So, it will not happen soon. Let me know if you find other Spice models for the LM317.
Ok, now the good news.
There is a way to force ngspice in PSPICE compatibility mode. To do that, create a TXT file called .spiceinit file in your user directory (C:\Users<your_user_name>). The file should contain the following text:
* User defined ngspice init file
set ngbehavior = psa
After the file is created in a text editor, remember to remove the “.txt” extension. It must not contain any extension or it will not work.
After that, you can open this project that has the LM317 with the spice model that you found.
LM317.fzz (11.3 KB)
And the output voltage changes when you change the knob of the potentiometer, as expected. See below:
A google search for “Pspice model lm317 equivalent” (with spice hits suppressed) comes up with a a pSpice model at TI (one appears to be encrypted and one not)
the spice models are at the bottom of the datasheet, I don’t know the copyright status, but the last TI spice models I looked at were “use at your own risk” which appeared to mean copyright free.
Peter