Skip to main content

Crate fastsim_core

Crate fastsim_core 

Source
Expand description

Core crate for performing FASTSim simulations.

§Crate Specific Coding Practices

  • #[non_exhaustive] macro is invoked to force any downstream crate to use the Init trait to initialize structs that implement this macro
  • #[fastsim_api] – used to expose the struct to python and provides assorted other features related to usability Crate containing models for second-by-second fuel and energy consumption of simulation of vehicles

§Feature Flags

  • curl — curl/isahc: optional deps for the compat feature. On macOS, static-ssl bundles OpenSSL so pkg-config isn’t needed during pixi install (before conda activation). On Linux, system/conda OpenSSL is used instead to avoid the __isoc23_strtol glibc 2.38+ linking error that occurs when the conda cross-compiler compiles vendored OpenSSL.
  • compat — Enables conversion functions from FASTSim 2 data structures
  • pyo3 — Enables pyo3 to provide fastsim-3 structs, methods, and functions to Python
  • resources (enabled by default) — Compiles external resources (e.g. vehicle files or cycle files) to be available in the binary
  • web — Enables internet-querying dependencies
  • serde-default (enabled by default) — Enables several text file formats for serialization and deserialization
  • csv (enabled by default) — Enables csv serialization and deserialization
  • json (enabled by default) — Enables json serialization and deserialization
  • toml (enabled by default) — Enables toml serialization and deserialization
  • yaml (enabled by default) — Enables yaml serialization and deserialization
  • msgpack (enabled by default) — Enables message pack serialization and deserialization via rmp-serde
  • simdrivelabel (enabled by default) — Enables the simdrivelabel module for calculating EPA label fuel economy

§Features needed to allow for custom uom quantities and units. These

§have no actual effect.

  • timer — Activates timer macros

Modules§

drive_cycle
error
Custom error types
gas_properties
imports
Module for crate-local imports to reduce boilerplate in submodules
macros
prelude
Convenience module for exposing commonly used structs
si
Import uom si system and add unit constants Zero values should be created using standard uom syntax ($Quantity::ZERO) after adding “use crate::imports::*” Non-zero values should be created using standard uom syntax ($Quantity::new::<$unit>($value)) or multiplication syntax ($value * $UNIT_CONSTANT)
simdrive
simdrivelabel
Module containing classes and methods for calculating label fuel economy.
traits
uc
Module providing unit constants (e.g. 1 kg) for an assortment of dimensional quantities.
utils
vehicle
Module containing submodules for vehicle and powertrain models

Macros§

eff_test_body
format_dbg
Generates a String similar to output of dbg but without printing
impl_efficiency_enum
impl_si_serialize_as
Generate a family of #[serde(serialize_with)]-compatible helpers that serialize a UOM SI quantity as a specific (non-base) unit.
init_opt_default
Makes it so that optional parameters get set in the Init::init call
make_uom_cmp_fn
timer
Times the duration whatever gets passed in

Statics§

FASTSIM_VERSION
Current version of FASTSim as specified in Cargo.toml

Functions§

enabled_features
List enabled features