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) { foreach (var sequence in powerUpSequence) { SetOutputChannel(sequence.Channel,true); Thread.Sleep(sequence.Delay); } } public void PowerDownSequence(List powerUpSequence) { foreach (var sequence in powerUpSequence) { SetOutputChannel(sequence.Channel, false); Thread.Sleep(sequence.Delay); } } public List GenerateSimulationPowerUpSequence() { List powerUpSequence = new List { 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(); } } }