Struct MosfetModel
pub struct MosfetModel {
pub vth: f64,
pub kp: f64,
pub lambda: f64,
pub is_n_channel: bool,
}Expand description
Enhancement-mode MOSFET model parameters.
Uses the SPICE Level 1 square-law model for drain current:
- Cutoff:
Ids = 0when|Vgs| < |Vth| - Triode:
Ids = Kp * [(Vgs-Vth)*Vds - 0.5*Vds^2] - Saturation:
Ids = 0.5*Kp * (Vgs-Vth)^2 * (1 + lambda*|Vds|)
Fields§
§vth: f64Threshold voltage (V). N-channel: positive, P-channel: negative.
kp: f64SPICE Level 1 transconductance parameter (A/V²), before the 1/2 square-law saturation factor.
lambda: f64Channel-length modulation parameter (1/V). Typical: 0.01-0.1.
is_n_channel: boolTrue for N-channel, false for P-channel.
Implementations§
§impl MosfetModel
impl MosfetModel
pub fn n_2n7000() -> MosfetModel
pub fn n_2n7000() -> MosfetModel
2N7000 N-channel enhancement MOSFET.
Very common in guitar pedal clipping (Fulltone OCD, modern drives). Low threshold voltage, small package, fast switching.
pub fn n_irf520() -> MosfetModel
pub fn n_irf520() -> MosfetModel
IRF520 N-channel power MOSFET.
Higher current capability, used in some high-headroom drive circuits.
pub fn p_bs250() -> MosfetModel
pub fn p_bs250() -> MosfetModel
BS250 P-channel enhancement MOSFET.
Used in some boost circuits and complementary configurations.
pub fn p_irf9520() -> MosfetModel
pub fn p_irf9520() -> MosfetModel
IRF9520 P-channel power MOSFET.
pub fn ids(&self, vgs: f64, vds: f64) -> f64
pub fn ids(&self, vgs: f64, vds: f64) -> f64
Drain current Ids(Vgs, Vds) — enhancement-mode square-law model.
- Cutoff:
Ids = 0when the channel is off (N:Vgs <= Vth, P:Vgs >= Vth) - Triode:
Ids = Kp * [Vov*|Vds| - 0.5*Vds²] * sign(Vds) - Saturation:
Ids = 0.5*Kp * Vov² * (1 + lambda*|Vds|) * sign(Vds)
The channel conducts symmetrically in both Vds polarities (drain and source are interchangeable in the square-law model).
pub fn ids_vds_derivative(&self, vgs: f64, vds: f64) -> f64
pub fn ids_vds_derivative(&self, vgs: f64, vds: f64) -> f64
Derivative dIds/dVds at fixed Vgs.
Returns LEAKAGE_CONDUCTANCE in cutoff so Newton-Raphson always sees
a non-zero slope.
Trait Implementations§
§impl Clone for MosfetModel
impl Clone for MosfetModel
§fn clone(&self) -> MosfetModel
fn clone(&self) -> MosfetModel
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more