pub struct SetSpeedTrainSim {
pub loco_con: Consist,
pub n_cars_by_type: HashMap<String, u32>,
pub state: TrainState,
pub speed_trace: SpeedTrace,
pub train_res: TrainRes,
pub history: TrainStateHistoryVec,
/* private fields */
}Expand description
Train simulation in which speed is prescribed. Note that this is not guaranteed to produce identical results to super::SpeedLimitTrainSim because of differences in braking controls but should generally be very close (i.e. error in cumulative fuel/battery energy should be less than 0.1%)
Fields§
§loco_con: Consist§n_cars_by_type: HashMap<String, u32>§state: TrainState§speed_trace: SpeedTrace§train_res: TrainRestrain resistance calculation
history: TrainStateHistoryVecCustom vector of Self::state
Implementations§
Source§impl SetSpeedTrainSim
impl SetSpeedTrainSim
Sourcepub fn trim_failed_steps(&mut self) -> Result<()>
pub fn trim_failed_steps(&mut self) -> Result<()>
Trims off any portion of the trip that failed to run
Sourcepub fn set_save_interval(&mut self, save_interval: Option<usize>)
pub fn set_save_interval(&mut self, save_interval: Option<usize>)
Sets save_interval for self and nested loco_con.
Sourcepub fn get_save_interval(&self) -> Option<usize>
pub fn get_save_interval(&self) -> Option<usize>
Returns self.save_interval and asserts that this is equal
to self.loco_con.get_save_interval().
Sourcepub fn solve_step(&mut self) -> Result<()>
pub fn solve_step(&mut self) -> Result<()>
Solves time step.
Sourcepub fn solve_required_pwr(&mut self, dt: Time) -> Result<()>
pub fn solve_required_pwr(&mut self, dt: Time) -> Result<()>
Sets power requirements based on:
- rolling resistance
- drag
- inertia
- acceleration
Trait Implementations§
Source§impl Clone for SetSpeedTrainSim
impl Clone for SetSpeedTrainSim
Source§fn clone(&self) -> SetSpeedTrainSim
fn clone(&self) -> SetSpeedTrainSim
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SetSpeedTrainSim
impl Debug for SetSpeedTrainSim
Source§impl Default for SetSpeedTrainSim
impl Default for SetSpeedTrainSim
Source§impl<'de> Deserialize<'de> for SetSpeedTrainSim
impl<'de> Deserialize<'de> for SetSpeedTrainSim
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 From<SetSpeedTrainSimBuilder> for SetSpeedTrainSim
impl From<SetSpeedTrainSimBuilder> for SetSpeedTrainSim
Source§fn from(value: SetSpeedTrainSimBuilder) -> Self
fn from(value: SetSpeedTrainSimBuilder) -> Self
Converts to this type from the input type.
Source§impl Init for SetSpeedTrainSim
impl Init for SetSpeedTrainSim
Source§impl PartialEq for SetSpeedTrainSim
impl PartialEq for SetSpeedTrainSim
Source§impl SaveState for SetSpeedTrainSim
impl SaveState for SetSpeedTrainSim
Source§impl SerdeAPI for SetSpeedTrainSim
impl SerdeAPI for SetSpeedTrainSim
const ACCEPTED_BYTE_FORMATS: &'static [&'static str] = _
const ACCEPTED_STR_FORMATS: &'static [&'static str] = _
const RESOURCES_SUBDIR: &'static str = ""
const RESOURCES_DIR: &'static Dir<'_> = _
Source§fn from_resource<P: AsRef<Path>>(
filepath: P,
skip_init: bool,
) -> Result<Self, Error>
fn from_resource<P: AsRef<Path>>( filepath: P, skip_init: bool, ) -> Result<Self, Error>
Read (deserialize) an object from a resource file packaged with the
altrios-core crate Read moreSource§fn list_resources() -> Result<Vec<PathBuf>, Error>
fn list_resources() -> Result<Vec<PathBuf>, Error>
List the available resources in the resources directory Read more
Source§fn to_file<P: AsRef<Path>>(&self, filepath: P) -> Result<()>
fn to_file<P: AsRef<Path>>(&self, filepath: P) -> Result<()>
Write (serialize) an object to a file.
Supported file extensions are listed in
ACCEPTED_BYTE_FORMATS.
Creates a new file if it does not already exist, otherwise truncates the existing file. Read moreSource§fn from_file<P: AsRef<Path>>(
filepath: P,
skip_init: bool,
) -> Result<Self, Error>
fn from_file<P: AsRef<Path>>( filepath: P, skip_init: bool, ) -> Result<Self, Error>
Read (deserialize) an object from a file.
Supported file extensions are listed in
ACCEPTED_BYTE_FORMATS. Read moreSource§fn to_writer<W: Write>(&self, wtr: W, format: &str) -> Result<()>
fn to_writer<W: Write>(&self, wtr: W, format: &str) -> Result<()>
Write (serialize) an object into anything that implements
std::io::Write Read moreSource§fn to_str(&self, format: &str) -> Result<String>
fn to_str(&self, format: &str) -> Result<String>
Write (serialize) an object into a string Read more
Source§fn from_str<S: AsRef<str>>(
contents: S,
format: &str,
skip_init: bool,
) -> Result<Self>
fn from_str<S: AsRef<str>>( contents: S, format: &str, skip_init: bool, ) -> Result<Self>
Read (deserialize) an object from a string Read more
Source§fn from_reader<R: Read>(
rdr: &mut R,
format: &str,
skip_init: bool,
) -> Result<Self, Error>
fn from_reader<R: Read>( rdr: &mut R, format: &str, skip_init: bool, ) -> Result<Self, Error>
Deserialize an object from anything that implements
std::io::Read Read moreSource§fn from_json<S: AsRef<str>>(json_str: S, skip_init: bool) -> Result<Self>
fn from_json<S: AsRef<str>>(json_str: S, skip_init: bool) -> Result<Self>
Read (deserialize) an object from a JSON string Read more
Source§fn from_msg_pack(msg_pack: &[u8], skip_init: bool) -> Result<Self>
fn from_msg_pack(msg_pack: &[u8], skip_init: bool) -> Result<Self>
Read (deserialize) an object from a message pack Read more
Source§impl Serialize for SetSpeedTrainSim
impl Serialize for SetSpeedTrainSim
Source§impl SetCumulative for SetSpeedTrainSim
impl SetCumulative for SetSpeedTrainSim
Source§impl Step for SetSpeedTrainSim
impl Step for SetSpeedTrainSim
impl StateMethods for SetSpeedTrainSim
impl StructuralPartialEq for SetSpeedTrainSim
Auto Trait Implementations§
impl Freeze for SetSpeedTrainSim
impl RefUnwindSafe for SetSpeedTrainSim
impl Send for SetSpeedTrainSim
impl Sync for SetSpeedTrainSim
impl Unpin for SetSpeedTrainSim
impl UnwindSafe for SetSpeedTrainSim
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> EqDefault for T
impl<T> EqDefault for T
Source§fn eq_default(&self) -> bool
fn eq_default(&self) -> bool
Checks if an instance of
Self is equal to Self::defaultSource§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>
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 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>
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