@energiok/node-red-contrib-pricecontrol-thermal 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -437,6 +437,41 @@ function calculateCoastTime(indoorTemp, outdoorTemp, comfortMin, heatLossCoeffic
|
|
|
437
437
|
* @returns {number} Retention time in minutes
|
|
438
438
|
*/
|
|
439
439
|
function calculateBoostRetention(outdoorTemp, comfortMax, comfortMin, heatLossCoefficient) {
|
|
440
|
+
// Boost duration should INCREASE in cold weather (building needs more heat)
|
|
441
|
+
// and DECREASE in mild weather (risk of overheating)
|
|
442
|
+
//
|
|
443
|
+
// Logic: In cold weather, we want to store more thermal energy during cheap hours
|
|
444
|
+
// because we'll need it. In mild weather, limit boost to avoid overshooting comfort.
|
|
445
|
+
//
|
|
446
|
+
// Base: 2 hours at 10°C (mild), scaling up to 6 hours at -20°C (very cold)
|
|
447
|
+
const baseBoostMinutes = 120; // 2 hours minimum
|
|
448
|
+
const maxBoostMinutes = 360; // 6 hours maximum
|
|
449
|
+
|
|
450
|
+
// Reference temperatures for scaling
|
|
451
|
+
const mildTemp = 10; // At this temp or above, use base boost
|
|
452
|
+
const coldTemp = -20; // At this temp or below, use max boost
|
|
453
|
+
|
|
454
|
+
if (outdoorTemp >= mildTemp) {
|
|
455
|
+
return baseBoostMinutes;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
if (outdoorTemp <= coldTemp) {
|
|
459
|
+
return maxBoostMinutes;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// Linear interpolation between mild and cold
|
|
463
|
+
const tempRange = mildTemp - coldTemp; // 30 degrees
|
|
464
|
+
const tempBelow = mildTemp - outdoorTemp; // How far below mild
|
|
465
|
+
const boostRange = maxBoostMinutes - baseBoostMinutes; // 240 minutes
|
|
466
|
+
|
|
467
|
+
return baseBoostMinutes + (boostRange * tempBelow) / tempRange;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Legacy calculation - kept for reference but no longer used
|
|
472
|
+
* Calculates heat retention based on thermal loss (inverse of what we want)
|
|
473
|
+
*/
|
|
474
|
+
function calculateBoostRetentionLegacy(outdoorTemp, comfortMax, comfortMin, heatLossCoefficient) {
|
|
440
475
|
const tempBuffer = comfortMax - comfortMin;
|
|
441
476
|
const tempDelta = comfortMax - outdoorTemp;
|
|
442
477
|
const heatLossRate = tempDelta * heatLossCoefficient;
|
|
@@ -446,6 +481,10 @@ function calculateBoostRetention(outdoorTemp, comfortMax, comfortMin, heatLossCo
|
|
|
446
481
|
return (tempBuffer / heatLossRate) * 60; // Convert hours to minutes
|
|
447
482
|
}
|
|
448
483
|
|
|
484
|
+
// Remove the legacy function from export but keep for backwards compat if called directly
|
|
485
|
+
// eslint-disable-next-line no-unused-vars
|
|
486
|
+
const _legacyBoostRetention = calculateBoostRetentionLegacy;
|
|
487
|
+
|
|
449
488
|
// ============================================================================
|
|
450
489
|
// Schedule Generation
|
|
451
490
|
// ============================================================================
|