This commit is contained in:
P43YM
2025-02-28 18:29:47 +03:00
parent 66ced5f8d0
commit 7c2059d7c6

View File

@@ -44,15 +44,16 @@ public:
private: private:
unsigned short _minOut = 20, _maxOut = 90; unsigned short _minOut = 20, _maxOut = 90;
datatype getResultN() { datatype getResultN()
float tempDiff = targetTemp - outdoorTemp, {
float tempDelta = targetTemp - outdoorTemp,
maxPoint = targetTemp - (_maxOut - targetTemp) / Kn, maxPoint = targetTemp - (_maxOut - targetTemp) / Kn,
sf = (_maxOut - targetTemp) / pow(targetTemp - maxPoint, 1.0 / Ke), sf = (_maxOut - targetTemp) / pow(targetTemp - maxPoint, 1.0 / Ke),
T_rad = targetTemp + sf * pow(tempDiff, 1.0 / Ke); T_rad = targetTemp + sf * (tempDelta >= 0 ? pow(tempDelta, 1.0 / Ke) : -pow(-tempDelta, 1.0 / Ke));
return T_rad > _maxOut ? _maxOut : T_rad; return T_rad > _maxOut ? _maxOut : T_rad;
} }
// Расчет поправки (ошибки) термостата // Реакция на разницу с целевой температурой
datatype getResultT() { datatype getResultT() {
return constrain((targetTemp - indoorTemp), -3, 3) * Kt; return constrain((targetTemp - indoorTemp), -3, 3) * Kt;
} }