ANEVH设备类修正
This commit is contained in:
@@ -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