예제 #1
0
 /// <summary>
 /// 实时库是否连接正常
 /// </summary>
 /// <returns></returns>
 public bool RealTimeConnection()
 {
     return(m_RTDB.Connection());
 }
예제 #2
0
        internal void PorcessExceedLimit()
        {
            IKPI_OverLimitConfigDal dataAccess = new KPI_OverLimitConfigDal();

            try {
                m_DataAccess.Connection();
                //返回超限配置列表
                List <OverLimitConfigEntity> faultConfigurations = dataAccess.GetOverLimitConfigs();
                DateTime startDate, endDate;
                endDate   = DateTime.Now;
                endDate   = endDate.AddSeconds(-1 * endDate.Second);
                startDate = endDate.AddMinutes(-1 * 10);
                List <TagValue> tagAttributeList;
                double          high1, high2, high3;
                foreach (OverLimitConfigEntity faultConfiguration in faultConfigurations)
                {
                    StopLastShiftAlarm(faultConfiguration);                    //停止上一班未结束的报警
                    tagAttributeList = m_DataAccess.GetHistoryDataList(faultConfiguration.TagCode, startDate, endDate);
                    high1            = double.MaxValue;
                    high2            = double.MaxValue;
                    high3            = double.MaxValue;

                    if (tagAttributeList.Count <= 0)
                    {
                        continue;
                    }
                    if (faultConfiguration.FirstLimitingValue != null)
                    {
                        high1 = Convert.ToDouble(faultConfiguration.FirstLimitingValue.Value);                                                                   //高1限值
                    }
                    if (faultConfiguration.SecondLimitingValue != null)
                    {
                        high2 = Convert.ToDouble(faultConfiguration.SecondLimitingValue.Value);                                                                    //高2限值
                    }
                    if (faultConfiguration.ThirdLimitingValue != null)
                    {
                        high3 = Convert.ToDouble(faultConfiguration.ThirdLimitingValue.Value);                                                                   //高3限值
                    }
                    //超高3
                    var q = (from p in tagAttributeList where p.TagDoubleValue > high3 select p);
                    if (q.Count() > 0)
                    {
                        H3(faultConfiguration, tagAttributeList, high3);
                    }
                    q = (from p in tagAttributeList where p.TagDoubleValue <= high3 select p);
                    if (q.Count() > 0)
                    {
                        StopAlarm(faultConfiguration, 3, tagAttributeList.First().TimeStamp);
                    }
                    //超高2
                    q = (from p in tagAttributeList where p.TagDoubleValue > high2 && p.TagDoubleValue <= high3 select p);
                    if (q.Count() > 0)
                    {
                        H2(faultConfiguration, tagAttributeList, high2, high3);
                    }
                    q = (from p in tagAttributeList where p.TagDoubleValue <= high2 select p);
                    if (q.Count() > 0)
                    {
                        StopAlarm(faultConfiguration, 2, tagAttributeList.First().TimeStamp);
                    }

                    //超高1
                    q = (from p in tagAttributeList where p.TagDoubleValue > high1 && p.TagDoubleValue <= high2 select p);
                    if (q.Count() > 0)
                    {
                        H1(faultConfiguration, tagAttributeList, high1, high2);
                    }
                    q = (from p in tagAttributeList where p.TagDoubleValue <= high1 select p);
                    if (q.Count() > 0)
                    {
                        StopAlarm(faultConfiguration, 1, tagAttributeList.First().TimeStamp);
                    }
                }
            }
            catch (Exception ex) {
                LogUtil.LogMessage(string.Format("安全指标超限报警计算错误,错误信息是:{0},调用栈信息是:{1}",
                                                 ex.Message, ex.StackTrace));
            }
        }