pub enum CoreRef<'a> {
Lin(&'a LinCore),
Rot(&'a RotCore),
}Expand description
A borrowing enum wrapping a LinCore or RotCore reference.
This enum is meant for use cases where a reference to a magnetic core is needed
but the type (linear or rotary) is unknown until runtime. This enum provides an
type-erased wrapper which “behaves like” a magnetic core by implementing
CoreExt. Every method implementation looks like this:
ⓘ
fn pole_pairs(&self) -> u16 {
match self {
Self::Lin(c) => (*c).pole_pairs(),
Self::Rot(c) => (*c).pole_pairs(),
}
}This wrapper is particularly useful for the AirGap
and FluxBarrier traits, since these are meant to be used for creating trait
objects and therefore don’t have generic methods. Therefore, the trait methods
require passing a CoreRef object, which can be created via the
CoreExt::as_core_ref method from a LinCore, RotCore or Core.
Variants§
Implementations§
Trait Implementations§
impl<'a> Copy for CoreRef<'a>
Source§impl<'a> CoreExt for CoreRef<'a>
impl<'a> CoreExt for CoreRef<'a>
Source§fn air_gap(&self) -> &dyn AirGap
fn air_gap(&self) -> &dyn AirGap
Returns a reference to the
AirGap trait object describing the air
gap contour of the core.Source§fn axial_length(&self) -> Length
fn axial_length(&self) -> Length
Returns the axial length of the core, i.e., the length into the image
plane when looking at the cross section of the core. Read more
Source§fn iron_fill_factor(&self) -> f64
fn iron_fill_factor(&self) -> f64
Returns the iron fill factor of the core, which is the ratio of the iron
volume to the total core volume. Read more
Source§fn pole_pairs(&self) -> NonZeroU16
fn pole_pairs(&self) -> NonZeroU16
Returns the number of pole pairs of
self.Source§fn yoke_height(&self) -> Length
fn yoke_height(&self) -> Length
Returns the yoke height of the core. Read more
Source§fn skew_angle(&self) -> f64
fn skew_angle(&self) -> f64
Returns the skew angle of the core. Read more
Source§fn air_gap_length(&self) -> Length
fn air_gap_length(&self) -> Length
Returns the air gap “length” of the core. Read more
Source§fn lin_or_rot(&self) -> LinOrRot
fn lin_or_rot(&self) -> LinOrRot
Returns if the core is linear or rotary.
Source§fn axial_coil_overhang(&self) -> Length
fn axial_coil_overhang(&self) -> Length
Returns the total axial coil overhang on both sides of the magnetic core. Read more
Source§fn flux_barrier(&self) -> Option<&dyn FluxBarrier>
fn flux_barrier(&self) -> Option<&dyn FluxBarrier>
Returns a reference to the
FluxBarrier trait object describing the
flux barrier of the core, if it has one. If it hasn’t, this method
returns None.Source§fn as_core_ref(&self) -> CoreRef<'_>
fn as_core_ref(&self) -> CoreRef<'_>
Source§fn pole_coverage(&self, surface_magnet_assembly: Option<&MagnetAssembly>) -> f64
fn pole_coverage(&self, surface_magnet_assembly: Option<&MagnetAssembly>) -> f64
Returns the d-axis pole coverage of
self as a relative fraction of the
entire air gap surface (value between 0 and 1). 0 means that the entire
air gap surface is covered by the q-axis, 1 means that it is completely
covered by the d-axis. Read moreSource§fn tooth_mass(&self) -> VarQuantity<Mass>
fn tooth_mass(&self) -> VarQuantity<Mass>
Returns the mass of a single tooth. Read more
Source§fn air_gap_curvature_factor(
&self,
effective_air_gap: Length,
spatial_order: SpatialOrder,
) -> f64
fn air_gap_curvature_factor( &self, effective_air_gap: Length, spatial_order: SpatialOrder, ) -> f64
Returns the curvature factor for the specified spatial order. Read more
Source§fn poles(&self) -> NonZeroU16
fn poles(&self) -> NonZeroU16
Returns the total number of poles. Read more
Source§fn assembly_check(
&self,
coil_layout: &CoilLayout,
surface_magnet_assembly: Option<&MagnetAssembly>,
epsilon: f64,
max_relative: f64,
) -> Result<(), AssemblyFailure>
fn assembly_check( &self, coil_layout: &CoilLayout, surface_magnet_assembly: Option<&MagnetAssembly>, epsilon: f64, max_relative: f64, ) -> Result<(), AssemblyFailure>
Checks if the core can be assembled with the given
coil_layout and
surface_magnet_assembly, using epsilon and max_relative as tolerances
for overlap checks. Read moreSource§fn slot_pitch(&self) -> Length
fn slot_pitch(&self) -> Length
Returns the slot pitch of the core. This is the quotient of the
air_gap_length and the number of
slots.Source§fn carter_factor(&self, geometrical_air_gap: Length) -> f64
fn carter_factor(&self, geometrical_air_gap: Length) -> f64
Returns the Carter factor of
self. Read moreSource§fn num_segments(&self) -> usize
fn num_segments(&self) -> usize
Returns the discretization / number of segments of the core. Read more
Source§fn segment_angle(&self, segment: usize) -> f64
fn segment_angle(&self, segment: usize) -> f64
Returns the staggering angle of a particular
segment. Read moreSource§fn winding_zones(&self, coil_layout: &CoilLayout) -> WindingZones ⓘ
fn winding_zones(&self, coil_layout: &CoilLayout) -> WindingZones ⓘ
Source§fn winding_zone_at(
&self,
coil_layout: &CoilLayout,
zone: Zone,
) -> Option<Contour>
fn winding_zone_at( &self, coil_layout: &CoilLayout, zone: Zone, ) -> Option<Contour>
Returns the contour of the winding zone, if it exists. Read more
Source§fn surface_magnets(
&self,
magnet_assembly: &MagnetAssembly,
split: bool,
) -> Magnets ⓘ
fn surface_magnets( &self, magnet_assembly: &MagnetAssembly, split: bool, ) -> Magnets ⓘ
Returns an iterator over the surface
PositionedMagnetShapes for
the given magnet_assembly. Read moreSource§fn num_surface_magnets(&self, magnet_assembly: &MagnetAssembly) -> NonZeroUsize
fn num_surface_magnets(&self, magnet_assembly: &MagnetAssembly) -> NonZeroUsize
Returns the total number of surface magnets mounted on
self. Read moreSource§fn interior_magnets(&self, split: bool) -> Magnets ⓘ
fn interior_magnets(&self, split: bool) -> Magnets ⓘ
Returns an iterator over the interior
PositionedMagnetShapes within
the flux barrier of self. Read moreSource§fn interior_magnet_assemblies(&self) -> &[MagnetAssembly]
fn interior_magnet_assemblies(&self) -> &[MagnetAssembly]
Returns all different magnet assemblies placed within the flux barrier,
if the core has one. Read more
Source§fn surface_magnets_mass(
&self,
magnet_assembly: &MagnetAssembly,
) -> VarQuantity<Mass>
fn surface_magnets_mass( &self, magnet_assembly: &MagnetAssembly, ) -> VarQuantity<Mass>
Returns the total mass of all surface magnets mounted on
self. Read moreSource§fn interior_magnets_mass(&self) -> VarQuantity<Mass>
fn interior_magnets_mass(&self) -> VarQuantity<Mass>
Returns the total mass of all interior magnets mounted in the flux
barrier of
self. Read moreSource§fn slot_opening_factor(&self, spatial_order: SpatialOrder) -> f64
fn slot_opening_factor(&self, spatial_order: SpatialOrder) -> f64
Returns the slot opening factor for the harmonic with the specified
spatial_order. Read moreSource§fn current_displacement_coefficients(&self) -> CurrentDisplacementCalculator
fn current_displacement_coefficients(&self) -> CurrentDisplacementCalculator
Returns the current displacement coefficients for a winding mounted on
self. Read moreSource§fn tooth_height(&self) -> Length
fn tooth_height(&self) -> Length
Returns the tooth height of the core. Read more
Source§fn tooth_width_at(&self, height: Length) -> Length
fn tooth_width_at(&self, height: Length) -> Length
Returns the tooth width at a specific height, measured from the air gap. Read more
Source§fn is_windable(&self) -> bool
fn is_windable(&self) -> bool
Returns whether a winding can be mounted on the core or not. Read more
Source§fn air_gap_area(&self) -> Area
fn air_gap_area(&self) -> Area
Returns the air gap surface area of the core. Read more
Source§fn drawable(&self) -> DrawableCow<'_>
fn drawable(&self) -> DrawableCow<'_>
Source§fn iron_length(&self) -> Length
fn iron_length(&self) -> Length
Returns the effective iron length of the core. Read more
Source§fn cross_section_area(&self) -> Area
fn cross_section_area(&self) -> Area
Returns the cross section area of the core. Read more
Source§fn teeth_mass(&self) -> VarQuantity<Mass>
fn teeth_mass(&self) -> VarQuantity<Mass>
Returns the mass of all teeth. Read more
Source§fn skew_factor(&self, spatial_order: SpatialOrder) -> f64
fn skew_factor(&self, spatial_order: SpatialOrder) -> f64
Returns the skew factor of the core for the given
spatial_order.` Read moreSource§fn axial_coil_length(&self) -> Length
fn axial_coil_length(&self) -> Length
Returns the length of a half-coil turn inside the core. Read more
Source§fn slotting_order(&self, k: NonZeroU32) -> SpatialOrder
fn slotting_order(&self, k: NonZeroU32) -> SpatialOrder
Returns the spatial order of the
k-th slotting harmonic. Read moreSource§fn d_axis_offset(&self) -> f64
fn d_axis_offset(&self) -> f64
Returns the offset of the first positive d-axis from the “start” of
the core in electrical radians. Read more
Source§fn first_slot_offset(&self) -> f64
fn first_slot_offset(&self) -> f64
Returns the offset of the first slot middle from the “start” of
the core in electrical radians. Read more
Source§fn first_slot_to_d_axis(&self) -> f64
fn first_slot_to_d_axis(&self) -> f64
Returns the electrical angle from the middle of the first slot to the
first positive d-axis in electrical radians. Read more
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for CoreRef<'a>
impl<'a> !UnwindSafe for CoreRef<'a>
impl<'a> Forget for CoreRef<'a>
impl<'a> Freeze for CoreRef<'a>
impl<'a> Move for CoreRef<'a>
impl<'a> Send for CoreRef<'a>
impl<'a> Sync for CoreRef<'a>
impl<'a> Unpin for CoreRef<'a>
impl<'a> UnsafeUnpin for CoreRef<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
Converts
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> ⓘ
Converts
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> SendAlias for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.