diff options
author | David Crocker <dcrocker@eschertech.com> | 2020-11-09 22:32:06 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2020-11-09 22:32:06 +0300 |
commit | 1a21482fec82f6f40c14384def139a2f0f0b786a (patch) | |
tree | 39065c017c9b873675ecd4e554df072dfd19e64d /src/Heating | |
parent | 4d431775e3a5bb29b0f4e0e118678e8f3eb19eeb (diff) |
Bug fixes, mostly to new heater tuning
Diffstat (limited to 'src/Heating')
-rw-r--r-- | src/Heating/LocalHeater.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/Heating/LocalHeater.cpp b/src/Heating/LocalHeater.cpp index 1accf069..189b102d 100644 --- a/src/Heating/LocalHeater.cpp +++ b/src/Heating/LocalHeater.cpp @@ -669,9 +669,11 @@ void LocalHeater::DoTuningStep() noexcept // Decide whether to finish tuning if ( tOff.GetNumSamples() == MaxTuningHeaterCycles || ( tOff.GetNumSamples() >= MinTuningHeaterCycles - && dLow.GetDeviation() <= 0.5 - && dHigh.GetDeviation() <= 0.5 - && coolingTimeConstant.GetDeviation() < coolingTimeConstant.GetMean() * 0.2 + && tOn.DeviationFractionWithin(0.2) + && dLow.DeviationFractionWithin(0.2) + && dLow.DeviationFractionWithin(0.2) + && dHigh.DeviationFractionWithin(0.2) + && coolingTimeConstant.DeviationFractionWithin(0.2) ) ) { @@ -720,6 +722,20 @@ void LocalHeater::DoTuningStep() noexcept // Calculate the heater model from the accumulated heater parameters void LocalHeater::CalculateModel() noexcept { + if (reprap.Debug(moduleHeat)) + { +#define PLUS_OR_MINUS "\xC2\xB1" + reprap.GetPlatform().MessageF(GenericMessage, + "tOn %ld" PLUS_OR_MINUS "%ld, tOff %ld" PLUS_OR_MINUS "%ld, dHigh %ld" PLUS_OR_MINUS "%ld, dLow %ld" PLUS_OR_MINUS "%ld, C %ld" PLUS_OR_MINUS "%ld, V %.1f" PLUS_OR_MINUS "%.1f\n", + lrintf(tOn.GetMean()), lrintf(tOn.GetDeviation()), + lrintf(tOff.GetMean()), lrintf(tOff.GetDeviation()), + lrintf(dHigh.GetMean()), lrintf(dHigh.GetDeviation()), + lrintf(dLow.GetMean()), lrintf(dLow.GetDeviation()), + lrintf(coolingTimeConstant.GetMean()), lrintf(coolingTimeConstant.GetDeviation()), + (double)tuningVoltage.GetMean(), (double)tuningVoltage.GetDeviation() + ); + } + const float cycleTime = tOn.GetMean() + tOff.GetMean(); // in milliseconds const float deadTime = (((dHigh.GetMean() * tOff.GetMean()) + (dLow.GetMean() * tOn.GetMean())) * 0.001)/cycleTime; // in seconds const float gain = ((tuningTargetTemp - tuningStartTemp.GetMean() - TuningHysteresis) * cycleTime) / (tOn.GetMean() * tuningPwm); |