Commit 2a61cb6c authored by 潘栩锋's avatar 潘栩锋 🚴

1.添加 添加 FilmPositionDetect 模块。

2.修改 DynArea 的通讯都改为 json
parent 3fd8c736
......@@ -6,6 +6,7 @@ using FObjBase;
using FLY.Thick.Base.Common;
using FLY.Thick.Base.OBJ_INTERFACE;
using FLY.Thick.Base.IService;
using Newtonsoft.Json;
namespace FLY.Thick.Base.Client
{
......@@ -15,6 +16,7 @@ namespace FLY.Thick.Base.Client
private UInt32 mServerID;
private IFConn mConn;
public DynAreaService(UInt32 id)
{
mServerID = id;
......@@ -57,9 +59,9 @@ namespace FLY.Thick.Base.Client
{
case DYNAREA_OBJ_INTERFACE.PUSH_ADPOS:
{
DYNAREA_OBJ_INTERFACE.Pack_GetADPos pack = new DYNAREA_OBJ_INTERFACE.Pack_GetADPos();
if (!pack.TryParse(infodata))
return;
string json = Misc.Converter.BytesToString(infodata);
DYNAREA_OBJ_INTERFACE.Pack_GetADPos pack = JsonConvert.DeserializeObject<DYNAREA_OBJ_INTERFACE.Pack_GetADPos>(json);
mDynArea.AD = pack.ad;
mDynArea.Thick = pack.thick;
mDynArea.Position = pack.position;
......@@ -67,34 +69,29 @@ namespace FLY.Thick.Base.Client
} break;
case DYNAREA_OBJ_INTERFACE.PUSH_SCANINFO:
{
DYNAREA_OBJ_INTERFACE.Pack_GetScanInfo pack = new DYNAREA_OBJ_INTERFACE.Pack_GetScanInfo();
if (!pack.TryParse(infodata))
return;
//TODO
for (int i = 0; i < 3; i++)
string json = Misc.Converter.BytesToString(infodata);
DYNAREA_OBJ_INTERFACE.Pack_GetScanInfo pack = JsonConvert.DeserializeObject<DYNAREA_OBJ_INTERFACE.Pack_GetScanInfo>(json);
if (pack.sampleAD != null)
{
for (int i = 0; i < mDynArea.SampleAD.Count() && i < pack.sampleAD.Count(); i++)
{
mDynArea.SampleAD[i] = pack.sampleAD[i];
}
}
mDynArea.TempState = pack.tempState;
mDynArea.DataValid = pack.datavalid;
mDynArea.RollDown = pack.rolldown;
mDynArea.Direction = pack.direction;
mDynArea.Width = pack.width;
mDynArea.FilmVelocity = pack.filmVelocity;
mDynArea.FilmPosition = pack.filmPosition;
mDynArea.Velocity = pack.velocity;
} break;
case DYNAREA_OBJ_INTERFACE.PUSH_PROFILE:
{
DYNAREA_OBJ_INTERFACE.Pack_GetProfile pack = new DYNAREA_OBJ_INTERFACE.Pack_GetProfile();
if (!pack.TryParse(infodata))
return;
string json = Misc.Converter.BytesToString(infodata);
DYNAREA_OBJ_INTERFACE.Pack_GetProfile pack = JsonConvert.DeserializeObject<DYNAREA_OBJ_INTERFACE.Pack_GetProfile>(json);
mDynArea.ProductName = pack.ProductName;
mDynArea.Target = pack.Target;
mDynArea.Alarm = pack.Alarm;
......@@ -107,9 +104,9 @@ namespace FLY.Thick.Base.Client
} break;
case DYNAREA_OBJ_INTERFACE.PUSH_SYSTEM:
{
DYNAREA_OBJ_INTERFACE.Pack_GetSystem pack = new DYNAREA_OBJ_INTERFACE.Pack_GetSystem();
if (!pack.TryParse(infodata))
return;
string json = Misc.Converter.BytesToString(infodata);
DYNAREA_OBJ_INTERFACE.Pack_GetSystem pack = JsonConvert.DeserializeObject<DYNAREA_OBJ_INTERFACE.Pack_GetSystem>(json);
mDynArea.FLYADIsConnect = pack.isConnect;
mDynArea.SecuteLock = pack.secuteLock;
mDynArea.Hrs = pack.hrs;
......@@ -118,33 +115,33 @@ namespace FLY.Thick.Base.Client
} break;
case DYNAREA_OBJ_INTERFACE.PUSH_BOLTMAP:
{
DYNAREA_OBJ_INTERFACE.Pack_GetBoltmap pack = new DYNAREA_OBJ_INTERFACE.Pack_GetBoltmap();
if (!pack.TryParse(infodata))
return;
string json = Misc.Converter.BytesToString(infodata);
DYNAREA_OBJ_INTERFACE.Pack_GetBoltmap pack = JsonConvert.DeserializeObject<DYNAREA_OBJ_INTERFACE.Pack_GetBoltmap>(json);
mDynArea.NBolts = pack.NBolts;
mDynArea.FirstBoltNo = pack.FirstBoltNo;
} break;
case DYNAREA_OBJ_INTERFACE.PUSH_IO:
{
DYNAREA_OBJ_INTERFACE.Pack_GetIO pack = new DYNAREA_OBJ_INTERFACE.Pack_GetIO();
if (!pack.TryParse(infodata))
return;
string json = Misc.Converter.BytesToString(infodata);
DYNAREA_OBJ_INTERFACE.Pack_GetIO pack = JsonConvert.DeserializeObject<DYNAREA_OBJ_INTERFACE.Pack_GetIO>(json);
mDynArea.IStatus = pack.iStatus;
mDynArea.OStatus = pack.oStatus;
} break;
case DYNAREA_OBJ_INTERFACE.PUSH_CONTROLLER_STATE:
{
DYNAREA_OBJ_INTERFACE.Pack_GetControllerState pack = new DYNAREA_OBJ_INTERFACE.Pack_GetControllerState();
if (!pack.TryParse(infodata))
return;
string json = Misc.Converter.BytesToString(infodata);
DYNAREA_OBJ_INTERFACE.Pack_GetControllerState pack = JsonConvert.DeserializeObject<DYNAREA_OBJ_INTERFACE.Pack_GetControllerState>(json);
mDynArea.ControllerState = pack.controller_state;
mDynArea.AutoScanCounter = pack.autoscan_counter;
} break;
case DYNAREA_OBJ_INTERFACE.PUSH_POSITION2:
{
DYNAREA_OBJ_INTERFACE.Pack_Position2 pack = new DYNAREA_OBJ_INTERFACE.Pack_Position2();
if (!pack.TryParse(infodata))
return;
string json = Misc.Converter.BytesToString(infodata);
DYNAREA_OBJ_INTERFACE.Pack_Position2 pack = JsonConvert.DeserializeObject<DYNAREA_OBJ_INTERFACE.Pack_Position2>(json);
mDynArea.Position2 = pack.position;
}break;
}
......
......@@ -110,71 +110,34 @@ namespace FLY.Thick.Base.Common
/// </summary>
public double FilmVelocity { get; set; }
/// <summary>
/// 膜生产位置 m
/// </summary>
public double FilmPosition { get; set; }
/// <summary>
/// 测厚仪速度 m/min
/// </summary>
public double Velocity { get; set; }
#endregion
#region 运行状态
private CTRL_STATE _controllerState;
public CTRL_STATE ControllerState//运行状态
{
get {
return _controllerState;
}
set {
if (_controllerState != value)
{
_controllerState = value;
NotifyPropertyChanged("ControllerState");
}
}
}
private int autoscancounter=5;
public int AutoScanCounter
{
get
{
return autoscancounter;
}
set
{
if (autoscancounter != value)
{
autoscancounter = value;
NotifyPropertyChanged("AutoScanCounter");
}
}
}
/// <summary>
/// 运行状态
/// </summary>
public CTRL_STATE ControllerState { get; set; }
/// <summary>
///
/// </summary>
public int AutoScanCounter { get; set; } = 5;
#endregion
#region IO
private UInt16 iStatus = 0xffff;
public UInt16 IStatus
{
get { return iStatus; }
set
{
if (iStatus != value)
{
iStatus = value;
NotifyPropertyChanged("IStatus");
}
}
}
public UInt16 oStatus = 0xffff;
public UInt16 OStatus
{
get { return oStatus; }
set
{
if (oStatus != value)
{
oStatus = value;
NotifyPropertyChanged("OStatus");
}
}
}
public UInt16 IStatus { get; set; } = 0xffff;
public UInt16 OStatus { get; set; } = 0xffff;
#endregion
#region 系统
......@@ -280,8 +243,6 @@ namespace FLY.Thick.Base.Common
/// </summary>
public int NBolts { get; set; } = 50;
private int _firstBoltNo = 0;
/// <summary>
/// 开始分区号
/// </summary>
......@@ -291,13 +252,7 @@ namespace FLY.Thick.Base.Common
#region INotifyPropertyChanged 成员
protected void NotifyPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
public event PropertyChangedEventHandler PropertyChanged;
#endregion
......
<?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="..\..\..\Project.FLY.Thick.Normal\packages\PropertyChanged2.Fody.2.6.0\build\PropertyChanged2.Fody.props" Condition="Exists('..\..\..\Project.FLY.Thick.Normal\packages\PropertyChanged2.Fody.2.6.0\build\PropertyChanged2.Fody.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
......@@ -11,10 +11,11 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FLY.Thick.Base</RootNamespace>
<AssemblyName>FLY.Thick.Base</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
......@@ -25,6 +26,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\FLY.Thick.Base.XML</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
......@@ -33,12 +35,16 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>
</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\..\Project.FLY.Thick.Normal\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PropertyChanged2, Version=2.6.0.0, Culture=neutral, PublicKeyToken=ee3ee20bcf148ddd, processorArchitecture=MSIL">
<HintPath>..\..\..\Project.FLY.Thick.Normal\packages\PropertyChanged2.Fody.2.6.0\lib\net40\PropertyChanged2.dll</HintPath>
</Reference>
......@@ -49,6 +55,7 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Client\BoltCreateInfo.cs" />
......@@ -96,6 +103,7 @@
<Compile Include="IService\IGetSampleService.cs" />
<Compile Include="IService\IInitParamService.cs" />
<Compile Include="IService\INotifyErrorArisen.cs" />
<Compile Include="IService\IFilmPositionDetectService.cs" />
<Compile Include="IService\IPasswordService.cs" />
<Compile Include="IService\IProfileService.cs" />
<Compile Include="IService\IRejectService.cs" />
......@@ -149,6 +157,7 @@
<Compile Include="Server\BorderSearch.cs" />
<Compile Include="Server\CoatingSegmentSearch.cs" />
<Compile Include="Server\CurveCollection.cs" />
<Compile Include="Server\FilmPositionDetect.cs" />
<Compile Include="Server\GetSample.cs" />
<Compile Include="Server\GM_Base.cs" />
<Compile Include="Server\GM_Fix.cs" />
......
using FLY.Thick.Base.Common;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FLY.Thick.Base.IService
{
public interface IFilmPositionDetect : INotifyPropertyChanged
{
/// <summary>
/// 线速度 m/min
/// </summary>
double FilmVelocity { get; }
/// <summary>
/// 膜位置, m
/// </summary>
double FilmPosition { get; }
/// <summary>
/// 线速度阀值,低于阀值,速度直接变为0
/// </summary>
double FilmVThreshold { get; set; }
/// <summary>
/// 编码器2 放大
/// </summary>
float Encoder2_comp { get; set; }
/// <summary>
/// 线速度来源
/// </summary>
FilmVSRC FilmVSrc { get; set; }
/// <summary>
/// 线速度:编码器2 mm/pulse
/// </summary>
double Encoder2_mmpp { get; set; }
/// <summary>
/// 线速度:1圈多少mm
/// </summary>
double MmOfR { get; set; }
/// <summary>
/// 设置膜位置为某值
/// </summary>
/// <param name="filmPosition"></param>
void Reset(double filmPosition);
}
}
......@@ -70,60 +70,51 @@ namespace FLY.Thick.Base.OBJ_INTERFACE
#endregion
}
public class Pack_GetScanInfo : IPack
public class Pack_GetScanInfo
{
public int[] sampleAD = new int[3];//最新样品AD
public bool tempState;//动态温修
public bool datavalid;//数据有效
public int rolldown;//下辊信号
public Misc.DIRECTION direction;//扫描方向
public double width;//膜宽 mm
public double filmVelocity;//线速度m/min
public double velocity;//速度 m/min
#region IPack 成员
public byte[] ToBytes()
{
List<byte> buf = new List<byte>();
for (int i = 0; i < 3; i++)
{
buf.AddRange(BitConverter.GetBytes(sampleAD[i]));
}
buf.AddRange(BitConverter.GetBytes(tempState));
buf.AddRange(BitConverter.GetBytes(datavalid));
buf.AddRange(BitConverter.GetBytes(rolldown));
buf.Add((byte)direction);
buf.AddRange(BitConverter.GetBytes(width));
buf.AddRange(BitConverter.GetBytes(filmVelocity));
buf.AddRange(BitConverter.GetBytes(velocity));
return (buf.ToArray());
}
public bool TryParse(byte[] value)
{
if (value.Length < (12 + 1 + 1 + 4 + 1+8*3))
return false;
int index = 0;
for (int i = 0; i < 3; i++)
{
sampleAD[i] = BitConverter.ToInt32(value, index); index += 4;
}
tempState = BitConverter.ToBoolean(value, index); index++;
datavalid = BitConverter.ToBoolean(value, index); index++;
rolldown = BitConverter.ToInt32(value, index); index += 4;
direction = (Misc.DIRECTION)value[index];index++;
width = BitConverter.ToDouble(value, index); index += 8;
filmVelocity = BitConverter.ToDouble(value, index); index += 8;
velocity = BitConverter.ToDouble(value, index); index += 8;
return true;
}
#endregion
/// <summary>
/// 最新样品AD
/// </summary>
public int[] sampleAD;
/// <summary>
/// 动态温修
/// </summary>
public bool tempState;
/// <summary>
/// 数据有效
/// </summary>
public bool datavalid;
/// <summary>
/// 扫描方向
/// </summary>
public Misc.DIRECTION direction;
/// <summary>
/// 膜宽 mm
/// </summary>
public double width;
/// <summary>
/// 线速度m/min
/// </summary>
public double filmVelocity;
/// <summary>
/// 膜生产位置m
/// </summary>
public double filmPosition;
/// <summary>
/// 速度 m/min
/// </summary>
public double velocity;
}
public class Pack_GetControllerState : IPack
{
public CTRL_STATE controller_state;//运行状态
public int autoscan_counter;//自动扫描时间累积
/// <summary>
/// 运行状态
/// </summary>
public CTRL_STATE controller_state;
/// <summary>
/// 自动扫描时间累积
/// </summary>
public int autoscan_counter;
#region IPack 成员
......
......@@ -6,7 +6,7 @@ using FLY.Thick.Base.Common;
using FObjBase;
using FLY.Thick.Base.OBJ_INTERFACE;
using FLY.Thick.Base.Server;
using Newtonsoft.Json;
namespace FLY.Thick.Base.Server.OBJProxy
{
......@@ -69,10 +69,10 @@ namespace FLY.Thick.Base.Server.OBJProxy
(e.PropertyName == "TempState") ||
(e.PropertyName == "Mix") ||
(e.PropertyName == "DataValid") ||
(e.PropertyName == "RollDown") ||
(e.PropertyName == "Direction") ||
(e.PropertyName == "Width") ||
(e.PropertyName == "FilmVelocity")||
(e.PropertyName == "FilmPosition") ||
(e.PropertyName == "Velocity")
)
{
......@@ -195,7 +195,8 @@ namespace FLY.Thick.Base.Server.OBJProxy
position = mDynArea.Position,
boltIndex = mDynArea.BoltIndex
};
infodata = p.ToBytes();
string json = JsonConvert.SerializeObject(p);
infodata = Misc.Converter.StringToBytes(json);
} break;
case DYNAREA_OBJ_INTERFACE.GET_SCANINFO:
{
......@@ -204,18 +205,14 @@ namespace FLY.Thick.Base.Server.OBJProxy
tempState = mDynArea.TempState,
direction = mDynArea.Direction,
datavalid = mDynArea.DataValid,
rolldown = mDynArea.RollDown,
width = mDynArea.Width,
filmVelocity = mDynArea.FilmVelocity,
velocity = mDynArea.Velocity
filmPosition = mDynArea.FilmPosition,
velocity = mDynArea.Velocity,
sampleAD = mDynArea.SampleAD.ToArray()
};
for(int i=0;i<3;i++)
{
p.sampleAD[i] = mDynArea.SampleAD[i];
}
infodata = p.ToBytes();
string json = JsonConvert.SerializeObject(p);
infodata = Misc.Converter.StringToBytes(json);
} break;
case DYNAREA_OBJ_INTERFACE.GET_PROFILE:
{
......@@ -231,7 +228,8 @@ namespace FLY.Thick.Base.Server.OBJProxy
Comp = mDynArea.Comp,
Shift = mDynArea.Shift
};
infodata = p.ToBytes();
string json = JsonConvert.SerializeObject(p);
infodata = Misc.Converter.StringToBytes(json);
} break;
case DYNAREA_OBJ_INTERFACE.GET_BOLTMAP:
{
......@@ -240,7 +238,8 @@ namespace FLY.Thick.Base.Server.OBJProxy
NBolts = mDynArea.NBolts,
FirstBoltNo = mDynArea.FirstBoltNo
};
infodata = p.ToBytes();
string json = JsonConvert.SerializeObject(p);
infodata = Misc.Converter.StringToBytes(json);
} break;
case DYNAREA_OBJ_INTERFACE.GET_IO:
{
......@@ -249,7 +248,8 @@ namespace FLY.Thick.Base.Server.OBJProxy
iStatus = mDynArea.IStatus,
oStatus = mDynArea.OStatus
};
infodata = p.ToBytes();
string json = JsonConvert.SerializeObject(p);
infodata = Misc.Converter.StringToBytes(json);
} break;
case DYNAREA_OBJ_INTERFACE.GET_CONTROLLER_STATE:
......@@ -259,7 +259,8 @@ namespace FLY.Thick.Base.Server.OBJProxy
controller_state = mDynArea.ControllerState,
autoscan_counter = mDynArea.AutoScanCounter
};
infodata = p.ToBytes();
string json = JsonConvert.SerializeObject(p);
infodata = Misc.Converter.StringToBytes(json);
} break;
case DYNAREA_OBJ_INTERFACE.GET_SYSTEM:
{
......@@ -271,7 +272,8 @@ namespace FLY.Thick.Base.Server.OBJProxy
hrs = mDynArea.Hrs,
gagetype = mDynArea.GageType
};
infodata = p.ToBytes();
string json = JsonConvert.SerializeObject(p);
infodata = Misc.Converter.StringToBytes(json);
} break;
case DYNAREA_OBJ_INTERFACE.GET_POSITION2:
{
......@@ -279,7 +281,8 @@ namespace FLY.Thick.Base.Server.OBJProxy
{
position = mDynArea.Position2
};
infodata = p.ToBytes();
string json = JsonConvert.SerializeObject(p);
infodata = Misc.Converter.StringToBytes(json);
} break;
default:
infodata = null;
......
using FLY.Thick.Base.Common;
using FLY.Thick.Base.IService;
using FlyADBase;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Threading;
namespace FLY.Thick.Base.Server
{
/// <summary>
/// 膜位置检测
/// 通过辊接近开关,或者编码器2
/// </summary>
public class FilmPositionDetect : IFilmPositionDetect
{
/// <summary>
/// 线速度 m/min
/// </summary>
public double FilmVelocity { get; private set; }
/// <summary>
/// 膜位置, m
/// </summary>
public double FilmPosition { get; private set; }
/// <summary>
/// 线速度阀值,低于阀值,速度直接变为0
/// </summary>
public double FilmVThreshold { get; set; }
/// <summary>
/// 线速度来源
/// </summary>
public FilmVSRC FilmVSrc { get; set; }
/// <summary>
/// 线速度:编码器2 mm/pulse
/// </summary>
public double Encoder2_mmpp { get; set; }
/// <summary>
/// 编码器2 放大
/// </summary>
public float Encoder2_comp { get; set; }
/// <summary>
/// 线速度:1圈多少mm
/// </summary>
public double MmOfR { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
private FlyAD7 mFlyAD;
public void Init(FlyAD7 flyAD)
{
mFlyAD = flyAD;
//------------------------------------------------------------------------------------------------------------------------------------
//线速度------------------------------------------------------------------------------------------------------------------------------
mFlyAD.PropertyChanged += (s, e) =>
{
if (FilmVSrc != FilmVSRC.EN2)
return;
if (e.PropertyName == "Speed2")
{
double speed = mFlyAD.Speed2 * Encoder2_mmpp;//mm/s
speed = speed * 60 / 1000;//m/min
FilmVelocity = speed;
}
else if (e.PropertyName == "Position2")
{
if (FilmVSrc != FilmVSRC.EN2)
return;
double position2 = mFlyAD.Position2* Encoder2_mmpp;//mm
position2 /= 1000.0;
FilmPosition = position2 + BaseFilmPosition;
}
};
//------------------------------------------------------------------------------------------------------------------------------------
//辊信号生成线速度-----------------------------------------------------------------------------------------------------------------------------
InitRoundFilmVelocity();
}
#region 辊信号生成 线速度
DispatcherTimer round_t;
DateTime dtRound;
int RCnt = 0;
double BaseFilmPosition = 0;
void InitRoundFilmVelocity()
{
round_t = new DispatcherTimer();
round_t.Interval = TimeSpan.FromSeconds(1);
round_t.Tick += new EventHandler(round_t_Tick);
mFlyAD.IStatusChangedEvent += new IStatusChangedEventHandler(mFlyAD_IStatusChangedEvent_round);
}
void mFlyAD_IStatusChangedEvent_round(object sender, IStatusChangedEventArgs e)
{
if (FilmVSrc != FilmVSRC.ROUND)
return;
if (!Misc.MyBase.CHECKBIT(e.IChanged, 11 - 1))
return;
if (Misc.MyBase.CHECKBIT(e.IStatus, 11 - 1))
return;
//1->0
DateTime dt = e.Time;
if (dt <= dtRound)
return;
if (dtRound != DateTime.MinValue)
{
double v = MmOfR / 1000.0 / (dt - dtRound).TotalMinutes;
if (v < 2)//太慢了
{
dt = DateTime.MinValue;
v = 0;
}
FilmVelocity = v;
if (v > 0)
{
RCnt++;
double p = RCnt * MmOfR / 1000.0 + BaseFilmPosition;
if (FilmPosition < p)
FilmPosition = p;
}
}
dtRound = dt;
if (dtRound != DateTime.MinValue)
{
if (!round_t.IsEnabled)
round_t.Start();
}
}
void round_t_Tick(object sender, EventArgs e)
{
if (FilmVSrc != FilmVSRC.ROUND)
{
round_t.Stop();
return;
}
if (dtRound == DateTime.MinValue)
{
round_t.Stop();
return;
}
//1->0
DateTime dt = DateTime.Now;
if (dt <= dtRound)
return;
double v = MmOfR / 1000.0 / (dt - dtRound).TotalMinutes;
if (v < (FilmVelocity - 1))
{
if (v < 2)
{
dtRound = DateTime.MinValue;
v = 0;
}
FilmVelocity = v;
}
double p1 = RCnt * MmOfR / 1000.0;
double p2 = (dt - dtRound).TotalMinutes * FilmVelocity;
if (p2 <= MmOfR / 1000.0)
p2 = MmOfR / 1000.0;
p1 += p2;
if (FilmPosition < p1)
FilmPosition = p1;
if (dtRound == DateTime.MinValue)
{
round_t.Stop();
return;
}
}
#endregion
/// <summary>
/// 设置膜位置为某值
/// </summary>
/// <param name="filmPosition"></param>
public void Reset(double filmPosition)
{
if (FilmVSrc == FilmVSRC.EN2)
{
mFlyAD.Position2 = 0;
}
else
{
FilmPosition = 0;
RCnt = 0;
}
BaseFilmPosition = filmPosition;
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Fody" version="3.3.5" targetFramework="net40" developmentDependency="true" />
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net462" />
<package id="PropertyChanged2.Fody" version="2.6.0" targetFramework="net40" />
</packages>
\ No newline at end of file
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