Skip to content

Commit

Permalink
Add maximum flow in estimation output
Browse files Browse the repository at this point in the history
  • Loading branch information
dalegaard committed Feb 19, 2022
1 parent 98e11ac commit ea7c2c6
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tool/src/cmd/estimate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ struct EstimationSequence {
total_time: f64,
total_distance: f64,
total_extrude_distance: f64,
max_flow: Option<f64>,
num_moves: usize,
total_z_time: f64,
total_output_time: f64,
Expand Down Expand Up @@ -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(),
_ => {}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ea7c2c6

Please sign in to comment.