Commit e3af7e40 authored by 潘栩锋's avatar 潘栩锋 🚴

反卷积研究

parent fad96eee
using FlyADBase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Unity;
namespace Flyad7_WPF
{
public class UnityExt
{
public static UnityContainer Container;
static UnityExt()
{
Init();
}
static void Init()
{
Container = new UnityContainer();
Container.RegisterType<DebugAppParam>(
new Unity.Lifetime.ContainerControlledLifetimeManager());
Container.RegisterFactory<FlyAD7>((unity) =>
{
IFlyADClient flyAd = new FlyAD7();
var param = unity.Resolve<DebugAppParam>();
Misc.BindingOperations.SetBinding(param, "HasCRC", flyAd, "HasCRC");
return flyAd;
}, new Unity.Lifetime.ContainerControlledLifetimeManager());
Container.RegisterFactory<AutoForwBackw>((unity) =>
{
var flyad = Container.Resolve<FlyAD7>();
AutoForwBackw autofb = new AutoForwBackw(flyad);
var param = unity.Resolve<DebugAppParam>();
Misc.BindingOperations.SetBinding(param, "FB_Pos1", autofb, "FB_Pos1", Misc.BindingOperations.BindingMode.TwoWay);
Misc.BindingOperations.SetBinding(param, "FB_Pos2", autofb, "FB_Pos2", Misc.BindingOperations.BindingMode.TwoWay);
return autofb;
}, new Unity.Lifetime.ContainerControlledLifetimeManager());
Container.RegisterType<FlyADClientUI>(
new Unity.Lifetime.ContainerControlledLifetimeManager());
Container.RegisterType<AutoGetGridAdv>(
new Unity.Lifetime.ContainerControlledLifetimeManager());
Container.RegisterType<AutoSync>(
new Unity.Lifetime.ContainerControlledLifetimeManager());
Container.RegisterFactory<GridAdvVm>((unity) =>
{
var flyad = Container.Resolve<FlyAD7>();
GridAdvVm gridAdvVm = new GridAdvVm(flyad);
var param = unity.Resolve<DebugAppParam>();
Misc.BindingOperations.SetBinding(param, "HasGridAdv", gridAdvVm, "HasGridAdv", Misc.BindingOperations.BindingMode.TwoWay);
return gridAdvVm;
}, new Unity.Lifetime.ContainerControlledLifetimeManager());
}
}
}
<Window x:Class="Flyad7_WPF.WdConvolution"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Flyad7_WPF"
xmlns:Chr="clr-namespace:System.Windows.Forms.DataVisualization.Charting;assembly=System.Windows.Forms.DataVisualization"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance local:WdConvolutionVm}"
Title="WdConvolution" Height="450" Width="800">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="WdConvolutionStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal">
<StackPanel Margin="5">
<TextBlock Style="{StaticResource TextBlockStyle_title}" >
R=<Run Text="{Binding R,StringFormat={}{0:F4}}"/> <LineBreak/>
</TextBlock>
<GroupBox Header="支架">
<StackPanel>
<Button Style="{StaticResource ButtonStyle_normal}" Content="创建支架" Command="{Binding CreateHolderCmd}"/>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_title}" Text="支架宽度(mm)"/>
<TextBox Style="{StaticResource TextBoxStyle_input}" Text="{Binding HolderWidth}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_title}" Text="mm/脉冲"/>
<TextBox Style="{StaticResource TextBoxStyle_input}" Text="{Binding Mmpp}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_title}" Text="支架中心(grid)"/>
<TextBox Style="{StaticResource TextBoxStyle_input}" Text="{Binding HolderMidGrid}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_title}" Text="空气AD"/>
<TextBox Style="{StaticResource TextBoxStyle_input}" Text="{Binding AirAd}"/>
</StackPanel>
<TextBlock Style="{StaticResource TextBlockStyle_title}">
HolderR=<Run Text="{Binding HolderR,StringFormat={}{0:F6}}"/>
</TextBlock>
</StackPanel>
</GroupBox>
<GroupBox Header="卷积计算">
<StackPanel>
<Button Style="{StaticResource ButtonStyle_normal}" Content="卷积计算" Command="{Binding UpdateConvCmd}"/>
<Button Style="{StaticResource ButtonStyle_normal}" Content="计算卷积核" Command="{Binding CalConvCmd}"/>
<Button Style="{StaticResource ButtonStyle_normal}" Content="计算卷积核2" Command="{Binding CalConv2Cmd}"/>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_title}" Text="卷积核长度(grid)"/>
<TextBox Style="{StaticResource TextBoxStyle_input}" Text="{Binding CoreLen}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_title}" Text="支架开始(grid)"/>
<TextBox Style="{StaticResource TextBoxStyle_input}" Text="{Binding HolderBeginGrid}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle_title}" Text="支架结束(grid)"/>
<TextBox Style="{StaticResource TextBoxStyle_input}" Text="{Binding HolderEndGrid}"/>
</StackPanel>
<TextBlock Style="{StaticResource TextBlockStyle_title}">
HolderLenGrid=<Run Text="{Binding HolderLenGrid,Mode=OneWay}"/>
</TextBlock>
</StackPanel>
</GroupBox>
</StackPanel>
<DataGrid AutoGenerateColumns="False" ItemsSource="{Binding ConvCore}" MinWidth="100" TextBlock.FontSize="18" TextBlock.FontWeight="Normal">
<DataGrid.Columns>
<DataGridTextColumn Header="Value" Binding="{Binding Value}" Width="100"/>
</DataGrid.Columns>
</DataGrid>
</StackPanel>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<WindowsFormsHost Grid.Row="0">
<Chr:Chart x:Name="chart0" />
</WindowsFormsHost>
<WindowsFormsHost Grid.Row="1">
<Chr:Chart x:Name="chart1" />
</WindowsFormsHost>
<WindowsFormsHost Grid.Row="2">
<Chr:Chart x:Name="chart2" />
</WindowsFormsHost>
</Grid>
</Grid>
</Window>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Flyad7_WPF.WdConvolution">
<Thickness x:Key="Margin_control">5</Thickness>
<Style TargetType="Button" x:Key="ButtonStyle_normal">
<Setter Property="Height" Value="30"/>
<Setter Property="Margin" Value="3"/>
<Setter Property="Padding" Value="20,3"/>
</Style>
<Style TargetType="TextBlock" x:Key="TextBlockStyle_title">
<Setter Property="Margin" Value="3" />
</Style>
<Style TargetType="TextBox" x:Key="TextBoxStyle_input">
<Setter Property="MinWidth" Value="100"/>
<Setter Property="Height" Value="23" />
<Setter Property="Margin" Value="3" />
</Style>
</ResourceDictionary>
\ No newline at end of file
<Window x:Class="Flyad7_WPF.WdGridAdvAnalyze"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Flyad7_WPF"
xmlns:Chr="clr-namespace:System.Windows.Forms.DataVisualization.Charting;assembly=System.Windows.Forms.DataVisualization"
mc:Ignorable="d"
Title="WdGridAdvAnalyze" Width="800" d:DataContext="{d:DesignInstance Type=local:WdGridAdvAnalyzeVm}">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="WdGridAdvAnalyzeStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel Margin="5">
<TextBlock Style="{StaticResource tbkTitle}" >
R=<Run Text="{Binding R,StringFormat={}{0:F4}}"/> <LineBreak/>
Speed=<Run Text="{Binding Speed,StringFormat={}{0:F1}}"/>
</TextBlock>
<Button Style="{StaticResource btnNormal}" Content="加载" Command="{Binding LoadCmd}"/>
<Button Style="{StaticResource btnNormal}" Content="自动计算" Command="{Binding AutoCmd}"/>
<Button Style="{StaticResource btnNormal}" Content="自动2" Command="{Binding Auto2Cmd}"/>
<Button Style="{StaticResource btnNormal}" Content="手动计算" Command="{Binding ManualCmd}"/>
<Button Style="{StaticResource btnNormal}" Content="清除R" Command="{Binding ClearRCmd}"/>
<Button Style="{StaticResource btnNormal}" Content="卷积调试" Command="{Binding ConvDebugCmd}"/>
<TextBlock Style="{StaticResource tbkTitle}">
CurrR=<Run Text="{Binding CurrR,StringFormat={}{0:F6}}"/>
</TextBlock>
<TextBlock Style="{StaticResource tbkTitle}">
CurrGroupR=<Run Text="{Binding CurrGroupR,StringFormat={}{0:F6}}"/>
</TextBlock>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource tbkTitle}" Text="K1*X(n)"/>
<TextBox Style="{StaticResource txtInput}" Text="{Binding Ks[0],StringFormat={}{0:F6}}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource tbkTitle}" Text="K2*Y(n-1)"/>
<TextBox Style="{StaticResource txtInput}" Text="{Binding Ks[1],StringFormat={}{0:F6}}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource tbkTitle}" Text="K3*X(n-1)"/>
<TextBox Style="{StaticResource txtInput}" Text="{Binding Ks[2],StringFormat={}{0:F6}}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource tbkTitle}" Text="K4*Y(n-2)"/>
<TextBox Style="{StaticResource txtInput}" Text="{Binding Ks[3],StringFormat={}{0:F6}}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource tbkTitle}" Text="K5*X(n-2)"/>
<TextBox Style="{StaticResource txtInput}" Text="{Binding Ks[4],StringFormat={}{0:F6}}"/>
</StackPanel>
<TextBlock Style="{StaticResource tbkTitle}">
CellCnt=<Run Text="{Binding CellCnt,Mode=OneWay}"/>
</TextBlock>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource tbkTitle}" Text="SampleCellIdx="/>
<TextBox Style="{StaticResource txtInput}" Text="{Binding SampleCellIdx}"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Style="{StaticResource btnNormal}" Content="Pre" Command="{Binding PreIdxCmd}"/>
<Button Style="{StaticResource btnNormal}" Content="Next" Command="{Binding NextIdxCmd}"/>
</StackPanel>
</StackPanel>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<WindowsFormsHost Grid.Row="0">
<Chr:Chart x:Name="chart2" />
</WindowsFormsHost>
<WindowsFormsHost Grid.Row="1">
<Chr:Chart x:Name="chart0" />
</WindowsFormsHost>
<WindowsFormsHost Grid.Row="2">
<Chr:Chart x:Name="chart1" />
</WindowsFormsHost>
</Grid>
</Grid>
</Window>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Flyad7_WPF">
<Style TargetType="Button" x:Key="btnNormal">
<Setter Property="Height" Value="30"/>
<Setter Property="Margin" Value="3"/>
<Setter Property="Padding" Value="20,3"/>
</Style>
<Style TargetType="TextBlock" x:Key="tbkTitle">
<Setter Property="Margin" Value="3" />
</Style>
<Style TargetType="TextBox" x:Key="txtInput">
<Setter Property="MinWidth" Value="100"/>
<Setter Property="Height" Value="23" />
<Setter Property="Margin" Value="3" />
</Style>
</ResourceDictionary>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment