pub struct RoundWire { /* private fields */ }Expand description
A flexible, round bar made of a conducting material, usually a metal such as copper, possibly with an insulation layer.
This is the “classic” round wire used in the vast majority of electrical machines. It is defined by the following fields:
outer_diameter: Outer diameter of the conductor. Must be positive (outer_diameter > 0 m).inner_diameter: Inner diameter of the conductor. Must be positive or zero, but smaller thanouter_diameter(outer_diameter > inner_diameter >= 0 m). A positive value means the conductor is hollow, e.g. to form a channel for cooling fluids.insulation_thickness: Thickness of the insulation layer wrapped around the outer diameter. Must be positive or zero (insulation_thickness >= 0 m), with zero equals no insulation layer.conductor_material: The material of the conductor.
The effective conductor area is the space between the inner and the outer diameter:
use std::sync::Arc;
use std::f64::consts::PI;
use approx::assert_abs_diff_eq;
use stem_wire::prelude::*;
let wire_round = RoundWire::new(
Arc::new(Material::default()),
Length::new::<millimeter>(2.0), // outer_diameter
Length::new::<millimeter>(1.0), // inner_diameter
Length::new::<millimeter>(0.1), // insulation_thickness
).expect("valid inputs");
assert_abs_diff_eq!(
wire_round.effective_conductor_area(Area::new::<square_millimeter>(20.0), 3).get::<square_millimeter>(),
PI - 0.25*PI,
epsilon = 1e-3
);§Deserialization
All length fields accept SI units during deserialization (e.g. 8 mm, 0.5 m).
See crate-level and dyn_quantity documentation for details.
Implementations§
Source§impl RoundWire
impl RoundWire
Sourcepub fn new(
conductor_material: Arc<Material>,
outer_diameter: Length,
inner_diameter: Length,
insulation_thickness: Length,
) -> Result<Self, Error>
pub fn new( conductor_material: Arc<Material>, outer_diameter: Length, inner_diameter: Length, insulation_thickness: Length, ) -> Result<Self, Error>
Returns a new instance of RoundWire if the given field values fulfill
the following conditions:
outer_diametermust be positive (outer_diameter > 0 m).inner_diametermust be positive or zero (inner_diameter >= 0 m).insulation_thicknessmust be positive or zero (insulation_thickness >= 0 m).
See the struct docstring RoundWire for more.
§Examples
use std::sync::Arc;
use stem_wire::prelude::*;
assert!(RoundWire::new(
Arc::new(Material::default()),
Length::new::<millimeter>(2.0),
Length::new::<millimeter>(1.0),
Length::new::<millimeter>(0.1)
).is_ok());
// Outer diameter negative
assert!(RoundWire::new(
Arc::new(Material::default()),
Length::new::<millimeter>(-2.0),
Length::new::<millimeter>(1.0),
Length::new::<millimeter>(0.1)
).is_err());
// Outer diameter zero
assert!(RoundWire::new(
Arc::new(Material::default()),
Length::new::<millimeter>(0.0),
Length::new::<millimeter>(1.0),
Length::new::<millimeter>(0.1)
).is_err());
// Inner diameter larger than outer diameter
assert!(RoundWire::new(
Arc::new(Material::default()),
Length::new::<millimeter>(2.0),
Length::new::<millimeter>(2.2),
Length::new::<millimeter>(0.1)
).is_err());
// Inner diameter equals outer diameter
assert!(RoundWire::new(
Arc::new(Material::default()),
Length::new::<millimeter>(2.0),
Length::new::<millimeter>(2.0),
Length::new::<millimeter>(0.1)
).is_err());
// Inner diameter negative
assert!(RoundWire::new(
Arc::new(Material::default()),
Length::new::<millimeter>(0.0),
Length::new::<millimeter>(-1.0),
Length::new::<millimeter>(0.1)
).is_err());
// Insulation negative
assert!(RoundWire::new(
Arc::new(Material::default()),
Length::new::<millimeter>(2.0),
Length::new::<millimeter>(1.0),
Length::new::<millimeter>(-0.1)
).is_err());Sourcepub fn insulation_diameter(&self) -> Length
pub fn insulation_diameter(&self) -> Length
Returns the “insulation” diameter of the wire (outer diameter plus two times insulation layer)
§Examples
use std::sync::Arc;
use stem_wire::prelude::*;
let wire = RoundWire::new(
Arc::new(Material::default()),
Length::new::<millimeter>(2.0),
Length::new::<millimeter>(0.0),
Length::new::<millimeter>(0.1)
).expect("valid inputs");
assert_eq!(wire.insulation_diameter().get::<millimeter>(), 2.2);Sourcepub fn outer_diameter(&self) -> Length
pub fn outer_diameter(&self) -> Length
Returns the outer diameter of the conductor.
Sourcepub fn inner_diameter(&self) -> Length
pub fn inner_diameter(&self) -> Length
Returns the inner diameter of the conductor.
Sourcepub fn insulation_thickness(&self) -> Length
pub fn insulation_thickness(&self) -> Length
Returns the thickness of the insulation layer.
Sourcepub fn conductor_area(&self) -> Area
pub fn conductor_area(&self) -> Area
Returns the conductor area of the wire.
This function returns the same value as Wire::effective_conductor_area,
but does not require zone_area and turns due to all needed information
being stored within the RoundWire struct.
§Examples
use std::sync::Arc;
use stem_wire::prelude::*;
let wire = RoundWire::new(
Arc::new(Material::default()),
Length::new::<millimeter>(2.0),
Length::new::<millimeter>(0.0),
Length::new::<millimeter>(0.1)
).expect("valid inputs");
assert_eq!(
wire.conductor_area(),
wire.effective_conductor_area(Default::default(), 0)
);Sourcepub fn overall_area(&self) -> Area
pub fn overall_area(&self) -> Area
Returns the overall area of the wire.
This function returns the same value as Wire::effective_overall_area,
but does not require zone_area and turns due to all needed information
being stored within the RoundWire struct.
§Examples
use std::sync::Arc;
use stem_wire::prelude::*;
let wire = RoundWire::new(
Arc::new(Material::default()),
Length::new::<millimeter>(2.0),
Length::new::<millimeter>(0.0),
Length::new::<millimeter>(0.1)
).expect("valid inputs");
assert_eq!(
wire.overall_area(),
wire.effective_overall_area(Default::default(), 0)
);Trait Implementations§
Source§impl<'de> Deserialize<'de> for RoundWire
Available on crate feature serde only.
impl<'de> Deserialize<'de> for RoundWire
serde only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl Wire for RoundWire
impl Wire for RoundWire
Source§fn material(&self) -> &Material
fn material(&self) -> &Material
Source§fn effective_conductor_area(&self, _zone_area: Area, _turns: usize) -> Area
fn effective_conductor_area(&self, _zone_area: Area, _turns: usize) -> Area
Source§fn effective_overall_area(&self, _zone_area: Area, _turns: usize) -> Area
fn effective_overall_area(&self, _zone_area: Area, _turns: usize) -> Area
Source§fn resistance(
&self,
length: Length,
zone_area: Area,
turns: usize,
conditions: &[DynQuantity<f64>],
) -> ElectricalResistance
fn resistance( &self, length: Length, zone_area: Area, turns: usize, conditions: &[DynQuantity<f64>], ) -> ElectricalResistance
length under influence of
the specified conditions. Read moreAuto Trait Implementations§
impl Freeze for RoundWire
impl !RefUnwindSafe for RoundWire
impl Send for RoundWire
impl Sync for RoundWire
impl Unpin for RoundWire
impl UnsafeUnpin for RoundWire
impl !UnwindSafe for RoundWire
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more