Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trace miss documentation #139

Merged
merged 3 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading