TM: Handle UV (PTC loss)

Model UV as power-invariant, so that scaling P doesn't change the
intercept location (that is, the zero point remains at the same
temperature even for more powerful heaters).

NOTE: It's not clear to me whether this is generally true (couldn't
find a datasheet from the same heater in diffent power variants
showing the efficiency loss)
This commit is contained in:
Yuri D'Elia 2023-01-26 22:45:16 +01:00
parent 02775fb79e
commit e147fc2cb0

View File

@ -2349,6 +2349,7 @@ void model_data::step(uint8_t heater_pwm, uint8_t fan_pwm, float heater_temp, fl
const float cur_R = R[fan_pwm]; // resistance at current fan power (K/W)
float dP = P * heater_scale; // current power [W]
dP *= (cur_heater_temp * U) + V; // linear temp. correction
float dPl = (cur_heater_temp - cur_ambient_temp) / cur_R; // [W] leakage power
float dT = (dP - dPl) * C_i; // expected temperature difference (K)
@ -2388,6 +2389,8 @@ static void setup()
static bool calibrated()
{
if(!(data.P > 0)) return false;
if(isnan(data.U)) return false;
if(isnan(data.V)) return false;
if(!(data.C > 0)) return false;
if(isnan(data.fS)) return false;
if(!(data.Ta_corr != NAN)) return false;