Long time no commit

This commit is contained in:
Roland Drabesch
2022-04-06 10:42:16 +02:00
parent 0a72be12ab
commit ec37bb9b9e
225 changed files with 65673 additions and 18510 deletions
@@ -5,7 +5,7 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D0C8D887-ED52-40AB-A069-90BCE0E801E2}</ProjectGuid>
<OutputType>WinExe</OutputType>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Xylem.Common.Ui.CordonelPreadjustmentUi</RootNamespace>
<AssemblyName>Xylem.Common.Ui.CordonelPreadjustmentUi</AssemblyName>
@@ -63,7 +63,7 @@
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
<SignManifests>false</SignManifests>
</PropertyGroup>
<PropertyGroup />
<PropertyGroup />
@@ -74,6 +74,31 @@
<PropertyGroup />
<PropertyGroup />
<PropertyGroup />
<PropertyGroup />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup />
<PropertyGroup />
<PropertyGroup />
<PropertyGroup />
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
@@ -116,6 +141,7 @@
<DependentUpon>MsgBox.cs</DependentUpon>
</Compile>
<Compile Include="Parameters\FlushParams.cs" />
<Compile Include="Parameters\PreAdjustmentTempSouce.cs" />
<Compile Include="PreAdjustmentControl.cs">
<SubType>UserControl</SubType>
</Compile>
+15 -2
View File
@@ -22,7 +22,7 @@ namespace CordonelPreadjustmentUi
private void MainForm_Load(object sender, EventArgs e)
{
preadjustCtl = new PreAdjustmentControl(mainSettings);
tab_ZeroFlowCal.Controls.Add(preadjustCtl);
@@ -104,7 +104,20 @@ namespace CordonelPreadjustmentUi
mainSettings.TempDeviationLimit = (double)nUD_SettingsTempMonitorDeviation.Value;
//mainSettings.MeterSize = (Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.Consts.MeterSize)nUD_SettingsPreparationMetersize.Value;
mainSettings.TempOnly = cB_TempOnly.Checked;
mainSettings.TempMan = cB_TempManualAcquisition.Checked;
mainSettings.SetTempUseTempFlansh(true);
if (cB_TempManualAcquisition.Checked)
{
mainSettings.SetTempUseManualInput(true);
mainSettings.SetTempUseTempFlansh(false);
}
else
{
mainSettings.SetTempUseTempFlansh(true);
mainSettings.SetTempUseManualInput(false);
}
mainSettings.OffsetTestGenerateLogfiles = cB_OffsetTestLogFiles.Checked;
mainSettings.OffsetTestActivityCheckInverval = (int)nUD_Settings_ZeroflowOffsetTestActivityCheckInterval.Value;
@@ -304,17 +304,31 @@ namespace CordonelPreadjustmentUi
{
if (Meter.Slot == 11)
{
pcbid = "18370042";
pcbid = "193400550";
Meter.WriteLog($"Fake pcbid {pcbid} for 2016 slot 11");
}
else if (Meter.Slot == 12)
{
pcbid = "182100096";
Meter.WriteLog($"Fake pcbid {pcbid} for 2016 slot 11");
pcbid = "193400388";
Meter.WriteLog($"Fake pcbid {pcbid} for 2016 slot 12");
}
}
}
if (string.IsNullOrEmpty(pcbid) || pcbid.Length < 5)
{
if (Meter.Slot == 11)
{
pcbid = "193400550";
Meter.WriteLog($"Fake pcbid {pcbid} for 2016 slot 11");
}
else if (Meter.Slot == 12)
{
pcbid = "193400388";
Meter.WriteLog($"Fake pcbid {pcbid} for 2016 slot 12");
}
}
@@ -0,0 +1 @@

@@ -76,7 +76,7 @@ namespace CordonelPreadjustmentUi
}
tmpI = 1;
if (settings.TempMeters.Any() && !settings.TempMan)
if (settings.TempMeters.Any() && settings.GetTempUseTempFlansh())
{
foreach (var tempMeter in settings.TempMeters)
{
@@ -92,7 +92,6 @@ namespace CordonelPreadjustmentUi
}
else
{
settings.TempMan = true;
var ctl = new TempMeterStateControl("Input");
ctl.Location = new Point(5 + ((tmpI - 1) * ctl.Width), 15);
ctl.SetChecked(true);
@@ -1412,7 +1411,7 @@ namespace CordonelPreadjustmentUi
GlobalMeterBatch = new MeterBatch();
ThermoMeterBatch = new MeterBatch();
if (settings.TempMan)
if (!settings.GetTempUseTempFlansh())
{
TempMeterStateCtls = new List<MeterStateControl>();
}
@@ -1521,14 +1520,19 @@ namespace CordonelPreadjustmentUi
}
try
{
foreach (var meterCtl in TempMeterStateCtls)
if (!settings.GetTempUseManualInput())
{
if (meterCtl != null && meterCtl.IsEnabled)
foreach (var meterCtl in TempMeterStateCtls)
{
meterCtl.Ok = meterCtl.Meter.CheckStreamingPort();
if (meterCtl != null && meterCtl.IsEnabled)
{
meterCtl.Ok = meterCtl.Meter.CheckStreamingPort();
}
}
AllMeterStateCtrls().ForEach(f => f.SetUi());
}
AllMeterStateCtrls().ForEach(f => f.SetUi());
}
catch (Exception ex)
{
@@ -1564,9 +1568,9 @@ namespace CordonelPreadjustmentUi
}
else
{
DialogResult AskForActions;
DialogResult AskForActions = DialogResult.Ignore;
AbortButtonEnabled(false);
AskForActions = ShowMsg(Text, $"{sequenceName}", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Question);
AskForActions = ShowMsg(Text, $"{sequenceName}", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Question, true);
AbortButtonEnabled(true);
DebugMessage($"AskForActions on {sequenceName} selected {AskForActions}");
@@ -1656,7 +1660,7 @@ namespace CordonelPreadjustmentUi
pp.OnRequestTemperatur += delegate (Object o, EventArgs args)
{
OnRequestTemperatur.Invoke(o, new EventArgs());
OnRequestTemperatur?.Invoke(o, new EventArgs());
};
@@ -1982,7 +1986,7 @@ namespace CordonelPreadjustmentUi
ThermoMeterBatch = new MeterBatch();
StopMainSequence(msg, MessageBoxIcon.Information, c);
OnIsDone?.Invoke(this,new EventArgsMeterSuccsessfull(goodMeters));
OnIsDone?.Invoke(this, new EventArgsMeterSuccsessfull(goodMeters));
}
@@ -1,12 +1,10 @@
using System;
using Logic.ProductionToProductMapper.Cordonel;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text;
using Logic.ProductionToProductMapper.Cordonel;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.Consts;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
namespace CordonelPreadjustmentUi
{
@@ -66,8 +64,8 @@ namespace CordonelPreadjustmentUi
private string CultureStr;
public List<Int32> TempMeters = new List<Int32>() { 1,10 };
public List<Int32> Meters = new List<Int32>() { 2, 3, 4, 5, 6, 7, 8, 9 };
public List<Int32> TempMeters = new List<Int32>() { 1, 10 };
public List<Int32> Meters = new List<Int32>() { 2, 3, 4, 5, 6, 7, 8, 9 };
public CultureInfo Culture
{
@@ -77,9 +75,71 @@ namespace CordonelPreadjustmentUi
public Int32 NumberOfPaths { get; internal set; }
public bool TempOnly { get; internal set; } = false;
public bool TempMan { get; internal set; } = false;
public PreAdjustmentSettingsContainer(int numberOfPaths = 3, Int32[] meters = null, string cultureStr = "de-DE", Int32[] tempMeters = null, MeterSize meterSize = MeterSize.DN50, Double upperTempLimit = 35, Double lowerTempLimit = 15, Double tempDeviationLimit = 1, Int32 ampTestTofRecordingTime = 2, Double ampTestTriggerValue = 0.5, bool ampTestGenerateLogfiles = true, bool ampTestGenerateMeanValuesFile = true, Int32 ampTestFirstHitLevelPropMin = 12, Int32 ampTestFirstHitLevelPropMax = 32, Int32 ampTestAmpTestDistance = 7, Int32 ampTestPercentageStart = 5, Int32 ampTestPercentageStop = 35, Int32 ampTestActivityCheckInverval = 6, bool offsetTestGenerateLogfiles = true, Int32 offsetTestUpperVoltageLimitMV = 650, Int32 offsetTestLowerVoltageLimitMV = 200, Int32 offsetTestOffsetLimitPS = 300, Int32 offsetTestSettlingTime = 60, Int32 offsetTestZeroflowOffsetTestNumberOfLines = 9000, Int32 offsetTestActivityCheckInverval = 2, Int32 offsetTestBadDataLimit = 3, Int32 samplerate = 16)
private bool tempUseManualInput;
public bool GetTempUseManualInput()
{
return tempUseManualInput;
}
public void SetTempUseManualInput(bool value)
{
tempUseManualInput = value;
}
private bool tempUsePtOverSps;
public bool GetTempUsePtOverSps()
{
return tempUsePtOverSps;
}
public void SetTempUsePtOverSps(bool value)
{
tempUsePtOverSps = value;
}
private bool tempUseTempFlansh;
public bool GetTempUseTempFlansh()
{
return tempUseTempFlansh;
}
public void SetTempUseTempFlansh(bool value)
{
tempUseTempFlansh = value;
}
public PreAdjustmentSettingsContainer(
int numberOfPaths = 3,
Int32[] meters = null,
string cultureStr = "de-DE",
Int32[] tempMeters = null,
MeterSize meterSize = MeterSize.DN50,
Double upperTempLimit = 35,
Double lowerTempLimit = 15,
Double tempDeviationLimit = 1,
Int32 ampTestTofRecordingTime = 2,
Double ampTestTriggerValue = 0.5,
bool ampTestGenerateLogfiles = true,
bool ampTestGenerateMeanValuesFile = true,
Int32 ampTestFirstHitLevelPropMin = 12,
Int32 ampTestFirstHitLevelPropMax = 32,
Int32 ampTestAmpTestDistance = 7,
Int32 ampTestPercentageStart = 5,
Int32 ampTestPercentageStop = 35,
Int32 ampTestActivityCheckInverval = 6,
bool offsetTestGenerateLogfiles = true,
Int32 offsetTestUpperVoltageLimitMV = 650,
Int32 offsetTestLowerVoltageLimitMV = 200,
Int32 offsetTestOffsetLimitPS = 300,
Int32 offsetTestSettlingTime = 60,
Int32 offsetTestZeroflowOffsetTestNumberOfLines = 9000,
Int32 offsetTestActivityCheckInverval = 2,
Int32 offsetTestBadDataLimit = 3,
Int32 samplerate = 16)
{
NumberOfPaths = numberOfPaths;
@@ -91,7 +151,7 @@ namespace CordonelPreadjustmentUi
}
else
{
Meters = new List<int>() { 2, 3, 4, 5, 6, 7, 8, 9 };
Meters = new List<int>() { 2, 3, 4, 5, 6, 7, 8, 9 };
}
if (tempMeters != null)
{
@@ -127,7 +187,7 @@ namespace CordonelPreadjustmentUi
public override string ToString()
{
var sb = new StringBuilder();
var sb = new StringBuilder();
foreach (var p in this.GetType().GetProperties().Where(p => !p.GetGetMethod().GetParameters().Any()))
{
sb.Append($"{p.Name}={p.GetValue(this, null).ToString()}");
@@ -93,16 +93,48 @@ namespace CordonelPreadjustmentUi.Processes.Actions
Exception exPost = new Exception();
int code = 0;
var tempP = "";
if (meterctl.Meter.calibrationResult.AdditionalLogInfos.TryGetValue("Amp. Test Mean value PATH 1", out tempP))
{
tempP = tempP.Replace(" at ", "").Replace("at ", "");
tempP = tempP.Replace(System.Environment.NewLine, ";");
meterctl.Meter.calibrationResult.AdditionalLogInfos["Amp. Test Mean value PATH 1"] = tempP;
}
if (meterctl.Meter.calibrationResult.AdditionalLogInfos.TryGetValue("Amp. Test Mean value PATH 2", out tempP))
{
tempP = tempP.Replace(" at ", "").Replace("at ", ""); ;
tempP = tempP.Replace(System.Environment.NewLine, ";");
meterctl.Meter.calibrationResult.AdditionalLogInfos["Amp. Test Mean value PATH 2"] = tempP;
}
if (meterctl.Meter.calibrationResult.AdditionalLogInfos.TryGetValue("Amp. Test Mean value PATH 3", out tempP))
{
tempP = tempP.Replace(" at ", "").Replace("at ", ""); ;
tempP = tempP.Replace(System.Environment.NewLine, ";");
meterctl.Meter.calibrationResult.AdditionalLogInfos["Amp. Test Mean value PATH 3"] = tempP.Trim();
}
var r = LocalWebRequest.PostRequestAsync($"{ServiceUrls.PostGenesisCalibrationResultUrl()}?PcbId={meterctl.Meter.PcbId}", ref code, ref exPost, 8000, meterctl.Meter.calibrationResult);
if (!r)
{
meterctl.Meter.WriteLog($"Could not store CalibrationResults on server CODE {code}EX:{exPost} ");
foreach (var item in meterctl.Meter.calibrationResult.AdditionalLogInfos)
{
meterctl.Meter.WriteLog($"AdditionalLogInfos {item.Key} -> {item.Value} ");
}
throw new Exception("Could not store CalibrationResults on server");
}
if (pp.IsAutomaticMode)
{
meterctl.Meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.ZeroFlow);
// meterctl.Meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.ZeroFlow);
}
@@ -131,7 +163,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
pp.DebugMessage($"{ProcessName} procedure successful", meterctl.Slot, "APP", meterctl.Meter.PcbId);
if (pp.IsAutomaticMode)
{
meterctl.Meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.ZeroFlow);
//meterctl.Meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.ZeroFlow);
}
}
@@ -32,7 +32,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
{
if (!pp.Setting.TempMan)
if (pp.Setting.GetTempUseTempFlansh())
{
pp.DebugMessage($"Load Temp {tempmeterctl.Slot} with {MeterStateControl.TempMode.CalcTof}\n");
@@ -7,6 +7,7 @@ using System.Threading;
using System.Threading.Tasks;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Ui.CordonelPreadjustmentUi.Helper.Extensions;
using static CordonelPreadjustmentUi.PreAdjustmentControl;
namespace CordonelPreadjustmentUi.Processes.Actions
@@ -39,26 +40,41 @@ namespace CordonelPreadjustmentUi.Processes.Actions
pp.StatusLabel = (PredefinedMessages.WaitUntilTemperatureAcquisitionFinished(pp.Setting.Culture));
if (!pp.Setting.TempMan || TempMeterStateCtls.Any(a => a.IsEnabled))
bool skipMan = false;
if (pp.Setting.GetTempUseTempFlansh() || TempMeterStateCtls.Any(a => a.IsEnabled))
{
skipMan = true;
//aoutmatic
decimal avgTemp = 0;
int TempFlanshCount = 0;
var listOFEnabledTempMeters = TempMeterStateCtls.Where(a => a.IsEnabled).ToList();
foreach (var avgTempCtls in listOFEnabledTempMeters)
{
avgTemp = avgTemp + avgTempCtls.GetTemperature();
var check = avgTempCtls.GetTemperature();
if (check > 2 || ((double)check) != 25.0d )
{
avgTemp = avgTemp + avgTempCtls.GetTemperature();
TempFlanshCount = TempFlanshCount + 1;
}
}
avgTemp = avgTemp / listOFEnabledTempMeters.Count;
foreach (var meterctl in MetersToProcess)
if (TempFlanshCount == 0)
{
meterctl.SetTemperature(avgTemp);
skipMan = false;
}
else
{
avgTemp = avgTemp / TempFlanshCount;
foreach (var meterctl in MetersToProcess)
{
meterctl.SetTemperature(avgTemp);
}
}
}
else
if (!skipMan)
{
//manual input
foreach (var meterctl in MetersToProcess)
@@ -103,7 +119,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
Thread.Sleep(100);
}
if (!pp.Setting.TempMan && pp.PushedTestBenchTemp.HasValue)
if (pp.Setting.GetTempUsePtOverSps() && pp.PushedTestBenchTemp.HasValue)
{
foreach (var updateMeter in MetersToProcess)
{
@@ -56,8 +56,6 @@ namespace CordonelPreadjustmentUi.Processes
pp.DebugMessage($"{ProcessName} procedure started");
try
{
listOfProcessTasks = StartWork();
}
@@ -323,6 +321,7 @@ namespace CordonelPreadjustmentUi.Processes
public bool ReadRegister(ZeroFlowGenesisMeter m, string displayName, string registerName, out byte[] ret)
{
Thread.Sleep(100);
CurrentProcessProgress.StatusLabel = PredefinedMessages.WaitUntilRegisterReadFinished(CurrentProcessProgress.Setting.Culture);
var Ok = false;
CurrentProcessProgress.DebugMessage($"Reading '{displayName}'-register", m.Slot, "CC", m.PcbId);
@@ -342,6 +341,7 @@ namespace CordonelPreadjustmentUi.Processes
}
public bool WriteRegisterSafe<T>(ZeroFlowGenesisMeter m, string displayName, string registerName, T Value, bool CheckResult = true)
{
Thread.Sleep(100);
CurrentProcessProgress.DebugMessage($"Writing {Value} to '{displayName}'-register", m.Slot, "CC", m.PcbId);
var Ok = false;
if (CheckResult)
@@ -321,7 +321,7 @@ namespace CordonelPreadjustmentUi
public new Boolean WriteRegisterUnsafe<T>(string reg, T value)
{
var RetrysLeft = 12;
var RetrysLeft = 8;
while (RetrysLeft >= 0)
@@ -351,7 +351,7 @@ namespace CordonelPreadjustmentUi
public new Boolean WriteRegisterSafe<T>(string reg, T value)
{
var RetrysLeft = 12;
var RetrysLeft = 8;
while (RetrysLeft >= 0)
@@ -382,7 +382,7 @@ namespace CordonelPreadjustmentUi
{
var RetrysLeft = 12;
var RetrysLeft = 8;
Exception lastEx = null;
while (RetrysLeft >= 0)