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
+73
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;
}
}
@@ -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");
}
}
}
}
+47 -21
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)
+94 -2
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;
}
}
+155 -9
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");
}
}
}
}
}
+216
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>
@@ -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}");
}
}
@@ -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;
}