Commit 880f59a4 authored by 潘栩锋's avatar 潘栩锋 🚴

Merge branch 'dev7.0-blowing' of…

Merge branch 'dev7.0-blowing' of http://private.flyautomation.net:82/panruising/thick_public into dev7.0-blowing
parents faf319ea 87d5e93d
......@@ -13,6 +13,16 @@ namespace Install
/// </summary>
public partial class App : Application
{
public App()
{
AppDomain.CurrentDomain.UnhandledException += (s, e) =>
{
MessageBox.Show("程序出现异常,请把下面信息拍照发给厂家" + Environment.NewLine + e.ExceptionObject.ToString(),
"异常,联系厂家",
MessageBoxButton.OK, MessageBoxImage.Error);
};
}
public static T Resolve<T>()
{
return (T)App.Current.Properties[typeof(T).FullName];
......
......@@ -80,7 +80,7 @@ namespace FLY.Simulation.Blowing
#region
/// <summary>
/// 膜泡压扁后总宽度,单位 脉冲
/// 膜泡压扁后总宽度,单位 mm
/// </summary>
public double FilmWidth { get; set; }
......@@ -229,7 +229,7 @@ namespace FLY.Simulation.Blowing
AngleDecTime = 5;//减速时间5s
AngleCoolTime = 5;//正反转延迟时间5s
FilmWidth = 2.3;//膜宽2.3m
FilmWidth = 1500;//膜宽1500mm
FilmVelocity = 20;//线速度m/min
FilmDistance = 26;//膜距离m
......@@ -550,9 +550,9 @@ namespace FLY.Simulation.Blowing
/// <summary>
/// 给定相对于膜横向位置, 输出当前对应的厚度
/// </summary>
/// <param name="pos_m"></param>
/// <param name="pos_mm"></param>
/// <returns></returns>
public FilmData GetData(double pos_m)
public FilmData GetData(double pos_mm)
{
//double ago_filmlength = CurrFilmLength - CurrFilmDistance;
double angle;
......@@ -564,7 +564,7 @@ namespace FLY.Simulation.Blowing
//if (!SearchAngleFromPositionList(ago_filmlength, out angle))
// return null;
return GetData(pos_m, angle);
return GetData(pos_mm, angle);
}
double GetValidAngle(double a) {
......@@ -577,17 +577,17 @@ namespace FLY.Simulation.Blowing
/// <summary>
/// 获取膜泡数据
/// </summary>
/// <param name="position">相对于膜泡位置,横向</param>
/// <param name="position_mm">相对于膜泡位置,横向</param>
/// <param name="angle">人字架角度</param>
/// <returns></returns>
FilmData GetData(double position, double angle)
FilmData GetData(double position_mm, double angle)
{
if ((position < 0) || (position > FilmWidth))
if ((position_mm < 0) || (position_mm > FilmWidth))
{
return null;
}
//与0°的偏移
double a = position / FilmWidth * 180;
double a = position_mm / FilmWidth * 180;
//压扁对面的角度
double a_other = 360 - a;
......
......@@ -17,7 +17,7 @@ namespace FLY.Simulation.Blowing
/// <summary>
/// 机架总长 mm
/// </summary>
public int TotalLength { get; set; } = 3000;
public int TotalLength { get; set; } = 2440;
public Blowing mBlowing;
......@@ -35,11 +35,10 @@ namespace FLY.Simulation.Blowing
/// </summary>
public int SenserWidth;
public int[] AirDatas;
CurveCollection curve;
double ppmm;
public GageAD()
{
curve = new CurveCollection();
......@@ -49,18 +48,8 @@ namespace FLY.Simulation.Blowing
FilmWidth = (int)mBlowing.FilmWidth;
FilmBegin = 300;
SenserWidth = 30;
AirDatas = new int[TotalLength];
NewAirDatas();
}
void NewAirDatas()
{
int a = 20;
Random r = new Random();
for (int i = 0; i < AirDatas.Count(); i++)
{
AirDatas[i] = r.Next(a) - a/2;
}
}
public void OnPoll(DateTime now)
{
//NewAirDatas();
......@@ -70,35 +59,34 @@ namespace FLY.Simulation.Blowing
public int GetAD(int mm)
{
return GetAD_1(mm);
//return GetAD_2(pos);
//return GetAD_2(mm);
}
int GetAD_1(int mm)
{
Random r = new Random();
int data = r.Next(50) - 25;
Random r = new Random();
int data = r.Next(30*2) - 30;// 单位 0.01um, ±0.3um波动
if ((mm >= FilmBegin) && (mm<(FilmBegin+FilmWidth)))
if ((mm >= FilmBegin) && (mm<(FilmBegin+FilmWidth)))
{
int position_mm = mm-FilmBegin;
FilmData fd = mBlowing.GetData(position_mm);
if (fd != null)
{
int position = mm-FilmBegin;
double pos_m = position / 1000.0;
FilmData fd = mBlowing.GetData(pos_m);
if (fd != null)
{
data += fd.data1 + fd.data2;
}
data += fd.data1 + fd.data2;
}
}
//求平均值
double thick = data / 100.0;
return curve.Value2Ad(thick, AD2ValueFlag.NoRevised);
}
int GetAD_2(int pos)
int GetAD_2(int mm)
{
int[] datas = new int[SenserWidth];
for (int i = 0; i < SenserWidth; i++)
for (int i = 0; i < SenserWidth; i+=5)
{
datas[i] = GetAD_1(pos - SenserWidth / 2 + i);
datas[i] = GetAD_1(mm - SenserWidth / 2 + i);
}
//求平均值
return (int)datas.Average();
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FLY.Simulation.Calender.GuRuiShiYe</RootNamespace>
<AssemblyName>FLY.Simulation.Calender.GuRuiShiYe</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Gage.cs" />
<Compile Include="GageAD.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Project.FLY.Misc\MISC\Misc.csproj">
<Project>{5ee61ac6-5269-4f0f-b8fa-4334fe4a678f}</Project>
<Name>Misc</Name>
</ProjectReference>
<ProjectReference Include="..\FLY.Simulation.Flyad7\FLY.Simulation.Flyad7.csproj">
<Project>{ae180a75-fafa-4c5e-8767-0a26447936b6}</Project>
<Name>FLY.Simulation.Flyad7</Name>
</ProjectReference>
<ProjectReference Include="..\FLY.Simulation\FLY.Simulation.csproj">
<Project>{150f2411-fe62-4042-a968-33e416dc56a1}</Project>
<Name>FLY.Simulation</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="EPPlus">
<Version>4.5.3.2</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>12.0.3</Version>
</PackageReference>
<PackageReference Include="PropertyChanged.Fody">
<Version>3.3.1</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<PropertyChanged />
</Weavers>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="PropertyChanged" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="InjectOnPropertyNameChanged" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if the On_PropertyName_Changed feature is enabled.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="TriggerDependentProperties" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if the Dependent properties feature is enabled.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="EnableIsChangedProperty" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if the IsChanged property feature is enabled.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="EventInvokerNames" type="xs:string">
<xs:annotation>
<xs:documentation>Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="CheckForEquality" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="CheckForEqualityUsingBaseEquals" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should use the Equals method resolved from the base class.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="UseStaticEqualsFromBase" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should use the static Equals method resolved from the base class.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="SuppressWarnings" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to turn off build warnings from this weaver.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="SuppressOnPropertyNameChangedWarning" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to turn off build warnings about mismatched On_PropertyName_Changed methods.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FLY.Simulation.Calender.GuRuiShiYe
{
public class Gage:INotifyPropertyChanged
{
public FLY.Simulation.Flyad7.FLYAD7[] FlyAds { get; private set; }
public GageAd[] GageAds { get; private set; }
FLY.Simulation.Flyad7.FLYAD7[] flyads;
GageAd[] gageAds;
public Gage() {
}
public event PropertyChangedEventHandler PropertyChanged;
public void Init(int devCnt) {
gageAds = new GageAd[devCnt];
flyads = new Flyad7.FLYAD7[devCnt];
for (int i = 0; i < devCnt; i++) {
gageAds[i] = new GageAd();
gageAds[i].Init($"{i:D2}", i > 0 ? gageAds[i - 1].GetFilmValue:null);
flyads[i] = new Flyad7.FLYAD7($@"{i:D2}\flyad.json");
flyads[i].Init(gageAds[i]);
}
FlyAds = flyads;
GageAds = gageAds;
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("FLY.Simulation.Calender.GuRuiShiYe")]
[assembly: AssemblyDescription("绵阳固瑞实业3台涂布线 AD盒模拟器")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FLY.Simulation.Calender.GuRuiShiYe")]
[assembly: AssemblyCopyright("Copyright © 2021 flyautomation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("aeadfc07-59d9-40c4-bb31-47cffda6cc5c")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
......@@ -133,7 +133,11 @@ namespace FLY.Simulation.Flyad7
mSimGageAD = new FLY.Simulation.Coating.GageAD();
break;
default:
throw new Exception("不支持 SIM_MODE" + mSimGageAD.ToString());
{
mSimGageAD = new FLY.Simulation.Blowing.GageAD();
mSimMode = SIM_MODE.Blowing;
break;
}
}
Init2();
......
......@@ -31,7 +31,7 @@ namespace FLY.Simulation.Flyad7.OBJProxy
}break;
case FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.GET_STATE:
{
FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.Pack_DriveState pack = new FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.Pack_DriveState();
FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.Pack_DriveState_2 pack = new FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.Pack_DriveState_2();
pack.order = Data.DriveOrder;
pack.status = Data.DriveStatus;
pack.marker = Data.Marker;
......
......@@ -89,7 +89,7 @@ namespace FLY.Simulation.Flyad7.OBJProxy
else if ((e.PropertyName == nameof(Data.DriveStatus))||(e.PropertyName == nameof(Data.Marker)))
{
CurrObjSys.PushObjInfoEx(this, FLYAD7_OBJ_INTERFACE.PUSH_DATA_INTERFACE.PUSH_STATUS,
new FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.Pack_DriveState
new FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.Pack_DriveState_2
{
order = Data.DriveOrder,
status = Data.DriveStatus,
......
......@@ -116,7 +116,7 @@ namespace FLY.Simulation.Flyad7
/// 当前脉冲
/// </summary>
double m_currpos => m_physicalPos + m_offset + PosOffset;
double m_physicalPos = 990;
double m_physicalPos = 3200;
/// <summary>
/// 归0信号偏移
/// </summary>
......
......@@ -40,8 +40,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FLY.Simulation.Battery.RayL
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FLYAD7.Simulation.Battery.RayLaser", "FLYAD7.Simulation.Battery.RayLaser\FLYAD7.Simulation.Battery.RayLaser.csproj", "{DFD5FDFA-6E8D-4901-8708-D7EF0269EE6A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FLY.Simulation.Calender.GuRuiShiYe", "FLY.Simulation.Calender.GuRuiShiYe\FLY.Simulation.Calender.GuRuiShiYe.csproj", "{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FLY.Simulation.Calender.GuRuiShiYe.UI", "FLY.Simulation.Calender.GuRuiShiYe.UI\FLY.Simulation.Calender.GuRuiShiYe.UI.csproj", "{517847E4-5708-4ACE-BDF0-BB2C4495136D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlyAd2021", "FlyAd2021\FlyAd2021.csproj", "{9521A8F9-7310-49B3-A951-594EFE9D3EF0}"
......@@ -50,6 +48,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlyAd2021_WPF", "FlyAd2021_
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FLY.ModbusMapper", "..\Project.FLY.ModbusMapper\FLY.ModbusMapper\FLY.ModbusMapper.csproj", "{6D4B9BDA-2A66-4583-B244-758BC4213D9F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FLY.Simulation.Calender.GuRuiShiYe", "FLY.Simulation.Calender.GuRuiShiYe\FLY.Simulation.Calender.GuRuiShiYe.csproj", "{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -224,18 +224,6 @@ Global
{DFD5FDFA-6E8D-4901-8708-D7EF0269EE6A}.Release|Mixed Platforms.Build.0 = Release|x86
{DFD5FDFA-6E8D-4901-8708-D7EF0269EE6A}.Release|x86.ActiveCfg = Release|x86
{DFD5FDFA-6E8D-4901-8708-D7EF0269EE6A}.Release|x86.Build.0 = Release|x86
{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}.Debug|x86.ActiveCfg = Debug|Any CPU
{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}.Debug|x86.Build.0 = Debug|Any CPU
{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}.Release|Any CPU.Build.0 = Release|Any CPU
{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}.Release|x86.ActiveCfg = Release|Any CPU
{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}.Release|x86.Build.0 = Release|Any CPU
{517847E4-5708-4ACE-BDF0-BB2C4495136D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{517847E4-5708-4ACE-BDF0-BB2C4495136D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{517847E4-5708-4ACE-BDF0-BB2C4495136D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
......@@ -282,6 +270,18 @@ Global
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Release|x86.ActiveCfg = Release|Any CPU
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Release|x86.Build.0 = Release|Any CPU
{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}.Debug|x86.ActiveCfg = Debug|Any CPU
{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}.Debug|x86.Build.0 = Debug|Any CPU
{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}.Release|Any CPU.Build.0 = Release|Any CPU
{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}.Release|x86.ActiveCfg = Release|Any CPU
{AEADFC07-59D9-40C4-BB31-47CFFDA6CC5C}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -95,7 +95,6 @@ namespace FlyAd2021
{
fGrid.SetSize(PosLen / PosOfGrid);
TimeGridAdvHelperExt.ad_ts_ms = 1;
mTimeGridAdvHelper.Init();
this.PropertyChanged += FlyAD7_PropertyChanged1;
......@@ -435,7 +434,7 @@ namespace FlyAd2021
{
Time = lastUpdateADTime,
Data = adList.ToArray(),
Ts = TimeGridAdvHelperExt.ad_ts
Ts = TimeSpan.FromMilliseconds(1)
});
lastUpdateADTime = Now;
......
......@@ -274,7 +274,35 @@ namespace Misc
else
return 0;
}
/// <summary>
/// 排除 NULL_VALUE, 求Sigma
/// </summary>
/// <param name="buf"></param>
/// <param name="first">开始序号</param>
/// <param name="last">结束序号</param>
/// <returns></returns>
public static double Sigma(IEnumerable<double> buf, int first, int last)
{
double avg = Avg(buf, first, last);
if (double.IsNaN(avg))
return double.NaN;
double sum = 0;
int cnt = 0;
for (int i = first; i <= last; i++)
{
if (!double.IsNaN(buf.ElementAt(i)))
{
sum += (buf.ElementAt(i) - avg) * (buf.ElementAt(i) - avg);
cnt++;
}
}
if (cnt >= 3)
return (Math.Sqrt(sum / (cnt - 1)));
else
return 0;
}
/// <summary>
/// 排除 NULL_VALUE, 求Sigma
/// </summary>
......
......@@ -125,7 +125,7 @@ namespace Misc
public static void CopyTo(object src, object dest)
{
Type t = src.GetType();
if (src.GetType() != dest.GetType())
if (!src.GetType().IsAssignableFrom(dest.GetType()))
{
throw new Exception("CopyTo src.GetType() != dest.GetType()");
}
......
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