Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
MarlinKimbra
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
MarlinKimbra
Commits
5ab3b03a
Commit
5ab3b03a
authored
May 12, 2016
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better PID defaults
parent
df6dc807
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
Configuration_Feature.h
...mentation/Laser/K40_ramps_configs/Configuration_Feature.h
+4
-4
temperature.cpp
MK/module/temperature/temperature.cpp
+5
-5
No files found.
Documentation/Laser/K40_ramps_configs/Configuration_Feature.h
View file @
5ab3b03a
...
@@ -220,14 +220,14 @@
...
@@ -220,14 +220,14 @@
// all forms of bed control obey this (PID, bang-bang, bang-bang with hysteresis)
// all forms of bed control obey this (PID, bang-bang, bang-bang with hysteresis)
// setting this to anything other than 255 enables a form of PWM to the bed,
// setting this to anything other than 255 enables a form of PWM to the bed,
// so you shouldn't use it unless you are OK with PWM on your bed. (see the comment on enabling PIDTEMPCOOLER)
// so you shouldn't use it unless you are OK with PWM on your bed. (see the comment on enabling PIDTEMPCOOLER)
#define MAX_COOLER_POWER 2
55 // limits duty cycle to bed; 255=full current
#define MAX_COOLER_POWER 2
00 // limits duty cycle to bed; 255=full current, save PEC life by setting max to 200
#define PID_COOLER_INTEGRAL_DRIVE_MAX MAX_COOLER_POWER // limit for the integral term
#define PID_COOLER_INTEGRAL_DRIVE_MAX MAX_COOLER_POWER // limit for the integral term
// 120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
// 120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
// from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
// from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
#define DEFAULT_coolerKp
1
0.00
#define DEFAULT_coolerKp
4
0.00
#define DEFAULT_coolerKi .
02
3
#define DEFAULT_coolerKi .3
#define DEFAULT_coolerKd
305
.4
#define DEFAULT_coolerKd
50
.4
// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.
// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.
...
...
MK/module/temperature/temperature.cpp
View file @
5ab3b03a
...
@@ -812,10 +812,10 @@ float get_pid_output(int h) {
...
@@ -812,10 +812,10 @@ float get_pid_output(int h) {
#if ENABLED(PIDTEMPCOOLER)
#if ENABLED(PIDTEMPCOOLER)
float
get_pid_output_cooler
()
{
float
get_pid_output_cooler
()
{
float
pid_output
;
float
pid_output
;
#if ENABLED(PID_OPENLOOP)
#if ENABLED(PID_OPENLOOP)
pid_output
=
constrain
(
target_temperature_cooler
,
0
,
MAX_COOLER_POWER
);
pid_output
=
constrain
(
target_temperature_cooler
,
0
,
MAX_COOLER_POWER
);
#else
#else
//pid_error_cooler = target_temperature_cooler - current_temperature_cooler;
//pid_error_cooler = target_temperature_cooler - current_temperature_cooler;
pid_error_cooler
=
current_temperature_cooler
-
target_temperature_cooler
;
pid_error_cooler
=
current_temperature_cooler
-
target_temperature_cooler
;
pTerm_cooler
=
coolerKp
*
pid_error_cooler
;
pTerm_cooler
=
coolerKp
*
pid_error_cooler
;
...
@@ -826,7 +826,7 @@ float get_pid_output(int h) {
...
@@ -826,7 +826,7 @@ float get_pid_output(int h) {
//dTerm_cooler = K2 * coolerKd * (current_temperature_cooler - temp_dState_cooler) + K1 * dTerm_cooler;
//dTerm_cooler = K2 * coolerKd * (current_temperature_cooler - temp_dState_cooler) + K1 * dTerm_cooler;
dTerm_cooler
=
K2
*
coolerKd
*
(
temp_dState_cooler
-
current_temperature_cooler
)
+
K1
*
dTerm_cooler
;
dTerm_cooler
=
K2
*
coolerKd
*
(
temp_dState_cooler
-
current_temperature_cooler
)
+
K1
*
dTerm_cooler
;
temp_dState_cooler
=
current_temperature_cooler
;
temp_dState_cooler
=
current_temperature_cooler
;
pid_output
=
pTerm_cooler
+
iTerm_cooler
-
dTerm_cooler
;
pid_output
=
pTerm_cooler
+
iTerm_cooler
-
dTerm_cooler
;
if
(
pid_output
>
MAX_COOLER_POWER
)
{
if
(
pid_output
>
MAX_COOLER_POWER
)
{
if
(
pid_error_cooler
>
0
)
temp_iState_cooler
-=
pid_error_cooler
;
// conditional un-integration
if
(
pid_error_cooler
>
0
)
temp_iState_cooler
-=
pid_error_cooler
;
// conditional un-integration
...
@@ -836,7 +836,6 @@ float get_pid_output(int h) {
...
@@ -836,7 +836,6 @@ float get_pid_output(int h) {
if
(
pid_error_cooler
<
0
)
temp_iState_cooler
-=
pid_error_cooler
;
// conditional un-integration
if
(
pid_error_cooler
<
0
)
temp_iState_cooler
-=
pid_error_cooler
;
// conditional un-integration
pid_output
=
0
;
pid_output
=
0
;
}
}
#endif // PID_OPENLOOP
#endif // PID_OPENLOOP
#if ENABLED(PID_COOLER_DEBUG)
#if ENABLED(PID_COOLER_DEBUG)
...
@@ -848,8 +847,9 @@ float get_pid_output(int h) {
...
@@ -848,8 +847,9 @@ float get_pid_output(int h) {
ECHO_EMV
(
" dTerm "
,
dTerm_cooler
);
ECHO_EMV
(
" dTerm "
,
dTerm_cooler
);
#endif //PID_COOLER_DEBUG
#endif //PID_COOLER_DEBUG
return
pid_output
;
}
}
#endif
#endif
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment