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

improved the pid calibration algorithm #62

Merged
merged 1 commit into from
Oct 7, 2023
Merged

improved the pid calibration algorithm #62

merged 1 commit into from
Oct 7, 2023

Conversation

dans98
Copy link
Contributor

@dans98 dans98 commented Sep 21, 2023

I've updated the pid calibration algorithm, so it provides better results, and added general pid documentation.

lots of discussion about the changes can be seen here.
https://klipper.discourse.group/t/experimental-pid-improvement-changes/3604

added general pid documentation

Signed-off-by: Daniel Sherman <[email protected]>
Copy link
Contributor

@bwnance bwnance left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks awesome :) thanks so much! I'm out of town for the weekend but maybe @rogerlz will have bandwidth to test this on his machine, but everything looks good to me!

Great work on the docs, too - super clear and a great explanation!

@rogerlz
Copy link
Contributor

rogerlz commented Sep 26, 2023

The PR looks nice! I don't have enough knowledge on the subject to understand what it does, but I can say that I have enabled pid_v on my machine and ran a PID_CALIBRATE, and nothing breaks.. so I am happy with that.

@dans98, we are applying code formatting to make it easier to read.. do you mind if I push a commit to your PR formatting it so the tests can run green? Ty

@bwnance
Copy link
Contributor

bwnance commented Sep 26, 2023

oh, @dans98 a question - is pid_v a viable use for hotends? or is it primarily for heaters with large thermal mass - eg, the bed?

@dans98
Copy link
Contributor Author

dans98 commented Sep 26, 2023

@rogerlz go ahead and push a commit, I have no issues with it.

I'm a developer by trade (enterprise grade php), and i'm used to a lot more stringent formatting & documentation. I was just trying to stick to what mainline klipper seems to have, almost no spacing, or inline documentation.

@dans98
Copy link
Contributor Author

dans98 commented Sep 26, 2023

@bwnance the main benefit of pid_v is that it's not susceptible to integral windup (the overshoot you get when first coming up to temp). its also generally better at holding temp, on a clean signal. I use pid_v on my hot end and bed.

If you have a large thermal mass bed you most likely want to use Cohen-Coon parameters instead of Classic Ziegler-Nichols (what klipper generates by default).

In the docs I provided a spreadsheet that lets you calculate Cohen-Coon parameters from the data written to the log.
https://github.com/dans98/danger-klipper/blob/pid_calibrate/docs/PID.md#advanced--manual-calibration

@bwnance
Copy link
Contributor

bwnance commented Sep 26, 2023

@dans98 awesome, thank you!

would it be feasible (can be in a subsequent PR) to have that parameter calculation in a klipper feature, rather than a spreadsheet?

Maybe as a config flag in a heater? specify the parameter type in the heater config block

@dans98
Copy link
Contributor Author

dans98 commented Sep 26, 2023

@bwnance

Maybe as a config flag in a heater? specify the parameter type in the heater config block

Yea I could do a follow up that calculates everything in klipper/python.

My only concern would be how do we present it all to the user? The spread sheet takes what's written to the log and then allows you to generate 5 different sets of parameters. should we just calculate them all and dump them all to the log?

I wouldn't want people to have to re-run calibration just to try different parameters. Than can take a long time on something like a high thermal mass bed.

@bwnance
Copy link
Contributor

bwnance commented Sep 26, 2023

@dans98 could we save the "raw" information (that's currently written to the log) to the config and then use it in conjunction with the chosen parameter type to calculate parameters on heater initialization?

@dans98
Copy link
Contributor Author

dans98 commented Sep 28, 2023

@bwnance I'm under the weather at the moment, but I'll think about what's possible.

@bwnance
Copy link
Contributor

bwnance commented Sep 28, 2023

@dans98 feel better! No rush :)

@kjkent kjkent mentioned this pull request Sep 29, 2023
@bwnance bwnance merged commit 0b03c2b into KalicoCrew:master Oct 7, 2023
1 check failed
@dans98
Copy link
Contributor Author

dans98 commented Oct 13, 2023

I haven't had time to look at the change yet, as soon as i got over the sinus infection my toddler gave me, I got hammered with a big work project.

With that being said, I've been incontact with Zeanon about getting his pid profile code in place.
https://github.com/Zeanon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants