Commit 50133b5b authored by 潘栩锋's avatar 潘栩锋 🚴

还没整理 360程序

parent 12c0a20a
...@@ -302,9 +302,9 @@ namespace FLY.Thick.Blowing360.UI ...@@ -302,9 +302,9 @@ namespace FLY.Thick.Blowing360.UI
/// <returns></returns> /// <returns></returns>
double RollList_GetPosition(int idx, DateTime dt) double RollList_GetPosition(int idx, DateTime dt)
{ {
DateTime dt1 = mRollList[idx + 1].dt; DateTime dt1 = mRollList[idx + 1].Time;
double position1 = (idx + 1) * RollPerimeter; double position1 = (idx + 1) * RollPerimeter;
DateTime dt2 = mRollList[idx].dt; DateTime dt2 = mRollList[idx].Time;
double position2 = (idx) * RollPerimeter; double position2 = (idx) * RollPerimeter;
return (position1 - position2) * (dt - dt2).Ticks / (dt1 - dt2).Ticks + position2; return (position1 - position2) * (dt - dt2).Ticks / (dt1 - dt2).Ticks + position2;
...@@ -316,8 +316,8 @@ namespace FLY.Thick.Blowing360.UI ...@@ -316,8 +316,8 @@ namespace FLY.Thick.Blowing360.UI
/// <returns></returns> /// <returns></returns>
double RollList_GetVelocity(int idx) double RollList_GetVelocity(int idx)
{ {
DateTime dt1 = mRollList[idx + 1].sysTime; DateTime dt1 = mRollList[idx + 1].SysTime;
DateTime dt2 = mRollList[idx].sysTime; DateTime dt2 = mRollList[idx].SysTime;
return RollPerimeter / 1000 / dt1.Subtract(dt2).TotalMinutes; return RollPerimeter / 1000 / dt1.Subtract(dt2).TotalMinutes;
} }
...@@ -330,9 +330,9 @@ namespace FLY.Thick.Blowing360.UI ...@@ -330,9 +330,9 @@ namespace FLY.Thick.Blowing360.UI
DateTime RollList_GetDateTime(int idx, double position) DateTime RollList_GetDateTime(int idx, double position)
{ {
//TODO 经常出错,position 无限小,idx=0 //TODO 经常出错,position 无限小,idx=0
DateTime dt1 = mRollList[idx + 1].dt; DateTime dt1 = mRollList[idx + 1].Time;
double position1 = (idx + 1) * RollPerimeter; double position1 = (idx + 1) * RollPerimeter;
DateTime dt2 = mRollList[idx].dt; DateTime dt2 = mRollList[idx].Time;
double position2 = (idx) * RollPerimeter; double position2 = (idx) * RollPerimeter;
return dt2.Add(new TimeSpan((long)((dt1 - dt2).Ticks * (position - position2) / (position1 - position2)))); return dt2.Add(new TimeSpan((long)((dt1 - dt2).Ticks * (position - position2) / (position1 - position2))));
...@@ -393,7 +393,7 @@ namespace FLY.Thick.Blowing360.UI ...@@ -393,7 +393,7 @@ namespace FLY.Thick.Blowing360.UI
for (int i = mRollList.Count - 1; i >= 0; i--) for (int i = mRollList.Count - 1; i >= 0; i--)
{ {
if (dt >= mRollList[i].dt) if (dt >= mRollList[i].Time)
{ {
//找到了 //找到了
if (i == (mRollList.Count - 1))//这个是未来的时间点,还没发生!!! if (i == (mRollList.Count - 1))//这个是未来的时间点,还没发生!!!
......
...@@ -283,15 +283,15 @@ namespace FLY.Thick.Blowing360.UI ...@@ -283,15 +283,15 @@ namespace FLY.Thick.Blowing360.UI
for (int i = 0; i < mRollList.Count(); i++) for (int i = 0; i < mRollList.Count(); i++)
{ {
var sysTime_min = mRollList[i].sysTime - filter_half; var sysTime_min = mRollList[i].SysTime - filter_half;
var sysTime_max = mRollList[i].sysTime + filter_half; var sysTime_max = mRollList[i].SysTime + filter_half;
int i_begin = 0; int i_begin = 0;
int i_end = mRollList.Count() - 1; int i_end = mRollList.Count() - 1;
for (int j = i; j >= 0; j--) for (int j = i; j >= 0; j--)
{ {
if (mRollList[j].sysTime <= sysTime_min) if (mRollList[j].SysTime <= sysTime_min)
{ {
//找到了 //找到了
i_begin = j; i_begin = j;
...@@ -301,7 +301,7 @@ namespace FLY.Thick.Blowing360.UI ...@@ -301,7 +301,7 @@ namespace FLY.Thick.Blowing360.UI
for (int j = i; j < mRollList.Count(); j++) for (int j = i; j < mRollList.Count(); j++)
{ {
if (mRollList[j].sysTime >= sysTime_max) if (mRollList[j].SysTime >= sysTime_max)
{ {
//找到了 //找到了
i_end = j; i_end = j;
...@@ -320,13 +320,13 @@ namespace FLY.Thick.Blowing360.UI ...@@ -320,13 +320,13 @@ namespace FLY.Thick.Blowing360.UI
} }
} }
TimeSpan ts = mRollList[i_end].sysTime - mRollList[i_begin].sysTime; TimeSpan ts = mRollList[i_end].SysTime - mRollList[i_begin].SysTime;
double minute = 1.0 * ts.Ticks / TimeSpan.TicksPerMinute; double minute = 1.0 * ts.Ticks / TimeSpan.TicksPerMinute;
double v = (i_end - i_begin) * mCurrRDetect.RollPerimeter / 1000 / minute; double v = (i_end - i_begin) * mCurrRDetect.RollPerimeter / 1000 / minute;
VelocityValues.Add( VelocityValues.Add(
new TimeValue() new TimeValue()
{ {
Time = mRollList[i].dt, Time = mRollList[i].Time,
Value = v Value = v
}); });
} }
...@@ -757,15 +757,15 @@ namespace FLY.Thick.Blowing360.UI ...@@ -757,15 +757,15 @@ namespace FLY.Thick.Blowing360.UI
if (param.mRollList.Count() == 0) if (param.mRollList.Count() == 0)
{ {
param.mRollList.Add(new RollCell() { dt = dt }); param.mRollList.Add(new RollCell() { Time = dt });
} }
else else
{ {
while ((dt - param.mRollList.Last().dt).TotalMinutes * v > (param.RollPerimeter / 1000)) while ((dt - param.mRollList.Last().Time).TotalMinutes * v > (param.RollPerimeter / 1000))
{ {
param.mRollList.Add(new RollCell() param.mRollList.Add(new RollCell()
{ {
dt = param.mRollList.Last().dt + TimeSpan.FromMinutes((param.RollPerimeter / 1000) / v) Time = param.mRollList.Last().Time + TimeSpan.FromMinutes((param.RollPerimeter / 1000) / v)
}); });
} }
} }
......
...@@ -521,8 +521,8 @@ namespace FLY.Thick.Blowing360.Server ...@@ -521,8 +521,8 @@ namespace FLY.Thick.Blowing360.Server
mRollList.RAdd( mRollList.RAdd(
new RollCell() new RollCell()
{ {
dt = dt, Time = dt,
sysTime = sysTime SysTime = sysTime
}); });
...@@ -598,15 +598,15 @@ namespace FLY.Thick.Blowing360.Server ...@@ -598,15 +598,15 @@ namespace FLY.Thick.Blowing360.Server
{ {
if (mRollList.Count > 1) if (mRollList.Count > 1)
{ {
DateTime sysTime1 = mRollList[mRollList.Count - 1].sysTime; DateTime sysTime1 = mRollList[mRollList.Count - 1].SysTime;
int cnt = 5; int cnt = 5;
if (cnt > mRollList.Count) if (cnt > mRollList.Count)
cnt = mRollList.Count; cnt = mRollList.Count;
DateTime sysTime2 = mRollList[mRollList.Count - cnt].sysTime; DateTime sysTime2 = mRollList[mRollList.Count - cnt].SysTime;
TimeSpan ts_last = TimeSpan.FromTicks((sysTime1 - sysTime2).Ticks / (cnt - 1));//5次的平均滤波, 使用AD盒的时间算出来的时间差,最准 TimeSpan ts_last = TimeSpan.FromTicks((sysTime1 - sysTime2).Ticks / (cnt - 1));//5次的平均滤波, 使用AD盒的时间算出来的时间差,最准
DateTime sysTime11 = mRollList[mRollList.Count - (cnt - 1)].sysTime; DateTime sysTime11 = mRollList[mRollList.Count - (cnt - 1)].SysTime;
//因为没有使用AD盒的时间,所以可以用DateTime.Now 比较 //因为没有使用AD盒的时间,所以可以用DateTime.Now 比较
...@@ -624,7 +624,7 @@ namespace FLY.Thick.Blowing360.Server ...@@ -624,7 +624,7 @@ namespace FLY.Thick.Blowing360.Server
FilmVelocity = RollPerimeter / 1000.0 / ts_max.TotalMinutes; FilmVelocity = RollPerimeter / 1000.0 / ts_max.TotalMinutes;
BufTotalTime = DateTime.Now - mRollList[0].dt; BufTotalTime = DateTime.Now - mRollList[0].Time;
} }
} }
/// <summary> /// <summary>
...@@ -634,7 +634,7 @@ namespace FLY.Thick.Blowing360.Server ...@@ -634,7 +634,7 @@ namespace FLY.Thick.Blowing360.Server
{ {
if (mRollList.Count > 0) if (mRollList.Count > 0)
{ {
DateTime dt = mRollList[mRollList.Count - 1].dt; DateTime dt = mRollList[mRollList.Count - 1].Time;
TimeSpan ts = DateTime.Now - dt; TimeSpan ts = DateTime.Now - dt;
if (ts.TotalMinutes > 1)//1min if (ts.TotalMinutes > 1)//1min
{ {
...@@ -975,9 +975,9 @@ namespace FLY.Thick.Blowing360.Server ...@@ -975,9 +975,9 @@ namespace FLY.Thick.Blowing360.Server
/// <returns></returns> /// <returns></returns>
double RollList_GetPosition(int idx, DateTime dt) double RollList_GetPosition(int idx, DateTime dt)
{ {
DateTime dt1 = mRollList[idx + 1].dt; DateTime dt1 = mRollList[idx + 1].Time;
double position1 = (idx + 1) * RollPerimeter; double position1 = (idx + 1) * RollPerimeter;
DateTime dt2 = mRollList[idx].dt; DateTime dt2 = mRollList[idx].Time;
double position2 = (idx) * RollPerimeter; double position2 = (idx) * RollPerimeter;
return (position1 - position2) * (dt - dt2).Ticks / (dt1 - dt2).Ticks + position2; return (position1 - position2) * (dt - dt2).Ticks / (dt1 - dt2).Ticks + position2;
...@@ -989,8 +989,8 @@ namespace FLY.Thick.Blowing360.Server ...@@ -989,8 +989,8 @@ namespace FLY.Thick.Blowing360.Server
/// <returns></returns> /// <returns></returns>
double RollList_GetVelocity(int idx) double RollList_GetVelocity(int idx)
{ {
DateTime dt1 = mRollList[idx + 1].sysTime; DateTime dt1 = mRollList[idx + 1].SysTime;
DateTime dt2 = mRollList[idx].sysTime; DateTime dt2 = mRollList[idx].SysTime;
return RollPerimeter / 1000 / dt1.Subtract(dt2).TotalMinutes; return RollPerimeter / 1000 / dt1.Subtract(dt2).TotalMinutes;
} }
...@@ -1003,9 +1003,9 @@ namespace FLY.Thick.Blowing360.Server ...@@ -1003,9 +1003,9 @@ namespace FLY.Thick.Blowing360.Server
DateTime RollList_GetDateTime(int idx, double position) DateTime RollList_GetDateTime(int idx, double position)
{ {
//TODO 经常出错,position 无限小,idx=0 //TODO 经常出错,position 无限小,idx=0
DateTime dt1 = mRollList[idx + 1].dt; DateTime dt1 = mRollList[idx + 1].Time;
double position1 = (idx + 1) * RollPerimeter; double position1 = (idx + 1) * RollPerimeter;
DateTime dt2 = mRollList[idx].dt; DateTime dt2 = mRollList[idx].Time;
double position2 = (idx) * RollPerimeter; double position2 = (idx) * RollPerimeter;
return dt2.Add(new TimeSpan((long)((dt1 - dt2).Ticks * (position - position2) / (position1 - position2)))); return dt2.Add(new TimeSpan((long)((dt1 - dt2).Ticks * (position - position2) / (position1 - position2))));
...@@ -1066,7 +1066,7 @@ namespace FLY.Thick.Blowing360.Server ...@@ -1066,7 +1066,7 @@ namespace FLY.Thick.Blowing360.Server
for (int i = mRollList.Count - 1; i >= 0; i--) for (int i = mRollList.Count - 1; i >= 0; i--)
{ {
if (dt >= mRollList[i].dt) if (dt >= mRollList[i].Time)
{ {
//找到了 //找到了
if (i == (mRollList.Count - 1))//这个是未来的时间点,还没发生!!! if (i == (mRollList.Count - 1))//这个是未来的时间点,还没发生!!!
...@@ -1327,7 +1327,7 @@ namespace FLY.Thick.Blowing360.Server ...@@ -1327,7 +1327,7 @@ namespace FLY.Thick.Blowing360.Server
{ {
var p = new GetRollListReponse(); var p = new GetRollListReponse();
p.datas = mRollList.FindAll(r => r.dt >= begin); p.datas = mRollList.FindAll(r => r.Time >= begin);
asyncDelegate(asyncContext, p); asyncDelegate(asyncContext, p);
} }
......
...@@ -330,8 +330,8 @@ namespace FLY.Thick.Blowing360.Server ...@@ -330,8 +330,8 @@ namespace FLY.Thick.Blowing360.Server
mRollList.RAdd( mRollList.RAdd(
new RollCell() new RollCell()
{ {
dt = dt, Time = dt,
sysTime = sysTime SysTime = sysTime
}); });
} }
} }
...@@ -612,15 +612,15 @@ namespace FLY.Thick.Blowing360.Server ...@@ -612,15 +612,15 @@ namespace FLY.Thick.Blowing360.Server
//更新当前速度 //更新当前速度
if (lastRollTime != mRollList.Last().dt) if (lastRollTime != mRollList.Last().Time)
{ {
lastRollTime = mRollList.Last().dt; lastRollTime = mRollList.Last().Time;
int lastIndex = mRollList.Count() - 1; int lastIndex = mRollList.Count() - 1;
double v = FilmVelocity; double v = FilmVelocity;
//计算3秒内均值 //计算3秒内均值
for (int index = mRollList.Count() - 2; index >= 0; index--) for (int index = mRollList.Count() - 2; index >= 0; index--)
{ {
DateTime firstTime = mRollList[index].dt; DateTime firstTime = mRollList[index].Time;
TimeSpan ts = lastRollTime - firstTime; TimeSpan ts = lastRollTime - firstTime;
int interval = lastIndex - index; int interval = lastIndex - index;
double m = RollPerimeter * interval / 1000.0; double m = RollPerimeter * interval / 1000.0;
......
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