void monitorAction(object source, System.Timers.ElapsedEventArgs e)
        {
            alarmDelegate md = new alarmDelegate(monitoractive);

            // daq.EventCount_Read();

            try { Invoke(md, new object[] { doData }); }
            catch
            { }
        }
예제 #2
0
        void theout(object source, System.Timers.ElapsedEventArgs e)
        {
            byte          diData = daq.InstantDi_Read();
            alarmDelegate md     = new alarmDelegate(alarmactive);

            // daq.EventCount_Read();
            try
            {
                if (this.IsHandleCreated)
                {
                    this.Invoke(md, new object[] { doData, diData });
                }
            }
            catch { }
        }
예제 #3
0
        void monitorAction(object source)
        {
            byte          diData = daq.InstantDi_Read();
            alarmDelegate md     = new alarmDelegate(alarmactive);

            // daq.EventCount_Read();
            try
            {
                if (this.IsHandleCreated)
                {
                    this.Invoke(md, new object[] { doData, diData });
                }
            }
            catch { }
        }
예제 #4
0
        void theout(object source)

        {
            byte          diData = daq.InstantDi_Read();
            alarmDelegate mdd    = new alarmDelegate(alarmactive);

            // daq.EventCount_Read();
            try
            {
                if (this.IsHandleCreated && !this.IsDisposed)
                {
                    this.Invoke(mdd, new object[] { doData, diData });
                }
            }
            catch { }
            //通道0  压力 pressure
            //通道1  水冲击力  waterHammer
            //通道2  温度
            //通道3  水泵压力输出值
            //modbus   流量
            double[] data = daq.InstantAi_Read(0, 4);

            double flow = mr.read_float("3002", 1);                               //读取3002地址的数据,单位立方米/s

            flow      = flow * 1000;                                              //转换成L/s
            flow      = flow + Convert.ToDouble(Properties.Settings.Default.m流量); //加上误差调整
            totalFlow = mr.read_double("3014", 1);                                //单位立方米
            totalFlow = totalFlow * 1000;                                         //单位:L
            data[4]   = flow;
            data[5]   = Math.Round(mr.read_short("8451", 2) / 100.0, 2);
            FLOW      = flow;
            data[2]   = data[2] * 10 + Convert.ToDouble(Properties.Settings.Default.m温度);
            if (loadDataFlag && (FLOW >= (double)startThreshold.Value))//大于阈值开始绘制曲线以及记录数据
            {
                l.Add(data[4]);
                if (wendu.Count < 1)
                {
                    wendu.Add(data[2]);
                }
                else if ((Math.Abs(data[2] - wendu[wendu.Count - 1]) <= 1 &&
                          data[2] < 50))
                {
                    wendu.Add(data[2]);
                }
                maxFlow      = l.Max();
                maxflow_pose = l.IndexOf(l.Max());
                //连续采样N个数据,去掉一个最大值和一个最小值然后计算N - 2个数据的算术平均值N值的选取:3~14
                //if (l.Count > 8)
                //{

                //    double sum = 0;
                //    List<double> temp = new List<double>();
                //    for (int i = 1; i < 8; i++)
                //    {
                //        temp.Add(l[l.Count - i]);
                //        sum += l[l.Count - i];
                //    }
                //    sum = sum - temp.Max() - temp.Min();
                //    l[l.Count - 4] = (sum / 5);
                //    if (l[l.Count - 4] > maxFlow) { maxFlow = l[l.Count - 4]; }
                //    maxflow_pose = l.IndexOf(l.Max()) ;
                //}
            }

            myDelegate md = new myDelegate(setText);

            // daq.EventCount_Read();
            // if (IsDisposed || !this.Parent.IsHandleCreated) return;
            try
            {
                if (this.IsHandleCreated && !this.IsDisposed)
                {
                    this.Invoke(md, new object[] { data });
                }
            }
            catch { }
        }