pub struct CYC_ACCEL { /* private fields */ }Methods from Deref<Target = Cycle>§
Sourcepub fn len_checked(&self) -> Result<usize>
pub fn len_checked(&self) -> Result<usize>
return the length of the cycle
pub fn to_fastsim2(&self) -> Result<Cycle2>
Sourcepub fn to_elements(&self) -> Vec<CycleElement>
pub fn to_elements(&self) -> Vec<CycleElement>
convert cycle to a vector of CycleElement
Sourcepub fn to_microtrips(&self, stop_speed: Option<Velocity>) -> Vec<Cycle>
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”.
Sourcepub fn average_speed(&self, while_moving: bool) -> Velocity
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
Sourcepub fn average_step_speeds(&self) -> Vec<Velocity> ⓘ
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.
Sourcepub fn average_step_speed_at(&self, i: usize) -> Velocity
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)
Sourcepub fn trapz_step_distances(&self) -> Vec<Length> ⓘ
pub fn trapz_step_distances(&self) -> Vec<Length> ⓘ
The distances traveled over each step using trapezoidal integration.
Sourcepub fn trapz_step_elevations(&self) -> Vec<Length> ⓘ
pub fn trapz_step_elevations(&self) -> Vec<Length> ⓘ
The elevation climb each step using trapezoidal integration.
Sourcepub fn trapz_step_start_distance(&self, step: usize) -> Length
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)
Sourcepub fn trapz_distance_for_step(&self, step: usize) -> Length
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)
Sourcepub fn trapz_distance_over_range(&self, step0: usize, step1: usize) -> Length
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)
Sourcepub fn time_spent_moving(&self, stopped_speed: Option<Velocity>) -> Time
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
Sourcepub fn distance_and_target_speeds_by_microtrip(
&self,
stop_speed: Option<Velocity>,
blend_factor: f64,
min_target_speed: Velocity,
) -> Vec<(Length, Velocity)>
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
Sourcepub fn extend_time(
&self,
absolute_time: Option<Time>,
time_fraction: Option<Ratio>,
) -> Cycle
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).
Sourcepub fn build_cache(&self) -> CycleCache
pub fn build_cache(&self) -> CycleCache
Create a cache object for faster computations on Cycle.
Sourcepub fn average_grade_over_range(
&self,
distance_start: Length,
delta_distance: Length,
cache: Option<&CycleCache>,
) -> Ratio
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]]
Sourcepub fn calc_distance_to_next_stop_from(
&self,
distance: Length,
cache: Option<&CycleCache>,
) -> Length
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
Sourcepub fn ending_idle_time(&self) -> Time
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
Sourcepub fn trim_ending_idle(&self, idle_to_keep: Option<Time>) -> Cycle
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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CYC_ACCEL
impl RefUnwindSafe for CYC_ACCEL
impl Send for CYC_ACCEL
impl Sync for CYC_ACCEL
impl Unpin for CYC_ACCEL
impl UnwindSafe for CYC_ACCEL
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
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 more