Commit 715ebee6 authored by 潘栩锋's avatar 潘栩锋 🚴

修复 电脑算AD盒的速度写错了,没有 使用double,都被取整了

修复 AD盒设置界面,RunToCmd 写错为RuntoCmd, 导致无效果
删除 样品取样 GetSample 删除 Interval,Timer
修复 边界查找,第1次正向扫描时,边界显示很大,因为忘记-探头半径了
优化 FLY.Thick.Base/Server/GM_ScanMotion 运行逻辑 修改为 归0取样阶段 与正常扫描阶段, 归0间隔为 min
parent 5fb77f45
......@@ -73,7 +73,7 @@ namespace FlyADBase
() =>
{
//速度是错了,需要自己计算
double scale = 1000 / sw_calSpeed.ElapsedMilliseconds;
double scale = 1000.0 / sw_calSpeed.ElapsedMilliseconds;
sw_calSpeed.Restart();
......
......@@ -137,7 +137,7 @@
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Content="运行至" Command="{Binding RuntoCmd}" />
<Button Content="运行至" Command="{Binding RunToCmd}" />
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="目标位置" />
<StackPanel Orientation="Horizontal">
......
......@@ -238,7 +238,6 @@ namespace FLY.Thick.Base.UI
this.getSampleService.Enable = this.Enable;
this.getSampleService.Interval = this.Interval;
this.getSampleService.Range = this.Range;
this.getSampleService.Velocity = this.Velocity;
this.getSampleService.Window = this.Window;
......@@ -301,7 +300,6 @@ namespace FLY.Thick.Base.UI
Enable = true;
Interval = 20;
Samples[0].Enable = true;
Features[0].Enable = true;
......@@ -315,10 +313,6 @@ namespace FLY.Thick.Base.UI
/// </summary>
public bool Enable { get; set; }
/// <summary>
/// 参数:间隔
/// </summary>
public int Interval { get; set; }
/// <summary>
/// 参数:速度
......
......@@ -27,18 +27,6 @@ namespace FLY.Thick.Base.Client
[JsonProperty]
public bool Enable { get; set; }
/// <summary>
/// 参数:间隔
/// </summary>
[JsonProperty]
public int Interval { get; set; }
/// <summary>
/// 采样计数
/// </summary>
[JsonProperty]
public int Timer { get; set; }
/// <summary>
/// 参数:速度
/// </summary>
......@@ -107,7 +95,6 @@ namespace FLY.Thick.Base.Client
GETSAMPLE_OBJ_INTERFACE.Pack_Params p = new GETSAMPLE_OBJ_INTERFACE.Pack_Params
{
enable = Enable,
interval = Interval,
velocity = Velocity,
range = Range,
window = Window,
......@@ -189,7 +176,6 @@ namespace FLY.Thick.Base.Client
Enable = p.enable;
Interval = p.interval;
Range = p.range;
Velocity = p.velocity;
Window = p.window;
......
......@@ -20,10 +20,7 @@ namespace FLY.Thick.Base.IService
/// </summary>
bool Enable { get; set; }
/// <summary>
/// 参数:间隔
/// </summary>
int Interval { get; set; }
/// <summary>
/// 参数:速度
......
......@@ -27,7 +27,6 @@ namespace FLY.Thick.Base.OBJ_INTERFACE
public class Pack_Params
{
public bool enable;
public int interval;
public UInt32 velocity;
public int range;
public int window;
......
......@@ -30,20 +30,12 @@ namespace FLY.Thick.Base.Server.OBJProxy
this.AD2Thick = AD2Thick;
mFlyAD.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(mFlyAD_PropertyChanged);
}
static string[] propertyname_params = new string[] {
"LocalEP","HasCRC","GridSmooth","IsCalSpeed","PosOfGrid","PosLen","MotorType","Ratio01","Ratio02","PosOffset","JogVelocity"
};
void mFlyAD_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if ((e.PropertyName == "LocalEP") ||
(e.PropertyName == "HasCRC") ||
(e.PropertyName == "GridSmooth") ||
(e.PropertyName == "IsCalSpeed") ||
(e.PropertyName == "PosOfGrid") ||
(e.PropertyName == "PosLen") ||
(e.PropertyName == "MotorType") ||
(e.PropertyName == "Ratio01") ||
(e.PropertyName == "Ratio02") ||
(e.PropertyName == "PosOffset") ||
(e.PropertyName == "JogVelocity"))
if (propertyname_params.Contains(e.PropertyName))
{
FObjBase.PollModule.Current.Poll_JustOnce(
new PollModule.PollHandler(delegate()
......
......@@ -120,7 +120,6 @@ namespace FLY.Thick.Base.Server.OBJProxy
GETSAMPLE_OBJ_INTERFACE.Pack_Params p = new GETSAMPLE_OBJ_INTERFACE.Pack_Params()
{
enable = mGetSampleService.Enable,
interval = mGetSampleService.Interval,
range = mGetSampleService.Range,
velocity = mGetSampleService.Velocity,
window = mGetSampleService.Window,
......@@ -192,7 +191,6 @@ namespace FLY.Thick.Base.Server.OBJProxy
var p = Newtonsoft.Json.JsonConvert.DeserializeObject<GETSAMPLE_OBJ_INTERFACE.Pack_Params>(json);
mGetSampleService.Enable = p.enable;
mGetSampleService.Interval = p.interval;
mGetSampleService.Range = p.range;
mGetSampleService.Velocity = p.velocity;
mGetSampleService.Window = p.window;
......
......@@ -632,29 +632,18 @@ namespace FLY.Thick.Base.Server
border[idx].Begin = (borderbegin_grid + gridBegin) * posOfGrid;
border[idx].End = (borderend_grid +gridBegin) * posOfGrid;
if (Misc.MyBase.ISVALIDATA(border[0].Begin) && Misc.MyBase.ISVALIDATA(border[1].Begin))
if (border.All(b => b.IsValid))
{
Border.Begin = (border[0].Begin + border[1].Begin) / 2 + SensorWidth / 2;
Border.End = (border[0].End + border[1].End) / 2 - SensorWidth / 2;
Width = Border.Width;
Mid = Border.Mid;
Border.Begin = (int)(border.Average(b => b.Begin) + SensorWidth / 2.0);
Border.End = (int)(border.Average(b => b.End) - SensorWidth / 2.0);
}
else if (Misc.MyBase.ISVALIDATA(border[0].Begin))
else if (border[idx].IsValid)
{
Border.Copy(border[0]);
Width = Border.Width;
Mid = Border.Mid;
Border.Begin = border[idx].Begin + SensorWidth / 2;
Border.End = border[idx].End - SensorWidth / 2;
}
else if (Misc.MyBase.ISVALIDATA(border[1].Begin))
{
Border.Copy(border[1]);
Width = Border.Width;
Mid = Border.Mid;
}
//膜宽
return true;
}
......
......@@ -2,6 +2,7 @@
using Misc;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
......@@ -30,6 +31,7 @@ namespace FLY.Thick.Base.Server
//把数据记录下来
getViewReponse = new BorderSearchGetViewReponse()
{
direction = direction,
posOfGrid = posOfGrid,
gridBegin = gridBegin,
dat = dat
......@@ -119,30 +121,18 @@ namespace FLY.Thick.Base.Server
border[idx].Begin = (borderbegin_grid + gridBegin) * posOfGrid - SensorWidth / 2;
border[idx].End = (borderend_grid + gridBegin) * posOfGrid + SensorWidth / 2;
if (Misc.MyBase.ISVALIDATA(border[0].Begin) && Misc.MyBase.ISVALIDATA(border[1].Begin))
if (border.All(b => b.IsValid))
{
Border.Begin = (border[0].Begin + border[1].Begin) / 2 + SensorWidth / 2;
Border.End = (border[0].End + border[1].End) / 2 - SensorWidth / 2;
Width = Border.Width;
Mid = Border.Mid;
Border.Begin = (int)(border.Average(b => b.Begin) + SensorWidth / 2.0);
Border.End = (int)(border.Average(b => b.End) - SensorWidth / 2.0);
}
else if (Misc.MyBase.ISVALIDATA(border[0].Begin))
else if (border[idx].IsValid)
{
Border.Copy(border[0]);
Width = Border.Width;
Mid = Border.Mid;
Border.Begin = border[idx].Begin + SensorWidth / 2;
Border.End = border[idx].End - SensorWidth / 2;
}
else if (Misc.MyBase.ISVALIDATA(border[1].Begin))
{
Border.Copy(border[1]);
Width = Border.Width;
Mid = Border.Mid;
}
//膜宽
return true;
}
}
......
......@@ -143,7 +143,7 @@ namespace FLY.Thick.Base.Server
bool b = base.Start();
if (!b)
return false;
mFlyAD.SetPosParam(Velocity, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff);
mFlyAD.SetVelocity(Velocity);
mFlyAD.Runto(pos);
return true;
}
......@@ -170,8 +170,7 @@ namespace FLY.Thick.Base.Server
bool b = base.Start();
if (!b)
return false;
mFlyAD.SetPosParam( Velocity, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff);
mFlyAD.SetVelocity(Velocity);
mFlyAD.RuntoMax();
return true;
}
......@@ -198,7 +197,7 @@ namespace FLY.Thick.Base.Server
bool b = base.Start();
if (!b)
return false;
mFlyAD.SetPosParam(Velocity, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff);
mFlyAD.SetVelocity(Velocity);
mFlyAD.RuntoMin();
return true;
}
......
......@@ -7,6 +7,7 @@ using System.Text;
using Misc;
using FlyADBase;
using FLY.Thick.Base.Common;
using System.Diagnostics;
namespace FLY.Thick.Base.Server
{
......@@ -18,64 +19,30 @@ namespace FLY.Thick.Base.Server
{
#region 成员变量
protected GSample gsample;
int scanCnt;//扫描次数, 当为-1时,无限次扫描,>0时,有限次扫描
public int ScanCnt
{
get
{
return scanCnt;
}
set
{
if (scanCnt != value)
{
scanCnt = value;
NotifyPropertyChanged("ScanCnt");
}
}
}
int autoOriginCount;//归原点累计(多少次扫描一个归原点的累计)
/// <summary>
/// 归0开始时间点,用于计算什么时候需要归0
/// </summary>
private TimeSpan orgStartTime;
int orgInterval;//归原点间隔
public int OrgInterval
{
get { return orgInterval; }
set
{
if (orgInterval != value)
{
orgInterval = value;
NotifyPropertyChanged("OrgInterval");
}
}
}
/// <summary>
/// 使用timer.Elapsed 代替 DateTime.Now 使用
/// </summary>
private Stopwatch timer = new Stopwatch();
/// <summary>
/// 归原点间隔
/// </summary>
public int OrgInterval { get; set; }
/// <summary>
/// 扫描范围
/// </summary>
public int ScanStart { get; set; }
public int ScanEnd { get; set; }
int scanStart, scanEnd;//扫描范围
public int ScanStart
{
get { return scanStart; }
set
{
if (scanStart != value)
{
scanStart = value;
NotifyPropertyChanged("ScanStart");
}
}
}
public int ScanEnd
{
get { return scanEnd; }
set
{
if (scanEnd != value)
{
scanEnd = value;
NotifyPropertyChanged("ScanEnd");
}
}
}
public event EndEventHandler DataPosEvent;
public event EndEventHandler EndEvent;
......@@ -85,18 +52,30 @@ namespace FLY.Thick.Base.Server
enum CTRLST
{
SORIGIN = 1,//判断是否归0
SORIGINWAIT = 2,//正在归0
SFORWARD = 3,//前进到样品,或扫描结束位置
SFORWAIT_1 = 4,//前进等待
SFORWAIT_2 = 5,//前进结束,等待获取grid
SBACKWARD = 8,//后退到温修,或扫描开始位置
SBACKWAIT_1 = 9,//后退等待
SBACKWAIT_2 = 10,//后退结束,等待获取grid
SFORWAIT_SAMPLE = 11,//前进取样中
SFORW_SAMPLE = 12,//前进取样
SBACKWAIT_SAMPLE = 13,//后退取样中
SBACKW_SAMPLE = 14//后退取样
INIT = 0,//判断进入阶段
#region 0 样品采集阶段
ORIGINWAIT = 2,//正在归0
FORWARD = 3,//前进到样品,或扫描结束位置
FORWAIT_1 = 4,//前进等待
FORWAIT_2 = 5,//前进结束,等待获取grid
BACKWARD = 8,//后退到温修,或扫描开始位置
BACKWAIT_1 = 9,//后退等待
BACKWAIT_2 = 10,//后退结束,等待获取grid
FORWAIT_SAMPLE = 11,//前进取样中
FORW_SAMPLE = 12,//前进取样
BACKWAIT_SAMPLE = 13,//后退取样中
BACKW_SAMPLE = 14,//后退取样
#endregion
#region 正常扫描阶段
SCAN_FORW = 20,//前进扫描
SCAN_FORWAIT = 21,//前进等待
SCAN_BACKW = 22,//后退扫描
SCAN_BACKWAIT = 23,//后退等待
#endregion
}
CTRLST state;
#endregion
......@@ -109,19 +88,17 @@ namespace FLY.Thick.Base.Server
GMState = CTRL_STATE.SCAN;
this.gsample = gsample;
ScanCnt = -1;//无限次扫描
ScanStart = -1;
ScanEnd = -1;
state = CTRLST.SORIGIN;
flyad.MiniGridEvent += (s, e) =>
{
if ((state == CTRLST.SFORWAIT_1) || (state == CTRLST.SBACKWAIT_1))
if ((state == CTRLST.FORWAIT_1)
|| (state == CTRLST.BACKWAIT_1)
|| (state == CTRLST.SCAN_FORWAIT)
|| (state == CTRLST.SCAN_BACKWAIT))
{
if (DataPosEvent != null)
DataPosEvent(this, e);
DataPosEvent?.Invoke(this, e);
}
};
}
......@@ -131,25 +108,21 @@ namespace FLY.Thick.Base.Server
ScanStart = start;
ScanEnd = end;
autoOriginCount = 0;
state = CTRLST.SORIGIN;
if (ScanCnt >= 0)
{
OrgInterval = ScanCnt + 1;//禁止自动归原点
}
timer.Restart();
orgStartTime = TimeSpan.FromMinutes(-OrgInterval);
state = CTRLST.INIT;
if (gsample != null)
gsample.Init(ScanStart, ScanEnd);
if (StartEvent != null)
StartEvent(this, null);
StartEvent?.Invoke(this, null);
return true;
}
public override void Stop()
{
if (FinishEvent != null)
FinishEvent(this, null);
timer.Stop();
FinishEvent?.Invoke(this, null);
base.Stop();
}
bool WaitFinish(ref CTRLST src, CTRLST next)
......@@ -174,36 +147,26 @@ namespace FLY.Thick.Base.Server
{
switch (state)
{
case CTRLST.SORIGIN:
{
state = CTRLST.SFORWARD;
//if( scanCnt == -1 )
case CTRLST.INIT:
{
if (IsOrgEnable() && (autoOriginCount > 0))
autoOriginCount--;
if (IsOrging())
{
autoOriginCount = OrgInterval;
mFlyAD.Origin();
state = CTRLST.SORIGINWAIT;
break;
state = CTRLST.ORIGINWAIT;
}
else {
state = CTRLST.SCAN_FORW;
}
} break;
case CTRLST.SORIGINWAIT:
}
break;
case CTRLST.ORIGINWAIT:
{
WaitFinish(ref state, CTRLST.SFORWARD);
WaitFinish(ref state, CTRLST.FORWARD);
} break;
case CTRLST.SFORWARD:
case CTRLST.FORWARD:
{
int to = ScanEnd;
if (scanCnt == -1)
{
if (gsample != null && gsample.Check())
{
int b, e;
if (gsample.GetSampleRange(Misc.DIRECTION.FORWARD, out b, out e))
{
......@@ -220,36 +183,20 @@ namespace FLY.Thick.Base.Server
}
}
}
}
mFlyAD.SetPosParam(Velocity, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff);
mFlyAD.SetVelocity(Velocity);
mFlyAD.Runto(to);
state = CTRLST.SFORWAIT_1;
state = CTRLST.FORWAIT_1;
} break;
case CTRLST.SFORWAIT_1:
case CTRLST.FORWAIT_1:
{
if (WaitFinish(ref state, CTRLST.SFORWAIT_2))
if (WaitFinish(ref state, CTRLST.FORWAIT_2))
FlushAD(DIRECTION.FORWARD);
} break;
case CTRLST.SFORWAIT_2:
case CTRLST.FORWAIT_2:
{
state = CTRLST.SBACKWARD;
//扫描次数
if (scanCnt > 0)
scanCnt--;
if (scanCnt == 0)
{
//扫描完成
Stop(); return;
}
state = CTRLST.BACKWARD;
if (scanCnt == -1)
{
if (gsample != null && gsample.Check())
{
int b, e;
if (gsample.GetSampleRange(Misc.DIRECTION.FORWARD, out b, out e))
{
......@@ -258,34 +205,29 @@ namespace FLY.Thick.Base.Server
if (motorType == FlyADBase.MOTORTYPE.VF0)
{
//直接去到取样的位置
state = CTRLST.SFORW_SAMPLE;
state = CTRLST.FORW_SAMPLE;
}
else//要变速,分开两段
{
mFlyAD.SetPosParam((UInt32)gsample.Velocity, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff);
mFlyAD.SetVelocity(gsample.Velocity);
mFlyAD.Runto(e);
state = CTRLST.SFORWAIT_SAMPLE;
}
}
state = CTRLST.FORWAIT_SAMPLE;
}
}
} break;
case CTRLST.SFORWAIT_SAMPLE:
case CTRLST.FORWAIT_SAMPLE:
{
WaitFinish(ref state, CTRLST.SFORW_SAMPLE);
WaitFinish(ref state, CTRLST.FORW_SAMPLE);
} break;
case CTRLST.SFORW_SAMPLE:
case CTRLST.FORW_SAMPLE:
{
gsample.Do(Misc.DIRECTION.FORWARD);
state = CTRLST.SBACKWARD;
state = CTRLST.BACKWARD;
} break;
case CTRLST.SBACKWARD:
case CTRLST.BACKWARD:
{
int to = ScanStart;
if (scanCnt == -1)
{
if (gsample.Check())
{
int b, e;
if (gsample.GetSampleRange(Misc.DIRECTION.BACKWARD, out b, out e))
{
......@@ -301,33 +243,17 @@ namespace FLY.Thick.Base.Server
to = e;
}
}
}
}
mFlyAD.SetPosParam(Velocity, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff);
mFlyAD.SetVelocity(Velocity);
mFlyAD.Runto(to);
state = CTRLST.SBACKWAIT_1;
state = CTRLST.BACKWAIT_1;
} break;
case CTRLST.SBACKWAIT_1:
case CTRLST.BACKWAIT_1:
{
if (WaitFinish(ref state, CTRLST.SBACKWAIT_2))
if (WaitFinish(ref state, CTRLST.BACKWAIT_2))
FlushAD(DIRECTION.BACKWARD);
} break;
case CTRLST.SBACKWAIT_2:
{
state = CTRLST.SORIGIN;
//扫描次数
if (scanCnt > 0)
scanCnt--;
if (scanCnt == 0)
{
//扫描完成
Stop(); return;
}
if (scanCnt == -1)
{
if (gsample.Check())
case CTRLST.BACKWAIT_2:
{
int b, e;
if (gsample.GetSampleRange(Misc.DIRECTION.BACKWARD, out b, out e))
......@@ -337,35 +263,75 @@ namespace FLY.Thick.Base.Server
if (motorType == FlyADBase.MOTORTYPE.VF0)
{
//直接去到取样的位置
state = CTRLST.SBACKW_SAMPLE;
state = CTRLST.BACKW_SAMPLE;
}
else//要变速,分开两段
{
mFlyAD.SetPosParam((UInt32)gsample.Velocity, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff);
mFlyAD.SetVelocity(gsample.Velocity);
mFlyAD.Runto(b);
state = CTRLST.SBACKWAIT_SAMPLE;
}
state = CTRLST.BACKWAIT_SAMPLE;
}
}
else {
//完成一次周期
if (gsample.OK())
orgStartTime = timer.Elapsed;
state = CTRLST.INIT;
}
} break;
case CTRLST.SBACKWAIT_SAMPLE:
case CTRLST.BACKWAIT_SAMPLE:
{
WaitFinish(ref state, CTRLST.SBACKW_SAMPLE);
WaitFinish(ref state, CTRLST.BACKW_SAMPLE);
} break;
case CTRLST.SBACKW_SAMPLE:
case CTRLST.BACKW_SAMPLE:
{
gsample.Do(Misc.DIRECTION.BACKWARD);
state = CTRLST.SORIGIN;
//完成一次周期
if (gsample.OK())
orgStartTime = timer.Elapsed;
state = CTRLST.INIT;
} break;
case CTRLST.SCAN_FORW:
{
int to = ScanEnd;
mFlyAD.SetVelocity(Velocity);
mFlyAD.Runto(to);
state = CTRLST.SCAN_FORWAIT;
}
break;
case CTRLST.SCAN_FORWAIT:
{
if (WaitFinish(ref state, CTRLST.SCAN_BACKW))
FlushAD(DIRECTION.FORWARD);
}
break;
case CTRLST.SCAN_BACKW:
{
int to = ScanStart;
mFlyAD.SetVelocity(Velocity);
mFlyAD.Runto(to);
state = CTRLST.SCAN_BACKWAIT;
}
break;
case CTRLST.SCAN_BACKWAIT:
{
if (WaitFinish(ref state, CTRLST.INIT))
FlushAD(DIRECTION.BACKWARD);
}
break;
}
}
private bool IsOrging()
{
if ((autoOriginCount == 0) && (OrgInterval > 0))
if (OrgInterval > 0) {
if (timer.Elapsed >= (orgStartTime + TimeSpan.FromMinutes(OrgInterval)))
return true;
}
return false;
}
......@@ -554,8 +520,9 @@ namespace FLY.Thick.Base.Server
}break;
case CTRLST.READY_BACKW:
{
mFlyAD.SetPosParam(Velocity, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff);
mFlyAD.Runto(0);
mFlyAD.SetVelocity(Velocity);
mFlyAD.RuntoMin();
state = CTRLST.READY_BACKWAIT;
} break;
case CTRLST.READY_BACKWAIT:
......@@ -564,9 +531,8 @@ namespace FLY.Thick.Base.Server
} break;
case CTRLST.SFORWARD:
{
int to = mFlyAD.PosLen;
mFlyAD.SetPosParam(Velocity, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff);
mFlyAD.Runto(to);
mFlyAD.SetVelocity(Velocity);
mFlyAD.RuntoMax();
state = CTRLST.SFORWAIT_1;
} break;
case CTRLST.SFORWAIT_1:
......@@ -580,8 +546,8 @@ namespace FLY.Thick.Base.Server
} break;
case CTRLST.SBACKWARD:
{
mFlyAD.SetPosParam(Velocity, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff);
mFlyAD.Runto(0);
mFlyAD.SetVelocity(Velocity);
mFlyAD.RuntoMin();
state = CTRLST.SBACKWAIT_1;
} break;
case CTRLST.SBACKWAIT_1:
......
......@@ -28,18 +28,6 @@ namespace FLY.Thick.Base.Server
[JsonProperty]
public bool Enable { get; set; } = true;
/// <summary>
/// 参数:间隔
/// </summary>
[JsonProperty]
public int Interval { get; set; } = 5;
/// <summary>
/// 采样计数
/// </summary>
public int Timer { get; set; }
/// <summary>
/// 参数:速度
/// </summary>
......@@ -131,7 +119,6 @@ namespace FLY.Thick.Base.Server
Enable = true;
Interval = 5;//采样间隔
Range = 100;//样品范围
Velocity = 200;//取样速度
Window = 3;//移动窗口
......@@ -142,16 +129,16 @@ namespace FLY.Thick.Base.Server
Samples[0] = new SampleCell()
{
Enable = true,
Position = 0,
OrgAD = 0
Position = 200,
OrgAD = 50300
};
directions[0] = DIRECTION.BACKWARD;
Samples[1] = new SampleCell()
{
Enable = false,
Position = 2006,
OrgAD = 30000
Position = 0,
OrgAD = 0
};
directions[1] = DIRECTION.FORWARD;
......@@ -223,8 +210,6 @@ namespace FLY.Thick.Base.Server
sample.AD = -1;
tempFilters[i].Reset();
}
Timer = Interval;
}
/// <summary>
......@@ -239,29 +224,8 @@ namespace FLY.Thick.Base.Server
sample.AD = -1;
tempFilters[i].Reset();
}
Timer = Interval;
}
/// <summary>
/// 检测是否要样品校正
/// </summary>
/// <returns></returns>
public virtual bool Check()
{
if (!Samples.Any(s => s.Enable))
{
return false;
}
if (Timer < Interval)
{
Timer++;
return false;
}
else
{
return true;
}
}
/// <summary>
/// 获取样品测量范围
/// </summary>
......@@ -527,9 +491,7 @@ namespace FLY.Thick.Base.Server
if (isFailure)//样品获取失败,下次继续!!!
return;
//只有当所有都成功,Timer=0
if(Samples.All(s => (s.Enable && s.AD > 0) || (!s.Enable)))
Timer = 0;
}
/// <summary>
......@@ -571,11 +533,6 @@ namespace FLY.Thick.Base.Server
SampleChangedEvent?.Invoke(this);
//只有当所有都成功,Timer=0
if (Samples.All(s => (s.Enable && s.AD > 0) || (!s.Enable)))
Timer = 0;
}
/// <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