Commit 196e5381 authored by 潘栩锋's avatar 潘栩锋 🚴

1. 把 膜距离 计算 拉到了 客户端执行。

2. 添加膜距离 计算界面
3.支持立体旋转架,这样的膜距离会变化的模型
parent aa6e6db4
......@@ -109,23 +109,19 @@
<None Include="Resources\bitbug_favicon.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Project.FLY.AppHelper\FLY.AppHelper\FLY.AppHelper.csproj">
<ProjectReference Include="..\..\thick_public\Project.FLY.AppHelper\FLY.AppHelper\FLY.AppHelper.csproj">
<Project>{9c46d98f-6500-490b-9e56-c89dfffa05f8}</Project>
<Name>FLY.AppHelper</Name>
</ProjectReference>
<ProjectReference Include="..\..\Project.FLY.ControlLibrary\FLY.ControlLibrary\FLY.ControlLibrary.csproj">
<Project>{119c3adc-f8e1-4f72-b89b-006236ff8586}</Project>
<Name>FLY.ControlLibrary</Name>
</ProjectReference>
<ProjectReference Include="..\..\Project.FLY.FObjSys\FObjSys\FObjBase.csproj">
<ProjectReference Include="..\..\thick_public\Project.FLY.FObjSys\FObjSys\FObjBase.csproj">
<Project>{abfe87d4-b692-4ae9-a8c0-1f470b8acbb8}</Project>
<Name>FObjBase</Name>
</ProjectReference>
<ProjectReference Include="..\..\Project.FLY.Misc\MISC\Misc.csproj">
<ProjectReference Include="..\..\thick_public\Project.FLY.Misc\MISC\Misc.csproj">
<Project>{5ee61ac6-5269-4f0f-b8fa-4334fe4a678f}</Project>
<Name>Misc</Name>
</ProjectReference>
<ProjectReference Include="..\..\Project.FLY.OBJComponents\OBJComponents\OBJComponents.csproj">
<ProjectReference Include="..\..\thick_public\Project.FLY.OBJComponents\OBJComponents\OBJComponents.csproj">
<Project>{a539505d-9ac0-426b-a9a0-197df50598b0}</Project>
<Name>OBJComponents</Name>
</ProjectReference>
......
......@@ -110,23 +110,23 @@
<Resource Include="通风风扇.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Project.FLY.AppHelper\FLY.AppHelper\FLY.AppHelper.csproj">
<ProjectReference Include="..\..\thick_public\Project.FLY.AppHelper\FLY.AppHelper\FLY.AppHelper.csproj">
<Project>{9c46d98f-6500-490b-9e56-c89dfffa05f8}</Project>
<Name>FLY.AppHelper</Name>
</ProjectReference>
<ProjectReference Include="..\..\Project.FLY.FObjSys\FObjSys\FObjBase.csproj">
<ProjectReference Include="..\..\thick_public\Project.FLY.FObjSys\FObjSys\FObjBase.csproj">
<Project>{abfe87d4-b692-4ae9-a8c0-1f470b8acbb8}</Project>
<Name>FObjBase</Name>
</ProjectReference>
<ProjectReference Include="..\..\Project.FLY.Misc\MISC\Misc.csproj">
<ProjectReference Include="..\..\thick_public\Project.FLY.Misc\MISC\Misc.csproj">
<Project>{5ee61ac6-5269-4f0f-b8fa-4334fe4a678f}</Project>
<Name>Misc</Name>
</ProjectReference>
<ProjectReference Include="..\..\Project.FLY.ModbusMapper\FLY.ModbusMapper\FLY.ModbusMapper.csproj">
<ProjectReference Include="..\..\thick_public\Project.FLY.ModbusMapper\FLY.ModbusMapper\FLY.ModbusMapper.csproj">
<Project>{6d4b9bda-2a66-4583-b244-758bc4213d9f}</Project>
<Name>FLY.ModbusMapper</Name>
</ProjectReference>
<ProjectReference Include="..\..\Project.FLY.OBJComponents\OBJComponents\OBJComponents.csproj">
<ProjectReference Include="..\..\thick_public\Project.FLY.OBJComponents\OBJComponents\OBJComponents.csproj">
<Project>{a539505d-9ac0-426b-a9a0-197df50598b0}</Project>
<Name>OBJComponents</Name>
</ProjectReference>
......
......@@ -60,25 +60,66 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
}
public void Init(IBlowingDetect blowingDetect,
//public void Init(IBlowingDetect blowingDetect,
// List<RollCell> rolls,
// List<LimitCell> limits,
// List<double> filmLength3D
// )
//{
// RAngle = blowingDetect.RAngle;
// RollPerimeter = blowingDetect.RollPerimeter;
// RenZiJiaPeriod = blowingDetect.RenZiJiaPeriod;
// FilmLength = blowingDetect.FilmLength;
// Is3D = blowingDetect.Is3D;
// mFilmLength3D = filmLength3D;
// mRollList = rolls;
// mLimitList = limits;
// RotationCnt = limits.Count();
//}
public void Init(
double RAngle,
double RollPerimeter,
TimeSpan RenZiJiaPeriod,
double FilmLength,
bool Is3D,
List<RollCell> rolls,
List<LimitCell> limits,
List<double> filmLength3D
)
{
RAngle = blowingDetect.RAngle;
RollPerimeter = blowingDetect.RollPerimeter;
RenZiJiaPeriod = blowingDetect.RenZiJiaPeriod;
FilmLength = blowingDetect.FilmLength;
RotationCnt = limits.Count();
Is3D = blowingDetect.Is3D;
this.RAngle = RAngle;
this.RollPerimeter = RollPerimeter;
this.RenZiJiaPeriod = RenZiJiaPeriod;
this.FilmLength = FilmLength;
this.Is3D = Is3D;
mFilmLength3D = filmLength3D;
mRollList = rolls;
mLimitList = limits;
RotationCnt = limits.Count();
}
int RotationCntToLimitIndex(int rotationcnt)
{
if (RotationCnt == 0)
return -1;
else
return rotationcnt - 1 - (RotationCnt - mLimitList.Count);
}
/// <summary>
/// 正反转信号列表中的序号,转旋转次数
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
int LimitIndexToRotationCnt(int index)
{
if (RotationCnt == 0)
return 0;
else
return RotationCnt - mLimitList.Count + index + 1;
}
/// <summary>
/// 通过角度 获取 膜距离
......@@ -167,8 +208,10 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
}
int ret = GetAgo(dt, filmLen, out ago_dt, out velocity);
if (ret == 1)
return ret;//发生在未来不处理!!!
GetAngle(
ago_dt,
out angle0, out direction, out rotationcnt, out inCV);
......@@ -202,6 +245,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
ago_velocity = 0;
int i;
int ret = RollList_FindIndex(dt, out i);
//发生在未来也要计算
if (ret == 1)
{
return ret;
......@@ -305,8 +349,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
dt_start = mLimitList[index].dt_end;
no = mLimitList[index].no;
}
rotationCnt = index + 1;
rotationCnt = LimitIndexToRotationCnt(index);
if (dt > (dt_start + RenZiJiaPeriod))
{
......@@ -323,7 +366,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
dt_start = mLimitList[index].dt_end;
dt_end = mLimitList[index + 1].dt_begin;
no = mLimitList[index].no;
rotationCnt = index;
rotationCnt = LimitIndexToRotationCnt(index);
inCV = true;
LimitListCal_ConstantVelocity(dt_end, dt_start, no, dt, out angle, out direction);
}
......@@ -338,7 +381,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
dt_start = mLimitList[0].dt_begin - (mLimitList[1].dt_begin - mLimitList[0].dt_end);
dt_end = mLimitList[0].dt_begin;
rotationCnt = 0;
rotationCnt = LimitIndexToRotationCnt(-1);
inCV = true;
LimitListCal_ConstantVelocity(dt_end, dt_start, no, dt, out angle, out direction);
}
......@@ -346,7 +389,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
case ListFindIndexResult.InCell://TODO
{
no = mLimitList[index].no;
rotationCnt = index;
rotationCnt = LimitIndexToRotationCnt(index);
inCV = false;
if (no == 0)
......@@ -365,7 +408,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
//case ListFindIndexResult.MaybeInCell:
{
no = mLimitList[index].no;
rotationCnt = index;
rotationCnt = index + 1;
inCV = false;
if (no == 0)
......
......@@ -91,6 +91,10 @@
<Reference Include="Microsoft.Xaml.Behaviors, Version=1.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Xaml.Behaviors.Wpf.1.0.1\lib\net45\Microsoft.Xaml.Behaviors.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PresentationFramework.Aero" />
<Reference Include="PropertyChanged, Version=2.6.1.0, Culture=neutral, PublicKeyToken=ee3ee20bcf148ddd, processorArchitecture=MSIL">
<HintPath>..\..\packages\PropertyChanged.Fody.2.6.1\lib\net452\PropertyChanged.dll</HintPath>
......
......@@ -162,11 +162,12 @@
</Style>
<local:PgBlowingViewModel_UnitTest x:Key="viewModel"/>
<local:BlowingDetect_UnitTest x:Key="bDetect" Direction="BACKWARD" FilmVelocity="1.2" Is3D="True"/>
</ResourceDictionary>
</Page.Resources>
<Grid >
<Grid x:Name="grid_bDetect"/>
<Grid x:Name="grid_bDetect" d:DataContext="{StaticResource bDetect}"/>
<Grid x:Name="grid_blowing"/>
<Grid x:Name="grid_viewModel" d:DataContext="{StaticResource viewModel}"/>
<Grid >
......@@ -174,7 +175,7 @@
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Background="{StaticResource Background_Title}">
<Button Style="{StaticResource ButtonStyle_back2}" Command="BrowseBack"/>
<Button Style="{StaticResource ButtonStyle_back2}" Click="BackButtonClick" Command="BrowseBack"/>
<TextBlock Style="{StaticResource TextBlockStyle_Title}" Text="吹膜测厚"/>
</StackPanel>
</Grid>
......@@ -224,12 +225,17 @@
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeader}" Text="旋转方向" />
<StackPanel Orientation="Horizontal">
<Grid>
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}" Text="正"
Visibility="{Binding Direction, Mode=OneWay,
Converter={StaticResource e2visconv}, ConverterParameter={x:Static misc:DIRECTION.FORWARD}}" />
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}" Text="反"
Visibility="{Binding Direction, Mode=OneWay,
Converter={StaticResource e2visconv}, ConverterParameter={x:Static misc:DIRECTION.BACKWARD}}" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent}" Text="正"
Visibility="{
Binding Direction ,
Converter={StaticResource e2visconv},
ConverterParameter={x:Static misc:DIRECTION.FORWARD}}"/>
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent}" Text="反"
Visibility="{
Binding Direction ,
Converter={StaticResource e2visconv},
ConverterParameter={x:Static misc:DIRECTION.BACKWARD}}"/>
</Grid>
</StackPanel>
</StackPanel>
......@@ -262,9 +268,12 @@
</Button>
<StackPanel Orientation="Vertical" Grid.Column="1">
<WrapPanel Orientation="Horizontal">
<StackPanel Orientation="Vertical" Margin="5" DataContext="{Binding DataContext, ElementName=grid_bDetect}">
<WrapPanel Orientation="Horizontal" DataContext="{Binding DataContext, ElementName=grid_bDetect}">
<StackPanel Orientation="Vertical" Margin="5" >
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="立式旋转" />
<ToggleButton Style="{StaticResource ToggleButtonStyle1}" HorizontalAlignment="Left" IsChecked="{Binding Is3D}"/>
</StackPanel>
<StackPanel Orientation="Vertical" Margin="5" >
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeader}" Text="1分区对应距离" />
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="≈" HorizontalAlignment="Left"/>
......@@ -280,11 +289,11 @@
<TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="m" HorizontalAlignment="Left"/>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" DataContext="{Binding DataContext, ElementName=grid_bDetect}">
<StackPanel Orientation="Horizontal" >
<StackPanel Orientation="Vertical" Margin="5">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="膜距离" />
<StackPanel Orientation="Horizontal">
<TextBox HorizontalAlignment="Left" MaxWidth="150" Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding FilmLength}" />
<TextBox HorizontalAlignment="Left" MaxWidth="150" Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding FilmLength,StringFormat={}{0:F1}}" />
<TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="m" />
</StackPanel>
</StackPanel>
......@@ -586,7 +595,7 @@
</StackPanel>
</Grid>
<GroupBox Grid.Column="1" Header="信号列表" DataContext="{Binding ElementName=grid_viewModel,Path=DataContext}">
<GroupBox Grid.Column="1" Header="信号列表" DataContext="{Binding ElementName=grid_viewModel,Path=DataContext}" Style="{x:Null}">
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
......
......@@ -19,6 +19,7 @@ using ThickTcpUiInWindow;
using System.ComponentModel;
using FLY.Thick.Blowing.IService;
using System.Collections.ObjectModel;
using FObjBase;
namespace FLY.Thick.Blowing.UI.Fix.Client
{
......@@ -41,6 +42,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
this.grid_blowing.DataContext = viewModel.mRenZiJiaService;
this.grid_bDetect.DataContext = viewModel.mBDetect;
this.grid_viewModel.DataContext = viewModel;
}
......@@ -53,7 +55,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
private void Page_Unloaded(object sender, RoutedEventArgs e)
{
viewModel.Dispose();
//viewModel.Dispose();
}
......@@ -66,7 +68,7 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
{
//TODO
PgBlowingExt p = new PgBlowingExt();
p.Init();// (serverep);
p.Init(viewModel.mRenZiJiaService, viewModel.mBDetect);
NavigationService.Navigate(p);
}
......@@ -76,6 +78,11 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
// return;
viewModel.Download();
}
private void BackButtonClick(object sender, RoutedEventArgs e)
{
viewModel.Dispose();
}
}
public class PgBlowingViewModel : INotifyPropertyChanged
......@@ -308,4 +315,177 @@ namespace FLY.Thick.Blowing.UI.Fix.Client
throw new NotImplementedException();
}
}
/// <summary>
/// 旋转架及膜位置检测模拟
/// </summary>
public class BlowingDetect_UnitTest : INotifyPropertyChanged
{
#region 参数
/// <summary>
/// 离开限位 到 撞下一个限位 的 旋转架转动总角度 单位°
/// </summary>
public double RAngle { get; set; }
/// <summary>
/// 人字架 旋转1周 设置 时间。
/// 刚开机时,RenZiJiaPeriod = DefaultRPeriod;
/// 异常时,RenZiJiaPeriod = DefaultRPeriod;
/// </summary>
public TimeSpan DefaultRPeriod { get; set; }
/// <summary>
/// 加速减速时间, 默认1s 加速减速时间 * 2 +正反转冷却时间 = 撞限位 到 离开限位 的时间
/// </summary>
public TimeSpan AccDecTime { get; set; }
/// <summary>
/// 信号0 撞2次。 这个能自动设置。 两个撞同一信号 间隔30秒内,算一个换向信号。
/// 当为2次撞时: StartTime = 第1次撞的StartTime, EndTime = 第2次撞的EndTime
/// </summary>
public bool IsSign0Double { get; set; }
/// <summary>
/// 信号1 撞2次。 这个能自动设置。 两个撞同一信号 间隔30秒内,算一个换向信号。
/// 当为2次撞时: StartTime = 第1次撞的StartTime, EndTime = 第2次撞的EndTime
/// </summary>
public bool IsSign1Double { get; set; }
/// <summary>
/// 信号模式, 短信号模式(只撞一下),长信号模式(只要是转着,信号就长亮,直到换向)
/// </summary>
public BlowingSignType SignType { get; set; }
/// <summary>
/// 撞限位 到 离开限位 的时间, 需要初始值,以后测量出来的
/// </summary>
public TimeSpan LimitSignTime { get; set; }
/// <summary>
/// 人字架到测厚仪膜长 单位m
/// 当旋转架为立式时, 膜长为人字架复位时,的最短膜距离
/// </summary>
public double FilmLength { get; set; }
/// <summary>
/// 辊周长,单位mm
/// </summary>
public double RollPerimeter { get; set; }
/// <summary>
/// 转向信号100ms 滤波
/// </summary>
public bool IsSignFilter { get; set; }
/// <summary>
/// 缺少信号模式
/// 正反信号线接得不好,有时候会丢失了。
/// 当前的旋转时间是上一次的1.1倍时,在以前的位置增加信号!!!!
/// 当有连续两次相同的信号,且信号差刚好是旋转时间的1.9~2.1倍时,证明真的是缺少信号
/// </summary>
public bool IsLackSignMode { get; set; }
/// <summary>
/// 旋转架为立式,测厚仪安装在二牵引前面,膜距离 与 旋转角度 一起变化, 旋转角度越大 膜距离越大
/// </summary>
public bool Is3D { get; set; }
#endregion
#region 状态
/// <summary>
/// 当前旋转架旋转角度
/// </summary>
public double Angle { get; set; }
/// <summary>
/// 当前方向
/// </summary>
public Misc.DIRECTION Direction { get; set; }
/// <summary>
/// 旋转次数
/// </summary>
public int RotationCnt { get; set; }
/// <summary>
/// 最新的限位信号序号
/// </summary>
public int LastLimitNo { get; set; }
/// <summary>
/// 最后一次撞限位,或离开限位信号 到当前已经消耗的时间
/// </summary>
public TimeSpan PastTime { get; set; }
/// <summary>
/// 当前线速度,单位 m/min
/// </summary>
public double FilmVelocity { get; set; }
/// <summary>
/// 离开限位 到 撞下一个限位 的 旋转架转动时间, 需要初始值,以后测量出来的
/// </summary>
public TimeSpan RenZiJiaPeriod { get; set; }
/// <summary>
/// 正反转冷却时间, 加速减速时间 * 2 +正反转冷却时间 = 撞限位 到 离开限位 的时间
/// </summary>
public TimeSpan SwapCoolTime { get; set; }
/// <summary>
/// 缓冲区拥有数据的时间长度,1s更新一次
/// </summary>
public TimeSpan BufTotalTime { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
#endregion
#region 功能
/// <summary>
/// 参数应用
/// </summary>
public void Apply() { }
/// <summary>
/// 获取 信号列表
/// </summary>
/// <param name="AsyncDelegate">retdata = GetBufListReponse</param>
/// <param name="AsyncState"></param>
public void GetSignList(AsyncCBHandler AsyncDelegate, object AsyncState) { }
/// <summary>
/// 获取 辊信号列表
/// </summary>
/// <param name="begin">开始时间</param>
/// <param name="AsyncDelegate">retdata = GetRollListReponse</param>
/// <param name="AsyncState"></param>
public void GetRollList(DateTime begin, AsyncCBHandler AsyncDelegate, object AsyncState) { }
/// <summary>
/// 获取 转向信号列表
/// </summary>
/// <param name="begin">开始时间</param>
/// <param name="AsyncDelegate">retdata = GetRollListReponse</param>
/// <param name="AsyncState"></param>
public void GetLimitList(DateTime begin, AsyncCBHandler AsyncDelegate, object AsyncState) { }
/// <summary>
/// 获取 立式旋转架 的 膜距离增量
/// </summary>
/// <param name="AsyncDelegate">retdata = GetFilmLength3DReponse</param>
/// <param name="AsyncState"></param>
public void GetFilmLength3D(AsyncCBHandler AsyncDelegate, object AsyncState) { }
/// <summary>
/// 设置 立式旋转架 的 膜距离增量
/// </summary>
/// <param name="data"></param>
public void SetFilmLength3D(List<double> data) { }
#endregion
}
}
......@@ -147,6 +147,10 @@ namespace FLY.Thick.Blowing.Client
/// </summary>
public TimeSpan SwapCoolTime { get; private set; }
/// <summary>
/// 缓冲区拥有数据的时间长度,1s更新一次
/// </summary>
public TimeSpan BufTotalTime { get; private set; }
#endregion
#endregion
......@@ -204,14 +208,14 @@ namespace FLY.Thick.Blowing.Client
/// <summary>
/// 获取 转向信号列表
/// </summary>
/// <param name="count">数量</param>
/// <param name="begin">开始时间</param>
/// <param name="AsyncDelegate">retdata = GetRollListReponse</param>
/// <param name="AsyncState"></param>
public void GetLimitList(int count, AsyncCBHandler AsyncDelegate, object AsyncState)
public void GetLimitList(DateTime begin, AsyncCBHandler AsyncDelegate, object AsyncState)
{
string json = Newtonsoft.Json.JsonConvert.SerializeObject(new GetLimitListRequest()
{
count = count
begin = begin
});
CurrObjSys.CallFunctionEx(mConn, mServerID, ID,
......@@ -335,6 +339,7 @@ namespace FLY.Thick.Blowing.Client
Direction = p.direction;
RenZiJiaPeriod = p.period;
SwapCoolTime = p.swapCoolTime;
BufTotalTime = p.BufTotalTime;
}
break;
}
......
......@@ -127,6 +127,10 @@ namespace FLY.Thick.Blowing.IService
/// </summary>
TimeSpan SwapCoolTime { get; }
/// <summary>
/// 缓冲区拥有数据的时间长度,1s更新一次
/// </summary>
TimeSpan BufTotalTime { get; }
#endregion
#region 功能
......@@ -153,10 +157,10 @@ namespace FLY.Thick.Blowing.IService
/// <summary>
/// 获取 转向信号列表
/// </summary>
/// <param name="count">数量</param>
/// <param name="begin">开始时间</param>
/// <param name="AsyncDelegate">retdata = GetRollListReponse</param>
/// <param name="AsyncState"></param>
void GetLimitList(int count, AsyncCBHandler AsyncDelegate, object AsyncState);
void GetLimitList(DateTime begin, AsyncCBHandler AsyncDelegate, object AsyncState);
/// <summary>
/// 获取 立式旋转架 的 膜距离增量
......@@ -339,10 +343,7 @@ namespace FLY.Thick.Blowing.IService
/// </summary>
public class GetLimitListRequest
{
/// <summary>
/// 数量
/// </summary>
public int count;
public DateTime begin;
}
/// <summary>
......
......@@ -124,7 +124,7 @@ namespace FLY.Thick.Blowing.IService
public override string ToString()
{
string t = Time.Minute.ToString() + ":" + (Time.Second + Time.Millisecond / 1000.0).ToString("N4");
string t = $"{Time:mm:ss.fff}";
string json = "";
foreach (double d in Angles)
{
......@@ -132,9 +132,9 @@ namespace FLY.Thick.Blowing.IService
{
json += ",";
}
json += d.ToString("F1");
json += $"{d:F1}°";
}
return t + " Angles=[" + json + "]";
return $"{Time:mm:ss.fff} [{json}] {Velocity:F1}m/min ({(Direction== Misc.DIRECTION.FORWARD?"正":"反")}){RotationCnt}{(InCV?"cv":"")}";
}
public ADCell Clone()
{
......@@ -156,7 +156,7 @@ namespace FLY.Thick.Blowing.IService
/// <summary>
///
/// </summary>
public int ad;
public int thick;
}
public class GetADListRequest
......
......@@ -94,6 +94,7 @@ namespace FLY.Thick.Blowing.OBJ_INTERFACE
/// </summary>
public TimeSpan period;
public TimeSpan swapCoolTime;
public TimeSpan BufTotalTime;
}
#endregion
......
......@@ -127,7 +127,7 @@ namespace FLY.Thick.Blowing.Server.OBJProxy
string json2 = Misc.Converter.BytesToString(infodata);
var p = JsonConvert.DeserializeObject<GetLimitListRequest>(json2);
mRenZiJia.GetLimitList(p.count,
mRenZiJia.GetLimitList(p.begin,
new AsyncCBHandler(delegate (object AsyncState, object retdata)
{
ConnContext context = (ConnContext)AsyncState;
......@@ -209,7 +209,8 @@ namespace FLY.Thick.Blowing.Server.OBJProxy
direction = mRenZiJia.Direction,
angle = mRenZiJia.Angle,
period = mRenZiJia.RenZiJiaPeriod,
swapCoolTime = mRenZiJia.SwapCoolTime
swapCoolTime = mRenZiJia.SwapCoolTime,
BufTotalTime = mRenZiJia.BufTotalTime
};
string json = Newtonsoft.Json.JsonConvert.SerializeObject(p);
infodata = Misc.Converter.StringToBytes(json);
......
......@@ -172,6 +172,10 @@ namespace FLY.Thick.Blowing.Server
/// </summary>
public TimeSpan SwapCoolTime { get; set; }
/// <summary>
/// 缓冲区拥有数据的时间长度,1s更新一次
/// </summary>
public TimeSpan BufTotalTime { get; set; }
#endregion
#region 信号列表
......@@ -1171,6 +1175,7 @@ namespace FLY.Thick.Blowing.Server
{
FilmVelocity = RollPerimeter / 1000.0 / ts_now.TotalMinutes;
}
BufTotalTime = DateTime.Now - mRollList[0].dt;
}
}
/// <summary>
......@@ -1276,6 +1281,7 @@ namespace FLY.Thick.Blowing.Server
RenZiJiaPeriod = DefaultRPeriod;
LimitSignTime = TimeSpan.FromSeconds(4);
BufTotalTime = TimeSpan.Zero;
ClearEvent?.Invoke(this);
}
......@@ -2202,7 +2208,11 @@ namespace FLY.Thick.Blowing.Server
/// <param name="AsyncState"></param>
public void GetFilmLength3D(AsyncCBHandler AsyncDelegate, object AsyncState)
{
throw new NotImplementedException();
GetFilmLength3DReponse p = new GetFilmLength3DReponse();
p.datas = mFilmLength3D;
AsyncDelegate(AsyncState, p);
}
/// <summary>
......@@ -2247,21 +2257,17 @@ namespace FLY.Thick.Blowing.Server
/// <summary>
/// 获取 转向信号列表
/// </summary>
/// <param name="count">数量</param>
/// <param name="begin">开始时间</param>
/// <param name="AsyncDelegate">retdata = GetRollListReponse</param>
/// <param name="AsyncState"></param>
public void GetLimitList(int count, AsyncCBHandler AsyncDelegate, object AsyncState)
public void GetLimitList(DateTime begin, AsyncCBHandler AsyncDelegate, object AsyncState)
{
var p = new GetLimitListReponse();
if (count > mLimitList.Count())
{
count = mLimitList.Count();
}
if (count > 0)
p.datas = mLimitList.FindAll(r =>
{
p.datas = mLimitList.Skip(mLimitList.Count() - count).ToList();
}
return (r.dt_begin >= begin)||(r.dt_end >= begin);
} );
AsyncDelegate(AsyncState, p);
}
}
......
......@@ -1917,7 +1917,8 @@ namespace FLY.Thick.Blowing.Server
{
var p = new GetADListReponse
{
datas = mADList.FindAll(a => a.Time >= begin).Select(a => new ADSingle() { dt = a.Time, ad = a.Ad }).ToList()
datas = mADList.FindAll(a => a.Time >= begin).Select(a => new ADSingle() { dt = a.Time,
thick = AD2Thick(a.Ad) }).ToList()
};
AsyncDelegate(AsyncState, p);
......
......@@ -115,23 +115,23 @@
<Resource Include="hourglass.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Project.FLY.AppHelper\FLY.AppHelper\FLY.AppHelper.csproj">
<ProjectReference Include="..\..\thick_public\Project.FLY.AppHelper\FLY.AppHelper\FLY.AppHelper.csproj">
<Project>{9c46d98f-6500-490b-9e56-c89dfffa05f8}</Project>
<Name>FLY.AppHelper</Name>
</ProjectReference>
<ProjectReference Include="..\..\Project.FLY.FObjSys\FObjSys\FObjBase.csproj">
<ProjectReference Include="..\..\thick_public\Project.FLY.FObjSys\FObjSys\FObjBase.csproj">
<Project>{abfe87d4-b692-4ae9-a8c0-1f470b8acbb8}</Project>
<Name>FObjBase</Name>
</ProjectReference>
<ProjectReference Include="..\..\Project.FLY.Misc\MISC\Misc.csproj">
<ProjectReference Include="..\..\thick_public\Project.FLY.Misc\MISC\Misc.csproj">
<Project>{5ee61ac6-5269-4f0f-b8fa-4334fe4a678f}</Project>
<Name>Misc</Name>
</ProjectReference>
<ProjectReference Include="..\..\Project.FLY.ModbusMapper\FLY.ModbusMapper\FLY.ModbusMapper.csproj">
<ProjectReference Include="..\..\thick_public\Project.FLY.ModbusMapper\FLY.ModbusMapper\FLY.ModbusMapper.csproj">
<Project>{6d4b9bda-2a66-4583-b244-758bc4213d9f}</Project>
<Name>FLY.ModbusMapper</Name>
</ProjectReference>
<ProjectReference Include="..\..\Project.FLY.OBJComponents\OBJComponents\OBJComponents.csproj">
<ProjectReference Include="..\..\thick_public\Project.FLY.OBJComponents\OBJComponents\OBJComponents.csproj">
<Project>{a539505d-9ac0-426b-a9a0-197df50598b0}</Project>
<Name>OBJComponents</Name>
</ProjectReference>
......
......@@ -107,23 +107,23 @@
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Project.FLY.AppHelper\FLY.AppHelper\FLY.AppHelper.csproj">
<ProjectReference Include="..\..\thick_public\Project.FLY.AppHelper\FLY.AppHelper\FLY.AppHelper.csproj">
<Project>{9c46d98f-6500-490b-9e56-c89dfffa05f8}</Project>
<Name>FLY.AppHelper</Name>
</ProjectReference>
<ProjectReference Include="..\..\Project.FLY.FObjSys\FObjSys\FObjBase.csproj">
<ProjectReference Include="..\..\thick_public\Project.FLY.FObjSys\FObjSys\FObjBase.csproj">
<Project>{abfe87d4-b692-4ae9-a8c0-1f470b8acbb8}</Project>
<Name>FObjBase</Name>
</ProjectReference>
<ProjectReference Include="..\..\Project.FLY.Misc\MISC\Misc.csproj">
<ProjectReference Include="..\..\thick_public\Project.FLY.Misc\MISC\Misc.csproj">
<Project>{5ee61ac6-5269-4f0f-b8fa-4334fe4a678f}</Project>
<Name>Misc</Name>
</ProjectReference>
<ProjectReference Include="..\..\Project.FLY.ModbusMapper\FLY.ModbusMapper\FLY.ModbusMapper.csproj">
<ProjectReference Include="..\..\thick_public\Project.FLY.ModbusMapper\FLY.ModbusMapper\FLY.ModbusMapper.csproj">
<Project>{6d4b9bda-2a66-4583-b244-758bc4213d9f}</Project>
<Name>FLY.ModbusMapper</Name>
</ProjectReference>
<ProjectReference Include="..\..\Project.FLY.OBJComponents\OBJComponents\OBJComponents.csproj">
<ProjectReference Include="..\..\thick_public\Project.FLY.OBJComponents\OBJComponents\OBJComponents.csproj">
<Project>{a539505d-9ac0-426b-a9a0-197df50598b0}</Project>
<Name>OBJComponents</Name>
</ProjectReference>
......
......@@ -193,6 +193,7 @@
<Setter Property="FontSize" Value="30" />
<Setter Property="FontFamily" Value="Microsoft Sans Serif" />
<Setter Property="TextAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Bottom"/>
</Style>
<Style TargetType="TextBox" x:Key="TextBoxStyle_FieldContent" BasedOn="{StaticResource ResourceKey=TextBoxStyle1}">
<Setter Property="Margin" Value="3" />
......
......@@ -269,6 +269,63 @@ namespace Misc
return 0;
}
/// <summary>
/// 求相关性
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
public static double Correl(IEnumerable<double> x, IEnumerable<double> y)
{
return Correl(x, 0, y, 0, x.Count());
}
/// <summary>
/// 求相关性
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <returns></returns>
public static double Correl(IEnumerable<double> x, int x_offset, IEnumerable<double> y, int y_offset, int len)
{
double sum_x = 0;
double sum_y = 0;
double sum_x2 = 0;
double sum_y2 = 0;
double sum_xy = 0;
int cnt = 0;
////避免溢出
//int max_x = Max(x, x_offset, x_offset + len - 1);
//if (max_x > 30000)
//{
//}
for (int i = 0; i < len; i++)
{
int x_i = i + x_offset;
int y_i = i + y_offset;
double xv = x.ElementAt(x_i);
double yv = y.ElementAt(y_i);
if ((!double.IsNaN(xv)) && (!double.IsNaN(yv)))
{
sum_x += xv;
sum_y += yv;
sum_x2 += xv * xv;
sum_y2 += yv * yv;
sum_xy += xv * yv;
cnt++;
}
}
if (cnt > 0)
{
double s1 = cnt * sum_xy - sum_x * sum_y;
double s2 = Math.Sqrt(cnt * sum_x2 - sum_x * sum_x);
double s3 = Math.Sqrt(cnt * sum_y2 - sum_y * sum_y);
double s4 = s1 / s2 / s3;
return s4;
}
else
return 0;
}
/// <summary>
/// 求相关性
/// </summary>
......
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