2026-06-30 12:10:29 +08:00
|
|
|
|
namespace SSPCTester.Devices.Interfaces;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 可编程负载(IT8733P / IT8702P)的工作模式。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public enum LoadMode
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>恒流。</summary>
|
|
|
|
|
|
CC,
|
|
|
|
|
|
/// <summary>恒压。</summary>
|
|
|
|
|
|
CV,
|
|
|
|
|
|
/// <summary>恒阻。</summary>
|
|
|
|
|
|
CR,
|
|
|
|
|
|
/// <summary>恒功率。</summary>
|
|
|
|
|
|
CP
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public readonly record struct PowerReading(double Volts, double Amps, double Watts);
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 可编程负载抽象接口。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public interface ILoad : IDeviceConnection
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>切换工作模式。</summary>
|
|
|
|
|
|
Task SetModeAsync(LoadMode mode, CancellationToken ct = default);
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>设定目标值(含义取决于当前模式:A / V / Ω / W)。</summary>
|
|
|
|
|
|
Task SetValueAsync(double value, CancellationToken ct = default);
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>开启 / 关闭负载输入。</summary>
|
|
|
|
|
|
Task InputAsync(bool on, CancellationToken ct = default);
|
|
|
|
|
|
|
2026-07-12 12:07:41 +08:00
|
|
|
|
/// <summary>从设备查询当前输入开关状态。</summary>
|
|
|
|
|
|
Task<bool> GetInputStateAsync(CancellationToken ct = default);
|
|
|
|
|
|
|
|
|
|
|
|
Task ResetAsync(CancellationToken ct = default);
|
|
|
|
|
|
|
2026-06-30 12:10:29 +08:00
|
|
|
|
/// <summary>读取实际电压、电流。</summary>
|
|
|
|
|
|
Task<(double volts, double amps)> ReadAsync(CancellationToken ct = default);
|
|
|
|
|
|
|
|
|
|
|
|
Task<PowerReading> ReadPowerAsync(CancellationToken ct = default);
|
|
|
|
|
|
|
|
|
|
|
|
Task<string> QueryIdentityAsync(CancellationToken ct = default);
|
2026-07-12 12:07:41 +08:00
|
|
|
|
|
|
|
|
|
|
Task<string> QueryErrorAsync(CancellationToken ct = default);
|
2026-06-30 12:10:29 +08:00
|
|
|
|
}
|