Fix Zeroflow for magflux

This commit is contained in:
Roland Drabesch
2023-06-02 13:13:12 +02:00
parent 7c47b4042f
commit 2edb09bfb5
5 changed files with 111 additions and 107 deletions
+1 -1
View File
@@ -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" />
@@ -1 +1 @@
1a3d4919c9c702245832d925951f2b7cb72fc333
5ed75d99ee45ff67821090f1b3dbb001dd9e4fe3
@@ -1 +1 @@
f64d563def603c89cafafa61a3219ba97e1e344c
0d85a5b3a7561b41163c20e5dc7713bcd0d65555
+107 -103
View File
@@ -272,8 +272,8 @@ namespace XylemCommonUiLegacyGenCtl
}
else if (Mode == MeterTypes.MagFlux)
{
MessageBox.Show("Start MagFlux ZeroFlow");
var meterBatch = new MeterBatch();
var meterBatch = new MeterBatch();
foreach (var item in TestsetuptContainer?.meterTestSettings)
{
@@ -290,42 +290,46 @@ namespace XylemCommonUiLegacyGenCtl
}
meterBatch.MetersStartMeasurement();
var testTime = 60;
var ZeroOffsetTime = DateTimeOffset.UtcNow.AddSeconds(testTime);
while (ZeroOffsetTime > DateTimeOffset.UtcNow)
{
Thread.Sleep(1000);
}
meterBatch.MetersStopMeasurement();
ZeroOffsetTime = DateTimeOffset.UtcNow.AddSeconds(10);
while (ZeroOffsetTime > DateTimeOffset.UtcNow)
{
Thread.Sleep(1000);
}
var c = TestsetuptContainer.meterTestSettings.Count();
TestsetuptContainer.meterTestResults = new MeterTestResults[c];
for (int i = 0; i < c; i++)
{
TestsetuptContainer.meterTestResults[c] = new MeterTestResults();
TestsetuptContainer.meterTestResults[c].Results = new List<Xylem.Common.Hardware.WaterMeter.DataPackages.MeasurementRecords.FlowDeviations>();
}
TestsetuptContainer.meterTestResults = new MeterTestResults[c];
Thread.Sleep(60000);
foreach (var meter in meterBatch.ListOfMeters)
{
var resU = meter.GetMainMeasurementResult(0, testTime);
try
{
meter.StopMeasurement();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
var resU = meter.GetMainMeasurementResult(0, 60);
TestsetuptContainer.meterTestResults[meter.Slot - 1] = new MeterTestResults();
TestsetuptContainer.meterTestResults[meter.Slot - 1].Results = new List<Xylem.Common.Hardware.WaterMeter.DataPackages.MeasurementRecords.FlowDeviations>();
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.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 = 60, MeasuredRefFlowQmPerH = 0, RequierdTimeS = 60, RequierdFlowQmPerH = 0, MeasuredDutFlowQmPerH = resU.DutFlowRateCmPh.Value, DutTimeS = resU.DutTimeS });
meter.Logout();
meter.DisposeMeter();
}
pollingAction = PollingAction.IsDone;
}
}
catch (Exception ex)
{
@@ -340,88 +344,88 @@ namespace XylemCommonUiLegacyGenCtl
}
public void SetFlushIsDone()
{
wrappedControl?.SetFlushIsDone();
pollingAction = PollingAction.IsBusy;
}
public void SetTestBenchTemp(double Temp)
{
wrappedControl?.SetTestBenchTemp(Temp);
pollingAction = PollingAction.IsBusy;
}
public PollingAction GetPollingAction()
{
return pollingAction;
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (wrappedControl != null)
{
wrappedControl.CloseConnections();
wrappedControl.Dispose();
}
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
public bool GetMeterIsDone(int Slot)
{
if (MetersFinallyPassed.Contains(Slot))
{
return true;
}
return false;
}
public void SetTestSetupContainer(dynamic vbContainer)
{
if (vbContainer is TestSetupContainer container)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine($"WatingForDecision={container.WatingForDecision}");
sb.AppendLine($"TempSouce={container.TempSouce}");
sb.AppendLine($"MeterSize={container.MeterSize}");
sb.AppendLine($"DelayInSBeforStart={container.DelayInSBeforStart}");
sb.AppendLine($"AllChanelsRequired={container.AllChanelsRequired}");
sb.AppendLine($"ProductionMode={container.ProductionMode}");
foreach (var item in container.meterTestSettings)
{
if (item == null)
{
continue;
}
sb.AppendLine($"Slot={item.Slot}");
sb.AppendLine($"SerialNr={item.SerialNr}");
sb.AppendLine($"FlowTesting={item.FlowTesting}");
sb.AppendLine($"PreAdjustment={item.PreAdjustment}");
sb.AppendLine($"FlowAdjustment={item.FlowAdjustment}");
sb.AppendLine($"FlowAdjustmentTarget={item.FlowAdjustmentTarget}");
sb.AppendLine($"FlowAdjustmentTarget={item.meterType}");
wrappedControl?.SetFlushIsDone();
pollingAction = PollingAction.IsBusy;
}
public void SetTestBenchTemp(double Temp)
{
wrappedControl?.SetTestBenchTemp(Temp);
pollingAction = PollingAction.IsBusy;
_logger.Info($"SetTestSetupContainer ({sb}) ");
TestsetuptContainer = vbContainer;
}
}
}
public PollingAction GetPollingAction()
{
return pollingAction;
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (wrappedControl != null)
{
wrappedControl.CloseConnections();
wrappedControl.Dispose();
}
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
public bool GetMeterIsDone(int Slot)
{
if (MetersFinallyPassed.Contains(Slot))
{
return true;
}
return false;
}
public void SetTestSetupContainer(dynamic vbContainer)
{
if (vbContainer is TestSetupContainer container)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine($"WatingForDecision={container.WatingForDecision}");
sb.AppendLine($"TempSouce={container.TempSouce}");
sb.AppendLine($"MeterSize={container.MeterSize}");
sb.AppendLine($"DelayInSBeforStart={container.DelayInSBeforStart}");
sb.AppendLine($"AllChanelsRequired={container.AllChanelsRequired}");
sb.AppendLine($"ProductionMode={container.ProductionMode}");
foreach (var item in container.meterTestSettings)
{
if (item == null)
{
continue;
}
sb.AppendLine($"Slot={item.Slot}");
sb.AppendLine($"SerialNr={item.SerialNr}");
sb.AppendLine($"FlowTesting={item.FlowTesting}");
sb.AppendLine($"PreAdjustment={item.PreAdjustment}");
sb.AppendLine($"FlowAdjustment={item.FlowAdjustment}");
sb.AppendLine($"FlowAdjustmentTarget={item.FlowAdjustmentTarget}");
sb.AppendLine($"FlowAdjustmentTarget={item.meterType}");
}
_logger.Info($"SetTestSetupContainer ({sb}) ");
TestsetuptContainer = vbContainer;
}
}
public dynamic GetTestSetupContainer()
{
+1 -1
View File
@@ -1005,7 +1005,7 @@ namespace XylemCommonUiLegacyGenCtl
}
mag.WriteCalibrationTestBench(result.Results);
}
MessageBox.Show($"{sb}");