Skip to main content

CoreRef

Enum CoreRef 

Source
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§

§

Lin(&'a LinCore)

A reference to a LinCore.

§

Rot(&'a RotCore)

A reference to a RotCore.

Implementations§

Source§

impl<'a> CoreRef<'a>

Source

pub fn lin<'core>(&'core self) -> Option<&'core LinCore>

Returns the underlying LinCore reference, if self wraps one. If self wraps a RotCore reference, this method returns None instead.

Source

pub fn rot<'core>(&'core self) -> Option<&'core RotCore>

Returns the underlying RotCore reference, if self wraps one. If self wraps a LinCore reference, this method returns None instead.

Trait Implementations§

Source§

impl<'a> Clone for CoreRef<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for CoreRef<'a>

Source§

impl<'a> CoreExt for CoreRef<'a>

Source§

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

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

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

Returns the number of pole pairs of self.
Source§

fn material(&self) -> &Arc<Material> ⓘ

Returns a reference to the core Material.
Source§

fn yoke_height(&self) -> Length

Returns the yoke height of the core. Read more
Source§

fn skew_angle(&self) -> f64

Returns the skew angle of the core. Read more
Source§

fn air_gap_length(&self) -> Length

Returns the air gap “length” of the core. Read more
Source§

fn lin_or_rot(&self) -> LinOrRot

Returns if the core is linear or rotary.
Source§

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>

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 shape(&self) -> &Shape

Returns a reference to the cross-section shape of self.
Source§

fn as_core_ref(&self) -> CoreRef<'_>

Converts the reference of self into a CoreRef enum. Read more
Source§

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 more
Source§

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

Returns the curvature factor for the specified spatial order. Read more
Source§

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>

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 more
Source§

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

Returns the Carter factor of self. Read more
Source§

fn num_segments(&self) -> usize

Returns the discretization / number of segments of the core. Read more
Source§

fn segment_angle(&self, segment: usize) -> f64

Returns the staggering angle of a particular segment. Read more
Source§

fn winding_zones(&self, coil_layout: &CoilLayout) -> WindingZones ⓘ

Returns an iterator over the PositionedZoneContours for the given coil_layout. Read more
Source§

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 ⓘ

Returns an iterator over the surface PositionedMagnetShapes for the given magnet_assembly. Read more
Source§

fn num_surface_magnets(&self, magnet_assembly: &MagnetAssembly) -> NonZeroUsize

Returns the total number of surface magnets mounted on self. Read more
Source§

fn interior_magnets(&self, split: bool) -> Magnets ⓘ

Returns an iterator over the interior PositionedMagnetShapes within the flux barrier of self. Read more
Source§

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>

Returns the total mass of all surface magnets mounted on self. Read more
Source§

fn interior_magnets_mass(&self) -> VarQuantity<Mass>

Returns the total mass of all interior magnets mounted in the flux barrier of self. Read more
Source§

fn slots(&self) -> u16

Returns the number of “slots” for a winding. Read more
Source§

fn slot_opening_factor(&self, spatial_order: SpatialOrder) -> f64

Returns the slot opening factor for the harmonic with the specified spatial_order. Read more
Source§

fn current_displacement_coefficients(&self) -> CurrentDisplacementCalculator

Returns the current displacement coefficients for a winding mounted on self. Read more
Source§

fn slot(&self) -> Option<&dyn Slot>

Returns the slot type of the air gap. Read more
Source§

fn tooth_height(&self) -> Length

Returns the tooth height of the core. Read more
Source§

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

Returns whether a winding can be mounted on the core or not. Read more
Source§

fn slotted(&self) -> bool

Returns whether the core has slots. Read more
Source§

fn air_gap_area(&self) -> Area

Returns the air gap surface area of the core. Read more
Source§

fn drawable(&self) -> DrawableCow<'_>

Returns CoreExt::shape wrapped in a DrawableCow. Read more
Source§

fn iron_length(&self) -> Length

Returns the effective iron length of the core. Read more
Source§

fn cross_section_area(&self) -> Area

Returns the cross section area of the core. Read more
Source§

fn volume(&self) -> Volume

Returns the volume of the core. Read more
Source§

fn mass(&self) -> VarQuantity<Mass>

Returns the mass of the core. Read more
Source§

fn teeth_mass(&self) -> VarQuantity<Mass>

Returns the mass of all teeth. Read more
Source§

fn yoke_mass(&self) -> VarQuantity<Mass>

Returns the mass of the yoke area. Read more
Source§

fn skew_factor(&self, spatial_order: SpatialOrder) -> f64

Returns the skew factor of the core for the given spatial_order.` Read more
Source§

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

Returns the spatial order of the k-th slotting harmonic. Read more
Source§

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

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

Returns the electrical angle from the middle of the first slot to the first positive d-axis in electrical radians. Read more
Source§

impl<'a> Debug for CoreRef<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> From<&'a Core> for CoreRef<'a>

Source§

fn from(value: &'a Core) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a LinCore> for CoreRef<'a>

Source§

fn from(value: &'a LinCore) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a RotCore> for CoreRef<'a>

Source§

fn from(value: &'a RotCore) -> Self

Converts to this type from the input type.
Source§

impl<'a, 'b> From<&'b CoreRef<'a>> for CoreRef<'a>

Source§

fn from(value: &'b CoreRef<'a>) -> Self

Converts to this type from the input type.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SendAlias for T

Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

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

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> SyncAlias for T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V