diff --git a/Thermo.Active.NC/NcAdapter.cs b/Thermo.Active.NC/NcAdapter.cs index df3f4766..42e6caa2 100644 --- a/Thermo.Active.NC/NcAdapter.cs +++ b/Thermo.Active.NC/NcAdapter.cs @@ -1457,12 +1457,12 @@ namespace Thermo.Active.NC lastProdEnd = DateTime.Now; // calcolo ultimo ciclo... var lastDuration = lastProdEnd.Subtract(lastProdStart).TotalSeconds; - // se il prec è > 3 cicli uso SOLO ultimo - if (lastCycle > 3 * lastDuration) + // se il valore SALVATO è > 3 * valore rilevato (ma NON inferiore a 1/3...) --> uso SOLO ultimo + if ((lastCycle > 3 * lastDuration) && (lastCycle / 3 < lastDuration)) { lastCycle = lastDuration; } - // altrimenti ewma 50% + // altrimenti EWMA 50% else { lastCycle = 0.5 * lastCycle + 0.5 * lastDuration;