Crate altrios_core

Crate altrios_core 

Source
Expand description

Crate containing models for second-by-second fuel and energy consumption of simulation of locomotive consists comprising collections of individual locomotives, which comprise various powertrain components (engine, generator/alternator, battery, and electric drivetrain) – all connected to a detailed train model including drag, grade, curvature, bearing, and rolling resistances.

§Helpful Tips

Every struct in this crate implements methods for serializing/deserializing itself to/from a handful of standard data formats as strings or file read/write operations using traits::SerdeAPI.

§Feature Flags

  • resources (enabled by default) — Compiles external resources (e.g. vehicle files or cycle files) to be available in the binary
  • pyo3 — Exposes ALTRIOS structs, methods, and functions to Python.
  • 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
  • timer — Activates timer macros

Modules§

combo_error
consist
Module containing submodules for consists, locomotives, and powertrain models
error
Custom error types
imports
lin_search_hint
macros
meet_pass
Meet-pass
prelude
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)
track
train
traits
uc
Module providing unit constants (e.g. 1 kg) for an assortment of dimensional quantities.
utils
validate

Macros§

eta_test_body
format_dbg
Generates a String similar to output of dbg but without printing
impl_get_set_eta_max_min
Implements get_eta_max, set_eta_max, get_eta_min, and set_eta_min methods
impl_get_set_eta_range
init_opt_default
Makes it so that optional parameter that is not provided or provided as None gets set in the Init::init call
make_uom_cmp_fn
print_to_py
Given pairs of arbitrary keys and values, prints “key: value” to python intepreter.
Given str, prints str.
Using this will break cargo test but work with maturin develop.
timer
Times the duration whatever gets passed in