PSW250CommandLibrary.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. using System.Collections.Generic;
  2. namespace APS7100TestTool.Libraries
  3. {
  4. /// <summary>
  5. /// PSW250-4.5 SCPI 命令库
  6. /// </summary>
  7. public static class PSW250CommandLibrary
  8. {
  9. public static List<ScpiCommandInfo> GetAllCommands()
  10. {
  11. return new List<ScpiCommandInfo>
  12. {
  13. // ==================== 系统命令 ====================
  14. new ScpiCommandInfo
  15. {
  16. Category = "系统命令",
  17. Command = "*IDN?",
  18. Description = "查询设备识别信息",
  19. IsQuery = true,
  20. Example = "返回: GWINSTEK,PSW250-4.5,SN123456,V1.00"
  21. },
  22. new ScpiCommandInfo
  23. {
  24. Category = "系统命令",
  25. Command = "*RST",
  26. Description = "重置设备到出厂状态",
  27. IsQuery = false,
  28. Example = null
  29. },
  30. new ScpiCommandInfo
  31. {
  32. Category = "系统命令",
  33. Command = "*CLS",
  34. Description = "清除状态寄存器",
  35. IsQuery = false,
  36. Example = null
  37. },
  38. new ScpiCommandInfo
  39. {
  40. Category = "系统命令",
  41. Command = "SYST:ERR?",
  42. Description = "查询错误队列",
  43. IsQuery = true,
  44. Example = "返回: 0,\"No error\""
  45. },
  46. new ScpiCommandInfo
  47. {
  48. Category = "系统命令",
  49. Command = "SYST:VERS?",
  50. Description = "查询 SCPI 版本",
  51. IsQuery = true,
  52. Example = "返回: 1999.0"
  53. },
  54. // ==================== 输出控制 ====================
  55. new ScpiCommandInfo
  56. {
  57. Category = "输出控制",
  58. Command = "OUTP ON",
  59. Description = "开启输出",
  60. IsQuery = false,
  61. Example = null
  62. },
  63. new ScpiCommandInfo
  64. {
  65. Category = "输出控制",
  66. Command = "OUTP OFF",
  67. Description = "关闭输出",
  68. IsQuery = false,
  69. Example = null
  70. },
  71. new ScpiCommandInfo
  72. {
  73. Category = "输出控制",
  74. Command = "OUTP?",
  75. Description = "查询输出状态",
  76. IsQuery = true,
  77. Example = "返回: 0(关) 或 1(开)"
  78. },
  79. // ==================== 电压设置 ====================
  80. new ScpiCommandInfo
  81. {
  82. Category = "电压设置",
  83. Command = "SOUR:VOLT 12",
  84. Description = "设置输出电压为 12V",
  85. IsQuery = false,
  86. Example = "范围: 0-72V"
  87. },
  88. new ScpiCommandInfo
  89. {
  90. Category = "电压设置",
  91. Command = "SOUR:VOLT 24",
  92. Description = "设置输出电压为 24V",
  93. IsQuery = false,
  94. Example = "范围: 0-72V"
  95. },
  96. new ScpiCommandInfo
  97. {
  98. Category = "电压设置",
  99. Command = "SOUR:VOLT 48",
  100. Description = "设置输出电压为 48V",
  101. IsQuery = false,
  102. Example = "范围: 0-72V"
  103. },
  104. new ScpiCommandInfo
  105. {
  106. Category = "电压设置",
  107. Command = "SOUR:VOLT?",
  108. Description = "查询电压设定值",
  109. IsQuery = true,
  110. Example = "返回: 12.0"
  111. },
  112. new ScpiCommandInfo
  113. {
  114. Category = "电压设置",
  115. Command = "SOUR:VOLT:PROT 75",
  116. Description = "设置过压保护值",
  117. IsQuery = false,
  118. Example = "设置为 75V"
  119. },
  120. new ScpiCommandInfo
  121. {
  122. Category = "电压设置",
  123. Command = "SOUR:VOLT:PROT?",
  124. Description = "查询过压保护值",
  125. IsQuery = true,
  126. Example = "返回: 75.0"
  127. },
  128. // ==================== 电流设置 ====================
  129. new ScpiCommandInfo
  130. {
  131. Category = "电流设置",
  132. Command = "SOUR:CURR 1",
  133. Description = "设置输出电流为 1A",
  134. IsQuery = false,
  135. Example = "范围: 0-4.5A"
  136. },
  137. new ScpiCommandInfo
  138. {
  139. Category = "电流设置",
  140. Command = "SOUR:CURR 2",
  141. Description = "设置输出电流为 2A",
  142. IsQuery = false,
  143. Example = "范围: 0-4.5A"
  144. },
  145. new ScpiCommandInfo
  146. {
  147. Category = "电流设置",
  148. Command = "SOUR:CURR 3",
  149. Description = "设置输出电流为 3A",
  150. IsQuery = false,
  151. Example = "范围: 0-4.5A"
  152. },
  153. new ScpiCommandInfo
  154. {
  155. Category = "电流设置",
  156. Command = "SOUR:CURR?",
  157. Description = "查询电流设定值",
  158. IsQuery = true,
  159. Example = "返回: 1.0"
  160. },
  161. new ScpiCommandInfo
  162. {
  163. Category = "电流设置",
  164. Command = "SOUR:CURR:PROT 5",
  165. Description = "设置过流保护值",
  166. IsQuery = false,
  167. Example = "设置为 5A"
  168. },
  169. new ScpiCommandInfo
  170. {
  171. Category = "电流设置",
  172. Command = "SOUR:CURR:PROT?",
  173. Description = "查询过流保护值",
  174. IsQuery = true,
  175. Example = "返回: 5.0"
  176. },
  177. // ==================== 输出控制优先级 ====================
  178. // 注意:CV/CC 是运行结果(取决于负载),不是可切换的模式
  179. // OUTP:MODE 设置的是控制优先级和动态响应策略
  180. new ScpiCommandInfo
  181. {
  182. Category = "输出控制优先级",
  183. Command = "OUTP:MODE CVHS",
  184. Description = "恒压优先(高速响应)",
  185. IsQuery = false,
  186. Example = "电压控制优先,快速响应负载变化"
  187. },
  188. new ScpiCommandInfo
  189. {
  190. Category = "输出控制优先级",
  191. Command = "OUTP:MODE CCHS",
  192. Description = "恒流优先(高速响应)",
  193. IsQuery = false,
  194. Example = "电流控制优先,快速响应负载变化"
  195. },
  196. new ScpiCommandInfo
  197. {
  198. Category = "输出控制优先级",
  199. Command = "OUTP:MODE CVLS",
  200. Description = "恒压优先(斜率/平滑变化)",
  201. IsQuery = false,
  202. Example = "电压控制优先,平滑过渡"
  203. },
  204. new ScpiCommandInfo
  205. {
  206. Category = "输出控制优先级",
  207. Command = "OUTP:MODE CCLS",
  208. Description = "恒流优先(斜率/平滑变化)",
  209. IsQuery = false,
  210. Example = "电流控制优先,平滑过渡"
  211. },
  212. new ScpiCommandInfo
  213. {
  214. Category = "输出控制优先级",
  215. Command = "OUTP:MODE?",
  216. Description = "查询当前输出控制优先级",
  217. IsQuery = true,
  218. Example = "返回: 0=CVHS, 1=CCHS, 2=CVLS, 3=CCLS"
  219. },
  220. // ==================== 测量命令 ====================
  221. new ScpiCommandInfo
  222. {
  223. Category = "测量命令",
  224. Command = "MEAS:VOLT?",
  225. Description = "测量实际输出电压",
  226. IsQuery = true,
  227. Example = "返回: 12.05"
  228. },
  229. new ScpiCommandInfo
  230. {
  231. Category = "测量命令",
  232. Command = "MEAS:CURR?",
  233. Description = "测量实际输出电流",
  234. IsQuery = true,
  235. Example = "返回: 1.234"
  236. },
  237. new ScpiCommandInfo
  238. {
  239. Category = "测量命令",
  240. Command = "MEAS:POW?",
  241. Description = "测量实际输出功率",
  242. IsQuery = true,
  243. Example = "返回: 14.87"
  244. },
  245. // ==================== 保护功能 ====================
  246. new ScpiCommandInfo
  247. {
  248. Category = "保护功能",
  249. Command = "VOLT:PROT:STAT ON",
  250. Description = "启用过压保护",
  251. IsQuery = false,
  252. Example = null
  253. },
  254. new ScpiCommandInfo
  255. {
  256. Category = "保护功能",
  257. Command = "VOLT:PROT:STAT OFF",
  258. Description = "禁用过压保护",
  259. IsQuery = false,
  260. Example = null
  261. },
  262. new ScpiCommandInfo
  263. {
  264. Category = "保护功能",
  265. Command = "VOLT:PROT:STAT?",
  266. Description = "查询过压保护状态",
  267. IsQuery = true,
  268. Example = "返回: 0(关) 或 1(开)"
  269. },
  270. new ScpiCommandInfo
  271. {
  272. Category = "保护功能",
  273. Command = "CURR:PROT:STAT ON",
  274. Description = "启用过流保护",
  275. IsQuery = false,
  276. Example = null
  277. },
  278. new ScpiCommandInfo
  279. {
  280. Category = "保护功能",
  281. Command = "CURR:PROT:STAT OFF",
  282. Description = "禁用过流保护",
  283. IsQuery = false,
  284. Example = null
  285. },
  286. new ScpiCommandInfo
  287. {
  288. Category = "保护功能",
  289. Command = "CURR:PROT:STAT?",
  290. Description = "查询过流保护状态",
  291. IsQuery = true,
  292. Example = "返回: 0(关) 或 1(开)"
  293. },
  294. // ==================== 远程控制 ====================
  295. new ScpiCommandInfo
  296. {
  297. Category = "远程控制",
  298. Command = "SYST:REM",
  299. Description = "进入远程控制模式",
  300. IsQuery = false,
  301. Example = "锁定前面板"
  302. },
  303. new ScpiCommandInfo
  304. {
  305. Category = "远程控制",
  306. Command = "SYST:COMM:RLST LOCAL",
  307. Description = "返回本地控制模式(面板有效)",
  308. IsQuery = false,
  309. Example = "解锁前面板"
  310. },
  311. };
  312. }
  313. public static List<string> GetCategories()
  314. {
  315. var categories = new List<string>();
  316. foreach (var cmd in GetAllCommands())
  317. {
  318. if (!categories.Contains(cmd.Category))
  319. {
  320. categories.Add(cmd.Category);
  321. }
  322. }
  323. return categories;
  324. }
  325. public static List<ScpiCommandInfo> GetCommandsByCategory(string category)
  326. {
  327. var commands = new List<ScpiCommandInfo>();
  328. foreach (var cmd in GetAllCommands())
  329. {
  330. if (cmd.Category == category)
  331. {
  332. commands.Add(cmd);
  333. }
  334. }
  335. return commands;
  336. }
  337. }
  338. }