Skip to content

Commit

Permalink
Implement time estimate calculation for SLA printers without tilt.
Browse files Browse the repository at this point in the history
This commit adds time estimate calculation based on lift and retract.
Calculation with these parameters gets triggered if tilt parameters
are set to null (N/A) in the SLA printer tab.

It also adds a `Time estimate correction` field in the `Corrections`
section of the SLA printer tab to account for processing delays of the
selected printer.
  • Loading branch information
Felix-Rm committed Sep 30, 2024
1 parent 50d28fe commit c0b70c8
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/libslic3r/Preset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ static std::vector<std::string> s_Preset_sla_printer_options {
"elefant_foot_compensation",
"elefant_foot_min_width",
"gamma_correction",
"time_estimate_correction",
"min_exposure_time", "max_exposure_time",
"min_initial_exposure_time", "max_initial_exposure_time", "sla_archive_format", "sla_output_precision",
//FIXME the print host keys are left here just for conversion from the Printer preset to Physical Printer preset.
Expand Down
9 changes: 9 additions & 0 deletions src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4105,6 +4105,15 @@ void PrintConfigDef::init_sla_params()
def->mode = comExpert;
def->set_default_value(new ConfigOptionFloat(1.0));

def = this->add("time_estimate_correction", coFloat);
def->label = L("Time estimate correction");
def->full_label = L("Time estimate correction");
def->tooltip = L("This time will be added for every layer when calculating the printing time estimate. "
"It may correct for any additional delays in the printing process.");
def->sidetext = L("s");
def->min = 0;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(0.0));

// SLA Material settings.

Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/PrintConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1283,6 +1283,7 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloat, elefant_foot_compensation))
((ConfigOptionFloat, elefant_foot_min_width))
((ConfigOptionFloat, gamma_correction))
((ConfigOptionFloat, time_estimate_correction))
((ConfigOptionFloatNullable, fast_tilt_time))
((ConfigOptionFloatNullable, slow_tilt_time))
((ConfigOptionFloatNullable, high_viscosity_tilt_time))
Expand Down
54 changes: 53 additions & 1 deletion src/libslic3r/SLAPrintSteps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,23 @@ static int layer_peel_move_time(int layer_height_nm, ExposureProfile p)
return int(tilt + tower);
}

namespace {
template<typename T> static T constrain(T value, T min, T max) {
if (value < min)
return min;
else if (value > max)
return max;
else
return value;
}

static float constrained_map(float value, float min, float max, float out_min, float out_max) {
value = constrain(value, min, max);
float t = (value - min) / (max - min);
return out_min * (1 - t) + out_max * t;
}
}

// Merging the slices from all the print objects into one slice grid and
// calculating print statistics from the merge result.
void SLAPrint::Steps::merge_slices_and_eval_stats() {
Expand All @@ -1145,6 +1162,8 @@ void SLAPrint::Steps::merge_slices_and_eval_stats() {
const double init_exp_time = material_config.initial_exposure_time.getFloat();
const double exp_time = material_config.exposure_time.getFloat();

const double time_estimate_correction = printer_config.time_estimate_correction.getFloat();

const int fade_layers_cnt = m_print->m_default_object_config.faded_layers.getInt();// 10 // [3;20]

ExposureProfile below(material_config, 0);
Expand All @@ -1166,7 +1185,8 @@ void SLAPrint::Steps::merge_slices_and_eval_stats() {
// Going to parallel:
auto printlayerfn = [this,
// functions and read only vars
area_fill, display_area, exp_time, init_exp_time, fast_tilt, slow_tilt, hv_tilt, material_config, delta_fade_time, is_prusa_print, first_slow_layers, below, above, is_printer_with_tilt
area_fill, display_area, exp_time, init_exp_time, fast_tilt, slow_tilt, hv_tilt, material_config, delta_fade_time, is_prusa_print, first_slow_layers, below, above,
is_printer_with_tilt, time_estimate_correction, fade_layers_cnt,

// write vars
&layers_info](size_t sliced_layer_cnt)
Expand Down Expand Up @@ -1289,6 +1309,38 @@ void SLAPrint::Steps::merge_slices_and_eval_stats() {

// We are done with tilt time, but we haven't added the exposure time yet.
layer_times += std::max(exp_time, init_exp_time - sliced_layer_cnt * delta_fade_time);
} else {
bool first_layer = sliced_layer_cnt == 0;

double layer_exposure_time = constrained_map(sliced_layer_cnt,
0, fade_layers_cnt, init_exp_time, exp_time);

// NOTE: Following times are in minutes and are therefore multiplied by 60
double primary_lift_time =
(first_layer ? material_config.sla_initial_primary_lift_distance : material_config.sla_primary_lift_distance) /
(first_layer ? material_config.sla_initial_primary_lift_speed : material_config.sla_primary_lift_speed) * 60;
double secondary_lift_time =
(first_layer ? material_config.sla_initial_secondary_lift_distance : material_config.sla_secondary_lift_distance) /
(first_layer ? material_config.sla_initial_secondary_lift_speed : material_config.sla_secondary_lift_speed) * 60;
double primary_retract_time =
(first_layer ? material_config.sla_initial_primary_retract_distance : material_config.sla_primary_retract_distance) /
(first_layer ? material_config.sla_initial_primary_retract_speed : material_config.sla_primary_retract_speed) * 60;
double secondary_retract_time =
(first_layer ? material_config.sla_initial_secondary_retract_distance : material_config.sla_secondary_retract_distance) /
(first_layer ? material_config.sla_initial_secondary_retract_speed : material_config.sla_secondary_retract_speed) * 60;

double wait_times =
(first_layer ? material_config.sla_initial_wait_before_lift : material_config.sla_wait_before_lift) +
(first_layer ? material_config.sla_initial_wait_after_lift : material_config.sla_wait_after_lift) +
(first_layer ? material_config.sla_initial_wait_after_retract : material_config.sla_wait_after_retract);

layer_times = layer_exposure_time +
primary_lift_time + secondary_lift_time +
primary_retract_time + secondary_retract_time +
wait_times + time_estimate_correction;

// NOTE: All faded layers are considered slow layers
is_fast_layer = sliced_layer_cnt > fade_layers_cnt;
}

// Collect values for this layer.
Expand Down

0 comments on commit c0b70c8

Please sign in to comment.