fix tempflansch pcb

This commit is contained in:
Roland Drabesch 2024-09-17 09:30:32 +02:00
parent 1cc4c6560f
commit 42a64216a6
24 changed files with 837 additions and 122 deletions

View File

@ -155,7 +155,7 @@
</site>
<site name="MeterProcessState" id="2">
<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>
<bindings>
<binding protocol="http" bindingInformation="*:56011:localhost" />

View File

@ -118,6 +118,13 @@
<PropertyGroup />
<PropertyGroup />
<PropertyGroup />
<PropertyGroup />
<PropertyGroup />
<PropertyGroup />
<PropertyGroup />
<PropertyGroup>
<NoWin32Manifest>true</NoWin32Manifest>
</PropertyGroup>
<ItemGroup>
<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>

View File

@ -2,12 +2,14 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Drawing;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Logic.SoftwareAccessHelper;
using Xylem.Common.Ui.CordonelPreadjustmentUi.Helper.Extensions;
@ -308,27 +310,31 @@ namespace CordonelPreadjustmentUi
{
TempFromTofLUT = new List<Tuple<double, double>>();
var pcbid = "notFound";
var pcbid = Meter.GetPcbId();
try
{
if (Meter.Slot == 11)
{
pcbid = "193400032";
OverridePassword = "42133FF3682D";
Meter.WriteLog($"Fake pcbid {pcbid} for 2015 slot 11");
pcbid = "193400024";
OverridePassword = "10C16DF46E6C";
Meter.WriteLog($"Fake pcbid {pcbid}");
}
else if (Meter.Slot == 12)
{
pcbid = "193400550";
pcbid = "193400261";
OverridePassword = "BF8AC70AB27E";
OverridePassword = "42133FF37D41";
Meter.WriteLog($"Fake pcbid {pcbid} for 2015 slot 12");
Meter.WriteLog($"Fake pcbid {pcbid}");
}
//Meter.Login(OverridePassword);
//Meter.WriteRegister(Register.Genesisflow.TriggerIdle, 0);
//Meter.WriteRegister(Register.Genesisflow.LedMode, 6);
//Meter.WriteRegister(Register.Genesisflow.SampleRate, 10);
Meter.Login();
Meter.WriteRegister(Register.Genesisflow.TriggerIdle, 0);
Meter.WriteRegister(Register.Genesisflow.LedMode, 6);
Meter.WriteRegister(Register.Genesisflow.SampleRate, 10);
var resp = LocalWebRequest.GetRequest($"http://10.49.40.25/MeterProcessState/api/TempFlange/GetLut?PcbId={pcbid}", 50000);

View File

@ -1754,7 +1754,7 @@ namespace CordonelPreadjustmentUi
}
var t = new Task(() =>
{
try
@ -1775,8 +1775,16 @@ namespace CordonelPreadjustmentUi
DebugMessage($"\tAPPLICATION:\t\t No device enabled");
DebugMessage($"\tAPPLICATION:\t\t ZEROFLOW CALIBRATION sequence failed");
pp.StopSequence = true;
}
listOfProgrammParts.Last().StartProcess(pp, MeterStateCtls, TempMeterStateCtls);
while (pp.IsBusy)
{
Thread.Sleep(50);
}
}

View File

@ -36,7 +36,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
pp.DebugMessage($"Performing {ProcessName} procedure", null, "CC");
#region Definitions and initializations
//////////////#region Definitions and initializations
const Int32 FirstHitShiftValue = 4;
const Int32 FirstHitShiftValueEnd = 4;
const Int32 FirstHitUpdatePeriodeValue = 1;
@ -50,7 +50,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
TofAvgMeanTotal.Update(null, new List<Double>());
Boolean Ok = false;
#endregion
//#endregion
#region StartLogging
if (pp.Setting.AmpTestGenerateLogfiles)
{
@ -70,7 +70,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
if (CheckAbort(Ok, meterctl)) { return Ok; }
pp.StatusLabel = (PredefinedMessages.WaitUntilRegisterWriteFinished(pp.Setting.Culture));
Ok = false;
//Ok = false;
Ok = WriteRegisterSafe(meterctl.Meter, "WorkAround TriggerIdle", Register.Genesisflow.TriggerIdle, 1, false);
Thread.Sleep(150);

View File

@ -1,12 +1,10 @@
using CordonelPreadjustmentUi.Processes.Itinerary;
using Logic.ProductionToProductMapper.Cordonel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.Consts;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
using Xylem.Common.Logic.SoftwareAccessHelper;
@ -28,10 +26,10 @@ namespace CordonelPreadjustmentUi.Processes.Actions
private List<Task> doWorkProcess(ProcessProgress pp)
{
var MetersToProcess = MeterStateCtls.Where(e => e.IsEnabled).ToList();
var MetersToProcess = MeterStateCtls.Where(e => e.IsEnabled || e.Failed).ToList();
var listOfProcessTask = new List<Task>();
pp.IsBusy = true;
foreach (var meterctl in MetersToProcess)
{
listOfProcessTask.Add(new Task<bool>(() =>
@ -43,15 +41,26 @@ namespace CordonelPreadjustmentUi.Processes.Actions
{
var Ok = false;
Ok = WriteRegisterSafe(meterctl.Meter, $"Samplerate", Register.Genesisflow.SampleRate, 10);
if (CheckAbort(Ok, meterctl)) { return Ok; }
Ok = WriteRegisterSafe(meterctl.Meter, $"LED mode", Register.Genesisflow.LedMode, (Byte)6);
if (CheckAbort(Ok, meterctl)) { return Ok; }
Ok = WriteRegisterSafe(meterctl.Meter, $"Store calibration", Register.Genesisflow.StoreCalibration, 1, false);
if (CheckAbort(Ok, meterctl)) { return Ok; }
pp.DebugMessage($"Read out", meterctl.Slot, "CC");
if (!meterctl.Failed)
{
Ok = WriteRegisterSafe(meterctl.Meter, $"Samplerate", Register.Genesisflow.SampleRate, 10);
if (CheckAbort(Ok, meterctl)) { return Ok; }
Ok = WriteRegisterSafe(meterctl.Meter, $"LED mode", Register.Genesisflow.LedMode, (Byte)6);
if (CheckAbort(Ok, meterctl)) { return Ok; }
Ok = WriteRegisterSafe(meterctl.Meter, $"Store calibration", Register.Genesisflow.StoreCalibration, 1, false);
if (CheckAbort(Ok, meterctl)) { return Ok; }
pp.DebugMessage($"Read out", meterctl.Slot, "CC");
}
else
{
Ok = WriteRegisterSafe(meterctl.Meter, $"Samplerate", Register.Genesisflow.SampleRate, 2);
if (CheckAbort(Ok, meterctl)) { return Ok; }
Ok = WriteRegisterSafe(meterctl.Meter, $"LED mode", Register.Genesisflow.LedMode, (Byte)0);
if (CheckAbort(Ok, meterctl)) { return Ok; }
}
var readsOk = new List<bool>();
@ -120,9 +129,9 @@ namespace CordonelPreadjustmentUi.Processes.Actions
meterctl.Meter.calibrationResult.AdditionalLogInfos["Amp. Test Mean value PATH 3"] = tempP.Trim();
}
meterctl.Meter.calibrationResult.Succesfull = !meterctl.Failed;
var r = LocalWebRequest.PostRequestAsync($"{ServiceUrls.PostGenesisCalibrationResultUrl()}?PcbId={meterctl.Meter.PcbId}", ref code, ref exPost, 8000, meterctl.Meter.calibrationResult);
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} ");
@ -136,7 +145,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
}
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);
}
@ -161,13 +170,13 @@ namespace CordonelPreadjustmentUi.Processes.Actions
}
else
{
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.PushProgress("CordonelPreadjustmentUi", Assembly.GetExecutingAssembly().GetName().Version.ToString());

View File

@ -25,31 +25,35 @@ namespace CordonelPreadjustmentUi.Processes.Actions
MetersToProcess.ForEach(lf => lf.LoginFailed = false);
var listOfLoginTask = new List<Task>();
foreach (var tempmeterctl in TempMeterStateCtls)
{
listOfLoginTask.Add(new Task<bool>(() =>
{
if (pp.Setting.GetTempUseTempFlansh())
{
if (tempmeterctl.Meter.Slot == 11)
{
tempmeterctl.OverridePassword = "42133FF3682D";
}
else if (tempmeterctl.Meter.Slot == 12)
{
tempmeterctl.OverridePassword = "42133FF37D41";
if (tempmeterctl.Slot == 11)
{
tempmeterctl.OverridePassword = "10C16DF46E6C";
}
else if (tempmeterctl.Slot == 12)
{
tempmeterctl.OverridePassword = "BF8AC70AB27E";
}
var Result = string.IsNullOrEmpty(tempmeterctl.OverridePassword)
? tempmeterctl.Meter.Login()
@ -61,8 +65,9 @@ namespace CordonelPreadjustmentUi.Processes.Actions
pp.DebugMessage($"Login to Flansch failed");
pp.Aborted = true;
}
}
Thread.Sleep(100);
pp.DebugMessage($"Load Temp {tempmeterctl.Slot} with {MeterStateControl.TempMode.CalcTof}\n");
@ -81,15 +86,15 @@ namespace CordonelPreadjustmentUi.Processes.Actions
tempmeterctl.StartTempWatch();
}
}
}
else
{
pp.DebugMessage($"Load Temp {tempmeterctl.Slot} with {MeterStateControl.TempMode.Hand}\n");
tempmeterctl.StartTempWatch();
}
tempmeterctl.SetTemperature(0);
tempmeterctl.DisableTemperatureinput(true);
return true;
@ -124,12 +129,12 @@ namespace CordonelPreadjustmentUi.Processes.Actions
pp.DebugMessage($"Error {e.Message}\n");
}
}
if (meterctl.Meter!= null)
if (meterctl.Meter != null)
{
meterctl.Meter.SerialNumber = meterctl.Srn;
meterctl.Meter.CurrentActionText = "PreAdjustment";
}
var meterIndex = (meterctl.Slot).ToString(pp.Setting.Culture);
@ -137,7 +142,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
meterctl.Failed = !Result;
if (!Result)
{
pp.DebugMessage($"{ProcessName} procedure failed", meterctl.Slot, "APP", meterctl.Meter.PcbId);
//pp.GenerateReturnNote(PredefinedMessages.LoginFailed(pp.Setting.Culture), meterctl);
}

View File

@ -59,12 +59,12 @@ namespace CordonelPreadjustmentUi.Processes.Actions
}
}
if (TempFlanshCount == 0)
if (TempFlanshCount <= 1)
{
System.Windows.Forms.MessageBox.Show("Fehler beim auslesen der TemperaturFlansche. Bitte per Hand eingeben");
skipMan = false;
System.Windows.Forms.MessageBox.Show("Fehler beim auslesen der TemperaturFlansche.");
throw new ApplicationException("No TempFlansch");
pp.RequestTempretureSelection();
}
else

View File

@ -4,6 +4,11 @@
<add key="GetPressureSensorSpecificationURL" value="http://sla12iis01.emea.sensus.net/MeterProcessState/api/CordonelPressureSensorTest/GetTestSpec"/>
<add key="PostPressureSensorResultURL" value="http://sla12iis01.emea.sensus.net/MeterProcessState/api/CordonelPressureSensorTest/PostTestResults"/>
<add key="PressureSensorResultsURL" value="http://sla12iis01.emea.sensus.net/MeterProcessState/api/CordonelPressureSensorTest/GetTestResults/{0}"/>
<add key="11OverridePcb" value="123"/>
<add key="11OverridePassword" value="pw1"/>
<add key="12OverridePcb" value="345"/>
<add key="12OverridePassword" value="pw2"/>
</appSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

View File

@ -133,5 +133,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisStatus
/// Uniontown status
/// </summary>
public Boolean UNTStatus { get; internal set; }
public Double EMEALimit { get; internal set; }
public Boolean EMEAStatus { get; internal set; }
public Double PreProductionUNTLimit { get; internal set; }
public Boolean PreProductionUNTStatus { get; internal set; }
public Double PreProductionEMEALimit { get; internal set; }
public Boolean PreProductionEMEAStatus { get; internal set; }
}
}

View File

@ -161,6 +161,16 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisStatus
status.UNTLimit = 1368000000 + (status.ExceededLifeTime_s * 77.7);
status.UNTStatus = status.UNTLimit >= status.DrainedBatteryLoad_uAs;
status.EMEALimit = 1368000000 + (status.ExceededLifeTime_s * 119.8);
status.EMEAStatus = status.UNTLimit >= status.DrainedBatteryLoad_uAs;
status.PreProductionUNTLimit = (1368000000/2) + (status.ExceededLifeTime_s * 77.7);
status.PreProductionUNTStatus = status.UNTLimit >= status.DrainedBatteryLoad_uAs;
status.PreProductionEMEALimit = (1368000000 / 2) + (status.ExceededLifeTime_s * 119.8);
status.PreProductionEMEAStatus = status.UNTLimit >= status.DrainedBatteryLoad_uAs;
return retVal;
}
}

View File

@ -1 +1 @@
8fbe991b217e7692af4817ad205b768685aa5a72
c43c40a030005a8f189e6179faf40a6d42bfef5c

View File

@ -92,6 +92,7 @@ namespace Logic.ProductionToProductMapper.Cordonel
/// Data base entry.
/// </summary>
public Int32 DbId { get; set; }
public Boolean Succesfull { get; set; }
/// <summary>
/// Dictionary of additional logging information.

View File

@ -66,7 +66,8 @@ namespace Service.MeterProcessState.Controllers
$"[toFTempOffset2]," +
$"[toFTempOffset3]," +
$"[meterSize]," +
$"[date] ) " +
$"[successful]," +
$"[date]) " +
$"values " +
$"('{PcbId}'," +
$" {results.CalFactor1}," +
@ -83,9 +84,9 @@ namespace Service.MeterProcessState.Controllers
$" {results.ToFTempOffset1}," +
$" {results.ToFTempOffset2}," +
$" {results.ToFTempOffset3}," +
$" {results.MeterSize},");
sb.AppendLine($" GETUTCDATE());");
$" {results.MeterSize}," +
$" {(results.Succesfull? 1:0)},");
sb.AppendLine($" GETUTCDATE()); ");
sb.AppendLine($"declare @Ident as int;");
sb.AppendLine($"Select @Ident = @@IDENTITY;");
@ -110,7 +111,7 @@ namespace Service.MeterProcessState.Controllers
}
[Route("GetCalibrationResults"), HttpGet]
public async Task<HttpResponseMessage> GetCalibrationResults(String PcbId)
public async Task<HttpResponseMessage> GetCalibrationResults(String PcbId, bool OnlySuccessful = true)
{
try
{
@ -139,9 +140,14 @@ namespace Service.MeterProcessState.Controllers
sb.AppendLine("r.[toFTempOffset2], ");
sb.AppendLine("r.[toFTempOffset3], ");
sb.AppendLine("r.[meterSize], ");
sb.AppendLine("r.[date] ");
sb.AppendLine("r.[date], ");
sb.AppendLine("r.[successful] ");
sb.AppendLine("from CordonelMeterCalibrationResults r ");
sb.AppendLine("WHERE r.PcbId =@pcbid ");
if (OnlySuccessful)
{
sb.AppendLine(" and successful = 1 ");
}
sb.AppendLine("order by r.[date] DESC ");
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
@ -167,6 +173,7 @@ namespace Service.MeterProcessState.Controllers
calibrationResult.ToFTempOffset3 = (Int32)item["toFTempOffset3"];
calibrationResult.MeterSize = (UInt16)(Int32)item["meterSize"];
calibrationResult.Date = (DateTime)item["date"];
calibrationResult.Succesfull = (Boolean)item["successful"];
ret.Add(calibrationResult);
}

View File

@ -288,8 +288,27 @@ namespace Service.MeterProcessState.Controllers
}
//
[Route("SetPressureStateHydralic"), HttpPost]
public async Task<HttpResponseMessage> SetPressureState(String PcbId, Int32 FertigungsauftragsNr)
{
try
{
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
{
var query = new StringBuilder();
query.AppendLine($" INSERT INTO [dbo].[Druckpruefung] select 0,'Übersprungen wegen Stichprobe', current_timestamp ,0,0,0,0,{PcbId}, null,null,null,null,'WZ',NULL,NULL,NULL, {FertigungsauftragsNr}, 1 ,null,null,1 ");
var dt = dataacces.ExecuteQuery(query.ToString());
}
return Request.CreateResponse(HttpStatusCode.OK, await Task.Run(() => { return "store"; }));
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.ExpectationFailed, ex);
}
}
[Route("SetPressureState"), HttpPost]
public async Task<HttpResponseMessage> SetPressureState(String PcbId, Int32 FertigungsauftragsNr, [FromBody]PressureTestResult testResult)

View File

@ -1 +1 @@
1babc7d629fd8c486aff20f4990c117c2e58a68f
65d75c3322f8a137c69963cfdc0cb6f1ffacf62a

View File

@ -57,11 +57,18 @@
this.btnConnect = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.cbComSlot = new System.Windows.Forms.ComboBox();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.button2 = new System.Windows.Forms.Button();
this.label9 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.txtHyMapOrder = new System.Windows.Forms.TextBox();
this.txtHyMapPcb = new System.Windows.Forms.TextBox();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.piBoQr)).BeginInit();
this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout();
this.tabPage4.SuspendLayout();
this.SuspendLayout();
//
// lblSrn
@ -77,6 +84,7 @@
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Controls.Add(this.tabPage4);
this.tabControl1.Location = new System.Drawing.Point(12, 6);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
@ -361,6 +369,63 @@
this.cbComSlot.TabIndex = 31;
this.cbComSlot.Text = "1";
//
// tabPage4
//
this.tabPage4.Controls.Add(this.button2);
this.tabPage4.Controls.Add(this.label9);
this.tabPage4.Controls.Add(this.label10);
this.tabPage4.Controls.Add(this.txtHyMapOrder);
this.tabPage4.Controls.Add(this.txtHyMapPcb);
this.tabPage4.Location = new System.Drawing.Point(4, 22);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Padding = new System.Windows.Forms.Padding(3);
this.tabPage4.Size = new System.Drawing.Size(799, 445);
this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "DruckPrüfung";
this.tabPage4.UseVisualStyleBackColor = true;
//
// button2
//
this.button2.Location = new System.Drawing.Point(23, 71);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(190, 33);
this.button2.TabIndex = 12;
this.button2.Text = "Add Druckprüfung I.O";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(21, 48);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(33, 13);
this.label9.TabIndex = 11;
this.label9.Text = "Order";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(21, 22);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(35, 13);
this.label10.TabIndex = 10;
this.label10.Text = "PcbId";
//
// txtHyMapOrder
//
this.txtHyMapOrder.Location = new System.Drawing.Point(85, 45);
this.txtHyMapOrder.Name = "txtHyMapOrder";
this.txtHyMapOrder.Size = new System.Drawing.Size(128, 20);
this.txtHyMapOrder.TabIndex = 9;
//
// txtHyMapPcb
//
this.txtHyMapPcb.Location = new System.Drawing.Point(85, 19);
this.txtHyMapPcb.Name = "txtHyMapPcb";
this.txtHyMapPcb.Size = new System.Drawing.Size(128, 20);
this.txtHyMapPcb.TabIndex = 8;
//
// FrmMasterMapping
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -378,6 +443,8 @@
this.tabPage2.PerformLayout();
this.tabPage3.ResumeLayout(false);
this.tabPage3.PerformLayout();
this.tabPage4.ResumeLayout(false);
this.tabPage4.PerformLayout();
this.ResumeLayout(false);
}
@ -412,5 +479,11 @@
private System.Windows.Forms.Label lblPickingOrder;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Button btnRemoveSure;
private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.TextBox txtHyMapOrder;
private System.Windows.Forms.TextBox txtHyMapPcb;
}
}

View File

@ -189,5 +189,19 @@ namespace Xylem.Common.Ui.GenesisToolBox
Dispose();
}
private void button2_Click(Object sender, EventArgs e)
{
var ret = LocalWebRequest.PostRequestAsync("http://10.49.40.25/MeterProcessState/api/ProccesState/SetPressureStateHydralic?PcbId=" + txtHyMapPcb.Text + "&FertigungsauftragsNr=" + txtHyMapOrder.Text, 80000);
if (ret)
{
MessageBox.Show("Erfogreich");
}
else
{
MessageBox.Show("Fehler");
}
}
}
}

View File

@ -7,7 +7,6 @@ using System.Text;
using System.Windows.Forms;
using Xylem.Common.CommonCore.Consts;
using Xylem.Common.Hardware.Interfaces.Ports.PortCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisStatus;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
@ -16,7 +15,7 @@ using Xylem.Common.Utils.Logging;
namespace Xylem.Common.Ui.GenesisToolBox
{
@ -81,7 +80,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
int.TryParse(cbComSlot.SelectedItem.ToString(), out slotNR))
{
conntect(slotNR);
}
}
}
@ -127,26 +126,53 @@ namespace Xylem.Common.Ui.GenesisToolBox
sbMSG.AppendLine($"Remaining life time in years {genesisStatus.RemainingLifeTimeYears:F2}");
sbMSG.AppendLine($"Totally drained battery load in % {genesisStatus.DrainedBatteryLoadPercent:F2}");
sbMSG.AppendLine("");
if (genesisStatus.UNTStatus)
{
sbMSG.AppendLine($"UNT Limit OK ");
}
else
{
sbMSG.AppendLine($"UNT Limit Failed ");
}
sbMSG.AppendLine($"UNT Limit data Limit {genesisStatus.UNTLimit} Meter has {genesisStatus.DrainedBatteryLoad_uAs}");
if (genesisStatus.DrainedBatteryLoad_uAs <= genesisStatus.ExceededLifeTime_s * 77.7)
if (_currentGenesis.Region == "NA")
{
sbMSG.AppendLine($"UNT Limit before testbench OK");
if (genesisStatus.UNTStatus)
{
sbMSG.AppendLine($"UNT Limit OK ");
}
else
{
sbMSG.AppendLine($"UNT Limit Failed ");
}
sbMSG.AppendLine($"UNT Limit data Limit {genesisStatus.UNTLimit} Meter has {genesisStatus.DrainedBatteryLoad_uAs}");
if (genesisStatus.PreProductionUNTStatus)
{
sbMSG.AppendLine($"UNT Limit before testbench OK");
}
else
{
sbMSG.AppendLine($"UNT Limit before testbench Failed");
}
sbMSG.AppendLine($"UNT Limit before testbench {genesisStatus.PreProductionUNTLimit} Meter has {genesisStatus.DrainedBatteryLoad_uAs}");
}
else
{
sbMSG.AppendLine($"UNT Limit before testbench Failed");
if (genesisStatus.EMEAStatus)
{
sbMSG.AppendLine($"EMEA Limit OK ");
}
else
{
sbMSG.AppendLine($"EMEA Limit Failed ");
}
sbMSG.AppendLine($"EMEA Limit data Limit {genesisStatus.EMEALimit} Meter has {genesisStatus.DrainedBatteryLoad_uAs}");
if (genesisStatus.PreProductionEMEAStatus)
{
sbMSG.AppendLine($"EMEA Limit before testbench OK");
}
else
{
sbMSG.AppendLine($"EMEA Limit before testbench Failed");
}
sbMSG.AppendLine($"EMEA Limit before testbench {genesisStatus.PreProductionEMEALimit} Meter has {genesisStatus.DrainedBatteryLoad_uAs}");
}
sbMSG.AppendLine($"UNT Limit before testbench {genesisStatus.ExceededLifeTime_s * 77.7} Meter has {genesisStatus.DrainedBatteryLoad_uAs}");
@ -200,7 +226,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
}
private void conntect(Int32 slotNR)
{
try
@ -230,7 +256,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
{
lblState.Text = "Failed";
}
}
catch (Exception ex)
@ -238,7 +264,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
logger.Error(ex, ex.Message);
}
}
private void btnDisplayDefault_Click(Object sender, EventArgs e)
{
@ -256,7 +282,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
}
}
private void FrmConfigurations_FormClosing(Object sender, FormClosingEventArgs e)

View File

@ -59,6 +59,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
this.automaticContentBox = new System.Windows.Forms.RichTextBox();
this.autometicControlsSplitter = new System.Windows.Forms.Splitter();
this.automaticControlsPanel = new System.Windows.Forms.Panel();
this.button1 = new System.Windows.Forms.Button();
this.connectedMeters = new System.Windows.Forms.ListView();
this.saveSettingsBtn = new System.Windows.Forms.Button();
this.messurementDauerMS = new System.Windows.Forms.TextBox();
@ -71,6 +72,12 @@ namespace Xylem.Common.Ui.GenesisToolBox
this.label1 = new System.Windows.Forms.Label();
this.timer3 = new System.Windows.Forms.Timer(this.components);
this.mainMenuStrip = new System.Windows.Forms.MenuStrip();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.button2 = new System.Windows.Forms.Button();
this.txtInterPolPcbId = new System.Windows.Forms.TextBox();
this.txtInterpolTofs = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.multiflancshCalibration.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
@ -78,6 +85,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
((System.ComponentModel.ISupportInitialize)(this.nudRef)).BeginInit();
this.AutomaticCalibrationTab.SuspendLayout();
this.automaticControlsPanel.SuspendLayout();
this.tabPage4.SuspendLayout();
this.SuspendLayout();
//
// timer1
@ -95,6 +103,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
this.multiflancshCalibration.Controls.Add(this.tabPage2);
this.multiflancshCalibration.Controls.Add(this.tabPage3);
this.multiflancshCalibration.Controls.Add(this.AutomaticCalibrationTab);
this.multiflancshCalibration.Controls.Add(this.tabPage4);
this.multiflancshCalibration.Dock = System.Windows.Forms.DockStyle.Fill;
this.multiflancshCalibration.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.multiflancshCalibration.Location = new System.Drawing.Point(0, 24);
@ -375,6 +384,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
// automaticControlsPanel
//
this.automaticControlsPanel.BackColor = System.Drawing.SystemColors.Menu;
this.automaticControlsPanel.Controls.Add(this.button1);
this.automaticControlsPanel.Controls.Add(this.connectedMeters);
this.automaticControlsPanel.Controls.Add(this.saveSettingsBtn);
this.automaticControlsPanel.Controls.Add(this.messurementDauerMS);
@ -392,13 +402,28 @@ namespace Xylem.Common.Ui.GenesisToolBox
this.automaticControlsPanel.Size = new System.Drawing.Size(328, 647);
this.automaticControlsPanel.TabIndex = 0;
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.button1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.button1.Location = new System.Drawing.Point(5, 286);
this.button1.Margin = new System.Windows.Forms.Padding(5);
this.button1.Name = "button1";
this.button1.Padding = new System.Windows.Forms.Padding(0, 5, 0, 5);
this.button1.Size = new System.Drawing.Size(318, 36);
this.button1.TabIndex = 18;
this.button1.Text = "Calculate LUT";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// connectedMeters
//
this.connectedMeters.HideSelection = false;
this.connectedMeters.Location = new System.Drawing.Point(5, 285);
this.connectedMeters.Location = new System.Drawing.Point(5, 330);
this.connectedMeters.MultiSelect = false;
this.connectedMeters.Name = "connectedMeters";
this.connectedMeters.Size = new System.Drawing.Size(318, 356);
this.connectedMeters.Size = new System.Drawing.Size(318, 311);
this.connectedMeters.TabIndex = 17;
this.connectedMeters.UseCompatibleStateImageBehavior = false;
this.connectedMeters.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.MeterSelected);
@ -538,6 +563,64 @@ namespace Xylem.Common.Ui.GenesisToolBox
this.mainMenuStrip.TabIndex = 57;
this.mainMenuStrip.Text = "menuStrip1";
//
// tabPage4
//
this.tabPage4.Controls.Add(this.label10);
this.tabPage4.Controls.Add(this.label8);
this.tabPage4.Controls.Add(this.txtInterpolTofs);
this.tabPage4.Controls.Add(this.txtInterPolPcbId);
this.tabPage4.Controls.Add(this.button2);
this.tabPage4.Location = new System.Drawing.Point(4, 25);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Padding = new System.Windows.Forms.Padding(3);
this.tabPage4.Size = new System.Drawing.Size(1217, 647);
this.tabPage4.TabIndex = 4;
this.tabPage4.Text = "Interpolation";
this.tabPage4.UseVisualStyleBackColor = true;
//
// button2
//
this.button2.Location = new System.Drawing.Point(78, 24);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(196, 45);
this.button2.TabIndex = 39;
this.button2.Text = "Calc";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// txtInterPolPcbId
//
this.txtInterPolPcbId.Location = new System.Drawing.Point(78, 91);
this.txtInterPolPcbId.Name = "txtInterPolPcbId";
this.txtInterPolPcbId.Size = new System.Drawing.Size(196, 22);
this.txtInterPolPcbId.TabIndex = 40;
//
// txtInterpolTofs
//
this.txtInterpolTofs.Location = new System.Drawing.Point(78, 128);
this.txtInterpolTofs.Multiline = true;
this.txtInterpolTofs.Name = "txtInterpolTofs";
this.txtInterpolTofs.Size = new System.Drawing.Size(196, 271);
this.txtInterpolTofs.TabIndex = 41;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(27, 91);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(45, 16);
this.label8.TabIndex = 42;
this.label8.Text = "PcbID";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(27, 131);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(35, 16);
this.label10.TabIndex = 43;
this.label10.Text = "Tofs";
//
// FrmTempMeter
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -559,6 +642,8 @@ namespace Xylem.Common.Ui.GenesisToolBox
this.AutomaticCalibrationTab.ResumeLayout(false);
this.automaticControlsPanel.ResumeLayout(false);
this.automaticControlsPanel.PerformLayout();
this.tabPage4.ResumeLayout(false);
this.tabPage4.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@ -605,5 +690,12 @@ namespace Xylem.Common.Ui.GenesisToolBox
private System.Windows.Forms.Button saveSettingsBtn;
private System.Windows.Forms.TextBox txtComport;
private System.Windows.Forms.ListView connectedMeters;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.TextBox txtInterpolTofs;
private System.Windows.Forms.TextBox txtInterPolPcbId;
private System.Windows.Forms.Button button2;
}
}

View File

@ -62,7 +62,7 @@
};
}
private void BtnConnect_Click(Object sender, EventArgs e)
private void BtnConnect_Click(Object sender, EventArgs e)
=> this.Connect();
private void Connect()
@ -248,7 +248,7 @@
SetEnabled(ProgrammState.Connected);
}
TempHelper helper;
private TempHelper helper;
private void btnCheck_Click(Object sender, EventArgs e)
{
if (btnCheck.Text == "Start Check")
@ -258,10 +258,10 @@
{
helper = new TempHelper();
TempHelper.UniversalOpenCom((port), 4800, 8, 0, 0);
}
currentGenesis.StartRecordData();
timer1.Enabled = true;
@ -349,7 +349,7 @@
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();
lblCheck.Text = "DUT:" + checkTempMeter.ToString() + "vs Ref:" + refTemp.ToString();
//
@ -886,14 +886,72 @@
Appsettings.SaveSettings();
}
public void InvokeOnUIThread(Action action)
public void InvokeOnUIThread(Action action)
=> this.Invoke(action);
public IDictionary<String, Double> GetAverageTOFForeachMeter()
public bool StopLED(int slot)
{
try
{
foreach (var meter in this.meterBatch.ListOfMeters.Where(m => m.Slot == slot))
{
if (meter is ZeroFlowGenesisMeter zfgnsm)
{
if (!zfgnsm.IsLoggedOn)
{
zfgnsm.ReLogin();
}
zfgnsm.SetLcdText(false, new byte[] { 0x10, 0x10 });
return true;
}
}
}
catch (Exception)
{
return false;
}
return false;
}
public bool StartLED(int slot)
{
try
{
foreach (var meter in this.meterBatch.ListOfMeters.Where(m => m.Slot == slot))
{
if (meter is ZeroFlowGenesisMeter zfgnsm)
{
if (!zfgnsm.IsLoggedOn)
{
zfgnsm.ReLogin();
}
zfgnsm.SetLcdText(true, new byte[] { 0x00, 0x00 });
return true;
}
}
}
catch (Exception)
{
return false;
}
return false;
}
public IDictionary<String, Double> GetAverageTOFForeachMeter(int Slot)
{
var results = new Dictionary<string, double>();
foreach (var meter in this.meterBatch.ListOfMeters)
foreach (var meter in this.meterBatch.ListOfMeters.Where(m => m.Slot == Slot ) )
{
if (meter is ZeroFlowGenesisMeter zfgnsm)
{
@ -946,6 +1004,94 @@
}
}
});
}
class tempEntry
{
public DateTime dt;
public double refT;
public double tof;
public double MaxRefTPast;
public double MaxRefTFutrue;
}
private void button1_Click(Object sender, EventArgs e)
{
var of = new OpenFileDialog();
var r = of.ShowDialog();
if (r == DialogResult.OK)
{
var lines = File.ReadAllLines(of.FileName);
var allData = new Dictionary<int, List<tempEntry>>();
foreach (var item in lines)
{
var it = item.Split(';');
if (it.Length >= 4 && DateTime.TryParse(it[0], out var dtTemp ) && double.TryParse(it[1], out var refTempTemp) && int.TryParse(it[2], out var pcbTemp) && double.TryParse(it[3], out var tofTemp))
{
if (!allData.ContainsKey(pcbTemp))
{
allData.Add(pcbTemp, new List<tempEntry>());
}
allData[pcbTemp].Add(new tempEntry() { dt = dtTemp, refT = refTempTemp, tof = tofTemp });
}
}
foreach (var pcb in allData.Keys)
{
for (int i = 20; i < allData[pcb].Count - 20; i++)
{
allData[pcb][i].MaxRefTPast = Math.Abs(allData[pcb].GetRange(i - 20, 20).Average(a => a.refT) - allData[pcb][i].refT);
allData[pcb][i].MaxRefTFutrue = Math.Abs(allData[pcb].GetRange(i, 20).Average(a => a.refT) - allData[pcb][i].refT);
}
}
}
}
private void button2_Click(Object sender, EventArgs e)
{
var resp = LocalWebRequest.GetRequest($"http://10.49.40.25/MeterProcessState/api/TempFlange/GetLut?PcbId={txtInterPolPcbId.Text}", 50000);
var cordonelTempLut = JsonConvert.DeserializeObject<List<CordonelTempLut>>(resp);
var TempFromTofLUT = new List<Tuple<double, double>>();
foreach (var item in cordonelTempLut.OrderBy(a => a.RefTempC))
{
TempFromTofLUT.Add(new Tuple<double, double>(item.AvgTof, item.RefTempC));
}
StringBuilder result = new StringBuilder();
List<string> list = new List<string>(
txtInterpolTofs.Text.Split(new string[] { "\r\n" },
StringSplitOptions.RemoveEmptyEntries));
foreach (var item in list)
{
var tof = 0.0;
if (double.TryParse(item, out tof))
{
result.AppendLine(interPol(cordonelTempLut, tof).ToString());
}
else
{
result.AppendLine("NAN");
}
}
}
}
}

View File

@ -123,12 +123,228 @@
<metadata name="timer2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>104, 17</value>
</metadata>
<metadata name="multiflancshCalibration.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tabPage1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="btnRefreshLut.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="txtLuts.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tabPage2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="txtComport.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lblCheck.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label9.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="btnCheck.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tabPage3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lblAvgDutTof.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label7.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label6.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lblDuration.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lblLines.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label5.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="btnAddLut.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="nudRef.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="btnStopRecord.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="btnStartRecord.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="txtCurrentTofs.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="AutomaticCalibrationTab.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="automaticContentBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="autometicControlsSplitter.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="automaticControlsPanel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tabPage4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="btnRefreshLut.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="txtLuts.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="txtComport.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lblCheck.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label9.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="btnCheck.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lblAvgDutTof.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label7.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label6.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lblDuration.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lblLines.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label5.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="btnAddLut.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="nudRef.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="btnStopRecord.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="btnStartRecord.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="txtCurrentTofs.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="automaticContentBox.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="autometicControlsSplitter.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="automaticControlsPanel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="button1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="connectedMeters.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="saveSettingsBtn.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="messurementDauerMS.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="stopAutomaticBtn.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="startAutomaticBtn.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="messurementStepMS.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="GMHPort.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="button1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="connectedMeters.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="saveSettingsBtn.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="messurementDauerMS.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="stopAutomaticBtn.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="startAutomaticBtn.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="messurementStepMS.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="GMHPort.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="timer3.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>191, 17</value>
</metadata>
<metadata name="mainMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>278, 17</value>
</metadata>
<metadata name="mainMenuStrip.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>42</value>
</metadata>

View File

@ -12,12 +12,16 @@
void StartRecording();
bool StartLED(int Slot);
bool StopLED(int Slot);
void InvokeOnUIThread(Action action);
IDictionary<string, double> GetAverageTOFForeachMeter();
IDictionary<string, double> GetAverageTOFForeachMeter(int Slot);
}
partial class AutomaticTemperatureCalibration
internal partial class AutomaticTemperatureCalibration
{
private readonly ITempMeterForm tempMeterForm;
private TemperatureSource temperatureSource;
@ -39,7 +43,7 @@
{
this.temperatureSource = new TemperatureSource();
this.tempMeterForm.StartRecording();
this.GetResults(null, null);
//this.GetResults(null, null);
this.timer = new Timer()
{
@ -50,27 +54,88 @@
this.timer.Start();
}
private double currentCount = 0.5;
private void GetResults(Object sender, ElapsedEventArgs args)
{
this.tempMeterForm.InvokeOnUIThread(() =>
{
try
{
var temp = this.temperatureSource.GetTemperature();
var results = this.tempMeterForm.GetAverageTOFForeachMeter();
if (!this.hasHeaders)
if (currentCount > -1)
{
File.AppendAllText(this.outputFile, $"Timestamp;°C;{string.Join(";", results.Keys)}{Environment.NewLine}");
var tmpCurrent = currentCount;
currentCount = -1;
try
{
this.hasHeaders = true;
if (tmpCurrent % 1 == 0)
{
// sleep
this.tempMeterForm.StopLED((int)tmpCurrent);
this.tempMeterForm.AddMessage($"Stop LED {((int)tmpCurrent).ToString()}");
if (((int)tmpCurrent) + 1 == 3)
{
this.tempMeterForm.StartLED(1);
this.tempMeterForm.AddMessage($"Start LED 1");
}
else
{
this.tempMeterForm.StartLED((int)tmpCurrent +1);
this.tempMeterForm.AddMessage($"Stop LED {((int)tmpCurrent +1).ToString()}");
}
}
else
{
var temp = this.temperatureSource.GetTemperature();
var results = this.tempMeterForm.GetAverageTOFForeachMeter((int)tmpCurrent);
//if (!this.hasHeaders)
//{
// File.AppendAllText(this.outputFile, $"Timestamp;°C;{string.Join(";", results.Keys)}{Environment.NewLine}");
// this.hasHeaders = true;
var messurement = $"{DateTime.Now};{temp:0.00};{string.Join(";", results.Keys.Select(x => $"{x}"))}; {string.Join(";", results.Values.Select(x => $"{x:0.0000000000}"))}";
File.AppendAllText(this.outputFile, $"{messurement}{Environment.NewLine}");
this.tempMeterForm.AddMessage(messurement);
}
}
catch (Exception)
{
}
finally
{
currentCount = tmpCurrent +0.5;
}
if (currentCount >= 3)
{
currentCount = 0.5;
}
}
else
{
this.tempMeterForm.AddMessage($"Blocked{Environment.NewLine}");
}
var messurement = $"{temp:0.00};{string.Join(";", results.Values.Select(x => $"{x:0.0000000000}"))}";
File.AppendAllText(this.outputFile, $"{messurement}{Environment.NewLine}");
this.tempMeterForm.AddMessage(messurement);
}
catch (Exception e)
{
@ -97,7 +162,7 @@
this.temperatureSource.Dispose();
}
catch (Exception e)
{
{
this.tempMeterForm.AddMessage($"{e}");
}
}

View File

@ -33,14 +33,14 @@
result = GMH_Transmit(1, 0, &priority, &temperature, &value);
}
if (temperature < 50)
{
return -1.11;
}
else if (temperature > 50)
{
return 1.11;
}
//if (temperature < 50)
//{
// return -1.11;
//}
//else if (temperature > 50)
//{
// return 1.11;
//}
return temperature;
}