From 312f5de1bcca64c5c4c25df573c47a666bb97fda Mon Sep 17 00:00:00 2001 From: Roland Drabesch Date: Tue, 16 Jan 2024 10:59:03 +0100 Subject: [PATCH] =?UTF-8?q?LEd=20aus=20an=20der=20Pr=C3=BCfstation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Common/.vs/config/applicationhost.config | 2 +- .../CordonelPreadjustmentUi.csproj | 1 + .../Processes/Actions/AmplitudeTestProcess.cs | 129 ++++++++++++------ .../Protocols/ProtocolCore/BaseProtocol.cs | 2 +- ...erRegisters.csproj.CoreCompileInputs.cache | 2 +- .../DataPackages/DataPackages.csproj | 9 +- .../eRegister/DataPackages/packages.config | 4 +- .../Protocols/StreamingProtocol.csproj | 14 +- .../eRegister/Protocols/packages.config | 5 +- .../eRegisterCore/eRegisterCore.csproj | 7 +- .../eRegister/eRegisterCore/packages.config | 5 +- .../Controllers/PasswordController.cs | 5 +- Common/TempFlansh/Program.cs | 1 + ...ToXlsHelper.csproj.CoreCompileInputs.cache | 2 +- .../GenesisToolBox/FrmTempMeter.Designer.cs | 18 ++- Common/Ui/GenesisToolBox/FrmTempMeter.cs | 89 +++++++----- Common/Ui/GenesisToolBox/FrmTempMeter.resx | 3 + .../Ui/GenesisToolBox/GenesisToolBox.csproj | 4 +- Common/Ui/GenesisToolBox/frmLeagcyTestApp.cs | 2 +- Common/Ui/GenesisToolBox/packages.config | 1 + Common/Ui/LegacyGenesisControl/ICRdy.cs | 1 + .../LegacyGenesisControl/ctlCRdy.Designer.cs | 1 + Common/Ui/LegacyGenesisControl/ctlCRdy.cs | 106 ++++++++++++++ 23 files changed, 315 insertions(+), 98 deletions(-) diff --git a/Common/.vs/config/applicationhost.config b/Common/.vs/config/applicationhost.config index ecc20ba7..de10b180 100644 --- a/Common/.vs/config/applicationhost.config +++ b/Common/.vs/config/applicationhost.config @@ -155,7 +155,7 @@ - + diff --git a/Common/CordonelPreadjustmentUi/CordonelPreadjustmentUi.csproj b/Common/CordonelPreadjustmentUi/CordonelPreadjustmentUi.csproj index 26eefd3b..be3a1a19 100644 --- a/Common/CordonelPreadjustmentUi/CordonelPreadjustmentUi.csproj +++ b/Common/CordonelPreadjustmentUi/CordonelPreadjustmentUi.csproj @@ -109,6 +109,7 @@ + ..\packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll diff --git a/Common/CordonelPreadjustmentUi/Processes/Actions/AmplitudeTestProcess.cs b/Common/CordonelPreadjustmentUi/Processes/Actions/AmplitudeTestProcess.cs index 4b259cbf..86b55683 100644 --- a/Common/CordonelPreadjustmentUi/Processes/Actions/AmplitudeTestProcess.cs +++ b/Common/CordonelPreadjustmentUi/Processes/Actions/AmplitudeTestProcess.cs @@ -1,16 +1,14 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.Eventing.Reader; -using System.Linq; -using System.Text; -using CordonelPreadjustmentUi.Processes.Itinerary; -using System.Threading; -using static CordonelPreadjustmentUi.PreAdjustmentControl; -using System.Threading.Tasks; +using CordonelPreadjustmentUi.Const; using CordonelPreadjustmentUi.Helper; -using CordonelPreadjustmentUi.Const; using CordonelPreadjustmentUi.Helper.Extensions; +using CordonelPreadjustmentUi.Processes.Itinerary; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; using Xylem.Common.Hardware.WaterMeter.Genesis.Registers; +using static CordonelPreadjustmentUi.PreAdjustmentControl; namespace CordonelPreadjustmentUi.Processes.Actions { @@ -35,8 +33,8 @@ namespace CordonelPreadjustmentUi.Processes.Actions { listOfProcessTask.Add(new Task(() => { - - pp.DebugMessage($"Performing {ProcessName} procedure", null , "CC"); + + pp.DebugMessage($"Performing {ProcessName} procedure", null, "CC"); #region Definitions and initializations const Int32 FirstHitShiftValue = 4; @@ -49,7 +47,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions var TofAvgMean = new MultiPathDataLogContainer(pp.Setting.NumberOfPaths); var OptimalPoint = new MultiPathDataLogContainer(pp.Setting.NumberOfPaths); var TofAvgMeanTotal = new MultiPathDataLogContainer>(pp.Setting.NumberOfPaths); - TofAvgMeanTotal.Update(null,new List()); + TofAvgMeanTotal.Update(null, new List()); Boolean Ok = false; #endregion @@ -61,10 +59,10 @@ namespace CordonelPreadjustmentUi.Processes.Actions meterctl.Meter.DataLog(Header); //GenesisZeroFlow._GenesisZeroFlow.SetLoggingPathAmplitudeTest(this.MeterNumber, $"{DataLogging.DefaultPath}AmplitudeTest_RawData_{TempPcbID}_{time}.txt"); meterctl.Meter.logAmpTest = true; - pp.DebugMessage($" Start logging", meterctl.Meter.Slot, "DC",meterctl.Meter.PcbId); + pp.DebugMessage($" Start logging", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId); } #endregion - + Ok = false; @@ -128,54 +126,95 @@ namespace CordonelPreadjustmentUi.Processes.Actions Ok = RecordData(pp, meterctl, Ok, FirstHitLevelPercentage); bool retryRecord = false; - - for (UInt16 Path = 0; Path < meterctl.Meter.listOfTotalTimeOfFlightSPerPath.GetPathCount(); Path++) + if (true) { - if (!meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Get(Path).Any()) + if (!meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Get(1).Any()) { - pp.StatusLabel = $"No Data for Path {Path}. Start one recollect"; + pp.StatusLabel = $"No Data for Path {1}. Start one recollect"; retryRecord = true; } - } + else + { + for (UInt16 Path = 0; Path < meterctl.Meter.listOfTotalTimeOfFlightSPerPath.GetPathCount(); Path++) + { + if (!meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Get(Path).Any()) + { + pp.StatusLabel = $"No Data for Path {Path}. Start one recollect"; + + retryRecord = true; + } + + } + } + if (retryRecord) { Ok = RecordData(pp, meterctl, Ok, FirstHitLevelPercentage); } - + pp.StatusLabel = $"{PredefinedMessages.WaitUntilPercentageSweepFinished(pp.Setting.Culture)} {FirstHitLevelPercentage.ToString(pp.Setting.Culture)}/{ pp.Setting.AmpTestPercentageStop.ToString(pp.Setting.Culture)}; 0s"; Ok = true; #endregion #region Calculate mean value - - for (UInt16 Path = 0; Path < meterctl.Meter.listOfTotalTimeOfFlightSPerPath.GetPathCount(); Path++) + if (true) { - var meanVal = meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Get(Path).ToList().Mean(); - pp.DebugMessage($"Calculate mean value {meanVal} at {meterctl.Meter.Slot}; PATH{(Path + 1).ToString(pp.Setting.Culture)}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId); + var meanVal = meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Get(1).ToList().Mean(); + pp.DebugMessage($"Calculate mean value {meanVal} at {meterctl.Meter.Slot}; PATH{(1 + 1).ToString(pp.Setting.Culture)}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId); //earlier TofAvgMeanTotal //TofAvgMean.Update(Path, meanVal); if (meanVal == 0) { - pp.DebugMessage($"Mean value is zero at {meterctl.Meter.Slot}; PATH{(Path + 1).ToString(pp.Setting.Culture)}; Value = {Math.Round(meanVal, 4).ToString("000.0000", pp.Setting.Culture)}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId); + pp.DebugMessage($"Mean value is zero at {meterctl.Meter.Slot}; PATH{(1 + 1).ToString(pp.Setting.Culture)}; Value = {Math.Round(meanVal, 4).ToString("000.0000", pp.Setting.Culture)}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId); meterctl.Meter.calibrationResult.AddAdditionalLog($"" + - $"PATH {Path + 1}", Math.Round(meanVal, 4).ToString("000.0000", pp.Setting.Culture)); + $"PATH {1 + 1}", Math.Round(meanVal, 4).ToString("000.0000", pp.Setting.Culture)); if (CheckAbort(false, meterctl)) { return false; } } - pp.DebugMessage($"Mean value at {meterctl.Meter.Slot}; PATH{(Path + 1).ToString(pp.Setting.Culture)}; Value = {Math.Round(meanVal, 4).ToString("000.0000", pp.Setting.Culture)}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId); + pp.DebugMessage($"Mean value at {meterctl.Meter.Slot}; PATH{(1 + 1).ToString(pp.Setting.Culture)}; Value = {Math.Round(meanVal, 4).ToString("000.0000", pp.Setting.Culture)}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId); - meterctl.Meter.calibrationResult.AddAdditionalLog($"Amp. Test Mean value PATH {Path + 1}", $"at {FirstHitLevelPercentage}={Math.Round(meanVal, 4).ToString("000.0000", pp.Setting.Culture)}"); - var cTofAvgMeanTotal = TofAvgMeanTotal.Get(Path).ToList(); + meterctl.Meter.calibrationResult.AddAdditionalLog($"Amp. Test Mean value PATH {1 + 1}", $"at {FirstHitLevelPercentage}={Math.Round(meanVal, 4).ToString("000.0000", pp.Setting.Culture)}"); + var cTofAvgMeanTotal = TofAvgMeanTotal.Get(1).ToList(); cTofAvgMeanTotal.Add(meanVal); - TofAvgMeanTotal.Update(Path, cTofAvgMeanTotal); + TofAvgMeanTotal.Update(1, cTofAvgMeanTotal); //meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Update(Path,new List()); } + else + { + + + for (UInt16 Path = 0; Path < meterctl.Meter.listOfTotalTimeOfFlightSPerPath.GetPathCount(); Path++) + { + var meanVal = meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Get(Path).ToList().Mean(); + pp.DebugMessage($"Calculate mean value {meanVal} at {meterctl.Meter.Slot}; PATH{(Path + 1).ToString(pp.Setting.Culture)}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId); + //earlier TofAvgMeanTotal + //TofAvgMean.Update(Path, meanVal); + + if (meanVal == 0) + { + pp.DebugMessage($"Mean value is zero at {meterctl.Meter.Slot}; PATH{(Path + 1).ToString(pp.Setting.Culture)}; Value = {Math.Round(meanVal, 4).ToString("000.0000", pp.Setting.Culture)}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId); + meterctl.Meter.calibrationResult.AddAdditionalLog($"" + + $"PATH {Path + 1}", Math.Round(meanVal, 4).ToString("000.0000", pp.Setting.Culture)); + + if (CheckAbort(false, meterctl)) { return false; } + } + + pp.DebugMessage($"Mean value at {meterctl.Meter.Slot}; PATH{(Path + 1).ToString(pp.Setting.Culture)}; Value = {Math.Round(meanVal, 4).ToString("000.0000", pp.Setting.Culture)}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId); + + meterctl.Meter.calibrationResult.AddAdditionalLog($"Amp. Test Mean value PATH {Path + 1}", $"at {FirstHitLevelPercentage}={Math.Round(meanVal, 4).ToString("000.0000", pp.Setting.Culture)}"); + var cTofAvgMeanTotal = TofAvgMeanTotal.Get(Path).ToList(); + + cTofAvgMeanTotal.Add(meanVal); + TofAvgMeanTotal.Update(Path, cTofAvgMeanTotal); + //meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Update(Path,new List()); + } + } #endregion } #endregion @@ -213,8 +252,8 @@ namespace CordonelPreadjustmentUi.Processes.Actions var tmpOptimalPoint = 0; var tmpDistanceLeft = 0.0; var tmpDistanceRight = 0.0; - - var r = CalculateOptimalPoint(pp, meterctl.Meter.Slot, TofAvgMeanTotal.Get(Path).ToList(),out tmpDistanceLeft, out tmpDistanceRight, out tmpOptimalPoint); + + var r = CalculateOptimalPoint(pp, meterctl.Meter.Slot, TofAvgMeanTotal.Get(Path).ToList(), out tmpDistanceLeft, out tmpDistanceRight, out tmpOptimalPoint); OptimalPoint.Update(Path, tmpOptimalPoint); DistanceLeft.Update(Path, tmpDistanceLeft); DistanceRight.Update(Path, tmpDistanceRight); @@ -241,8 +280,10 @@ namespace CordonelPreadjustmentUi.Processes.Actions Boolean OptimalPointOK = true; for (UInt16 Path = 0; Path < OptimalPoint.GetPathCount(); Path++) { - if (!this.CheckOptimalPoint(pp,OptimalPoint.Get(Path), out DebugMessage, meterctl.Meter.Slot)) + if (!this.CheckOptimalPoint(pp, OptimalPoint.Get(Path), out DebugMessage, meterctl.Meter.Slot)) + { OptimalPointOK = false; + } pp.DebugMessage($"{DebugMessage}, PATH{Path + 1}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId); } @@ -253,8 +294,10 @@ namespace CordonelPreadjustmentUi.Processes.Actions Boolean CheckDistOK = true; for (UInt16 Path = 0; Path < DistanceLeft.GetPathCount(); Path++) { - if (!this.CheckDistance(pp,DistanceLeft.Get(Path), DistanceRight.Get(Path), out DebugMessage, meterctl.Meter.Slot )) + if (!this.CheckDistance(pp, DistanceLeft.Get(Path), DistanceRight.Get(Path), out DebugMessage, meterctl.Meter.Slot)) + { CheckDistOK = false; + } pp.DebugMessage($"{DebugMessage}, PATH{Path + 1}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId); } @@ -367,7 +410,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions return Ok; } - private Boolean CalculateOptimalPoint(ProcessProgress pp,int Slot, List TofAvg, out Double left, out Double right, out Int32 xAtOptimalPoint) + private Boolean CalculateOptimalPoint(ProcessProgress pp, int Slot, List TofAvg, out Double left, out Double right, out Int32 xAtOptimalPoint) { List ValuesLeft = new List(); @@ -378,8 +421,8 @@ namespace CordonelPreadjustmentUi.Processes.Actions left = 0; right = 0; - ValuesLeft = this.CalculateNearestDistanceLeft(pp,TofAvg, out left); - ValuesRight = this.CalculateNearestDistanceRight(pp,TofAvg, out right); + ValuesLeft = this.CalculateNearestDistanceLeft(pp, TofAvg, out left); + ValuesRight = this.CalculateNearestDistanceRight(pp, TofAvg, out right); for (UInt16 i = 0; i < ValuesLeft.Count(); i++) { @@ -408,7 +451,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions { Maximum = MinDistance.ElementAt(i); xAtOptimalPoint = (Int32)i + pp.Setting.AmpTestPercentageStart; - ; + ; SubError = false; } } @@ -423,7 +466,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions Boolean Detected = false; left = 0; - for (Int32 Percentage = pp.Setting.AmpTestFirstHitLevelPropMin; Percentage <= pp.Setting.AmpTestFirstHitLevelPropMax ; Percentage++) + for (Int32 Percentage = pp.Setting.AmpTestFirstHitLevelPropMin; Percentage <= pp.Setting.AmpTestFirstHitLevelPropMax; Percentage++) { Detected = false; for (Int32 PercentageFollowing = Percentage; PercentageFollowing <= pp.Setting.AmpTestFirstHitLevelPropMax; PercentageFollowing++) @@ -436,7 +479,9 @@ namespace CordonelPreadjustmentUi.Processes.Actions } } if (!Detected) + { NearestDistance = pp.Setting.AmpTestFirstHitLevelPropMax - Percentage; + } Distance.Add(NearestDistance); } @@ -472,7 +517,9 @@ namespace CordonelPreadjustmentUi.Processes.Actions } if (!Detected) + { NearestDistance = Percentage - pp.Setting.AmpTestFirstHitLevelPropMin; + } Distance.Add(NearestDistance); } @@ -510,7 +557,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions return Ok; } - private Boolean CheckDistance(ProcessProgress pp,Double left, Double right, out String debugMessage, int Slot) + private Boolean CheckDistance(ProcessProgress pp, Double left, Double right, out String debugMessage, int Slot) { Boolean Ok = true; debugMessage = $"Distance check successful at {Slot}"; diff --git a/Common/Hardware/Interfaces/Protocols/ProtocolCore/BaseProtocol.cs b/Common/Hardware/Interfaces/Protocols/ProtocolCore/BaseProtocol.cs index cd31a11b..25f1ba1b 100644 --- a/Common/Hardware/Interfaces/Protocols/ProtocolCore/BaseProtocol.cs +++ b/Common/Hardware/Interfaces/Protocols/ProtocolCore/BaseProtocol.cs @@ -41,7 +41,7 @@ namespace Xylem.Common.Hardware.Interfaces.Protocols.ProtocolCore /// protected BaseProtocol(String ident) { - Ident = ident; + Ident = ident; //assign thread to loop _decodingThread = new Thread(DecodingThreadLoop) { Name = $"{Ident} Decoding thread" }; //start DecodingThread diff --git a/Common/Hardware/WaterMeter/WaterMeterCore/WaterMeterRegisters/obj/Debug/WaterMeterRegisters.csproj.CoreCompileInputs.cache b/Common/Hardware/WaterMeter/WaterMeterCore/WaterMeterRegisters/obj/Debug/WaterMeterRegisters.csproj.CoreCompileInputs.cache index 82bc2c16..d110f5fc 100644 --- a/Common/Hardware/WaterMeter/WaterMeterCore/WaterMeterRegisters/obj/Debug/WaterMeterRegisters.csproj.CoreCompileInputs.cache +++ b/Common/Hardware/WaterMeter/WaterMeterCore/WaterMeterRegisters/obj/Debug/WaterMeterRegisters.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -bf6bb8fceb3db5a9977dadc407cf576684bf7127 +c43c40a030005a8f189e6179faf40a6d42bfef5c diff --git a/Common/Hardware/WaterMeter/eRegister/DataPackages/DataPackages.csproj b/Common/Hardware/WaterMeter/eRegister/DataPackages/DataPackages.csproj index ffbb89a4..c9240fab 100644 --- a/Common/Hardware/WaterMeter/eRegister/DataPackages/DataPackages.csproj +++ b/Common/Hardware/WaterMeter/eRegister/DataPackages/DataPackages.csproj @@ -9,7 +9,7 @@ Properties Xylem.Common.Hardware.WaterMeter.ERegister.DataPackages Xylem.Common.Hardware.WaterMeter.ERegister.DataPackages - v4.8 + v4.0 512 true @@ -37,7 +37,14 @@ ..\..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll + + ..\..\..\..\packages\NLog.5.2.8\lib\net35\NLog.dll + + + ..\..\..\..\packages\RestSharp.105.0.0\lib\net4\RestSharp.dll + + diff --git a/Common/Hardware/WaterMeter/eRegister/DataPackages/packages.config b/Common/Hardware/WaterMeter/eRegister/DataPackages/packages.config index 121d3593..1e2a717b 100644 --- a/Common/Hardware/WaterMeter/eRegister/DataPackages/packages.config +++ b/Common/Hardware/WaterMeter/eRegister/DataPackages/packages.config @@ -1,4 +1,6 @@  - + + + \ No newline at end of file diff --git a/Common/Hardware/WaterMeter/eRegister/Protocols/StreamingProtocol.csproj b/Common/Hardware/WaterMeter/eRegister/Protocols/StreamingProtocol.csproj index fa3e8685..80f25942 100644 --- a/Common/Hardware/WaterMeter/eRegister/Protocols/StreamingProtocol.csproj +++ b/Common/Hardware/WaterMeter/eRegister/Protocols/StreamingProtocol.csproj @@ -7,11 +7,12 @@ {B6A19B80-0F0F-434C-A754-A7712FC208B2} Library Properties - Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.StreamingProtocol - Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.StreamingProtocol - v4.8 + Xylem.Common.Hardware.WaterMeter.eRegister.Protocols.StreamingProtocol + Xylem.Common.Hardware.WaterMeter.eRegister.Protocols.StreamingProtocol + v4.0 512 true + true @@ -32,10 +33,13 @@ - ..\..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll + ..\..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll - ..\..\..\..\..\packages\NLog.5.2.2\lib\net46\NLog.dll + ..\..\..\..\packages\NLog.5.2.8\lib\net35\NLog.dll + + + ..\..\..\..\packages\RestSharp.105.0.0\lib\net4\RestSharp.dll diff --git a/Common/Hardware/WaterMeter/eRegister/Protocols/packages.config b/Common/Hardware/WaterMeter/eRegister/Protocols/packages.config index e07979d0..1e2a717b 100644 --- a/Common/Hardware/WaterMeter/eRegister/Protocols/packages.config +++ b/Common/Hardware/WaterMeter/eRegister/Protocols/packages.config @@ -1,5 +1,6 @@  - - + + + \ No newline at end of file diff --git a/Common/Hardware/WaterMeter/eRegister/eRegisterCore/eRegisterCore.csproj b/Common/Hardware/WaterMeter/eRegister/eRegisterCore/eRegisterCore.csproj index 61c99b6e..cad6f32c 100644 --- a/Common/Hardware/WaterMeter/eRegister/eRegisterCore/eRegisterCore.csproj +++ b/Common/Hardware/WaterMeter/eRegister/eRegisterCore/eRegisterCore.csproj @@ -9,7 +9,7 @@ Properties Xylem.Common.Hardware.WaterMeter.eRegister.eRegisterCore Xylem.Common.Hardware.WaterMeter.eRegister.eRegisterCore - v4.8 + v4.0 512 true @@ -38,7 +38,10 @@ ..\..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll - ..\..\..\..\packages\NLog.5.2.2\lib\net35\NLog.dll + ..\..\..\..\packages\NLog.5.2.8\lib\net35\NLog.dll + + + ..\..\..\..\packages\RestSharp.105.0.0\lib\net4\RestSharp.dll diff --git a/Common/Hardware/WaterMeter/eRegister/eRegisterCore/packages.config b/Common/Hardware/WaterMeter/eRegister/eRegisterCore/packages.config index e48cba92..1e2a717b 100644 --- a/Common/Hardware/WaterMeter/eRegister/eRegisterCore/packages.config +++ b/Common/Hardware/WaterMeter/eRegister/eRegisterCore/packages.config @@ -1,5 +1,6 @@  - - + + + \ No newline at end of file diff --git a/Common/Service/MeterProcessState/Controllers/PasswordController.cs b/Common/Service/MeterProcessState/Controllers/PasswordController.cs index 321309b7..b18997a0 100644 --- a/Common/Service/MeterProcessState/Controllers/PasswordController.cs +++ b/Common/Service/MeterProcessState/Controllers/PasswordController.cs @@ -155,7 +155,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers var pwString = o["JsonObject"][searchKey].ToString(); //FE081F0 E5250E5D084FA024 00 04 80 00 70 03 48 9E //0x 0413F059069BEB24 - + //FE081F0 D1 B1 FF 63 07 75 74 24 00 04 80 00 70 03 48 9E //pwString = "FE081F0 F2 30 F0 59 03 66 10 24 00 04 80 00 70 03 48 9A"; //pwString = "FE081F0 16 31 F0 59 06 9B EB 24 00 04 80 00 70 03 48 9A"; //pwString = "FE081F0 B3 F3 0D 5C 05 C3 9B 24 00 04 80 00 70 03 48 9E"; @@ -163,6 +163,9 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers //E79E9F08AFBE var pId = Convert.ToUInt64(pwString.Replace(" ", "").Substring(7, 16), 16); + //FE081F0 D1 B1 FF 63 07 75 74 24 00 04 80 00 70 03 48 9E + //FE081F0 36 BB FF 63 08 19 F3 24 00 04 80 00 70 03 48 9E -> "3DFB7AF7D8C9" + //FE081F0 D1 B1 FF 63 07 75 74 24 00 04 80 00 70 03 48 9E -> 517316F8D22E var s = BuildSkeletonKey(pId); var r = ""; diff --git a/Common/TempFlansh/Program.cs b/Common/TempFlansh/Program.cs index 623bee88..fc4b1649 100644 --- a/Common/TempFlansh/Program.cs +++ b/Common/TempFlansh/Program.cs @@ -68,6 +68,7 @@ namespace TempFlansh //Application.EnableVisualStyles(); //Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new Form1()); + } } } diff --git a/Common/Tools/Tools.JsonToXlsHelper/obj/Debug/Tools.JsonToXlsHelper.csproj.CoreCompileInputs.cache b/Common/Tools/Tools.JsonToXlsHelper/obj/Debug/Tools.JsonToXlsHelper.csproj.CoreCompileInputs.cache index 8dda2975..84b6b3be 100644 --- a/Common/Tools/Tools.JsonToXlsHelper/obj/Debug/Tools.JsonToXlsHelper.csproj.CoreCompileInputs.cache +++ b/Common/Tools/Tools.JsonToXlsHelper/obj/Debug/Tools.JsonToXlsHelper.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -247396738e2c5d26ac00f9df05c0cc5c61d7f33a +65d75c3322f8a137c69963cfdc0cb6f1ffacf62a diff --git a/Common/Ui/GenesisToolBox/FrmTempMeter.Designer.cs b/Common/Ui/GenesisToolBox/FrmTempMeter.Designer.cs index 9334ab16..f28597bd 100644 --- a/Common/Ui/GenesisToolBox/FrmTempMeter.Designer.cs +++ b/Common/Ui/GenesisToolBox/FrmTempMeter.Designer.cs @@ -70,6 +70,7 @@ namespace Xylem.Common.Ui.GenesisToolBox this.tabPage4 = new System.Windows.Forms.TabPage(); this.timer3 = new System.Windows.Forms.Timer(this.components); this.mainMenuStrip = new System.Windows.Forms.MenuStrip(); + this.txtComport = new System.Windows.Forms.TextBox(); this.automaticCalibrationTabControl.SuspendLayout(); this.tabPage1.SuspendLayout(); this.tabPage2.SuspendLayout(); @@ -81,7 +82,7 @@ namespace Xylem.Common.Ui.GenesisToolBox // // timer1 // - this.timer1.Interval = 5000; + this.timer1.Interval = 60000; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // // timer2 @@ -138,6 +139,7 @@ namespace Xylem.Common.Ui.GenesisToolBox // // tabPage2 // + this.tabPage2.Controls.Add(this.txtComport); this.tabPage2.Controls.Add(this.lblCheck); this.tabPage2.Controls.Add(this.label9); this.tabPage2.Controls.Add(this.btnCheck); @@ -522,6 +524,19 @@ namespace Xylem.Common.Ui.GenesisToolBox this.mainMenuStrip.TabIndex = 57; this.mainMenuStrip.Text = "menuStrip1"; // + // txtComport + // + this.txtComport.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtComport.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.txtComport.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.txtComport.Location = new System.Drawing.Point(77, 24); + this.txtComport.Margin = new System.Windows.Forms.Padding(0); + this.txtComport.MinimumSize = new System.Drawing.Size(2, 25); + this.txtComport.Name = "txtComport"; + this.txtComport.Size = new System.Drawing.Size(318, 25); + this.txtComport.TabIndex = 55; + // // FrmTempMeter // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -588,5 +603,6 @@ namespace Xylem.Common.Ui.GenesisToolBox private System.Windows.Forms.Label label3; private System.Windows.Forms.Button saveSettingsBtn; private System.Windows.Forms.TabPage tabPage4; + private System.Windows.Forms.TextBox txtComport; } } \ No newline at end of file diff --git a/Common/Ui/GenesisToolBox/FrmTempMeter.cs b/Common/Ui/GenesisToolBox/FrmTempMeter.cs index 3e425c03..019515b3 100644 --- a/Common/Ui/GenesisToolBox/FrmTempMeter.cs +++ b/Common/Ui/GenesisToolBox/FrmTempMeter.cs @@ -15,7 +15,7 @@ using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; - + using TempFlansh; using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages; using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages.MeasurementRecords; using Xylem.Common.Hardware.WaterMeter.Genesis.Registers; @@ -165,34 +165,34 @@ private String GetLutsText(String PcbId) { var ret = new StringBuilder(); - //var resp = LocalWebRequest.GetRequest($"http://10.49.40.25/MeterProcessState/api/TempFlange/GetLut?PcbId={PcbId}"); + var resp = LocalWebRequest.GetRequest($"http://10.49.40.25/MeterProcessState/api/TempFlange/GetLut?PcbId={PcbId}"); - //ret.AppendLine($"Ref Temp C°\t|\t AvgTof"); + ret.AppendLine($"Ref Temp C°\t|\t AvgTof"); - //var CurrentReqRequierd = new List(); - //CurrentReqRequierd.AddRange(reftempRangeReq); - //try - //{ - // cordonelTempLut = JsonConvert.DeserializeObject>(resp); + var CurrentReqRequierd = new List(); + CurrentReqRequierd.AddRange(reftempRangeReq); + try + { + cordonelTempLut = JsonConvert.DeserializeObject>(resp); - // foreach (var item in cordonelTempLut.OrderBy(a => a.RefTempC)) - // { - // CurrentReqRequierd.RemoveAll(rem => item.RefTempC >= rem.Min && item.RefTempC <= rem.Max); - // ret.AppendLine($"{item.RefTempC.ToString("n8")}\t|\t{item.AvgTof}"); - // } - //} - //catch (Exception) - //{ + foreach (var item in cordonelTempLut.OrderBy(a => a.RefTempC)) + { + CurrentReqRequierd.RemoveAll(rem => item.RefTempC >= rem.Min && item.RefTempC <= rem.Max); + ret.AppendLine($"{item.RefTempC.ToString("n8")}\t|\t{item.AvgTof}"); + } + } + catch (Exception) + { - // ret.AppendLine($"No entrys"); - //} + ret.AppendLine($"No entrys"); + } - //lutIsMissing = false; - //foreach (var item in CurrentReqRequierd) - //{ - // lutIsMissing = true; - // ret.AppendLine($"{item.Min}-{item.Max}\t|\t Missing"); - //} + lutIsMissing = false; + foreach (var item in CurrentReqRequierd) + { + lutIsMissing = true; + ret.AppendLine($"{item.Min}-{item.Max}\t|\t Missing"); + } return ret.ToString(); } @@ -226,11 +226,23 @@ SetEnabled(ProgrammState.Connected); } - + TempHelper helper; private void btnCheck_Click(Object sender, EventArgs e) { if (btnCheck.Text == "Start Check") { + short port = 0; + if (short.TryParse(txtComport.Text, out port)) + { + helper = new TempHelper(); + TempHelper.UniversalOpenCom((port), 4800, 8, 0, 0); + + + } + + + + currentGenesis.StartRecordData(); timer1.Enabled = true; @@ -315,7 +327,12 @@ // do nothing } - lblCheck.Text = checkTempMeter.ToString(); + var refTemp = helper.ReadCurrentDisplayValue().ToString(); + + File.AppendAllLines("Check.txt", new List { $"{currentGenesis.PcbId },{checkTempMeter.ToString()},{refTemp.ToString()} " }); + lblCheck.Text = "DUT:" + checkTempMeter.ToString() + "vs Ref:" + refTemp.ToString(); + + // } else @@ -461,7 +478,7 @@ if (i > 0) { - + avgTof = avgTof / i; if (!double.IsNaN(avgTof)) { @@ -494,7 +511,7 @@ { jsonData = $",{jsonData}"; } - + File.AppendAllText(fiName, jsonData); } @@ -507,7 +524,7 @@ MergeToAutoFile(); } - private Double generateTof(Random r , Double temp) + private Double generateTof(Random r, Double temp) { var tmp = r.Next(1, 5); var retrn = temp / 9000 - Math.Pow(temp, 1.6) / 100_000; @@ -529,7 +546,7 @@ //plateau while (needUp >= 0) { - + var temp = rramp.NextDouble() / (needUp * 100); // +0 needUp = needUp - temp; refTemp = refTemp + temp; @@ -542,7 +559,7 @@ for (Int32 platI = 0; platI < tillI; platI++) { - + var temp = r.NextDouble() / 5; refTempss.Add(new TempTofCalc() { RefDate = sDate.AddSeconds(refTempss.Count), RefTemp = refTemp + temp, Tof = generateTof(rtof, refTemp) }); } @@ -640,7 +657,7 @@ this.mainMenuStrip.Items.Add(this.disconnectBtn); this.mainMenuStrip.Items.Add(this.testBtn); - this.automaticCalibrationTabControl.GotFocus += (Object sender, EventArgs e) => + this.automaticCalibrationTabControl.GotFocus += (Object sender, EventArgs e) => { this.GMHPort.Text = Appsettings.GMHPort.ToString(); this.messurementStepMS.Text = Appsettings.MessurementStep.ToString(); @@ -754,7 +771,7 @@ private void StopAutomaticBtn_Clicked(object sender, EventArgs args) { this.automatic = false; - + this.automaticCalibration.StopMessuring(); this.MergeToAutoFile(); @@ -765,7 +782,7 @@ this.stopAutomaticBtn.Enabled = false; } - const int TAKE_LINES = 50; + private const int TAKE_LINES = 50; public void AddMessage(string message) { @@ -819,7 +836,7 @@ } } - public void StartRecording() + public void StartRecording() => this.currentGenesis ?.StartRecordData(); @@ -838,7 +855,7 @@ .Average(x => x.TotalTimeOfFlightS); } - protected override void OnFormClosed(FormClosedEventArgs e) + protected override void OnFormClosed(FormClosedEventArgs e) => this.BtnDisconnect_Click(default(object), EventArgs.Empty); private void SaveSettingsBtn_Click(Object sender, EventArgs e) diff --git a/Common/Ui/GenesisToolBox/FrmTempMeter.resx b/Common/Ui/GenesisToolBox/FrmTempMeter.resx index 5eae84c8..8da282f5 100644 --- a/Common/Ui/GenesisToolBox/FrmTempMeter.resx +++ b/Common/Ui/GenesisToolBox/FrmTempMeter.resx @@ -129,4 +129,7 @@ 278, 17 + + 120 + \ No newline at end of file diff --git a/Common/Ui/GenesisToolBox/GenesisToolBox.csproj b/Common/Ui/GenesisToolBox/GenesisToolBox.csproj index 664552da..df6aeb88 100644 --- a/Common/Ui/GenesisToolBox/GenesisToolBox.csproj +++ b/Common/Ui/GenesisToolBox/GenesisToolBox.csproj @@ -171,7 +171,9 @@ ..\..\packages\QRCoder.1.4.3\lib\net40\QRCoder.dll - + + ..\..\packages\RestSharp.105.0.0\lib\net4\RestSharp.dll + diff --git a/Common/Ui/GenesisToolBox/frmLeagcyTestApp.cs b/Common/Ui/GenesisToolBox/frmLeagcyTestApp.cs index daa4b9f4..48bfb8fe 100644 --- a/Common/Ui/GenesisToolBox/frmLeagcyTestApp.cs +++ b/Common/Ui/GenesisToolBox/frmLeagcyTestApp.cs @@ -428,7 +428,7 @@ namespace GenesisToolBox container.meterTestSettings[i].FlowTesting = true; container.meterTestSettings[i].PreAdjustment = false; container.meterTestSettings[i].SerialNr = $"450000{slotNr}"; - container.meterTestSettings[i].meterType = MeterTypes.eRegister; + container.meterTestSettings[i].meterType = MeterTypes.MagFlux; } i++; diff --git a/Common/Ui/GenesisToolBox/packages.config b/Common/Ui/GenesisToolBox/packages.config index 2521e3a4..f0696bde 100644 --- a/Common/Ui/GenesisToolBox/packages.config +++ b/Common/Ui/GenesisToolBox/packages.config @@ -3,6 +3,7 @@ + \ No newline at end of file diff --git a/Common/Ui/LegacyGenesisControl/ICRdy.cs b/Common/Ui/LegacyGenesisControl/ICRdy.cs index b4e9d90f..3645af84 100644 --- a/Common/Ui/LegacyGenesisControl/ICRdy.cs +++ b/Common/Ui/LegacyGenesisControl/ICRdy.cs @@ -44,6 +44,7 @@ namespace XylemCommonUiLegacyGenCtl void Init(int v); void Start(); + void LedOff(); bool GetAllInfos(out string oPcbId, out string oSerialNumber, out bool oHasPreajustment, out bool oHasWarnings, out string oLUT); diff --git a/Common/Ui/LegacyGenesisControl/ctlCRdy.Designer.cs b/Common/Ui/LegacyGenesisControl/ctlCRdy.Designer.cs index 6f890890..28d4245d 100644 --- a/Common/Ui/LegacyGenesisControl/ctlCRdy.Designer.cs +++ b/Common/Ui/LegacyGenesisControl/ctlCRdy.Designer.cs @@ -67,6 +67,7 @@ this.lblLed.Size = new System.Drawing.Size(46, 22); this.lblLed.TabIndex = 7; this.lblLed.Text = "LED"; + this.lblLed.Click += new System.EventHandler(this.lblLed_Click); // // lblDataOverall // diff --git a/Common/Ui/LegacyGenesisControl/ctlCRdy.cs b/Common/Ui/LegacyGenesisControl/ctlCRdy.cs index 6bd67257..81fa194f 100644 --- a/Common/Ui/LegacyGenesisControl/ctlCRdy.cs +++ b/Common/Ui/LegacyGenesisControl/ctlCRdy.cs @@ -376,11 +376,112 @@ namespace XylemCommonUiLegacyGenCtl private CancellationTokenSource CancellationTokenSource = new CancellationTokenSource(); + + + public void LedOff() + { + + this.BackColor = Color.LightYellow; + var t = new Task(() => + { + + using (var overallMeterBatch = new MeterBatch("Start ctlRdy")) + { + using (var meter = new GenesisMeter()) + { + var ctlCancellationToken = CancellationTokenSource.Token; + try + { + + var settingsToUse = new DefaultSettings(); + + + meter.SetupFromConfigFile(meterSlot, false, true, true); + + overallMeterBatch.AddMeter(meter); + changeCurrentSlotState(TaskState.SetPcbId); + } + catch (Exception) + { + changeCurrentSlotState(TaskState.Fatal); + } + isBusy = true; + changeCurrentSlotState(TaskState.SetPcbId); + setMeterInfo("-", null, null); + if (ctlCancellationToken.IsCancellationRequested) + { + return; + } + try + { + + if (currentState != TaskState.Fatal) + { + FlowState = MeterReadyResults.NotStarted; + Path1State = MeterReadyResults.NotStarted; + Path2State = MeterReadyResults.NotStarted; + Path3State = MeterReadyResults.NotStarted; + + if (string.IsNullOrEmpty(meter.PcbId)) + { + PcbId = meter.GetPcbId(); + } + else + { + PcbId = meter.PcbId; + } + if (ctlCancellationToken.IsCancellationRequested) + { + return; + } + + changeCurrentSlotState(TaskState.LoginInProgress); + if (ctlCancellationToken.IsCancellationRequested) + { + return; + } + if (!string.IsNullOrEmpty(meter.PcbId) && meter.Login()) + { + changeCurrentSlotState(TaskState.LoginDone); + + meter.WriteRegister("GENESISFLOW_LedMode", 0, true, true); + meter.WriteRegister("GENESISFLOW_SampleRate", 2, true, true); + + } + else + { + changeCurrentSlotState(TaskState.LoginFailed); + DetectIsDone = true; + } + } + } + catch (Exception ex) + { + PcbId = ""; + DetectIsDone = true; + + } + finally + { + isBusy = false; + + meter?.Dispose(); + + } + } + } + }); + t.Start(); + } + + public void Start() { Start(false); } + + public void Start(bool forceDisplayClear) { @@ -749,5 +850,10 @@ namespace XylemCommonUiLegacyGenCtl { } + + private void lblLed_Click(Object sender, EventArgs e) + { + LedOff(); + } } }