list更改

This commit is contained in:
“hsc”
2026-09-24 15:20:29 +08:00
parent 81c6386e62
commit c017efdb49
5 changed files with 1057 additions and 278 deletions
@@ -137,6 +137,12 @@
<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}" />
<ComboBox Width="130" Height="32" FontSize="12" Margin="4,0"
ItemsSource="{Binding PhaseOptions}"
SelectedIndex="{Binding SelectedPhaseIndex}" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,4">
<TextBlock Text="电压 (V)" Style="{StaticResource ParamLabel}" />
<TextBox Style="{StaticResource NumInput}"
@@ -162,10 +168,40 @@
</StackPanel>
</GroupBox>
<!-- LIST 模式 -->
<GroupBox Header="LIST 模式" Margin="0,0,0,8"
<!-- LIST 模式(三相独立) -->
<GroupBox Header="LIST 模式(三相独立)" Margin="0,0,0,8"
materialDesign:ColorZoneAssist.Mode="PrimaryLight">
<StackPanel Margin="4">
<StackPanel Orientation="Horizontal" Margin="0,4">
<TextBlock Text="测试项" Style="{StaticResource ParamLabel}" />
<ComboBox Width="230" Height="32" FontSize="12" Margin="4,0"
ItemsSource="{Binding PresetOptions}"
SelectedIndex="{Binding SelectedPresetIndex}" />
<Button Content="载入" Command="{Binding LoadPresetCommand}"
Style="{StaticResource CmdBtn}" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,4">
<TextBlock Text="名称" Style="{StaticResource ParamLabel}" />
<TextBox Style="{StaticResource NumInput}" Width="150"
ToolTip="保存时作为文件名(写入 D:\acp\源测试);选中已有测试项会自动填充,可改名另存"
Text="{Binding PresetName, UpdateSourceTrigger=PropertyChanged}" />
<Button Content="保存" Command="{Binding SavePresetCommand}"
Style="{StaticResource CmdBtn}"
Background="#388E3C" Foreground="White" />
<Button Content="删除" Command="{Binding DeletePresetCommand}"
Style="{StaticResource WarnBtn}"
ToolTip="删除下拉框当前选中的测试项文件(带二次确认)" />
</StackPanel>
<TextBox Margin="4,0,4,2" FontSize="11" Foreground="#1565C0"
Height="46" TextWrapping="Wrap" AcceptsReturn="True"
VerticalScrollBarVisibility="Auto" VerticalContentAlignment="Top"
ToolTip="测试项说明(随文件一并保存)"
Text="{Binding PresetNote, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Text="{Binding PresetStorageHint}"
FontSize="11" Foreground="#757575"
Margin="4,0,4,4" TextWrapping="Wrap" />
<Separator Margin="0,4" />
<StackPanel Orientation="Horizontal" Margin="0,4">
<TextBlock Text="操作模态" Style="{StaticResource ParamLabel}" />
<Button Content="FIXED 固定" Command="{Binding SetFixedModeCommand}"
@@ -174,32 +210,37 @@
Style="{StaticResource CmdBtn}" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,4">
<TextBlock Text="列表耦合" Style="{StaticResource ParamLabel}" />
<ComboBox Width="80" Height="32" FontSize="12" Margin="4,0"
ItemsSource="{Binding ListCouplingOptions}"
SelectedItem="{Binding ListCoupling}" />
<TextBlock Text="执行次数" Style="{StaticResource ParamLabel}" />
<TextBox Style="{StaticResource NumInput}" Width="60"
ToolTip="0 = 无限循环"
Text="{Binding ListCount, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Text="触发" Style="{StaticResource ParamLabel}" />
<ComboBox Width="100" Height="32" FontSize="12" Margin="4,0"
<ComboBox Width="88" Height="32" FontSize="12" Margin="4,0"
ItemsSource="{Binding ListTriggerOptions}"
SelectedItem="{Binding ListTrigger}" />
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,4">
<TextBlock Text="执行次数" Style="{StaticResource ParamLabel}" />
<TextBox Style="{StaticResource NumInput}" Width="80"
Text="{Binding ListCount, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Text="时间基础" Style="{StaticResource ParamLabel}" />
<ComboBox Width="90" Height="32" FontSize="12" Margin="4,0"
<TextBlock Text="时基" Style="{StaticResource ParamLabel}" />
<ComboBox Width="80" Height="32" FontSize="12" Margin="4,0"
ItemsSource="{Binding ListTimeBaseOptions}"
SelectedItem="{Binding ListTimeBase}" />
</StackPanel>
<Button Content="应用基础配置(耦合 / 触发 / 次数 / 时基)"
Command="{Binding ApplyListBasicCommand}"
Style="{StaticResource CmdBtn}"
HorizontalAlignment="Left" Margin="0,4" />
<Separator Margin="0,6" />
<TextBlock Text="序列设置(英文逗号分隔,留空则不下发)"
FontSize="12" Foreground="#616161" Margin="4,2" />
<StackPanel Orientation="Horizontal" Margin="0,4">
<TextBlock Text="编辑相位" Style="{StaticResource ParamLabel}" />
<ComboBox Width="100" Height="32" FontSize="12" Margin="4,0"
ItemsSource="{Binding ListPhaseOptions}"
SelectedIndex="{Binding ListEditPhaseIndex}" />
<TextBlock Text="该相波形" Style="{StaticResource ParamLabel}" />
<ComboBox Width="80" Height="32" FontSize="12" Margin="4,0"
ItemsSource="{Binding WaveformOptions}"
SelectedItem="{Binding ListWaveform}" />
</StackPanel>
<Button Content="复制当前相到三相(B/C 相位角自动 ±120°)"
Command="{Binding CopyPhaseToThreeCommand}"
Style="{StaticResource CmdBtn}"
HorizontalAlignment="Left" Margin="0,4" />
<TextBlock Text="序列设置(英文逗号分隔,留空则不下发;作用于上方选中的相位)"
FontSize="12" Foreground="#616161" Margin="4,2" TextWrapping="Wrap" />
<Grid Margin="0,2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="92" />
@@ -213,60 +254,71 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="AC起始电压"
<TextBlock Grid.Row="0" Grid.Column="0" Text="相位角度"
Style="{StaticResource ParamLabel}" />
<TextBox Grid.Row="0" Grid.Column="1" Style="{StaticResource NumInput}"
Width="240" ToolTip="单位 V,如 0,50,100,150"
Text="{Binding ListVoltAcStartText, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Row="1" Grid.Column="0" Text="AC结束电压"
Style="{StaticResource ParamLabel}" />
<TextBox Grid.Row="1" Grid.Column="1" Style="{StaticResource NumInput}"
Width="240" ToolTip="单位 V,如 150,100,50,0"
Text="{Binding ListVoltAcEndText, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Row="2" Grid.Column="0" Text="起始频率"
Style="{StaticResource ParamLabel}" />
<TextBox Grid.Row="2" Grid.Column="1" Style="{StaticResource NumInput}"
Width="240" ToolTip="单位 Hz,如 50,60,50"
Text="{Binding ListFreqStartText, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Row="3" Grid.Column="0" Text="结束频率"
Style="{StaticResource ParamLabel}" />
<TextBox Grid.Row="3" Grid.Column="1" Style="{StaticResource NumInput}"
Width="240" ToolTip="单位 Hz,如 50,50,60"
Text="{Binding ListFreqEndText, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Row="4" Grid.Column="0" Text="静止时间"
Style="{StaticResource ParamLabel}" />
<TextBox Grid.Row="4" Grid.Column="1" Style="{StaticResource NumInput}"
Width="240" ToolTip="单位 ms,如 500,500,500"
Text="{Binding ListDwellText, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Row="5" Grid.Column="0" Text="相位角度"
Style="{StaticResource ParamLabel}" />
<TextBox Grid.Row="5" Grid.Column="1" Style="{StaticResource NumInput}"
Width="240" ToolTip="单位 °,如 0,120,240"
Width="240" ToolTip="LIST:DEGR,单位 °,如 0,90,0;三相基准 0/120/240"
Text="{Binding ListDegrText, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Row="6" Grid.Column="0" Text="波形顺序"
<TextBlock Grid.Row="1" Grid.Column="0" Text="AC起始电压"
Style="{StaticResource ParamLabel}" />
<TextBox Grid.Row="1" Grid.Column="1" Style="{StaticResource NumInput}"
Width="240" ToolTip="LIST:VOLT:AC:STAR,单位 V,如 230,11.5,230"
Text="{Binding ListVoltAcStartText, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Row="2" Grid.Column="0" Text="AC结束电压"
Style="{StaticResource ParamLabel}" />
<TextBox Grid.Row="2" Grid.Column="1" Style="{StaticResource NumInput}"
Width="240" ToolTip="LIST:VOLT:AC:END,单位 V,如 230,11.5,230"
Text="{Binding ListVoltAcEndText, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Row="3" Grid.Column="0" Text="DC起始电压"
Style="{StaticResource ParamLabel}" />
<TextBox Grid.Row="3" Grid.Column="1" Style="{StaticResource NumInput}"
Width="240" ToolTip="LIST:VOLT:DC:STAR,单位 V,如 10,10,10"
Text="{Binding ListVoltDcStartText, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Row="4" Grid.Column="0" Text="DC结束电压"
Style="{StaticResource ParamLabel}" />
<TextBox Grid.Row="4" Grid.Column="1" Style="{StaticResource NumInput}"
Width="240" ToolTip="LIST:VOLT:DC:END,单位 V,如 10,10,10"
Text="{Binding ListVoltDcEndText, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Row="5" Grid.Column="0" Text="起始频率"
Style="{StaticResource ParamLabel}" />
<TextBox Grid.Row="5" Grid.Column="1" Style="{StaticResource NumInput}"
Width="240" ToolTip="LIST:FREQ:STAR,单位 Hz,如 50,50,50"
Text="{Binding ListFreqStartText, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Row="6" Grid.Column="0" Text="结束频率"
Style="{StaticResource ParamLabel}" />
<TextBox Grid.Row="6" Grid.Column="1" Style="{StaticResource NumInput}"
Width="240" ToolTip="A / B 序列,如 A,B,A"
Width="240" ToolTip="LIST:FREQ:END,单位 Hz,如 50,50,50"
Text="{Binding ListFreqEndText, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Row="7" Grid.Column="0" Text="静止时间"
Style="{StaticResource ParamLabel}" />
<TextBox Grid.Row="7" Grid.Column="1" Style="{StaticResource NumInput}"
Width="240" ToolTip="LIST:DWEL,单位 ms,如 20000,280,20000"
Text="{Binding ListDwellText, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Grid.Row="8" Grid.Column="0" Text="波形顺序"
Style="{StaticResource ParamLabel}" />
<TextBox Grid.Row="8" Grid.Column="1" Style="{StaticResource NumInput}"
Width="240" ToolTip="LIST:SHAP,A / B 序列,如 A,A,A(可留空)"
Text="{Binding ListShapeText, UpdateSourceTrigger=PropertyChanged}" />
</Grid>
<Button Content="应用序列" Command="{Binding ApplyListSequencesCommand}"
Style="{StaticResource CmdBtn}"
HorizontalAlignment="Left" Margin="0,4" />
<Separator Margin="0,6" />
<StackPanel Orientation="Horizontal" Margin="0,4">
<Button Content="开始执行" Command="{Binding ListStartCommand}"
<Button Content="下发三相并启动 LIST" Command="{Binding DownloadThreePhaseListCommand}"
Style="{StaticResource CmdBtn}"
Background="#388E3C" Foreground="White" />
<Button Content="停止执行" Command="{Binding ListStopCommand}"
<Button Content="停止 LIST" Command="{Binding ListStopCommand}"
Style="{StaticResource WarnBtn}" />
</StackPanel>
</StackPanel>
@@ -300,6 +352,9 @@
</TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,4">
<CheckBox Content="采集频率" IsChecked="{Binding IsFrequencySamplingEnabled}"
VerticalAlignment="Center" Margin="4,0,10,0"
ToolTip="频率一般无需持续采集;勾选后采样循环才读取频率并绘制到右侧频率曲线" />
<TextBlock Text="频率" Style="{StaticResource ParamLabel}" />
<TextBox Style="{StaticResource MeasureBox}"
Text="{Binding FrequencyNow, Mode=OneWay, StringFormat={}{0:F2}}" />
@@ -325,12 +380,11 @@
</StackPanel>
</ScrollViewer>
<!-- ============ 右侧:三相正弦波(电压 / 电流 / 功率,横轴相位角 0~360°,有正有负) ============ -->
<!-- ============ 右侧:三相电压 + 输出频率(横轴为采集经过时间 s) ============ -->
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- 三相电压 -->
@@ -358,49 +412,33 @@
</Grid>
</Border>
<!-- 三相电流 -->
<Border Grid.Row="1" Background="White" BorderBrush="#DDD" BorderThickness="1" Margin="0,0,0,4">
<!-- 输出频率(受左侧“采集频率”开关控制,一般不采集) -->
<Border Grid.Row="1" Background="White" BorderBrush="#DDD" BorderThickness="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Margin="10,6">
<TextBlock Text="三相电流 (A)" FontWeight="Bold" FontSize="13"
<TextBlock Text="输出频率 (Hz)" FontWeight="Bold" FontSize="13"
VerticalAlignment="Center" Margin="0,0,16,0" />
<TextBlock Text="A" FontSize="12" Foreground="#E53935" VerticalAlignment="Center" />
<TextBlock Text="{Binding CurrentA, StringFormat={}{0:F2}}" FontSize="12"
FontWeight="Bold" VerticalAlignment="Center" Margin="3,0,14,0" />
<TextBlock Text="B" FontSize="12" Foreground="#43A047" VerticalAlignment="Center" />
<TextBlock Text="{Binding CurrentB, StringFormat={}{0:F2}}" FontSize="12"
FontWeight="Bold" VerticalAlignment="Center" Margin="3,0,14,0" />
<TextBlock Text="C" FontSize="12" Foreground="#1E88E5" VerticalAlignment="Center" />
<TextBlock Text="{Binding CurrentC, StringFormat={}{0:F2}}" FontSize="12"
FontWeight="Bold" VerticalAlignment="Center" Margin="3,0,0,0" />
<TextBlock Text="{Binding FrequencyNow, StringFormat={}{0:F2}}" FontSize="12"
FontWeight="Bold" Foreground="#8E24AA" VerticalAlignment="Center" Margin="3,0,14,0" />
<TextBlock FontSize="11" Foreground="#4CAF50" VerticalAlignment="Center">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Text" Value="频率采集中" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsFrequencySamplingEnabled}" Value="False">
<Setter Property="Text" Value="频率采集未开启(在左侧“数据采集”勾选后才会绘制)" />
<Setter Property="Foreground" Value="#9E9E9E" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</StackPanel>
<oxy:PlotView Grid.Row="1" Model="{Binding CurrentPlot}"
Background="Transparent" Margin="4,0,4,4" />
</Grid>
</Border>
<!-- 三相功率 -->
<Border Grid.Row="2" Background="White" BorderBrush="#DDD" BorderThickness="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Margin="10,6">
<TextBlock Text="三相功率 (W)" FontWeight="Bold" FontSize="13"
VerticalAlignment="Center" Margin="0,0,16,0" />
<TextBlock Text="总有功" FontSize="12" Foreground="#616161" VerticalAlignment="Center" />
<TextBlock Text="{Binding PowerNow, StringFormat={}{0:F1}}" FontSize="12"
FontWeight="Bold" VerticalAlignment="Center" Margin="3,0,14,0" />
<TextBlock Text="频率" FontSize="12" Foreground="#616161" VerticalAlignment="Center" />
<TextBlock Text="{Binding FrequencyNow, StringFormat={}{0:F2} Hz}" FontSize="12"
FontWeight="Bold" VerticalAlignment="Center" Margin="3,0,0,0" />
</StackPanel>
<oxy:PlotView Grid.Row="1" Model="{Binding PowerPlot}"
<oxy:PlotView Grid.Row="1" Model="{Binding FrequencyPlot}"
Background="Transparent" Margin="4,0,4,4" />
</Grid>
</Border>