pub struct Network {
pub name: String,
pub rank: i32,
pub frequency_unit: String,
pub parameter: String,
pub format: String,
pub resistance_string: String,
pub z0: f64,
pub comments: Vec<String>,
pub comments_after_option_line: Vec<String>,
pub f: Vec<f64>,
pub s: Vec<ParsedDataLine>,
}Fields§
§name: String§rank: i32§frequency_unit: String§parameter: String§format: String§resistance_string: String§z0: f64§comments: Vec<String>§comments_after_option_line: Vec<String>§f: Vec<f64>§s: Vec<ParsedDataLine>Implementations§
Source§impl Network
impl Network
pub fn new(file_path: String) -> Self
pub fn print_summary(&self)
pub fn f(&self) -> Vec<f64>
pub fn s_db(&self, j: i8, k: i8) -> Vec<FrequencyDB>
pub fn s_ri(&self, j: i8, k: i8) -> Vec<FrequencyRI>
pub fn s_ma(&self, j: i8, k: i8) -> Vec<FrequencyMA>
Sourcepub fn cascade(&self, other: &Network) -> Network
pub fn cascade(&self, other: &Network) -> Network
Cascade two 2-port networks (standard connection: port 2 → port 1)
For more control over port connections, use cascade_ports().
Sourcepub fn cascade_ports(
&self,
other: &Network,
from_port: usize,
to_port: usize,
) -> Network
pub fn cascade_ports( &self, other: &Network, from_port: usize, to_port: usize, ) -> Network
Cascade two networks with explicit port specification
§Arguments
other- The network to cascade withfrom_port- Output port of self to connect (1-indexed)to_port- Input port of other to connect (1-indexed)
§Examples
use touchstone::Network;
let net1 = Network::new("files/ntwk1.s2p".to_string());
let net2 = Network::new("files/ntwk2.s2p".to_string());
// Standard 2-port cascade (port 2 → port 1)
let result = net1.cascade_ports(&net2, 2, 1);§Current Limitations
- Only 2-port networks with standard connection (2→1) are currently supported
- N-port cascade (N > 2) will be implemented in a future release
§Panics
- If port numbers are out of range
- If networks are not 2-port
- If connection is not standard (2→1) for 2-port networks
pub fn save(&self, file_path: &str) -> Result<()>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Network
impl RefUnwindSafe for Network
impl Send for Network
impl Sync for Network
impl Unpin for Network
impl UnwindSafe for Network
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more