Skip to content

Commit

Permalink
Merge pull request #139 from NREL/f2/trace-miss-doc
Browse files Browse the repository at this point in the history
trace miss documentation
  • Loading branch information
calbaker authored Jul 1, 2024
2 parents c747884 + b308537 commit 1952581
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 13 additions & 3 deletions rust/fastsim-core/src/simdrive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion rust/fastsim-core/src/simdrive/simdrive_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1952581

Please sign in to comment.