Source code coming soon. The GitHub repository is private for now and opens to everyone very soon.
BetterSPICE Beta 0.8.0 Join the beta Download soon
Part VI  Parts and modelsReferenceContentsIndex
32

Devices: semiconductors

The diode, BJT, MOSFET (levels 1, 2 and 3, and VDMOS) and JFET use the same equations as ngspice, ported from its source: defaults, temperature scaling, junction limiting and convergence tests. A vendor .model card therefore gives the same result as in ngspice. Its parameters go on the part under their ngspice names in lower case.

32.1Where semiconductor values come from

Where semiconductor values come from
SourceWhat it sets
The inspectorThe main parameters: is, n, rs, bv and cj0 for a diode, bf, is, vaf, cje and cjc for a BJT, vto, kp, lambda, cgs and cgd for a MOSFET.
A vendor model cardAssigning a model from the library merges every parameter of its card into the part. Simulate uses the vendor card itself.
Quick modelDatasheet values fitted exactly at the stated test point (Quick model tab).
A part fileValues from a .bspart.
The All parameters tab or the fileAny other ngspice parameter by its ngspice name.

Shared instance parameters: temp (°C, default 27, the ngspice default), dtemp (offset from the circuit temperature), tnom (the temperature the model was measured at, default 27), mult (parallel devices), and area for diodes, BJTs and JFETs. Variants such as rectifier or darlington only change the symbol, except where the text says otherwise.

32.2Diode

Diode
TypeKeyPinsVariantsClass
diode (D)Danode, cathoderectifier, signal, schottky, zener, tvs, varactor, switching, fast (symbols). The bidirectional TVS is a separate model.exact

The ngspice junction diode: forward current IS (eV/(N·Vt) - 1), reverse breakdown at BV matched to IBV, series resistance, depletion and diffusion charge. A part placed from the library starts with is = 1 nA and n = 1.8.

Diode
ParameterKeyUnitDefaultRangeValue comes fromWhat it does
Saturation currentisA10 fA> 0Default, inspector, Quick model, board import, cardAlias js.
Emission coefficientn1> 0Default, inspector, Quick model, card
Series resistancersΩ0≥ 0Default, inspector, Quick model, card
Breakdown voltagebvVnone (no breakdown)> 0Default, inspector, Quick model, cardA positive number. Aliases vb, vrb.
Breakdown currentibvA1 mA> 0Inspector (Zener: Current at breakdown), Quick model (Zener), cardCurrent at bv.
Breakdown emissionnbv= n> 0Vendor model card, All parameters tab
Junction capacitancecj0F0≥ 0Default, inspector, Quick model, cardZero-bias capacitance. Aliases cjo, cj.
Junction potentialvjV1> 0Vendor model card, All parameters tabAlias pb.
Grading coefficientm0.50 to 0.999Vendor model card, All parameters tabAlias mj.
Forward-bias coefficientfc0.50 to 0.999Vendor model card, All parameters tab
Transit timetts0≥ 0Quick model (t_rr / 1.5), cardDiffusion charge, sets reverse recovery.
Knee currentsikf, ikrAnone> 0Vendor model card, All parameters tabHigh-injection roll-off.
Recombinationisr, nrA, -none, 2≥ 0, > 0Vendor model card, All parameters tab
Sidewalljsw, ns, cjp, php, mjsw, fcs, ikpnone, = n, 0, 1, 0.33, 0.5, noneVendor model card, All parameters tabSidewall current and capacitance.
Tunnellingjtun, jtunsw, ntun, xtitun, kegnone, none, 30, 3, 1Vendor model card, All parameters tab
Area, perimeterarea, pj-, m1, 0> 0, ≥ 0Vendor model card, All parameters tab
Temperature modeleg, xti, tlev, tlevc, cta, ctp, tpb, tphp, trs, trs2, tm1, tm2, ttt1, ttt2, tcv, gap1, gap2eg 1.11 eV, xti 3, others 0Vendor model card, All parameters tabTemperature dependence of IS, BV, capacitances and resistances.

Key: the name in the circuit file, in a parameter step (R1.r) and for AI agents. Range: a value outside it is refused with E_PARAM. Value comes from: where you can set it. The All parameters tab and agents can set every parameter.

Not implemented, so models that use them run approximately: LEVEL 3 geometry, RSW, soft recovery (VP) and self-heating. Typical values the inspector shows per variant: rectifier is 7 nA, n 1.98, rs 42 mΩ, bv 1000 V, cj0 26 pF. Signal: is 2.52 nA, n 1.752, bv 100 V, cj0 4 pF, tt 20 ns. Schottky: is 30 µA, n 1.05, bv 40 V, cj0 110 pF. Zener: bv 5.075 V, ibv 5 mA, rs 5 Ω. TVS: bv 6.7 V, cj0 1 nF. Varactor: bv 30 V, cj0 30 pF.

Try it
A 3.3 V Zener regulator
  1. Place a 12 V DC source, a 470 Ω resistor and a diode with its cathode towards the resistor and anode to ground.
  2. Select the diode, press Ctrl+Shift+M and type V_Z 3.3, I_Z 20m, Z_Z 10. Press Apply.
  3. Hover the cathode wire.

You should seeThe cathode sits near 3.3 V. Change the source with its slider: the Zener voltage barely moves while the current through it changes.

32.3LED

LED
TypeKeyPinsVariantsClass
led (LED)Shift+Danode, cathodestandard, laser (symbols)exact

The diode model with colour-dependent defaults. It glows on the canvas in proportion to its current, full at 20 mA.

LED
ParameterKeyUnitDefaultRangeValue comes fromWhat it does
Colourcolorredred, orange, yellow, green, blue, white, uv, irDefault, inspectorSets is, n and rs unless they are given (is / n / rs): red 10-18 A / 1.9 / 2 Ω, orange and yellow 10-19 / 1.9 / 2, green 10-20 / 2.0 / 2, blue, white and uv 10-22 / 2.6 / 2, infrared 10-16 / 1.6 / 1. The inspector and All parameters show the values of the chosen colour, and the note under the colour gives the forward voltages.
Saturation currentisAby colour> 0Default, inspector, Quick model
Emission coefficientnby colour> 0Default, inspector, Quick model
Series resistancersΩ2≥ 0Default, inspector, Quick model

Key: the name in the circuit file, in a parameter step (R1.r) and for AI agents. Range: a value outside it is refused with E_PARAM. Value comes from: where you can set it. The All parameters tab and agents can set every parameter.

32.4Bipolar transistor (NPN, PNP)

Bipolar transistor (NPN, PNP)
TypeKeyPinsVariantsClass
npn, pnp (Q)Q or Shift+Qc, b, edefault, darlington (symbol), prebias (digital transistor with base resistors)exact

The ngspice Gummel-Poon model, with quasi-saturation (Kull) when rco is set. The prebias variant adds R1 in series with the base and R2 from base to emitter. The substrate capacitance goes to ground. A part placed from the library starts with bf = 100.

Bipolar transistor (NPN, PNP)
ParameterKeyUnitDefaultRangeValue comes fromWhat it does
Forward betabf100> 0. Slider 10 to 1000.Default, inspector, Quick model, board import, cardIdeal maximum forward current gain.
Saturation currentisA10 fA> 0Default, inspector, Quick model, card
Early voltagevafVnone (no Early effect)≥ 0Default, inspector, Quick model, cardAlias va. 0 also means none.
B-E capacitancecjeF0≥ 0Default, inspector, Quick model, cardWith vje (0.75 V) and mje (0.33).
B-C capacitancecjcF0≥ 0Default, inspector, Quick model, cardWith vjc (0.75 V), mjc (0.33) and xcjc (1).
Forward emissionnf1> 0Vendor model card, All parameters tab
Knee currentikf, nkfA, -none≥ 0Vendor model card, All parameters tabBeta roll-off at high current.
B-E leakageise, neA, -0, 1.5≥ 0, > 0Vendor model card, All parameters tabLow-current beta.
Reversebr, nr, var, ikr, isc, nc1, 1, none, none, 0, 2Vendor model card, All parameters tabReverse-active operation.
Resistancesrb, irb, rbm, re, rcΩ, A0, 0, = rb, 0, 0≥ 0Vendor model card, All parameters tabBase resistance falls from rb to rbm with current.
Transit timestf, xtf, vtf, itf, trs, -, V, A, s0, 0, none, 0, 0≥ 0Vendor model card, All parameters tabDiffusion charge, sets f_T and storage time.
Substratecjs, vjs, mjs, iss, ns, subs0, 0.75, 0, none, 1, ±1Vendor model card, All parameters tab
Quasi-saturationrco, vo, gamma, qco, quasimod, vg, cn, doff unless rco is setVendor model card, All parameters tabKull model with an extra collector node.
Prebias resistorsr1, r2Ω10 kΩ, 10 kΩ> 0, ≥ 0Default, inspectorPrebias variant only. r2 = 0 removes R2.
Temperature modeleg, xti, xtb, tlev, tlevc and the t… coefficientseg 1.11 eV, xti 3, others 0Vendor model card, All parameters tab

Key: the name in the circuit file, in a parameter step (R1.r) and for AI agents. Range: a value outside it is refused with E_PARAM. Value comes from: where you can set it. The All parameters tab and agents can set every parameter.

Not implemented: excess phase (ptf) and self-heating. Typical values shown for a new NPN: is 6.7 fA, bf 200, vaf 74 V, cje 4.5 pF, cjc 3.6 pF. PNP: is 1.4 fA, bf 180, vaf 18.7 V.

32.5MOSFET (N, P)

MOSFET (N, P)
TypeKeyPinsVariantsClass
nmos, pmos (M)M or Shift+Md, g, s, and optionally benh, dep, 4pin, power, gan, sicexact

The ngspice MOSFET levels 1, 2 and 3, and the VDMOS model for power devices. With three pins the bulk is tied to the source. Variants that change the behaviour:

  • dep: depletion mode, the threshold sign is flipped.
  • power, gan, sic: a body diode from source to drain. A new part of these variants runs the VDMOS model with the values of a real part of its class (below), a part saved before with level 1 and bodyDiode on.
  • 4pin: the symbol with the bulk pin.
  • vdmos (from a vendor card or the file): the VDMOS model instead of level 1 to 3.

Where the engine deliberately differs from ngspice. A level 2 card with vmax (velocity saturation) and no nfs: between the flat-band voltage vbin and the threshold voltage ngspice solves a quartic for the saturation voltage whose root goes negative, and the channel then conducts a falling current although there is no inversion charge. A card with vto 0.72 V and gamma 0.94 V½ (vbin is then slightly below 0) conducts 47 µA at Vgs = 0 in ngspice. BetterSPICE holds the saturation voltage at zero there, so the device is off below its threshold, as the equations and the physics require (a CMOS output with its n-channel off reaches the supply rail: 5.000 V where ngspice shows 4.964 V). Above the threshold both give the same current to five digits. A level 2 part run in ngspice itself (a vendor-model Simulate, bspice ngspice) still shows ngspice's own sub-threshold current. The check is the known-difference entry of verification/circuits/semi/mos_cmos_l2_tran (PASS! in the verify list, Verification).

A plain MOSFET with no card uses level 1 with vto = ±2 V, kp = 0.1 A/V² and lambda = 0.01 /V. If rds_on is set and kp isn’t, kp = 1 / (rds_on · (10 - |vto|)), so rds_on is the on-resistance at 10 V of gate drive.

Default capacitances. Without gate capacitance a gate switches at once: no Miller plateau, no gate charge to drive. So a new generic MOSFET is placed with the capacitances of a real part of its class, taken from its datasheet and checked with a gate-charge test (constant gate current, clamped drain current, as the datasheets measure it). They are written into the part, so circuits saved before keep their results.

  • enh, dep, 4pin N-channel (2N7000 class, 60 V 0.2 A): cgs 20 pF, cgd 6 pF. P-channel (BSS84 class, 50 V 0.13 A): cgs 50 pF, cgd 10 pF (Qgs 0.2 nC, Qgd 0.3 nC as the datasheet). The fixed cgd is the mean C_rss over the drain swing, so the gate charge is right although C_rss itself is larger at low voltage.
  • power N-channel (IRLZ44N class, 55 V 47 A, logic level): VDMOS with vto 1.5 V, kp 20, rd 7 mΩ, rs 3 mΩ, rg 1.5 Ω, cgs 1.55 nF, cgdmin 40 pF, cgdmax 2.9 nF, a 0.4, cjo 1.4 nF, tt 8 ns. C_iss 1.70 nF, C_rss 151 pF, C_oss 397 pF at 25 V. Gate charge at 44 V, 25 A, 5 V: Qg 31.5, Qgs 4.8, Qgd 18 nC (datasheet maxima 48, 8.6, 25).
  • power P-channel (IRF5305 class, -55 V -31 A): VDMOS with vto -3 V, kp 8, cgs 0.95 nF, cgdmax 2 nF, cjo 1.5 nF. Qg 42.7, Qgd 23.8 nC at -10 V (maxima 63, 29). The gan and sic symbols of a P-channel part get the same values (no such parts are made).
  • gan (EPC2045 class, 100 V 16 A): VDMOS with vto 1.4 V, rg 0.6 Ω, cgs 0.76 nF, cgdmax 0.2 nF, cjo 0.8 nF, no body diode (it conducts backwards through the channel at about 1.6 V, as the datasheet’s 1.7 V). Qg 5.3, Qgs 1.8, Qgd 0.8 nC at 5 V (datasheet 6, 1.9, 0.8).
  • sic (C3M0060065D class, 650 V 37 A): VDMOS with vto 2.3 V, rg 3 Ω, cgs 1.01 nF, cgdmin 6 pF, cgdmax 1.2 nF, cjo 0.6 nF, body diode about 5 V. C_rss 9 pF and C_oss 81 pF at 600 V. Qg 43.8 nC from 0 to 15 V at 400 V (datasheet 46 nC from -4 to 15 V).

The inspector shows one quiet line under the model of a generic MOSFET or IGBT: the class its capacitances are typical of. A larger part has more gate and output capacitance, and the package inductance (LG, LS, LD, a few nH each) is not in the part: draw it as inductors, or assign a vendor model, which has all of it. A part without any gate capacitance (one saved before) says so instead. The line is not shown for a part with a vendor model. No breakdown voltage is set, so a generic part used above its class does not clamp: set bv for avalanche. A part added with its own level-1 values (cgd, bodyDiode, rds_on or level) on a power symbol stays level 1, as does a vendor model’s fit.

The inspector of a generic MOSFET: the quiet line under the model, ending in Set from rating.
Figure 32.1The inspector of a generic MOSFET: the quiet line under the model, ending in Set from rating.

On an N-channel MOSFET the line ends in Set from rating, a menu of five classes, each with the values of one real part fitted to its datasheet: 30 V 5 A (AO3400A), 60 V 30 A (FQP30N06L), 100 V 50 A (IRF3710), 650 V SiC 30 A (C3M0060065D) and 100 V GaN 30 A (EPC2204). A choice fills the whole model as one undo step, switches the symbol to power, SiC or GaN as the part needs, and the line then names the part. The gate charge of each is within the datasheet’s typical or maximum values (docs/DEVICES.md lists them).

MOSFET (N, P)
ParameterKeyUnitDefaultRangeValue comes fromWhat it does
ThresholdvtoV2 (pmos -2)any. Slider -10 to 10 V.Default, inspector, Quick model, board import, cardAlias vt0.
TransconductancekpA/V²0.1> 0Default, inspector, Quick model, card
Channel-length modulationlambda1/V0.01≥ 0Default, inspector, Quick model, cardOutput conductance in saturation.
Gate-source capacitancecgsF0 (placed with 20 pF, P 50 pF)≥ 0Default, inspector, Quick modelA fixed capacitor (BetterSPICE, not ngspice). Quick model: C_iss - C_rss.
Gate-drain capacitancecgdF0 (placed with 6 pF, P 10 pF)≥ 0Default, inspector, Quick modelA fixed capacitor. Quick model: C_rss.
On-resistancerds_onΩ> 0Default, inspectorSets kp as above.
Body diodebodyDiode0 / 11 for power, gan, sicDefault, inspectorIS 1 pA, N 1.
Levellevel11 to 3Vendor model card, All parameters tab
Bulk effectgamma, phi√V, V0, 0.6≥ 0, > 0Vendor model card, All parameters tab
Resistancesrd, rs, rsh, nrd, nrsΩ0≥ 0Vendor model card, All parameters tab
Junctionsis, js, pb, cbd, cbs, cj, mj, cjsw, mjsw, fcis 10 fA, pb 0.8 V, others 0 or 0.5Vendor model card, All parameters tab
Overlap capacitancescgso, cgdo, cgboF/m0≥ 0Vendor model card, All parameters tab
Processtox, uo, nsub, tpg, nss, ld, xjtox none, uo 600 cm²/VsVendor model card, All parameters tabDerive vto, gamma, phi and kp when given.
Level 2 and 3delta, uexp, ucrit, vmax, neff, nfs, theta, eta, kappa, xl, wd, xw, delvtongspice defaultsVendor model card, All parameters tab
Geometryl, w, ad, as, pd, psm, m²l = w = 100 µm> 0Vendor model card, All parameters tab

Key: the name in the circuit file, in a parameter step (R1.r) and for AI agents. Range: a value outside it is refused with E_PARAM. Value comes from: where you can set it. The All parameters tab and agents can set every parameter.

VDMOS cards add vto (default ±3 V), kp (20 or 10 A/V²), rd, rs, rg and rds. They also add quasi-saturation (rq, vq), the non-linear gate-drain capacitance (cgdmin, cgdmax, a), cgs, and a built-in body diode (is, n, rb, cjo, vj, m, tt, bv). Not implemented: self-heating and soft recovery. Typical values shown in empty fields of a new N-channel: vto 1.3 V, kp 0.2 A/V², cgs 20 pF, cgd 6 pF.

32.6JFET (N, P)

JFET (N, P)
TypeKeyPinsVariantsClass
njf, pjf (J)Jd, g, snoneexact

The ngspice JFET with the Sydney University doping-tail parameter b. For a P-channel JFET, vto is entered as the P-channel value, positive for depletion.

JFET (N, P)
ParameterKeyUnitDefaultRangeValue comes fromWhat it does
Pinch-off voltagevtoV-2 (pjf +2)anyDefault, inspector, Quick model, board import, cardQuick model: -|V_GS(off)|.
TransconductancebetaA/V²1 mA/V²> 0Default, inspector, Quick model, cardQuick model: I_DSS / vto².
Channel-length modulationlambda1/V0≥ 0Default, inspector, card
Doping tailb1Vendor model card, All parameters tab
Resistancesrd, rsΩ0≥ 0Vendor model card, All parameters tab
Capacitancescgs, cgd, pb, fcF, V0, 0, 1, 0.5Vendor model card, All parameters tab
Gate junctionis, nA, -10 fA, 1Vendor model card, All parameters tab
Temperaturetcv, vtotc, bex, betatce, xti, eg0, eg 1.11Vendor model card, All parameters tab

Key: the name in the circuit file, in a parameter step (R1.r) and for AI agents. Range: a value outside it is refused with E_PARAM. Value comes from: where you can set it. The All parameters tab and agents can set every parameter.

32.7IGBT

IGBT
TypeKeyPinsVariantsClass
igbt (Q)libraryc, g, enoneapproximate

A behavioural IGBT: an N-channel MOSFET behind a collector diode that gives the saturation knee. It has no reverse conduction: add an antiparallel diode for a co-pack.

IGBT
ParameterKeyUnitDefaultRangeValue comes fromWhat it does
ThresholdvthV5any. Slider 1 to 10 V.Default, inspector
TransconductancekpA/V²1> 0Default, inspector
V_CE(sat)vce_satV1.5≥ 0Default, inspectorOn-state voltage scale at about 1 A.
Gate capacitancescgs, cgdF0 (placed with 0.9 nF, 0.2 nF)≥ 0File or All parameters onlyA new IGBT gets the values of a 600 V, 20 A part (IKW20N60T: C_ies 1.1 nF, Q_G 120 nC at 480 V). cgd is the mean C_res over the collector swing, so the gate charge is right (112 nC). Package inductance is drawn as inductors.

Key: the name in the circuit file, in a parameter step (R1.r) and for AI agents. Range: a value outside it is refused with E_PARAM. Value comes from: where you can set it. The All parameters tab and agents can set every parameter.