Exemple #1
0
        private List <OverLimitConfigEntity> GetOverLimitConfigList()
        {
            IKPI_OverLimitConfigDal      dataAccess = new KPI_OverLimitConfigDal();
            List <OverLimitConfigEntity> faultOverLimitConfigList = dataAccess.GetOverLimitConfigs();

            return(faultOverLimitConfigList);
        }
Exemple #2
0
        internal void ReCalcuateOverLimit(DateTime StartDate, DateTime EndDate)
        {
            IKPI_OverLimitConfigDal dataAccess = new KPI_OverLimitConfigDal();

            try {
                //返回超限配置列表
                List <OverLimitConfigEntity> faultConfigurations = dataAccess.GetOverLimitConfigs();
                if (faultConfigurations == null)
                {
                    m_Logger.Info("数据库不存在超限配置");
                    return;
                }

                //endDate = DateTime.Now;
                //endDate = endDate.AddSeconds(-1 * endDate.Second);
                //startDate = endDate.AddMinutes(-1 * AlarmInterval);
                //startDate = new DateTime(2013, 11, 28, 4, 30, 0);
                //endDate = new DateTime(2013, 11, 28, 4, 40, 0);
                List <TagValue> tagAttributeList;
                //faultConfigurations = faultConfigurations.Where(p => p.TagCode == @"\mjdc\DCS1\TE_31251F_PV").ToList<KPI_OverLimitConfig>();
                foreach (OverLimitConfigEntity faultConfiguration in faultConfigurations)
                {
                    //StopLastShiftAlarm(faultConfiguration);//停止上一班未结束的报警
                    if (UnitIsRunning(faultConfiguration.UnitID) == false)
                    {
                        continue;
                    }
                    tagAttributeList = RTDataAccess.GetHistoryDataList(faultConfiguration.TagCode, StartDate, EndDate);
                    if (tagAttributeList == null)
                    {
                        m_Logger.InfoFormat("读取测点{0}{1}信息失败!", faultConfiguration.TagCode, faultConfiguration.TagDesc);
                        continue;
                    }
                    tagAttributeList = tagAttributeList.OrderBy(p => p.TimeStamp).ToList <TagValue>();
                    //StopPreviousAlarm(faultConfiguration, tagAttributeList);//停止前一轮起报的报警
                    CalcAlarm(faultConfiguration, tagAttributeList);//计算报警
                }
            }
            catch (Exception ex) {
                m_Logger.InfoFormat("PorcessExceedLimit安全指标超限报警计算错误,错误信息是:{0},调用栈信息是:{1}",
                                    ex.Message, ex.StackTrace);
                m_Logger.Error(ex);
            }
        }
Exemple #3
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));
            }
        }