Struct TransformerAdaptor
pub struct TransformerAdaptor {
pub port_resistance: f64,
/* private fields */
}Expand description
Ideal transformer adaptor for WDF trees.
Models an ideal transformer with turns ratio n (primary:secondary = n:1). The primary port faces the root (reflection-free), secondary faces child subtree.
Transformer relations:
- Voltage ratio: V₁/V₂ = n
- Current ratio: I₁/I₂ = 1/n
- Power: V₁·I₁ = V₂·I₂ (lossless)
WDF port resistance transformation:
- R_primary = n² × R_secondary
Scattering (primary adapted, S₁₁=0):
- scatter_up: b₁ = n·b₂
- scatter_down: a₂ = a₁/n
For a step-down transformer (n > 1): voltage decreases, current increases. For a step-up transformer (n < 1): voltage increases, current decreases.
Fields§
§port_resistance: f64Port resistance seen from primary (root direction) = n² × R_secondary
Implementations§
§impl TransformerAdaptor
impl TransformerAdaptor
pub fn new(
turns_ratio: f64,
secondary_port_resistance: f64,
) -> TransformerAdaptor
pub fn new( turns_ratio: f64, secondary_port_resistance: f64, ) -> TransformerAdaptor
Create a transformer adaptor.
turns_ratio— n = primary turns / secondary turns (e.g., 10.0 for 10:1 step-down)secondary_port_resistance— port resistance of the secondary side subtree
pub fn update_secondary(&mut self, secondary_port_resistance: f64)
pub fn update_secondary(&mut self, secondary_port_resistance: f64)
Update when secondary subtree port resistance changes.
pub fn set_turns_ratio(
&mut self,
turns_ratio: f64,
secondary_port_resistance: f64,
)
pub fn set_turns_ratio( &mut self, turns_ratio: f64, secondary_port_resistance: f64, )
Update turns ratio (for variable transformers / tap switching).
pub fn turns_ratio(&self) -> f64
pub fn turns_ratio(&self) -> f64
Get current turns ratio.
pub fn scatter_up(&mut self, b2: f64) -> f64
pub fn scatter_up(&mut self, b2: f64) -> f64
scatter_up: secondary (child) sends b₂, produce b₁ to primary (parent/root).
Voltage is scaled up by turns ratio: V₁ = n·V₂
pub fn scatter_down(&self, a1: f64) -> f64
pub fn scatter_down(&self, a1: f64) -> f64
scatter_down: primary (parent) sends a₁, produce a₂ to secondary (child).
Voltage is scaled down by turns ratio: V₂ = V₁/n
pub fn reset(&mut self)
pub fn reset(&mut self)
Reset state.
Trait Implementations§
§impl Clone for TransformerAdaptor
impl Clone for TransformerAdaptor
§fn clone(&self) -> TransformerAdaptor
fn clone(&self) -> TransformerAdaptor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more