diff --git a/HTOLHAST/Agilent34970a.cs b/HTOLHAST/Agilent34970a.cs
new file mode 100644
index 0000000..7a71e93
--- /dev/null
+++ b/HTOLHAST/Agilent34970a.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HTOLHAST
+{
+ public class Agilent34970a : SCPIInstrument
+ {
+ public Agilent34970a(string resourceString) : base(resourceString) { }
+
+ public override Sample CreateSample(string response)
+ {
+ string Response = response;
+
+ // Parse the Keithley output
+ string[] parts = Response.Split(',');
+
+ if (parts.Length >= 1 && double.TryParse(parts[0].Replace("V", ""), out double current))
+ {
+ Agilent34970aSample sample = new Agilent34970aSample(DateTime.Now, current, "V");
+
+ // Optionally, store or process the sample here
+ Console.WriteLine($"[Agilent34970] Sample Created, Value: {sample.Value} {sample.Unit}");
+ return sample;
+ }
+
+ throw new InvalidOperationException("Unsupported instrument type.");
+ }
+ }
+}
diff --git a/HTOLHAST/Form1.Designer.cs b/HTOLHAST/Form1.Designer.cs
index dea9aaa..e518890 100644
--- a/HTOLHAST/Form1.Designer.cs
+++ b/HTOLHAST/Form1.Designer.cs
@@ -31,10 +31,10 @@ namespace HTOLHAST
{
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPageInstruments = new System.Windows.Forms.TabPage();
- this.checkBox4 = new System.Windows.Forms.CheckBox();
- this.checkBox3 = new System.Windows.Forms.CheckBox();
- this.checkBox2 = new System.Windows.Forms.CheckBox();
- this.checkBox1 = new System.Windows.Forms.CheckBox();
+ 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();
@@ -46,13 +46,13 @@ namespace HTOLHAST
this.textBox6 = new System.Windows.Forms.TextBox();
this.textBox5 = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label();
- this.textBox4 = new System.Windows.Forms.TextBox();
+ this.tbResourceStringPAM = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
- this.textBox3 = new System.Windows.Forms.TextBox();
+ this.tbResourceStringDAQ = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
- this.textBox2 = new System.Windows.Forms.TextBox();
+ this.tbResourceStringPSU2 = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
- this.textBox1 = new System.Windows.Forms.TextBox();
+ this.tbResourceStringPSU1 = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.pictureBox4 = new System.Windows.Forms.PictureBox();
@@ -108,6 +108,7 @@ namespace HTOLHAST
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.tabControl1.SuspendLayout();
this.tabPageInstruments.SuspendLayout();
this.panel1.SuspendLayout();
@@ -140,19 +141,20 @@ namespace HTOLHAST
//
// tabPageInstruments
//
- this.tabPageInstruments.Controls.Add(this.checkBox4);
- this.tabPageInstruments.Controls.Add(this.checkBox3);
- this.tabPageInstruments.Controls.Add(this.checkBox2);
- this.tabPageInstruments.Controls.Add(this.checkBox1);
+ 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.textBox4);
+ this.tabPageInstruments.Controls.Add(this.tbResourceStringPAM);
this.tabPageInstruments.Controls.Add(this.label8);
- this.tabPageInstruments.Controls.Add(this.textBox3);
+ this.tabPageInstruments.Controls.Add(this.tbResourceStringDAQ);
this.tabPageInstruments.Controls.Add(this.label7);
- this.tabPageInstruments.Controls.Add(this.textBox2);
+ this.tabPageInstruments.Controls.Add(this.tbResourceStringPSU2);
this.tabPageInstruments.Controls.Add(this.label6);
- this.tabPageInstruments.Controls.Add(this.textBox1);
+ this.tabPageInstruments.Controls.Add(this.tbResourceStringPSU1);
this.tabPageInstruments.Controls.Add(this.label5);
this.tabPageInstruments.Controls.Add(this.label4);
this.tabPageInstruments.Controls.Add(this.pictureBox4);
@@ -171,49 +173,49 @@ namespace HTOLHAST
this.tabPageInstruments.Text = "Instruments";
this.tabPageInstruments.UseVisualStyleBackColor = true;
//
- // checkBox4
+ // cbPAMEnabled
//
- this.checkBox4.AutoSize = true;
- this.checkBox4.Location = new System.Drawing.Point(618, 271);
- this.checkBox4.Margin = new System.Windows.Forms.Padding(2);
- this.checkBox4.Name = "checkBox4";
- this.checkBox4.Size = new System.Drawing.Size(59, 17);
- this.checkBox4.TabIndex = 22;
- this.checkBox4.Text = "Enable";
- this.checkBox4.UseVisualStyleBackColor = true;
+ 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.TabIndex = 22;
+ this.cbPAMEnabled.Text = "Enable";
+ this.cbPAMEnabled.UseVisualStyleBackColor = true;
//
- // checkBox3
+ // cbPSU2Enabled
//
- this.checkBox3.AutoSize = true;
- this.checkBox3.Location = new System.Drawing.Point(262, 271);
- this.checkBox3.Margin = new System.Windows.Forms.Padding(2);
- this.checkBox3.Name = "checkBox3";
- this.checkBox3.Size = new System.Drawing.Size(59, 17);
- this.checkBox3.TabIndex = 21;
- this.checkBox3.Text = "Enable";
- this.checkBox3.UseVisualStyleBackColor = true;
+ this.cbPSU2Enabled.AutoSize = true;
+ 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.TabIndex = 21;
+ this.cbPSU2Enabled.Text = "Enable";
+ this.cbPSU2Enabled.UseVisualStyleBackColor = true;
//
- // checkBox2
+ // cbDAQEnabled
//
- this.checkBox2.AutoSize = true;
- this.checkBox2.Location = new System.Drawing.Point(618, 24);
- this.checkBox2.Margin = new System.Windows.Forms.Padding(2);
- this.checkBox2.Name = "checkBox2";
- this.checkBox2.Size = new System.Drawing.Size(59, 17);
- this.checkBox2.TabIndex = 20;
- this.checkBox2.Text = "Enable";
- this.checkBox2.UseVisualStyleBackColor = true;
+ 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;
//
- // checkBox1
+ // cbPSU1Enabled
//
- this.checkBox1.AutoSize = true;
- this.checkBox1.Location = new System.Drawing.Point(262, 24);
- this.checkBox1.Margin = new System.Windows.Forms.Padding(2);
- this.checkBox1.Name = "checkBox1";
- this.checkBox1.Size = new System.Drawing.Size(59, 17);
- this.checkBox1.TabIndex = 19;
- this.checkBox1.Text = "Enable";
- this.checkBox1.UseVisualStyleBackColor = true;
+ 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
//
@@ -324,13 +326,13 @@ namespace HTOLHAST
this.label9.TabIndex = 0;
this.label9.Text = "DATALOGGER MAX CURRENT: ";
//
- // textBox4
+ // tbResourceStringPAM
//
- this.textBox4.Location = new System.Drawing.Point(490, 465);
- this.textBox4.Margin = new System.Windows.Forms.Padding(2);
- this.textBox4.Name = "textBox4";
- this.textBox4.Size = new System.Drawing.Size(184, 20);
- this.textBox4.TabIndex = 15;
+ this.tbResourceStringPAM.Location = new System.Drawing.Point(490, 465);
+ this.tbResourceStringPAM.Margin = new System.Windows.Forms.Padding(2);
+ this.tbResourceStringPAM.Name = "tbResourceStringPAM";
+ this.tbResourceStringPAM.Size = new System.Drawing.Size(184, 20);
+ this.tbResourceStringPAM.TabIndex = 15;
//
// label8
//
@@ -342,13 +344,13 @@ namespace HTOLHAST
this.label8.TabIndex = 14;
this.label8.Text = "VISA ADDRESS";
//
- // textBox3
+ // tbResourceStringDAQ
//
- this.textBox3.Location = new System.Drawing.Point(490, 216);
- this.textBox3.Margin = new System.Windows.Forms.Padding(2);
- this.textBox3.Name = "textBox3";
- this.textBox3.Size = new System.Drawing.Size(184, 20);
- this.textBox3.TabIndex = 13;
+ this.tbResourceStringDAQ.Location = new System.Drawing.Point(490, 216);
+ this.tbResourceStringDAQ.Margin = new System.Windows.Forms.Padding(2);
+ this.tbResourceStringDAQ.Name = "tbResourceStringDAQ";
+ this.tbResourceStringDAQ.Size = new System.Drawing.Size(184, 20);
+ this.tbResourceStringDAQ.TabIndex = 13;
//
// label7
//
@@ -360,13 +362,13 @@ namespace HTOLHAST
this.label7.TabIndex = 12;
this.label7.Text = "VISA ADDRESS";
//
- // textBox2
+ // tbResourceStringPSU2
//
- this.textBox2.Location = new System.Drawing.Point(134, 465);
- this.textBox2.Margin = new System.Windows.Forms.Padding(2);
- this.textBox2.Name = "textBox2";
- this.textBox2.Size = new System.Drawing.Size(184, 20);
- this.textBox2.TabIndex = 11;
+ this.tbResourceStringPSU2.Location = new System.Drawing.Point(134, 465);
+ this.tbResourceStringPSU2.Margin = new System.Windows.Forms.Padding(2);
+ this.tbResourceStringPSU2.Name = "tbResourceStringPSU2";
+ this.tbResourceStringPSU2.Size = new System.Drawing.Size(184, 20);
+ this.tbResourceStringPSU2.TabIndex = 11;
//
// label6
//
@@ -378,13 +380,13 @@ namespace HTOLHAST
this.label6.TabIndex = 10;
this.label6.Text = "VISA ADDRESS";
//
- // textBox1
+ // tbResourceStringPSU1
//
- this.textBox1.Location = new System.Drawing.Point(134, 216);
- this.textBox1.Margin = new System.Windows.Forms.Padding(2);
- this.textBox1.Name = "textBox1";
- this.textBox1.Size = new System.Drawing.Size(184, 20);
- this.textBox1.TabIndex = 9;
+ this.tbResourceStringPSU1.Location = new System.Drawing.Point(134, 216);
+ this.tbResourceStringPSU1.Margin = new System.Windows.Forms.Padding(2);
+ this.tbResourceStringPSU1.Name = "tbResourceStringPSU1";
+ this.tbResourceStringPSU1.Size = new System.Drawing.Size(184, 20);
+ this.tbResourceStringPSU1.TabIndex = 9;
//
// label5
//
@@ -944,6 +946,16 @@ namespace HTOLHAST
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);
+ //
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -980,13 +992,13 @@ namespace HTOLHAST
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPageInstruments;
- private System.Windows.Forms.TextBox textBox4;
+ private System.Windows.Forms.TextBox tbResourceStringPAM;
private System.Windows.Forms.Label label8;
- private System.Windows.Forms.TextBox textBox3;
+ private System.Windows.Forms.TextBox tbResourceStringDAQ;
private System.Windows.Forms.Label label7;
- private System.Windows.Forms.TextBox textBox2;
+ private System.Windows.Forms.TextBox tbResourceStringPSU2;
private System.Windows.Forms.Label label6;
- private System.Windows.Forms.TextBox textBox1;
+ private System.Windows.Forms.TextBox tbResourceStringPSU1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.PictureBox pictureBox4;
@@ -1009,10 +1021,10 @@ namespace HTOLHAST
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.TextBox textBox6;
- private System.Windows.Forms.CheckBox checkBox4;
- private System.Windows.Forms.CheckBox checkBox3;
- private System.Windows.Forms.CheckBox checkBox2;
- private System.Windows.Forms.CheckBox checkBox1;
+ 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;
@@ -1057,6 +1069,7 @@ namespace HTOLHAST
private System.Windows.Forms.Label label17;
private System.Windows.Forms.Button button17;
private System.Windows.Forms.DataGridViewTextBoxColumn ID;
+ private System.Windows.Forms.Button btnInitializeInstruments;
}
}
diff --git a/HTOLHAST/Form1.cs b/HTOLHAST/Form1.cs
index 501fb43..be1839c 100644
--- a/HTOLHAST/Form1.cs
+++ b/HTOLHAST/Form1.cs
@@ -13,11 +13,91 @@ namespace HTOLHAST
{
public partial class Form1 : Form
{
+
+ HMP4040 PSU1;
+ HMP4040 PSU2;
+ Keithley6485 PAM;
+ Agilent34970a DAQ;
+
+
public Form1()
{
InitializeComponent();
}
+
+
+ public void InitializeInstruments()
+ {
+
+ // Mandatory instruments:
+ InitializePSU1(tbResourceStringPSU1.Text);
+ InitializeDAQ(tbResourceStringDAQ.Text);
+
+ // Optional Instruments check if to be used
+ if (cbPSU1Enabled.Checked)
+ {
+ InitializePSU2(tbResourceStringPSU2.Text);
+ }
+
+ if (cbPAMEnabled.Checked)
+ {
+ InitializePAM(tbResourceStringPAM.Text);
+ }
+ }
+ public void InitializePSU1(string resourceString)
+ {
+ try
+ {
+ PSU1 = new HMP4040(resourceString);
+ }
+ catch (Exception)
+ {
+
+ throw;
+ }
+
+ }
+ public void InitializePSU2(string resourceString)
+ {
+ try
+ {
+ PSU2 = new HMP4040(resourceString);
+ }
+ catch (Exception)
+ {
+
+ throw;
+ }
+
+ }
+ public void InitializePAM(string resourceString)
+ {
+ try
+ {
+ PAM = new Keithley6485(resourceString);
+ }
+ catch (Exception)
+ {
+
+ throw;
+ }
+
+ }
+ public void InitializeDAQ(string resourceString)
+ {
+ try
+ {
+ DAQ = new Agilent34970a(resourceString);
+ }
+ catch (Exception)
+ {
+
+ throw;
+ }
+
+ }
+
public void HamegValidationOfMethods()
{
string resourceString = "ASRL4::INSTR"; // Replace with your instrument's resource string
@@ -58,6 +138,11 @@ namespace HTOLHAST
// Close the instrument connection
keithley.Close();
- }
+ }
+
+ private void btnInitializeInstruments_Click(object sender, EventArgs e)
+ {
+ InitializeInstruments();
+ }
}
}
diff --git a/HTOLHAST/Form1.resx b/HTOLHAST/Form1.resx
index f1196cb..46b325c 100644
--- a/HTOLHAST/Form1.resx
+++ b/HTOLHAST/Form1.resx
@@ -123,12 +123,39 @@
True
+
+ True
+
+
+ True
+
True
True
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
True
@@ -156,6 +183,21 @@
True
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
True
diff --git a/HTOLHAST/HTOLHAST.csproj b/HTOLHAST/HTOLHAST.csproj
index 1f09c99..d53e558 100644
--- a/HTOLHAST/HTOLHAST.csproj
+++ b/HTOLHAST/HTOLHAST.csproj
@@ -67,6 +67,7 @@
+
Form
diff --git a/HTOLHAST/Sample.cs b/HTOLHAST/Sample.cs
index 597285b..0af7124 100644
--- a/HTOLHAST/Sample.cs
+++ b/HTOLHAST/Sample.cs
@@ -50,4 +50,14 @@ namespace HTOLHAST
Value = value;
}
}
+
+ public class Agilent34970aSample : Sample
+ {
+ public double Value { get; set; }
+
+ public Agilent34970aSample(DateTime timeStamp, double value, string unit) : base(timeStamp, unit)
+ {
+ Value = value;
+ }
+ }
}