LEd aus an der Prüfstation

This commit is contained in:
Roland Drabesch
2024-01-16 10:59:03 +01:00
parent ff2034273b
commit 312f5de1bc
23 changed files with 315 additions and 98 deletions
+1 -1
View File
@@ -155,7 +155,7 @@
</site> </site>
<site name="MeterProcessState" id="2"> <site name="MeterProcessState" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool"> <application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="D:\Projekte\SENSUS_GitLab\laa_production\Common\Service\MeterProcessState" /> <virtualDirectory path="/" physicalPath="C:\Users\drabesch_ro\Repo\lab\la_operations\laa_production\Common\Service\MeterProcessState" />
</application> </application>
<bindings> <bindings>
<binding protocol="http" bindingInformation="*:56011:localhost" /> <binding protocol="http" bindingInformation="*:56011:localhost" />
@@ -109,6 +109,7 @@
<PropertyGroup /> <PropertyGroup />
<PropertyGroup /> <PropertyGroup />
<PropertyGroup /> <PropertyGroup />
<PropertyGroup />
<ItemGroup> <ItemGroup>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
@@ -1,16 +1,14 @@
using System; using CordonelPreadjustmentUi.Const;
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.Helper; using CordonelPreadjustmentUi.Helper;
using CordonelPreadjustmentUi.Const;
using CordonelPreadjustmentUi.Helper.Extensions; 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 Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using static CordonelPreadjustmentUi.PreAdjustmentControl;
namespace CordonelPreadjustmentUi.Processes.Actions namespace CordonelPreadjustmentUi.Processes.Actions
{ {
@@ -35,8 +33,8 @@ namespace CordonelPreadjustmentUi.Processes.Actions
{ {
listOfProcessTask.Add(new Task<bool>(() => listOfProcessTask.Add(new Task<bool>(() =>
{ {
pp.DebugMessage($"Performing {ProcessName} procedure", null , "CC"); pp.DebugMessage($"Performing {ProcessName} procedure", null, "CC");
#region Definitions and initializations #region Definitions and initializations
const Int32 FirstHitShiftValue = 4; const Int32 FirstHitShiftValue = 4;
@@ -49,7 +47,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
var TofAvgMean = new MultiPathDataLogContainer<Double>(pp.Setting.NumberOfPaths); var TofAvgMean = new MultiPathDataLogContainer<Double>(pp.Setting.NumberOfPaths);
var OptimalPoint = new MultiPathDataLogContainer<Int32>(pp.Setting.NumberOfPaths); var OptimalPoint = new MultiPathDataLogContainer<Int32>(pp.Setting.NumberOfPaths);
var TofAvgMeanTotal = new MultiPathDataLogContainer<List<Double>>(pp.Setting.NumberOfPaths); var TofAvgMeanTotal = new MultiPathDataLogContainer<List<Double>>(pp.Setting.NumberOfPaths);
TofAvgMeanTotal.Update(null,new List<Double>()); TofAvgMeanTotal.Update(null, new List<Double>());
Boolean Ok = false; Boolean Ok = false;
#endregion #endregion
@@ -61,10 +59,10 @@ namespace CordonelPreadjustmentUi.Processes.Actions
meterctl.Meter.DataLog(Header); meterctl.Meter.DataLog(Header);
//GenesisZeroFlow._GenesisZeroFlow.SetLoggingPathAmplitudeTest(this.MeterNumber, $"{DataLogging.DefaultPath}AmplitudeTest_RawData_{TempPcbID}_{time}.txt"); //GenesisZeroFlow._GenesisZeroFlow.SetLoggingPathAmplitudeTest(this.MeterNumber, $"{DataLogging.DefaultPath}AmplitudeTest_RawData_{TempPcbID}_{time}.txt");
meterctl.Meter.logAmpTest = true; 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 #endregion
Ok = false; Ok = false;
@@ -128,54 +126,95 @@ namespace CordonelPreadjustmentUi.Processes.Actions
Ok = RecordData(pp, meterctl, Ok, FirstHitLevelPercentage); Ok = RecordData(pp, meterctl, Ok, FirstHitLevelPercentage);
bool retryRecord = false; bool retryRecord = false;
if (true)
for (UInt16 Path = 0; Path < meterctl.Meter.listOfTotalTimeOfFlightSPerPath.GetPathCount(); Path++)
{ {
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; 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) if (retryRecord)
{ {
Ok = RecordData(pp, meterctl, Ok, FirstHitLevelPercentage); 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"; pp.StatusLabel = $"{PredefinedMessages.WaitUntilPercentageSweepFinished(pp.Setting.Culture)} {FirstHitLevelPercentage.ToString(pp.Setting.Culture)}/{ pp.Setting.AmpTestPercentageStop.ToString(pp.Setting.Culture)}; 0s";
Ok = true; Ok = true;
#endregion #endregion
#region Calculate mean value #region Calculate mean value
if (true)
for (UInt16 Path = 0; Path < meterctl.Meter.listOfTotalTimeOfFlightSPerPath.GetPathCount(); Path++)
{ {
var meanVal = meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Get(Path).ToList().Mean(); var meanVal = meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Get(1).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); 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 //earlier TofAvgMeanTotal
//TofAvgMean.Update(Path, meanVal); //TofAvgMean.Update(Path, meanVal);
if (meanVal == 0) 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($"" + 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; } 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)}"); 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(Path).ToList(); var cTofAvgMeanTotal = TofAvgMeanTotal.Get(1).ToList();
cTofAvgMeanTotal.Add(meanVal); cTofAvgMeanTotal.Add(meanVal);
TofAvgMeanTotal.Update(Path, cTofAvgMeanTotal); TofAvgMeanTotal.Update(1, cTofAvgMeanTotal);
//meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Update(Path,new List<Double>()); //meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Update(Path,new List<Double>());
} }
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<Double>());
}
}
#endregion #endregion
} }
#endregion #endregion
@@ -213,8 +252,8 @@ namespace CordonelPreadjustmentUi.Processes.Actions
var tmpOptimalPoint = 0; var tmpOptimalPoint = 0;
var tmpDistanceLeft = 0.0; var tmpDistanceLeft = 0.0;
var tmpDistanceRight = 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); OptimalPoint.Update(Path, tmpOptimalPoint);
DistanceLeft.Update(Path, tmpDistanceLeft); DistanceLeft.Update(Path, tmpDistanceLeft);
DistanceRight.Update(Path, tmpDistanceRight); DistanceRight.Update(Path, tmpDistanceRight);
@@ -241,8 +280,10 @@ namespace CordonelPreadjustmentUi.Processes.Actions
Boolean OptimalPointOK = true; Boolean OptimalPointOK = true;
for (UInt16 Path = 0; Path < OptimalPoint.GetPathCount(); Path++) 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; OptimalPointOK = false;
}
pp.DebugMessage($"{DebugMessage}, PATH{Path + 1}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId); pp.DebugMessage($"{DebugMessage}, PATH{Path + 1}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId);
} }
@@ -253,8 +294,10 @@ namespace CordonelPreadjustmentUi.Processes.Actions
Boolean CheckDistOK = true; Boolean CheckDistOK = true;
for (UInt16 Path = 0; Path < DistanceLeft.GetPathCount(); Path++) 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; CheckDistOK = false;
}
pp.DebugMessage($"{DebugMessage}, PATH{Path + 1}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId); pp.DebugMessage($"{DebugMessage}, PATH{Path + 1}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId);
} }
@@ -367,7 +410,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
return Ok; return Ok;
} }
private Boolean CalculateOptimalPoint(ProcessProgress pp,int Slot, List<Double> TofAvg, out Double left, out Double right, out Int32 xAtOptimalPoint) private Boolean CalculateOptimalPoint(ProcessProgress pp, int Slot, List<Double> TofAvg, out Double left, out Double right, out Int32 xAtOptimalPoint)
{ {
List<Double> ValuesLeft = new List<Double>(); List<Double> ValuesLeft = new List<Double>();
@@ -378,8 +421,8 @@ namespace CordonelPreadjustmentUi.Processes.Actions
left = 0; left = 0;
right = 0; right = 0;
ValuesLeft = this.CalculateNearestDistanceLeft(pp,TofAvg, out left); ValuesLeft = this.CalculateNearestDistanceLeft(pp, TofAvg, out left);
ValuesRight = this.CalculateNearestDistanceRight(pp,TofAvg, out right); ValuesRight = this.CalculateNearestDistanceRight(pp, TofAvg, out right);
for (UInt16 i = 0; i < ValuesLeft.Count(); i++) for (UInt16 i = 0; i < ValuesLeft.Count(); i++)
{ {
@@ -408,7 +451,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
{ {
Maximum = MinDistance.ElementAt(i); Maximum = MinDistance.ElementAt(i);
xAtOptimalPoint = (Int32)i + pp.Setting.AmpTestPercentageStart; xAtOptimalPoint = (Int32)i + pp.Setting.AmpTestPercentageStart;
; ;
SubError = false; SubError = false;
} }
} }
@@ -423,7 +466,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
Boolean Detected = false; Boolean Detected = false;
left = 0; 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; Detected = false;
for (Int32 PercentageFollowing = Percentage; PercentageFollowing <= pp.Setting.AmpTestFirstHitLevelPropMax; PercentageFollowing++) for (Int32 PercentageFollowing = Percentage; PercentageFollowing <= pp.Setting.AmpTestFirstHitLevelPropMax; PercentageFollowing++)
@@ -436,7 +479,9 @@ namespace CordonelPreadjustmentUi.Processes.Actions
} }
} }
if (!Detected) if (!Detected)
{
NearestDistance = pp.Setting.AmpTestFirstHitLevelPropMax - Percentage; NearestDistance = pp.Setting.AmpTestFirstHitLevelPropMax - Percentage;
}
Distance.Add(NearestDistance); Distance.Add(NearestDistance);
} }
@@ -472,7 +517,9 @@ namespace CordonelPreadjustmentUi.Processes.Actions
} }
if (!Detected) if (!Detected)
{
NearestDistance = Percentage - pp.Setting.AmpTestFirstHitLevelPropMin; NearestDistance = Percentage - pp.Setting.AmpTestFirstHitLevelPropMin;
}
Distance.Add(NearestDistance); Distance.Add(NearestDistance);
} }
@@ -510,7 +557,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
return Ok; 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; Boolean Ok = true;
debugMessage = $"Distance check successful at {Slot}"; debugMessage = $"Distance check successful at {Slot}";
@@ -41,7 +41,7 @@ namespace Xylem.Common.Hardware.Interfaces.Protocols.ProtocolCore
/// </remarks> /// </remarks>
protected BaseProtocol(String ident) protected BaseProtocol(String ident)
{ {
Ident = ident; Ident = ident;
//assign thread to loop //assign thread to loop
_decodingThread = new Thread(DecodingThreadLoop) { Name = $"{Ident} Decoding thread" }; _decodingThread = new Thread(DecodingThreadLoop) { Name = $"{Ident} Decoding thread" };
//start DecodingThread //start DecodingThread
@@ -1 +1 @@
bf6bb8fceb3db5a9977dadc407cf576684bf7127 c43c40a030005a8f189e6179faf40a6d42bfef5c
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Xylem.Common.Hardware.WaterMeter.ERegister.DataPackages</RootNamespace> <RootNamespace>Xylem.Common.Hardware.WaterMeter.ERegister.DataPackages</RootNamespace>
<AssemblyName>Xylem.Common.Hardware.WaterMeter.ERegister.DataPackages</AssemblyName> <AssemblyName>Xylem.Common.Hardware.WaterMeter.ERegister.DataPackages</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
@@ -37,7 +37,14 @@
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll</HintPath> <HintPath>..\..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\NLog.5.2.8\lib\net35\NLog.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=105.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\RestSharp.105.0.0\lib\net4\RestSharp.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net40" requireReinstallation="true" /> <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net40" />
<package id="NLog" version="5.2.8" targetFramework="net40" />
<package id="RestSharp" version="105.0.0" targetFramework="net40" />
</packages> </packages>
@@ -7,11 +7,12 @@
<ProjectGuid>{B6A19B80-0F0F-434C-A754-A7712FC208B2}</ProjectGuid> <ProjectGuid>{B6A19B80-0F0F-434C-A754-A7712FC208B2}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.StreamingProtocol</RootNamespace> <RootNamespace>Xylem.Common.Hardware.WaterMeter.eRegister.Protocols.StreamingProtocol</RootNamespace>
<AssemblyName>Xylem.Common.Hardware.WaterMeter.MagFlux.Protocols.StreamingProtocol</AssemblyName> <AssemblyName>Xylem.Common.Hardware.WaterMeter.eRegister.Protocols.StreamingProtocol</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@@ -32,10 +33,13 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL"> <Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\..\..\..\..\packages\NLog.5.2.2\lib\net46\NLog.dll</HintPath> <HintPath>..\..\..\..\packages\NLog.5.2.8\lib\net35\NLog.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=105.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\RestSharp.105.0.0\lib\net4\RestSharp.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" /> <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net40" />
<package id="NLog" version="5.2.2" targetFramework="net48" /> <package id="NLog" version="5.2.8" targetFramework="net40" />
<package id="RestSharp" version="105.0.0" targetFramework="net40" />
</packages> </packages>
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Xylem.Common.Hardware.WaterMeter.eRegister.eRegisterCore</RootNamespace> <RootNamespace>Xylem.Common.Hardware.WaterMeter.eRegister.eRegisterCore</RootNamespace>
<AssemblyName>Xylem.Common.Hardware.WaterMeter.eRegister.eRegisterCore</AssemblyName> <AssemblyName>Xylem.Common.Hardware.WaterMeter.eRegister.eRegisterCore</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
@@ -38,7 +38,10 @@
<HintPath>..\..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll</HintPath> <HintPath>..\..\..\..\packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL"> <Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\NLog.5.2.2\lib\net35\NLog.dll</HintPath> <HintPath>..\..\..\..\packages\NLog.5.2.8\lib\net35\NLog.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=105.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\RestSharp.105.0.0\lib\net4\RestSharp.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net40" requireReinstallation="true" /> <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net40" />
<package id="NLog" version="5.2.2" targetFramework="net40" requireReinstallation="true" /> <package id="NLog" version="5.2.8" targetFramework="net40" />
<package id="RestSharp" version="105.0.0" targetFramework="net40" />
</packages> </packages>
@@ -155,7 +155,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
var pwString = o["JsonObject"][searchKey].ToString(); var pwString = o["JsonObject"][searchKey].ToString();
//FE081F0 E5250E5D084FA024 00 04 80 00 70 03 48 9E //FE081F0 E5250E5D084FA024 00 04 80 00 70 03 48 9E
//0x 0413F059069BEB24 //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 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 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"; //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 //E79E9F08AFBE
var pId = Convert.ToUInt64(pwString.Replace(" ", "").Substring(7, 16), 16); 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 s = BuildSkeletonKey(pId);
var r = ""; var r = "";
+1
View File
@@ -68,6 +68,7 @@ namespace TempFlansh
//Application.EnableVisualStyles(); //Application.EnableVisualStyles();
//Application.SetCompatibleTextRenderingDefault(false); //Application.SetCompatibleTextRenderingDefault(false);
//Application.Run(new Form1()); //Application.Run(new Form1());
} }
} }
} }
@@ -1 +1 @@
247396738e2c5d26ac00f9df05c0cc5c61d7f33a 65d75c3322f8a137c69963cfdc0cb6f1ffacf62a
+17 -1
View File
@@ -70,6 +70,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
this.tabPage4 = new System.Windows.Forms.TabPage(); this.tabPage4 = new System.Windows.Forms.TabPage();
this.timer3 = new System.Windows.Forms.Timer(this.components); this.timer3 = new System.Windows.Forms.Timer(this.components);
this.mainMenuStrip = new System.Windows.Forms.MenuStrip(); this.mainMenuStrip = new System.Windows.Forms.MenuStrip();
this.txtComport = new System.Windows.Forms.TextBox();
this.automaticCalibrationTabControl.SuspendLayout(); this.automaticCalibrationTabControl.SuspendLayout();
this.tabPage1.SuspendLayout(); this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout(); this.tabPage2.SuspendLayout();
@@ -81,7 +82,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
// //
// timer1 // timer1
// //
this.timer1.Interval = 5000; this.timer1.Interval = 60000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick); this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
// //
// timer2 // timer2
@@ -138,6 +139,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
// //
// tabPage2 // tabPage2
// //
this.tabPage2.Controls.Add(this.txtComport);
this.tabPage2.Controls.Add(this.lblCheck); this.tabPage2.Controls.Add(this.lblCheck);
this.tabPage2.Controls.Add(this.label9); this.tabPage2.Controls.Add(this.label9);
this.tabPage2.Controls.Add(this.btnCheck); this.tabPage2.Controls.Add(this.btnCheck);
@@ -522,6 +524,19 @@ namespace Xylem.Common.Ui.GenesisToolBox
this.mainMenuStrip.TabIndex = 57; this.mainMenuStrip.TabIndex = 57;
this.mainMenuStrip.Text = "menuStrip1"; 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 // FrmTempMeter
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 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.Label label3;
private System.Windows.Forms.Button saveSettingsBtn; private System.Windows.Forms.Button saveSettingsBtn;
private System.Windows.Forms.TabPage tabPage4; private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.TextBox txtComport;
} }
} }
+53 -36
View File
@@ -15,7 +15,7 @@
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using TempFlansh;
using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages; using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages;
using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages.MeasurementRecords; using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages.MeasurementRecords;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers; using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
@@ -165,34 +165,34 @@
private String GetLutsText(String PcbId) private String GetLutsText(String PcbId)
{ {
var ret = new StringBuilder(); 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<RefTempRange>(); var CurrentReqRequierd = new List<RefTempRange>();
//CurrentReqRequierd.AddRange(reftempRangeReq); CurrentReqRequierd.AddRange(reftempRangeReq);
//try try
//{ {
// cordonelTempLut = JsonConvert.DeserializeObject<List<CordonelTempLut>>(resp); cordonelTempLut = JsonConvert.DeserializeObject<List<CordonelTempLut>>(resp);
// foreach (var item in cordonelTempLut.OrderBy(a => a.RefTempC)) foreach (var item in cordonelTempLut.OrderBy(a => a.RefTempC))
// { {
// CurrentReqRequierd.RemoveAll(rem => item.RefTempC >= rem.Min && item.RefTempC <= rem.Max); CurrentReqRequierd.RemoveAll(rem => item.RefTempC >= rem.Min && item.RefTempC <= rem.Max);
// ret.AppendLine($"{item.RefTempC.ToString("n8")}\t|\t{item.AvgTof}"); ret.AppendLine($"{item.RefTempC.ToString("n8")}\t|\t{item.AvgTof}");
// } }
//} }
//catch (Exception) catch (Exception)
//{ {
// ret.AppendLine($"No entrys"); ret.AppendLine($"No entrys");
//} }
//lutIsMissing = false; lutIsMissing = false;
//foreach (var item in CurrentReqRequierd) foreach (var item in CurrentReqRequierd)
//{ {
// lutIsMissing = true; lutIsMissing = true;
// ret.AppendLine($"{item.Min}-{item.Max}\t|\t Missing"); ret.AppendLine($"{item.Min}-{item.Max}\t|\t Missing");
//} }
return ret.ToString(); return ret.ToString();
} }
@@ -226,11 +226,23 @@
SetEnabled(ProgrammState.Connected); SetEnabled(ProgrammState.Connected);
} }
TempHelper helper;
private void btnCheck_Click(Object sender, EventArgs e) private void btnCheck_Click(Object sender, EventArgs e)
{ {
if (btnCheck.Text == "Start Check") 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(); currentGenesis.StartRecordData();
timer1.Enabled = true; timer1.Enabled = true;
@@ -315,7 +327,12 @@
// do nothing // do nothing
} }
lblCheck.Text = checkTempMeter.ToString(); var refTemp = helper.ReadCurrentDisplayValue().ToString();
File.AppendAllLines("Check.txt", new List<string> { $"{currentGenesis.PcbId },{checkTempMeter.ToString()},{refTemp.ToString()} " });
lblCheck.Text = "DUT:" + checkTempMeter.ToString() + "vs Ref:" + refTemp.ToString();
//
} }
else else
@@ -461,7 +478,7 @@
if (i > 0) if (i > 0)
{ {
avgTof = avgTof / i; avgTof = avgTof / i;
if (!double.IsNaN(avgTof)) if (!double.IsNaN(avgTof))
{ {
@@ -494,7 +511,7 @@
{ {
jsonData = $",{jsonData}"; jsonData = $",{jsonData}";
} }
File.AppendAllText(fiName, jsonData); File.AppendAllText(fiName, jsonData);
} }
@@ -507,7 +524,7 @@
MergeToAutoFile(); MergeToAutoFile();
} }
private Double generateTof(Random r , Double temp) private Double generateTof(Random r, Double temp)
{ {
var tmp = r.Next(1, 5); var tmp = r.Next(1, 5);
var retrn = temp / 9000 - Math.Pow(temp, 1.6) / 100_000; var retrn = temp / 9000 - Math.Pow(temp, 1.6) / 100_000;
@@ -529,7 +546,7 @@
//plateau //plateau
while (needUp >= 0) while (needUp >= 0)
{ {
var temp = rramp.NextDouble() / (needUp * 100); // +0 var temp = rramp.NextDouble() / (needUp * 100); // +0
needUp = needUp - temp; needUp = needUp - temp;
refTemp = refTemp + temp; refTemp = refTemp + temp;
@@ -542,7 +559,7 @@
for (Int32 platI = 0; platI < tillI; platI++) for (Int32 platI = 0; platI < tillI; platI++)
{ {
var temp = r.NextDouble() / 5; var temp = r.NextDouble() / 5;
refTempss.Add(new TempTofCalc() { RefDate = sDate.AddSeconds(refTempss.Count), RefTemp = refTemp + temp, Tof = generateTof(rtof, refTemp) }); 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.disconnectBtn);
this.mainMenuStrip.Items.Add(this.testBtn); 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.GMHPort.Text = Appsettings.GMHPort.ToString();
this.messurementStepMS.Text = Appsettings.MessurementStep.ToString(); this.messurementStepMS.Text = Appsettings.MessurementStep.ToString();
@@ -754,7 +771,7 @@
private void StopAutomaticBtn_Clicked(object sender, EventArgs args) private void StopAutomaticBtn_Clicked(object sender, EventArgs args)
{ {
this.automatic = false; this.automatic = false;
this.automaticCalibration.StopMessuring(); this.automaticCalibration.StopMessuring();
this.MergeToAutoFile(); this.MergeToAutoFile();
@@ -765,7 +782,7 @@
this.stopAutomaticBtn.Enabled = false; this.stopAutomaticBtn.Enabled = false;
} }
const int TAKE_LINES = 50; private const int TAKE_LINES = 50;
public void AddMessage(string message) public void AddMessage(string message)
{ {
@@ -819,7 +836,7 @@
} }
} }
public void StartRecording() public void StartRecording()
=> this.currentGenesis => this.currentGenesis
?.StartRecordData(); ?.StartRecordData();
@@ -838,7 +855,7 @@
.Average(x => x.TotalTimeOfFlightS); .Average(x => x.TotalTimeOfFlightS);
} }
protected override void OnFormClosed(FormClosedEventArgs e) protected override void OnFormClosed(FormClosedEventArgs e)
=> this.BtnDisconnect_Click(default(object), EventArgs.Empty); => this.BtnDisconnect_Click(default(object), EventArgs.Empty);
private void SaveSettingsBtn_Click(Object sender, EventArgs e) private void SaveSettingsBtn_Click(Object sender, EventArgs e)
@@ -129,4 +129,7 @@
<metadata name="mainMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="mainMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>278, 17</value> <value>278, 17</value>
</metadata> </metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>120</value>
</metadata>
</root> </root>
@@ -171,7 +171,9 @@
<Reference Include="QRCoder, Version=1.4.3.0, Culture=neutral, PublicKeyToken=c4ed5b9ae8358a28, processorArchitecture=MSIL"> <Reference Include="QRCoder, Version=1.4.3.0, Culture=neutral, PublicKeyToken=c4ed5b9ae8358a28, processorArchitecture=MSIL">
<HintPath>..\..\packages\QRCoder.1.4.3\lib\net40\QRCoder.dll</HintPath> <HintPath>..\..\packages\QRCoder.1.4.3\lib\net40\QRCoder.dll</HintPath>
</Reference> </Reference>
<Reference Include="RestSharp, Version=105.0.0.0, Culture=neutral, PublicKeyToken=null" /> <Reference Include="RestSharp, Version=105.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\RestSharp.105.0.0\lib\net4\RestSharp.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
+1 -1
View File
@@ -428,7 +428,7 @@ namespace GenesisToolBox
container.meterTestSettings[i].FlowTesting = true; container.meterTestSettings[i].FlowTesting = true;
container.meterTestSettings[i].PreAdjustment = false; container.meterTestSettings[i].PreAdjustment = false;
container.meterTestSettings[i].SerialNr = $"450000{slotNr}"; container.meterTestSettings[i].SerialNr = $"450000{slotNr}";
container.meterTestSettings[i].meterType = MeterTypes.eRegister; container.meterTestSettings[i].meterType = MeterTypes.MagFlux;
} }
i++; i++;
+1
View File
@@ -3,6 +3,7 @@
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" /> <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
<package id="NLog" version="5.2.2" targetFramework="net48" /> <package id="NLog" version="5.2.2" targetFramework="net48" />
<package id="QRCoder" version="1.4.3" targetFramework="net40" /> <package id="QRCoder" version="1.4.3" targetFramework="net40" />
<package id="RestSharp" version="105.0.0" targetFramework="net48" />
<package id="System.DirectoryServices.AccountManagement" version="7.0.0" targetFramework="net48" /> <package id="System.DirectoryServices.AccountManagement" version="7.0.0" targetFramework="net48" />
<package id="System.Security.Principal.Windows" version="5.0.0" targetFramework="net48" /> <package id="System.Security.Principal.Windows" version="5.0.0" targetFramework="net48" />
</packages> </packages>
+1
View File
@@ -44,6 +44,7 @@ namespace XylemCommonUiLegacyGenCtl
void Init(int v); void Init(int v);
void Start(); void Start();
void LedOff();
bool GetAllInfos(out string oPcbId, out string oSerialNumber, out bool oHasPreajustment, out bool oHasWarnings, out string oLUT); bool GetAllInfos(out string oPcbId, out string oSerialNumber, out bool oHasPreajustment, out bool oHasWarnings, out string oLUT);
+1
View File
@@ -67,6 +67,7 @@
this.lblLed.Size = new System.Drawing.Size(46, 22); this.lblLed.Size = new System.Drawing.Size(46, 22);
this.lblLed.TabIndex = 7; this.lblLed.TabIndex = 7;
this.lblLed.Text = "LED"; this.lblLed.Text = "LED";
this.lblLed.Click += new System.EventHandler(this.lblLed_Click);
// //
// lblDataOverall // lblDataOverall
// //
+106
View File
@@ -376,11 +376,112 @@ namespace XylemCommonUiLegacyGenCtl
private CancellationTokenSource CancellationTokenSource = new CancellationTokenSource(); 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() public void Start()
{ {
Start(false); Start(false);
} }
public void Start(bool forceDisplayClear) public void Start(bool forceDisplayClear)
{ {
@@ -749,5 +850,10 @@ namespace XylemCommonUiLegacyGenCtl
{ {
} }
private void lblLed_Click(Object sender, EventArgs e)
{
LedOff();
}
} }
} }