Example #1
0
        public List <ElementId> GetOverWarnNodesElementsByTDepthNode(Document doc, WarnSettings warnSettings)
        {
            List <ElementId> results = new List <ElementId>();

            foreach (var node in MemorableData.Data.DepthNodeDatas.GetOverWarn(warnSettings, MemorableData.Data))
            {
                results.AddRange(GetElementIds(node.NodeCode, node.Depth, doc));
            }
            return(results);
        }
        private IEnumerable <T> getWarnResult(WarnSettings warnSettings, TDetail detail, double warnCoefficientMin)//, double warnCoefficientMax = double.NaN)
        {
            List <T> result = new List <T>();
            var      d      = Datas.FirstOrDefault();

            if (d == null)
            {
                return(result);
            }

            var totalHourRange = warnSettings.PressedPipeLineSubsidence_Day * 24;//检测项
            var endTime        = detail.IssueDateTime;
            var details        = Facade.GetDetailsByTimeRange(detail.IssueType, endTime.AddHours(-totalHourRange), endTime);
            var orderedDetails = details.OrderByDescending(c => c.IssueDateTime).ToList();
            var currentDetail  = detail;
            //需预警的节点
            //监测 warnSettings.PressedPipeLineSubsidence_SumMillimeter;
            var sumMillimeter = warnSettings.PressedPipeLineSubsidence_SumMillimeter;//检测项

            foreach (var data in Datas)
            {
                if (data.SumChanges_Float >= sumMillimeter * warnCoefficientMin)
                {
                    result.Add(data);
                }

                //if (double.IsNaN(overCoefficientMax))
                //{
                //    if (data.SumChanges_Float >= sumMillimeter * warnCoefficientMin)
                //        result.Add(data);
                //}
                //else
                //{
                //    if (data.SumChanges_Float >= sumMillimeter * warnCoefficientMin)
                //        && data.SumChanges_Float < sumMillimeter * overCoefficientMax)
                //        result.Add(data);
                //}
            }
            //监测 warnSettings.PressedPipeLineSubsidence_DailyMillimeter;
            //数据天数达标监测
            if (totalHourRange != 0)
            {
                var    dailyMillimeter        = warnSettings.PressedPipeLineSubsidence_PipelineMillimeter;//检测项
                double warnDailyMillimeterMin = dailyMillimeter * warnCoefficientMin;
                //double warnDailyMillimeterMax = 0;
                //if (!double.IsNaN(warnCoefficientMax))
                //{
                //    warnDailyMillimeterMax = dailyMillimeter * warnCoefficientMax;
                //}
                var tempTotalTimeRange = totalHourRange;
                int detailIndex        = 0;
                while (tempTotalTimeRange > 0)
                {
                    if (detailIndex == orderedDetails.Count())
                    {
                        throw new NotImplementedException("未满足监测报警要求的天数");
                    }
                    var nextDetail       = orderedDetails[detailIndex];
                    var currentTimeRange = (int)(currentDetail.IssueDateTime.AddMinutes(currentDetail.IssueTimeRange) - nextDetail.IssueDateTime.AddMinutes(nextDetail.IssueTimeRange)).TotalHours;
                    if (currentTimeRange <= tempTotalTimeRange)
                    {
                        tempTotalTimeRange -= currentTimeRange;
                    }
                    else
                    {
                        tempTotalTimeRange -= currentTimeRange;
                    }
                    currentDetail = nextDetail;
                    detailIndex++;
                }
                foreach (var data in Datas)
                {
                    if (result.Contains(data))
                    {
                        continue;
                    }

                    detailIndex   = 0;
                    currentDetail = detail;
                    int    days       = warnSettings.PressedPipeLineSubsidence_PipelineMillimeter;
                    double overHours  = 0;
                    double overValues = 0;
                    while (days > 0)
                    {
                        double dailyValue  = 0;
                        double hoursToDeal = 0;
                        if (overHours >= 24)
                        {
                            dailyValue  = overValues * 24 / overHours;
                            overValues -= dailyValue;
                            overHours  -= 24;
                        }
                        else
                        {
                            dailyValue  = overValues;
                            hoursToDeal = 24 - overHours;
                            while (hoursToDeal > 0)
                            {
                                var currentNodeData = currentDetail.NodeDatas.Datas.FirstOrDefault(c => c.NodeCode == data.NodeCode);
                                if (currentNodeData == null) //信息缺失,不作提醒处理  当前所需的节点数据不存在
                                {
                                    days        = -1;        //-1表信息缺失
                                    hoursToDeal = 0;
                                    break;
                                }
                                var    nextDetail       = orderedDetails[detailIndex];
                                double currentTimeRange = (currentDetail.IssueDateTime.AddMinutes(currentDetail.IssueTimeRange) - nextDetail.IssueDateTime.AddMinutes(nextDetail.IssueTimeRange)).TotalHours;
                                if (currentTimeRange <= hoursToDeal)
                                {
                                    dailyValue += (currentNodeData as T).CurrentChanges_Float;
                                }
                                else
                                {
                                    dailyValue += (currentNodeData as T).CurrentChanges_Float * (hoursToDeal / currentTimeRange);
                                    overHours   = currentTimeRange - hoursToDeal;
                                    overValues  = (currentNodeData as T).CurrentChanges_Float * (overHours / currentTimeRange);
                                }
                                hoursToDeal -= currentTimeRange;
                                detailIndex++;
                                currentDetail = nextDetail;
                            }
                        }
                        //时间已尽 检测是否到达预期值
                        if (days == -1)
                        {
                            break;
                        }
                        if (dailyValue >= warnDailyMillimeterMin)
                        {
                            days--;
                        }
                        else
                        {
                            days = -2;//-2表信息未到连续标准
                            break;
                        }
                        //if (!double.IsNaN(overCoefficientMax) && dailyValue > warnDailyMillimeterMax)
                        //{
                        //    days = -3;//-3表信息已过高限
                        //    break;
                        //}
                        //else if (dailyValue >= warnDailyMillimeterMin)
                        //    days--;
                        //else
                        //{
                        //    days = -2;//-2表信息未到连续标准
                        //    break;
                        //}
                    }
                    if (days == 0)//处理结束 认为按照标准的到达了日期0则各天检测通过
                    {
                        result.Add(data);
                    }
                }
            }
            return(result);
        }
 public IEnumerable <T> GetOverWarn(WarnSettings warnSettings, TDetail detail)
 {
     return(getWarnResult(warnSettings, detail, WarnSettings.OverCoefficient));
 }
Example #4
0
 private IEnumerable <T> getWarnResult(WarnSettings warnSettings, TDetail detail, double warnCoefficientMin)//, double warnCoefficientMax = double.NaN)
 {
     throw new NotImplementedException("该类型无可查看的构件内容");
 }
Example #5
0
        /// <summary>
        /// 只有warnCoefficientMin,表只有下界,过界则录入
        /// 有min和max则有上下界,界内录入
        /// </summary>
        /// <param name="warnSettings"></param>
        /// <param name="detail"></param>
        /// <param name="warnCoefficientMin"></param>
        /// <param name="warnCoefficientMax"></param>
        /// <returns></returns>
        private IEnumerable <T> getWarnResult(WarnSettings warnSettings, TDetail detail, double warnCoefficientMin)//, double warnCoefficientMax = double.NaN)
        {
            //算法
            List <T> result = new List <T>();
            var      d      = Datas.FirstOrDefault();

            if (d == null)
            {
                return(result);
            }

            var totalHourRange = 24;
            var endTime        = detail.IssueDateTime;
            var details        = Facade.GetDetailsByTimeRange(detail.IssueType, endTime.AddHours(-totalHourRange), endTime);
            var orderedDetails = details.OrderByDescending(c => c.IssueDateTime).ToList();
            var currentDetail  = detail;
            //需预警的节点
            var maxAxle = warnSettings.STBAP_MaxAxle;

            foreach (var data in Datas)
            {
                if (data.AxialForce_Float >= maxAxle * warnCoefficientMin)
                {
                    result.Add(data);
                }

                //if (double.IsNaN(warnCoefficientMax))
                //{
                //    if (data.AxialForce_Float >= maxAxle * warnCoefficientMin)
                //        result.Add(data);
                //}
                //else
                //{
                //    if (data.AxialForce_Float >= maxAxle * warnCoefficientMin
                //        && data.AxialForce_Float < maxAxle * warnCoefficientMax)
                //        result.Add(data);
                //}
            }
            var minAxle = warnSettings.STBAP_MinAxle;

            foreach (var data in Datas)
            {
                if (data.AxialForce_Float <= minAxle / warnCoefficientMin)
                {
                    result.Add(data);
                }

                //if (double.IsNaN(warnCoefficientMax))
                //{
                //    if (data.AxialForce_Float <= minAxle / warnCoefficientMin)
                //        result.Add(data);
                //}
                //else
                //{
                //    if (data.AxialForce_Float <= minAxle / warnCoefficientMin
                //        && data.AxialForce_Float > minAxle / warnCoefficientMax)
                //        result.Add(data);
                //}
            }
            return(result);
        }
Example #6
0
        public string CheckWarnSettings(WarnSettings warnSettings)
        {
            StringBuilder sb = new StringBuilder();

            switch (IssueType)
            {
            case EIssueType.建筑物沉降:
                //建筑物沉降
                if (warnSettings.BuildingSubsidence_Day == int.MinValue)
                {
                    sb.AppendLine(WarnSettings.Tag_BuildingSubsidence_Day + MessageSuffix);
                }
                if (warnSettings.BuildingSubsidence_DailyMillimeter == int.MinValue)
                {
                    sb.AppendLine(WarnSettings.Tag_BuildingSubsidence_DailyMillimeter + MessageSuffix);
                }
                if (warnSettings.BuildingSubsidence_SumMillimeter == int.MinValue)
                {
                    sb.AppendLine(WarnSettings.Tag_BuildingSubsidence_SumMillimeter + MessageSuffix);
                }
                return(sb.ToString());

            case EIssueType.地表沉降:
                //地表沉降
                if (warnSettings.SurfaceSubsidence_Day == int.MinValue)
                {
                    sb.AppendLine(WarnSettings.Tag_SurfaceSubsidence_Day + MessageSuffix);
                }
                if (warnSettings.SurfaceSubsidence_DailyMillimeter == int.MinValue)
                {
                    sb.AppendLine(WarnSettings.Tag_SurfaceSubsidence_DailyMillimeter + MessageSuffix);
                }
                if (warnSettings.SurfaceSubsidence_SumMillimeter == int.MinValue)
                {
                    sb.AppendLine(WarnSettings.Tag_SurfaceSubsidence_SumMillimeter + MessageSuffix);
                }
                return(sb.ToString());

            case EIssueType.管线沉降_有压:
                //管线沉降(有压)
                if (warnSettings.PressedPipeLineSubsidence_Day == int.MinValue)
                {
                    sb.AppendLine(WarnSettings.Tag_PressedPipeLineSubsidence_Day + MessageSuffix);
                }
                if (warnSettings.PressedPipeLineSubsidence_PipelineMillimeter == int.MinValue)
                {
                    sb.AppendLine(WarnSettings.Tag_PressedPipeLineSubsidence_PipelineMillimeter + MessageSuffix);
                }
                if (warnSettings.PressedPipeLineSubsidence_WellMillimeter == int.MinValue)
                {
                    sb.AppendLine(WarnSettings.Tag_PressedPipeLineSubsidence_WellMillimeter + MessageSuffix);
                }
                if (warnSettings.PressedPipeLineSubsidence_SumMillimeter == int.MinValue)
                {
                    sb.AppendLine(WarnSettings.Tag_PressedPPipeLineSubsidence_SumMillimeter + MessageSuffix);
                }
                return(sb.ToString());

            case EIssueType.管线沉降_无压:
                //管线沉降(无压)
                if (warnSettings.UnpressedPipeLineSubsidence_Day == int.MinValue)
                {
                    sb.AppendLine(WarnSettings.Tag_UnpressedPipeLineSubsidence_Day + MessageSuffix);
                }
                if (warnSettings.UnpressedPipeLineSubsidence_PipelineMillimeter == int.MinValue)
                {
                    sb.AppendLine(WarnSettings.Tag_UnpressedPipeLineSubsidence_PipelineMillimeter + MessageSuffix);
                }
                if (warnSettings.UnpressedPipeLineSubsidence_WellMillimeter == int.MinValue)
                {
                    sb.AppendLine(WarnSettings.Tag_UnpressedPipeLineSubsidence_WellMillimeter + MessageSuffix);
                }
                if (warnSettings.UnpressedPipeLineSubsidence_SumMillimeter == int.MinValue)
                {
                    sb.AppendLine(WarnSettings.Tag_UnpressedPipeLineSubsidence_SumMillimeter + MessageSuffix);
                }
                return(sb.ToString());

            case EIssueType.侧斜监测:
                //墙体水平位移(侧斜)
                if (warnSettings.SkewBack_WellMillimeter == int.MinValue)
                {
                    sb.AppendLine(WarnSettings.Tag_SkewBack_WellMillimeter + MessageSuffix);
                }
                if (warnSettings.SkewBack_StandardMillimeter == int.MinValue)
                {
                    sb.AppendLine(WarnSettings.Tag_SkewBack_StandardMillimeter + MessageSuffix);
                }
                if (warnSettings.SkewBack_Speed == int.MinValue)
                {
                    sb.AppendLine(WarnSettings.Tag_SkewBack_Speed + MessageSuffix);
                }
                if (warnSettings.SkewBack_Day == int.MinValue)
                {
                    sb.AppendLine(WarnSettings.Tag_SkewBack_Day + MessageSuffix);
                }
                return(sb.ToString());

            case EIssueType.钢支撑轴力监测:
                //钢支撑轴力
                if (warnSettings.STBAP_MaxAxle == int.MinValue)
                {
                    sb.AppendLine(WarnSettings.Tag_STBAP_MaxAxle + MessageSuffix);
                }
                if (warnSettings.STBAP_MinAxle == int.MinValue)
                {
                    sb.AppendLine(WarnSettings.Tag_STBAP_MinAxle + MessageSuffix);
                }
                return(sb.ToString());

            default:
                throw new NotImplementedException("尚未支持的类型");
            }
        }