Add project files.

This commit is contained in:
Wesley Hofman
2025-08-29 18:17:48 +02:00
parent 31eaf9e5f7
commit a0d5f3b21b
23 changed files with 2144 additions and 0 deletions

101
HTOLHAST/HMP4040.cs Normal file
View File

@@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
namespace HTOLHAST
{
public class HMP4040 : SCPIInstrument
{
public HMP4040(string resourceString) : base(resourceString) { }
public string MeasureCurrent(int channel)
{
string Channel = channel.ToString();
WriteCommand($"INST:NSEL {Channel}");
WriteCommand("MEAS:CURR?");
return ReadResponse();
}
public string MeasureVolt(int channel)
{
string Channel = channel.ToString();
WriteCommand($"INST:NSEL {Channel}");
WriteCommand("MEAS:VOLT?");
return ReadResponse();
}
public string SetVoltage (double setpoint, int channel)
{
WriteCommand($"INST:NSEL {channel}");
WriteCommand($"VOLT {setpoint}");
WriteCommand($"VOLT?");
return ReadResponse();
}
public string SetCurrent(double setpoint, int channel)
{
WriteCommand($"INST:NSEL {channel}");
WriteCommand($"CURR {setpoint}");
WriteCommand($"CURR?");
return ReadResponse();
}
public void SetOutputChannel (int channel, bool enabled)
{
WriteCommand($"INST:NSEL {channel}");
if (enabled)
{
WriteCommand("OUTP ON");
}
else
{
WriteCommand("OUTP OFF");
}
}
public void SetGeneralOutputState(bool enabled)
{
if (enabled)
{
WriteCommand("OUTP:GEN ON");
}
else
{
WriteCommand("OUTP:GEN OFF");
}
}
public void PowerUpSequence(List<PowerUpSequence> powerUpSequence)
{
foreach (var sequence in powerUpSequence)
{
SetOutputChannel(sequence.Channel,true);
Thread.Sleep(sequence.Delay);
}
}
public void PowerDownSequence(List<PowerUpSequence> powerUpSequence)
{
foreach (var sequence in powerUpSequence)
{
SetOutputChannel(sequence.Channel, false);
Thread.Sleep(sequence.Delay);
}
}
public List<PowerUpSequence> GenerateSimulationPowerUpSequence()
{
List<PowerUpSequence> powerUpSequence = new List<PowerUpSequence> {
new PowerUpSequence { Channel = 1, Delay = 1000},
new PowerUpSequence { Channel = 3, Delay = 1000},
new PowerUpSequence { Channel = 4, Delay = 1000},
new PowerUpSequence { Channel = 2, Delay = 1000},
};
return powerUpSequence;
}
public override Sample CreateSample(string response)
{
throw new NotImplementedException();
}
}
}