First of all, I'm pretty new to the simulation side of engineering. I'm using gschem to draw simple circuits and I'm using ngspice from the commandline to run the simulation and plot the results.
So far I've succesfully done a simulation with a simple voltage source, and resistor. Just to get used to the basic workflow.
Now the next thing I would like to accomplish, is to use a Mosfet in my simulation.
This generates the following netlist:
* gnetlist -g spice-sdb -o sim1.ckt sim1.sch
*********************************************************
* Spice file generated by gnetlist *
* spice-sdb version 4.28.2007 by SDB -- *
* provides advanced spice netlisting capability. *
* Documentation at http://www.brorson.com/gEDA/SPICE/ *
*********************************************************
*============== Begin SPICE netlist of main design ============
M1 drain 1 0 unconnected_pin-1 STN2NF10
V1 Vcc 0 DC 12V
R1 drain Vcc 250
.tran 1ms 100ms
V2 1 0 pulse(0 5 0s 2ns 2ns 1ms 10ms)
.end
Now when I try to run this I get the following error:
Error on line 9 : m1 drain 1 0 unconnected_pin-1 stn2nf10
Unable to find definition of model stn2nf10 - default assumed
Which is not realy a supprise, after all, how should ngspice know the characterics of all components in the digikey catalogue.
So I understand that I have to specify the charcteristics of this mosfet. This is where I get stuck. I've read the part of the ngspice manual (p. 127, sorry not enough reputation to post 2 links: ngspice.sourceforge.net/docs/ngspice-manual.pdf) about mosfets, it says the general form to define a mosfet is as follows:
MXXXXXXX nd ng ns nb mname <m=val> <l=val> <w=val>
+ <ad=val> <as=val> <pd=val> <ps=val> <nrd=val>
+ <nrs=val> <off> <ic=vds,vgs,vbs> <temp=t>
The 'm' parameter is for multiplicity, I understeand this one. Now the 'l' and 'w' parameters, these are the length and width of the channel. How on earth should I be able to know these? They are not in the datasheet for sure. Same for the 'ad' and 'as' parameters these are the drain and source 'diffusions'.
Why can't we just enter the characteristics as meantioned in the datasheet: STN2NF10. Vdss, Idss, Igss, Vgs, Rds, etc.
I believe there is a good reason why it's the way it is, I'm probably just missing or misunderstanding something.
The question:
How do I simulate a circuit containing a Mosfet, and transform the values in the datasheet of the mosfet into ngspice.
PS. The same question is of course applicable to other parts then mosfets, I would just like to keep to the mosfets for now, in order to keep thins simple and practicle.