diff --git a/pyproject.toml b/pyproject.toml index 51a6984e..81260ac9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ classifiers = [ dependencies = [ "pandas>=1", "matplotlib>=3.3", - "numpy>=1.18,<1.24", + "numpy==1.24", "scipy", "seaborn>=0.10", "typing_extensions", diff --git a/rust/fastsim-core/src/simdrive.rs b/rust/fastsim-core/src/simdrive.rs index c5e00146..26fcf0b6 100644 --- a/rust/fastsim-core/src/simdrive.rs +++ b/rust/fastsim-core/src/simdrive.rs @@ -36,11 +36,14 @@ pub struct RustSimDriveParams { pub time_dilation_tol: f64, /// number of iterations to achieve time dilation correction pub max_trace_miss_iters: u32, - /// threshold of error in speed [m/s] that triggers warning + /// threshold for triggering warning log message if vehicle speed deficit [m/s] + /// relative to prescribed speed exceeds this amount pub trace_miss_speed_mps_tol: f64, - /// threshold for printing warning when time dilation is active + /// threshold for triggering warning log message if achieved elapsed time + /// relative to prescribed elapsed time exceeds this fractional amount pub trace_miss_time_tol: f64, - /// threshold of fractional eror in distance that triggers warning + /// threshold for triggering warning log message if achieved distance + /// relative to prescribed distance exceeds this fractional amount pub trace_miss_dist_tol: f64, /// max allowable number of HEV SOC iterations pub sim_count_max: usize, @@ -571,9 +574,16 @@ pub struct RustSimDrive { pub fc_kj: f64, pub net_kj: f64, pub ke_kj: f64, + /// `true` when the vehicle misses the prescribed speed trace pub trace_miss: bool, + /// fractional difference between achieved cumulative distance + /// and prescribed cumulative distance pub trace_miss_dist_frac: f64, + /// fractional difference between achieved time when trace miss is + /// and prescribed cumulative distance pub trace_miss_time_frac: f64, + /// Maximum speed by which vehicle's speed falls behind prescribed + /// speed trace pub trace_miss_speed_mps: f64, #[serde(skip)] pub orphaned: bool, diff --git a/rust/fastsim-core/src/simdrive/simdrive_impl.rs b/rust/fastsim-core/src/simdrive/simdrive_impl.rs index 38186339..4a94db7f 100644 --- a/rust/fastsim-core/src/simdrive/simdrive_impl.rs +++ b/rust/fastsim-core/src/simdrive/simdrive_impl.rs @@ -1853,8 +1853,9 @@ impl RustSimDrive { self.trace_miss = false; let dist_m = self.cyc0.dist_m().sum(); self.trace_miss_dist_frac = if dist_m > 0.0 { - (self.dist_m.sum() - self.cyc0.dist_m().sum()).abs() / dist_m + (self.dist_m.sum() - dist_m).abs() / dist_m } else { + bail!("Vehicle did not move forward."); 0.0 }; self.trace_miss_time_frac = (self