Continue to Site

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.

  • 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.

Spice Help Please.

Status
Not open for further replies.

kinarfi

Well-Known Member
Here's what I have done, went to International Rectifier's web site and copied the IRF4905PBF spice file and saved it as IRF4905PBF.txt using Note Pad. Copied that and renamed it IRF4905PBF.sub and again as IRF4905PBF.mod.
Now what do I do. Move it some where? How do I call it up in the sim. I've tried, but I'm finally giving up and asking for help.
Thanks,
Kinarfi
 

Attachments

  • IRF4905PBF.txt
    1.7 KB · Views: 504
What version of Spice are you using?

Does it use .mod for the model files? If so then just do a search in you computer for other .mod files. Then put your new file in the same directory.
 
Last edited:
LT Spice IV, Version 4.10A

Evidently not, the only .mod files are ones I put in.
Kinarfi
 
Last edited:
Step 1. Put the text file containing the downloaded model in the same subdirectory as where your .asc file is. Doesn't matter what it is named, as long as you can remember it.

Step two. Insert a PMOS symbol into your .asc schematic just as though you were adding one that is known to LTSpice.

Step three. Hold the CTRL key while right-clicking on the PMOS symbol you just placed. The Component Attribute Editor pops up.

Step four. Place cursor over the first line Value where it says MP, doubleclick, and change it to X

Step five. Place cursor over the forth line Value where it says PMOS, doubleclick, and change it to IRF4905 (This field must match the name following the .SUBCKT in the downloaded model file.)

Step Six. Hook up the circuit.

Step Seven. Click on the .OP button in the toolbar, type .INCLUDE IRF4905BPF.TXT (or whatever you named it) and then insert that onto the schematic.

I have included a zip of the subdirectory of where I did this. Unzip it into a new subdirectory, and you should be able to rerun the sim. I also saved the plot window, so that should appear as soon as the sim stops.

btw- the sim shows the dissipation (complex red trace) as the PFET switches on and off. Care to guess why it is so high?
 

Attachments

  • KinFet.png
    KinFet.png
    33.6 KB · Views: 535
  • Kinarfi.zip
    33.6 KB · Views: 353
Last edited:
Thank You Very Very much, Mike!!
Had a few problems with typos, like the . in front of include and in copying the .txt file over, but eventually, it worked, now I have other files to move in with my .asc files.
I recognized the voltage plot from when I was working on my Power Steering project, which works good, FYI, as the Miller Effect. Didn't think on it much then, but the power curve got me thinking. Let me see if I can describe what's happening.

Starting out with 10 amps flowing through the FET to the lamps, Vsd is min, Vgs is max. Gate voltage is removed, gate charge starts do decrease, Ron starts to rise, current starts to drop, Vsd starts to rise. Max power dissipation happens as current and Vsd reach 50% of their max and the plots cross. The rising Vds probably effects the effect that the decreasing gate charge has by causing the FET act as if the gate charge was decreasing slower than it is and thus the knee on the plots.
I added the Vsd, V(N002,out) and the I(R1) plots which help me to see what happening a little better.
That how I see, am I close?
Thanks for the help and thanks for the lessons.
Kinarfi, Fly Safe
 

Attachments

  • FET- Miller.PNG
    FET- Miller.PNG
    28 KB · Views: 459
Given the value of R2 and the amount of gate capacitance noted in the datasheet, what does that imply to you vis-a-vis the gate charge you noted? Now run the same sim with R2 at 100 ohms vice 1k and see what happens to the power that must be dissipated.
 
Not sure what your asking, what you mean by "vis-a-vis", I assume run 100 ohms "vice" means "instead of" which bleeds of the gate charge quicker, but causes my sim to take for ever to run, but 110 ohms works fine. Also makes for a shorter period of power dissipation.
Kinarfi
 
Last edited:
Not sure what your asking, what you mean by "vis-a-vis", I assume run 100 ohms "vice" means "instead of" which bleeds of the gate charge quicker, but causes my sim to take for ever to run, but 110 ohms works fine. Also makes for a shorter period of power dissipation.
Kinarfi

Sorry for the confusion. The French phrase vis-à-vis literally means face to face and refers to a relationship of one thing to another, a counterpart and/or a like function or characteristic, and vice can mean an exchange of one thing, value, concept, etc. for another.

Below I have included two graphs with four traces; the trigger pulse V(in), the voltage drop across the MosFet V(12v)-V(Out), the absolute value of the drain current abs(1x(U1:D)) and the absolute value of the power loss of the MosFet abs(Ix(U1:D)*{V(12v)-V(out)}). One has R2 at 1K and the other has R2 at 100.

What I was trying to get you to see was the relationship between the gate charge and discharge and the resistance of R1 and R2. The gate charge and discharge period is the period of the greatest power loss as the device shifts from one state to the other. Graphing the drain current times the voltage drop across the device during the entire cycle displays the instantaneous power loss of the device over the period.

Note the extended time it takes for the MosFet to completely turn off as a result of the RC time of the gate capacitance and the value of R2 at 1K in the first plot and the very much abbreviated time with R2 at 100 in the second plot with relationship of the trigger pulse in both. Also of note is the delta in Ton in both plots.

I hope I have brought some clarity on the subject for you. Also, if you'd like the symbol file for the IRF4905 let me know and I'll post it.
 

Attachments

  • MosFet 1K Plot.jpg
    MosFet 1K Plot.jpg
    182.7 KB · Views: 411
  • MosFet 100 Ohm Plot.jpg
    MosFet 100 Ohm Plot.jpg
    178.1 KB · Views: 549
MRCecil, Thanks and yes, Please post your symbol file for the IRF4905, even if I have it, I can make sure mine is correct. I understand the power dissipation during transition from on to off and off to on. Is my thinking that the the knee (circled in white on drawing) in the voltage across Vsd is do the change of voltage, Vsd, and acts as if gate discharge is decreasing slower than it actual is, assuming that is constant, Or does the gate discharge rate actually slow down? Or is it something else entirely that causes that knew?
Thanks again,
Kinarf
 

Attachments

  • untitled1.png
    untitled1.png
    97.6 KB · Views: 390
a
I understand the power dissipation during transition from on to off and off to on. Is my thinking that the the knee (circled in white on drawing) in the voltage across Vsd is do the change of voltage, Vsd, and acts as if gate discharge is decreasing slower than it actual is, assuming that is constant, Or does the gate discharge rate actually slow down? Or is it something else entirely that causes that knew?

Actually, the plot that you circled is the absolute value drain current. The V(12v)- V(out) plot is the voltage across the MosFet.

Think about it this way. Which terminal of the device controls Isd? To change the state of that switch, a charge, Q, must be pumped into and/or out of the gate to change the gate potential to change the conduction state. This essentially boils down to a RC circuit with the gate charging via R1 and discharging via R2. The rate of change of the gate potential is directly tied the rate of change in charge at the gate, which is the major factor impacting Ton and Toff.

Look at the datasheet below closely with particular attention to Fig. 5 and Fig. 13A.

https://www.electro-tech-online.com/custompdfs/2010/11/irf4905pbf.pdf

I have included two more plots with the addition of the gate potential V(gate) of those I posted yesterday. Look at the step in as the MosFet turns on and off and how that compares with the graph in Fig. 13A. Also, in the sim change R1 to 1ohm and R2 to 10ohms, and observe the changes in Ton and Toff.

OK, here is the symbol (.asy) file and I’ll briefly describe how and where to put it. I don’t believe you have this since you have used the include statement in the sim you posted.

1. Create a new folder in LTC\lib\sym\misc and name it MOSFET;
2. Copy the file below and paste it to a pure text editor…I use Notepad all the time. Using Notepad, under File select Save As then click on the box Save as Type and select All files. Then type in the file name as IRF4905.asy and save it in the folder created above;
NOTE: Be sure you include the .asy extension;
3. Then create a new folder in LTC\lib\sub and name it MOSFET also;
4. Rename the file IRF4905.sub if it is not already because the spicemodel line in the symbol file is pointing at that file name as MOSFET\IRF4905.sub
5. Move the MosFet subcircuit file to the new subfolder created then start LTC and test. If LTC was running shut it down and reboot so it can see the new part.

This method will work for MosFets, among others, that are spice subcircuit models only and the appropriate files should be placed in your two newly created folders with the same path information in the symbol file. If you come across a MosFet with a simpler .model file, that can be place in the cmp\M Standard file using the format convention used there. Here is the symbol file:

Version 4
SymbolType CELL
LINE Normal 48 48 48 96
LINE Normal 16 80 48 80
LINE Normal 16 48 24 48
LINE Normal 48 48 24 44
LINE Normal 48 48 24 52
LINE Normal 24 44 24 52
LINE Normal 16 8 16 24
LINE Normal 16 40 16 56
LINE Normal 16 72 16 88
LINE Normal 0 80 8 80
LINE Normal 8 16 8 80
LINE Normal 48 16 16 16
LINE Normal 48 0 48 16
WINDOW 0 56 32 Left 0
WINDOW 3 56 72 Left 0
SYMATTR Value IRF4905
SYMATTR Prefix X
SYMATTR SpiceModel MOSFET\IRF4905.sub
SYMATTR Value2 IRF4905
SYMATTR Description HEXFET® Power MOSFET Transistor
PIN 48 0 NONE 0
PINATTR PinName D
PINATTR SpiceOrder 1
PIN 0 80 NONE 0
PINATTR PinName G
PINATTR SpiceOrder 2
PIN 48 96 NONE 0
PINATTR PinName S
PINATTR SpiceOrder 3
 

Attachments

  • MosFet 1K Gate Plot.jpg
    MosFet 1K Gate Plot.jpg
    197 KB · Views: 574
  • MosFet 100 Ohm Gate Plot.jpg
    MosFet 100 Ohm Gate Plot.jpg
    188 KB · Views: 545
Last edited:
Most what I did worked but it failed to run, take a look at my files that I put together with copy and paste, hope it shows what is in which file in a method you can understand. Main question is what the ext is for the subcircuit file. I copied and saved it as a .txt file.
I appreciate your help,
Thanks
Kinarfi
 

Attachments

  • MRCecil.PNG
    MRCecil.PNG
    61.5 KB · Views: 439
Did you:
1. restart LTS?
2. delete the old MosFet and replace it with the new symbol?
3. delete the include directive?

Be sure those are done then try it again.
 
I used a new schematic, the IRF4905 came up beautifully, the IRF4905 was the only item on the page when I tried to run it and got the box at the bottom of the picture. What is the extension for the down loaded subcrkt supposed to be "IRF4905.txt" that goes into LTC\lib\sub\MOSFET
Just to be sure, I take your file, copy and save as IRF4905.ASY and put in new folder LTC\lib\sym\MYSTUFF\MOSFET
Then I take your file, copy and save as IRF4905.SUB and put in in LTC\lib\sub\MOSFET
Then I take my down loaded subcrkt file IRF4905pbf.txt and put it in LTC\lib\sub\MOSFET also.
Do I change the name to match the the others or leave it alone.
Thanks
Kinarfi
Any one know why I getting an attack warning when I from Google when I open the site?
Starting over and redoing you instructions.

Still having to .include irf4905.txt
 
Last edited:
I used a new schematic, the IRF4905 came up beautifully, the IRF4905 was the only item on the page when I tried to run it and got the box at the bottom of the picture. What is the extension for the down loaded subcrkt supposed to be "IRF4905.txt" that goes into LTC\lib\sub\MOSFET
Just to be sure, I take your file, copy and save as IRF4905.ASY and put in new folder LTC\lib\sym\MYSTUFF\MOSFET
Then I take your file, copy and save as IRF4905.SUB and put in in LTC\lib\sub\MOSFETThen I take my down loaded subcrkt file IRF4905pbf.txt and put it in LTC\lib\sub\MOSFET also.
Do I change the name to match the the others or leave it alone.
Thanks
Kinarfi
Any one know why I getting an attack warning when I from Google when I open the site?
Starting over and redoing you instructions.

Still having to .include irf4905.txt

OK, I see what is wrong and why it isn't working for you. The line above that is highlighted and underlined is the problem.

The file I sent you is a SYMBOL file and belongs in one location only. For this instance, it should ONLY be in LTC\lib\sym\misc\MOSFET folder. It should NOT be placed in LTC\lib\sub\MOSFET as a sub file with a .sub extension.

To correct the issue, go to LTC\lib\sub\MOSFET and verify that that file begins with the line Version 4 using Notepad. If it does, delete that file. Then check the other file with the .txt extension you placed in that folder. If the first line reads .SUBCKT irf4905 1 2 3 that is the file that should be there. That file should be saved as IRF4905.sub because that is the subcircuit model file the symbol file is telling LTS to look for.

When you're done, you should have the symbol file I sent you in the folder LTC\lib\sym\misc\MOSFET with the extension .asy and with the first line reading Version 4, and the subcircuit file you downloaded from IR in the folder LTC\lib\sub\MOSFET with the extension .sub and with the first line reading .SUBCKT irf4905 1 2 3

Make those changes and it will work fine for you just like components LT supplied in the program. Let me know how it turns out.
 
Worked like a charm.
IRF4905.ASY goes into C:\Spice LTC\lib\sym\MY STUFF only
IRF4905.sub which is downloaded from the manufacturer as a .TXT file goes into C:\Spice LTC\lib\sub only
after I remove MOSFET\ from the line SYMATTR SpiceModel MOSFET\IRF4905.sub in the IRF4905.ASY

already did this & it works!!
Seems simple, just hard to find, understand and implement. Been trying to add components for a long time and this is my first success.
Thanks you very Much,
Kinarfi
 
Last edited:
Trying get a good model for a 2N7000 and others, went to ON Semiconductor and got 4 of them, which one do I want for LTSpice? Do I cut it out of the models they show and paste it?
This is the first model in C:\Spice LTC\CMP\standard.mos. AO6407 VDMOS(pchan Rg=3 Rd=14m Rs=10m Vto=-.8 Kp=32 Cgdmax=.5n Cgdmin=.07n Cgs=.9n Cjo=.26n Is=26p Rb=17m mfg=Alpha_&_Omega Vds=-20 Ron=34m Qg=13n)
When I get the 2N7000 model, I will just copy and paste it at the bottom or top of Standard mos.
Is this correct?
Thanks
Kinarfi
 

Attachments

  • post.png
    post.png
    31.4 KB · Views: 366
hi,
This is the one I use from Yahoo user group
 

Attachments

  • 2N7000.zip
    2.2 KB · Views: 302
Hi kinarfi,

Yes that is the method I use when I have a valid model file, unlike the method we discussed last week where only the .subckt file was available. One caution I will pass on is to follow the same format used in the standard.mos folder for any device you place in there. For instance, if the device is a p-channel be sure that appears as the first annotation after the open paren of the model and for n-channel it is omitted. Be sure to get the manufacturers name added and Vds, Ron and Qg from the datasheet in the correct order ending with the close paren. Be sure you save the file (standard.mos) rather than save as with another or misspelled name. Before closing down NotePad, reopen standard.mos and insure your new models are there...jusssst to be sure.

Or you can use the subckt file Eric has provided for one of the devices, and you know how to do that now.

Good Luck,
Merv
 
Thanks, so far no model, so I went the subcircuit route.
Kinarfi
 
Last edited:
Need a little more help with the step command or what ever command I need to run a simulation with different frequencies. Want to run my circuit at 50 hz, 100 hz, 150 hz .......300 hz. Tried several things that I read and keep getting errors.
Thanks,
Kinarfi

p.s. I don't really want the bode plot, just the value at U4 out for each freq.
 

Attachments

  • untitled.PNG
    untitled.PNG
    4 KB · Views: 339
  • lm2917.asc
    5.4 KB · Views: 323
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top