Skip to main content

Stepper

Struct Stepper 

Source
pub struct Stepper {
    pub teeth: f64,
    pub detent: f64,
    pub microstep: f64,
    pub current: f64,
}

Fields§

§teeth: f64

Rotor teeth N (50 for a 1.8 degree motor): 4 N full steps a turn.

§detent: f64

effects.detent_torque: the detent torque’s amplitude, N m; 0 off.

§microstep: f64

One microstep at the motor, rad.

§current: f64

The current vector’s amplitude the drive sets, A: sqrt 2 times a phase’s current in a full step.

Implementations§

Source§

impl Stepper

Source

pub fn from_config(cfg: &Config) -> Result<Self, ConfigError>

Source

pub fn torque(&self, p: &DriveParams, [ia, ib]: [f64; 2], e: f64) -> f64

The torque of phase currents at the rotor’s electrical angle e.

Source

pub fn holding_torque(&self, p: &DriveParams) -> f64

The holding torque: kt times the current the drive sets.

Source

pub fn detent_potential(&self, angle: f64, origin: f64) -> f64

The detent torque’s potential at the rotor angle angle, J: the torque is -T_d sin 4e (e = N (angle - origin)), so U = -T_d cos(4e) / (4 N), whose angle derivative is T_d sin 4e. It is the magnets’ energy (the torque is conservative), enabled or not: the detent’s work is part of the shaft’s, and what the magnets give for it, the change of U, is booked as it happens (Drive::detent_moved, Drive::emf_loss), never stored, so that nothing of it appears or vanishes at an enable or a disable.

Source

pub fn detent_torque(&self, angle: f64, origin: f64) -> f64

The detent torque at the rotor angle angle, N m: -T_d sin 4e, the magnets’ alone, with the drive enabled or not.

Source

pub fn pull_out(&self, p: &DriveParams, speed: f64, supply: f64) -> f64

The pull-out torque at a speed, motoring, with the supply supply (infinite: no limit): the most torque a steady run at that speed can have from currents within the drive’s amplitude I and voltages within the supply. In phasors at the electrical frequency N w, with the back-EMF E = kE w as the real axis and Z = R + j N w L, the torque is kt Re(I) and V = Z I + E: Re(I) at its highest over the intersection of the disc |I| <= I and the disc |I + E / Z| <= U / |Z|. Without detent torque, cold winding.

Source

pub fn braking(&self, p: &DriveParams, speed: f64, supply: f64) -> f64

The braking counterpart of pull_out: the back-EMF helps the current.

Source

pub fn torque_curve( &self, p: &DriveParams, speed: f64, supply: f64, ) -> (f64, f64)

(lowest, highest) torque at a speed, as DriveParams::torque_curve: the pull-out curve and its braking side.

Trait Implementations§

Source§

impl Clone for Stepper

Source§

fn clone(&self) -> Stepper

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 Debug for Stepper

Source§

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

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

impl<'de> Deserialize<'de> for Stepper

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 PartialEq for Stepper

Source§

fn eq(&self, other: &Stepper) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Stepper

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 StructuralPartialEq for Stepper

Auto Trait Implementations§

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<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> 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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.