duheng
2025-02-11 36a0ce55799c95821f39aab5c13566a5f238970b
Calc/IStation.Calc.Model/AnaPrj.cs
@@ -1,6 +1,8 @@
 
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Reflection.Emit;
using System.Linq;
namespace IStation.CalcModel
{
@@ -27,19 +29,58 @@
                }
            }
        }
        public List<AnaPrjPointTime> GetAllPointTimeList()
        {
            List<AnaPrjPointTime> list = new List<AnaPrjPointTime>();
            if (this.BlockTimes != null)
            {
                foreach (var bt in this.BlockTimes)
                {
                    if (bt.PointTimes != null)
                    {
                        list.AddRange(bt.PointTimes);
                    }
                }
            }
            return list;
        }
        public double GetWaterLevelHByTime(DateTime time)
        {
            List<AnaPrjPointTime> list = new List<AnaPrjPointTime>();
            if (this.BlockTimes != null)
            {
                foreach (var bt in this.BlockTimes)
                {
                    if (bt.PointTimes == null)
                        continue;
                    foreach (var tp in bt.PointTimes)
                    {
                        if (tp.Time >= time)
                            return tp.WaterLevelH;
                    }
                }
            }
            return -1;
        }
        public DateTime StartTime { get; set; }
        public DateTime EndTime { get; set; }
        public string ID { get; set; }
        public string Name { get; set; }
        public string Name { get; set; } //流水号
        public string WaterLevelInfo { get; set; }
        public double SumFlow { get; set; }
        public double SumFlow { get; set; }//吨(计算值)
        public double SumPower { get; set; }
        public double SumMoney { get; set; }
        public double SumFlow4Disp { get { return Math.Round(SumFlow / 10000, 2); } }
        public double SumPower4Disp { get { return Math.Round(SumPower, 0); } }
        public double MaxWaterLevelH { get; set; }//最大水库水位
        public DateTime MaxWaterLevelTime { get; set; }//最大水库水位时间
        public int CalcSpaceMinute { get; set; }
@@ -54,14 +95,64 @@
            }
        }
        public List<int> EndTimeOpenPumpStatus { get; set; } //最后一刻的开泵状态:用于第二天调度计算
        public List<AnaPrjSwitchInfo> PumpSwitchs { get; set; }//泵操作信息
        public List<AnaPrjBlockTime> BlockTimes { get; set; }
        public List<AnaPrjPointTime> PointTimes { get; set; }
        public AnaPrjPointTime FingPointTime(DateTime time)
        /// <summary>
        /// 正好
        /// </summary>
        /// <param name="time"></param>
        /// <returns></returns>
        public AnaPrjPointTime FindPointTime(DateTime time)
        {
            return PointTimes.Find(x => x.Time == time);
            if (BlockTimes == null || BlockTimes.Count  == 0)
                return null;
            if(time > this.BlockTimes.Last().PointTimes.Last().Time.AddMinutes(-5))
            {
                return this.BlockTimes.Last().PointTimes.Last();
            }
            foreach (var bt in BlockTimes)
            {
                if (bt.PointTimes == null)
                    continue;
                var fff = bt.PointTimes.Find(x => x.Time == time);
                if(fff != null)
                    return fff;
            }
            return null;
        }
        /// <summary>
        /// 靠近
        /// </summary>
        /// <param name="time"></param>
        /// <returns></returns>
        public AnaPrjPointTime NearPointTime(DateTime time)
        {
            if(BlockTimes == null)
                return null;
            AnaPrjPointTime near_pt = null;
            double min_dis = 30;//最少30分
            foreach (var bt in BlockTimes)
            {
                if (bt.PointTimes == null)
                    continue;
                foreach(var pt in bt.PointTimes)
                {
                    var m = Math.Abs((time - pt.Time).TotalMinutes);
                    if (m < min_dis)
                    {
                        min_dis = m;
                        near_pt = pt;
                    }
                }
            }
            return near_pt;
        }
        //
        public bool IsFixed { get; set; } = false;
        public string Note { get;set; }
@@ -116,15 +207,29 @@
    public class AnaPrjBlockTime
    {
        public AnaPrjBlockTime() { }
        public AnaPrjBlockTime() {   }
        public AnaPrjBlockTime(AnaPrjBlockTime item) { 
            this.StartTime = item.StartTime;
            this.EndTime = item.EndTime;
            this.OpenPumpCount = item.OpenPumpCount;
            this.EndTime = item.EndTime;
            this.OpenPumpIndexs = item.OpenPumpIndexs;
            this.OpenPumpCount = item.OpenPumpCount;
            this.SumFlow = item.SumFlow;
            this.SumMoney = item.SumMoney;
            this.SumPower = item.SumPower;
        }
        public DateTime StartTime { get; set; }
        public DateTime EndTime { get; set; }
        public int OpenPumpCount { get; set; }
        public int ID { get;set; }
        public DateTime StartTime { get; set; }//时间
        public DateTime EndTime { get; set; }//结束时间
        public int StartTimeIndex { get; set; }//开始时角标
        public int EndTimeIndex { get; set; }//结束时角标
        public int OpenPumpCount { get; set; }//开泵数量
        public double ReservoirEndHeight { get; set; }//开始时的水位
        public double ReservoirStartHeight { get; set; }//结束时的水位
        public List<int> OpenPumpIndexs { get; set; }// 开泵情况
        public int StartSwitchGroupID { get; set; }//开始时对应的SwitchID
        public int EndSwitchGroupID { get; set; }//结束时对应的SwitchID
        public double SumFlow { get; set; }//已经考虑时间段  (累计值)
        public double SumPower { get; set; }//已经考虑时间段 (累计值 度)
@@ -133,7 +238,7 @@
        public double SumFlow4Disp { get { return Math.Round(SumFlow / 10000, 2); } }
        public double SumPower4Disp { get { return Math.Round(SumPower, 0); } }
        public List<AnaPrjPointTime> PointTimes { get; set; }
        //千吨水能耗
        public double QDSLN
@@ -230,12 +335,10 @@
        public double SumPower { get; set; }//用电量 , 考虑时间段
        public double SumMoney { get; set; }//费电 , 考虑时间段
        public double WaterLevelQ { get; set; }//前池液位
        public double WaterLevelH { get; set; }//水库液位
        public double WaterLevelQ { get; set; }//前池水位
        public double WaterLevelH { get; set; }//水库水位
        public double WaterLevelC { get; set; }//长江水位
        public double ReservoirDropFlowTotal { get; set; }//水库总供水量
@@ -243,4 +346,15 @@
        //public List<IStation.CalcModel.PumpTimeData> PumpDatas { get; set; } 
    }
    public class AnaPrjSwitchInfo
    {
        public AnaPrjSwitchInfo() { }
        //
        public int Index { get; set;}//顺序ID
        public int GroupID { get; set; }//分组ID
        public int PumpIndex { get; set; }//泵角标
        public DateTime Time { get; set; }//时间
        public int SwitchType { get; set; }//1 开机 0 关机
    }
}