Skip to main content

Core

Enum Core 

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

§

Lin(LinCore)

A wrapped LinCore.

§

Rot(RotCore)

A wrapped RotCore.

Implementations§

Source§

impl Core

Source

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

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

Source

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

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

Source

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 Clone for Core

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 CoreExt for Core

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<'a>(&'a self) -> &'a 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 against the “start” of the core in electrical radians. Read more
Source§

impl Debug for Core

Source§

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

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

impl<'de> Deserialize<'de> for Core

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. 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 From<LinCore> for Core

Source§

fn from(value: LinCore) -> Self

Converts to this type from the input type.
Source§

impl From<RotCore> for Core

Source§

fn from(value: RotCore) -> Self

Converts to this type from the input type.
Source§

impl Serialize for Core

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFrom<Core> for LinCore

Source§

type Error = Core

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

fn try_from(value: Core) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Core> for RotCore

Source§

type Error = Core

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

fn try_from(value: Core) -> Result<Self, Self::Error>

Performs the conversion.

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> 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

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