pub enum Core {
Lin(LinCore),
Rot(RotCore),
}Expand description
An owning enum wrapping a LinCore or RotCore.
This enum is meant for use cases where a magnetic core is needed but the type
(linear or rotary) is unknown until runtime. This enum provides a 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(),
}
}Variants§
Implementations§
Source§impl Core
impl Core
Sourcepub fn set_flux_barrier(
&mut self,
flux_barrier: Option<Box<dyn FluxBarrier>>,
) -> Result<(), IncompatibleFluxBarrier>
pub fn set_flux_barrier( &mut self, flux_barrier: Option<Box<dyn FluxBarrier>>, ) -> Result<(), IncompatibleFluxBarrier>
Fallibly inserts a new FluxBarrier into self or removes an
existing one.
If flux_barrier is Some, it is checked whether the wrapped
FluxBarrier is compatible to self by creating the flux barrier
contours via the FluxBarrier::combine method and checking if those
fit into the shape of self. If FluxBarrier::combine fails or if
the contours don’t fit, the resulting error is wrapped into
IncompatibleFluxBarrier and returned together with the given
FluxBarrier. Otherwise, the old flux barrier of self will be
replaced with the new one. If flux_barrier is None and self has a
flux barrier, it will be removed. Otherwise, this is a no-op.
This method forwards to either LinCore::set_flux_barrier or
RotCore::set_flux_barrier, see their docstrings for examples.
Trait Implementations§
Source§impl CoreExt for Core
impl CoreExt for Core
Source§fn air_gap(&self) -> &dyn AirGap
fn air_gap(&self) -> &dyn AirGap
AirGap trait object describing the air
gap contour of the core.Source§fn axial_length(&self) -> Length
fn axial_length(&self) -> Length
Source§fn iron_fill_factor(&self) -> f64
fn iron_fill_factor(&self) -> f64
Source§fn pole_pairs(&self) -> NonZeroU16
fn pole_pairs(&self) -> NonZeroU16
self.Source§fn yoke_height(&self) -> Length
fn yoke_height(&self) -> Length
Source§fn skew_angle(&self) -> f64
fn skew_angle(&self) -> f64
Source§fn air_gap_length(&self) -> Length
fn air_gap_length(&self) -> Length
Source§fn lin_or_rot(&self) -> LinOrRot
fn lin_or_rot(&self) -> LinOrRot
Source§fn axial_coil_overhang(&self) -> Length
fn axial_coil_overhang(&self) -> Length
Source§fn flux_barrier(&self) -> Option<&dyn FluxBarrier>
fn flux_barrier(&self) -> Option<&dyn FluxBarrier>
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
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>
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
Source§fn poles(&self) -> NonZeroU16
fn poles(&self) -> NonZeroU16
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>
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
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
self. Read moreSource§fn num_segments(&self) -> usize
fn num_segments(&self) -> usize
Source§fn segment_angle(&self, segment: usize) -> f64
fn segment_angle(&self, segment: usize) -> f64
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>
Source§fn surface_magnets(
&self,
magnet_assembly: &MagnetAssembly,
split: bool,
) -> Magnets ⓘ
fn surface_magnets( &self, magnet_assembly: &MagnetAssembly, split: bool, ) -> Magnets ⓘ
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
self. Read moreSource§fn interior_magnets(&self, split: bool) -> Magnets ⓘ
fn interior_magnets(&self, split: bool) -> Magnets ⓘ
PositionedMagnetShapes within
the flux barrier of self. Read moreSource§fn interior_magnet_assemblies(&self) -> &[MagnetAssembly]
fn interior_magnet_assemblies(&self) -> &[MagnetAssembly]
Source§fn surface_magnets_mass(
&self,
magnet_assembly: &MagnetAssembly,
) -> VarQuantity<Mass>
fn surface_magnets_mass( &self, magnet_assembly: &MagnetAssembly, ) -> VarQuantity<Mass>
self. Read moreSource§fn interior_magnets_mass(&self) -> VarQuantity<Mass>
fn interior_magnets_mass(&self) -> VarQuantity<Mass>
self. Read moreSource§fn slot_opening_factor(&self, spatial_order: SpatialOrder) -> f64
fn slot_opening_factor(&self, spatial_order: SpatialOrder) -> f64
spatial_order. Read moreSource§fn current_displacement_coefficients(&self) -> CurrentDisplacementCalculator
fn current_displacement_coefficients(&self) -> CurrentDisplacementCalculator
self. Read moreSource§fn tooth_height(&self) -> Length
fn tooth_height(&self) -> Length
Source§fn tooth_width_at(&self, height: Length) -> Length
fn tooth_width_at(&self, height: Length) -> Length
Source§fn is_windable(&self) -> bool
fn is_windable(&self) -> bool
Source§fn air_gap_area(&self) -> Area
fn air_gap_area(&self) -> Area
Source§fn drawable(&self) -> DrawableCow<'_>
fn drawable(&self) -> DrawableCow<'_>
Source§fn iron_length(&self) -> Length
fn iron_length(&self) -> Length
Source§fn cross_section_area(&self) -> Area
fn cross_section_area(&self) -> Area
Source§fn teeth_mass(&self) -> VarQuantity<Mass>
fn teeth_mass(&self) -> VarQuantity<Mass>
Source§fn skew_factor(&self, spatial_order: SpatialOrder) -> f64
fn skew_factor(&self, spatial_order: SpatialOrder) -> f64
spatial_order.` Read moreSource§fn axial_coil_length(&self) -> Length
fn axial_coil_length(&self) -> Length
Source§fn slotting_order(&self, k: NonZeroU32) -> SpatialOrder
fn slotting_order(&self, k: NonZeroU32) -> SpatialOrder
k-th slotting harmonic. Read moreSource§fn d_axis_offset(&self) -> f64
fn d_axis_offset(&self) -> f64
Source§impl<'de> Deserialize<'de> for Core
impl<'de> Deserialize<'de> for Core
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>,
Auto Trait Implementations§
impl !RefUnwindSafe for Core
impl !UnwindSafe for Core
impl Forget for Core
impl Freeze for Core
impl Move for Core
impl Send for Core
impl Sync for Core
impl Unpin for Core
impl UnsafeUnpin for Core
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
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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 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<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.