Files
htolhast/HTOLHAST/Agilent34970a.cs
Wesley Hofman 9292dcfad5 test commit
2025-09-11 09:17:50 +02:00

33 lines
1008 B
C#

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.");
}
}
}