Skip to content

Commit

Permalink
Add average+top speeds in estimate output
Browse files Browse the repository at this point in the history
  • Loading branch information
dalegaard committed Jun 28, 2023
1 parent fe93cc1 commit 63ac067
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tool/src/cmd/estimate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ struct EstimationSequence {
total_distance: f64,
total_extrude_distance: f64,
max_flow: Option<f64>,
max_speed: Option<f64>,
num_moves: usize,
total_z_time: f64,
total_output_time: f64,
Expand Down Expand Up @@ -150,6 +151,7 @@ impl EstimationState {
seq.total_distance += m.distance;
seq.total_extrude_distance += m.end.w - m.start.w;
seq.num_moves += 1;
seq.max_speed = Some(seq.max_speed.unwrap_or(0.0).max(m.cruise_v));

match (m.is_extrude_move(), m.is_kinematic_move()) {
(true, true) => {
Expand Down Expand Up @@ -250,6 +252,18 @@ impl EstimateCmd {
format_time(seq.total_travel_time),
seq.total_travel_time
);
println!(
" Average speed: {:.3} mm/s",
seq.total_distance / seq.total_time
);
println!(
" Top speed: {}",
if let Some(max_speed) = seq.max_speed {
format!("{:.3} mm/s", max_speed)
} else {
"-".to_string()
}
);
println!(
" Average flow: {:.3} mm³/s",
seq.total_extrude_distance * cross_section / seq.total_time
Expand Down

0 comments on commit 63ac067

Please sign in to comment.