You need to sign in or sign up before continuing.
BlowingDetectServiceClient.cs 9.32 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1 2 3
using FLY.Thick.Blowing.IService;
using FLY.Thick.Blowing.OBJ_INTERFACE;
using FObjBase;
4
using FObjBase.Reflect;
潘栩锋's avatar
潘栩锋 committed
5
using Newtonsoft.Json;
潘栩锋's avatar
潘栩锋 committed
6 7 8 9 10 11 12 13 14 15 16
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace FLY.Thick.Blowing.Client
{
    /// <summary>
    /// 旋转架及膜位置检测模拟
    /// </summary>
17
    public class BlowingDetectServiceClient: FObjBase.Reflect.Reflect_SeviceClient, IBlowingDetectService
潘栩锋's avatar
潘栩锋 committed
18
    {
19
        protected override Type InterfaceType => typeof(IBlowingDetectService);
潘栩锋's avatar
潘栩锋 committed
20 21 22

        #region IBlowingDetect 成员
        #region 参数
潘栩锋's avatar
潘栩锋 committed
23

潘栩锋's avatar
潘栩锋 committed
24 25 26
        /// <summary>
        /// 离开限位 到 撞下一个限位 的 旋转架转动总角度 单位°
        /// </summary>
潘栩锋's avatar
潘栩锋 committed
27 28
        public double RAngle { get; set; } = 350;

潘栩锋's avatar
潘栩锋 committed
29 30 31 32 33 34

        /// <summary>
        /// 人字架 旋转1周 设置 时间。 
        /// 刚开机时,RenZiJiaPeriod = DefaultRPeriod;
        /// 异常时,RenZiJiaPeriod = DefaultRPeriod;
        /// </summary>
潘栩锋's avatar
潘栩锋 committed
35 36
        public TimeSpan DefaultRPeriod { get; set; }

潘栩锋's avatar
潘栩锋 committed
37 38 39 40

        /// <summary>
        /// 加速减速时间, 加速减速时间+正反转冷却时间 = 撞限位 到 离开限位 的时间
        /// </summary>
潘栩锋's avatar
潘栩锋 committed
41
        public TimeSpan AccDecTime { get; set; }
潘栩锋's avatar
潘栩锋 committed
42 43 44 45 46

        /// <summary>
        /// 信号0 撞2次。 这个能自动设置。 两个撞同一信号 间隔30秒内,算一个换向信号。 
        /// 当为2次撞时:  StartTime = 第1次撞的StartTime, EndTime = 第2次撞的EndTime
        /// </summary>
潘栩锋's avatar
潘栩锋 committed
47 48
        public bool IsSign0Double { get; set; }

潘栩锋's avatar
潘栩锋 committed
49 50 51 52 53

        /// <summary>
        /// 信号1 撞2次。 这个能自动设置。 两个撞同一信号 间隔30秒内,算一个换向信号。 
        /// 当为2次撞时:  StartTime = 第1次撞的StartTime, EndTime = 第2次撞的EndTime
        /// </summary>
潘栩锋's avatar
潘栩锋 committed
54
        public bool IsSign1Double { get; set; }
潘栩锋's avatar
潘栩锋 committed
55

潘栩锋's avatar
潘栩锋 committed
56
        
潘栩锋's avatar
潘栩锋 committed
57 58 59
        /// <summary>
        /// 信号模式, 短信号模式(只撞一下),长信号模式(只要是转着,信号就长亮,直到换向)
        /// </summary>
潘栩锋's avatar
潘栩锋 committed
60
        public BlowingSignType SignType { get; set; } = BlowingSignType.Short;
潘栩锋's avatar
潘栩锋 committed
61

62

潘栩锋's avatar
潘栩锋 committed
63 64 65 66 67


        /// <summary>
        /// 人字架到测厚仪膜长 单位m
        /// </summary>
潘栩锋's avatar
潘栩锋 committed
68
        public double FilmLength { get; set; } = 26;
潘栩锋's avatar
潘栩锋 committed
69

潘栩锋's avatar
潘栩锋 committed
70
 
潘栩锋's avatar
潘栩锋 committed
71 72 73
        /// <summary>
        /// 辊周长,单位mm
        /// </summary>
潘栩锋's avatar
潘栩锋 committed
74 75
        public double RollPerimeter { get; set; } = 314;

潘栩锋's avatar
潘栩锋 committed
76 77 78 79

        /// <summary>
        /// 转向信号100ms 滤波
        /// </summary>
潘栩锋's avatar
潘栩锋 committed
80 81
        public bool IsSignFilter { get; set; }

潘栩锋's avatar
潘栩锋 committed
82 83 84 85 86 87 88

        /// <summary>
        /// 缺少信号模式
        /// 正反信号线接得不好,有时候会丢失了。 
        /// 当前的旋转时间是上一次的1.1倍时,在以前的位置增加信号!!!!
        /// 当有连续两次相同的信号,且信号差刚好是旋转时间的1.9~2.1倍时,证明真的是缺少信号
        /// </summary>
潘栩锋's avatar
潘栩锋 committed
89 90 91 92 93 94
        public bool IsLackSignMode { get; set; }

        /// <summary>
        /// 旋转架为立式,测厚仪安装在二牵引前面,膜距离 与 旋转角度 一起变化, 旋转角度越大 膜距离越大
        /// </summary>
        public bool Is3D { get; set; }
95 96 97 98 99 100 101 102 103 104 105

        /// <summary>
        /// 使用编码器检测旋转架旋转位置模式
        /// </summary>
        public bool IsRPosMode { get; set; }

        /// <summary>
        /// 离开限位 到 撞下一个限位 的 旋转架转动总脉冲 单位 脉冲;
        /// 通过看 转向信号列表,可以看到
        /// </summary>
        public int RPosOfR { get; set; }
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121

        /// <summary>
        /// 自定义 转向信号 输入口序号 从0开始 默认9-1
        /// </summary>
        public int InNo_Limit0 { get; set; }

        /// <summary>
        /// 自定义 转向信号 输入口序号 从0开始 默认10-1
        /// </summary>
        public int InNo_Limit1 { get; set; }

        /// <summary>
        /// 自定义 辊速度 输入口序号 从0开始 默认11-1
        /// </summary>
        public int InNo_Roll { get; set; }

潘栩锋's avatar
潘栩锋 committed
122 123 124
        #endregion

        #region 状态
潘栩锋's avatar
潘栩锋 committed
125

潘栩锋's avatar
潘栩锋 committed
126 127 128
        /// <summary>
        /// 当前旋转架旋转角度
        /// </summary>
129
        public double Angle { get; set; }
潘栩锋's avatar
潘栩锋 committed
130

潘栩锋's avatar
潘栩锋 committed
131 132 133
        /// <summary>
        /// 当前方向
        /// </summary>
134
        public Misc.DIRECTION Direction { get; set; } = Misc.DIRECTION.FORWARD;
潘栩锋's avatar
潘栩锋 committed
135 136 137 138 139


        /// <summary>
        /// 当前缓冲区数量
        /// </summary>
潘栩锋's avatar
潘栩锋 committed
140 141
        public int RotationCnt { get; set; }

潘栩锋's avatar
潘栩锋 committed
142 143 144 145

        /// <summary>
        /// 最新的限位信号序号
        /// </summary>
潘栩锋's avatar
潘栩锋 committed
146 147
        public int LastLimitNo { get; set; }

潘栩锋's avatar
潘栩锋 committed
148 149 150
        /// <summary>
        /// 最后一次撞限位,或离开限位信号 到当前已经消耗的时间
        /// </summary>
潘栩锋's avatar
潘栩锋 committed
151
        public TimeSpan PastTime { get; set; }
潘栩锋's avatar
潘栩锋 committed
152 153


潘栩锋's avatar
潘栩锋 committed
154
        
潘栩锋's avatar
潘栩锋 committed
155 156 157
        /// <summary>
        /// 当前线速度,单位 m/min
        /// </summary>
158
        public double FilmVelocity { get;  set; } = 0;
潘栩锋's avatar
潘栩锋 committed
159 160


潘栩锋's avatar
潘栩锋 committed
161 162 163 164 165


        /// <summary>
        /// 离开限位 到 撞下一个限位  的 旋转架转动时间, 需要初始值,以后测量出来的
        /// </summary>
166
        public TimeSpan RenZiJiaPeriod { get;  set; }
潘栩锋's avatar
潘栩锋 committed
167

168

潘栩锋's avatar
潘栩锋 committed
169
        /// <summary>
170
        /// 撞限位 到 离开限位 的时间, 需要初始值,以后测量出来的
潘栩锋's avatar
潘栩锋 committed
171
        /// </summary>
172
        public TimeSpan LimitSignTime { get; set; }
潘栩锋's avatar
潘栩锋 committed
173

174 175 176
        /// <summary>
        /// 缓冲区拥有数据的时间长度,1s更新一次
        /// </summary>
177
        public TimeSpan BufTotalTime { get;  set; }
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195

        /// <summary>
        /// 上一次撞限位开关0时, 旋转架脉冲
        /// </summary>
        public int OrgRPos { get; set; }
        /// <summary>
        ///旋转架全局脉冲, 当前旋转架脉冲 = GlobalRPos - OrgRPos;
        /// </summary>
        public int GlobalRPos { get; set; }
        /// <summary>
        /// 旋转架脉冲速度,  旋转架角速度 = RSpeed * RAngle / RPosOfR
        /// </summary>
        public int RSpeed { get; set; }

        /// <summary>
        /// 刚开机,信号列表一个信号都没有,创造一个时间点,作为信号点
        /// </summary>        
        public DateTime DefaultTime { get; set; }
潘栩锋's avatar
潘栩锋 committed
196 197 198 199 200 201 202
        #endregion

        #endregion

        /// <summary>
        /// 
        /// </summary>
203 204 205 206 207 208 209
        public BlowingDetectServiceClient(UInt32 serviceId) : base(serviceId) { }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="serviceId"></param>
        /// <param name="connName"></param>
        public BlowingDetectServiceClient(UInt32 serviceId, string connName) : base(serviceId, connName) { }
潘栩锋's avatar
潘栩锋 committed
210

211
        
潘栩锋's avatar
潘栩锋 committed
212 213 214 215 216
        #region 功能

        /// <summary>
        /// 应用
        /// </summary>
217
        
潘栩锋's avatar
潘栩锋 committed
218 219
        public void Apply()
        {
220
            Call(nameof(Apply));
潘栩锋's avatar
潘栩锋 committed
221 222 223 224
        }
        /// <summary>
        /// 获取 信号列表
        /// </summary>
225
        /// <param name="asyncDelegate"></param>
226
        /// <param name="asyncContext"></param>
227 228
        [Call(typeof(GetSignListReponse))]
        public void GetSignList(DateTime begin, AsyncCBHandler asyncDelegate, object asyncContext)
潘栩锋's avatar
潘栩锋 committed
229
        {
230
            Call(nameof(GetSignList), new {begin}, asyncDelegate, asyncContext);
潘栩锋's avatar
潘栩锋 committed
231
        }
232

潘栩锋's avatar
潘栩锋 committed
233
        /// <summary>
234
        /// 获取 辊信号列表
潘栩锋's avatar
潘栩锋 committed
235
        /// </summary>
236
        /// <param name="begin">开始时间</param>
237
        /// <param name="asyncDelegate"></param>
238
        /// <param name="asyncContext"></param>
239 240
        [Call(typeof(GetRollListReponse))]
        public void GetRollList(DateTime begin, AsyncCBHandler asyncDelegate, object asyncContext)
潘栩锋's avatar
潘栩锋 committed
241
        {
242
            Call(nameof(GetRollList), new { begin }, asyncDelegate, asyncContext);
潘栩锋's avatar
潘栩锋 committed
243 244 245
        }

        /// <summary>
246
        /// 获取 转向信号列表
潘栩锋's avatar
潘栩锋 committed
247 248
        /// </summary>
        /// <param name="begin">开始时间</param>
249
        /// <param name="asyncDelegate"></param>
250
        /// <param name="asyncContext"></param>
251 252
        [Call(typeof(GetLimitListReponse))]
        public void GetLimitList(DateTime begin, AsyncCBHandler asyncDelegate, object asyncContext)
潘栩锋's avatar
潘栩锋 committed
253
        {
254
            Call(nameof(GetLimitList), new { begin }, asyncDelegate, asyncContext);
潘栩锋's avatar
潘栩锋 committed
255 256
        }

257 258


潘栩锋's avatar
潘栩锋 committed
259 260 261
        /// <summary>
        /// 获取 立式旋转架 的 膜距离增量
        /// </summary>
262
        /// <param name="asyncDelegate"></param>
263
        /// <param name="asyncContext"></param>
264
        [Call(typeof(GetFilmLength3DReponse))]
265
        public void GetFilmLength3D(AsyncCBHandler asyncDelegate, object asyncContext)
潘栩锋's avatar
潘栩锋 committed
266
        {
267
            Call(nameof(GetFilmLength3D), null, asyncDelegate, asyncContext);
潘栩锋's avatar
潘栩锋 committed
268 269 270 271 272 273 274 275
        }

        /// <summary>
        /// 设置 立式旋转架 的 膜距离增量
        /// </summary>
        /// <param name="data"></param>
        public void SetFilmLength3D(List<double> data)
        {
276
            Call(nameof(SetFilmLength3D), new { data });
潘栩锋's avatar
潘栩锋 committed
277
        }
潘栩锋's avatar
潘栩锋 committed
278

279 280 281 282 283 284 285 286 287 288 289 290 291

        /// <summary>
        /// 获取 旋转位置列表
        /// </summary>
        /// <param name="begin">开始时间</param>
        /// <param name="asyncDelegate"></param>
        /// <param name="asyncContext"></param>
        [Call(typeof(GetRPosListReponse))]
        public void GetRPosList(DateTime begin, AsyncCBHandler asyncDelegate, object asyncContext) 
        {
            Call(nameof(GetRPosList), new { begin }, asyncDelegate, asyncContext);
        }

潘栩锋's avatar
潘栩锋 committed
292 293 294 295
        #endregion

    }
}