Module cycle

Source
Expand description

Module containing drive cycle struct and related functions.

Structs§

PassingInfo
RustCycle
Struct for containing:
RustCycleCache
RustCycleElement

Functions§

accel_array_for_constant_jerk
Apply accel_for_constant_jerk to full
accel_for_constant_jerk
Calculate the acceleration n timesteps away
average_step_speed_at
Calculate the average step speed at step i in m/s (i.e., from sample point i-1 to i)
average_step_speeds
Calculate the average speed per each step in m/s
calc_constant_jerk_trajectory
Arguments
create_dist_and_target_speeds_by_microtrip
Create distance and target speeds by microtrip This helper function splits a cycle up into microtrips and returns a list of 2-tuples of: (distance from start in meters, target speed in meters/second)
detect_passing
Reports back information of the first point where cyc passes cyc0, starting at step i until the next stop of cyc.
dist_for_constant_jerk
Calculate distance (m) after n timesteps
extend_cycle
cyc: fastsim.cycle.Cycleabsolute_time_s: float, the seconds to extendtime_fraction: float, the fraction of the original cycle time to add onuse_rust: bool, if True, return a RustCycle instance, else a normal Python Cycle RETURNS: fastsim.cycle.Cycle (or fastsimrust.RustCycle), the new cycle with stopped time appended NOTE: additional time is rounded to the nearest second
speed_for_constant_jerk
Calculate speed (m/s) n timesteps away via a constant-jerk acceleration
time_spent_moving
Calculate the time in a cycle spent moving
to_microtrips
Split a cycle into an array of microtrips with one microtrip being a start to subsequent stop plus any idle (stopped time). Arguments:
trapz_distance_for_step
The distance traveled during step i in meters (i.e., from sample point i-1 to i)
trapz_distance_over_range
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)
trapz_step_distances
Sum of the distance traveled over each step using trapezoidal integration
trapz_step_distances_primitive
trapz_step_start_distance
The distance traveled from start at the beginning of step i (i.e., distance traveled up to sample point i-1) Distance is in meters.