From ea7c2c65da2e0476be83b4cd7c94af6a4910bc10 Mon Sep 17 00:00:00 2001 From: Lasse Dalegaard Date: Sat, 19 Feb 2022 18:25:51 +0100 Subject: [PATCH] Add maximum flow in estimation output --- tool/src/cmd/estimate.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tool/src/cmd/estimate.rs b/tool/src/cmd/estimate.rs index 22eb618..73037f9 100644 --- a/tool/src/cmd/estimate.rs +++ b/tool/src/cmd/estimate.rs @@ -62,6 +62,7 @@ struct EstimationSequence { total_time: f64, total_distance: f64, total_extrude_distance: f64, + max_flow: Option, num_moves: usize, total_z_time: f64, total_output_time: f64, @@ -132,7 +133,12 @@ impl EstimationState { seq.num_moves += 1; match (m.is_extrude_move(), m.is_kinematic_move()) { - (true, true) => seq.total_output_time += m.total_time(), + (true, true) => { + seq.total_output_time += m.total_time(); + if let Some(flow_rate) = m.flow_rate(1.75 / 2.0) { + seq.max_flow = Some(seq.max_flow.unwrap_or(0.0).max(flow_rate)); + } + } (true, false) => seq.total_extrude_only_time += m.total_time(), (false, true) => seq.total_travel_time += m.total_time(), _ => {} @@ -229,6 +235,14 @@ impl EstimateCmd { " Average flow: {:.3} mm³/s", seq.total_extrude_distance * cross_section / seq.total_time ); + println!( + " Maximum flow: {}", + if let Some(max_flow) = seq.max_flow { + format!("{:.3} mm³/s", max_flow) + } else { + format!("-") + } + ); println!( " Average flow (output only): {:.3} mm³/s", seq.total_extrude_distance * cross_section / seq.total_output_time