After reading through these answers, clicking on a couple links, and more in depth links, a a whole rabbit hole of clicks, I have found quite a bit of info which I will skim over as an updated answer (and for my own documentational purposes ;)
First of all : you should know that this is much more invloved than can be answered as an answer here. More-over, your question is too generic ,as others have commented already. I will only touch the surface, list a couple from the basic passive elements which aren't documented much and then provide links to further investigate how to model your component of interest as this is a HUGE subject, even for just a single element.
For creating your own models in SPICE for a specific component you will need to figure out the following:
- How Spice Models a specific component and the parameters available to you
- How each parameter influences the modeled behaviour
- How to correlate the provided information in the datasheet to modeled behaviour
Spice available model defined elements
.MODEL -- Define a SPICE Model
Syntax: .model <modname> <type>[(<parameter list>)]
Type (Associated Circuit Element) :
SW (Voltage Controlled Switch) , CSW (Current Controlled Switch) , URC (Uniform Distributed RC Line) , LTRA (Lossy Transmission Line) ,D (Diode) ,NPN (NPN Bipolar Transistor) ,PNP (PNP Bipolar Transistor) ,NJF (N-channel JFET model) ,PJF (P-channel JFET model) ,NMOS (N-channel MOSFET) ,PMOS (P-channel MOSFET) ,NMF (N-channel MESFET) ,PMF (P-channel MESFET) ,VDMOS (Vertical Double Diffused Power MOSFET)
RES(Resistor), CAP(Capacitor), IND(Inductor)
note:this list may not be complete
Basic Passives (R,L,C)
- Resistor : You can define/tweak a temperature dependence
- Capacitor : You can define/tweak a temperature dependence, voltage dependence
- Inductor : You can define/tweak a temperature dependence, current dependence
Temperature dependence (R,L,C)
=========== ============================== ======= =======
name parameter units default
=========== ============================== ======= =======
TC1 linear temperature coeff. 1/ºC 0.0
TC2 quadratic temperature coeff. 1/ºC² 0.0
T_MEASURED override component temp. ºC 27
TNOM (same as above) ºC 27
=========== ============================== ======= =======
These coefficients get calculated to a Temperature Factor multiplier as follows:
(\Delta T = \left(T_{amb} - T_{nom} \right ) \text{ , default } T_{amb}=27\
TempFactor = 1+T_{c1} \cdot\Delta T+T_{c2}\cdot(\Delta T)^2)
Resistor Extended temperature modeling
======= ============================== ======= =======
name parameter units default
======= ============================== ======= =======
TCE exponential temperature coeff. %/ºC 0.0
======= ============================== ======= =======
(TempFactor_{R} = TempFactor\cdot 1.01^{Tce\cdot\Delta T})
T_amb = is the global temperature, by default 27ºC
This can be defined in .TEMP runs
.TEMP 10 20
or sweeping the temp parameter in a DC sweep analysis for example.
The value of the resistors, capacitors, inductors will be calculated as follows:
Voltage dependence (C)
=========== ============================== ======= =======
name parameter units default
=========== ============================== ======= =======
VC1 linear voltage coefficient 1/V 0.0
VC2 quadratic voltage coefficient 1/V² 0.0
=========== ============================== ======= =======
(C = C\cdot \left(1+Vc1\cdot V_C+Vc2\cdot V_C^2\right))
Current dependence (L)
=========== ============================== ======= =======
name parameter units default
=========== ============================== ======= =======
IL1 linear current coefficient 1/A 0.0
IL2 quadratic current coefficient 1/A² 0.0
=========== ============================== ======= =======
(L = L\cdot \left(1+Il1\cdot I_L+Il2\cdot I_L^2\right))
Initial Values
This will only cause an effect on the simulation if the ‘UIC’ (skip initial operating point solution) option is specified on the .tran analysis.
Within the model you can also specify the initial value with the parameter ic where its value will define the initial current in an inductor or the initial voltage in a capacitor. It does not apply to resistances.
Initial Values can also be set in a general context at specific Nodes with the .ic spice directive.
Parasitic elements
Resistors
In this case, define a subcircuit such as presented in this question/answer Equivalent circuit of a non-ideal resistor, modeling the parasitic elements.
The model which suits your specific resistor construction and application is up to you to choose.
In this Application Note from Vishay on Thin Film Chip Resistors they provide model coefficients for parasitic parameter variation depending on smd coponent case size a type of terminal endings.
Capacitors
LTSpice has the following parasitic element model.
In LTSpice, right-clicking on the device allows you to specify the following parasitic components:
Rser, Lser, Rpar, Cpar
To specify RLShunt you will need to (cntrl+right click) and scroll down to SpiceLine or SpiceLine2 and manually type it in there. e.g. RLShunt=0.01
Inductors
LTSpice has the following parasitic element model.
In LTSpice, right-clicking on the device allows you to specify the following parasitic components:
Rser, Lser, Rpar, Cpar
*Rser defaults to 1mΩ unless strictly specified. This allows LTspice to integrate the inductance as a Norton equivalent circuit instead of Thevenin equivalent in order to reduce the size of the circuit's linearized matrix.
Defining the model
To define the model create a spice directive and place it on the sheet:
.model myR res(Tnom=150 Tc2=-19u)
then enter the model into its "SpiceModel" field (via ctrl-right mouse click) on the Resistor. Same procedure applies for all components
Defining Non-Linear behaviours
These statements are not compatible with model definitions of the passives. They are entered instead of the component value as the expression defines the behaviour of that value.
Resistors
R=<expression> , defines resistance (R<>0 to avoid problems)
R=limit(1,100k,V(1,2)*I(V1)) , result is kept between 1Ω and 100kΩ
Capacitors
Q=<expression> , defines capacitance ('x' is Capacitors voltage)
Q=1u*x , defines a 1uF capacitor
Q=x*if(x>3,1n,400p) , a more complex relationship
More info here
Inductors
There are two forms of non-linear inductors available in LTspice. The basic one follows:
Flux=<expression> , defines the inductance ('x' is Inductors current)
Flux=1m*x , defines a 1mH inductor
Flux=1m*tanh(5*x) , a more complex relationship
The other non-linear behaviour attempts to model a core, defining a hysterisis loop using the following parameters:
====== ========================= ===============
Name Description Units
====== ========================= ===============
Hc Coercive force Amp-turns/meter
Br Remnant flux density Tesla
Bs Saturation flux density Tesla
------ ------------------------- ----------------
Mechanical dimensions of the core
------ ------------------------- ----------------
Lm Magnetic Length(excl.gap) meters
Lg Length of gap meters
A Cross sectional area meters²
N Number of turns -
====== ========================= ===============
More info here
Step 2 :
Now that you have an idea of how you can model a couple components, now you have to look at the datasheet and see what you can use to best model the component to your needs.
Here is a nice read to selecting and calculating the equivalent circuit for passives behavior when provided a graph.
Step 3 :
Generate curves with test setups in spice simulation runs and tweak the values of the parameters to fit the curves.
I'm adding a section on MOSFETs because it was the component you were initially attempting to model and the once I am too.
MOSFETs
There are two fundamentally different types of MOSFETS in LTspice, monolithic MOSFETs and a new vertical double diffused power MOSFET model.
Power MOSFETs is the current area of interest are modeled as vertical double diffused power MOSFETs: VDMOS
Minimum Required model Parameters
=========== ===========================================
Parameter Description
=========== ===========================================
Rg Gate ohmic resistance
Rd Drain ohmic resistance (this is NOT RDSon
but the resistance of the bond wire)
Rs Source ohmic resistance.
Vto Zero-bias threshold voltage.
Kp – Transconductance coefficient
Lambda Change in drain current with Vds
Cgdmax Maximum gate to drain capacitance.
Cgdmin Minimum gate to drain capacitance.
Cgs Gate to source capacitance.
Cjo Parasitic diode capacitance.
Is Parasitic diode saturation current.
Rb Body diode resistance.
=========== ===========================================
How to correlate the model to the datasheet is extensively and very well modeled in the multiple papers published by Ian Hegglun. There are test setups for tweaking the curves aswell in zip files to be downloaded.
MOSFET : VDMOS Parameter Extraction from curves and datasheet
Resources to trace curves from datasheets
Sources: