Skip to content

No overshoot with settings #45

@Finnitio

Description

@Finnitio

I have a AVR128DB48 that uses 8 bit PWM for heater control. PT1000 thermoelement. Depending on usecase other setpoints are used. Thus i would like to implement the autotune feature for quickPID.

I use these parameter:

float inputSpan = maximumTemperature - MIN_TEMPERATURE; // Temperature range
float outputSpan = 255.0; // PWM range 0-255
float outputStart = 0.0; // Start at 0% PWM
float outputStep = 64.0; // 25% step size
uint32_t testTimeSec = 60; // 1 minute test time
uint32_t settleTimeSec = 0; // 0 seconds settle time
uint16_t samples = 500; // Number of samples

to get this autotune run:

sTune configured - starting autotuning...
 sec: 0.0000  out: 0.00  pv: 25.346  tan: 0.000 →
 sec: 0.2899  out: 64.00  pv: 25.346  tan: 0.000 →
 sec: 0.5797  out: 64.00  pv: 25.325  tan: -0.001 ↘
 sec: 0.8697  out: 64.00  pv: 26.939  tan: 0.052 ↗
 sec: 1.1596  out: 64.00  pv: 28.640  tan: 0.162 ↗
 sec: 1.4495  out: 64.00  pv: 29.873  tan: 0.313 ↗
 sec: 1.7395  out: 64.00  pv: 31.639  tan: 0.523 ↗
 sec: 2.0294  out: 64.00  pv: 32.256  tan: 0.753 ↗
 sec: 2.3193  out: 64.00  pv: 33.747  tan: 1.033 ↗
 sec: 2.6092  out: 64.00  pv: 34.577  tan: 1.341 ↗
 sec: 2.8992  out: 64.00  pv: 35.920  tan: 1.694 ↗
 sec: 3.1891  out: 64.00  pv: 36.985  tan: 2.081 ↗
 sec: 3.4790  out: 64.00  pv: 37.923  tan: 2.501 ↗
 sec: 3.7689  out: 64.00  pv: 38.542  tan: 2.941 ↗
 sec: 4.0588  out: 64.00  pv: 39.245  tan: 3.404 ↗
 sec: 4.3488  out: 64.00  pv: 39.971  tan: 3.891 ↗
 sec: 4.6387  out: 64.00  pv: 40.803  tan: 4.407 ↗
 sec: 4.9286  out: 64.00  pv: 41.336  tan: 4.940 ↗
 sec: 5.2185  out: 64.00  pv: 42.105  tan: 5.498 ↗
 sec: 5.5084  out: 64.00  pv: 42.681  tan: 6.076 ↗
 sec: 5.7984  out: 64.00  pv: 42.916  tan: 6.662 ↗
 sec: 6.0883  out: 64.00  pv: 43.514  tan: 7.267 ↗
 sec: 6.3782  out: 64.00  pv: 44.069  tan: 7.892 ↗
 sec: 6.6681  out: 64.00  pv: 44.347  tan: 8.525 ↗
 sec: 6.9580  out: 64.00  pv: 44.689  tan: 9.170 ↗
 sec: 7.2480  out: 64.00  pv: 45.223  tan: 9.832 ↗
 sec: 7.5379  out: 64.00  pv: 45.672  tan: 10.510 ↗
 sec: 7.8278  out: 64.00  pv: 46.014  tan: 11.199 ↗
 sec: 8.1178  out: 64.00  pv: 46.313  tan: 11.898 ↗
 sec: 8.4077  out: 64.00  pv: 46.933  tan: 12.617 ↗
 sec: 8.6977  out: 64.00  pv: 47.339  tan: 13.350 ↗
 sec: 8.9876  out: 64.00  pv: 47.553  tan: 14.112 ↗
 sec: 9.2776  out: 64.00  pv: 47.489  tan: 13.236 ↘
 sec: 9.5675  out: 64.00  pv: 48.366  tan: 12.250 ↘
 sec: 9.8575  out: 64.00  pv: 48.366  tan: 11.674 ↘
 sec: 10.1475  out: 64.00  pv: 48.644  tan: 10.533 ↘
 sec: 10.4374  out: 64.00  pv: 48.729  tan: 10.486 ↘
 sec: 10.7274  out: 64.00  pv: 49.243  tan: 9.562 ↘
 sec: 11.0174  out: 64.00  pv: 49.500  tan: 9.256 ↘
 sec: 11.3073  out: 64.00  pv: 49.692  tan: 8.418 ↘
 sec: 11.5973  out: 64.00  pv: 49.928  tan: 7.819 ↘
 sec: 11.8873  out: 64.00  pv: 49.821  tan: 7.309 ↘
 sec: 12.1772  out: 64.00  pv: 50.184  tan: 7.099 ↘
 sec: 12.4672  out: 64.00  pv: 50.548  tan: 6.796 ↘
 sec: 12.7571  out: 64.00  pv: 50.612  tan: 6.449 ↘
 sec: 13.0471  out: 64.00  pv: 50.420  tan: 5.966 ↘
 sec: 13.3370  out: 64.00  pv: 50.848  tan: 5.767 ↘
 sec: 13.6270  out: 64.00  pv: 50.933  tan: 5.318 ↘
 sec: 13.9169  out: 64.00  pv: 51.255  tan: 5.047 ↘
 sec: 14.2069  out: 64.00  pv: 51.212  tan: 5.096 ↗
 sec: 14.4969  out: 64.00  pv: 51.533  tan: 4.785 ↘
 sec: 14.7868  out: 64.00  pv: 51.597  tan: 4.500 ↘
 sec: 15.0768  out: 64.00  pv: 51.683  tan: 4.476 ↘
 sec: 15.3667  out: 64.00  pv: 52.004  tan: 4.389 ↘
 sec: 15.6567  out: 64.00  pv: 51.683  tan: 4.088 ↘
 sec: 15.9466  out: 64.00  pv: 52.282  tan: 3.875 ↘
 sec: 16.2366  out: 64.00  pv: 52.261  tan: 3.752 ↘
 sec: 16.5265  out: 64.00  pv: 52.368  tan: 3.665 ↘
 sec: 16.8165  out: 64.00  pv: 52.346  tan: 3.246 ↘
 sec: 17.1065  out: 64.00  pv: 52.625  tan: 3.029 ↘
 sec: 17.3964  out: 64.00  pv: 52.839  tan: 2.999 ↘

 Controller Action: directIP

 Output Start:      0.00
 Output Step:       64.00
 Sample Sec:        0.1200

 Pv Start:          25.346
 Pv Max:            111.401
 Pv Diff:           86.055

 Process Gain:      2.286
 Dead Time Sec:     0.870
 Tau Sec:           20.352

 Tau/Dead Time:     23.4 (easy to control)
 Tau/Sample Period: 169.6 (good sample rate)

 Tuning Method: ZN_PID
  Kp: 6.142
  Ki: 0.575  Ti: 10.684
  Kd: 2.300  Td: 2.671

Autotuning completed successfully!

with these pid parameters i get this pid control:

PID Input: 28.00 °C, Output: 143.99, PWM: 143.99
PID Input: 30.83 °C, Output: 56.31, PWM: 56.31
PID Input: 31.23 °C, Output: 110.66, PWM: 110.66
PID Input: 36.15 °C, Output: 0.00, PWM: 0.00
PID Input: 35.13 °C, Output: 121.20, PWM: 121.20
PID Input: 39.97 °C, Output: 0.00, PWM: 0.00
PID Input: 38.35 °C, Output: 116.43, PWM: 116.43
PID Input: 42.87 °C, Output: 0.00, PWM: 0.00
PID Input: 40.74 °C, Output: 114.51, PWM: 114.51
PID Input: 44.88 °C, Output: 0.00, PWM: 0.00
PID Input: 42.62 °C, Output: 106.67, PWM: 106.67
PID Input: 46.08 °C, Output: 0.00, PWM: 0.00
PID Input: 43.83 °C, Output: 99.30, PWM: 99.30
PID Input: 46.85 °C, Output: 0.00, PWM: 0.00
PID Input: 44.56 °C, Output: 96.32, PWM: 96.32
PID Input: 47.49 °C, Output: 0.00, PWM: 0.00
PID Input: 45.07 °C, Output: 96.56, PWM: 96.56

not really sure what the problem is but there is no overshoot and temps are not very stable.

this

Pv Start:          25.346
Pv Max:            111.401
Pv Diff:           86.055

seems odd to me since max temp during autotune run was pv = 52.839.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions