Prductionsdate now from RadioTest

This commit is contained in:
Roland Drabesch 2023-02-27 10:53:10 +01:00
parent 204377fb30
commit 050fd97aaa
15 changed files with 498 additions and 72 deletions

View File

@ -147,6 +147,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RawDataViewer", "Ui\RawData
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TempFlansh", "TempFlansh\TempFlansh.csproj", "{62E5BA37-36AB-4F0A-BC12-554E7A1F1A39}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DynamicStremingLogAnalyzer", "Ui\DynamicStremingLogAnalyzer\DynamicStremingLogAnalyzer.csproj", "{652ECA13-A411-4789-8814-6823965947CB}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
Utils\DateTimeServerShared\DateTimeServerShared.projitems*{4806d89a-fbfb-41bc-aaa7-2242444bf55a}*SharedItemsImports = 4
@ -3317,6 +3319,70 @@ Global
{62E5BA37-36AB-4F0A-BC12-554E7A1F1A39}.XP32bit|x64.Build.0 = Release|x64
{62E5BA37-36AB-4F0A-BC12-554E7A1F1A39}.XP32bit|x86.ActiveCfg = Release|Any CPU
{62E5BA37-36AB-4F0A-BC12-554E7A1F1A39}.XP32bit|x86.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}._MANUAL_CONTROL|Any CPU.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}._MANUAL_CONTROL|Any CPU.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}._MANUAL_CONTROL|Mixed Platforms.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}._MANUAL_CONTROL|Mixed Platforms.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}._MANUAL_CONTROL|x64.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}._MANUAL_CONTROL|x64.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}._MANUAL_CONTROL|x86.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}._MANUAL_CONTROL|x86.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.COM|Any CPU.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.COM|Any CPU.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.COM|Mixed Platforms.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.COM|Mixed Platforms.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.COM|x64.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.COM|x64.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.COM|x86.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.COM|x86.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.Debug|x64.ActiveCfg = Debug|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.Debug|x64.Build.0 = Debug|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.Debug|x86.ActiveCfg = Debug|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.Debug|x86.Build.0 = Debug|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.GenesisDisplayTool_V01|Any CPU.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.GenesisDisplayTool_V01|Any CPU.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.GenesisDisplayTool_V01|Mixed Platforms.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.GenesisDisplayTool_V01|Mixed Platforms.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.GenesisDisplayTool_V01|x64.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.GenesisDisplayTool_V01|x64.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.GenesisDisplayTool_V01|x86.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.GenesisDisplayTool_V01|x86.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.PerformTest|Any CPU.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.PerformTest|Any CPU.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.PerformTest|Mixed Platforms.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.PerformTest|Mixed Platforms.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.PerformTest|x64.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.PerformTest|x64.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.PerformTest|x86.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.PerformTest|x86.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.Release|Any CPU.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.Release|x64.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.Release|x64.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.Release|x86.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.Release|x86.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.ReleaseTest|Any CPU.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.ReleaseTest|Any CPU.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.ReleaseTest|Mixed Platforms.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.ReleaseTest|Mixed Platforms.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.ReleaseTest|x64.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.ReleaseTest|x64.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.ReleaseTest|x86.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.ReleaseTest|x86.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.XP32bit|Any CPU.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.XP32bit|Any CPU.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.XP32bit|Mixed Platforms.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.XP32bit|Mixed Platforms.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.XP32bit|x64.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.XP32bit|x64.Build.0 = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.XP32bit|x86.ActiveCfg = Release|Any CPU
{652ECA13-A411-4789-8814-6823965947CB}.XP32bit|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -3381,6 +3447,7 @@ Global
{CBF74D42-327E-4476-A096-63E7EBD9B7A3} = {57AA2731-BFD9-40A5-820F-E943FBC75D91}
{108FE49B-75E1-43F5-82DD-DA33FE99CBEC} = {03D4F23E-7E4A-4091-BC96-036C996D351A}
{62E5BA37-36AB-4F0A-BC12-554E7A1F1A39} = {03D4F23E-7E4A-4091-BC96-036C996D351A}
{652ECA13-A411-4789-8814-6823965947CB} = {03D4F23E-7E4A-4091-BC96-036C996D351A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4BCB7B69-696C-436A-86F7-C91EA5588164}

View File

@ -581,6 +581,10 @@ namespace CordonelAssemblyLine.Model
var nowSeconds = meter.ReadRegister("POWERMON_TotalUsedSeconds");
var nowCharge = meter.ReadRegister("POWERMON_TotalUsedCharge", 8);
var mfgCharge = meter.ReadRegister("CUSTOMER_MfgCharge");
var BatteryMilliAHrRating = meter.ReadRegister("POWERMON_BatteryMilliAHrRating");
if (nowCharge == null || nowSeconds == null)
{
meter.WriteLog("Batterie nicht lesbar");
@ -590,17 +594,67 @@ namespace CordonelAssemblyLine.Model
}
else
{
var nowChargeV = BitConverter.ToUInt64(nowCharge.ToArray(), 0);
var nowSecondsV = BitConverter.ToUInt32(nowSeconds.ToArray(), 0);
var mfgChargeV = BitConverter.ToUInt32(mfgCharge.ToArray(), 0);
//var nowChargeV = BitConverter.ToUInt64(nowCharge.ToArray(), 0);
//var nowSecondsV = BitConverter.ToUInt32(nowSeconds.ToArray(), 0);
//var mfgChargeV = BitConverter.ToUInt32(mfgCharge.ToArray(), 0);
//var BatteryMilliAHrRatingV = BitConverter.ToUInt32(BatteryMilliAHrRating.ToArray(), 0);
////// Time Span in h in mAhr In % with one battery is 100%
//////(((total used change difference / (Time span / 3600) ) / 3600000) / 19000)*100
//// ReSharper disable once UnusedVariable
//var loadAtH = nowChargeV / ((Double)nowSecondsV / 3600) / 3600000 / (19000 * 2) * 100;
//var totalUsed = (Double)nowChargeV / 1000000 / 3.6 / (19000 * 2) * 100;
//SetState($"Battery Total Used {totalUsed}%");
//SetState($"Battery Total Charge {nowChargeV}uAs");
//SetState($"Battery MFG Charge {mfgChargeV}uAs");
// (nowSecondsV / nowChargeV) * (2*BatteryMilliAHrRatingV * 1000 * 3600)
//(POWERMON_TotalUsedSeconds / POWERMON_TotalUsedCharge) * (POWERMON_BatteryQuantity * POWERMON_BatteryMilliAHrRating * 1000 * 3600) = lifetime in seconds
//Lifetime in seconds - POWERMON_TotalUsedSeconds = remaining lifetime.
var POWERMON_TotalUsedSeconds = (double)(RegisterConverter.ConvertTo<UInt32>(meter.ReadRegister("POWERMON_TotalUsedSeconds")));
var tmp_POWERMON_TotalUsedCharge = meter.ReadRegister("POWERMON_TotalUsedCharge", 8);
var POWERMON_TotalUsedCharge = BitConverter.ToUInt64(tmp_POWERMON_TotalUsedCharge.ToArray(), 0);
var POWERMON_BatteryQuantity = (double)RegisterConverter.ConvertTo<int>(meter.ReadRegister("POWERMON_BatteryQuantity"));
var POWERMON_BatteryMilliAHrRating = (double)RegisterConverter.ConvertTo<UInt16>(meter.ReadRegister("POWERMON_BatteryMilliAHrRating"));
var lifetimeInSeconds = (POWERMON_TotalUsedSeconds / (double)(POWERMON_TotalUsedCharge)) * (POWERMON_BatteryQuantity * POWERMON_BatteryMilliAHrRating * 1000 * 3600);
var remainingLifetime = lifetimeInSeconds - POWERMON_TotalUsedSeconds;
var sbMSG = new StringBuilder();
sbMSG.AppendLine($"Pcb = {meter.PcbId}");
sbMSG.AppendLine($"POWERMON_TotalUsedSeconds = {POWERMON_TotalUsedSeconds}");
sbMSG.AppendLine($"POWERMON_TotalUsedCharge = {POWERMON_TotalUsedCharge}");
sbMSG.AppendLine($"POWERMON_BatteryQuantity = {POWERMON_BatteryQuantity}");
sbMSG.AppendLine($"POWERMON_BatteryMilliAHrRating = {POWERMON_BatteryMilliAHrRating}");
sbMSG.AppendLine("");
sbMSG.AppendLine($"lifetimeInSeconds = (POWERMON_TotalUsedSeconds / POWERMON_TotalUsedCharge) * (POWERMON_BatteryQuantity * POWERMON_BatteryMilliAHrRating * 1000 * 3600)");
sbMSG.AppendLine($"{lifetimeInSeconds} = ({POWERMON_TotalUsedSeconds} / {POWERMON_TotalUsedCharge}) * ({POWERMON_BatteryQuantity} * {POWERMON_BatteryMilliAHrRating} * 1000 * 3600)");
sbMSG.AppendLine("");
sbMSG.AppendLine("remainingLifetime = lifetimeInSeconds - POWERMON_TotalUsedSeconds");
sbMSG.AppendLine($"{remainingLifetime} = {lifetimeInSeconds} - {POWERMON_TotalUsedSeconds}");
sbMSG.AppendLine("");
sbMSG.AppendLine($"in Years {(remainingLifetime / 86400 / 365)}");
//// Time Span in h in mAhr In % with one battery is 100%
////(((total used change difference / (Time span / 3600) ) / 3600000) / 19000)*100
// ReSharper disable once UnusedVariable
var loadAtH = nowChargeV / ((Double)nowSecondsV / 3600) / 3600000 / (19000 * 2) * 100;
var totalUsed = (Double)nowChargeV / 1000000 / 3.6 / (19000 * 2) * 100;
SetState($"Battery Total Used {totalUsed}%");
SetState($"Battery Total Charge {nowChargeV}uAs");
SetState($"Battery MFG Charge {mfgChargeV}uAs");
var loadAtH = ((((double)POWERMON_TotalUsedCharge / ((double)POWERMON_TotalUsedSeconds / 3600)) / 3600000) / (19000 * 2)) * 100;
var totalUsed = (((double)POWERMON_TotalUsedCharge / 1000000 / 3.6) / ((19000 * 2))) * 100;
sbMSG.AppendLine($"in % {totalUsed}");
if (totalUsed >= 7.5)
{
@ -608,6 +662,11 @@ namespace CordonelAssemblyLine.Model
lblS08Color = _progressError;
ret = false;
}
meter.WriteLog(sbMSG.ToString());
}

View File

@ -365,7 +365,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties configuration_1json__JsonSchema="http://json.schemastore.org/bower" />
<UserProperties configuration_1json__JsonSchema="https://codemagic.io/codemagic-schema.json" />
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@ -47,41 +47,50 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
{
if (!SkipPreparationForTestBench)
{
SkipPreparationForTestBench = true;
//TODO set display unit
//TODO calculated overflow volume for display
WriteRegister<Byte>(Register.Genesisflow.SampleRate, 16, checkRegister: true);
WriteRegister(Register.Genesisflow.LedMode, (Byte)LedMode.FlowTestAndCalibData, checkRegister: true);
WriteRegister("GENESISFLOW_SealDisplay", 0, true, true);
var displayState = ReadRegister(Register.Genesisflow.TriggerIdle);
if (displayState == null)
try
{
displayState = ReadRegister(Register.Genesisflow.TriggerIdle);
var displayState = ReadRegister(Register.Genesisflow.TriggerIdle);
if (displayState == null)
{
_logger.Info($"Slot:{Slot} - Not able to read display state");
return;
displayState = ReadRegister(Register.Genesisflow.TriggerIdle);
if (displayState == null)
{
_logger.Info($"Slot:{Slot} - Not able to read display state");
return;
}
}
}
var displayStateString = ByteStyler.ToString(displayState);
var displayStateString = ByteStyler.ToString(displayState);
if (displayStateString.Substring(0, 2) != "FF" || displayStateString.Substring(0, 5) == "FF-55")
{
WriteRegister(Register.Genesisflow.TriggerIdle, 0, true, true);
displayState = ReadRegister(Register.Genesisflow.TriggerIdle);
displayStateString = ByteStyler.ToString(displayState);
if (displayStateString != "00-00-00-00")
if (displayStateString.Substring(0, 2) != "FF" || displayStateString.Substring(0, 5) == "FF-55")
{
WriteRegister(Register.Genesisflow.TriggerActive, 1);
}
WriteRegister(Register.Genesisflow.TriggerIdle, 0, true, true);
displayState = ReadRegister(Register.Genesisflow.TriggerIdle);
displayStateString = ByteStyler.ToString(displayState);
if (displayStateString != "00-00-00-00")
{
WriteRegister(Register.Genesisflow.TriggerActive, 1);
}
}
else
{
WriteLog($"meter not active because display code has an error on code:{displayStateString}");
}
}
else
catch (Exception)
{
WriteLog($"meter not active because display code has an error on code:{displayStateString}");
}
WriteRegister("GENESISFLOW_DisplayPow10", (new Byte[] { 0x00, 0x00, 0x00, 0xFA }).Reverse().ToArray());

View File

@ -28,6 +28,7 @@ namespace Xylem.Common.Logic.ProductionOrderCore.OrderData
defEncryptionKey.AddRange(new Byte[] { 0x3B, 0x27, 0xA4, 0x9B }.ToArray());
defEncryptionKey.AddRange(new Byte[] { 0xAC, 0x21, 0x65, 0x35 }.ToArray());
using (var dataAccess = new SqlDataAccess(connectionString))
{
var sb = new StringBuilder();

View File

@ -1,4 +1,9 @@
using System;
using Newtonsoft.Json;
using ProductionUiCordonel.ProductionProcesses;
using ProductionUiCordonel.ProductionProcesses.Actions;
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@ -13,11 +18,6 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Threading;
using Newtonsoft.Json;
using ProductionUiCordonel.ProductionProcesses;
using ProductionUiCordonel.ProductionProcesses.Actions;
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.CommonCore.Consts;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig;
@ -409,7 +409,10 @@ namespace ProductionUiCordonel
var connectProcess = new ProductionProcessConnect(CurrentGenesisMeter);
pc.Processes.Add(connectProcess); //[x] [x] [x]
if (RadioAddress != 0)
{
RadioAddress = 1;
}
orderBarcode = new ProductionProcessCheckOrderNumber(0);
@ -427,17 +430,13 @@ namespace ProductionUiCordonel
pc.Processes.Add(new ProductionCheckShippingState()); //[x] [x] [x]
pc.Processes.Add(new ProductionProcessRegisterWatch());
pc.Processes.Add(new ProductionProcessPasswordFile()); //[x] [x] [x]
pc.Processes.Add(new ProductionProcessRegisterWatch());
//pc.Processes.Add(new ProductionProcessFinalParametrizationFix()); //[x] [x] []
pc.Processes.Add(new ProductionProcessFinalParametrizationVakoCsd(connectProcess, RadioAddress != 0)); //[x] [x] []
pc.Processes.Add(new ProductionProcessFinalParametrizationVakoCsd(connectProcess, true)); //[x] [x] []
pc.Processes.Add(new ProductionProcessRegisterWatch());
//if (RadioAddress != 0)
//{
var radioCheck = new ProductionProcessRadioCheck();
@ -446,26 +445,21 @@ namespace ProductionUiCordonel
radioCheck.Ordernumber = ((ProductionProcessCheckOrderNumber)sender).Ordernumber;
};
pc.Processes.Add(radioCheck); //[] [] []
//}
pc.Processes.Add(new ProductionProcessRegisterWatch());
//pc.Processes.Add(new ProductionProcessSpecialConfig()); //[x] [x] []
pc.Processes.Add(new ProductionProcessShippingMode(true, RadioAddress != 0)); //[] [] []
pc.Processes.Add(new ProductionProcessShippingMode(true,true)); //[] [] []
pc.Processes.Add(new ProductionProcessRegisterWatch());
pc.Processes.Add(new ProductionProcessFinalParametrizationVakoCsd(connectProcess, RadioAddress != 0)); //[x] [x] []
pc.Processes.Add(new ProductionProcessFinalParametrizationVakoCsd(connectProcess, true)); //[x] [x] []
pc.Processes.Add(new ProductionProcessRegisterWatch());
pc.Processes.Add(new ProductionProcessShippingMode(false, RadioAddress != 0)); //[] [] []
pc.Processes.Add(new ProductionProcessShippingMode(false, true)); //[] [] []
pc.Processes.Add(new ProductionProcessRegisterWatch());
pc.Processes.Add(new ProductionProcessFullReadOut()); //[x] [x] [x]
pc.Processes.Add(new ProductionProcessLogOff()); //[] [] []
var checkAttach = new ProductionProcessCheckAttachment(OrderNumber);
orderBarcode.isDone += (x, g) =>
{
checkAttach.OrderNumber = ((ProductionProcessCheckOrderNumber)x).Ordernumber;
checkAttach.OrderNumber = ((ProductionProcessCheckOrderNumber)x).Ordernumber;
};
pc.Processes.Add(checkAttach); //[] [] []
@ -528,7 +522,7 @@ namespace ProductionUiCordonel
{
return;
}
if (newMeter == null)
if (newMeter == null)
{
//remove all
CurrentProcess = "Warte auf Zähler";

View File

@ -43,7 +43,6 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
new Action(() => { UserControl.lblHl.Content = "Read out Registers"; }
));
var total = Meter.GetRegistersDic().Keys.Where(n => n.RegisterName == "TemperatureMeasurePeriod" || n.RegisterName == "PressureMeasurePeriod" || n.RegisterName == "METROLOGYASST_PressureRate").ToList();
var done = 0;
foreach (var dic in total)
@ -58,12 +57,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
Meter.WriteLog($"Register Watch: {dic.RegisterName} = { RegisterConverter.ConvertTo<UInt32>(ret)}");
}
}
done += 1;

View File

@ -51,6 +51,10 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
Meter.SetLcdText(true, new Byte[] { 0x00, 0x00, 0x00, 0x01 });
Meter.ResetAlarm(GenesisMeter.Alarm.EMPTY_PIPE);//(true, new byte[] { 0x00, 0x00, 0x00, 0x01 });
if (!hasRadio && Meter.RadioFrequencyMhz.HasValue)
{
throw new Exception("Meter radio is incompatible with test");
}
if (hasRadio)

View File

@ -383,7 +383,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
sb.AppendLine($" ,[ID_PCB] ");
sb.AppendLine($" ,[ID_TEST] ");
sb.AppendLine($" ,[JSON] ");
sb.AppendLine($" FROM [MyOraDB]..[DELTACHEF].[GENESIS_PCBMETROLOGYTEST_PD] ");
sb.AppendLine($" FROM [MyOraDB]..[DELTACHEF].[GENESIS_PCBRADIOTEST_PD] ");
sb.AppendLine($" where[ID_PCB] = '{CheckPcbId}' ");
sb.AppendLine($" order by cast(ID_TEST as int) desc");
@ -396,11 +396,23 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
{
var jsonString = item["JSON"].ToString();
JObject o = JObject.Parse(jsonString);
if (o.ContainsKey("StartDT") && DateTimeOffset.TryParse(o["StartDT"].ToString(), out ret))
{
return ret;
}
var jResults = JsonConvert.DeserializeObject<JToken>(jsonString);
//foreach (var o in jResults["JsonObject"])
//{
// //o.ToString().Contains("StartDT")
// if (o["StartDT"] != null && DateTimeOffset.TryParse(o["StartDT"].ToString(), out ret))
// {
// return ret;
// }
//}
}
catch (Exception)

View File

@ -329,6 +329,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
public List<Byte[]> listOfPasswords = new List<Byte[]>();
public String KeySetId { get; internal set; }
public String PasswordFileIdent { get; internal set; }
}
@ -413,6 +414,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
result.radioAdress = (Int64)item["Adresse"];
result.Skeleton = (String)item["Skeleton"];
result.Password = (String)item["Password"];
result.PasswordFileIdent = result.radioAdress.HasValue ? result.radioAdress.Value.ToString() : PcbId;
if (item["KeySetId"].GetType() != typeof(System.DBNull))
{
result.KeySetId = (String)item["KeySetId"];
@ -421,8 +423,8 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
}
//todo add NA with serailnumber
if (!result.orderNumber.HasValue || !result.radioAdress.HasValue)
if (!result.orderNumber.HasValue)
{
return Request.CreateResponse(HttpStatusCode.InternalServerError, new PcbIdNotException(new Guid("160B4C44-6EF7-41DC-A48D-4B4105B4779B")));
}
@ -437,15 +439,15 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
{
result.KeySetId = CreateKeySet(Request.Headers.GetValues("X-Node-Token").First(), 7);
//mapp keyset
MapKeySet(Request.Headers.GetValues("X-Node-Token").First(), result.KeySetId, result.orderNumber.Value, result.radioAdress.Value);
MapKeySet(Request.Headers.GetValues("X-Node-Token").First(), result.KeySetId, result.orderNumber.Value, result.PasswordFileIdent);
using (var dataAccess = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var dt = dataAccess.ExecuteQuery(
$"update auftrag.[dbo].[Genesis_PcbPassword] set KeySetId = '{result.KeySetId}', [orderNumber] = {result.orderNumber.Value}, [radioAdress] = {result.radioAdress.Value} where PcbId = '{PcbId}'; select * from auftrag.[dbo].[Genesis_PcbPassword] where PcbId = '{PcbId}'");
$"update auftrag.[dbo].[Genesis_PcbPassword] set KeySetId = '{result.KeySetId}', [orderNumber] = {result.orderNumber.Value}, [radioAdress] = {result.PasswordFileIdent} where PcbId = '{PcbId}'; select * from auftrag.[dbo].[Genesis_PcbPassword] where PcbId = '{PcbId}'");
}
}
var passwords = getKeys(Request.Headers.GetValues("X-Node-Token").First(), result.orderNumber.Value.ToString(), result.radioAdress.Value.ToString());
var passwords = getKeys(Request.Headers.GetValues("X-Node-Token").First(), result.orderNumber.Value.ToString(), result.PasswordFileIdent);
//pw lvl
passwords.Keys.Insert(2, new Key() { Index = 2, KeyKey = result.Skeleton });
@ -487,7 +489,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
}
}
private String MapKeySet(String Token, String KeySetID, Int64 MeterOrderNumber, Int64 MeterRadioAdress)
private String MapKeySet(String Token, String KeySetID, Int64 MeterOrderNumber, string MeterPassowrdIdent)
{
try
@ -504,7 +506,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
//string postData = $"[{{\"setId\":\"{KeySetID}\", \"orderNumber\":\"{orderNumber}\", \"radioAdress\":\"{radioAdress}\"}}]";
var postData = new MapKeySetItem()
{ orderNumber = MeterOrderNumber.ToString(), radioAdress = MeterRadioAdress.ToString(), setId = KeySetID };
{ orderNumber = MeterOrderNumber.ToString(), radioAdress = MeterPassowrdIdent.ToString(), setId = KeySetID };
var helpArray = new List<MapKeySetItem>() { postData };

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{652ECA13-A411-4789-8814-6823965947CB}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>DynamicStremingLogAnalyzer</RootNamespace>
<AssemblyName>DynamicStremingLogAnalyzer</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Hardware\WaterMeter\Genesis\DataPackages\DataPackages.csproj">
<Project>{0E524D43-7B66-45CD-AA74-41D51AFC3D99}</Project>
<Name>DataPackages</Name>
</ProjectReference>
<ProjectReference Include="..\..\Hardware\WaterMeter\Genesis\Protocols\StreamingProtocol\StreamingProtocol.csproj">
<Project>{29617814-313E-409E-AA5D-59C78A9D4DF1}</Project>
<Name>StreamingProtocol</Name>
</ProjectReference>
<ProjectReference Include="..\..\Metrology\Measurements\Measurements.csproj">
<Project>{6CCDB656-C676-4360-BABA-C4596AAD175D}</Project>
<Name>Measurements</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,166 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.StreamingProtocol;
namespace DynamicStremingLogAnalyzer
{
internal class PathOffsetBag
{
public int Path { get; set; }
public int CurrentOffsetValue { get; set; }
public List<double> DeltaTimeOfFlightS { get; set; }
public int indexOflastChange { get; set; }
}
internal class MeterBag
{
public MeterBag()
{
PathOffsets = new List<PathOffsetBag>();
}
public string SerialNumber { get; set; }
public string PcbID { get; set; }
public List<PathOffsetBag> PathOffsets { get; set; }
public bool MeterValid { get; set; } = true;
}
internal class Program
{
private static void Main(string[] args)
{
DateTimeOffset timestamp;
var meters = new List<MeterBag>();
foreach (var item in Directory.GetFiles("\\\\sla12buma\\cordonelds$\\LAA-D-70MYB62\\2023-02-06\\", "*_PreAdjustment.log", SearchOption.AllDirectories))
{
//Meter_SlotSlot_2_SN23706764_PreAdjustment
var meter = new MeterBag();
meter.SerialNumber = item.Substring(item.LastIndexOf("_SN") + 3, item.IndexOf("_PreAdjustment.log") - item.LastIndexOf("_SN") - 3);
meter.PathOffsets.Add(new PathOffsetBag() { Path = 1, CurrentOffsetValue = 0, indexOflastChange = 0, DeltaTimeOfFlightS = new List<double>() });
meter.PathOffsets.Add(new PathOffsetBag() { Path = 2, CurrentOffsetValue = 0, indexOflastChange = 0, DeltaTimeOfFlightS = new List<double>() });
meter.PathOffsets.Add(new PathOffsetBag() { Path = 3, CurrentOffsetValue = 0, indexOflastChange = 0, DeltaTimeOfFlightS = new List<double>() });
var directoryName = Path.GetDirectoryName(item);
//LedRawData__Slot_10_SN23706763_PreAdjustment.log
File.Exists(directoryName + "\\Meter_SlotSlot_2_SN23706764_PreAdjustment.log");
DateTimeOffset? Start = null;
var StreamingDecode = new StreamingDecoder(false);
foreach (var line in File.ReadAllLines(item))
{
if (line.Contains('|'))
{
if (DateTimeOffset.TryParse(line.Split('|')[0], out timestamp))
{
if (!Start.HasValue)
{
Start = timestamp;
}
else
{
if (StreamingDecode.DecodeMsg(line.Split('|')[1].Trim()))
{
var c = StreamingDecode.DataCalib;
if (c.IsValid)
{
meter.PathOffsets.Find(f => f.Path == c.Channel).DeltaTimeOfFlightS.Add(c.DeltaTimeOfFlightS);
}
}
}
}
}
}
meters.Add(meter);
}
foreach (var removeLineMeter in meters)
{
for (int i = 1; i <= 3; i++)
{
var cList = removeLineMeter.PathOffsets.Find(f => f.Path == i);
if (cList.DeltaTimeOfFlightS.Count > 27000)
{
cList.DeltaTimeOfFlightS.RemoveRange(0, cList.DeltaTimeOfFlightS.Count - 27000);
}
else
{
removeLineMeter.MeterValid = false;
}
}
}
foreach (var calcMeter in meters.Where(m => m.MeterValid))
{
foreach (var pOffset in calcMeter.PathOffsets)
{
List<double> CalculatedOffsets = new List<double>();
foreach (var currentOffset in pOffset.DeltaTimeOfFlightS)
{
CalculatedOffsets.Add(currentOffset);
var avg = CalculatedOffsets.Sum() / CalculatedOffsets.Count;
var OffsetValue = (Int32)((avg * Math.Pow(2, 40)));
if (pOffset.CurrentOffsetValue != OffsetValue)
{
pOffset.CurrentOffsetValue = OffsetValue;
pOffset.indexOflastChange = CalculatedOffsets.Count;
}
else
{
}
}
}
}
var sb = new StringBuilder();
foreach (var PrintMeter in meters.Where(m => m.MeterValid))
{
Console.WriteLine(PrintMeter.SerialNumber);
foreach (var pOffset in PrintMeter.PathOffsets)
{
Console.WriteLine($"{pOffset.Path} = {pOffset.indexOflastChange}");
}
}
Console.ReadLine();
//\Pruef2000
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DynamicStremingLogAnalyzer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DynamicStremingLogAnalyzer")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("652eca13-a411-4789-8814-6823965947cb")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -758,8 +758,13 @@ namespace XylemCommonUiLegacyGenCtl
return;
}
}
meter.SkipPreparationForTestBench = false;
if (TestSetupContainer.ProductionMode)
{
meter.SkipPreparationForTestBench = true;
}
meter.SkipPreparationForTestBench = true;
//;
meter.WriteLog("Add from AddAllMeters");
}
catch (Exception ex)
@ -1112,7 +1117,11 @@ namespace XylemCommonUiLegacyGenCtl
listOfTasks.ForEach(t => t.Start());
Task.WaitAll(listOfTasks.ToArray());
TryInvoke(new Action(UpdateBatch));
CheckMetersAreReadyForTest();
//When testing with scale we dont have a flow right now
if (!IsFlyingStartStop)
{
CheckMetersAreReadyForTest();
}
setBusy(false);
return true;
}