From 14e8e2f267c16190e7412a89254c744ad4b71952 Mon Sep 17 00:00:00 2001 From: Wesley Hofman Date: Mon, 15 Sep 2025 20:24:09 +0200 Subject: [PATCH] Various updates --- HTOLHAST/Agilent34970a.cs | 34 +- HTOLHAST/App.config | 8 + HTOLHAST/Form1.Designer.cs | 716 +++++++++++-------------- HTOLHAST/Form1.cs | 483 ++++++++++++++++- HTOLHAST/Form1.resx | 60 --- HTOLHAST/FormSelectProject.Designer.cs | 58 ++ HTOLHAST/FormSelectProject.cs | 30 ++ HTOLHAST/FormSelectProject.resx | 120 +++++ HTOLHAST/HMP4040.cs | 37 +- HTOLHAST/HTOLHAST.csproj | 55 ++ HTOLHAST/HeaderSetting.cs | 22 + HTOLHAST/Keithley6485.cs | 19 +- HTOLHAST/Measurement.cs | 30 ++ HTOLHAST/PowerSupplySetting.cs | 23 + HTOLHAST/Sample.cs | 1 - HTOLHAST/ScpiInstrument.cs | 2 +- HTOLHAST/SwitchMatrix.cs | 16 + HTOLHAST/packages.config | 10 + 18 files changed, 1241 insertions(+), 483 deletions(-) create mode 100644 HTOLHAST/FormSelectProject.Designer.cs create mode 100644 HTOLHAST/FormSelectProject.cs create mode 100644 HTOLHAST/FormSelectProject.resx create mode 100644 HTOLHAST/HeaderSetting.cs create mode 100644 HTOLHAST/Measurement.cs create mode 100644 HTOLHAST/PowerSupplySetting.cs create mode 100644 HTOLHAST/SwitchMatrix.cs diff --git a/HTOLHAST/Agilent34970a.cs b/HTOLHAST/Agilent34970a.cs index 7a71e93..e81abb5 100644 --- a/HTOLHAST/Agilent34970a.cs +++ b/HTOLHAST/Agilent34970a.cs @@ -8,18 +8,40 @@ namespace HTOLHAST { public class Agilent34970a : SCPIInstrument { + //00926 20 Channel Actuator / GP Switch Module SLOT1 + //02700 20 Channel Multiplexer Module (BLR) SLOT2 + public Agilent34970a(string resourceString) : base(resourceString) { } - public override Sample CreateSample(string response) + public Sample MeasureVolt(int channel) + { + string Channel = channel.ToString(); + WriteCommand($"MEAS:VOLT:DC? (@{channel})"); + string response = ReadResponse(); + Console.WriteLine($"[Agilent] Measured Voltage : {response}"); + Sample sample = CreateSample(response, "V"); + return sample; + } + public void CloseChannel(int channel) + { + WriteCommand($"ROUT:CLOS (@{channel})"); + } + public void OpenChannel(int channel) + { + WriteCommand($"ROUT:OPEN (@{channel})"); + } + public void ConfigVoltageChannel(int channel) + { + string Channel = channel.ToString(); + WriteCommand($"CONF:VOLT:DC (@{channel})"); + } + public override Sample CreateSample(string response, string unit) { string Response = response; - // Parse the Keithley output - string[] parts = Response.Split(','); - - if (parts.Length >= 1 && double.TryParse(parts[0].Replace("V", ""), out double current)) + if (double.TryParse(Response, out double voltage)) { - Agilent34970aSample sample = new Agilent34970aSample(DateTime.Now, current, "V"); + Agilent34970aSample sample = new Agilent34970aSample(DateTime.Now, voltage, unit); // Optionally, store or process the sample here Console.WriteLine($"[Agilent34970] Sample Created, Value: {sample.Value} {sample.Unit}"); diff --git a/HTOLHAST/App.config b/HTOLHAST/App.config index 24c49e7..4c9e6f9 100644 --- a/HTOLHAST/App.config +++ b/HTOLHAST/App.config @@ -19,4 +19,12 @@ + + + + + + + + \ No newline at end of file diff --git a/HTOLHAST/Form1.Designer.cs b/HTOLHAST/Form1.Designer.cs index e518890..db9f417 100644 --- a/HTOLHAST/Form1.Designer.cs +++ b/HTOLHAST/Form1.Designer.cs @@ -31,13 +31,12 @@ namespace HTOLHAST { this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPageInstruments = new System.Windows.Forms.TabPage(); + this.btnInitializeInstruments = new System.Windows.Forms.Button(); this.cbPAMEnabled = new System.Windows.Forms.CheckBox(); this.cbPSU2Enabled = new System.Windows.Forms.CheckBox(); - this.cbDAQEnabled = new System.Windows.Forms.CheckBox(); - this.cbPSU1Enabled = new System.Windows.Forms.CheckBox(); this.label11 = new System.Windows.Forms.Label(); this.panel1 = new System.Windows.Forms.Panel(); - this.textBox7 = new System.Windows.Forms.TextBox(); + this.tbPamMaxCurrent = new System.Windows.Forms.TextBox(); this.textBox8 = new System.Windows.Forms.TextBox(); this.label13 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); @@ -63,12 +62,19 @@ namespace HTOLHAST this.label1 = new System.Windows.Forms.Label(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.tabPagePSUSettings = new System.Windows.Forms.TabPage(); + this.btnSendPsuSettings = new System.Windows.Forms.Button(); + this.cbCH8 = new System.Windows.Forms.CheckBox(); + this.cbCH7 = new System.Windows.Forms.CheckBox(); + this.cbCH6 = new System.Windows.Forms.CheckBox(); + this.cbCH5 = new System.Windows.Forms.CheckBox(); + this.cbCH4 = new System.Windows.Forms.CheckBox(); + this.cbCH3 = new System.Windows.Forms.CheckBox(); + this.cbCH2 = new System.Windows.Forms.CheckBox(); + this.cbCH1 = new System.Windows.Forms.CheckBox(); this.button12 = new System.Windows.Forms.Button(); this.button13 = new System.Windows.Forms.Button(); this.button11 = new System.Windows.Forms.Button(); this.button10 = new System.Windows.Forms.Button(); - this.button2 = new System.Windows.Forms.Button(); - this.button1 = new System.Windows.Forms.Button(); this.label15 = new System.Windows.Forms.Label(); this.dataGridView3 = new System.Windows.Forms.DataGridView(); this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -77,38 +83,24 @@ namespace HTOLHAST this.Channel = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Delay = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.label14 = new System.Windows.Forms.Label(); - this.button9 = new System.Windows.Forms.Button(); - this.button8 = new System.Windows.Forms.Button(); - this.button7 = new System.Windows.Forms.Button(); - this.button6 = new System.Windows.Forms.Button(); - this.button5 = new System.Windows.Forms.Button(); - this.button4 = new System.Windows.Forms.Button(); - this.dataGridView1 = new System.Windows.Forms.DataGridView(); - this.Supply = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Description = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.VSetpoint = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Tolerance = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.CurrentLimitTotal = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dgvPowerSupplies = new System.Windows.Forms.DataGridView(); this.tabPageHeader = new System.Windows.Forms.TabPage(); - this.dataGridView6 = new System.Windows.Forms.DataGridView(); - this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.dataGridViewTextBoxColumn6 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dgvHeaderSettings = new System.Windows.Forms.DataGridView(); this.tabPageMeasurement = new System.Windows.Forms.TabPage(); - this.textBox11 = new System.Windows.Forms.TextBox(); - this.textBox10 = new System.Windows.Forms.TextBox(); + this.tbStepDescription = new System.Windows.Forms.Label(); + this.tbSubProjectDescription = new System.Windows.Forms.Label(); + this.tbProjectDescription = new System.Windows.Forms.Label(); + this.btnSelectProject = new System.Windows.Forms.Button(); + this.tbCurrentPosition = new System.Windows.Forms.TextBox(); + this.tbPositionIncrement = new System.Windows.Forms.TextBox(); this.label18 = new System.Windows.Forms.Label(); this.label17 = new System.Windows.Forms.Label(); - this.button17 = new System.Windows.Forms.Button(); + this.btnClear = new System.Windows.Forms.Button(); this.button16 = new System.Windows.Forms.Button(); - this.button15 = new System.Windows.Forms.Button(); - this.button14 = new System.Windows.Forms.Button(); - this.textBox9 = new System.Windows.Forms.TextBox(); - this.label16 = new System.Windows.Forms.Label(); - this.dataGridView4 = new System.Windows.Forms.DataGridView(); - this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.btnInitializeInstruments = new System.Windows.Forms.Button(); + this.btnNextPosition = new System.Windows.Forms.Button(); + this.btnMeasure = new System.Windows.Forms.Button(); + this.tbProject = new System.Windows.Forms.Label(); + this.dgvMeasurements = new System.Windows.Forms.DataGridView(); this.tabControl1.SuspendLayout(); this.tabPageInstruments.SuspendLayout(); this.panel1.SuspendLayout(); @@ -119,11 +111,11 @@ namespace HTOLHAST this.tabPagePSUSettings.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.dgvPowerSupplies)).BeginInit(); this.tabPageHeader.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView6)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.dgvHeaderSettings)).BeginInit(); this.tabPageMeasurement.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView4)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.dgvMeasurements)).BeginInit(); this.SuspendLayout(); // // tabControl1 @@ -144,8 +136,6 @@ namespace HTOLHAST this.tabPageInstruments.Controls.Add(this.btnInitializeInstruments); this.tabPageInstruments.Controls.Add(this.cbPAMEnabled); this.tabPageInstruments.Controls.Add(this.cbPSU2Enabled); - this.tabPageInstruments.Controls.Add(this.cbDAQEnabled); - this.tabPageInstruments.Controls.Add(this.cbPSU1Enabled); this.tabPageInstruments.Controls.Add(this.label11); this.tabPageInstruments.Controls.Add(this.panel1); this.tabPageInstruments.Controls.Add(this.tbResourceStringPAM); @@ -173,13 +163,23 @@ namespace HTOLHAST this.tabPageInstruments.Text = "Instruments"; this.tabPageInstruments.UseVisualStyleBackColor = true; // + // btnInitializeInstruments + // + this.btnInitializeInstruments.Location = new System.Drawing.Point(775, 438); + this.btnInitializeInstruments.Name = "btnInitializeInstruments"; + this.btnInitializeInstruments.Size = new System.Drawing.Size(117, 47); + this.btnInitializeInstruments.TabIndex = 23; + this.btnInitializeInstruments.Text = "Initialize Instruments"; + this.btnInitializeInstruments.UseVisualStyleBackColor = true; + this.btnInitializeInstruments.Click += new System.EventHandler(this.btnInitializeInstruments_Click); + // // cbPAMEnabled // this.cbPAMEnabled.AutoSize = true; this.cbPAMEnabled.Location = new System.Drawing.Point(618, 271); this.cbPAMEnabled.Margin = new System.Windows.Forms.Padding(2); this.cbPAMEnabled.Name = "cbPAMEnabled"; - this.cbPAMEnabled.Size = new System.Drawing.Size(59, 17); + this.cbPAMEnabled.Size = new System.Drawing.Size(68, 19); this.cbPAMEnabled.TabIndex = 22; this.cbPAMEnabled.Text = "Enable"; this.cbPAMEnabled.UseVisualStyleBackColor = true; @@ -190,46 +190,24 @@ namespace HTOLHAST this.cbPSU2Enabled.Location = new System.Drawing.Point(262, 271); this.cbPSU2Enabled.Margin = new System.Windows.Forms.Padding(2); this.cbPSU2Enabled.Name = "cbPSU2Enabled"; - this.cbPSU2Enabled.Size = new System.Drawing.Size(59, 17); + this.cbPSU2Enabled.Size = new System.Drawing.Size(68, 19); this.cbPSU2Enabled.TabIndex = 21; this.cbPSU2Enabled.Text = "Enable"; this.cbPSU2Enabled.UseVisualStyleBackColor = true; // - // cbDAQEnabled - // - this.cbDAQEnabled.AutoSize = true; - this.cbDAQEnabled.Location = new System.Drawing.Point(618, 24); - this.cbDAQEnabled.Margin = new System.Windows.Forms.Padding(2); - this.cbDAQEnabled.Name = "cbDAQEnabled"; - this.cbDAQEnabled.Size = new System.Drawing.Size(59, 17); - this.cbDAQEnabled.TabIndex = 20; - this.cbDAQEnabled.Text = "Enable"; - this.cbDAQEnabled.UseVisualStyleBackColor = true; - // - // cbPSU1Enabled - // - this.cbPSU1Enabled.AutoSize = true; - this.cbPSU1Enabled.Location = new System.Drawing.Point(262, 24); - this.cbPSU1Enabled.Margin = new System.Windows.Forms.Padding(2); - this.cbPSU1Enabled.Name = "cbPSU1Enabled"; - this.cbPSU1Enabled.Size = new System.Drawing.Size(59, 17); - this.cbPSU1Enabled.TabIndex = 19; - this.cbPSU1Enabled.Text = "Enable"; - this.cbPSU1Enabled.UseVisualStyleBackColor = true; - // // label11 // this.label11.AutoSize = true; this.label11.Location = new System.Drawing.Point(772, 28); this.label11.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(91, 13); + this.label11.Size = new System.Drawing.Size(100, 15); this.label11.TabIndex = 18; this.label11.Text = "CURRENT LIMIT"; // // panel1 // - this.panel1.Controls.Add(this.textBox7); + this.panel1.Controls.Add(this.tbPamMaxCurrent); this.panel1.Controls.Add(this.textBox8); this.panel1.Controls.Add(this.label13); this.panel1.Controls.Add(this.label10); @@ -244,13 +222,14 @@ namespace HTOLHAST this.panel1.Size = new System.Drawing.Size(348, 149); this.panel1.TabIndex = 17; // - // textBox7 + // tbPamMaxCurrent // - this.textBox7.Location = new System.Drawing.Point(266, 63); - this.textBox7.Margin = new System.Windows.Forms.Padding(2); - this.textBox7.Name = "textBox7"; - this.textBox7.Size = new System.Drawing.Size(76, 20); - this.textBox7.TabIndex = 23; + this.tbPamMaxCurrent.Location = new System.Drawing.Point(266, 63); + this.tbPamMaxCurrent.Margin = new System.Windows.Forms.Padding(2); + this.tbPamMaxCurrent.Name = "tbPamMaxCurrent"; + this.tbPamMaxCurrent.Size = new System.Drawing.Size(76, 20); + this.tbPamMaxCurrent.TabIndex = 23; + this.tbPamMaxCurrent.Text = "0.02"; // // textBox8 // @@ -266,7 +245,7 @@ namespace HTOLHAST this.label13.Location = new System.Drawing.Point(290, 15); this.label13.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(30, 13); + this.label13.Size = new System.Drawing.Size(33, 15); this.label13.TabIndex = 21; this.label13.Text = "MAX"; // @@ -276,7 +255,7 @@ namespace HTOLHAST this.label10.Location = new System.Drawing.Point(194, 15); this.label10.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(27, 13); + this.label10.Size = new System.Drawing.Size(30, 15); this.label10.TabIndex = 20; this.label10.Text = "MIN"; // @@ -286,7 +265,7 @@ namespace HTOLHAST this.label12.Location = new System.Drawing.Point(2, 63); this.label12.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(136, 13); + this.label12.Size = new System.Drawing.Size(150, 15); this.label12.TabIndex = 19; this.label12.Text = "PICOAM MAX CURRENT: "; // @@ -322,7 +301,7 @@ namespace HTOLHAST this.label9.Location = new System.Drawing.Point(2, 40); this.label9.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(169, 13); + this.label9.Size = new System.Drawing.Size(185, 15); this.label9.TabIndex = 0; this.label9.Text = "DATALOGGER MAX CURRENT: "; // @@ -333,6 +312,7 @@ namespace HTOLHAST this.tbResourceStringPAM.Name = "tbResourceStringPAM"; this.tbResourceStringPAM.Size = new System.Drawing.Size(184, 20); this.tbResourceStringPAM.TabIndex = 15; + this.tbResourceStringPAM.Text = "ASRL3::INSTR"; // // label8 // @@ -340,7 +320,7 @@ namespace HTOLHAST this.label8.Location = new System.Drawing.Point(394, 465); this.label8.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(86, 13); + this.label8.Size = new System.Drawing.Size(93, 15); this.label8.TabIndex = 14; this.label8.Text = "VISA ADDRESS"; // @@ -351,6 +331,7 @@ namespace HTOLHAST this.tbResourceStringDAQ.Name = "tbResourceStringDAQ"; this.tbResourceStringDAQ.Size = new System.Drawing.Size(184, 20); this.tbResourceStringDAQ.TabIndex = 13; + this.tbResourceStringDAQ.Text = "ASRL9::INSTR"; // // label7 // @@ -358,7 +339,7 @@ namespace HTOLHAST this.label7.Location = new System.Drawing.Point(394, 216); this.label7.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(86, 13); + this.label7.Size = new System.Drawing.Size(93, 15); this.label7.TabIndex = 12; this.label7.Text = "VISA ADDRESS"; // @@ -376,7 +357,7 @@ namespace HTOLHAST this.label6.Location = new System.Drawing.Point(38, 465); this.label6.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(86, 13); + this.label6.Size = new System.Drawing.Size(93, 15); this.label6.TabIndex = 10; this.label6.Text = "VISA ADDRESS"; // @@ -387,6 +368,7 @@ namespace HTOLHAST this.tbResourceStringPSU1.Name = "tbResourceStringPSU1"; this.tbResourceStringPSU1.Size = new System.Drawing.Size(184, 20); this.tbResourceStringPSU1.TabIndex = 9; + this.tbResourceStringPSU1.Text = "ASRL4::INSTR"; // // label5 // @@ -394,7 +376,7 @@ namespace HTOLHAST this.label5.Location = new System.Drawing.Point(38, 216); this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(86, 13); + this.label5.Size = new System.Drawing.Size(93, 15); this.label5.TabIndex = 8; this.label5.Text = "VISA ADDRESS"; // @@ -404,7 +386,7 @@ namespace HTOLHAST this.label4.Location = new System.Drawing.Point(394, 276); this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(86, 13); + this.label4.Size = new System.Drawing.Size(96, 15); this.label4.TabIndex = 7; this.label4.Text = "PICOAMMETER"; // @@ -425,7 +407,7 @@ namespace HTOLHAST this.label3.Location = new System.Drawing.Point(394, 28); this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(81, 13); + this.label3.Size = new System.Drawing.Size(88, 15); this.label3.TabIndex = 5; this.label3.Text = "DATALOGGER"; // @@ -446,7 +428,7 @@ namespace HTOLHAST this.label2.Location = new System.Drawing.Point(38, 276); this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(96, 13); + this.label2.Size = new System.Drawing.Size(106, 15); this.label2.TabIndex = 3; this.label2.Text = "POWERSUPPLY2"; // @@ -467,7 +449,7 @@ namespace HTOLHAST this.label1.Location = new System.Drawing.Point(38, 28); this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(96, 13); + this.label1.Size = new System.Drawing.Size(106, 15); this.label1.TabIndex = 1; this.label1.Text = "POWERSUPPLY1"; // @@ -484,23 +466,24 @@ namespace HTOLHAST // // tabPagePSUSettings // + this.tabPagePSUSettings.Controls.Add(this.btnSendPsuSettings); + this.tabPagePSUSettings.Controls.Add(this.cbCH8); + this.tabPagePSUSettings.Controls.Add(this.cbCH7); + this.tabPagePSUSettings.Controls.Add(this.cbCH6); + this.tabPagePSUSettings.Controls.Add(this.cbCH5); + this.tabPagePSUSettings.Controls.Add(this.cbCH4); + this.tabPagePSUSettings.Controls.Add(this.cbCH3); + this.tabPagePSUSettings.Controls.Add(this.cbCH2); + this.tabPagePSUSettings.Controls.Add(this.cbCH1); this.tabPagePSUSettings.Controls.Add(this.button12); this.tabPagePSUSettings.Controls.Add(this.button13); this.tabPagePSUSettings.Controls.Add(this.button11); this.tabPagePSUSettings.Controls.Add(this.button10); - this.tabPagePSUSettings.Controls.Add(this.button2); - this.tabPagePSUSettings.Controls.Add(this.button1); this.tabPagePSUSettings.Controls.Add(this.label15); this.tabPagePSUSettings.Controls.Add(this.dataGridView3); this.tabPagePSUSettings.Controls.Add(this.dataGridView2); this.tabPagePSUSettings.Controls.Add(this.label14); - this.tabPagePSUSettings.Controls.Add(this.button9); - this.tabPagePSUSettings.Controls.Add(this.button8); - this.tabPagePSUSettings.Controls.Add(this.button7); - this.tabPagePSUSettings.Controls.Add(this.button6); - this.tabPagePSUSettings.Controls.Add(this.button5); - this.tabPagePSUSettings.Controls.Add(this.button4); - this.tabPagePSUSettings.Controls.Add(this.dataGridView1); + this.tabPagePSUSettings.Controls.Add(this.dgvPowerSupplies); this.tabPagePSUSettings.Location = new System.Drawing.Point(4, 22); this.tabPagePSUSettings.Margin = new System.Windows.Forms.Padding(2); this.tabPagePSUSettings.Name = "tabPagePSUSettings"; @@ -510,6 +493,104 @@ namespace HTOLHAST this.tabPagePSUSettings.Text = "PSUSettings"; this.tabPagePSUSettings.UseVisualStyleBackColor = true; // + // btnSendPsuSettings + // + this.btnSendPsuSettings.Location = new System.Drawing.Point(320, 434); + this.btnSendPsuSettings.Name = "btnSendPsuSettings"; + this.btnSendPsuSettings.Size = new System.Drawing.Size(139, 48); + this.btnSendPsuSettings.TabIndex = 42; + this.btnSendPsuSettings.Text = "SEND"; + this.btnSendPsuSettings.UseVisualStyleBackColor = true; + this.btnSendPsuSettings.Click += new System.EventHandler(this.btnSendPsuSettings_Click); + // + // cbCH8 + // + this.cbCH8.Appearance = System.Windows.Forms.Appearance.Button; + this.cbCH8.Location = new System.Drawing.Point(907, 102); + this.cbCH8.Name = "cbCH8"; + this.cbCH8.Size = new System.Drawing.Size(134, 68); + this.cbCH8.TabIndex = 41; + this.cbCH8.Text = "CH8"; + this.cbCH8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.cbCH8.UseVisualStyleBackColor = true; + // + // cbCH7 + // + this.cbCH7.Appearance = System.Windows.Forms.Appearance.Button; + this.cbCH7.Location = new System.Drawing.Point(766, 102); + this.cbCH7.Name = "cbCH7"; + this.cbCH7.Size = new System.Drawing.Size(134, 68); + this.cbCH7.TabIndex = 40; + this.cbCH7.Text = "CH7"; + this.cbCH7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.cbCH7.UseVisualStyleBackColor = true; + // + // cbCH6 + // + this.cbCH6.Appearance = System.Windows.Forms.Appearance.Button; + this.cbCH6.Location = new System.Drawing.Point(626, 102); + this.cbCH6.Name = "cbCH6"; + this.cbCH6.Size = new System.Drawing.Size(134, 68); + this.cbCH6.TabIndex = 39; + this.cbCH6.Text = "CH6"; + this.cbCH6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.cbCH6.UseVisualStyleBackColor = true; + // + // cbCH5 + // + this.cbCH5.Appearance = System.Windows.Forms.Appearance.Button; + this.cbCH5.Location = new System.Drawing.Point(486, 102); + this.cbCH5.Name = "cbCH5"; + this.cbCH5.Size = new System.Drawing.Size(134, 68); + this.cbCH5.TabIndex = 38; + this.cbCH5.Text = "CH5"; + this.cbCH5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.cbCH5.UseVisualStyleBackColor = true; + // + // cbCH4 + // + this.cbCH4.Appearance = System.Windows.Forms.Appearance.Button; + this.cbCH4.Location = new System.Drawing.Point(907, 15); + this.cbCH4.Name = "cbCH4"; + this.cbCH4.Size = new System.Drawing.Size(134, 68); + this.cbCH4.TabIndex = 37; + this.cbCH4.Text = "CH4"; + this.cbCH4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.cbCH4.UseVisualStyleBackColor = true; + // + // cbCH3 + // + this.cbCH3.Appearance = System.Windows.Forms.Appearance.Button; + this.cbCH3.Location = new System.Drawing.Point(766, 15); + this.cbCH3.Name = "cbCH3"; + this.cbCH3.Size = new System.Drawing.Size(134, 68); + this.cbCH3.TabIndex = 36; + this.cbCH3.Text = "CH3"; + this.cbCH3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.cbCH3.UseVisualStyleBackColor = true; + // + // cbCH2 + // + this.cbCH2.Appearance = System.Windows.Forms.Appearance.Button; + this.cbCH2.Location = new System.Drawing.Point(626, 15); + this.cbCH2.Name = "cbCH2"; + this.cbCH2.Size = new System.Drawing.Size(134, 68); + this.cbCH2.TabIndex = 35; + this.cbCH2.Text = "CH2"; + this.cbCH2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.cbCH2.UseVisualStyleBackColor = true; + // + // cbCH1 + // + this.cbCH1.Appearance = System.Windows.Forms.Appearance.Button; + this.cbCH1.Location = new System.Drawing.Point(486, 15); + this.cbCH1.Name = "cbCH1"; + this.cbCH1.Size = new System.Drawing.Size(134, 68); + this.cbCH1.TabIndex = 34; + this.cbCH1.Text = "CH1"; + this.cbCH1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.cbCH1.UseVisualStyleBackColor = true; + // // button12 // this.button12.Location = new System.Drawing.Point(1045, 384); @@ -550,35 +631,13 @@ namespace HTOLHAST this.button10.Text = "Up"; this.button10.UseVisualStyleBackColor = true; // - // button2 - // - this.button2.Enabled = false; - this.button2.Location = new System.Drawing.Point(904, 102); - this.button2.Margin = new System.Windows.Forms.Padding(2); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(136, 68); - this.button2.TabIndex = 29; - this.button2.Text = "CH8"; - this.button2.UseVisualStyleBackColor = true; - // - // button1 - // - this.button1.Enabled = false; - this.button1.Location = new System.Drawing.Point(764, 102); - this.button1.Margin = new System.Windows.Forms.Padding(2); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(136, 68); - this.button1.TabIndex = 28; - this.button1.Text = "CH7"; - this.button1.UseVisualStyleBackColor = true; - // // label15 // this.label15.AutoSize = true; this.label15.Location = new System.Drawing.Point(809, 230); this.label15.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label15.Name = "label15"; - this.label15.Size = new System.Drawing.Size(148, 13); + this.label15.Size = new System.Drawing.Size(164, 15); this.label15.TabIndex = 27; this.label15.Text = "POWER-DOWN SEQUENCE"; // @@ -644,125 +703,24 @@ namespace HTOLHAST this.label14.Location = new System.Drawing.Point(484, 230); this.label14.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label14.Name = "label14"; - this.label14.Size = new System.Drawing.Size(128, 13); + this.label14.Size = new System.Drawing.Size(143, 15); this.label14.TabIndex = 24; this.label14.Text = "POWER-UP SEQUENCE"; // - // button9 + // dgvPowerSupplies // - this.button9.Location = new System.Drawing.Point(624, 102); - this.button9.Margin = new System.Windows.Forms.Padding(2); - this.button9.Name = "button9"; - this.button9.Size = new System.Drawing.Size(136, 68); - this.button9.TabIndex = 23; - this.button9.Text = "CH6"; - this.button9.UseVisualStyleBackColor = true; - // - // button8 - // - this.button8.Location = new System.Drawing.Point(484, 102); - this.button8.Margin = new System.Windows.Forms.Padding(2); - this.button8.Name = "button8"; - this.button8.Size = new System.Drawing.Size(136, 68); - this.button8.TabIndex = 22; - this.button8.Text = "CH5"; - this.button8.UseVisualStyleBackColor = true; - // - // button7 - // - this.button7.Location = new System.Drawing.Point(904, 15); - this.button7.Margin = new System.Windows.Forms.Padding(2); - this.button7.Name = "button7"; - this.button7.Size = new System.Drawing.Size(136, 68); - this.button7.TabIndex = 21; - this.button7.Text = "CH4"; - this.button7.UseVisualStyleBackColor = true; - // - // button6 - // - this.button6.Location = new System.Drawing.Point(764, 15); - this.button6.Margin = new System.Windows.Forms.Padding(2); - this.button6.Name = "button6"; - this.button6.Size = new System.Drawing.Size(136, 68); - this.button6.TabIndex = 20; - this.button6.Text = "CH3"; - this.button6.UseVisualStyleBackColor = true; - // - // button5 - // - this.button5.Location = new System.Drawing.Point(624, 15); - this.button5.Margin = new System.Windows.Forms.Padding(2); - this.button5.Name = "button5"; - this.button5.Size = new System.Drawing.Size(136, 68); - this.button5.TabIndex = 19; - this.button5.Text = "CH2"; - this.button5.UseVisualStyleBackColor = true; - // - // button4 - // - this.button4.Location = new System.Drawing.Point(484, 15); - this.button4.Margin = new System.Windows.Forms.Padding(2); - this.button4.Name = "button4"; - this.button4.Size = new System.Drawing.Size(136, 68); - this.button4.TabIndex = 18; - this.button4.Text = "CH1"; - this.button4.UseVisualStyleBackColor = true; - // - // dataGridView1 - // - this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.Supply, - this.Description, - this.VSetpoint, - this.Tolerance, - this.CurrentLimitTotal}); - this.dataGridView1.Location = new System.Drawing.Point(11, 15); - this.dataGridView1.Margin = new System.Windows.Forms.Padding(2); - this.dataGridView1.Name = "dataGridView1"; - this.dataGridView1.RowHeadersWidth = 51; - this.dataGridView1.RowTemplate.Height = 24; - this.dataGridView1.Size = new System.Drawing.Size(417, 399); - this.dataGridView1.TabIndex = 0; - // - // Supply - // - this.Supply.HeaderText = "Channel"; - this.Supply.MinimumWidth = 6; - this.Supply.Name = "Supply"; - this.Supply.Width = 125; - // - // Description - // - this.Description.HeaderText = "Description"; - this.Description.MinimumWidth = 6; - this.Description.Name = "Description"; - this.Description.Width = 125; - // - // VSetpoint - // - this.VSetpoint.HeaderText = "VSetpoint"; - this.VSetpoint.MinimumWidth = 6; - this.VSetpoint.Name = "VSetpoint"; - this.VSetpoint.Width = 125; - // - // Tolerance - // - this.Tolerance.HeaderText = "Tolerance"; - this.Tolerance.MinimumWidth = 6; - this.Tolerance.Name = "Tolerance"; - this.Tolerance.Width = 125; - // - // CurrentLimitTotal - // - this.CurrentLimitTotal.HeaderText = "CurrentLimitTotal"; - this.CurrentLimitTotal.MinimumWidth = 6; - this.CurrentLimitTotal.Name = "CurrentLimitTotal"; - this.CurrentLimitTotal.Width = 125; + this.dgvPowerSupplies.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dgvPowerSupplies.Location = new System.Drawing.Point(11, 15); + this.dgvPowerSupplies.Margin = new System.Windows.Forms.Padding(2); + this.dgvPowerSupplies.Name = "dgvPowerSupplies"; + this.dgvPowerSupplies.RowHeadersWidth = 51; + this.dgvPowerSupplies.RowTemplate.Height = 24; + this.dgvPowerSupplies.Size = new System.Drawing.Size(448, 399); + this.dgvPowerSupplies.TabIndex = 0; // // tabPageHeader // - this.tabPageHeader.Controls.Add(this.dataGridView6); + this.tabPageHeader.Controls.Add(this.dgvHeaderSettings); this.tabPageHeader.Location = new System.Drawing.Point(4, 22); this.tabPageHeader.Margin = new System.Windows.Forms.Padding(2); this.tabPageHeader.Name = "tabPageHeader"; @@ -772,63 +730,33 @@ namespace HTOLHAST this.tabPageHeader.Text = "Header"; this.tabPageHeader.UseVisualStyleBackColor = true; // - // dataGridView6 + // dgvHeaderSettings // - this.dataGridView6.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridView6.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.dataGridViewTextBoxColumn3, - this.dataGridViewTextBoxColumn4, - this.dataGridViewTextBoxColumn5, - this.dataGridViewTextBoxColumn6}); - this.dataGridView6.Location = new System.Drawing.Point(4, 5); - this.dataGridView6.Margin = new System.Windows.Forms.Padding(2); - this.dataGridView6.Name = "dataGridView6"; - this.dataGridView6.RowHeadersWidth = 51; - this.dataGridView6.RowTemplate.Height = 24; - this.dataGridView6.Size = new System.Drawing.Size(418, 522); - this.dataGridView6.TabIndex = 1; - // - // dataGridViewTextBoxColumn3 - // - this.dataGridViewTextBoxColumn3.HeaderText = "HeaderPin"; - this.dataGridViewTextBoxColumn3.MinimumWidth = 6; - this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3"; - this.dataGridViewTextBoxColumn3.Width = 125; - // - // dataGridViewTextBoxColumn4 - // - this.dataGridViewTextBoxColumn4.HeaderText = "Description"; - this.dataGridViewTextBoxColumn4.MinimumWidth = 6; - this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4"; - this.dataGridViewTextBoxColumn4.Width = 125; - // - // dataGridViewTextBoxColumn5 - // - this.dataGridViewTextBoxColumn5.HeaderText = "Setpoint"; - this.dataGridViewTextBoxColumn5.MinimumWidth = 6; - this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5"; - this.dataGridViewTextBoxColumn5.Width = 125; - // - // dataGridViewTextBoxColumn6 - // - this.dataGridViewTextBoxColumn6.HeaderText = "Tolerance"; - this.dataGridViewTextBoxColumn6.MinimumWidth = 6; - this.dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6"; - this.dataGridViewTextBoxColumn6.Width = 125; + this.dgvHeaderSettings.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dgvHeaderSettings.Location = new System.Drawing.Point(4, 5); + this.dgvHeaderSettings.Margin = new System.Windows.Forms.Padding(2); + this.dgvHeaderSettings.Name = "dgvHeaderSettings"; + this.dgvHeaderSettings.RowHeadersWidth = 51; + this.dgvHeaderSettings.RowTemplate.Height = 24; + this.dgvHeaderSettings.Size = new System.Drawing.Size(558, 522); + this.dgvHeaderSettings.TabIndex = 1; // // tabPageMeasurement // - this.tabPageMeasurement.Controls.Add(this.textBox11); - this.tabPageMeasurement.Controls.Add(this.textBox10); + this.tabPageMeasurement.Controls.Add(this.tbStepDescription); + this.tabPageMeasurement.Controls.Add(this.tbSubProjectDescription); + this.tabPageMeasurement.Controls.Add(this.tbProjectDescription); + this.tabPageMeasurement.Controls.Add(this.btnSelectProject); + this.tabPageMeasurement.Controls.Add(this.tbCurrentPosition); + this.tabPageMeasurement.Controls.Add(this.tbPositionIncrement); this.tabPageMeasurement.Controls.Add(this.label18); this.tabPageMeasurement.Controls.Add(this.label17); - this.tabPageMeasurement.Controls.Add(this.button17); + this.tabPageMeasurement.Controls.Add(this.btnClear); this.tabPageMeasurement.Controls.Add(this.button16); - this.tabPageMeasurement.Controls.Add(this.button15); - this.tabPageMeasurement.Controls.Add(this.button14); - this.tabPageMeasurement.Controls.Add(this.textBox9); - this.tabPageMeasurement.Controls.Add(this.label16); - this.tabPageMeasurement.Controls.Add(this.dataGridView4); + this.tabPageMeasurement.Controls.Add(this.btnNextPosition); + this.tabPageMeasurement.Controls.Add(this.btnMeasure); + this.tabPageMeasurement.Controls.Add(this.tbProject); + this.tabPageMeasurement.Controls.Add(this.dgvMeasurements); this.tabPageMeasurement.Location = new System.Drawing.Point(4, 22); this.tabPageMeasurement.Margin = new System.Windows.Forms.Padding(2); this.tabPageMeasurement.Name = "tabPageMeasurement"; @@ -837,26 +765,68 @@ namespace HTOLHAST this.tabPageMeasurement.Text = "Measurement"; this.tabPageMeasurement.UseVisualStyleBackColor = true; // - // textBox11 + // tbStepDescription // - this.textBox11.Location = new System.Drawing.Point(1075, 3); - this.textBox11.Name = "textBox11"; - this.textBox11.Size = new System.Drawing.Size(100, 20); - this.textBox11.TabIndex = 10; + this.tbStepDescription.AutoSize = true; + this.tbStepDescription.Location = new System.Drawing.Point(13, 66); + this.tbStepDescription.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.tbStepDescription.Name = "tbStepDescription"; + this.tbStepDescription.Size = new System.Drawing.Size(103, 15); + this.tbStepDescription.TabIndex = 14; + this.tbStepDescription.Text = "Step Description :"; // - // textBox10 + // tbSubProjectDescription // - this.textBox10.Location = new System.Drawing.Point(857, 3); - this.textBox10.Name = "textBox10"; - this.textBox10.Size = new System.Drawing.Size(100, 20); - this.textBox10.TabIndex = 9; + this.tbSubProjectDescription.AutoSize = true; + this.tbSubProjectDescription.Location = new System.Drawing.Point(13, 53); + this.tbSubProjectDescription.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.tbSubProjectDescription.Name = "tbSubProjectDescription"; + this.tbSubProjectDescription.Size = new System.Drawing.Size(138, 15); + this.tbSubProjectDescription.TabIndex = 13; + this.tbSubProjectDescription.Text = "SubProject Description :"; + // + // tbProjectDescription + // + this.tbProjectDescription.AutoSize = true; + this.tbProjectDescription.Location = new System.Drawing.Point(13, 40); + this.tbProjectDescription.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.tbProjectDescription.Name = "tbProjectDescription"; + this.tbProjectDescription.Size = new System.Drawing.Size(116, 15); + this.tbProjectDescription.TabIndex = 12; + this.tbProjectDescription.Text = "Project Description :"; + // + // btnSelectProject + // + this.btnSelectProject.Location = new System.Drawing.Point(173, 84); + this.btnSelectProject.Name = "btnSelectProject"; + this.btnSelectProject.Size = new System.Drawing.Size(147, 45); + this.btnSelectProject.TabIndex = 11; + this.btnSelectProject.Text = "Select Project"; + this.btnSelectProject.UseVisualStyleBackColor = true; + this.btnSelectProject.Click += new System.EventHandler(this.btnSelectProject_Click); + // + // tbCurrentPosition + // + this.tbCurrentPosition.Location = new System.Drawing.Point(1075, 3); + this.tbCurrentPosition.Name = "tbCurrentPosition"; + this.tbCurrentPosition.Size = new System.Drawing.Size(100, 20); + this.tbCurrentPosition.TabIndex = 10; + this.tbCurrentPosition.Text = "1"; + // + // tbPositionIncrement + // + this.tbPositionIncrement.Location = new System.Drawing.Point(857, 3); + this.tbPositionIncrement.Name = "tbPositionIncrement"; + this.tbPositionIncrement.Size = new System.Drawing.Size(100, 20); + this.tbPositionIncrement.TabIndex = 9; + this.tbPositionIncrement.Text = "1"; // // label18 // this.label18.AutoSize = true; this.label18.Location = new System.Drawing.Point(744, 10); this.label18.Name = "label18"; - this.label18.Size = new System.Drawing.Size(94, 13); + this.label18.Size = new System.Drawing.Size(109, 15); this.label18.TabIndex = 8; this.label18.Text = "Position Increment"; // @@ -865,18 +835,19 @@ namespace HTOLHAST this.label17.AutoSize = true; this.label17.Location = new System.Drawing.Point(989, 10); this.label17.Name = "label17"; - this.label17.Size = new System.Drawing.Size(81, 13); + this.label17.Size = new System.Drawing.Size(94, 15); this.label17.TabIndex = 7; this.label17.Text = "Current Position"; // - // button17 + // btnClear // - this.button17.Location = new System.Drawing.Point(689, 426); - this.button17.Name = "button17"; - this.button17.Size = new System.Drawing.Size(164, 79); - this.button17.TabIndex = 6; - this.button17.Text = "ABORT"; - this.button17.UseVisualStyleBackColor = true; + this.btnClear.Location = new System.Drawing.Point(689, 426); + this.btnClear.Name = "btnClear"; + this.btnClear.Size = new System.Drawing.Size(164, 79); + this.btnClear.TabIndex = 6; + this.btnClear.Text = "CLEAR"; + this.btnClear.UseVisualStyleBackColor = true; + this.btnClear.Click += new System.EventHandler(this.btnClear_Click); // // button16 // @@ -888,79 +859,54 @@ namespace HTOLHAST this.button16.Text = "SAVE"; this.button16.UseVisualStyleBackColor = true; // - // button15 + // btnNextPosition // - this.button15.Location = new System.Drawing.Point(516, 426); - this.button15.Margin = new System.Windows.Forms.Padding(2); - this.button15.Name = "button15"; - this.button15.Size = new System.Drawing.Size(166, 79); - this.button15.TabIndex = 4; - this.button15.Text = "NEXT POSITION"; - this.button15.UseVisualStyleBackColor = true; + this.btnNextPosition.Location = new System.Drawing.Point(516, 426); + this.btnNextPosition.Margin = new System.Windows.Forms.Padding(2); + this.btnNextPosition.Name = "btnNextPosition"; + this.btnNextPosition.Size = new System.Drawing.Size(166, 79); + this.btnNextPosition.TabIndex = 4; + this.btnNextPosition.Text = "NEXT POSITION"; + this.btnNextPosition.UseVisualStyleBackColor = true; + this.btnNextPosition.Click += new System.EventHandler(this.btnNextPosition_Click); // - // button14 + // btnMeasure // - this.button14.Location = new System.Drawing.Point(346, 426); - this.button14.Margin = new System.Windows.Forms.Padding(2); - this.button14.Name = "button14"; - this.button14.Size = new System.Drawing.Size(166, 79); - this.button14.TabIndex = 3; - this.button14.Text = "MEASURE"; - this.button14.UseVisualStyleBackColor = true; + this.btnMeasure.Location = new System.Drawing.Point(346, 426); + this.btnMeasure.Margin = new System.Windows.Forms.Padding(2); + this.btnMeasure.Name = "btnMeasure"; + this.btnMeasure.Size = new System.Drawing.Size(166, 79); + this.btnMeasure.TabIndex = 3; + this.btnMeasure.Text = "MEASURE"; + this.btnMeasure.UseVisualStyleBackColor = true; + this.btnMeasure.Click += new System.EventHandler(this.btnMeasure_Click); // - // textBox9 + // tbProject // - this.textBox9.Location = new System.Drawing.Point(15, 44); - this.textBox9.Margin = new System.Windows.Forms.Padding(2); - this.textBox9.Name = "textBox9"; - this.textBox9.Size = new System.Drawing.Size(76, 20); - this.textBox9.TabIndex = 2; + this.tbProject.AutoSize = true; + this.tbProject.Location = new System.Drawing.Point(13, 27); + this.tbProject.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.tbProject.Name = "tbProject"; + this.tbProject.Size = new System.Drawing.Size(123, 15); + this.tbProject.TabIndex = 1; + this.tbProject.Text = "Project: Pxxxxx Sub x"; // - // label16 + // dgvMeasurements // - this.label16.AutoSize = true; - this.label16.Location = new System.Drawing.Point(13, 27); - this.label16.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); - this.label16.Name = "label16"; - this.label16.Size = new System.Drawing.Size(40, 13); - this.label16.TabIndex = 1; - this.label16.Text = "Project"; - // - // dataGridView4 - // - this.dataGridView4.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridView4.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.ID}); - this.dataGridView4.Location = new System.Drawing.Point(346, 27); - this.dataGridView4.Margin = new System.Windows.Forms.Padding(2); - this.dataGridView4.Name = "dataGridView4"; - this.dataGridView4.RowHeadersWidth = 51; - this.dataGridView4.RowTemplate.Height = 24; - this.dataGridView4.Size = new System.Drawing.Size(812, 358); - this.dataGridView4.TabIndex = 0; - // - // ID - // - this.ID.HeaderText = "ID"; - this.ID.MinimumWidth = 6; - this.ID.Name = "ID"; - this.ID.Width = 125; - // - // btnInitializeInstruments - // - this.btnInitializeInstruments.Location = new System.Drawing.Point(775, 438); - this.btnInitializeInstruments.Name = "btnInitializeInstruments"; - this.btnInitializeInstruments.Size = new System.Drawing.Size(117, 47); - this.btnInitializeInstruments.TabIndex = 23; - this.btnInitializeInstruments.Text = "Initialize Instruments"; - this.btnInitializeInstruments.UseVisualStyleBackColor = true; - this.btnInitializeInstruments.Click += new System.EventHandler(this.btnInitializeInstruments_Click); + this.dgvMeasurements.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dgvMeasurements.Location = new System.Drawing.Point(346, 27); + this.dgvMeasurements.Margin = new System.Windows.Forms.Padding(2); + this.dgvMeasurements.Name = "dgvMeasurements"; + this.dgvMeasurements.RowHeadersWidth = 51; + this.dgvMeasurements.RowTemplate.Height = 24; + this.dgvMeasurements.Size = new System.Drawing.Size(812, 358); + this.dgvMeasurements.TabIndex = 0; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1204, 575); + this.ClientSize = new System.Drawing.Size(1198, 569); this.Controls.Add(this.tabControl1); this.Margin = new System.Windows.Forms.Padding(2); this.Name = "Form1"; @@ -978,12 +924,12 @@ namespace HTOLHAST this.tabPagePSUSettings.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.dgvPowerSupplies)).EndInit(); this.tabPageHeader.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView6)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.dgvHeaderSettings)).EndInit(); this.tabPageMeasurement.ResumeLayout(false); this.tabPageMeasurement.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView4)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.dgvMeasurements)).EndInit(); this.ResumeLayout(false); } @@ -1009,13 +955,13 @@ namespace HTOLHAST private System.Windows.Forms.Label label1; private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.TabPage tabPagePSUSettings; - private System.Windows.Forms.DataGridView dataGridView1; + private System.Windows.Forms.DataGridView dgvPowerSupplies; private System.Windows.Forms.Label label11; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Button button3; private System.Windows.Forms.TextBox textBox5; private System.Windows.Forms.Label label9; - private System.Windows.Forms.TextBox textBox7; + private System.Windows.Forms.TextBox tbPamMaxCurrent; private System.Windows.Forms.TextBox textBox8; private System.Windows.Forms.Label label13; private System.Windows.Forms.Label label10; @@ -1023,10 +969,6 @@ namespace HTOLHAST private System.Windows.Forms.TextBox textBox6; private System.Windows.Forms.CheckBox cbPAMEnabled; private System.Windows.Forms.CheckBox cbPSU2Enabled; - private System.Windows.Forms.CheckBox cbDAQEnabled; - private System.Windows.Forms.CheckBox cbPSU1Enabled; - private System.Windows.Forms.Button button2; - private System.Windows.Forms.Button button1; private System.Windows.Forms.Label label15; private System.Windows.Forms.DataGridView dataGridView3; private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1; @@ -1035,41 +977,37 @@ namespace HTOLHAST private System.Windows.Forms.DataGridViewTextBoxColumn Channel; private System.Windows.Forms.DataGridViewTextBoxColumn Delay; private System.Windows.Forms.Label label14; - private System.Windows.Forms.Button button9; - private System.Windows.Forms.Button button8; - private System.Windows.Forms.Button button7; - private System.Windows.Forms.Button button6; - private System.Windows.Forms.Button button5; - private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button12; private System.Windows.Forms.Button button13; private System.Windows.Forms.Button button11; private System.Windows.Forms.Button button10; private System.Windows.Forms.TabPage tabPageMeasurement; private System.Windows.Forms.Button button16; - private System.Windows.Forms.Button button15; - private System.Windows.Forms.Button button14; - private System.Windows.Forms.TextBox textBox9; - private System.Windows.Forms.Label label16; - private System.Windows.Forms.DataGridView dataGridView4; + private System.Windows.Forms.Button btnNextPosition; + private System.Windows.Forms.Button btnMeasure; + private System.Windows.Forms.Label tbProject; + private System.Windows.Forms.DataGridView dgvMeasurements; private System.Windows.Forms.TabPage tabPageHeader; - private System.Windows.Forms.DataGridView dataGridView6; - private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3; - private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn4; - private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn5; - private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn6; - private System.Windows.Forms.DataGridViewTextBoxColumn Supply; - private System.Windows.Forms.DataGridViewTextBoxColumn Description; - private System.Windows.Forms.DataGridViewTextBoxColumn VSetpoint; - private System.Windows.Forms.DataGridViewTextBoxColumn Tolerance; - private System.Windows.Forms.DataGridViewTextBoxColumn CurrentLimitTotal; - private System.Windows.Forms.TextBox textBox11; - private System.Windows.Forms.TextBox textBox10; + private System.Windows.Forms.DataGridView dgvHeaderSettings; + private System.Windows.Forms.TextBox tbCurrentPosition; + private System.Windows.Forms.TextBox tbPositionIncrement; private System.Windows.Forms.Label label18; private System.Windows.Forms.Label label17; - private System.Windows.Forms.Button button17; - private System.Windows.Forms.DataGridViewTextBoxColumn ID; + private System.Windows.Forms.Button btnClear; private System.Windows.Forms.Button btnInitializeInstruments; + private System.Windows.Forms.Button btnSelectProject; + private System.Windows.Forms.Label tbStepDescription; + private System.Windows.Forms.Label tbSubProjectDescription; + private System.Windows.Forms.Label tbProjectDescription; + private System.Windows.Forms.CheckBox cbCH8; + private System.Windows.Forms.CheckBox cbCH7; + private System.Windows.Forms.CheckBox cbCH6; + private System.Windows.Forms.CheckBox cbCH5; + private System.Windows.Forms.CheckBox cbCH4; + private System.Windows.Forms.CheckBox cbCH3; + private System.Windows.Forms.CheckBox cbCH2; + private System.Windows.Forms.CheckBox cbCH1; + private System.Windows.Forms.Button btnSendPsuSettings; } } diff --git a/HTOLHAST/Form1.cs b/HTOLHAST/Form1.cs index be1839c..324ba3b 100644 --- a/HTOLHAST/Form1.cs +++ b/HTOLHAST/Form1.cs @@ -8,25 +8,203 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Threading; +using System.Text.RegularExpressions; +using Maser.Palantir.Model; namespace HTOLHAST { public partial class Form1 : Form { + public int PositionIncrement + { + get + { + int result; + if (int.TryParse(tbPositionIncrement.Text, out result)) + { + return result; + } + else + { + // Handle the case where the conversion fails + throw new FormatException("Invalid input for PAMMaxCurrent."); + } + } + set + { + tbPositionIncrement.Text = value.ToString(); + } + } + public int CurrentPosition + { + get + { + int result; + if (int.TryParse(tbCurrentPosition.Text, out result)) + { + return result; + } + else + { + // Handle the case where the conversion fails + throw new FormatException("Invalid input for PAMMaxCurrent."); + } + } + set + { + tbCurrentPosition.Text = value.ToString(); + } + } HMP4040 PSU1; HMP4040 PSU2; Keithley6485 PAM; Agilent34970a DAQ; + Project Project; + List switchMatrix; + List powerUpSequences; + List powerDownSequences; + List measurements; + List headerSettings = new List(); + + + DataTable dataTablePowersupplySettings = new DataTable(); + List powerSupplySettings = new List(); + + + List voltageChannels = new List() { 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, + 214, 215, 216, 217, 218, 219 }; + public double PAMMaxCurrent + { + get + { + double result; + if (double.TryParse(tbPamMaxCurrent.Text, out result)) + { + return result; + } + else + { + // Handle the case where the conversion fails + throw new FormatException("Invalid input for PAMMaxCurrent."); + } + } + } public Form1() { InitializeComponent(); + + InitializeEvents(); + //InitializeDataTablePowerSupplySettings(); + //InitializeDgvPowerSupplySettings(); + //KeithleyValidationOfMethods(); + InitDgvPowersupply(); + InitDgvHeaderSetting(); + InitDgvMeasurements(); + InitSwitchMatrix(); + InitializePowerupSequence(); } + private void InitDgvMeasurements() + { + measurements = new List(); + dgvMeasurements.DataSource = measurements; + } + private void InitBeginPositionOfSwitches() + { + foreach (var sw in switchMatrix) + { + DAQ.CloseChannel(sw.SW1); + DAQ.OpenChannel(sw.SW2); + DAQ.CloseChannel(sw.SW3); + } + } + private void InitSwitchMatrix() + { + switchMatrix = new List() + { + //00926 20 Channel Actuator / GP Switch Module SLOT1 + new SwitchMatrix { Channel = 1, SW1 = 102, SW2 = 103, SW3 = 104 }, + new SwitchMatrix { Channel = 2, SW1 = 105, SW2 = 106, SW3 = 107 }, + new SwitchMatrix { Channel = 3, SW1 = 108, SW2 = 109, SW3 = 110 }, + new SwitchMatrix { Channel = 4, SW1 = 111, SW2 = 112, SW3 = 113 }, + new SwitchMatrix { Channel = 5, SW1 = 114, SW2 = 115, SW3 = 116 }, + new SwitchMatrix { Channel = 6, SW1 = 117, SW2 = 118, SW3 = 119 } + }; + } + public void InitDgvHeaderSetting() + { + for (int headerpin = 1; headerpin <= 10; headerpin++) + { + HeaderSetting headerSetting = new HeaderSetting() { HeaderPin = headerpin.ToString(), Channel = voltageChannels[headerpin -1], Description = "-", Setpoint = 0.0, Tolerance = 0.0 }; + headerSettings.Add(headerSetting); + } + dgvHeaderSettings.DataSource = headerSettings; + dgvHeaderSettings.Update(); + } + public void InitDgvPowersupply () + { + + for (int channel = 1; channel <= 6; channel++) + { + PowerSupplySetting powerSupplySetting = new PowerSupplySetting() { Channel = channel, Description = "-", Voltage = 0.0, Tolerance = 1, CurrentLimit = 0.1, Enabled = false }; + powerSupplySettings.Add(powerSupplySetting); + } + dgvPowerSupplies.DataSource = powerSupplySettings; + dgvPowerSupplies.Update(); + } + public void InitializeDataTablePowerSupplySettings() + { + dataTablePowersupplySettings.Columns.Add("Channel", typeof(int)); + dataTablePowersupplySettings.Columns.Add("Description", typeof(string)); + dataTablePowersupplySettings.Columns.Add("Voltage", typeof(double)); + dataTablePowersupplySettings.Columns.Add("Tolerance", typeof(double)); + dataTablePowersupplySettings.Columns.Add("CurrentLimit", typeof(double)); + dataTablePowersupplySettings.Columns.Add("Enabled", typeof(bool)); + } + public void InitializeDgvPowerSupplySettings() + { + dgvPowerSupplies.DataSource = dataTablePowersupplySettings; + for (int channel = 1; channel <= 6; channel++) + { + PowerSupplySetting powerSupplySetting = new PowerSupplySetting() { Channel = channel, Description = "-", Voltage = 0.0, Tolerance = 1, CurrentLimit = 0.1, Enabled = false }; + dataTablePowersupplySettings.Rows.Add(powerSupplySetting.Channel, powerSupplySetting.Description, powerSupplySetting.Voltage, + powerSupplySetting.Tolerance, powerSupplySetting.CurrentLimit, powerSupplySetting.Enabled); + } + dgvPowerSupplies.Update(); - + } + private void InitializeEvents () + { + cbCH1.CheckedChanged += OnPowerSupplyCheckboxClicked; + cbCH2.CheckedChanged += OnPowerSupplyCheckboxClicked; + cbCH3.CheckedChanged += OnPowerSupplyCheckboxClicked; + cbCH4.CheckedChanged += OnPowerSupplyCheckboxClicked; + cbCH5.CheckedChanged += OnPowerSupplyCheckboxClicked; + cbCH6.CheckedChanged += OnPowerSupplyCheckboxClicked; + cbCH7.Enabled = false; + cbCH8.Enabled = false; + } + private void InitializePowerupSequence() + { + powerUpSequences = new List() + { new PowerUpSequence { Channel = 1, Delay = 100}, + new PowerUpSequence { Channel = 2, Delay = 100}, + new PowerUpSequence { Channel = 3, Delay = 100}, + new PowerUpSequence { Channel = 4, Delay = 100} + }; + } + private void InitializePowerDownSequence() + { + powerDownSequences = new List() + { new PowerUpSequence { Channel = 1, Delay = 1}, + new PowerUpSequence { Channel = 2, Delay = 1}, + new PowerUpSequence { Channel = 3, Delay = 1}, + new PowerUpSequence { Channel = 4, Delay = 1} + }; + } public void InitializeInstruments() { @@ -35,7 +213,7 @@ namespace HTOLHAST InitializeDAQ(tbResourceStringDAQ.Text); // Optional Instruments check if to be used - if (cbPSU1Enabled.Checked) + if (cbPSU2Enabled.Checked) { InitializePSU2(tbResourceStringPSU2.Text); } @@ -50,10 +228,19 @@ namespace HTOLHAST try { PSU1 = new HMP4040(resourceString); + foreach (var setting in powerSupplySettings) + { + if (setting.Channel <=4) + { + setting.Voltage = PSU1.ReadSetpoint(setting.Channel); + } + } + dgvPowerSupplies.Refresh(); } catch (Exception) { + MessageBox.Show("Unable to Connect to HAMEG 1 PowerSupply"); throw; } @@ -66,7 +253,7 @@ namespace HTOLHAST } catch (Exception) { - + MessageBox.Show("Unable to Connect to HAMEG 2 PowerSupply"); throw; } @@ -76,10 +263,17 @@ namespace HTOLHAST try { PAM = new Keithley6485(resourceString); + // Query the instrument ID + PAM.Reset(); + string idnResponse = PAM.GetID(); + Console.WriteLine($"Instrument ID: {idnResponse}"); + + // Measure DC current + PAM.PerformZeroCheck(); } catch (Exception) { - + MessageBox.Show("Unable to Connect to PicoAmmeter"); throw; } @@ -90,24 +284,24 @@ namespace HTOLHAST { DAQ = new Agilent34970a(resourceString); } - catch (Exception) + catch (Exception e) { + MessageBox.Show("Unable to Connect to DAQ"); throw; } } - public void HamegValidationOfMethods() { string resourceString = "ASRL4::INSTR"; // Replace with your instrument's resource string HMP4040 hameg = new HMP4040(resourceString); hameg.GetID(); - string voltageResponse = hameg.MeasureVolt(1); - Console.WriteLine($"Measured Voltage: {voltageResponse} V"); + HMP4040Sample voltageResponse = (HMP4040Sample)hameg.MeasureVolt(1); + Console.WriteLine($"Measured Voltage: {voltageResponse.Value} V"); - string currentResponse = hameg.MeasureCurrent(1); - Console.WriteLine($"Measured Current: {currentResponse} A"); + HMP4040Sample currentResponse = (HMP4040Sample)hameg.MeasureCurrent(1); + Console.WriteLine($"Measured Current: {currentResponse.Value} A"); string voltageSetpoint = hameg.SetVoltage(1.1, 1); @@ -132,17 +326,282 @@ namespace HTOLHAST // Measure DC current keithley.PerformZeroCheck(); - string currentResponse = keithley.MeasureDCCurrent(); - Console.WriteLine($"Measured Current: {currentResponse}"); + Keithley6485Sample currentResponse = (Keithley6485Sample) keithley.MeasureDCCurrent(); + Console.WriteLine($"Measured Current: {currentResponse.Value}"); // Close the instrument connection keithley.Close(); } + public void AgilentValidationOfMethods() + { + // Example usage + string resourceString = "ASRL9::INSTR"; // Replace with your instrument's resource string + Agilent34970a agilent = new Agilent34970a(resourceString); + // Query the instrument ID + agilent.Reset(); + string idnResponse = agilent.GetID(); + Console.WriteLine($"Instrument ID: {idnResponse}"); + + //Measure DC Voltage + foreach (var channel in voltageChannels) + { + agilent.ConfigVoltageChannel(channel); + Agilent34970aSample sample =(Agilent34970aSample) agilent.MeasureVolt(channel); + Console.WriteLine($"Measured voltage CH{channel} : {sample.Value}"); + } + + // Close the instrument connection + agilent.Close(); + + } private void btnInitializeInstruments_Click(object sender, EventArgs e) { InitializeInstruments(); } + private void btnSelectProject_Click(object sender, EventArgs e) + { + // Create new Form and show in showdialog window. + FormSelectProject formSelectProject = new FormSelectProject(); + if (formSelectProject.ShowDialog() == DialogResult.OK) + { + // Get Project information from formSelectProject Form. + Project = formSelectProject.Project; + // Update Project information + UpdateProjectInfoTextboxes(Project); + } + } + private void UpdateProjectInfoTextboxes(Project project) + { + // Fill in project information textboxes. + tbProject.Text = $"Project: P{project.MIDSProject} Sub: {project.MIDSSubProject} Step: {project.MIDSStep}"; + tbProjectDescription.Text = project.MIDSProjectDescription; + tbSubProjectDescription.Text = project.MIDSSubProjectDescription; + tbStepDescription.Text = project.MIDSStepDescription; + } + public void OnPowerSupplyCheckboxClicked (object sender, EventArgs e) + { + CheckBox SelectedChannel = (CheckBox)sender; + Console.WriteLine(SelectedChannel.Name); + int.TryParse(SelectedChannel.Name[4].ToString(), out int channel); + //DataRow row = dataTablePowersupplySettings.Rows[channel-1]; + //row["Enabled"] = SelectedChannel.Checked; + foreach (var setting in powerSupplySettings) + { + if (setting.Channel == channel) + { + setting.Enabled = SelectedChannel.Checked; + dgvPowerSupplies.Refresh(); + } + } + } + private void btnMeasure_Click(object sender, EventArgs e) + { + InitBeginPositionOfSwitches(); + PowerUpPSU(powerUpSequences); + MeasurePSUVoltage(); + MeasureHeaderVoltage(); + MeasureCurrent(); + PowerDownPSU(powerUpSequences); + UpdateMeasureDGV(); + + // Timestamp, Position, Device, Measurement, Voltage, Current + // 2025-01-09, 1, HAMEG1, CH1, 1.0, 0.1 + // 2025-01-09, 1, HAMEG2, CH5, 1.0, 0.1 + // 2025-01-09, 1, KEITHLEY, CH1, -, 1.0 + // 2025-01-09, 1, AGILENT, HEADER1, 1.0, - + } + private void UpdateMeasureDGV() + { + dgvMeasurements.DataSource = null; + dgvMeasurements.DataSource = measurements; + dgvMeasurements.Refresh(); + } + private void PowerUpPSU(List powerUpsequences) + { + PSU1.PowerUpSequence(powerUpsequences); + PSU1.SetGeneralOutputState(true); + } + private void PowerDownPSU(List powerUpsequences) + { + PSU1.PowerDownSequence(powerUpsequences); + PSU1.SetGeneralOutputState(false); + } + private void MeasureHeaderVoltage() + { + //02700 20 Channel Multiplexer Module (BLR) SLOT2 + foreach (var header in headerSettings) + { + DAQ.ConfigVoltageChannel(header.Channel); + Agilent34970aSample sample =(Agilent34970aSample)DAQ.MeasureVolt(header.Channel); + this.measurements.Add(new Measurement + { + Description = $"Headerpin : {header.HeaderPin}", + Device = "Agilent34970A", + Position = CurrentPosition, + Timestamp = sample.TimeStamp, + Value = sample.Value, + Unit = sample.Unit + }); + + Console.WriteLine($"Measured voltage CH{header.Channel} : {sample.Value}"); + } + + } + private void MeasurePSUVoltage() + { + var powerSupplies = GetEnabledPowerSupplies(); + foreach (var powersupply in powerSupplies) + { + if (powersupply.Channel <= 4) + { + HMP4040Sample sample = (HMP4040Sample)PSU1.MeasureVolt(powersupply.Channel); + this.measurements.Add(new Measurement + { + Description = $"PSU1_CH{powersupply.Channel}", + Device = "HAMEG4040", + Position = CurrentPosition, + Timestamp = sample.TimeStamp, + Value = sample.Value, + Unit = sample.Unit + }); + sample = (HMP4040Sample)PSU1.MeasureCurrent(powersupply.Channel); + this.measurements.Add(new Measurement + { + Description = $"PSU1_CH{powersupply.Channel}", + Device = "HAMEG4040", + Position = CurrentPosition, + Timestamp = sample.TimeStamp, + Value = sample.Value, + Unit = sample.Unit + }); + + } + else + { + HMP4040Sample sample = (HMP4040Sample)PSU2.MeasureVolt(powersupply.Channel); + this.measurements.Add(new Measurement + { + Description = $"PSU2_CH{powersupply.Channel}", + Device = "HAMEG4040", + Position = CurrentPosition, + Timestamp = sample.TimeStamp, + Value = sample.Value, + Unit = sample.Unit + }); + sample = (HMP4040Sample)PSU2.MeasureCurrent(powersupply.Channel); + this.measurements.Add(new Measurement + { + Description = $"PSU1_CH{powersupply.Channel}", + Device = "HAMEG4040", + Position = CurrentPosition, + Timestamp = sample.TimeStamp, + Value = sample.Value, + Unit = sample.Unit + }); + } + } + + } + private void MeasureCurrent() + { + var enabledPowersupplies = GetEnabledPowerSupplies(); + + foreach (var powersupply in enabledPowersupplies) + { + if (powersupply.Channel <= 4) + { + HMP4040Sample current = (HMP4040Sample) PSU1.MeasureCurrent(powersupply.Channel); + + if (PAM == null) { return; } + + if (current.Value < PAMMaxCurrent ) + { + DAQ.CloseChannel(101); // Switch relay for PAM measurement + SetSwitchesBeforeCurrentMeasurement(powersupply.Channel); + Keithley6485Sample sample = (Keithley6485Sample) PAM.MeasureDCCurrent(); + this.measurements.Add(new Measurement + { + Description = $"PSU1_CH{powersupply.Channel}", + Device = "Keithley6485", + Position = CurrentPosition, + Timestamp = sample.TimeStamp, + Value = sample.Value, + Unit = sample.Unit + }); + SetSwitchesAfterCurrentMeasurement(powersupply.Channel); + } + + } + else + { + DAQ.CloseChannel(101); // Switch relay for PAM measurement + HMP4040Sample current = (HMP4040Sample)PSU2.MeasureCurrent(powersupply.Channel); + if (PAM == null) { return; } + + if (current.Value < PAMMaxCurrent) + { + SetSwitchesBeforeCurrentMeasurement(powersupply.Channel); + PAM.MeasureDCCurrent(); + Keithley6485Sample sample = (Keithley6485Sample)PAM.MeasureDCCurrent(); + this.measurements.Add(new Measurement + { + Description = $"PSU2_CH{powersupply.Channel}", + Device = "Keithley6485", + Position = CurrentPosition, + Timestamp = sample.TimeStamp, + Value = sample.Value, + Unit = sample.Unit + }); + SetSwitchesAfterCurrentMeasurement(powersupply.Channel); + } + } + } + + + } + private void SetSwitchesBeforeCurrentMeasurement(int channel) + { + SwitchMatrix switches = switchMatrix.Where(x => x.Channel == channel).First(); + DAQ.CloseChannel(switches.SW1); + DAQ.CloseChannel(switches.SW2); + DAQ.CloseChannel(switches.SW3); + DAQ.OpenChannel(switches.SW1); + + } + private void SetSwitchesAfterCurrentMeasurement(int channel) + { + SwitchMatrix switches = switchMatrix.Where(x => x.Channel == channel).First(); + DAQ.CloseChannel(switches.SW1); + DAQ.OpenChannel(switches.SW2); + DAQ.OpenChannel(switches.SW3); + + + } + private List GetEnabledPowerSupplies() + { + var enabledPowerSupplies = powerSupplySettings.Where(x => x.Enabled == true).ToList(); + return enabledPowerSupplies; + } + private void btnSendPsuSettings_Click(object sender, EventArgs e) + { + foreach (PowerSupplySetting powerSupplySetting in powerSupplySettings) + { + PSU1.SetVoltage(powerSupplySetting.Voltage, powerSupplySetting.Channel); + PSU1.SetCurrent(powerSupplySetting.CurrentLimit, powerSupplySetting.Channel); + } + } + private void btnNextPosition_Click(object sender, EventArgs e) + { + CurrentPosition += PositionIncrement; + } + + private void btnClear_Click(object sender, EventArgs e) + { + measurements.Clear(); // Clear the list + dgvMeasurements.DataSource = null; // Clear the data source + dgvMeasurements.DataSource = measurements; + } } } diff --git a/HTOLHAST/Form1.resx b/HTOLHAST/Form1.resx index 46b325c..f7ee287 100644 --- a/HTOLHAST/Form1.resx +++ b/HTOLHAST/Form1.resx @@ -141,64 +141,4 @@ True - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - \ No newline at end of file diff --git a/HTOLHAST/FormSelectProject.Designer.cs b/HTOLHAST/FormSelectProject.Designer.cs new file mode 100644 index 0000000..dbd4aaf --- /dev/null +++ b/HTOLHAST/FormSelectProject.Designer.cs @@ -0,0 +1,58 @@ + +namespace HTOLHAST +{ + partial class FormSelectProject + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.midsProjectRetriever = new Maser.Palantir.MIDSProjectRetriever.MIDSProjectRetriever(); + this.SuspendLayout(); + // + // midsProjectRetriever + // + this.midsProjectRetriever.Location = new System.Drawing.Point(12, 12); + this.midsProjectRetriever.Name = "midsProjectRetriever"; + this.midsProjectRetriever.Size = new System.Drawing.Size(963, 243); + this.midsProjectRetriever.TabIndex = 0; + // + // FormSelectProject + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1000, 270); + this.Controls.Add(this.midsProjectRetriever); + this.Name = "FormSelectProject"; + this.Text = "FormSelectProject"; + this.ResumeLayout(false); + + } + + #endregion + + private Maser.Palantir.MIDSProjectRetriever.MIDSProjectRetriever midsProjectRetriever; + } +} \ No newline at end of file diff --git a/HTOLHAST/FormSelectProject.cs b/HTOLHAST/FormSelectProject.cs new file mode 100644 index 0000000..fb1cc97 --- /dev/null +++ b/HTOLHAST/FormSelectProject.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Maser.Palantir.Model; + +namespace HTOLHAST +{ + public partial class FormSelectProject : Form + { + public Project Project; + public FormSelectProject() + { + InitializeComponent(); + midsProjectRetriever.OK_Clicked += MidsProjectRetriever_OK_Clicked; + } + + private void MidsProjectRetriever_OK_Clicked(object sender, EventArgs e) + { + Project = midsProjectRetriever.Project; + this.DialogResult = DialogResult.OK; + this.Close(); + } + } +} diff --git a/HTOLHAST/FormSelectProject.resx b/HTOLHAST/FormSelectProject.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/HTOLHAST/FormSelectProject.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/HTOLHAST/HMP4040.cs b/HTOLHAST/HMP4040.cs index bfdf288..e279e1b 100644 --- a/HTOLHAST/HMP4040.cs +++ b/HTOLHAST/HMP4040.cs @@ -10,19 +10,33 @@ namespace HTOLHAST public class HMP4040 : SCPIInstrument { public HMP4040(string resourceString) : base(resourceString) { } - public string MeasureCurrent(int channel) + public Sample MeasureCurrent(int channel) { string Channel = channel.ToString(); WriteCommand($"INST:NSEL {Channel}"); WriteCommand("MEAS:CURR?"); - return ReadResponse(); + string response = ReadResponse(); + Console.WriteLine($"[Hameg] Measured Current : {response}"); + Sample sample = CreateSample(response, "A"); + return sample; } - public string MeasureVolt(int channel) + public double ReadSetpoint(int channel) + { + double response = double.NaN; + WriteCommand($"INST OUT{channel}"); + WriteCommand($"VOLT? CH{channel}"); + double.TryParse(ReadResponse(), out response); + return response; + } + public Sample MeasureVolt(int channel) { string Channel = channel.ToString(); WriteCommand($"INST:NSEL {Channel}"); WriteCommand("MEAS:VOLT?"); - return ReadResponse(); + string response = ReadResponse(); + Console.WriteLine($"[Hameg] Measured Voltage : {response}"); + Sample sample = CreateSample(response,"V"); + return sample; } public string SetVoltage (double setpoint, int channel) { @@ -91,9 +105,20 @@ namespace HTOLHAST return powerUpSequence; } - public override Sample CreateSample(string response) + public override Sample CreateSample(string response, string unit) { - throw new NotImplementedException(); + string Response = response; + + if (double.TryParse(Response, out double voltage)) + { + HMP4040Sample sample = new HMP4040Sample(DateTime.Now, voltage, unit); + + // Optionally, store or process the sample here + Console.WriteLine($"[HMP4040] Sample Created, Value: {sample.Value} {sample.Unit}"); + return sample; + } + + throw new InvalidOperationException("Unsupported instrument type."); } } } diff --git a/HTOLHAST/HTOLHAST.csproj b/HTOLHAST/HTOLHAST.csproj index d53e558..7c09c8e 100644 --- a/HTOLHAST/HTOLHAST.csproj +++ b/HTOLHAST/HTOLHAST.csproj @@ -44,7 +44,32 @@ ..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll + + Z:\software\MASER software\Source\C# Maser Libraries\Released\Maser.Palantir.MIDSinterface.dll + + + False + Z:\software\MASER software\Source\C# Maser Libraries\Released\Maser.Palantir.MIDSProjectRetriever.dll + + + Z:\software\MASER software\Source\C# Maser Libraries\Released\Maser.Palantir.Model.dll + + + ..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll + + + ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.2\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll + + + ..\packages\Microsoft.Extensions.Logging.Abstractions.8.0.2\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll + + + ..\packages\MySqlConnector.2.4.0\lib\net471\MySqlConnector.dll + + + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + @@ -56,6 +81,23 @@ ..\packages\System.Data.SQLite.Linq.1.0.119.0\lib\net46\System.Data.SQLite.Linq.dll + + ..\packages\System.Diagnostics.DiagnosticSource.8.0.1\lib\net462\System.Diagnostics.DiagnosticSource.dll + + + ..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll + + + + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + + + ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll + + @@ -75,16 +117,29 @@ Form1.cs + + Form + + + FormSelectProject.cs + + + + + Form1.cs + + FormSelectProject.cs + ResXFileCodeGenerator Resources.Designer.cs diff --git a/HTOLHAST/HeaderSetting.cs b/HTOLHAST/HeaderSetting.cs new file mode 100644 index 0000000..e5e4a7d --- /dev/null +++ b/HTOLHAST/HeaderSetting.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HTOLHAST +{ + public class HeaderSetting + { + public string HeaderPin { get; set; } + public int Channel { get; set; } + public string Description { get; set; } + public double Setpoint { get; set; } + public double Tolerance { get; set; } + + public HeaderSetting() + { + + } + } +} diff --git a/HTOLHAST/Keithley6485.cs b/HTOLHAST/Keithley6485.cs index 7d5064b..7eb7995 100644 --- a/HTOLHAST/Keithley6485.cs +++ b/HTOLHAST/Keithley6485.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Threading; namespace HTOLHAST { @@ -46,24 +47,27 @@ namespace HTOLHAST WriteCommand("RANG:AUTO ON"); // Enable AUTO range WriteCommand("READ?"); // trigger and return one reading Console.WriteLine("Read Command Initiated"); + Thread.Sleep(100); } - public string MeasureDCCurrent() + public Sample MeasureDCCurrent() { InitiateRead(); string response = ReadResponse(); - CreateSample(response); - return response; + + Console.WriteLine($"Current reading from PAM : { response }"); + Sample sample = CreateSample(response, "A"); + return sample; } - public override Sample CreateSample(string response) + public override Sample CreateSample(string response, string unit) { string Response = response; // Parse the Keithley output string[] parts = Response.Split(','); - if (parts.Length >= 1 && double.TryParse(parts[0].Replace("A", ""), out double current)) + if (double.TryParse(parts[0].Replace("A", ""), out double current)) { - Keithley6485Sample sample = new Keithley6485Sample(DateTime.Now, current, "A"); + Keithley6485Sample sample = new Keithley6485Sample(DateTime.Now, current, unit); // Optionally, store or process the sample here Console.WriteLine($"[Keithley] Sample Created, Value: {sample.Value} {sample.Unit}"); @@ -71,8 +75,7 @@ namespace HTOLHAST } throw new InvalidOperationException("Unsupported instrument type."); - } - + } // Add more specific methods for Keithley 6485 as needed } } diff --git a/HTOLHAST/Measurement.cs b/HTOLHAST/Measurement.cs new file mode 100644 index 0000000..f37e083 --- /dev/null +++ b/HTOLHAST/Measurement.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HTOLHAST +{ + public class Measurement + { + // Timestamp, Position, Device, Measurement, Value, Unit + // 2025-01-09, 1, HAMEG1, CH1, 1.0, 0.1 + // 2025-01-09, 1, HAMEG2, CH5, 1.0, 0.1 + // 2025-01-09, 1, KEITHLEY, CH1, -, 1.0 + // 2025-01-09, 1, AGILENT, HEADER1, 1.0, - + + public DateTime Timestamp { get; set; } + public int Position { get; set; } + public string Device { get; set; } + public string Description { get; set; } + public double Value { get; set; } + public string Unit { get; set; } + + + public Measurement() + { + + } + } +} diff --git a/HTOLHAST/PowerSupplySetting.cs b/HTOLHAST/PowerSupplySetting.cs new file mode 100644 index 0000000..bfc2293 --- /dev/null +++ b/HTOLHAST/PowerSupplySetting.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HTOLHAST +{ + public class PowerSupplySetting + { + public int Channel { get; set; } + public string Description { get; set; } + public double Voltage { get; set; } + public double Tolerance { get; set; } + public double CurrentLimit { get; set; } + public bool Enabled { get; set; } + + public PowerSupplySetting() + { + + } + } +} diff --git a/HTOLHAST/Sample.cs b/HTOLHAST/Sample.cs index 0af7124..4481b49 100644 --- a/HTOLHAST/Sample.cs +++ b/HTOLHAST/Sample.cs @@ -54,7 +54,6 @@ namespace HTOLHAST public class Agilent34970aSample : Sample { public double Value { get; set; } - public Agilent34970aSample(DateTime timeStamp, double value, string unit) : base(timeStamp, unit) { Value = value; diff --git a/HTOLHAST/ScpiInstrument.cs b/HTOLHAST/ScpiInstrument.cs index 955f72b..11bae4d 100644 --- a/HTOLHAST/ScpiInstrument.cs +++ b/HTOLHAST/ScpiInstrument.cs @@ -13,7 +13,7 @@ namespace HTOLHAST { protected ResourceManager resourceManager; protected Ivi.Visa.Interop.FormattedIO488 instrument; - public abstract Sample CreateSample(string response); + public abstract Sample CreateSample(string response, string unit); protected SCPIInstrument(string resourceString) { resourceManager = new ResourceManager(); diff --git a/HTOLHAST/SwitchMatrix.cs b/HTOLHAST/SwitchMatrix.cs new file mode 100644 index 0000000..faf61d8 --- /dev/null +++ b/HTOLHAST/SwitchMatrix.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HTOLHAST +{ + public class SwitchMatrix + { + public int Channel { get; set; } + public int SW1 { get; set; } + public int SW2 { get; set; } + public int SW3 { get; set; } + } +} diff --git a/HTOLHAST/packages.config b/HTOLHAST/packages.config index 1146e4e..ddab9ef 100644 --- a/HTOLHAST/packages.config +++ b/HTOLHAST/packages.config @@ -1,9 +1,19 @@  + + + + + + + + + + \ No newline at end of file