ANEVH设备类修正
This commit is contained in:
@@ -2,17 +2,27 @@
|
||||
using DeviceCommand.Base;
|
||||
using Model.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DeviceCommand.Devices
|
||||
{
|
||||
/// <summary>
|
||||
/// ANEVH80 电子负载(一对三控制),基于 TCP 通信,使用 SCPI 指令集。
|
||||
/// 用于被测产品的放电/带载测试,可模拟真实负载工况。
|
||||
/// ANEVH 操作模式枚举
|
||||
/// </summary>
|
||||
public enum ANEVH操作模式_枚举
|
||||
{
|
||||
/// <summary>定值模式</summary>
|
||||
FIXED,
|
||||
/// <summary>序列测试模式</summary>
|
||||
LIST
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ANEVH 系列双向可编程直流电源(一拖三),基于 TCP 通信,使用 SCPI 指令集。
|
||||
/// 作为高压源载一体机使用:同时具备直流电源输出(SOURce)与电子负载(SINK)能力。
|
||||
/// </summary>
|
||||
[ACPCommand]
|
||||
public class ANEVH80 : Tcp
|
||||
@@ -29,15 +39,321 @@ namespace DeviceCommand.Devices
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 占位符方法,预留后续负载控制操作(如设置负载模式、设置电流等)。
|
||||
/// 当前实现为查询频率测量值。
|
||||
/// 从设备返回的 SCPI 响应字符串中提取数值部分并转换为 double。
|
||||
/// 支持科学计数法(如 2.48E-03),结果保留两位小数。
|
||||
/// </summary>
|
||||
/// <param name="raw">设备返回的原始字符串</param>
|
||||
/// <returns>提取到的数值(保留两位小数),解析失败时返回 0</returns>
|
||||
private static double ExtractDouble(string raw)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(raw)) return 0;
|
||||
|
||||
// 从响应中提取第一个数值(含正负号、小数点、科学计数法),可自动忽略单位后缀与命令头
|
||||
var match = Regex.Match(raw, @"[+-]?(?:\d+\.?\d*|\.\d+)(?:[Ee][+-]?\d+)?");
|
||||
return match.Success && double.TryParse(match.Value, NumberStyles.Float, CultureInfo.InvariantCulture, out double val)
|
||||
? Math.Round(val, 2)
|
||||
: 0;
|
||||
}
|
||||
|
||||
#region 1. 系统与公共指令
|
||||
|
||||
/// <summary>
|
||||
/// 清除错误队列 (*CLS)
|
||||
/// </summary>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
/// <returns>查询到的频率值,解析失败返回 0.0</returns>
|
||||
public virtual async Task<double> 占位符(CancellationToken ct = default)
|
||||
public virtual async Task 清除错误队列Async(CancellationToken ct = default)
|
||||
{
|
||||
string resp = await WriteReadAsync($"MEAS:FREQ?{ScpiDelimiter}", ScpiDelimiter, ct);
|
||||
return double.TryParse(resp, NumberStyles.Any, CultureInfo.InvariantCulture, out double val) ? val : 0.0;
|
||||
await SendAsync($"*CLS{ScpiDelimiter}", ct);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重设仪器为出厂默认状态 (*RST)
|
||||
/// </summary>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
public virtual async Task 复位Async(CancellationToken ct = default)
|
||||
{
|
||||
await SendAsync($"*RST{ScpiDelimiter}", ct);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询仪器识别码 (*IDN?)
|
||||
/// </summary>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
/// <returns>设备标识字符串(厂商,型号,序列号,固件版本)</returns>
|
||||
public virtual async Task<string> 查询设备信息Async(CancellationToken ct = default)
|
||||
{
|
||||
return await WriteReadAsync($"*IDN?{ScpiDelimiter}", ScpiDelimiter, ct);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询错误信息 (SYST:ERR?)
|
||||
/// </summary>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
/// <returns>错误信息字符串</returns>
|
||||
public virtual async Task<string> 查询错误信息Async(CancellationToken ct = default)
|
||||
{
|
||||
return await WriteReadAsync($"SYST:ERR?{ScpiDelimiter}", ScpiDelimiter, ct);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 2. 输出控制 (OUTPut 子系统)
|
||||
|
||||
/// <summary>
|
||||
/// 设置输出开关状态 (OUTP ON / OFF)
|
||||
/// </summary>
|
||||
/// <param name="isOn">true: 开启输出, false: 关闭输出</param>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
public virtual async Task 设置输出开关Async(bool isOn, CancellationToken ct = default)
|
||||
{
|
||||
string state = isOn ? "ON" : "OFF";
|
||||
await SendAsync($"OUTP {state}{ScpiDelimiter}", ct);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置操作模式 (OUTP:MODE)
|
||||
/// </summary>
|
||||
/// <param name="mode">操作模式枚举 (FIXED: 定值 | LIST: 序列测试)</param>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
public virtual async Task 设置操作模式Async(ANEVH操作模式_枚举 mode, CancellationToken ct = default)
|
||||
{
|
||||
await SendAsync($"OUTP:MODE {mode}{ScpiDelimiter}", ct);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 3. 源模式参数设置 (SOURce 子系统)
|
||||
|
||||
/// <summary>
|
||||
/// 设置源输出电压 (SOUR:VOLT)
|
||||
/// </summary>
|
||||
/// <param name="voltage">电压值 (单位: V)</param>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
public virtual async Task 设置电压Async(double voltage, CancellationToken ct = default)
|
||||
{
|
||||
string valStr = voltage.ToString("0.###", CultureInfo.InvariantCulture);
|
||||
await SendAsync($"SOUR:VOLT {valStr}{ScpiDelimiter}", ct);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询源设定电压 (SOUR:VOLT?)
|
||||
/// </summary>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
/// <returns>设定电压值 (单位: V)</returns>
|
||||
public virtual async Task<double> 查询设定电压Async(CancellationToken ct = default)
|
||||
{
|
||||
string resp = await WriteReadAsync($"SOUR:VOLT?{ScpiDelimiter}", ScpiDelimiter, ct);
|
||||
return ExtractDouble(resp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置源正向限流 (SOUR:CURR)
|
||||
/// </summary>
|
||||
/// <param name="current">电流值 (单位: A,正值)</param>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
public virtual async Task 设置电流Async(double current, CancellationToken ct = default)
|
||||
{
|
||||
string valStr = current.ToString("0.###", CultureInfo.InvariantCulture);
|
||||
await SendAsync($"SOUR:CURR {valStr}{ScpiDelimiter}", ct);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询源设定电流 (SOUR:CURR?)
|
||||
/// </summary>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
/// <returns>设定电流值 (单位: A)</returns>
|
||||
public virtual async Task<double> 查询设定电流Async(CancellationToken ct = default)
|
||||
{
|
||||
string resp = await WriteReadAsync($"SOUR:CURR?{ScpiDelimiter}", ScpiDelimiter, ct);
|
||||
return ExtractDouble(resp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置源正向限功率 (SOUR:POW)
|
||||
/// </summary>
|
||||
/// <param name="power">功率值 (单位: W,正值)</param>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
public virtual async Task 设置功率Async(double power, CancellationToken ct = default)
|
||||
{
|
||||
string valStr = power.ToString("0.###", CultureInfo.InvariantCulture);
|
||||
await SendAsync($"SOUR:POW {valStr}{ScpiDelimiter}", ct);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询源设定功率 (SOUR:POW?)
|
||||
/// </summary>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
/// <returns>设定功率值 (单位: W)</returns>
|
||||
public virtual async Task<double> 查询设定功率Async(CancellationToken ct = default)
|
||||
{
|
||||
string resp = await WriteReadAsync($"SOUR:POW?{ScpiDelimiter}", ScpiDelimiter, ct);
|
||||
return ExtractDouble(resp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置电压上升斜率 (SOUR:VOLT:SLEW:POS)
|
||||
/// </summary>
|
||||
/// <param name="slewRate">电压上升速率 (单位: V/ms)</param>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
public virtual async Task 设置电压上升斜率Async(double slewRate, CancellationToken ct = default)
|
||||
{
|
||||
string valStr = slewRate.ToString("0.###", CultureInfo.InvariantCulture);
|
||||
await SendAsync($"SOUR:VOLT:SLEW:POS {valStr}{ScpiDelimiter}", ct);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置电压下降斜率 (SOUR:VOLT:SLEW:NEG)
|
||||
/// </summary>
|
||||
/// <param name="slewRate">电压下降速率 (单位: V/ms)</param>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
public virtual async Task 设置电压下降斜率Async(double slewRate, CancellationToken ct = default)
|
||||
{
|
||||
string valStr = slewRate.ToString("0.###", CultureInfo.InvariantCulture);
|
||||
await SendAsync($"SOUR:VOLT:SLEW:NEG {valStr}{ScpiDelimiter}", ct);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置电流上升斜率 (SOUR:CURR:SLEW:POS)
|
||||
/// </summary>
|
||||
/// <param name="slewRate">电流上升速率 (单位: A/ms)</param>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
public virtual async Task 设置电流上升斜率Async(double slewRate, CancellationToken ct = default)
|
||||
{
|
||||
string valStr = slewRate.ToString("0.###", CultureInfo.InvariantCulture);
|
||||
await SendAsync($"SOUR:CURR:SLEW:POS {valStr}{ScpiDelimiter}", ct);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置电流下降斜率 (SOUR:CURR:SLEW:NEG)
|
||||
/// </summary>
|
||||
/// <param name="slewRate">电流下降速率 (单位: A/ms)</param>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
public virtual async Task 设置电流下降斜率Async(double slewRate, CancellationToken ct = default)
|
||||
{
|
||||
string valStr = slewRate.ToString("0.###", CultureInfo.InvariantCulture);
|
||||
await SendAsync($"SOUR:CURR:SLEW:NEG {valStr}{ScpiDelimiter}", ct);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置过压保护值 (SOUR:VOLT:PROT)
|
||||
/// </summary>
|
||||
/// <param name="voltage">过压保护阈值 (单位: V)</param>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
public virtual async Task 设置过压保护Async(double voltage, CancellationToken ct = default)
|
||||
{
|
||||
string valStr = voltage.ToString("0.###", CultureInfo.InvariantCulture);
|
||||
await SendAsync($"SOUR:VOLT:PROT {valStr}{ScpiDelimiter}", ct);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置过流保护值 (SOUR:CURR:PROT)
|
||||
/// </summary>
|
||||
/// <param name="current">过流保护阈值 (单位: A)</param>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
public virtual async Task 设置过流保护Async(double current, CancellationToken ct = default)
|
||||
{
|
||||
string valStr = current.ToString("0.###", CultureInfo.InvariantCulture);
|
||||
await SendAsync($"SOUR:CURR:PROT {valStr}{ScpiDelimiter}", ct);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置过功率保护值 (SOUR:POW:PROT)
|
||||
/// </summary>
|
||||
/// <param name="power">过功率保护阈值 (单位: W)</param>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
public virtual async Task 设置过功率保护Async(double power, CancellationToken ct = default)
|
||||
{
|
||||
string valStr = power.ToString("0.###", CultureInfo.InvariantCulture);
|
||||
await SendAsync($"SOUR:POW:PROT {valStr}{ScpiDelimiter}", ct);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 4. 负载模式参数设置 (SINK 子系统)
|
||||
|
||||
/// <summary>
|
||||
/// 设置负载吸收电流 (SINK:CURR)
|
||||
/// </summary>
|
||||
/// <param name="current">负载电流值 (单位: A)</param>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
public virtual async Task 设置负载电流Async(double current, CancellationToken ct = default)
|
||||
{
|
||||
string valStr = current.ToString("0.###", CultureInfo.InvariantCulture);
|
||||
await SendAsync($"SINK:CURR {valStr}{ScpiDelimiter}", ct);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询负载设定电流 (SINK:CURR?)
|
||||
/// </summary>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
/// <returns>负载电流设定值 (单位: A)</returns>
|
||||
public virtual async Task<double> 查询负载电流Async(CancellationToken ct = default)
|
||||
{
|
||||
string resp = await WriteReadAsync($"SINK:CURR?{ScpiDelimiter}", ScpiDelimiter, ct);
|
||||
return ExtractDouble(resp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设置负载吸收功率 (SINK:POW)
|
||||
/// </summary>
|
||||
/// <param name="power">负载功率值 (单位: W)</param>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
public virtual async Task 设置负载功率Async(double power, CancellationToken ct = default)
|
||||
{
|
||||
string valStr = power.ToString("0.###", CultureInfo.InvariantCulture);
|
||||
await SendAsync($"SINK:POWer {valStr}{ScpiDelimiter}", ct);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询负载设定功率 (SINK:POW?)
|
||||
/// </summary>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
/// <returns>负载功率设定值 (单位: W)</returns>
|
||||
public virtual async Task<double> 查询负载功率Async(CancellationToken ct = default)
|
||||
{
|
||||
string resp = await WriteReadAsync($"SINK:POWer?{ScpiDelimiter}", ScpiDelimiter, ct);
|
||||
return ExtractDouble(resp);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 5. 测量查询 (MEASure 子系统)
|
||||
|
||||
/// <summary>
|
||||
/// 查询测量电压 (MEAS:VOLT?)
|
||||
/// </summary>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
/// <returns>实际输出电压 (单位: V,保留两位小数)</returns>
|
||||
public virtual async Task<double> 读取电压Async(CancellationToken ct = default)
|
||||
{
|
||||
string resp = await WriteReadAsync($"MEAS:VOLT?{ScpiDelimiter}", ScpiDelimiter, ct);
|
||||
return ExtractDouble(resp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询测量电流 (MEAS:CURR?)
|
||||
/// </summary>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
/// <returns>实际输出电流 (单位: A,保留两位小数,正值为源模式,负值为负载模式)</returns>
|
||||
public virtual async Task<double> 读取电流Async(CancellationToken ct = default)
|
||||
{
|
||||
string resp = await WriteReadAsync($"MEAS:CURR?{ScpiDelimiter}", ScpiDelimiter, ct);
|
||||
return ExtractDouble(resp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询测量功率 (MEAS:POW?)
|
||||
/// </summary>
|
||||
/// <param name="ct">异步取消令牌</param>
|
||||
/// <returns>实际输出功率 (单位: W,保留两位小数)</returns>
|
||||
public virtual async Task<double> 读取功率Async(CancellationToken ct = default)
|
||||
{
|
||||
string resp = await WriteReadAsync($"MEAS:POW?{ScpiDelimiter}", ScpiDelimiter, ct);
|
||||
return ExtractDouble(resp);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ using UIShare.ViewModelBase;
|
||||
namespace DeviceEditModule.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// ANEVH80 电子负载 控制面板 ViewModel
|
||||
/// ANEVH 高压源载一体机 控制面板 ViewModel
|
||||
/// </summary>
|
||||
public class ANEVH80ViewModel : NavigateViewModelBase, IDisposable
|
||||
{
|
||||
@@ -26,26 +26,60 @@ namespace DeviceEditModule.ViewModels
|
||||
private bool _isBusy;
|
||||
public bool IsBusy { get => _isBusy; set => SetProperty(ref _isBusy, value); }
|
||||
|
||||
#region 输入参数
|
||||
#region 输入参数 — 源模式
|
||||
private double _voltage;
|
||||
public double Voltage { get => _voltage; set => SetProperty(ref _voltage, value); }
|
||||
private double _current;
|
||||
public double Current { get => _current; set => SetProperty(ref _current, value); }
|
||||
private double _power;
|
||||
public double Power { get => _power; set => SetProperty(ref _power, value); }
|
||||
#endregion
|
||||
|
||||
#region 输入参数 — 负载(SINK)参数
|
||||
private double _sinkCurrent;
|
||||
public double SinkCurrent { get => _sinkCurrent; set => SetProperty(ref _sinkCurrent, value); }
|
||||
private double _sinkPower;
|
||||
public double SinkPower { get => _sinkPower; set => SetProperty(ref _sinkPower, value); }
|
||||
#endregion
|
||||
|
||||
#region 测量结果
|
||||
private double _measuredValue;
|
||||
public double MeasuredValue { get => _measuredValue; set => SetProperty(ref _measuredValue, value); }
|
||||
private double _measuredVoltage;
|
||||
public double MeasuredVoltage { get => _measuredVoltage; set => SetProperty(ref _measuredVoltage, value); }
|
||||
private double _measuredCurrent;
|
||||
public double MeasuredCurrent { get => _measuredCurrent; set => SetProperty(ref _measuredCurrent, value); }
|
||||
private double _measuredPower;
|
||||
public double MeasuredPower { get => _measuredPower; set => SetProperty(ref _measuredPower, value); }
|
||||
private string _responseLog = "";
|
||||
public string ResponseLog { get => _responseLog; set => SetProperty(ref _responseLog, value); }
|
||||
#endregion
|
||||
|
||||
#region 命令
|
||||
public ICommand QueryIdn { get; } public ICommand Measure { get; }
|
||||
public ICommand QueryIdn { get; } public ICommand Reset { get; }
|
||||
public ICommand OutOn { get; } public ICommand OutOff { get; }
|
||||
public ICommand SetV { get; } public ICommand SetI { get; } public ICommand SetP { get; }
|
||||
public ICommand SetSinkI { get; } public ICommand SetSinkP { get; }
|
||||
public ICommand QMeas { get; }
|
||||
#endregion
|
||||
|
||||
public ANEVH80ViewModel(IContainerProvider cp) : base(cp)
|
||||
{
|
||||
_dm = cp.Resolve<DeviceManager>();
|
||||
QueryIdn = new DelegateCommand(async () => await Exec(async () => Log("IDN: 占位符设备")));
|
||||
Measure = new DelegateCommand(async () => await Exec(async () => { MeasuredValue = await _dev!.占位符(Ct()); Log($"测量值={MeasuredValue}"); }));
|
||||
QueryIdn = new DelegateCommand(async () => await Exec(async () => Log("IDN:" + await _dev!.查询设备信息Async(Ct()))));
|
||||
Reset = new DelegateCommand(async () => await Exec(async () => { await _dev!.复位Async(Ct()); Log("设备已复位"); }));
|
||||
OutOn = new DelegateCommand(async () => await Exec(async () => { await _dev!.设置输出开关Async(true, Ct()); Log("输出已开启"); }));
|
||||
OutOff = new DelegateCommand(async () => await Exec(async () => { await _dev!.设置输出开关Async(false, Ct()); Log("输出已关闭"); }));
|
||||
SetV = new DelegateCommand(async () => await Exec(async () => { await _dev!.设置电压Async(Voltage, Ct()); Log($"电压={Voltage}V"); }));
|
||||
SetI = new DelegateCommand(async () => await Exec(async () => { await _dev!.设置电流Async(Current, Ct()); Log($"电流={Current}A"); }));
|
||||
SetP = new DelegateCommand(async () => await Exec(async () => { await _dev!.设置功率Async(Power, Ct()); Log($"功率={Power}W"); }));
|
||||
SetSinkI = new DelegateCommand(async () => await Exec(async () => { await _dev!.设置负载电流Async(SinkCurrent, Ct()); Log($"负载电流={SinkCurrent}A"); }));
|
||||
SetSinkP = new DelegateCommand(async () => await Exec(async () => { await _dev!.设置负载功率Async(SinkPower, Ct()); Log($"负载功率={SinkPower}W"); }));
|
||||
QMeas = new DelegateCommand(async () => await Exec(async () =>
|
||||
{
|
||||
MeasuredVoltage = await _dev!.读取电压Async(Ct());
|
||||
MeasuredCurrent = await _dev!.读取电流Async(Ct());
|
||||
MeasuredPower = await _dev!.读取功率Async(Ct());
|
||||
Log($"测量→V:{MeasuredVoltage} I:{MeasuredCurrent} P:{MeasuredPower}");
|
||||
}));
|
||||
Initialize();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<materialDesign:PackIcon Kind="LightningBolt" Width="22" Height="22"
|
||||
Foreground="#1565C0" Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"/>
|
||||
<TextBlock Text="ANEVH80 电子负载"
|
||||
<TextBlock Text="ANEVH 高压源载一体机"
|
||||
FontSize="15" FontWeight="Bold"
|
||||
VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding DeviceName, StringFormat=' [{0}]'}"
|
||||
@@ -71,21 +71,83 @@
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Margin="0,0,4,0">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,4">
|
||||
<TextBlock Text="操作" Style="{StaticResource ParamLabel}"/>
|
||||
<Button Content="查询IDN" Command="{Binding QueryIdn}" Style="{StaticResource CmdBtn}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" Margin="4,0,0,0">
|
||||
<GroupBox Header="测量" Margin="0,0,0,8" materialDesign:ColorZoneAssist.Mode="PrimaryLight">
|
||||
<GroupBox Header="输出控制" Margin="0,0,0,8" materialDesign:ColorZoneAssist.Mode="PrimaryLight">
|
||||
<StackPanel Margin="4">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,4">
|
||||
<TextBlock Text="测量值" Style="{StaticResource ParamLabel}"/>
|
||||
<TextBox Style="{StaticResource MeasureBox}"
|
||||
Text="{Binding MeasuredValue, Mode=OneWay}"/>
|
||||
<TextBlock Text="" VerticalAlignment="Center" Margin="2,0,8,0"/>
|
||||
<Button Content="开启" Command="{Binding OutOn}"
|
||||
Style="{StaticResource MaterialDesignRaisedButton}"
|
||||
Background="#388E3C" Foreground="White"
|
||||
Height="32" Padding="12,0" FontSize="12" Margin="4,0"/>
|
||||
<Button Content="关闭" Command="{Binding OutOff}"
|
||||
Style="{StaticResource WarnBtn}"/>
|
||||
</StackPanel>
|
||||
<Button Content="刷新全部测量" Command="{Binding Measure}" Style="{StaticResource CmdBtn}" HorizontalAlignment="Left" Margin="0,4,0,0"/>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,4">
|
||||
<TextBlock Text="系统" Style="{StaticResource ParamLabel}"/>
|
||||
<Button Content="复位" Command="{Binding Reset}" Style="{StaticResource CmdBtn}"/>
|
||||
</StackPanel>
|
||||
<GroupBox Header="源模式参数" Margin="0,8,0,8" materialDesign:ColorZoneAssist.Mode="PrimaryLight">
|
||||
<StackPanel Margin="4">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,4">
|
||||
<TextBlock Text="电压 (V)" Style="{StaticResource ParamLabel}"/>
|
||||
<TextBox Style="{StaticResource NumInput}"
|
||||
Text="{Binding Voltage, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
<Button Content="设置" Command="{Binding SetV}" Style="{StaticResource CmdBtn}"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,4">
|
||||
<TextBlock Text="电流 (A)" Style="{StaticResource ParamLabel}"/>
|
||||
<TextBox Style="{StaticResource NumInput}"
|
||||
Text="{Binding Current, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
<Button Content="设置" Command="{Binding SetI}" Style="{StaticResource CmdBtn}"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,4">
|
||||
<TextBlock Text="功率 (W)" Style="{StaticResource ParamLabel}"/>
|
||||
<TextBox Style="{StaticResource NumInput}"
|
||||
Text="{Binding Power, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
<Button Content="设置" Command="{Binding SetP}" Style="{StaticResource CmdBtn}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
<GroupBox Header="负载(SINK)参数" Margin="0,0,0,8" materialDesign:ColorZoneAssist.Mode="PrimaryLight">
|
||||
<StackPanel Margin="4">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,4">
|
||||
<TextBlock Text="负载电流 (A)" Style="{StaticResource ParamLabel}"/>
|
||||
<TextBox Style="{StaticResource NumInput}"
|
||||
Text="{Binding SinkCurrent, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
<Button Content="设置" Command="{Binding SetSinkI}" Style="{StaticResource CmdBtn}"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,4">
|
||||
<TextBlock Text="负载功率 (W)" Style="{StaticResource ParamLabel}"/>
|
||||
<TextBox Style="{StaticResource NumInput}"
|
||||
Text="{Binding SinkPower, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
<Button Content="设置" Command="{Binding SetSinkP}" Style="{StaticResource CmdBtn}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" Margin="4,0,0,0">
|
||||
<GroupBox Header="实时测量" Margin="0,0,0,8" materialDesign:ColorZoneAssist.Mode="PrimaryLight">
|
||||
<StackPanel Margin="4">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,4">
|
||||
<TextBlock Text="电压" Style="{StaticResource ParamLabel}"/>
|
||||
<TextBox Style="{StaticResource MeasureBox}"
|
||||
Text="{Binding MeasuredVoltage, Mode=OneWay}"/>
|
||||
<TextBlock Text="V" VerticalAlignment="Center" Margin="2,0,8,0"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,4">
|
||||
<TextBlock Text="电流" Style="{StaticResource ParamLabel}"/>
|
||||
<TextBox Style="{StaticResource MeasureBox}"
|
||||
Text="{Binding MeasuredCurrent, Mode=OneWay}"/>
|
||||
<TextBlock Text="A" VerticalAlignment="Center" Margin="2,0,8,0"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,4">
|
||||
<TextBlock Text="功率" Style="{StaticResource ParamLabel}"/>
|
||||
<TextBox Style="{StaticResource MeasureBox}"
|
||||
Text="{Binding MeasuredPower, Mode=OneWay}"/>
|
||||
<TextBlock Text="W" VerticalAlignment="Center" Margin="2,0,8,0"/>
|
||||
</StackPanel>
|
||||
<Button Content="刷新全部测量" Command="{Binding QMeas}" Style="{StaticResource CmdBtn}" HorizontalAlignment="Left" Margin="0,4,0,0"/>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
<GroupBox Header="设备信息" Margin="0,0,0,8" materialDesign:ColorZoneAssist.Mode="PrimaryLight">
|
||||
|
||||
Reference in New Issue
Block a user