diff --git a/Thermo.Active.Model/Constants.cs b/Thermo.Active.Model/Constants.cs index 9c1dab74..85cd6b0b 100644 --- a/Thermo.Active.Model/Constants.cs +++ b/Thermo.Active.Model/Constants.cs @@ -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"; diff --git a/Thermo.Active.Model/DTOModels/ThAxes/DTOAxisInfoModel.cs b/Thermo.Active.Model/DTOModels/ThAxes/DTOAxisInfoModel.cs index bc044b92..6abf82eb 100644 --- a/Thermo.Active.Model/DTOModels/ThAxes/DTOAxisInfoModel.cs +++ b/Thermo.Active.Model/DTOModels/ThAxes/DTOAxisInfoModel.cs @@ -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; diff --git a/Thermo.Active.Model/DTOModels/ThModules/DTOModulesBlock.cs b/Thermo.Active.Model/DTOModels/ThModules/DTOModulesBlock.cs index 3313ce7b..2df95cd4 100644 --- a/Thermo.Active.Model/DTOModels/ThModules/DTOModulesBlock.cs +++ b/Thermo.Active.Model/DTOModels/ThModules/DTOModulesBlock.cs @@ -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; diff --git a/Thermo.Active.Model/DTOModels/ThProd/DTOProdInfo.cs b/Thermo.Active.Model/DTOModels/ThProd/DTOProdInfo.cs index 877b0183..003a247e 100644 --- a/Thermo.Active.Model/DTOModels/ThProd/DTOProdInfo.cs +++ b/Thermo.Active.Model/DTOModels/ThProd/DTOProdInfo.cs @@ -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; diff --git a/Thermo.Active.Model/DTOModels/ThProd/DTOThermoPanelProd.cs b/Thermo.Active.Model/DTOModels/ThProd/DTOThermoPanelProd.cs index d70cb291..2a3d8dd2 100644 --- a/Thermo.Active.Model/DTOModels/ThProd/DTOThermoPanelProd.cs +++ b/Thermo.Active.Model/DTOModels/ThProd/DTOThermoPanelProd.cs @@ -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; diff --git a/Thermo.Active.Model/DTOModels/ThProd/DTOThermoProd.cs b/Thermo.Active.Model/DTOModels/ThProd/DTOThermoProd.cs index 54a6f2bc..27ce415f 100644 --- a/Thermo.Active.Model/DTOModels/ThProd/DTOThermoProd.cs +++ b/Thermo.Active.Model/DTOModels/ThProd/DTOThermoProd.cs @@ -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;