Skip to main content

DfcoControls

Struct DfcoControls 

Source
#[non_exhaustive]
pub struct DfcoControls { pub dfco_enabled: bool, pub minimum_dfco_speed: Velocity, pub minimum_dfco_deceleration: Acceleration, pub stopped_speed_threshold: Velocity, pub save_interval: Option<usize>, pub state: DfcoState, pub history: DfcoStateHistoryVec, }

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§dfco_enabled: bool

If true DFCO is enabled, else it will never run.

§minimum_dfco_speed: Velocity

The minimum speed at or above which which DFCO can activate.

§minimum_dfco_deceleration: Acceleration

The minimum vehicle acceleration required for DFCO to be able to activate.

§stopped_speed_threshold: Velocity

Speed threshold at or below which DFCO is considered unavailable due to near-stop operation.

§save_interval: Option<usize>

Time step interval between saves. 1 is a good option. If None, no saving occurs.

§state: DfcoState

current state of control variables

§history: DfcoStateHistoryVec

history of current state

Implementations§

Source§

impl DfcoControls

Source

pub fn is_dfco_disabled_due_to_veh_dynamics( prev_speed: Velocity, speed: Velocity, dt: Time, dfco_allowed: bool, minimum_dfco_speed: Velocity, minimum_dfco_deceleration: Acceleration, stopped_speed_threshold: Velocity, ) -> bool

Determine if decel fuel cut-off (DFCO) is disabled based on vehicle dynamics considerations (i.e., speed, acceleration). Note: considerations related to whether the engine is too cold and such would be handled elsewhere.

Source§

impl DfcoControls

Source

pub fn new( dfco_enabled: bool, minimum_dfco_speed: Velocity, minimum_dfco_deceleration: Acceleration, save_interval: Option<usize>, ) -> Result<Self>

Trait Implementations§

Source§

impl Clone for DfcoControls

Source§

fn clone(&self) -> DfcoControls

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 DfcoControls

Source§

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

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

impl Default for DfcoControls

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for DfcoControls

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 HistoryMethods for DfcoControls

Source§

fn set_save_interval(&mut self, save_interval: Option<usize>) -> Result<()>

Recursively sets save interval Read more
Source§

fn save_interval(&self) -> Result<Option<usize>>

Returns save interval for self but does not guarantee recursive consistency in nested objects
Source§

fn clear(&mut self)

Remove all history
Source§

impl Init for DfcoControls

Source§

fn init(&mut self) -> Result<(), Error>

Specialized code to execute upon initialization. For any struct with fields that implement Init, this should propagate down the hierarchy.
Source§

impl PartialEq for DfcoControls

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl SaveState for DfcoControls

Source§

fn save_state<F: Fn() -> String>(&mut self, loc: F) -> Result<()>

Implementation for structs with save_interval

Source§

impl SerdeAPI for DfcoControls

Source§

const ACCEPTED_BYTE_FORMATS: &'static [&'static str] = _

Source§

const ACCEPTED_STR_FORMATS: &'static [&'static str] = _

Source§

const RESOURCES_DIR: &'static Dir<'_> = _

Source§

const RESOURCES_SUBDIR: &'static str = ""

Source§

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 fastsim-core crate Read more
Source§

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<(), Error>

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 more
Source§

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 more
Source§

fn to_writer<W: Write>(&self, wtr: W, format: &str) -> Result<(), Error>

Write (serialize) an object into anything that implements std::io::Write Read more
Source§

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 more
Source§

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>

Read (deserialize) an object from a string Read more
Source§

fn to_json(&self) -> Result<String>

Write (serialize) an object to a JSON string
Source§

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 to_msg_pack(&self) -> Result<Vec<u8>>

Write (serialize) an object to a message pack
Source§

fn from_msg_pack(msg_pack: &[u8], skip_init: bool) -> Result<Self>

Read (deserialize) an object from a message pack Read more
Source§

fn to_toml(&self) -> Result<String>

Write (serialize) an object to a TOML string
Source§

fn from_toml<S: AsRef<str>>(toml_str: S, skip_init: bool) -> Result<Self>

Read (deserialize) an object from a TOML string Read more
Source§

fn to_yaml(&self) -> Result<String>

Write (serialize) an object to a YAML string
Source§

fn from_yaml<S: AsRef<str>>(yaml_str: S, skip_init: bool) -> Result<Self>

Read (deserialize) an object from a YAML string Read more
Source§

impl Serialize for DfcoControls

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 SetCumulative for DfcoControls

Source§

fn set_cumulative<F: Fn() -> String>(&mut self, dt: Time, loc: F) -> Result<()>

Sets cumulative values based on rate values
Source§

fn reset_cumulative<F: Fn() -> String>(&mut self, loc: F) -> Result<()>

Resets cumulative and corresponding rate values to zero
Source§

impl StateMethods for DfcoControls

Source§

impl Step for DfcoControls

Source§

fn step<F: Fn() -> String>(&mut self, loc: F) -> Result<()>

Increments i field of this and all contained structs, recursively Read more
Source§

fn reset_step<F: Fn() -> String>(&mut self, loc: F) -> Result<()>

Resets i field of this and all contained structs, recursively Read more
Source§

impl StructuralPartialEq for DfcoControls

Source§

impl TrackedStateMethods for DfcoControls

Source§

fn check_and_reset<F: Fn() -> String>(&mut self, loc: F) -> Result<()>

Ensure [State::Fresh] and reset to [State::Stale] Read more
Source§

fn mark_fresh<F: Fn() -> String>(&mut self, loc: F) -> Result<()>

Mark states as [State::Fresh] Read more

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> EqDefault for T
where T: Default + PartialEq,

Source§

fn eq_default(&self) -> bool

If self is default, returns true
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> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.