CYC_ACCEL

Struct CYC_ACCEL 

Source
pub struct CYC_ACCEL { /* private fields */ }

Methods from Deref<Target = Cycle>§

Source

pub fn dt_at_i(&self, i: usize) -> Result<Time>

rust-internal time steps at i

Source

pub fn len_checked(&self) -> Result<usize>

return the length of the cycle

Source

pub fn is_empty(&self) -> Result<bool>

return true if the cycle is empty, else false

Source

pub fn to_csv(&self) -> Result<String>

Write (serialize) cycle to a CSV string

Source

pub fn to_fastsim2(&self) -> Result<Cycle2>

Source

pub fn to_elements(&self) -> Vec<CycleElement>

convert cycle to a vector of CycleElement

Source

pub fn to_microtrips(&self, stop_speed: Option<Velocity>) -> Vec<Cycle>

Convert cycle into a vector of “microtrips”. A microtrip is a start to a subsequent stop plus any idle time.

  • stop_speed: the speed at or below which vehicle is considered “stopped”

RETURN: vector of cycles with each cycle being a “microtrip”.

Source

pub fn average_speed(&self, while_moving: bool) -> Velocity

Determine average speed of cycle. – while_moving: if true, only takes average while moving

RETURN: average speed

Source

pub fn average_step_speeds(&self) -> Vec<Velocity>

Return the average step speeds of the cycle as vector of velicities. NOTE: the average speed from sample i-1 to i will appear as entry i. RETURN: vector of velocities representing average step speeds.

Source

pub fn average_step_speed_at(&self, i: usize) -> Velocity

Calculate the average step speed at step i (i.e., from sample point i-1 to i)

Source

pub fn trapz_step_distances(&self) -> Vec<Length>

The distances traveled over each step using trapezoidal integration.

Source

pub fn trapz_step_elevations(&self) -> Vec<Length>

The elevation climb each step using trapezoidal integration.

Source

pub fn trapz_step_start_distance(&self, step: usize) -> Length

The distance traveled from start to the beginning of step i (i.e., distance traveled up to sample point i-1)

Source

pub fn trapz_distance_for_step(&self, step: usize) -> Length

The distance traveled during the given step (i.e., distance from sample point i-1 to i for step i)

Source

pub fn trapz_distance_over_range(&self, step0: usize, step1: usize) -> Length

Calculate the distance from step i_start to the start of step i_end (i.e., distance from sample point i_start - 1 to i_end - 1)

Source

pub fn time_spent_moving(&self, stopped_speed: Option<Velocity>) -> Time

Calculate the time in a cycle spent moving

  • stopped_speed_m_per_s: the speed above which we are considered to be moving

RETURN: the time spent moving in seconds

Source

pub fn distance_and_target_speeds_by_microtrip( &self, stop_speed: Option<Velocity>, blend_factor: f64, min_target_speed: Velocity, ) -> Vec<(Length, Velocity)>

Create distance and target speeds by microtrip. Splits cycle into microtrips and returns a list of 2-tuples of: (distance from start in meters, target speed in m/s) The distance is measured to the start of the microtrip.

§Parameters
  • blend_factor: from 0.0 to 1.0
    • if 0.0, use the average speed of the microtrip
    • if 1.0, use the average speed while moving (i.e., no stopped time)
    • otherwise, something in between
  • min_target_speed: the minimum target speed allowed
§Result

List of 2-tuple of (distance from start, target speed). A tuple represents the distance from start of the start of the given microtrip and its target speed.

§Notes
  • target speed per microtrip is not allowed to be below the min_target_speed
Source

pub fn extend_time( &self, absolute_time: Option<Time>, time_fraction: Option<Ratio>, ) -> Cycle

Add idle time to Cycle. By “idle” time, we mean “stopped” time (i.e., vehicle not moving).

Source

pub fn build_cache(&self) -> CycleCache

Create a cache object for faster computations on Cycle.

Source

pub fn average_grade_over_range( &self, distance_start: Length, delta_distance: Length, cache: Option<&CycleCache>, ) -> Ratio

Returns the average grade over the given range of distances.

  • distance_start: the distance at start of evaluation area
  • delta_distance: distance traveled from distance_start
  • cache: optional CycleCache which can save computation time

RETURN: average grade (rise over run) for the given range.

NOTE: grade is assumed to be constant from just after the previous sample point until the current sample point (inclusive). That is, grade[i] applies from distance, d, of (d[i - 1], d[i]]

Source

pub fn calc_distance_to_next_stop_from( &self, distance: Length, cache: Option<&CycleCache>, ) -> Length

Calculate the distance to next stop from distance.

  • distance: the distance to calculate distance-to-stop from

RETURN: returns the distance to the next stop from distance

NOTE: distance may be negative if we’re beyond the last stop

Source

pub fn ending_idle_time(&self) -> Time

Report the stopped time (i.e., idle) at the end of a cycle.

RESULT: time vehicle is at zero speed at cycle end

Source

pub fn trim_ending_idle(&self, idle_to_keep: Option<Time>) -> Cycle

Remove idel time at end of cycle except for the optionally specified duration.

  • idle_to_keep: optional duration of idle time to keep. Default is 0 s

RESULT: a new cycle with idle time trimmed.

Source

pub fn resample(&self, dt: Time) -> Cycle

Resample cycle to a lower or higher frequency.

  • dt: the new step duration.

RETURN: cycle NOTE: a value of dt <= 0 s implies to just clone the current cycle “as is”

Trait Implementations§

Source§

impl Deref for CYC_ACCEL

Source§

type Target = Cycle

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Cycle

Dereferences the value.
Source§

impl LazyStatic for CYC_ACCEL

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> 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> SendAlias for T

Source§

impl<T> SendSyncUnwindSafe for T
where T: Send + Sync + UnwindSafe + ?Sized,

Source§

impl<T> SyncAlias for T

Source§

impl<T> Ungil for T
where T: Send,