From 5a29ac454ff83a643a035f39dd3a396c83f4db63 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 13 Jul 2020 10:46:43 +0200 Subject: [PATCH] fix filter & stats for TC --- Thermo.Active.NC/NcAdapter.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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;