diff --git a/DeviceCommand/Devices/PW8001.cs b/DeviceCommand/Devices/PW8001.cs
new file mode 100644
index 0000000..0b2bd70
--- /dev/null
+++ b/DeviceCommand/Devices/PW8001.cs
@@ -0,0 +1,244 @@
+using Common;
+using Common.Attributes;
+using DeviceCommand.Base;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace DeviceCommand.Device
+{
+ ///
+ /// 功率分析仪(型号:HIOKI PW8001)
+ ///
+
+ public class PW8001 : Tcp
+ {
+ ///
+ /// 构造函数:SCPI 通信使用端口 23
+ ///
+ public PW8001()
+ {
+ Port = 23;
+ }
+
+ ///
+ /// 执行引擎注入的设备实例会话键
+ ///
+ public string? SessionKey { get; set; }
+
+ #region 1. IEEE 488.2 基础标准命令
+
+ public virtual async Task 查询机器信息(CancellationToken ct = default)
+ {
+ return await WriteReadAsync("*IDN?\r\n", "\n", ct);
+ }
+
+ public virtual async Task 查询硬件选项(CancellationToken ct = default)
+ {
+ return await WriteReadAsync("*OPT?\r\n", "\n", ct);
+ }
+
+ public virtual async Task 复位仪器(CancellationToken ct = default)
+ {
+ await SendAsync("*RST\r\n", ct);
+ }
+
+ public virtual async Task 清除状态(CancellationToken ct = default)
+ {
+ await SendAsync("*CLS\r\n", ct);
+ }
+
+ #endregion
+
+ #region 2. 仪器系统与测试模式设置设置 (System & Mode)
+
+ public virtual async Task 设置测试模式_WIDE(CancellationToken ct = default)
+ {
+ await SendAsync(":MODE WIDE\r\n", ct);
+ }
+
+ public virtual async Task 设置测试模式_IEC(CancellationToken ct = default)
+ {
+ await SendAsync(":MODE IEC\r\n", ct);
+ }
+
+ public virtual async Task 查询测试模式(CancellationToken ct = default)
+ {
+ return await WriteReadAsync(":MODE?\r\n", "\n", ct);
+ }
+
+ public virtual async Task 设置同步源(string 源, CancellationToken ct = default)
+ {
+ await SendAsync($":SYNC:SOURce {源}\r\n", ct);
+ }
+
+ public virtual async Task 查询同步源(CancellationToken ct = default)
+ {
+ return await WriteReadAsync(":SYNC:SOURce?\r\n", "\n", ct);
+ }
+
+ public virtual async Task 设置零点调整(string 状态, CancellationToken ct = default)
+ {
+ await SendAsync($":ZERO {状态}\r\n", ct);
+ }
+
+ public virtual async Task 查询零点调整(CancellationToken ct = default)
+ {
+ return await WriteReadAsync(":ZERO?\r\n", "\n", ct);
+ }
+
+ public virtual async Task 设置零点抑制(string 状态, CancellationToken ct = default)
+ {
+ await SendAsync($":ZSP {状态}\r\n", ct);
+ }
+
+ public virtual async Task 查询零点抑制(CancellationToken ct = default)
+ {
+ return await WriteReadAsync(":ZSP?\r\n", "\n", ct);
+ }
+
+ public virtual async Task 设置响应消息头(string 状态, CancellationToken ct = default)
+ {
+ await SendAsync($":HEADer {状态}\r\n", ct);
+ }
+
+ public virtual async Task 查询响应消息头(CancellationToken ct = default)
+ {
+ return await WriteReadAsync(":HEADer?\r\n", "\n", ct);
+ }
+
+ public virtual async Task 设置按键锁定(string 状态, CancellationToken ct = default)
+ {
+ await SendAsync($":KLOCk {状态}\r\n", ct);
+ }
+
+ public virtual async Task 查询按键锁定(CancellationToken ct = default)
+ {
+ return await WriteReadAsync(":KLOCk?\r\n", "\n", ct);
+ }
+
+ #endregion
+
+ #region 3. 积分控制 (Integration)
+
+ public virtual async Task 设置积分控制(string 模式, CancellationToken ct = default)
+ {
+ await SendAsync($":INTEG:CONTROL {模式}\r\n", ct);
+ }
+
+ public virtual async Task 查询积分控制(CancellationToken ct = default)
+ {
+ return await WriteReadAsync(":INTEG:CONTROL?\r\n", "\n", ct);
+ }
+
+ public virtual async Task 设置积分模式(string 通道号, string 模式, CancellationToken ct = default)
+ {
+ await SendAsync($":INTEG:MODE{通道号} {模式}\r\n", ct);
+ }
+
+ public virtual async Task 查询积分模式(string 通道号, CancellationToken ct = default)
+ {
+ return await WriteReadAsync($":INTEG:MODE{通道号}?\r\n", "\n", ct);
+ }
+
+ #endregion
+
+ #region 4. 测量值查询 (Measurement Query)
+
+ // ---------------- 基础测量(不含变比) ----------------
+
+ public virtual async Task 查询电压_不含变比(int 通道号, CancellationToken ct = default)
+ {
+ return await WriteReadAsync($":MEAS:U{通道号}?\r\n", "\n", ct);
+ }
+
+ public virtual async Task 查询电流_不含变比(int 通道号, CancellationToken ct = default)
+ {
+ return await WriteReadAsync($":MEAS:I{通道号}?\r\n", "\n", ct);
+ }
+
+ public virtual async Task 查询功率_不含变比(int 通道号, CancellationToken ct = default)
+ {
+ return await WriteReadAsync($":MEAS:P{通道号}?\r\n", "\n", ct);
+ }
+
+ // ---------------- 基础测量(含变比 CT) ----------------
+
+ public virtual async Task 查询电压_含变比(int 通道号, CancellationToken ct = default)
+ {
+ return await WriteReadAsync($":MEAS:U{通道号}:CT?\r\n", "\n", ct);
+ }
+
+ public virtual async Task 查询电流_含变比(int 通道号, CancellationToken ct = default)
+ {
+ return await WriteReadAsync($":MEAS:I{通道号}:CT?\r\n", "\n", ct);
+ }
+
+ public virtual async Task 查询功率_含变比(int 通道号, CancellationToken ct = default)
+ {
+ return await WriteReadAsync($":MEAS:P{通道号}:CT?\r\n", "\n", ct);
+ }
+
+ // ---------------- 其他高阶参数测量 ----------------
+
+ public virtual async Task 查询有功功率积分(int 通道号, CancellationToken ct = default)
+ {
+ return await WriteReadAsync($":MEAS:WP{通道号}?\r\n", "\n", ct);
+ }
+
+ public virtual async Task 查询电压THD(int 通道号, CancellationToken ct = default)
+ {
+ return await WriteReadAsync($":MEAS:UTHD{通道号}?\r\n", "\n", ct);
+ }
+
+ public virtual async Task 查询电流THD(int 通道号, CancellationToken ct = default)
+ {
+ return await WriteReadAsync($":MEAS:ITHD{通道号}?\r\n", "\n", ct);
+ }
+
+ public virtual async Task 查询线电压U12(CancellationToken ct = default)
+ {
+ return await WriteReadAsync(":MEAS:U12?\r\n", "\n", ct);
+ }
+
+ public virtual async Task 查询总功率P123(CancellationToken ct = default)
+ {
+ return await WriteReadAsync(":MEAS:P123?\r\n", "\n", ct);
+ }
+
+ // ---------------- 整流平均值 ----------------
+
+ public virtual async Task 查询电压整流平均值(int 通道号, CancellationToken ct = default)
+ {
+ return await WriteReadAsync($":MEAS:UMN{通道号}?\r\n", "\n", ct);
+ }
+
+ public virtual async Task 查询电流整流平均值(int 通道号, CancellationToken ct = default)
+ {
+ return await WriteReadAsync($":MEAS:IMN{通道号}?\r\n", "\n", ct);
+ }
+
+ public virtual async Task 查询电压整流平均值_含变比(int 通道号, CancellationToken ct = default)
+ {
+ return await WriteReadAsync($":MEAS:UMN{通道号}:CT?\r\n", "\n", ct);
+ }
+
+ public virtual async Task 查询电流整流平均值_含变比(int 通道号, CancellationToken ct = default)
+ {
+ return await WriteReadAsync($":MEAS:IMN{通道号}:CT?\r\n", "\n", ct);
+ }
+
+ #endregion
+
+ #region 5. 自定义透传指令
+
+ ///
+ /// 发送自定义命令
+ ///
+ public virtual async Task 发送自定义命令(string 命令, CancellationToken ct = default)
+ {
+ await SendAsync($"{命令}\r\n", ct);
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/DeviceCommand/Devices/TektronixMSO.cs b/DeviceCommand/Devices/TektronixMSO.cs
new file mode 100644
index 0000000..1a8ffa5
--- /dev/null
+++ b/DeviceCommand/Devices/TektronixMSO.cs
@@ -0,0 +1,198 @@
+using Common.Attributes;
+using DeviceCommand.Base;
+using Model.Models;
+using System;
+using System.Globalization;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace DeviceCommand.Devices
+{
+ #region 枚举定义
+
+ ///
+ /// Tektronix MSO 采集模式
+ ///
+ public enum TekAcquisitionMode
+ {
+ /// 采样模式
+ SAMple,
+ /// 峰值检测模式
+ PEAKdetect,
+ /// 高分辨率模式
+ HIRes,
+ /// 平均模式
+ AVErage,
+ /// 包络模式
+ ENVelope
+ }
+
+ ///
+ /// Tektronix MSO 测量类型 (部分常用)
+ ///
+ public enum TekMeasurementType
+ {
+ AMPLitude,
+ FREQuency,
+ MEAN,
+ PK2PK,
+ MAXimum,
+ MINimum
+ }
+
+ #endregion
+
+ [ACPCommand]
+ public class TektronixMSO : Tcp
+ {
+ // SCPI 指令结束符 (文档中提到消息终止符需使用 LF)[cite: 1]
+ private const string ScpiDelimiter = "\n";
+
+ public TektronixMSO(TcpConfig config) : base(config)
+ {
+ }
+
+ #region 1. 公共命令与状态查询
+
+ public virtual async Task 查询设备标识(CancellationToken ct = default)
+ {
+ // 返回仪器的标识代码[cite: 1]
+ return await WriteReadAsync($"*IDN?{ScpiDelimiter}", ScpiDelimiter, ct);
+ }
+
+ public virtual async Task 查询忙碌状态(CancellationToken ct = default)
+ {
+ // 查询仪器是否处于忙碌状态,常用于同步操作[cite: 1]
+ return await WriteReadAsync($"BUSY?{ScpiDelimiter}", ScpiDelimiter, ct);
+ }
+
+ public virtual async Task 执行自校准(CancellationToken ct = default)
+ {
+ // 指示仪器执行信号路径校准 (SPC),需要几分钟时间[cite: 1]
+ await SendAsync($"*CAL?{ScpiDelimiter}", ct);
+ }
+
+ #endregion
+
+ #region 2. 采集系统控制 (Acquisition)
+
+ ///
+ /// 启动或停止采集
+ ///
+ public virtual async Task 设置采集状态(bool 运行, CancellationToken ct = default)
+ {
+ // 启动、停止或返回采集状态[cite: 1]
+ string 参数 = 运行 ? "RUN" : "STOP";
+ await SendAsync($"ACQuire:STATE {参数}{ScpiDelimiter}", ct);
+ }
+
+ public virtual async Task 查询采集状态(CancellationToken ct = default)
+ {
+ return await WriteReadAsync($"ACQuire:STATE?{ScpiDelimiter}", ScpiDelimiter, ct); //[cite: 1]
+ }
+
+ public virtual async Task 设置采集模式(TekAcquisitionMode 模式, CancellationToken ct = default)
+ {
+ // 设置或查询采集模式[cite: 1]
+ await SendAsync($"ACQuire:MODe {模式}{ScpiDelimiter}", ct);
+ }
+
+ #endregion
+
+ #region 3. 水平系统控制 (Horizontal)
+
+ public virtual async Task 设置水平刻度(double 秒每格, CancellationToken ct = default)
+ {
+ // 设置或查询水平刻度 (Scale)[cite: 1]
+ string cmd = string.Format(CultureInfo.InvariantCulture, "HORizontal:SCAle {0:E}{1}", 秒每格, ScpiDelimiter);
+ await SendAsync(cmd, ct);
+ }
+
+ public virtual async Task 设置记录长度(long 长度, CancellationToken ct = default)
+ {
+ // 设置或查询记录长度[cite: 1]
+ await SendAsync($"HORizontal:RECOrdlength {长度}{ScpiDelimiter}", ct);
+ }
+
+ public virtual async Task 设置采样率(double 采样率, CancellationToken ct = default)
+ {
+ // 设置或查询水平采样率[cite: 1]
+ string cmd = string.Format(CultureInfo.InvariantCulture, "HORizontal:SAMPLERate {0:E}{1}", 采样率, ScpiDelimiter);
+ await SendAsync(cmd, ct);
+ }
+
+ #endregion
+
+ #region 4. 通道与显示控制 (Display & Vertical)
+
+ ///
+ /// 全局启用或关闭某通道的显示
+ ///
+ public virtual async Task 设置通道显示开关(int 通道号, bool 开启, CancellationToken ct = default)
+ {
+ // 设置或查询指定通道的显示模式(开或关)[cite: 1]
+ string 参数 = 开启 ? "ON" : "OFF";
+ await SendAsync($"DISplay:GLObal:CH{通道号}:STATE {参数}{ScpiDelimiter}", ct);
+ }
+
+ ///
+ /// 设置指定通道的垂直缩放比例 (Volts/Div)
+ ///
+ public virtual async Task 设置通道垂直刻度(int 通道号, double 伏特每格, CancellationToken ct = default)
+ {
+ // 设置或查询指定Waveform View内指定通道的垂直缩放比例(注:WaveView 通常为1)[cite: 1]
+ string cmd = string.Format(CultureInfo.InvariantCulture, "DISplay:WAVEView1:CH{0}:VERTical:SCAle {1:E}{2}", 通道号, 伏特每格, ScpiDelimiter);
+ await SendAsync(cmd, ct);
+ }
+
+ ///
+ /// 设置指定通道的垂直位置 (Divisions)
+ ///
+ public virtual async Task 设置通道垂直位置(int 通道号, double 格数, CancellationToken ct = default)
+ {
+ // 设置或查询指定Waveform View内指定通道的垂直位置(以格为单位)[cite: 1]
+ string cmd = string.Format(CultureInfo.InvariantCulture, "DISplay:WAVEView1:CH{0}:VERTical:POSition {1:F2}{2}", 通道号, 格数, ScpiDelimiter);
+ await SendAsync(cmd, ct);
+ }
+
+ #endregion
+
+ #region 5. 自动测量 (Measurement)
+
+ ///
+ /// 新增一个测量项槽位
+ ///
+ public virtual async Task 添加测量项(CancellationToken ct = default)
+ {
+ // 添加一个测量项[cite: 1]
+ await SendAsync($"MEASUrement:ADDMEAS{ScpiDelimiter}", ct);
+ }
+
+ public virtual async Task 设置测量类型(int 测量项编号, TekMeasurementType 类型, CancellationToken ct = default)
+ {
+ // 设置或查询测量类型[cite: 1]
+ await SendAsync($"MEASUrement:MEAS{测量项编号}:TYPe {类型}{ScpiDelimiter}", ct);
+ }
+
+ public virtual async Task 设置测量源(int 测量项编号, string 源名称, CancellationToken ct = default)
+ {
+ // 设置或查询局部输入源 (例如 CH1, CH2)[cite: 1]
+ await SendAsync($"MEASUrement:MEAS{测量项编号}:SOURCE {源名称}{ScpiDelimiter}", ct);
+ }
+
+ [Monitorable("测量项当前采集的平均值")]
+ public virtual async Task 查询测量项平均值(int 测量项编号, CancellationToken ct = default)
+ {
+ // 返回当前采集的指定测量的平均值[cite: 1]
+ return await WriteReadAsync($"MEASUrement:MEAS{测量项编号}:RESUlts:CURRentacq:MEAN?{ScpiDelimiter}", ScpiDelimiter, ct);
+ }
+
+ public virtual async Task 查询测量项最大值(int 测量项编号, CancellationToken ct = default)
+ {
+ // 返回自上次统计重置以来指定测量的最大值(当前采集)[cite: 1]
+ return await WriteReadAsync($"MEASUrement:MEAS{测量项编号}:RESUlts:CURRentacq:MAXimum?{ScpiDelimiter}", ScpiDelimiter, ct);
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file