Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated docs to reflect actual mpc behaviour #517

Merged
merged 2 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions docs/MPC.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ To use MPC as the temperature controller for the extruder use the following basi
[extruder]
control: mpc
heater_power: 50
cooling_fan: fan
cooling_fan:
filament_diameter: 1.75
filament_density: 1.20
filament_heat_capacity: 1.8
Expand All @@ -42,9 +42,10 @@ filament_heat_capacity: 1.8
heater. Setting heater_power to the power output at the expected printing
temperature is recommended.

- `cooling_fan: fan`
_Default Value: fan_
This is the fan that is cooling extruded filament and the hotend.
- `cooling_fan:`
_Default Value: Nothing_
The fan that is cooling extruded filament and the hotend. Default is no fan so
there will be no fan taken into account for controlling the heater.
Specifying "fan" will automatically use the part cooling fan.

- `filament_diameter: 1.75`
Expand Down
39 changes: 18 additions & 21 deletions klippy/extras/control_mpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ def run(self, gcmd):
ambient_max_measure_time,
ambient_measure_sample_time,
fan_breakpoints,
new_control,
first_res,
)
second_res = self.process_second_pass(
Expand Down Expand Up @@ -588,7 +587,6 @@ def transfer_test(
ambient_max_measure_time,
ambient_measure_sample_time,
fan_breakpoints,
control,
first_pass_results,
):
target_temp = round(first_pass_results["post_block_temp"])
Expand All @@ -609,27 +607,26 @@ def transfer_test(
)
gcmd.respond_info(f"Average stable power: {power_base} W")
else:
if fan is not None:
for idx in range(0, fan_breakpoints):
speed = idx / (fan_breakpoints - 1)
curtime = self.heater.reactor.monotonic()
print_time = fan.get_mcu().estimated_print_time(curtime)
fan.set_speed(print_time + PIN_MIN_TIME, speed)
gcmd.respond_info("Waiting for temperature to stabilize")
self.wait_stable(3)
gcmd.respond_info(
f"Temperature stable, measuring power usage with {speed*100.:.0f}% fan speed"
)
power = self.measure_power(
ambient_max_measure_time, ambient_measure_sample_time
)
gcmd.respond_info(
f"{speed*100.:.0f}% fan average power: {power:.2f} W"
)
fan_powers.append((speed, power))
for idx in range(0, fan_breakpoints):
speed = idx / (fan_breakpoints - 1)
curtime = self.heater.reactor.monotonic()
print_time = fan.get_mcu().estimated_print_time(curtime)
fan.set_speed(print_time + PIN_MIN_TIME, 0.0)
fan.set_speed(print_time + PIN_MIN_TIME, speed)
gcmd.respond_info("Waiting for temperature to stabilize")
self.wait_stable(3)
gcmd.respond_info(
f"Temperature stable, measuring power usage with {speed*100.:.0f}% fan speed"
)
power = self.measure_power(
ambient_max_measure_time, ambient_measure_sample_time
)
gcmd.respond_info(
f"{speed*100.:.0f}% fan average power: {power:.2f} W"
)
fan_powers.append((speed, power))
curtime = self.heater.reactor.monotonic()
print_time = fan.get_mcu().estimated_print_time(curtime)
fan.set_speed(print_time + PIN_MIN_TIME, 0.0)
power_base = fan_powers[0][1]

return {
Expand Down
Loading