pub struct RectangularWire { /* private fields */ }Expand description
A rectangular bar made of a conducting material, usually a metal such as copper, possibly with an insulation layer.
This type of wire is often found in “constructed” windings such as hairpin windings with a low number of turns per coil. It is defined by the following fields:
height: Height of the bar. Must be positive.width: Width of the bar. Must be positive.insulation_thickness: Thickness of the insulation layer wrapped around the outer diameter. Must be positive or zero (zero means 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), // height
Length::new::<millimeter>(1.0), // width
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 RectangularWire
impl RectangularWire
Sourcepub fn new(
conductor_material: Arc<Material>,
height: Length,
width: Length,
insulation_thickness: Length,
) -> Result<Self, Error>
pub fn new( conductor_material: Arc<Material>, height: Length, width: Length, insulation_thickness: Length, ) -> Result<Self, Error>
Returns a new instance of RectangularWire if the given field values
fulfill the following conditions:
heightmust be positive.widthmust be positive.insulation_thicknessmust be positive or zero.
See the struct docstring RectangularWire for more.
§Examples
use std::sync::Arc;
use stem_wire::prelude::*;
assert!(RectangularWire::new(
Arc::new(Material::default()),
Length::new::<millimeter>(2.0),
Length::new::<millimeter>(1.0),
Length::new::<millimeter>(0.1)
).is_ok());
// Height is not positive
assert!(RectangularWire::new(
Arc::new(Material::default()),
Length::new::<millimeter>(0.0),
Length::new::<millimeter>(1.0),
Length::new::<millimeter>(0.1)
).is_err());
// Width is not positive
assert!(RectangularWire::new(
Arc::new(Material::default()),
Length::new::<millimeter>(2.0),
Length::new::<millimeter>(-1.0),
Length::new::<millimeter>(0.1)
).is_err());
// Insulation thickness is negative
assert!(RectangularWire::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_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 RectangularWire struct.
§Examples
use std::sync::Arc;
use stem_wire::prelude::*;
let wire = RectangularWire::new(
Arc::new(Material::default()),
Length::new::<millimeter>(2.0),
Length::new::<millimeter>(1.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 RectangularWire struct.
§Examples
use std::sync::Arc;
use stem_wire::prelude::*;
let wire = RectangularWire::new(
Arc::new(Material::default()),
Length::new::<millimeter>(2.0),
Length::new::<millimeter>(1.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 Clone for RectangularWire
impl Clone for RectangularWire
Source§fn clone(&self) -> RectangularWire
fn clone(&self) -> RectangularWire
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RectangularWire
impl Debug for RectangularWire
Source§impl Default for RectangularWire
impl Default for RectangularWire
Source§fn default() -> RectangularWire
fn default() -> RectangularWire
Source§impl<'de> Deserialize<'de> for RectangularWire
Available on crate feature serde only.
impl<'de> Deserialize<'de> for RectangularWire
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 Serialize for RectangularWire
impl Serialize for RectangularWire
Source§impl Wire for RectangularWire
impl Wire for RectangularWire
Source§fn material(&self) -> &Material
fn material(&self) -> &Material
Source§fn material_arc(&self) -> Arc<Material>
fn material_arc(&self) -> Arc<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 RectangularWire
impl !RefUnwindSafe for RectangularWire
impl Send for RectangularWire
impl Sync for RectangularWire
impl Unpin for RectangularWire
impl UnsafeUnpin for RectangularWire
impl !UnwindSafe for RectangularWire
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