Struct DiffPairRoot
pub struct DiffPairRoot {
pub alpha: f64,
pub n_vt: f64,
pub i_tail: f64,
pub i_tail_bias: f64,
pub i_tail_max: f64,
pub prev_v: f64,
}Expand description
Diff-pair macromodel for ladder filter stages (Moog/303/Korg).
Models one stage of a transistor ladder as a differential pair with tanh transfer characteristic:
I_out = α · I_tail · tanh(V_in / (2 · n · V_t))
where:
α = β/(β+1)from SPICE BF parameter (collector current fraction)I_tail= tail current, modulated by cutoff CV (this IS the cutoff control)n= forward ideality factor (SPICE NF, usually ~1.0)V_t= thermal voltage (kT/q ≈ 25.85mV at 25°C)
The cap in the WDF tree is loaded by 1/gm = 2·n·Vt / (α·I_tail), giving cutoff frequency f_c = α·I_tail / (4π·n·Vt·C).
K-table: 2D lookup on (b_tree, I_tail). The I_tail axis maps to the cutoff control CV. Monotonic, bounded, memoryless — ideal for K-method.
Fields§
§alpha: f64α = BF / (BF + 1), collector current fraction.
n_vt: f64n · Vt: scaled thermal voltage (NF * kT/q).
i_tail: f64Current tail current (modulated by cutoff CV).
i_tail_bias: f64DC bias tail current (quiescent operating point).
i_tail_max: f64Max tail current (sets cutoff range).
prev_v: f64Previous sample’s voltage for NR warm-start.
Implementations§
§impl DiffPairRoot
impl DiffPairRoot
pub fn from_gummel_poon(
model: &GummelPoonModel,
i_tail_bias: f64,
) -> DiffPairRoot
pub fn from_gummel_poon( model: &GummelPoonModel, i_tail_bias: f64, ) -> DiffPairRoot
Create from SPICE Gummel-Poon parameters.
pub fn new(alpha: f64, n_vt: f64, i_tail: f64) -> DiffPairRoot
pub fn new(alpha: f64, n_vt: f64, i_tail: f64) -> DiffPairRoot
Create with explicit parameters.
pub fn set_i_tail(&mut self, i_tail: f64)
pub fn set_i_tail(&mut self, i_tail: f64)
Set the tail current (cutoff control, audio rate).
pub fn i_tail_bias(&self) -> f64
pub fn i_tail_bias(&self) -> f64
Get the DC bias tail current.
pub fn current(&self, v: f64) -> f64
pub fn current(&self, v: f64) -> f64
Output current of the diff pair at voltage V. I = α · I_tail · tanh(V / (2 · n · Vt))
pub fn current_derivative(&self, v: f64) -> f64
pub fn current_derivative(&self, v: f64) -> f64
Derivative dI/dV = α · I_tail / (2 · n · Vt) · sech²(V / (2·n·Vt))
pub fn reset_nr_state(&mut self)
pub fn reset_nr_state(&mut self)
Reset NR warm-start state.
pub fn k_method_candidacy(&self) -> (bool, usize)
pub fn k_method_candidacy(&self) -> (bool, usize)
K-method candidacy: 2D (b_tree × I_tail).
Trait Implementations§
§impl Clone for DiffPairRoot
impl Clone for DiffPairRoot
§fn clone(&self) -> DiffPairRoot
fn clone(&self) -> DiffPairRoot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more