This commit is contained in:
Thomas Wiedebusch
2023-09-06 14:54:26 +02:00
110 changed files with 46987 additions and 1286 deletions
+382 -183
View File
@@ -1,4 +1,6 @@
namespace Xylem.Common.Ui.GenesisToolBox
using System.Drawing;
namespace Xylem.Common.Ui.GenesisToolBox
{
partial class FrmTempMeter
{
@@ -29,14 +31,9 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.btnConnect = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.cbComSlot = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.lblPcbId = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.timer2 = new System.Windows.Forms.Timer(this.components);
this.tabControl1 = new System.Windows.Forms.TabControl();
this.automaticCalibrationTabControl = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.btnRefreshLut = new System.Windows.Forms.Button();
this.txtLuts = new System.Windows.Forms.TextBox();
@@ -57,89 +54,39 @@
this.btnStopRecord = new System.Windows.Forms.Button();
this.btnStartRecord = new System.Windows.Forms.Button();
this.txtCurrentTofs = new System.Windows.Forms.TextBox();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.btnUpdateGrid = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.AutomaticCalibrationTab = new System.Windows.Forms.TabPage();
this.automaticContentBox = new System.Windows.Forms.RichTextBox();
this.autometicControlsSplitter = new System.Windows.Forms.Splitter();
this.automaticControlsPanel = new System.Windows.Forms.Panel();
this.messurementTOFTolerance = new System.Windows.Forms.TextBox();
this.label42 = new System.Windows.Forms.Label();
this.stopAutomaticBtn = new System.Windows.Forms.Button();
this.startAutomaticBtn = new System.Windows.Forms.Button();
this.messurementToleranceInC = new System.Windows.Forms.TextBox();
this.label11 = new System.Windows.Forms.Label();
this.messurementStep = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.messurementDauerInMs = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.temperatureChecksCount = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.temperatureCheckInC = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.temperatureCheckInMs = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.timer3 = new System.Windows.Forms.Timer(this.components);
this.button3 = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout();
this.mainMenuStrip = new System.Windows.Forms.MenuStrip();
this.messurementExitAfterInMin = new System.Windows.Forms.TextBox();
this.label12 = new System.Windows.Forms.Label();
this.automaticCalibrationTabControl.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudRef)).BeginInit();
this.tabPage4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.AutomaticCalibrationTab.SuspendLayout();
this.automaticControlsPanel.SuspendLayout();
this.SuspendLayout();
//
// btnConnect
//
this.btnConnect.Location = new System.Drawing.Point(12, 37);
this.btnConnect.Name = "btnConnect";
this.btnConnect.Size = new System.Drawing.Size(234, 24);
this.btnConnect.TabIndex = 30;
this.btnConnect.Text = "Connect";
this.btnConnect.UseVisualStyleBackColor = true;
this.btnConnect.Click += new System.EventHandler(this.btnConnect_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(13, 14);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(28, 13);
this.label2.TabIndex = 29;
this.label2.Text = "Slot:";
//
// cbComSlot
//
this.cbComSlot.FormattingEnabled = true;
this.cbComSlot.Items.AddRange(new object[] {
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"20"});
this.cbComSlot.Location = new System.Drawing.Point(43, 10);
this.cbComSlot.Name = "cbComSlot";
this.cbComSlot.Size = new System.Drawing.Size(37, 21);
this.cbComSlot.TabIndex = 28;
this.cbComSlot.Text = "1";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(99, 14);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(40, 13);
this.label1.TabIndex = 33;
this.label1.Text = "PcbID:";
//
// lblPcbId
//
this.lblPcbId.AutoSize = true;
this.lblPcbId.Location = new System.Drawing.Point(153, 14);
this.lblPcbId.Name = "lblPcbId";
this.lblPcbId.Size = new System.Drawing.Size(10, 13);
this.lblPcbId.TabIndex = 34;
this.lblPcbId.Text = "-";
//
// timer1
//
this.timer1.Interval = 5000;
@@ -149,27 +96,31 @@
//
this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
//
// tabControl1
// automaticCalibrationTabControl
//
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, 90);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(652, 649);
this.tabControl1.TabIndex = 55;
this.tabControl1.Tag = "";
this.automaticCalibrationTabControl.Controls.Add(this.tabPage1);
this.automaticCalibrationTabControl.Controls.Add(this.tabPage2);
this.automaticCalibrationTabControl.Controls.Add(this.tabPage3);
this.automaticCalibrationTabControl.Controls.Add(this.AutomaticCalibrationTab);
this.automaticCalibrationTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.automaticCalibrationTabControl.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.automaticCalibrationTabControl.Location = new System.Drawing.Point(0, 24);
this.automaticCalibrationTabControl.Margin = new System.Windows.Forms.Padding(0);
this.automaticCalibrationTabControl.Name = "automaticCalibrationTabControl";
this.automaticCalibrationTabControl.Padding = new System.Drawing.Point(0, 0);
this.automaticCalibrationTabControl.SelectedIndex = 0;
this.automaticCalibrationTabControl.Size = new System.Drawing.Size(1245, 724);
this.automaticCalibrationTabControl.TabIndex = 55;
this.automaticCalibrationTabControl.Tag = "";
//
// tabPage1
//
this.tabPage1.Controls.Add(this.btnRefreshLut);
this.tabPage1.Controls.Add(this.txtLuts);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Location = new System.Drawing.Point(4, 25);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(644, 623);
this.tabPage1.Size = new System.Drawing.Size(1237, 695);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Current entrys in LUT";
this.tabPage1.UseVisualStyleBackColor = true;
@@ -197,10 +148,10 @@
this.tabPage2.Controls.Add(this.lblCheck);
this.tabPage2.Controls.Add(this.label9);
this.tabPage2.Controls.Add(this.btnCheck);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Location = new System.Drawing.Point(4, 25);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(644, 623);
this.tabPage2.Size = new System.Drawing.Size(1237, 695);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Manual check temp";
this.tabPage2.UseVisualStyleBackColor = true;
@@ -210,7 +161,7 @@
this.lblCheck.AutoSize = true;
this.lblCheck.Location = new System.Drawing.Point(221, 66);
this.lblCheck.Name = "lblCheck";
this.lblCheck.Size = new System.Drawing.Size(10, 13);
this.lblCheck.Size = new System.Drawing.Size(12, 16);
this.lblCheck.TabIndex = 54;
this.lblCheck.Text = "-";
//
@@ -219,7 +170,7 @@
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(147, 66);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(68, 13);
this.label9.Size = new System.Drawing.Size(85, 16);
this.label9.TabIndex = 53;
this.label9.Text = "Check Temp";
//
@@ -247,10 +198,10 @@
this.tabPage3.Controls.Add(this.btnStopRecord);
this.tabPage3.Controls.Add(this.btnStartRecord);
this.tabPage3.Controls.Add(this.txtCurrentTofs);
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Location = new System.Drawing.Point(4, 25);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
this.tabPage3.Size = new System.Drawing.Size(644, 623);
this.tabPage3.Size = new System.Drawing.Size(1237, 695);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Manual add LUT";
this.tabPage3.UseVisualStyleBackColor = true;
@@ -260,7 +211,7 @@
this.lblAvgDutTof.AutoSize = true;
this.lblAvgDutTof.Location = new System.Drawing.Point(235, 322);
this.lblAvgDutTof.Name = "lblAvgDutTof";
this.lblAvgDutTof.Size = new System.Drawing.Size(10, 13);
this.lblAvgDutTof.Size = new System.Drawing.Size(12, 16);
this.lblAvgDutTof.TabIndex = 60;
this.lblAvgDutTof.Text = "-";
//
@@ -269,7 +220,7 @@
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(235, 299);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(71, 13);
this.label7.Size = new System.Drawing.Size(87, 16);
this.label7.TabIndex = 59;
this.label7.Text = "Avg DUT Tof";
//
@@ -278,7 +229,7 @@
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(95, 299);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(90, 13);
this.label6.Size = new System.Drawing.Size(111, 16);
this.label6.TabIndex = 58;
this.label6.Text = "Avg Ref Temp C°";
//
@@ -287,7 +238,7 @@
this.lblDuration.AutoSize = true;
this.lblDuration.Location = new System.Drawing.Point(145, 47);
this.lblDuration.Name = "lblDuration";
this.lblDuration.Size = new System.Drawing.Size(10, 13);
this.lblDuration.Size = new System.Drawing.Size(12, 16);
this.lblDuration.TabIndex = 57;
this.lblDuration.Text = "-";
//
@@ -296,7 +247,7 @@
this.lblLines.AutoSize = true;
this.lblLines.Location = new System.Drawing.Point(145, 25);
this.lblLines.Name = "lblLines";
this.lblLines.Size = new System.Drawing.Size(10, 13);
this.lblLines.Size = new System.Drawing.Size(12, 16);
this.lblLines.TabIndex = 56;
this.lblLines.Text = "-";
//
@@ -305,7 +256,7 @@
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(94, 47);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(47, 13);
this.label5.Size = new System.Drawing.Size(58, 16);
this.label5.TabIndex = 55;
this.label5.Text = "Duration";
//
@@ -314,7 +265,7 @@
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(94, 25);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(32, 13);
this.label4.Size = new System.Drawing.Size(40, 16);
this.label4.TabIndex = 54;
this.label4.Text = "Lines";
//
@@ -380,88 +331,324 @@
this.txtCurrentTofs.Size = new System.Drawing.Size(380, 230);
this.txtCurrentTofs.TabIndex = 49;
//
// tabPage4
// AutomaticCalibrationTab
//
this.tabPage4.Controls.Add(this.dataGridView1);
this.tabPage4.Controls.Add(this.btnUpdateGrid);
this.tabPage4.Controls.Add(this.button2);
this.tabPage4.Controls.Add(this.button1);
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(644, 623);
this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "Auto Calibration";
this.tabPage4.UseVisualStyleBackColor = true;
this.AutomaticCalibrationTab.BackColor = System.Drawing.SystemColors.Window;
this.AutomaticCalibrationTab.Controls.Add(this.automaticContentBox);
this.AutomaticCalibrationTab.Controls.Add(this.autometicControlsSplitter);
this.AutomaticCalibrationTab.Controls.Add(this.automaticControlsPanel);
this.AutomaticCalibrationTab.Location = new System.Drawing.Point(4, 25);
this.AutomaticCalibrationTab.Margin = new System.Windows.Forms.Padding(0);
this.AutomaticCalibrationTab.Name = "AutomaticCalibrationTab";
this.AutomaticCalibrationTab.Size = new System.Drawing.Size(1237, 695);
this.AutomaticCalibrationTab.TabIndex = 3;
this.AutomaticCalibrationTab.Text = "Automatic Calibration";
//
// dataGridView1
// automaticContentBox
//
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Location = new System.Drawing.Point(27, 105);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.Size = new System.Drawing.Size(586, 324);
this.dataGridView1.TabIndex = 61;
this.automaticContentBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.automaticContentBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.automaticContentBox.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.automaticContentBox.Location = new System.Drawing.Point(331, 0);
this.automaticContentBox.Name = "automaticContentBox";
this.automaticContentBox.Size = new System.Drawing.Size(906, 695);
this.automaticContentBox.TabIndex = 2;
this.automaticContentBox.Text = "";
//
// btnUpdateGrid
// autometicControlsSplitter
//
this.btnUpdateGrid.Location = new System.Drawing.Point(148, 6);
this.btnUpdateGrid.Name = "btnUpdateGrid";
this.btnUpdateGrid.Size = new System.Drawing.Size(61, 61);
this.btnUpdateGrid.TabIndex = 60;
this.btnUpdateGrid.Text = "Update Grid";
this.btnUpdateGrid.UseVisualStyleBackColor = true;
this.btnUpdateGrid.Click += new System.EventHandler(this.btnUpdateGrid_Click);
this.autometicControlsSplitter.BackColor = System.Drawing.SystemColors.ScrollBar;
this.autometicControlsSplitter.Cursor = System.Windows.Forms.Cursors.VSplit;
this.autometicControlsSplitter.Location = new System.Drawing.Point(328, 0);
this.autometicControlsSplitter.Name = "autometicControlsSplitter";
this.autometicControlsSplitter.Size = new System.Drawing.Size(3, 695);
this.autometicControlsSplitter.TabIndex = 1;
this.autometicControlsSplitter.TabStop = false;
//
// button2
// automaticControlsPanel
//
this.button2.Location = new System.Drawing.Point(238, 6);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(89, 62);
this.button2.TabIndex = 59;
this.button2.Text = "End automatic";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
this.automaticControlsPanel.BackColor = System.Drawing.SystemColors.Menu;
this.automaticControlsPanel.Controls.Add(this.messurementExitAfterInMin);
this.automaticControlsPanel.Controls.Add(this.label12);
this.automaticControlsPanel.Controls.Add(this.messurementTOFTolerance);
this.automaticControlsPanel.Controls.Add(this.label42);
this.automaticControlsPanel.Controls.Add(this.stopAutomaticBtn);
this.automaticControlsPanel.Controls.Add(this.startAutomaticBtn);
this.automaticControlsPanel.Controls.Add(this.messurementToleranceInC);
this.automaticControlsPanel.Controls.Add(this.label11);
this.automaticControlsPanel.Controls.Add(this.messurementStep);
this.automaticControlsPanel.Controls.Add(this.label10);
this.automaticControlsPanel.Controls.Add(this.messurementDauerInMs);
this.automaticControlsPanel.Controls.Add(this.label8);
this.automaticControlsPanel.Controls.Add(this.temperatureChecksCount);
this.automaticControlsPanel.Controls.Add(this.label3);
this.automaticControlsPanel.Controls.Add(this.temperatureCheckInC);
this.automaticControlsPanel.Controls.Add(this.label2);
this.automaticControlsPanel.Controls.Add(this.temperatureCheckInMs);
this.automaticControlsPanel.Controls.Add(this.label1);
this.automaticControlsPanel.Dock = System.Windows.Forms.DockStyle.Left;
this.automaticControlsPanel.Location = new System.Drawing.Point(0, 0);
this.automaticControlsPanel.Name = "automaticControlsPanel";
this.automaticControlsPanel.Padding = new System.Windows.Forms.Padding(5);
this.automaticControlsPanel.Size = new System.Drawing.Size(328, 695);
this.automaticControlsPanel.TabIndex = 0;
//
// button1
// messurementTOFTolerance
//
this.button1.Location = new System.Drawing.Point(34, 6);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(89, 62);
this.button1.TabIndex = 58;
this.button1.Text = "Start automatic";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click_1);
this.messurementTOFTolerance.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.messurementTOFTolerance.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.messurementTOFTolerance.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.messurementTOFTolerance.Location = new System.Drawing.Point(5, 298);
this.messurementTOFTolerance.Margin = new System.Windows.Forms.Padding(0);
this.messurementTOFTolerance.Name = "messurementTOFTolerance";
this.messurementTOFTolerance.Size = new System.Drawing.Size(318, 24);
this.messurementTOFTolerance.TabIndex = 16;
//
// label42
//
this.label42.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label42.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.label42.Location = new System.Drawing.Point(5, 281);
this.label42.Margin = new System.Windows.Forms.Padding(5);
this.label42.Name = "label42";
this.label42.Size = new System.Drawing.Size(318, 18);
this.label42.TabIndex = 15;
this.label42.Text = "Messurement TOF tolerance in %";
this.label42.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
//
// stopAutomaticBtn
//
this.stopAutomaticBtn.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.stopAutomaticBtn.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.stopAutomaticBtn.Location = new System.Drawing.Point(5, 426);
this.stopAutomaticBtn.Margin = new System.Windows.Forms.Padding(5);
this.stopAutomaticBtn.Name = "stopAutomaticBtn";
this.stopAutomaticBtn.Padding = new System.Windows.Forms.Padding(0, 5, 0, 5);
this.stopAutomaticBtn.Size = new System.Drawing.Size(318, 36);
this.stopAutomaticBtn.TabIndex = 13;
this.stopAutomaticBtn.Text = "Stop messurement";
this.stopAutomaticBtn.UseVisualStyleBackColor = true;
this.stopAutomaticBtn.Click += new System.EventHandler(this.StopAutomaticBtn_Clicked);
//
// startAutomaticBtn
//
this.startAutomaticBtn.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.startAutomaticBtn.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.startAutomaticBtn.Location = new System.Drawing.Point(5, 380);
this.startAutomaticBtn.Margin = new System.Windows.Forms.Padding(5);
this.startAutomaticBtn.Name = "startAutomaticBtn";
this.startAutomaticBtn.Padding = new System.Windows.Forms.Padding(0, 5, 0, 5);
this.startAutomaticBtn.Size = new System.Drawing.Size(318, 36);
this.startAutomaticBtn.TabIndex = 12;
this.startAutomaticBtn.Text = "Start messurement";
this.startAutomaticBtn.UseVisualStyleBackColor = true;
this.startAutomaticBtn.Click += new System.EventHandler(this.StartAutomaticBtn_Clicked);
//
// messurementToleranceInC
//
this.messurementToleranceInC.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.messurementToleranceInC.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.messurementToleranceInC.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.messurementToleranceInC.Location = new System.Drawing.Point(5, 252);
this.messurementToleranceInC.Margin = new System.Windows.Forms.Padding(0);
this.messurementToleranceInC.Name = "messurementToleranceInC";
this.messurementToleranceInC.Size = new System.Drawing.Size(318, 24);
this.messurementToleranceInC.TabIndex = 11;
//
// label11
//
this.label11.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label11.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.label11.Location = new System.Drawing.Point(5, 235);
this.label11.Margin = new System.Windows.Forms.Padding(5);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(318, 18);
this.label11.TabIndex = 10;
this.label11.Text = "Messurement tolerance in °C";
this.label11.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
//
// messurementStep
//
this.messurementStep.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.messurementStep.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.messurementStep.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.messurementStep.Location = new System.Drawing.Point(5, 206);
this.messurementStep.Margin = new System.Windows.Forms.Padding(0);
this.messurementStep.Name = "messurementStep";
this.messurementStep.Size = new System.Drawing.Size(318, 24);
this.messurementStep.TabIndex = 9;
//
// label10
//
this.label10.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label10.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.label10.Location = new System.Drawing.Point(5, 189);
this.label10.Margin = new System.Windows.Forms.Padding(5);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(318, 18);
this.label10.TabIndex = 8;
this.label10.Text = "Messurement steps in miliseconds";
this.label10.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
//
// messurementDauerInMs
//
this.messurementDauerInMs.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.messurementDauerInMs.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.messurementDauerInMs.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.messurementDauerInMs.Location = new System.Drawing.Point(5, 160);
this.messurementDauerInMs.Margin = new System.Windows.Forms.Padding(0);
this.messurementDauerInMs.Name = "messurementDauerInMs";
this.messurementDauerInMs.Size = new System.Drawing.Size(318, 24);
this.messurementDauerInMs.TabIndex = 7;
//
// label8
//
this.label8.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label8.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.label8.Location = new System.Drawing.Point(5, 143);
this.label8.Margin = new System.Windows.Forms.Padding(5);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(318, 18);
this.label8.TabIndex = 6;
this.label8.Text = "Messurement dauer in miliseconds";
this.label8.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
//
// temperatureChecksCount
//
this.temperatureChecksCount.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.temperatureChecksCount.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.temperatureChecksCount.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.temperatureChecksCount.Location = new System.Drawing.Point(5, 114);
this.temperatureChecksCount.Margin = new System.Windows.Forms.Padding(0);
this.temperatureChecksCount.Name = "temperatureChecksCount";
this.temperatureChecksCount.Size = new System.Drawing.Size(318, 24);
this.temperatureChecksCount.TabIndex = 5;
//
// label3
//
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label3.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.label3.Location = new System.Drawing.Point(5, 97);
this.label3.Margin = new System.Windows.Forms.Padding(5);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(318, 18);
this.label3.TabIndex = 4;
this.label3.Text = "Temperature checks count";
this.label3.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
//
// temperatureCheckInC
//
this.temperatureCheckInC.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.temperatureCheckInC.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.temperatureCheckInC.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.temperatureCheckInC.Location = new System.Drawing.Point(5, 68);
this.temperatureCheckInC.Margin = new System.Windows.Forms.Padding(0);
this.temperatureCheckInC.Name = "temperatureCheckInC";
this.temperatureCheckInC.Size = new System.Drawing.Size(318, 24);
this.temperatureCheckInC.TabIndex = 3;
//
// label2
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label2.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.label2.Location = new System.Drawing.Point(5, 51);
this.label2.Margin = new System.Windows.Forms.Padding(5);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(318, 18);
this.label2.TabIndex = 2;
this.label2.Text = "Temperature checks in °C";
this.label2.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
//
// temperatureCheckInMs
//
this.temperatureCheckInMs.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.temperatureCheckInMs.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.temperatureCheckInMs.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.temperatureCheckInMs.Location = new System.Drawing.Point(5, 22);
this.temperatureCheckInMs.Margin = new System.Windows.Forms.Padding(0);
this.temperatureCheckInMs.MinimumSize = new System.Drawing.Size(2, 25);
this.temperatureCheckInMs.Name = "temperatureCheckInMs";
this.temperatureCheckInMs.Size = new System.Drawing.Size(318, 24);
this.temperatureCheckInMs.TabIndex = 1;
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label1.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.label1.Location = new System.Drawing.Point(5, 5);
this.label1.Margin = new System.Windows.Forms.Padding(5);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(318, 18);
this.label1.TabIndex = 0;
this.label1.Text = "Temperature checks in miliseconds";
this.label1.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
//
// timer3
//
this.timer3.Interval = 10000;
this.timer3.Tick += new System.EventHandler(this.timer3_Tick);
//
// button3
// mainMenuStrip
//
this.button3.Location = new System.Drawing.Point(641, 26);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(163, 47);
this.button3.TabIndex = 56;
this.button3.Text = "button3";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
this.mainMenuStrip.BackColor = System.Drawing.SystemColors.Control;
this.mainMenuStrip.Location = new System.Drawing.Point(0, 0);
this.mainMenuStrip.Name = "mainMenuStrip";
this.mainMenuStrip.Size = new System.Drawing.Size(1245, 24);
this.mainMenuStrip.TabIndex = 57;
this.mainMenuStrip.Text = "menuStrip1";
//
// messurementExitAfterInMin
//
this.messurementExitAfterInMin.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.messurementExitAfterInMin.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.messurementExitAfterInMin.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.messurementExitAfterInMin.Location = new System.Drawing.Point(5, 344);
this.messurementExitAfterInMin.Margin = new System.Windows.Forms.Padding(0);
this.messurementExitAfterInMin.Name = "messurementExitAfterInMin";
this.messurementExitAfterInMin.Size = new System.Drawing.Size(318, 24);
this.messurementExitAfterInMin.TabIndex = 18;
//
// label12
//
this.label12.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label12.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.label12.Location = new System.Drawing.Point(5, 327);
this.label12.Margin = new System.Windows.Forms.Padding(5);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(318, 18);
this.label12.TabIndex = 17;
this.label12.Text = "Exit when °C is not changing (in minutes) ";
this.label12.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
//
// FrmTempMeter
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1245, 780);
this.Controls.Add(this.button3);
this.Controls.Add(this.tabControl1);
this.Controls.Add(this.lblPcbId);
this.Controls.Add(this.label1);
this.Controls.Add(this.btnConnect);
this.Controls.Add(this.label2);
this.Controls.Add(this.cbComSlot);
this.ClientSize = new System.Drawing.Size(1245, 748);
this.Controls.Add(this.automaticCalibrationTabControl);
this.Controls.Add(this.mainMenuStrip);
this.MainMenuStrip = this.mainMenuStrip;
this.Name = "FrmTempMeter";
this.Text = "FrmTempMeter";
this.tabControl1.ResumeLayout(false);
this.automaticCalibrationTabControl.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
this.tabPage2.ResumeLayout(false);
@@ -469,23 +656,18 @@
this.tabPage3.ResumeLayout(false);
this.tabPage3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudRef)).EndInit();
this.tabPage4.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.AutomaticCalibrationTab.ResumeLayout(false);
this.automaticControlsPanel.ResumeLayout(false);
this.automaticControlsPanel.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnConnect;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox cbComSlot;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label lblPcbId;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Timer timer2;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabControl automaticCalibrationTabControl;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.Button btnRefreshLut;
private System.Windows.Forms.TextBox txtLuts;
@@ -506,12 +688,29 @@
private System.Windows.Forms.Button btnStopRecord;
private System.Windows.Forms.Button btnStartRecord;
private System.Windows.Forms.TextBox txtCurrentTofs;
private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button btnUpdateGrid;
private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.TabPage AutomaticCalibrationTab;
private System.Windows.Forms.Timer timer3;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.MenuStrip mainMenuStrip;
private System.Windows.Forms.RichTextBox automaticContentBox;
private System.Windows.Forms.Splitter autometicControlsSplitter;
private System.Windows.Forms.Panel automaticControlsPanel;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox temperatureCheckInMs;
private System.Windows.Forms.TextBox temperatureCheckInC;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox temperatureChecksCount;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox messurementDauerInMs;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.TextBox messurementStep;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.TextBox messurementToleranceInC;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Button stopAutomaticBtn;
private System.Windows.Forms.Button startAutomaticBtn;
private System.Windows.Forms.TextBox messurementTOFTolerance;
private System.Windows.Forms.Label label42;
private System.Windows.Forms.TextBox messurementExitAfterInMin;
private System.Windows.Forms.Label label12;
}
}
File diff suppressed because it is too large Load Diff
@@ -126,4 +126,7 @@
<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>
</root>
+10 -2
View File
@@ -25,7 +25,7 @@
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>2</ApplicationRevision>
<ApplicationVersion>1.5.0.%2a</ApplicationVersion>
<ApplicationVersion>2.6.0</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
@@ -43,7 +43,7 @@
<LangVersion>7.0</LangVersion>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<DocumentationFile>bin\Debug\Xylem.Common.Ui.GenesisToolBox.xml</DocumentationFile>
<NoWarn>1591</NoWarn>
<NoWarn>0003;1591;</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -417,13 +417,16 @@
<DependentUpon>FrmTempMeter.cs</DependentUpon>
</Compile>
<Compile Include="Infrastructure\ADLoginModel.cs" />
<Compile Include="Infrastructure\Appsettings.cs" />
<Compile Include="Infrastructure\Software.cs" />
<Compile Include="Infrastructure\SoftwareUser.cs" />
<Compile Include="Infrastructure\SoftwareVersion.cs" />
<Compile Include="Infrastructure\SoftwareFunctions.cs" />
<Compile Include="Infrastructure\TempMeterModels.cs" />
<Compile Include="Infrastructure\UserLoginModel.cs" />
<Compile Include="ProccessConfig.cs" />
<Compile Include="Program.cs" />
<Compile Include="ProgrammState.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="FrmLeagcyTestApp.cs">
<SubType>Form</SubType>
@@ -698,6 +701,10 @@
<Project>{a33e3c6d-eaae-4a20-a0ee-f9e6922fd029}</Project>
<Name>SoftwareAccessHelper</Name>
</ProjectReference>
<ProjectReference Include="..\..\TempFlansh\TempFlansh.csproj">
<Project>{62E5BA37-36AB-4F0A-BC12-554E7A1F1A39}</Project>
<Name>TempFlansh</Name>
</ProjectReference>
<ProjectReference Include="..\..\Utils\ByteArrayStyle\ByteArrayStyle.csproj">
<Project>{8a619cd5-6c8d-420c-a132-7946c6f13e6e}</Project>
<Name>ByteArrayStyle</Name>
@@ -731,6 +738,7 @@
<Content Include="RegAsm4.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Include="README.md" />
<None Include="Resources\SensusLogoXylem.JPG" />
</ItemGroup>
<ItemGroup>
@@ -10,6 +10,6 @@
<ErrorReportUrlHistory />
<FallbackCulture>de-DE</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
<ProjectView>ProjectFiles</ProjectView>
<ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup>
</Project>
@@ -0,0 +1,222 @@
namespace Xylem.Common.Ui.GenesisToolBox.Infrastructure
{
using System;
using System.ComponentModel;
using System.Configuration;
using System.Runtime.CompilerServices;
using System.Windows.Forms;
internal static class Appsettings
{
private const string EMPTY = "";
private static readonly Configuration configuration = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);
private class DefaultValues
{
public const int TemperatureCheckInMs = 6_000;
public const double TemperatureCheckInC = 1.00;
public const int TemperatureChecksCount = 10;
public const int MessurementDauerInMs = 600_000;
public const int MessurementStep = 10_000;
public const double MessurementToleranceInC = 0.05;
public const double MessurementTOFTolerance = 30.00;
public const int ExitWhenNotChangedInMin = 60;
}
public class AppsettingsModel : INotifyPropertyChanged
{
/// <summary>
/// The time in whitch should be checked for temperature changes greater than <see cref="TemperatureCheckInC"/>°C. By default: 1min * 60sec * 1000ms = 60_000ms.
/// After temperature change is detected, messurement should start for <see cref="MessurementDauerInMs"/> in tolerance from +/- <see cref="MessurementToleranceInC"/>°C.
/// </summary>
public string TemperatureCheckInMs
{
get => GetStringValue(DefaultValues.TemperatureCheckInMs);
set => this.NotifyPropertyChanged(value, DefaultValues.TemperatureCheckInMs);
}
/// <summary>
/// The mark on whitch should be notified for temperature change.
/// By default +/-1°C.
/// </summary>
public string TemperatureCheckInC
{
get => GetStringValue(DefaultValues.TemperatureCheckInC);
set => this.NotifyPropertyChanged(value, DefaultValues.TemperatureCheckInC);
}
/// <summary>
/// Describes after how many checks the temperature is counted as same.
/// By default 10.
/// </summary>
public string TemperatureChecksCount
{
get => GetStringValue(DefaultValues.TemperatureChecksCount);
set => this.NotifyPropertyChanged(value, DefaultValues.TemperatureChecksCount);
}
/// <summary>
/// Describes how long should be messured current temperature.
/// By default: 10min * 60sec * 1000ms = 600_000ms.
/// </summary>
public string MessurementDauerInMs
{
get => GetStringValue(DefaultValues.MessurementDauerInMs);
set => this.NotifyPropertyChanged(value, DefaultValues.MessurementDauerInMs);
}
/// <summary>
/// Describes in how many seconds schuld be messured.
/// By default: 10sec * 1000ms = 10_000ms.
/// </summary>
public string MessurementStep
{
get => GetStringValue(DefaultValues.MessurementStep);
set => this.NotifyPropertyChanged(value, DefaultValues.MessurementStep);
}
/// <summary>
/// Describes the temperature tolerance in whitch the messurement is valid.
/// If the tolerance is oversteped, the messurement is canceled.
/// By default: +/-0.05°C.
/// </summary>
public string MessurementToleranceInC
{
get => GetStringValue(DefaultValues.MessurementToleranceInC);
set => this.NotifyPropertyChanged(value, DefaultValues.MessurementToleranceInC);
}
/// <summary>
/// Describes the tolerance in whitch should all TOF's laying (in %).
/// By default: +/-30.00%.
/// </summary>
public string MessurementTOFTolerance
{
get => GetStringValue(DefaultValues.MessurementTOFTolerance);
set => this.NotifyPropertyChanged(value, DefaultValues.MessurementTOFTolerance);
}
/// <summary>
/// Describes in how mutch time schuld the messurement be canceled when temperature not changing.
/// </summary>
public string ExitWhenNotChangedInMin
{
get => GetStringValue(DefaultValues.ExitWhenNotChangedInMin);
set => this.NotifyPropertyChanged(value, DefaultValues.ExitWhenNotChangedInMin);
}
public event PropertyChangedEventHandler PropertyChanged;
protected void NotifyPropertyChanged<T>(object currentValue, T defaultValue, [CallerMemberName] string property = EMPTY)
{
try
{
currentValue = Convert.ChangeType(currentValue, typeof(T));
}
catch
{
currentValue = defaultValue;
}
currentValue.SetValue<T>(defaultValue, property);
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
}
}
public static AppsettingsModel Model { get; } = new AppsettingsModel();
/// <summary>
/// <see cref="AppsettingsModel.TemperatureCheckInMs"/>
/// </summary>
public static int TemperatureCheckInMs => GetValue(DefaultValues.TemperatureCheckInMs);
/// <summary>
/// <see cref="AppsettingsModel.TemperatureCheckInC"/>
/// </summary>
public static double TemperatureCheckInC => GetValue(DefaultValues.TemperatureCheckInC);
/// <summary>
/// <see cref="AppsettingsModel.TemperatureChecksCount"/>
/// </summary>
public static int TemperatureChecksCount => GetValue(DefaultValues.TemperatureChecksCount);
/// <summary>
/// <see cref="AppsettingsModel.MessurementDauerInMs"/>
/// </summary>
public static int MessurementDauerInMs => GetValue(DefaultValues.MessurementDauerInMs);
/// <summary>
/// <see cref="AppsettingsModel.MessurementStep"/>
/// </summary>
public static int MessurementStep => GetValue(DefaultValues.MessurementStep);
/// <summary>
/// <see cref="AppsettingsModel.MessurementToleranceInC"/>
/// </summary>
public static double MessurementToleranceInC => GetValue(DefaultValues.MessurementToleranceInC);
/// <summary>
/// <see cref="AppsettingsModel.MessurementTOFTolerance"/>
/// </summary>
public static double MessurementTOFTolerance => GetValue(DefaultValues.MessurementTOFTolerance);
/// <summary>
/// <see cref="AppsettingsModel.ExitWhenNotChangedInMin"/>
/// </summary>
public static int ExitWhenNotChangedInMin => GetValue(DefaultValues.ExitWhenNotChangedInMin);
private static int GetValue(int defaultValue, [CallerMemberName] string property = EMPTY)
{
var setting = configuration.AppSettings.Settings[property]?.Value;
if (int.TryParse($"{setting}", out var value))
{
return value;
}
return defaultValue;
}
private static double GetValue(double defaultValue, [CallerMemberName] string property = EMPTY)
{
var setting = configuration.AppSettings.Settings[property]?.Value;
if (double.TryParse($"{setting}", out var value))
{
return value;
}
return defaultValue;
}
private static string GetStringValue(object defaultValue, string format = EMPTY, [CallerMemberName] string property = EMPTY)
{
return configuration.AppSettings.Settings[property]?.Value ?? defaultValue?.ToString();
}
private static void SetValue<T>(this object value, object @default, [CallerMemberName] string property = EMPTY)
{
if (value == null || value.Equals(default(T)))
{
value = @default;
}
var saved = configuration.AppSettings.Settings[property];
var currentValue = $"{value}";
if (saved is null)
{
configuration.AppSettings.Settings.Add(property, currentValue);
}
else
{
configuration.AppSettings.Settings[property].Value = currentValue;
}
configuration.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings");
}
}
}
@@ -0,0 +1,430 @@
namespace Xylem.Common.Ui.GenesisToolBox.Infrastructure
{
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.IO.Pipes;
using System.Linq;
using System.Timers;
public class CordonelTempLut
{
public int Id { get; set; }
public int PcbId { get; set; }
public double RefTempC { get; set; }
public double AvgTof { get; set; }
public bool Active { get; set; }
public DateTime? Timestamp { get; set; }
}
public class RefTempRange
{
public Double Min { get; set; }
public Double Max { get; set; }
}
public class LutTemp
{
public int PcbId { get; set; }
public int FromTempC { get; set; }
public int ToTempC { get; set; }
public double? AvgRefTempC { get; set; }
public ICollection<double> ListOfRecordedTofs { get; set; } = new List<double>();
public double? AvgTofs { get; set; }
}
internal enum ProgrammState
{
Start,
Connected,
RecordRuning,
RecordStoped,
RecodCalculated,
}
internal struct Messurement
{
public double T { get; set; }
public double TOF { get; set; }
public DateTime DTS { get; set; }
}
internal class AutomaticTemperatureCalibration
{
private readonly int messurementsCount;
private readonly Func<double> tofSource;
private readonly Timer temperatureWatcher;
private readonly Timer messurementWatcher;
private readonly ICollection<Messurement> messurements;
private int messurmentN;
private double referenceT;
private bool waitingChanges;
private int temperatureChecks;
private int temperatureErrors;
private StreamReader streamReader;
private NamedPipeClientStream pipeStream;
private DateTime? timestamp;
public AutomaticTemperatureCalibration(Func<double> tofSource)
{
this.tofSource = tofSource;
// Instead of time tracking,
this.messurementsCount = Appsettings.MessurementDauerInMs / Appsettings.MessurementStep;
this.temperatureWatcher = new Timer(Appsettings.TemperatureCheckInMs);
this.temperatureWatcher.Elapsed += this.CheckTemperature;
this.messurementWatcher = new Timer(Appsettings.MessurementStep);
this.messurementWatcher.Elapsed += this.Messure;
this.waitingChanges = true;
this.messurements = new List<Messurement>();
}
public event Action Start;
public event Action Stop;
public event Action<string> InfoMessage;
public event Action<string> ErrorMessage;
public event Action<string> WarningMessage;
public event Action<double, double, DateTime> TemperatureMesured;
public void StartMessuring()
{
this.Info(string.Empty);
this.Info($"================================");
this.Info($"[INFO] Starting messurements ...");
if (this.tofSource != null)
{
try
{
this.pipeStream = new NamedPipeClientStream(".", "TempPipe", PipeDirection.In);
this.pipeStream.Connect(3000);
}
catch (Exception e)
{
this.Error(e.Message);
this.Stop?.Invoke();
}
if (this.pipeStream.IsConnected)
{
this.streamReader = new StreamReader(this.pipeStream);
this.StopMessurementWatcher();
this.StartTemperatureWatcher();
this.Start?.Invoke();
}
}
else
{
this.Stop?.Invoke();
this.Info($"\tTOF source is missing.");
}
}
public void StopMessuring()
{
this.Info(string.Empty);
if (this.tofSource != null)
{
this.StopMessurementWatcher();
this.StopTemperatureWatcher();
this.streamReader.Dispose();
this.pipeStream.Close();
}
this.Stop?.Invoke();
this.Info($"[INFO] Messurements canceled.");
this.Info($"=============================");
this.Info(string.Empty);
}
private void Info(string message)
=> this.InfoMessage?.Invoke(message);
private void Warning(string message)
=> this.WarningMessage?.Invoke(message);
private void Error(string message)
=> this.ErrorMessage?.Invoke(message);
private void StartTemperatureWatcher()
{
this.temperatureWatcher.AutoReset = true;
this.temperatureWatcher.Enabled = true;
this.temperatureWatcher.Start();
}
private void StopTemperatureWatcher()
{
this.temperatureWatcher.Stop();
this.temperatureWatcher.Enabled = false;
this.temperatureWatcher.AutoReset = false;
}
private void StartMessurementWatcher()
{
this.messurmentN = 1;
this.messurementWatcher.AutoReset = true;
this.messurementWatcher.Enabled = true;
this.messurementWatcher.Start();
}
private void StopMessurementWatcher()
{
this.messurmentN = 1;
this.messurementWatcher.Stop();
this.messurementWatcher.Enabled = false;
this.messurementWatcher.AutoReset = false;
}
private void CheckTemperature(object sender, ElapsedEventArgs args)
{
// Default start number.
const int start = 1;
// If reading of the reference temperature succeeds.
if (this.TryGetReferenceT(out var referenceT))
{
// Calculating the absolute difference to the previouse temperature.
var differenceT = Math.Abs(this.referenceT - referenceT);
if (this.waitingChanges && differenceT < Appsettings.TemperatureCheckInC)
{
// Reset counter to default.
this.temperatureChecks = 0;
this.Warning($"[CHECK] Temperature is not changed {this.referenceT,5:0.00} <=> {referenceT,5:0.00}°C difference {differenceT,5:0.00}°C {args.SignalTime:hh:mm:ss.fff}ms");
if (this.timestamp.HasValue && Math.Abs((args.SignalTime - this.timestamp.Value).TotalMinutes) > Appsettings.ExitWhenNotChangedInMin)
{
this.StopMessuring();
}
return;
}
this.timestamp = args.SignalTime;
// If difference is greater or equal than configured, reset counter and start tracking the new temperature.
if (differenceT >= Appsettings.TemperatureCheckInC)
{
if (this.temperatureChecks == 0)
{
this.Info(string.Empty);
this.Info($"[CHECK] Start counting: {Appsettings.TemperatureChecksCount} times for {referenceT:0.00}°C +/-{Appsettings.MessurementToleranceInC:0.00}°C");
}
this.waitingChanges = false;
// Start counting from 1.
this.temperatureChecks = start;
// Saving current temperature for fuhrter comparisons.
this.referenceT = referenceT;
var t = differenceT == referenceT ? 0 : differenceT;
this.Info($"[CHECK] {this.temperatureChecks, 2}. {referenceT, 5:0.00}°C difference {t, 5:0.00}°C {args.SignalTime:hh:mm:ss.fff}ms");
}
// If tolerance is smaller or equal than configured,
else if (differenceT <= Appsettings.MessurementToleranceInC)
{
// the temperature is same also continue counting.
this.temperatureChecks++;
this.Info($"[CHECK] {this.temperatureChecks, 2}. {referenceT, 5:0.00}°C difference {differenceT, 5:0.00}°C {args.SignalTime:hh:mm:ss.fff}ms");
}
// If counter reaches configured counts then start messurement for configured time.
if (this.temperatureChecks == Appsettings.TemperatureChecksCount)
{
this.waitingChanges = true;
// Reset counter to default.
this.temperatureChecks = 0;
// Next call breaks current method execution.
this.StopTemperatureWatcher();
// Next call starts new messurement as configured.
this.StartMessurementWatcher();
this.Info(string.Empty);
this.Info($"[INFO] Starting messurement - {args.SignalTime: yyyy-MM-dd hh:mm:ss.ffff}, {Appsettings.MessurementStep}ms for {Appsettings.MessurementDauerInMs}ms");
}
}
else
{
this.waitingChanges = true;
// Reset counter to default.
this.temperatureChecks = 0;
// Reset temperature to default.
this.referenceT = default(double);
this.Info(string.Empty);
this.Warning($"[WARNING] Reading reference temperature failed, resseting state.");
}
}
private void Messure(object sender, ElapsedEventArgs args)
{
// If reading of the reference temperature succeeds ...
if (this.TryGetReferenceT(out var referenceT))
{
var differenceT = Math.Abs(this.referenceT - referenceT);
// If the absolute difference is in expected tolerance.
if (differenceT <= Appsettings.MessurementToleranceInC)
{
this.referenceT = referenceT;
var currentTOF = this.tofSource();
var hasValidTOF = true;
this.Info($"[INFO] {this.messurmentN, 2}. {currentTOF, 19:F18}, {referenceT, 5:0.00}°C, +/-{differenceT, 5:0.00}°C, {args.SignalTime:hh:mm:ss.fff}ms");
// For some LINQ expressions the collection should have at least 1 item in it.
if (this.messurements.Any())
{
// For instance if the tolerance is 30% => 30 / 100 = 0.3
var tolerance = Appsettings.MessurementTOFTolerance / 100;
// Calculating min tolerance: (if TOF = 1) * (1.00 - 0.3 = 0.7) = 0.7 is the min tolerance.
var min = this.messurements.Min(x => x.TOF) * (1.00 - tolerance);
// Calculating max tolerance: (if TOF = 1) * (1.00 + 0.3 = 1.3) = 1.3 is the max tolerance.
var max = this.messurements.Max(x => x.TOF) * (1.00 + tolerance);
// Determinates wheter current TOF is between min and max tolerance
hasValidTOF = currentTOF >= min && currentTOF <= max;
if (!hasValidTOF)
{
this.Error($"[ERROR] Invalid TOF: {currentTOF}");
}
}
// When current TOF is between min and max tolerance
if (hasValidTOF)
{
// New messurement record is created and added to the messurements.
this.messurements.Add(new Messurement
{
T = referenceT,
TOF = currentTOF,
DTS = args.SignalTime
});
}
}
// Else the absolute difference was greater than expected.
else if (differenceT >= Appsettings.TemperatureCheckInC)
{
// Sets the messurements to the calculated count.
// This should breack current method execution in the next step.
this.messurmentN = this.messurementsCount;
this.Warning($"[WARNING] {referenceT:0.00}°C overstepped the tolerance of +/-{Appsettings.TemperatureCheckInC:0.00}.");
}
else
{
this.temperatureErrors++;
this.Warning($"[WARNING] {referenceT:0.00}°C overstepped the tolerance of +/-{Appsettings.MessurementToleranceInC:0.00}.");
this.Warning($"[WARNING] Next time current messurment will be canceled.");
}
// In each case counts 1 more.
this.messurmentN++;
}
else
{
this.Warning($"[WARNING] Reading reference temperature failed.");
}
// If the messurements count is reached.
if (this.messurmentN > this.messurementsCount || this.temperatureErrors > 2)
{
// Calculates the time difference between first and last messurement times.
var timespan = this.messurements.LastOrDefault().DTS - this.messurements.FirstOrDefault().DTS;
// If there are enough messurements, more than the half of the Appsettings.MessurementDauerInMs.
if (timespan.TotalMilliseconds > Appsettings.MessurementDauerInMs / 2)
{
// Average temperature is calculated.
var tmp = this.messurements.Average(x => x.T);
// Average times od flights is calculated.
var tof = this.messurements.Average(x => x.TOF);
this.Info($"[INFO] Data collected over {timespan}, sending average values ...");
// Notifies whit the average values and a timestamp that the messurement is completed.
this.TemperatureMesured?.Invoke(tmp, tof, args.SignalTime);
// All existing messurements are cleared.
this.messurements.Clear();
this.Info($"[SENT] {tmp, 5} {tof, 19} {args.SignalTime}");
}
else
{
this.Error($"[ERROR] {timespan.Milliseconds}ms <= {Appsettings.MessurementDauerInMs / 2}");
}
this.messurmentN = 1;
// In each case, when the messuremens count is reached current method execution should be stopped.
this.StopMessurementWatcher();
// Next call starts seeking for new temperature change.
this.StartTemperatureWatcher();
this.Info($"[INFO] Messurement is done.");
this.Info(string.Empty);
}
}
private bool TryGetReferenceT(out double referenceT)
{
referenceT = 0;
var succeeded = false;
var readAttempts = 1;
var value = string.Empty;
try
{
do
{
lock (this.streamReader)
{
value = this.streamReader.ReadLine();
}
if (double.TryParse(value, NumberStyles.Any, new CultureInfo("de"), out referenceT)
|| double.TryParse(value, NumberStyles.Any, new CultureInfo("us"), out referenceT))
{
succeeded = true;
break;
}
System.Threading.Thread.Sleep(10);
} while (readAttempts++ <= 1000);
}
catch (Exception e)
{
this.Error(e.Message);
}
return succeeded;
}
}
}
+10
View File
@@ -0,0 +1,10 @@
namespace Xylem.Common.Ui.GenesisToolBox
{
internal enum ProgrammState
{
Start,
Connected,
RecordRuning,
RecordStoped
}
}
+6 -6
View File
@@ -661,8 +661,8 @@ namespace Xylem.Common.Ui.GenesisToolBox
//var regDef = _currentGenesis.GetRegisterDefinitionByName(reg);
SetProgreess($"Read Register {regDef.RegisterName}", total, done + 1);
if (regDef.RegisterDetail != null && (
regDef.RegisterDetail.Privilege.Lvl8 == Access.Ro ||
regDef.RegisterDetail.Privilege.Lvl8 == Access.Rw))
regDef.RegisterDetail.Privilege.Lvl8 == Access.RO ||
regDef.RegisterDetail.Privilege.Lvl8 == Access.RW))
{
try
{
@@ -755,8 +755,8 @@ namespace Xylem.Common.Ui.GenesisToolBox
{
((DataRow)rowItem)["RawValueFile"] = keyValue.value;
if (regDef.RegisterDetail.Privilege.Lvl8 == Access.Ro ||
regDef.RegisterDetail.Privilege.Lvl8 == Access.Rw)
if (regDef.RegisterDetail.Privilege.Lvl8 == Access.RO ||
regDef.RegisterDetail.Privilege.Lvl8 == Access.RW)
{
Byte[] rawRegister;
if (regDef.DataType == typeof(String) || regDef.DataType == typeof(Int64) ||
@@ -1454,8 +1454,8 @@ namespace Xylem.Common.Ui.GenesisToolBox
foreach (var VARIABLE in List)
{
if ((VARIABLE.RegisterDetail.Privilege.Lvl8 == Access.Ro
|| VARIABLE.RegisterDetail.Privilege.Lvl8 == Access.Rw)
if ((VARIABLE.RegisterDetail.Privilege.Lvl8 == Access.RO
|| VARIABLE.RegisterDetail.Privilege.Lvl8 == Access.RW)
)
{
var a = _currentGenesis.ReadRegister(VARIABLE.GetIdent());
@@ -117,10 +117,6 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\MJK\Code\C#\modbus_master_csharp\src\modbus_master_csharp\modbus_master_csharp.csproj">
<Project>{F14940F8-3C86-4BB7-A915-B021E4B3052D}</Project>
<Name>modbus_master_csharp</Name>
</ProjectReference>
<ProjectReference Include="..\..\CommonCore\CommonCore.csproj">
<Project>{1B02C79E-0B19-43E2-8F6B-71EF0C786C97}</Project>
<Name>CommonCore</Name>