Skip to content

Commit c0b70c8

Browse files
committed
Implement time estimate calculation for SLA printers without tilt.
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.
1 parent 50d28fe commit c0b70c8

File tree

4 files changed

+64
-1
lines changed

4 files changed

+64
-1
lines changed

src/libslic3r/Preset.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,7 @@ static std::vector<std::string> s_Preset_sla_printer_options {
709709
"elefant_foot_compensation",
710710
"elefant_foot_min_width",
711711
"gamma_correction",
712+
"time_estimate_correction",
712713
"min_exposure_time", "max_exposure_time",
713714
"min_initial_exposure_time", "max_initial_exposure_time", "sla_archive_format", "sla_output_precision",
714715
//FIXME the print host keys are left here just for conversion from the Printer preset to Physical Printer preset.

src/libslic3r/PrintConfig.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4105,6 +4105,15 @@ void PrintConfigDef::init_sla_params()
41054105
def->mode = comExpert;
41064106
def->set_default_value(new ConfigOptionFloat(1.0));
41074107

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

41094118
// SLA Material settings.
41104119

src/libslic3r/PrintConfig.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,6 +1283,7 @@ PRINT_CONFIG_CLASS_DEFINE(
12831283
((ConfigOptionFloat, elefant_foot_compensation))
12841284
((ConfigOptionFloat, elefant_foot_min_width))
12851285
((ConfigOptionFloat, gamma_correction))
1286+
((ConfigOptionFloat, time_estimate_correction))
12861287
((ConfigOptionFloatNullable, fast_tilt_time))
12871288
((ConfigOptionFloatNullable, slow_tilt_time))
12881289
((ConfigOptionFloatNullable, high_viscosity_tilt_time))

src/libslic3r/SLAPrintSteps.cpp

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1123,6 +1123,23 @@ static int layer_peel_move_time(int layer_height_nm, ExposureProfile p)
11231123
return int(tilt + tower);
11241124
}
11251125

1126+
namespace {
1127+
template<typename T> static T constrain(T value, T min, T max) {
1128+
if (value < min)
1129+
return min;
1130+
else if (value > max)
1131+
return max;
1132+
else
1133+
return value;
1134+
}
1135+
1136+
static float constrained_map(float value, float min, float max, float out_min, float out_max) {
1137+
value = constrain(value, min, max);
1138+
float t = (value - min) / (max - min);
1139+
return out_min * (1 - t) + out_max * t;
1140+
}
1141+
}
1142+
11261143
// Merging the slices from all the print objects into one slice grid and
11271144
// calculating print statistics from the merge result.
11281145
void SLAPrint::Steps::merge_slices_and_eval_stats() {
@@ -1145,6 +1162,8 @@ void SLAPrint::Steps::merge_slices_and_eval_stats() {
11451162
const double init_exp_time = material_config.initial_exposure_time.getFloat();
11461163
const double exp_time = material_config.exposure_time.getFloat();
11471164

1165+
const double time_estimate_correction = printer_config.time_estimate_correction.getFloat();
1166+
11481167
const int fade_layers_cnt = m_print->m_default_object_config.faded_layers.getInt();// 10 // [3;20]
11491168

11501169
ExposureProfile below(material_config, 0);
@@ -1166,7 +1185,8 @@ void SLAPrint::Steps::merge_slices_and_eval_stats() {
11661185
// Going to parallel:
11671186
auto printlayerfn = [this,
11681187
// functions and read only vars
1169-
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
1188+
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,
1189+
is_printer_with_tilt, time_estimate_correction, fade_layers_cnt,
11701190

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

12901310
// We are done with tilt time, but we haven't added the exposure time yet.
12911311
layer_times += std::max(exp_time, init_exp_time - sliced_layer_cnt * delta_fade_time);
1312+
} else {
1313+
bool first_layer = sliced_layer_cnt == 0;
1314+
1315+
double layer_exposure_time = constrained_map(sliced_layer_cnt,
1316+
0, fade_layers_cnt, init_exp_time, exp_time);
1317+
1318+
// NOTE: Following times are in minutes and are therefore multiplied by 60
1319+
double primary_lift_time =
1320+
(first_layer ? material_config.sla_initial_primary_lift_distance : material_config.sla_primary_lift_distance) /
1321+
(first_layer ? material_config.sla_initial_primary_lift_speed : material_config.sla_primary_lift_speed) * 60;
1322+
double secondary_lift_time =
1323+
(first_layer ? material_config.sla_initial_secondary_lift_distance : material_config.sla_secondary_lift_distance) /
1324+
(first_layer ? material_config.sla_initial_secondary_lift_speed : material_config.sla_secondary_lift_speed) * 60;
1325+
double primary_retract_time =
1326+
(first_layer ? material_config.sla_initial_primary_retract_distance : material_config.sla_primary_retract_distance) /
1327+
(first_layer ? material_config.sla_initial_primary_retract_speed : material_config.sla_primary_retract_speed) * 60;
1328+
double secondary_retract_time =
1329+
(first_layer ? material_config.sla_initial_secondary_retract_distance : material_config.sla_secondary_retract_distance) /
1330+
(first_layer ? material_config.sla_initial_secondary_retract_speed : material_config.sla_secondary_retract_speed) * 60;
1331+
1332+
double wait_times =
1333+
(first_layer ? material_config.sla_initial_wait_before_lift : material_config.sla_wait_before_lift) +
1334+
(first_layer ? material_config.sla_initial_wait_after_lift : material_config.sla_wait_after_lift) +
1335+
(first_layer ? material_config.sla_initial_wait_after_retract : material_config.sla_wait_after_retract);
1336+
1337+
layer_times = layer_exposure_time +
1338+
primary_lift_time + secondary_lift_time +
1339+
primary_retract_time + secondary_retract_time +
1340+
wait_times + time_estimate_correction;
1341+
1342+
// NOTE: All faded layers are considered slow layers
1343+
is_fast_layer = sliced_layer_cnt > fade_layers_cnt;
12921344
}
12931345

12941346
// Collect values for this layer.

0 commit comments

Comments
 (0)