add MagFlux TestResults for calibration
This commit is contained in:
@@ -155,7 +155,7 @@
|
||||
</site>
|
||||
<site name="MeterProcessState" id="2">
|
||||
<application path="/" applicationPool="Clr4IntegratedAppPool">
|
||||
<virtualDirectory path="/" physicalPath="C:\Users\SZLATEV\source\repos\laa_production\Common\Service\MeterProcessState" />
|
||||
<virtualDirectory path="/" physicalPath="C:\Users\drabesch_ro\Repo\lab\la_operations\laa_production\Common\Service\MeterProcessState" />
|
||||
</application>
|
||||
<bindings>
|
||||
<binding protocol="http" bindingInformation="*:56011:localhost" />
|
||||
|
||||
@@ -220,7 +220,6 @@
|
||||
<Compile Include="EventArguments\RegisterUpdateEventArgs.cs" />
|
||||
<Compile Include="EventArguments\RequestResponseDataEventArgs.cs" />
|
||||
<Compile Include="MeasurementRecords\CalibrationRecord.cs" />
|
||||
<Compile Include="MeasurementRecords\FlowDeviations.cs" />
|
||||
<Compile Include="MeasurementRecords\FlowTestRecord.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RadioConfigurationParams.cs" />
|
||||
|
||||
@@ -1168,6 +1168,11 @@ namespace Xylem.Common.Hardware.WaterMeter.MagFlux.MagFluxCore
|
||||
}
|
||||
}
|
||||
|
||||
public void WriteCalibrationTestBench(List<WaterMeter.DataPackages.MeasurementRecords.FlowDeviations> results)
|
||||
{
|
||||
//todo: convert to CalibrationPoints in L per H
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
void IMeter.SetupFromConfigFile(Int32 slot, Boolean ignoreCorruptedData, Boolean useRequest, Boolean useStreaming)
|
||||
{
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages.MeasurementRecords
|
||||
namespace Xylem.Common.Hardware.WaterMeter.DataPackages.MeasurementRecords
|
||||
{
|
||||
public class FlowDeviations
|
||||
{
|
||||
@@ -257,6 +257,7 @@
|
||||
<Compile Include="BatchActions\BatchCallStopMeasurement.cs" />
|
||||
<Compile Include="Consts\DisplayCodes.cs" />
|
||||
<Compile Include="Consts\ErrorState.cs" />
|
||||
<Compile Include="DataPackages\FlowDeviations.cs" />
|
||||
<Compile Include="IMeterBatch.cs" />
|
||||
<Compile Include="MeterBatch.cs" />
|
||||
<Compile Include="IMeter.cs" />
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages.MeasurementRecords;
|
||||
using Xylem.Common.Hardware.WaterMeter.DataPackages.MeasurementRecords;
|
||||
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
|
||||
|
||||
namespace XylemCommonUiLegacyGenCtl.DataPackage
|
||||
|
||||
@@ -5,6 +5,10 @@ namespace XylemCommonUiLegacyGenCtl.DataPackage
|
||||
{
|
||||
public class TestSetupContainer
|
||||
{
|
||||
public TestSetupContainer()
|
||||
{
|
||||
meterTestResults = new MeterTestResults[10];
|
||||
}
|
||||
public bool WatingForDecision { get; set; } = true;
|
||||
|
||||
public TempSouceType TempSouce { get; set; }
|
||||
|
||||
@@ -25,5 +25,8 @@ namespace XylemCommonUiLegacyGenCtl
|
||||
|
||||
void SetTestSetupContainer(dynamic container);
|
||||
|
||||
|
||||
dynamic GetTestSetupContainer();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -268,6 +268,7 @@ namespace XylemCommonUiLegacyGenCtl
|
||||
}
|
||||
else if (Mode == MeterTypes.MagFlux)
|
||||
{
|
||||
MessageBox.Show("Start MagFlux ZeroFlow");
|
||||
var meterBatch = new MeterBatch();
|
||||
|
||||
foreach (var item in TestsetuptContainer?.meterTestSettings)
|
||||
@@ -277,7 +278,9 @@ namespace XylemCommonUiLegacyGenCtl
|
||||
var newMeter = new MagFluxMeter();
|
||||
newMeter.Login();
|
||||
newMeter.SerialNumber = item.SerialNr;
|
||||
|
||||
meterBatch.AddMeter(newMeter);
|
||||
newMeter.InitCalibration();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -301,7 +304,7 @@ namespace XylemCommonUiLegacyGenCtl
|
||||
for (int i = 0; i <= c; i++)
|
||||
{
|
||||
TestsetuptContainer.meterTestResults[c] = new MeterTestResults();
|
||||
TestsetuptContainer.meterTestResults[c].Results = new List<Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages.MeasurementRecords.FlowDeviations>();
|
||||
TestsetuptContainer.meterTestResults[c].Results = new List<Xylem.Common.Hardware.WaterMeter.DataPackages.MeasurementRecords.FlowDeviations>();
|
||||
}
|
||||
|
||||
|
||||
@@ -312,7 +315,7 @@ namespace XylemCommonUiLegacyGenCtl
|
||||
TestsetuptContainer.meterTestResults[meter.Slot - 1].meterType = MeterTypes.MagFlux;
|
||||
TestsetuptContainer.meterTestResults[meter.Slot - 1].Slot = meter.Slot;
|
||||
TestsetuptContainer.meterTestResults[meter.Slot - 1].SerialNr = meter.SerialNumber;
|
||||
TestsetuptContainer.meterTestResults[meter.Slot - 1].Results.Add(new Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages.MeasurementRecords.FlowDeviations() { RefTimeS = testTime, MeasuredRefFlowQmPerH = 0, RequierdTimeS = testTime, RequierdFlowQmPerH = 0, MeasuredDutFlowQmPerH = resU.DutFlowRateCmPh.Value, DutTimeS = resU.DutTimeS });
|
||||
TestsetuptContainer.meterTestResults[meter.Slot - 1].Results.Add(new Xylem.Common.Hardware.WaterMeter.DataPackages.MeasurementRecords.FlowDeviations() { RefTimeS = testTime, MeasuredRefFlowQmPerH = 0, RequierdTimeS = testTime, RequierdFlowQmPerH = 0, MeasuredDutFlowQmPerH = resU.DutFlowRateCmPh.Value, DutTimeS = resU.DutTimeS });
|
||||
}
|
||||
|
||||
|
||||
@@ -413,6 +416,11 @@ public void SetTestSetupContainer(dynamic vbContainer)
|
||||
_logger.Info($"SetTestSetupContainer ({sb}) ");
|
||||
TestsetuptContainer = vbContainer;
|
||||
}
|
||||
}
|
||||
|
||||
public dynamic GetTestSetupContainer()
|
||||
{
|
||||
return TestsetuptContainer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,13 +186,19 @@ namespace XylemCommonUiLegacyGenCtl
|
||||
testSetup.meterTestSettings[Slot - 1] = new MeterTestSettings();
|
||||
}
|
||||
|
||||
|
||||
if (testSetup.meterTestSettings[Slot - 1] == null)
|
||||
{
|
||||
testSetup.meterTestResults[Slot - 1] = new MeterTestResults();
|
||||
}
|
||||
|
||||
testSetup.meterTestSettings[Slot - 1].Slot = Slot;
|
||||
testSetup.meterTestSettings[Slot - 1].SerialNr = SerialNr;
|
||||
testSetup.meterTestSettings[Slot - 1].FlowAdjustment = FlowAdjustment;
|
||||
testSetup.meterTestSettings[Slot - 1].FlowAdjustmentTarget = Convert.ToDecimal(FlowAdjustmentTarget);
|
||||
testSetup.meterTestSettings[Slot - 1].PreAdjustment = PreAdjustment;
|
||||
testSetup.meterTestSettings[Slot - 1].FlowTesting = FlowTesting;
|
||||
testSetup.meterTestSettings[Slot - 1].meterType = Xylem.Common.Hardware.WaterMeter.WaterMeterCore.MeterTypes.Cordonel;
|
||||
testSetup.meterTestSettings[Slot - 1].meterType = Xylem.Common.Hardware.WaterMeter.WaterMeterCore.MeterTypes.MagFlux;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -886,11 +886,14 @@ namespace XylemCommonUiLegacyGenCtl
|
||||
TestSetupContainer = new TestSetupContainer();
|
||||
TestSetupContainer.AllChanelsRequired = true;
|
||||
TestSetupContainer.meterTestSettings = new MeterTestSettings[10];
|
||||
TestSetupContainer.meterTestResults = new MeterTestResults[10];
|
||||
}
|
||||
|
||||
if (!TestSetupContainer.meterTestSettings.Any(f => f != null && f.Slot == slot))
|
||||
{
|
||||
TestSetupContainer.meterTestSettings[slot] = new MeterTestSettings() { SerialNr = serialNumber, Slot = slot, FlowAdjustment = true, FlowTesting = true };
|
||||
TestSetupContainer.meterTestResults[slot] = new MeterTestResults() { SerialNr = serialNumber, Slot = slot, meterType = MeterTypes.MagFlux, Results = new List<Xylem.Common.Hardware.WaterMeter.DataPackages.MeasurementRecords.FlowDeviations>() };
|
||||
|
||||
}
|
||||
AddMeter(serialNumber, slot, true);
|
||||
}
|
||||
@@ -987,6 +990,28 @@ namespace XylemCommonUiLegacyGenCtl
|
||||
var meter = batch.ListOfMeters.First(f => f.Slot == slot);
|
||||
var state = Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.FlowTested;
|
||||
|
||||
|
||||
if (meter is MagFluxMeter mag)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
if (TestSetupContainer.meterTestSettings.Any(s => s.Slot == slot && s.PreAdjustment))
|
||||
{
|
||||
var result = TestSetupContainer.meterTestResults.First(s => s.Slot == slot);
|
||||
sb.AppendLine($"Results: {result.SerialNr} on ep. {result.Slot}");
|
||||
foreach (var flowDeviations in result.Results)
|
||||
{
|
||||
|
||||
sb.AppendLine($"RefFlow {flowDeviations.MeasuredRefFlowQmPerH} (for {flowDeviations.RefTimeS} Seconds) vs DutFlow {flowDeviations.MeasuredDutFlowQmPerH} (for {flowDeviations.DutTimeS} Seconds)");
|
||||
}
|
||||
mag.WriteCalibrationTestBench(result.Results);
|
||||
}
|
||||
MessageBox.Show($"{sb}");
|
||||
|
||||
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
if (!Succeed)
|
||||
{
|
||||
if (meter is GenesisMeter gen)
|
||||
@@ -1526,11 +1551,42 @@ namespace XylemCommonUiLegacyGenCtl
|
||||
_logger.Debug($"Start Record: TimeS={result.Value.DutStartRecord.GetTimeS()}, VolumeCm={result.Value.DutStartRecord.GetVolumeCm()}");
|
||||
_logger.Debug($"End Record: TimeS={result.Value.DutStopRecord.GetTimeS()}, VolumeCm={result.Value.DutStopRecord.GetVolumeCm()}");
|
||||
var sbError = string.Empty;
|
||||
|
||||
|
||||
if (ErrorMetersAlarms.ContainsKey(Slot) && ErrorMetersAlarms[Slot].HasFlag(TestBenchRelatedAlarms))
|
||||
{
|
||||
var MeterAlarms = ErrorMetersAlarms[Slot].GetHashCode();
|
||||
sbError = $"ErrorCode{MeterAlarms}";
|
||||
}
|
||||
if (Chnnl == 0)
|
||||
{
|
||||
var results = TestSetupContainer.meterTestResults.First(f => f != null && f.Slot == Slot);
|
||||
|
||||
if (results == null)
|
||||
{
|
||||
MessageBox.Show("No TestContainer found");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (results.Results == null)
|
||||
{
|
||||
results.Results = new List<Xylem.Common.Hardware.WaterMeter.DataPackages.MeasurementRecords.FlowDeviations>();
|
||||
}
|
||||
|
||||
if (!results.Results.Any(f => f.MeasuredRefFlowQmPerH == result.Value.RefFlowRateCmPh))
|
||||
{
|
||||
results.Results.Add(new Xylem.Common.Hardware.WaterMeter.DataPackages.MeasurementRecords.FlowDeviations()
|
||||
{
|
||||
MeasuredRefFlowQmPerH = result.Value.RefFlowRateCmPh ?? 0,
|
||||
RefTimeS = result.Value.RefTimeS ?? 0,
|
||||
RequierdFlowQmPerH = result.Value.RefFlowRateCmPh ?? 0,
|
||||
RequierdTimeS = result.Value.RefTimeS ?? 0,
|
||||
MeasuredDutFlowQmPerH = result.Value.DutFlowRateCmPh ?? 0,
|
||||
DutTimeS = result.Value.DutTimeS,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Results(result.Value, sbError);
|
||||
}
|
||||
@@ -2268,6 +2324,26 @@ namespace XylemCommonUiLegacyGenCtl
|
||||
sb.AppendLine($"meterType={item.meterType}");
|
||||
}
|
||||
_logger.Info($"SetTestSetupContainer ({sb}) ");
|
||||
|
||||
|
||||
foreach (var item in container.meterTestResults)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
sb.AppendLine($"Slot={item.Slot}");
|
||||
sb.AppendLine($"Sr={item.SerialNr}");
|
||||
|
||||
foreach (var flows in item.Results)
|
||||
{
|
||||
sb.AppendLine($"MeasuredRefFlowQmPerH={flows.MeasuredRefFlowQmPerH}");
|
||||
sb.AppendLine($"MeasuredDutFlowQmPerH={flows.MeasuredDutFlowQmPerH}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MessageBox.Show(sb.ToString());
|
||||
TestSetupContainer = vbContainer;
|
||||
_currentState = BatchState.TestContainerIsReady;
|
||||
|
||||
Reference in New Issue
Block a user