modifica calcoli equality x uso epsilon a 0.1

This commit is contained in:
Samuele Locatelli
2020-09-25 11:46:10 +02:00
parent a554e42f06
commit 08d48f6044
6 changed files with 27 additions and 34 deletions
+1 -1
View File
@@ -391,7 +391,7 @@ namespace Thermo.Active.Model
public static readonly string[] VALID_FILE_EXTENSIONS = { "", ".txt", ".cnc", ".ini", ".mpf", ".spf" };
public static readonly string[] VALID_IMAGE_EXTENSIONS = { ".jpg", ".jpeg", ".png", ".bmp", ".gif" };
public const double EPSILON = 0.001;
public const double EPSILON = 0.1;
public static string QUEUE_FILE_NAME = "pp";
public const string JOB_MAIN_FILENAME = "main.cnc";
public const string JOB_METADATA_FILENAME = "metadata.json";
@@ -51,28 +51,20 @@ namespace Thermo.Active.Model.DTOModels.ThAxes
// Object is not a GaugeModel instance
if (!(obj is DTOAxisInfoModel item))
return false;
if (ID != item.ID)
return false;
if (name != item.name)
return false;
if (Math.Round(Math.Abs(position - item.position), 1) >= Constants.EPSILON * 100)
if (Math.Round(Math.Abs(position - item.position), 1) >= Constants.EPSILON)
return false;
if (Math.Round(Math.Abs(speed - item.speed), 1) >= Constants.EPSILON * 100)
if (Math.Round(Math.Abs(speed - item.speed), 1) >= Constants.EPSILON)
return false;
if (Math.Round(Math.Abs(load - item.load), 1) >= Constants.EPSILON * 100)
if (Math.Round(Math.Abs(load - item.load), 1) >= Constants.EPSILON)
return false;
if (errorCode != item.errorCode)
return false;
if (movPhase != item.movPhase)
return false;
if (statusCode != item.statusCode)
return false;
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using static Thermo.Active.Model.Constants;
@@ -52,13 +53,13 @@ namespace Thermo.Active.Model.DTOModels.ThModules
return false;
if (NumDec != item.NumDec)
return false;
if (ActualDelay != item.ActualDelay)
if (Math.Round(Math.Abs(ActualDelay - item.ActualDelay), 1) >= Constants.EPSILON)
return false;
if (ActualDuration != item.ActualDuration)
if (Math.Round(Math.Abs(ActualDuration - item.ActualDuration), 1) >= Constants.EPSILON)
return false;
if (EstimatedDelay != item.EstimatedDelay)
if (Math.Round(Math.Abs(EstimatedDelay - item.EstimatedDelay), 1) >= Constants.EPSILON)
return false;
if (EstimatedDuration != item.EstimatedDuration)
if (Math.Round(Math.Abs(EstimatedDuration - item.EstimatedDuration), 1) >= Constants.EPSILON)
return false;
if (!Enumerable.SequenceEqual(PrecedingId, item.PrecedingId))
return false;
@@ -39,27 +39,27 @@ namespace Thermo.Active.Model.DTOModels.ThProd
return false;
if (NumDone != item.NumDone)
return false;
if (TimeWarm != item.TimeWarm)
if (Math.Round(Math.Abs(TimeWarm - item.TimeWarm), 1) >= Constants.EPSILON)
return false;
if (Math.Round(Math.Abs(TimeVent - item.TimeVent), 1) >= Constants.EPSILON * 100)
if (Math.Round(Math.Abs(TimeVent - item.TimeVent), 1) >= Constants.EPSILON)
return false;
if (Math.Round(Math.Abs(TimeVacuum - item.TimeVacuum), 1) >= Constants.EPSILON * 100)
if (Math.Round(Math.Abs(TimeVacuum - item.TimeVacuum), 1) >= Constants.EPSILON)
return false;
if (Math.Round(Math.Abs(TimeCycleGross - item.TimeCycleGross), 1) >= Constants.EPSILON * 100)
if (Math.Round(Math.Abs(TimeCycleGross - item.TimeCycleGross), 1) >= Constants.EPSILON)
return false;
if (Math.Round(Math.Abs(TimeCycleNet - item.TimeCycleNet), 1) >= Constants.EPSILON * 100)
if (Math.Round(Math.Abs(TimeCycleNet - item.TimeCycleNet), 1) >= Constants.EPSILON)
return false;
if (Math.Round(Math.Abs(MaterialTempEndWarm - item.MaterialTempEndWarm), 1) >= Constants.EPSILON * 100)
if (Math.Round(Math.Abs(MaterialTempEndWarm - item.MaterialTempEndWarm), 1) >= Constants.EPSILON)
return false;
if (Math.Round(Math.Abs(MaterialTempEndVent - item.MaterialTempEndVent), 1) >= Constants.EPSILON * 100)
if (Math.Round(Math.Abs(MaterialTempEndVent - item.MaterialTempEndVent), 1) >= Constants.EPSILON)
return false;
if (Math.Round(Math.Abs(MoldTemp - item.MoldTemp), 1) >= Constants.EPSILON * 100)
if (Math.Round(Math.Abs(MoldTemp - item.MoldTemp), 1) >= Constants.EPSILON)
return false;
if (Math.Round(Math.Abs(VacuumReadVal - item.VacuumReadVal), 1) >= Constants.EPSILON * 100)
if (Math.Round(Math.Abs(VacuumReadVal - item.VacuumReadVal), 1) >= Constants.EPSILON)
return false;
if (Math.Round(Math.Abs(MouldEnergyOUT - item.MouldEnergyOUT), 1) >= Constants.EPSILON * 100)
if (Math.Round(Math.Abs(MouldEnergyOUT - item.MouldEnergyOUT), 1) >= Constants.EPSILON)
return false;
if (Math.Round(Math.Abs(MouldEnergyIN - item.MouldEnergyIN), 1) >= Constants.EPSILON * 100)
if (Math.Round(Math.Abs(MouldEnergyIN - item.MouldEnergyIN), 1) >= Constants.EPSILON)
return false;
if (IsScrap != item.IsScrap)
return false;
@@ -30,17 +30,17 @@ namespace Thermo.Active.Model.DTOModels.ThProd
return false;
if (InizioProd != item.InizioProd)
return false;
if (StimaDurata != item.StimaDurata)
if (Math.Round(Math.Abs(StimaDurata - item.StimaDurata), 1) >= Constants.EPSILON)
return false;
if (TempAct != item.TempAct)
if (Math.Round(Math.Abs(TempAct - item.TempAct), 1) >= Constants.EPSILON)
return false;
if (TempSetpoint != item.TempSetpoint)
if (Math.Round(Math.Abs(TempSetpoint - item.TempSetpoint), 1) >= Constants.EPSILON)
return false;
if (NomeRicetta != item.NomeRicetta)
return false;
if (LastCadenza != item.LastCadenza)
if (Math.Round(Math.Abs(LastCadenza - item.LastCadenza), 1) >= Constants.EPSILON)
return false;
if (LastTCiclo != item.LastTCiclo)
if (Math.Round(Math.Abs(LastTCiclo - item.LastTCiclo), 1) >= Constants.EPSILON)
return false;
if (!Enumerable.SequenceEqual(TS_Cadenza, item.TS_Cadenza))
return false;
@@ -22,7 +22,7 @@ namespace Thermo.Active.Model.DTOModels.ThProd
if (!Category.Equals(item.Category))
return false;
if (Math.Round(Math.Abs(Value - item.Value), 1) >= Constants.EPSILON * 100)
if (Math.Round(Math.Abs(Value - item.Value), 1) >= Constants.EPSILON)
return false;
if (Name != item.Name)
return false;