Commit 1a7305cc authored by 潘栩锋's avatar 潘栩锋 🚴

Squashed commit of the following:

commit c9341c1e
Author: SimonPan <panruising@163.com>
Date:   Tue Feb 19 09:10:24 2019 +0800

    1
parent 7158c9a0
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
......@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FLY.ControlLibrary</RootNamespace>
<AssemblyName>FLY.ControlLibrary</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
......@@ -26,6 +26,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\FLY.ControlLibrary.XML</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
......@@ -34,6 +35,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Expression.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
......
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.34209
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
......@@ -19,7 +19,7 @@ namespace FLY.ControlLibrary.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
......@@ -47,7 +47,7 @@ namespace FLY.ControlLibrary.Properties {
}
/// <summary>
/// 使用此强类型资源类,为所有资源查找
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
......
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.34209
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
......@@ -12,7 +12,7 @@ namespace FLY.ControlLibrary.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
......
......@@ -29,5 +29,5 @@ namespace FObjBase
}
}
public delegate void AsyncCBHandler(object AsyncState, object retData);
public delegate void AsyncCBHandler(object AsyncContext, object retData);
}
......@@ -150,7 +150,7 @@ namespace FObjBase
{
}
public virtual void PushCallFunction(IFConn from, uint srcid, UInt32 magic, ushort funcid, byte[] retdata, object AsyncDelegate, object AsyncState)
public virtual void PushCallFunction(IFConn from, uint srcid, UInt32 magic, ushort funcid, byte[] retdata, object AsyncDelegate, object AsyncContext)
{
}
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Misc
{
public static class Enumerable
{
//
// 摘要:
// 计算 System.Double 值序列的Sigma,该值可通过调用输入序列的每个元素的转换函数获取。
//
// 参数:
// source:
// 要计算其平均值的值序列。
//
// selector:
// 应用于每个元素的转换函数。
//
// 类型参数:
// TSource:
// source 中的元素的类型。
//
// 返回结果:
// 值序列的Sigma。
//
// 异常:
// T:System.ArgumentNullException:
// source 或 selector 为 null。
//
// T:System.InvalidOperationException:
// source 中不包含任何元素。
public static double Sigma<TSource>(this IEnumerable<TSource> source, Func<TSource, double> selector)
{
if (source.Count() == 0)
return -1;
double avg = source.Average(selector);
double sum_pow = source.Sum((s) => Math.Pow((selector(s) - avg), 2));
return Math.Sqrt(sum_pow / (source.Count() - 1));
}
public static double Sigma(this IEnumerable<double> source)
{
return source.Sigma(d => d);
}
public static double CPK<TSource>(this IEnumerable<TSource> source, Func<TSource, double> selector, double usl, double lsl)
{
if (source.Count() == 0)
return -1;
//CPK = Min(CPKu,CPKl)
//USL(Upper specification limit): 规格上限。
//LSL(Low specification limit): 规格下限。
//ˉx = (x1 + x2 +...+ xn) / n : 平均值。
//T = USL - LSL : 规格公差。
//U = (USL + LSL) / 2:规格中心。
//CPKu = | USL - ˉx | / 3σ
//CPKl = | ˉx - LSL | / 3σ
double avg = source.Average(selector);
double sigma3 = source.Sigma(selector) * 3;
double CPKu = Math.Abs(usl - avg) / sigma3;
double CPKl = Math.Abs(lsl - avg) / sigma3;
double CPK = Math.Min(CPKu, CPKl);
return CPK;
}
public static double CPK(this IEnumerable<double> source, double usl, double lsl)
{
return source.CPK(d => d, usl, lsl);
}
public static List<XY> GetHistogram<TSource>(this IEnumerable<TSource> source, Func<TSource, double> selector, double step)
{
List<XY> list = new List<XY>();
foreach (var v in source)
{
double x = ((int)(selector(v) / step)) * step;
XY xy = list.Find(_xy => _xy.X == x);
if (xy != null)
{
xy.Y++;
}
else
{
xy = new XY(x, 1);
list.Add(xy);
}
}
list.Sort();
return list;
}
public static List<XY> GetHistogram(this IEnumerable<double> source, double step)
{
return source.GetHistogram(d => d, step);
}
}
public class XY : IComparable, ICloneable, ICopiable
{
public double X { get; set; }
public double Y { get; set; }
public XY()
{
}
public XY(double x, double y)
{
X = x;
Y = y;
}
public int CompareTo(object obj)
{
XY xy = obj as XY;
return X.CompareTo(xy.X);
}
public object Clone()
{
XY xy = new XY();
xy.Copy(this);
return xy;
}
public void Copy(object src)
{
Misc.PropertiesManager.CopyTo(src, this);
}
}
}
......@@ -86,6 +86,7 @@
<Compile Include="CRC.cs" />
<Compile Include="DATARANGE.cs" />
<Compile Include="Debug.cs" />
<Compile Include="Enumerable.cs" />
<Compile Include="IgnoreAttribute.cs" />
<Compile Include="ITDParam.cs" />
<Compile Include="Log.cs" />
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\PropertyChanged2.Fody.2.5.13\build\PropertyChanged2.Fody.props" Condition="Exists('..\..\packages\PropertyChanged2.Fody.2.5.13\build\PropertyChanged2.Fody.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
......@@ -11,7 +11,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ThickTcpUiInWindow</RootNamespace>
<AssemblyName>ThickTcpUiInWindow</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
......@@ -45,6 +45,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\ThickTcpUiInWindow.XML</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
......@@ -54,6 +55,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>
......
......@@ -19,7 +19,7 @@ namespace ThickTcpUiInWindow.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Resources {
......@@ -47,7 +47,7 @@ namespace ThickTcpUiInWindow.Properties {
}
/// <summary>
/// 使用此强类型资源类,为所有资源查找
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
......
......@@ -12,7 +12,7 @@ namespace ThickTcpUiInWindow.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
......
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></configuration>
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