fastsim_core/lib.rs
1#![allow(non_local_definitions)]
2// This needs to be a square logo to avoid stretching, and can have transparency
3#![doc(html_logo_url = "https://www.nrel.gov/transportation/assets/images/icon-fastsim.jpg")]
4//! Documentation for the Rust backend of the Future Automotive Systems Technology Simulator (FASTSim).
5
6//! # Overview
7//! FASTSim provides a simple way to compare powertrains and estimate the impact of technology
8//! improvements on light-, medium-, and heavy-duty vehicle efficiency, performance, cost, and battery life.
9//! More information here: <https://www.nrel.gov/transportation/fastsim.html>
10//!
11//! # Crate features
12//! * **full** - When enabled (which is default), include additional capabilities that
13//! require additional dependencies
14//! * **resources** - When enabled (which is triggered by enabling full (thus default)
15//! or enabling this feature directly), compiles commonly used resources (e.g.
16//! standard drive cycles) for faster access.
17//!
18//! # Python Examples
19//! ```python
20//! import fastsim
21//!
22//! ## Load drive cycle by name
23//! cyc_py = fastsim.cycle.Cycle.from_file("udds")
24//! cyc_rust = cyc_py.to_rust()
25//!
26//! ## Load vehicle using database vehicle ID number
27//! vnum = 1
28//! veh_py = fastsim.vehicle.Vehicle.from_vehdb(vnum)
29//! veh_rust = veh_py.to_rust()
30//!
31//! ## Simulate
32//! sd = fastsim.RustSimDrive(cyc_rust, veh_rust)
33//! sd.sim_drive()
34//! ```
35
36extern crate ndarray;
37
38#[macro_use]
39pub mod macros;
40pub mod air;
41mod calibration;
42pub mod cycle;
43pub mod imports;
44pub mod params;
45pub mod pyo3imports;
46pub mod simdrive;
47pub use simdrive::simdrive_impl;
48pub mod simdrivelabel;
49pub mod thermal;
50pub mod traits;
51pub mod utils;
52pub mod vehicle;
53pub mod vehicle_import;
54pub mod vehicle_thermal;
55pub mod vehicle_utils;
56
57pub use fastsim_proc_macros as proc_macros;
58
59#[cfg_attr(feature = "pyo3", pyo3imports::pyfunction)]
60#[allow(clippy::vec_init_then_push)]
61pub fn enabled_features() -> Vec<String> {
62 #[allow(unused_mut)]
63 let mut enabled = vec![];
64
65 #[cfg(feature = "default")]
66 enabled.push("default".into());
67
68 #[cfg(feature = "bincode")]
69 enabled.push("bincode".into());
70
71 #[cfg(feature = "logging")]
72 enabled.push("logging".into());
73
74 #[cfg(feature = "resources")]
75 enabled.push("resources".into());
76
77 #[cfg(feature = "simdrivelabel")]
78 enabled.push("simdrivelabel".into());
79
80 #[cfg(feature = "validation")]
81 enabled.push("validation".into());
82
83 #[cfg(feature = "vehicle-import")]
84 enabled.push("vehicle-import".into());
85
86 enabled
87}