Skip to main content

TransformerConfig

Struct TransformerConfig 

Source
pub struct TransformerConfig {
Show 24 fields pub model: Option<String>, pub turns_ratio: f64, pub primary_inductance: f64, pub primary_type: WindingType, pub secondary_type: WindingType, pub primary_dcr: f64, pub secondary_dcr: f64, pub capacitance: f64, pub coupling: f64, pub primary_leakage: Option<f64>, pub secondary_leakage: Option<f64>, pub magnetizing_inductance: Option<f64>, pub core_loss_resistance: Option<f64>, pub core_primary_turns: Option<f64>, pub core_area: Option<f64>, pub core_path_length: Option<f64>, pub core_gap: Option<f64>, pub dc_bias_current: Option<f64>, pub ja_ms: Option<f64>, pub ja_a: Option<f64>, pub ja_alpha: Option<f64>, pub ja_k: Option<f64>, pub ja_c: Option<f64>, pub tertiary_turns_ratio: Option<f64>,
}
Expand description

Audio transformer configuration.

Transformers are modeled with:

  • Turns ratio (affects impedance transformation by n²)
  • Primary inductance (determines low-frequency response)
  • Optional center taps for push-pull configurations
  • Parasitic elements (DCR, capacitance) for accurate HF response

Fields§

§model: Option<String>

Optional model-library name. When present, library values seed the electrical/core fields and explicit DSL fields override them.

§turns_ratio: f64

Turns ratio (primary:secondary). 1.0 = 1:1, 10.0 = 10:1 step-down

§primary_inductance: f64

Primary winding inductance in Henries

§primary_type: WindingType

Primary winding configuration

§secondary_type: WindingType

Secondary winding configuration

§primary_dcr: f64

DC resistance of primary winding (Ω), default 0

§secondary_dcr: f64

DC resistance of secondary winding (Ω), default 0

§capacitance: f64

Parasitic capacitance (F), default 0

§coupling: f64

Coupling coefficient (0-1), default 0.99 for audio transformers

§primary_leakage: Option<f64>

Optional explicit primary leakage inductance in Henries.

§secondary_leakage: Option<f64>

Optional explicit secondary leakage inductance in Henries.

§magnetizing_inductance: Option<f64>

Optional explicit magnetizing inductance in Henries.

§core_loss_resistance: Option<f64>

Optional core-loss resistance in Ohms.

§core_primary_turns: Option<f64>

Optional primary turns for a nonlinear magnetizing core model.

§core_area: Option<f64>

Optional core cross-sectional area in square meters.

§core_path_length: Option<f64>

Optional magnetic path length in meters.

§core_gap: Option<f64>

Optional air gap length in meters.

§dc_bias_current: Option<f64>

Optional standing primary DC bias current in Amps.

§ja_ms: Option<f64>

Optional Jiles-Atherton saturation magnetization in A/m.

§ja_a: Option<f64>

Optional Jiles-Atherton anhysteretic shape parameter in A/m.

§ja_alpha: Option<f64>

Optional Jiles-Atherton inter-domain coupling.

§ja_k: Option<f64>

Optional Jiles-Atherton domain-wall pinning parameter in A/m.

§ja_c: Option<f64>

Optional Jiles-Atherton reversible magnetization fraction.

§tertiary_turns_ratio: Option<f64>

Optional tertiary winding turns ratio (primary:tertiary). When present, the transformer is modeled as a 3-winding R-type adaptor. Used for transformers with NFB windings (e.g., Fairchild 670 sidechain output).

Implementations§

Source§

impl TransformerConfig

Source

pub fn new(turns_ratio: f64, primary_inductance: f64) -> Self

Create a simple transformer with turns ratio and inductance.

Source

pub fn with_model(turns_ratio: f64, model: String) -> Self

Create a transformer backed by an embedded model-library entry.

Source

pub fn with_center_tap(self) -> Self

Create a center-tapped secondary transformer.

Source

pub fn with_push_pull_primary(self) -> Self

Create a push-pull primary transformer.

Source

pub fn with_dcr(self, primary: f64, secondary: f64) -> Self

Add DC resistance to windings.

Source

pub fn with_capacitance(self, cap: f64) -> Self

Add parasitic capacitance.

Source

pub fn with_tertiary(self, tertiary_turns_ratio: f64) -> Self

Add a tertiary winding with the given primary:tertiary turns ratio.

Source

pub fn has_tertiary(&self) -> bool

Returns true if this transformer has a tertiary (third) winding.

Trait Implementations§

Source§

impl Clone for TransformerConfig

Source§

fn clone(&self) -> TransformerConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TransformerConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TransformerConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for TransformerConfig

Source§

fn eq(&self, other: &TransformerConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for TransformerConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more