| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352 |
- using System.Collections.Generic;
- namespace APS7100TestTool.Libraries
- {
- /// <summary>
- /// PSW250-4.5 SCPI 命令库
- /// </summary>
- public static class PSW250CommandLibrary
- {
- public static List<ScpiCommandInfo> GetAllCommands()
- {
- return new List<ScpiCommandInfo>
- {
- // ==================== 系统命令 ====================
- new ScpiCommandInfo
- {
- Category = "系统命令",
- Command = "*IDN?",
- Description = "查询设备识别信息",
- IsQuery = true,
- Example = "返回: GWINSTEK,PSW250-4.5,SN123456,V1.00"
- },
- new ScpiCommandInfo
- {
- Category = "系统命令",
- Command = "*RST",
- Description = "重置设备到出厂状态",
- IsQuery = false,
- Example = null
- },
- new ScpiCommandInfo
- {
- Category = "系统命令",
- Command = "*CLS",
- Description = "清除状态寄存器",
- IsQuery = false,
- Example = null
- },
- new ScpiCommandInfo
- {
- Category = "系统命令",
- Command = "SYST:ERR?",
- Description = "查询错误队列",
- IsQuery = true,
- Example = "返回: 0,\"No error\""
- },
- new ScpiCommandInfo
- {
- Category = "系统命令",
- Command = "SYST:VERS?",
- Description = "查询 SCPI 版本",
- IsQuery = true,
- Example = "返回: 1999.0"
- },
- // ==================== 输出控制 ====================
- new ScpiCommandInfo
- {
- Category = "输出控制",
- Command = "OUTP ON",
- Description = "开启输出",
- IsQuery = false,
- Example = null
- },
- new ScpiCommandInfo
- {
- Category = "输出控制",
- Command = "OUTP OFF",
- Description = "关闭输出",
- IsQuery = false,
- Example = null
- },
- new ScpiCommandInfo
- {
- Category = "输出控制",
- Command = "OUTP?",
- Description = "查询输出状态",
- IsQuery = true,
- Example = "返回: 0(关) 或 1(开)"
- },
- // ==================== 电压设置 ====================
- new ScpiCommandInfo
- {
- Category = "电压设置",
- Command = "SOUR:VOLT 12",
- Description = "设置输出电压为 12V",
- IsQuery = false,
- Example = "范围: 0-72V"
- },
- new ScpiCommandInfo
- {
- Category = "电压设置",
- Command = "SOUR:VOLT 24",
- Description = "设置输出电压为 24V",
- IsQuery = false,
- Example = "范围: 0-72V"
- },
- new ScpiCommandInfo
- {
- Category = "电压设置",
- Command = "SOUR:VOLT 48",
- Description = "设置输出电压为 48V",
- IsQuery = false,
- Example = "范围: 0-72V"
- },
- new ScpiCommandInfo
- {
- Category = "电压设置",
- Command = "SOUR:VOLT?",
- Description = "查询电压设定值",
- IsQuery = true,
- Example = "返回: 12.0"
- },
- new ScpiCommandInfo
- {
- Category = "电压设置",
- Command = "SOUR:VOLT:PROT 75",
- Description = "设置过压保护值",
- IsQuery = false,
- Example = "设置为 75V"
- },
- new ScpiCommandInfo
- {
- Category = "电压设置",
- Command = "SOUR:VOLT:PROT?",
- Description = "查询过压保护值",
- IsQuery = true,
- Example = "返回: 75.0"
- },
- // ==================== 电流设置 ====================
- new ScpiCommandInfo
- {
- Category = "电流设置",
- Command = "SOUR:CURR 1",
- Description = "设置输出电流为 1A",
- IsQuery = false,
- Example = "范围: 0-4.5A"
- },
- new ScpiCommandInfo
- {
- Category = "电流设置",
- Command = "SOUR:CURR 2",
- Description = "设置输出电流为 2A",
- IsQuery = false,
- Example = "范围: 0-4.5A"
- },
- new ScpiCommandInfo
- {
- Category = "电流设置",
- Command = "SOUR:CURR 3",
- Description = "设置输出电流为 3A",
- IsQuery = false,
- Example = "范围: 0-4.5A"
- },
- new ScpiCommandInfo
- {
- Category = "电流设置",
- Command = "SOUR:CURR?",
- Description = "查询电流设定值",
- IsQuery = true,
- Example = "返回: 1.0"
- },
- new ScpiCommandInfo
- {
- Category = "电流设置",
- Command = "SOUR:CURR:PROT 5",
- Description = "设置过流保护值",
- IsQuery = false,
- Example = "设置为 5A"
- },
- new ScpiCommandInfo
- {
- Category = "电流设置",
- Command = "SOUR:CURR:PROT?",
- Description = "查询过流保护值",
- IsQuery = true,
- Example = "返回: 5.0"
- },
- // ==================== 输出控制优先级 ====================
- // 注意:CV/CC 是运行结果(取决于负载),不是可切换的模式
- // OUTP:MODE 设置的是控制优先级和动态响应策略
- new ScpiCommandInfo
- {
- Category = "输出控制优先级",
- Command = "OUTP:MODE CVHS",
- Description = "恒压优先(高速响应)",
- IsQuery = false,
- Example = "电压控制优先,快速响应负载变化"
- },
- new ScpiCommandInfo
- {
- Category = "输出控制优先级",
- Command = "OUTP:MODE CCHS",
- Description = "恒流优先(高速响应)",
- IsQuery = false,
- Example = "电流控制优先,快速响应负载变化"
- },
- new ScpiCommandInfo
- {
- Category = "输出控制优先级",
- Command = "OUTP:MODE CVLS",
- Description = "恒压优先(斜率/平滑变化)",
- IsQuery = false,
- Example = "电压控制优先,平滑过渡"
- },
- new ScpiCommandInfo
- {
- Category = "输出控制优先级",
- Command = "OUTP:MODE CCLS",
- Description = "恒流优先(斜率/平滑变化)",
- IsQuery = false,
- Example = "电流控制优先,平滑过渡"
- },
- new ScpiCommandInfo
- {
- Category = "输出控制优先级",
- Command = "OUTP:MODE?",
- Description = "查询当前输出控制优先级",
- IsQuery = true,
- Example = "返回: 0=CVHS, 1=CCHS, 2=CVLS, 3=CCLS"
- },
- // ==================== 测量命令 ====================
- new ScpiCommandInfo
- {
- Category = "测量命令",
- Command = "MEAS:VOLT?",
- Description = "测量实际输出电压",
- IsQuery = true,
- Example = "返回: 12.05"
- },
- new ScpiCommandInfo
- {
- Category = "测量命令",
- Command = "MEAS:CURR?",
- Description = "测量实际输出电流",
- IsQuery = true,
- Example = "返回: 1.234"
- },
- new ScpiCommandInfo
- {
- Category = "测量命令",
- Command = "MEAS:POW?",
- Description = "测量实际输出功率",
- IsQuery = true,
- Example = "返回: 14.87"
- },
- // ==================== 保护功能 ====================
- new ScpiCommandInfo
- {
- Category = "保护功能",
- Command = "VOLT:PROT:STAT ON",
- Description = "启用过压保护",
- IsQuery = false,
- Example = null
- },
- new ScpiCommandInfo
- {
- Category = "保护功能",
- Command = "VOLT:PROT:STAT OFF",
- Description = "禁用过压保护",
- IsQuery = false,
- Example = null
- },
- new ScpiCommandInfo
- {
- Category = "保护功能",
- Command = "VOLT:PROT:STAT?",
- Description = "查询过压保护状态",
- IsQuery = true,
- Example = "返回: 0(关) 或 1(开)"
- },
- new ScpiCommandInfo
- {
- Category = "保护功能",
- Command = "CURR:PROT:STAT ON",
- Description = "启用过流保护",
- IsQuery = false,
- Example = null
- },
- new ScpiCommandInfo
- {
- Category = "保护功能",
- Command = "CURR:PROT:STAT OFF",
- Description = "禁用过流保护",
- IsQuery = false,
- Example = null
- },
- new ScpiCommandInfo
- {
- Category = "保护功能",
- Command = "CURR:PROT:STAT?",
- Description = "查询过流保护状态",
- IsQuery = true,
- Example = "返回: 0(关) 或 1(开)"
- },
- // ==================== 远程控制 ====================
- new ScpiCommandInfo
- {
- Category = "远程控制",
- Command = "SYST:REM",
- Description = "进入远程控制模式",
- IsQuery = false,
- Example = "锁定前面板"
- },
- new ScpiCommandInfo
- {
- Category = "远程控制",
- Command = "SYST:COMM:RLST LOCAL",
- Description = "返回本地控制模式(面板有效)",
- IsQuery = false,
- Example = "解锁前面板"
- },
- };
- }
- public static List<string> GetCategories()
- {
- var categories = new List<string>();
- foreach (var cmd in GetAllCommands())
- {
- if (!categories.Contains(cmd.Category))
- {
- categories.Add(cmd.Category);
- }
- }
- return categories;
- }
- public static List<ScpiCommandInfo> GetCommandsByCategory(string category)
- {
- var commands = new List<ScpiCommandInfo>();
- foreach (var cmd in GetAllCommands())
- {
- if (cmd.Category == category)
- {
- commands.Add(cmd);
- }
- }
- return commands;
- }
- }
- }
|