using FObjBase;
using FObjBase.Reflect;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
namespace FLY.Thick.Blowing.IService
{
///
/// 旋转架及膜位置检测模拟
///
public interface IBlowingDetectService :INotifyPropertyChanged
{
#region 参数
///
/// 离开限位 到 撞下一个限位 的 旋转架转动总角度 单位°
///
double RAngle { get; set; }
///
/// 人字架 旋转1周 设置 时间。
/// 刚开机时,RenZiJiaPeriod = DefaultRPeriod;
/// 异常时,RenZiJiaPeriod = DefaultRPeriod;
///
TimeSpan DefaultRPeriod { get; set; }
///
/// 信号0 撞2次。 这个能自动设置。 两个撞同一信号 间隔30秒内,算一个换向信号。
/// 当为2次撞时: StartTime = 第1次撞的StartTime, EndTime = 第2次撞的EndTime
///
bool IsSign0Double { get; set; }
///
/// 信号1 撞2次。 这个能自动设置。 两个撞同一信号 间隔30秒内,算一个换向信号。
/// 当为2次撞时: StartTime = 第1次撞的StartTime, EndTime = 第2次撞的EndTime
///
bool IsSign1Double { get; set; }
///
/// 信号模式, 短信号模式(只撞一下),长信号模式(只要是转着,信号就长亮,直到换向)
///
BlowingSignType SignType { get; set; }
///
/// 撞限位 到 离开限位 的时间, 需要初始值,以后测量出来的
///
TimeSpan LimitSignTime { get; set; }
///
/// 人字架到测厚仪膜长 单位m
/// 当旋转架为立式时, 膜长为人字架复位时,的最短膜距离
///
double FilmLength { get; set; }
///
/// 辊周长,单位mm
///
double RollPerimeter { get; set; }
///
/// 转向信号100ms 滤波
///
bool IsSignFilter { get; set; }
///
/// 缺少信号模式
/// 正反信号线接得不好,有时候会丢失了。
/// 当前的旋转时间是上一次的1.1倍时,在以前的位置增加信号!!!!
/// 当有连续两次相同的信号,且信号差刚好是旋转时间的1.9~2.1倍时,证明真的是缺少信号
///
bool IsLackSignMode { get; set; }
///
/// 旋转架为立式,测厚仪安装在二牵引前面,膜距离 与 旋转角度 一起变化, 旋转角度越大 膜距离越大
///
bool Is3D { get; set; }
#endregion
#region 状态
///
/// 当前旋转架旋转角度
///
double Angle { get; }
///
/// 当前方向
///
Misc.DIRECTION Direction { get; }
///
/// 旋转次数
///
int RotationCnt { get; }
///
/// 最新的限位信号序号
///
int LastLimitNo { get; }
///
/// 最后一次撞限位,或离开限位信号 到当前已经消耗的时间
///
TimeSpan PastTime { get; }
///
/// 当前线速度,单位 m/min
///
double FilmVelocity { get; }
///
/// 离开限位 到 撞下一个限位 的 旋转架转动时间, 需要初始值,以后测量出来的
///
TimeSpan RenZiJiaPeriod { get; }
///
/// 缓冲区拥有数据的时间长度,1s更新一次
///
TimeSpan BufTotalTime { get; }
#endregion
#region 功能
///
/// 参数应用
///
void Apply();
///
/// 获取 信号列表
///
///
///
[Call(typeof(GetSignListReponse))]
void GetSignList(AsyncCBHandler asyncDelegate, object asyncContext);
///
/// 获取 辊信号列表
///
/// 开始时间
///
///
[Call(typeof(GetRollListReponse))]
void GetRollList(DateTime begin, AsyncCBHandler asyncDelegate, object asyncContext);
///
/// 获取 转向信号列表
///
/// 开始时间
///
///
[Call(typeof(GetLimitListReponse))]
void GetLimitList(DateTime begin, AsyncCBHandler asyncDelegate, object asyncContext);
///
/// 获取 立式旋转架 的 膜距离增量
///
///
///
[Call(typeof(GetFilmLength3DReponse))]
void GetFilmLength3D(AsyncCBHandler asyncDelegate, object asyncContext);
///
/// 设置 立式旋转架 的 膜距离增量
///
///
void SetFilmLength3D(List data);
#endregion
}
///
/// 正反转信号类型
///
public enum BlowingSignType
{
///
/// 短信号模式, 撞输入口 为0, 离开输入口为1
///
Short,
///
/// 长信号模式,撞输入口 为0,直到切换为下一个信号,才恢复为1
///
Long
}
///
/// 信号
///
public class SignData : INotifyPropertyChanged
{
///
/// 信号序号
///
public int No { get; set; }
///
/// 时间
///
public DateTime Time { get; set; }
///
/// on? off?
///
public bool On { get; set; }
///
/// 与上一次的时间间隔
///
public TimeSpan Interval { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
}
///
/// 辊信号时间
///
public class RollCell
{
///
/// 创建副本
///
///
public RollCell Clone()
{
RollCell r = new RollCell();
r.dt = dt;
return r;
}
public DateTime dt;
public override string ToString()
{
return dt.ToString();
}
}
///
/// 撞向信号
///
public class LimitCell
{
///
/// 信号开始
///
public DateTime dt_begin = DateTime.MinValue;
///
/// 信号结束
///
public DateTime dt_end = DateTime.MinValue;
///
/// 信号序号 0 或 1
///
public int no = 0;
///
/// 两次撞转向 = 1次信号
///
public bool isDouble = false;
///
/// 当为两次撞转向, 第1次撞结束时间。用于当两次信号发生时间间隔很长,现在肯定就只有一次撞转向而已
///
public DateTime dt_mid = DateTime.MinValue;
///
/// 这是一个虚拟的信号
///
public bool isVirtual = false;
///
/// 创建副本
///
///
public LimitCell Clone()
{
LimitCell l = new LimitCell();
l.dt_begin = dt_begin;
l.dt_end = dt_end;
l.dt_mid = dt_mid;
l.isDouble = isDouble;
l.isVirtual = isVirtual;
l.no = no;
return l;
}
///
///
///
///
public override string ToString()
{
return no.ToString() + " " + ((isDouble) ? "D" : "S") + " (" + dt_begin.ToString() + "-" + dt_end.ToString() + ") " + (isVirtual ? "V" : "");
}
}
///
/// GetSignList 返回
///
public class GetSignListReponse
{
public List datas;
}
///
/// GetRollList 参数
///
public class GetRollListRequest
{
public DateTime begin;
}
///
/// GetRollList 返回
///
public class GetRollListReponse
{
public List datas;
}
///
/// GetFilmLength3D 返回
///
public class GetFilmLength3DReponse
{
public List datas;
}
///
///
///
public class GetLimitListRequest
{
public DateTime begin;
}
///
///
///
public class GetLimitListReponse
{
public List datas;
}
}