Aggiunta gestione LastTCicloNetto ( denom. % tempo cerchio)

This commit is contained in:
Samuele Locatelli
2020-10-19 18:47:20 +02:00
parent 95a7a1355e
commit a794402ccb
2 changed files with 17 additions and 1 deletions
+14 -1
View File
@@ -48,10 +48,14 @@ namespace Thermo.Active.NC
/// </summary>
protected DateTime lastProdEnd;
/// <summary>
/// Ultimo ciclo registrato(secondi)
/// Ultimo ciclo registrato (secondi)
/// </summary>
protected double lastCycle = 9999;
/// <summary>
/// Ultimo ciclo NETTO registrato (secondi)
/// </summary>
protected double lastCycleNet = 9999;
/// <summary>
/// Indica che per i dati del prodPanel è necessario rileggere il DB (modificato)
/// </summary>
protected static bool forceProdPanelDbReload = false;
@@ -1579,22 +1583,31 @@ namespace Thermo.Active.NC
{
currentProdPanel.LastCadenza = Math.Round((double)3600000 / lastProdInfoData.TimeCycleGross, 2);
}
// 2020.10.19 aggiungo TCicloNetto
currentProdPanel.LastTCicloNetto = Math.Round((double)lastProdInfoData.TimeCycleNet / 1000, 2);
// se NON HO un last value...
if (lastCycle == 0)
{
lastCycle = currentProdPanel.LastTCiclo;
lastCycleNet = currentProdPanel.LastTCicloNetto;
}
// se il valore SALVATO è > 3 * valore rilevato --> uso SOLO ultimo
else if (lastCycle > 3 * currentProdPanel.LastTCiclo)
{
lastCycle = currentProdPanel.LastTCiclo;
lastCycleNet = currentProdPanel.LastTCicloNetto;
}
// altrimenti EWMA da parametro calcolato standard, default 50%
else
{
//lastCycle = 0.5 * lastCycle + 0.5 * lastDuration;
lastCycle = ewmaLambda * currentProdPanel.LastTCiclo + (1 - ewmaLambda) * lastCycle;
lastCycleNet = ewmaLambda * currentProdPanel.LastTCicloNetto + (1 - ewmaLambda) * lastCycleNet;
// sistemo ponderato il ciclo netto rilevato
currentProdPanel.LastTCicloNetto = lastCycleNet;
}
// salvo anche nei live data della ricetta...
RecipeLiveData.TC_last = lastCycle;