using System; using System.Collections.Generic; namespace IStation.CalcModel { public class AnaPrj { public AnaPrj() { } public AnaPrj(AnaPrj prj) { this.ID = prj.ID; this.Name = prj.Name; this.IsFixed = prj.IsFixed; this.SumMoney = prj.SumMoney; this.SumFlow = prj.SumFlow; this.SumPower = prj.SumPower; this.Note = prj.Note; this.StartTime = prj.StartTime; this.EndTime = prj.EndTime; this.CalcSpaceMinute = prj.CalcSpaceMinute; if (prj.BlockTimes != null) { this.BlockTimes = new List(); foreach (var item in prj.BlockTimes) { this.BlockTimes.Add(new AnaPrjBlockTime(item)); } } } public DateTime StartTime { get; set; } public DateTime EndTime { get; set; } public string ID { get; set; } public string Name { get; set; } public string WaterLevelInfo { 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 int CalcSpaceMinute { get; set; } //千吨水能耗 public double QDSLN { get { if (SumFlow == 0) return 0; return Math.Round(SumPower * 1000 / SumFlow, 1); } } public List BlockTimes { get; set; } public List PointTimes { get; set; } public AnaPrjPointTime FingPointTime(DateTime time) { return PointTimes.Find(x => x.Time == time); } public bool IsFixed { get; set; } = false; public string Note { get;set; } public int Type { get; set; }//0 表示分析得出 1 表示手动添加 //排序与比较 public class Comparer : IComparer { private eCalcOptType sortType; public Comparer(eCalcOptType type) { sortType = type; } #region IComparer 成员 int IComparer.Compare(AnaPrj obj1, AnaPrj obj2) { if (sortType == eCalcOptType.功率) { if (Math.Abs(obj1.SumPower - obj2.SumPower) < 0.1) { return 0; } else if (obj1.SumPower > obj2.SumPower) { return 1; } else { return -1; } } else { if (Math.Abs(obj1.SumMoney- obj2.SumMoney) < 0.1) { return 0; } else if (obj1.SumMoney > obj2.SumMoney) { return 1; } else { return -1; } } } #endregion } } public class AnaPrjBlockTime { public AnaPrjBlockTime() { } public AnaPrjBlockTime(AnaPrjBlockTime item) { this.StartTime = item.StartTime; this.EndTime = item.EndTime; this.OpenPumpCount = item.OpenPumpCount; } public DateTime StartTime { get; set; } public DateTime EndTime { get; set; } public int OpenPumpCount { 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 QDSLN { get { if(SumFlow == 0) return 0; return Math.Round(SumPower * 1000 / SumFlow, 1); } } public static AnaPrjBlockTime Find( List items, DateTime start) { if (items == null || items.Count == 0) return null; if(items.Count == 1) { return items[0]; } foreach(var item in items) { if(item.StartTime >= start ) { return item; } } return null; } } public class AnaPrjPointTime { public AnaPrjPointTime() { } public AnaPrjPointTime(AnaPrjPointTime rhs) { this.Time = rhs.Time; this.ReservoirDropFlowTotal = rhs.ReservoirDropFlowTotal; this.RealHead = rhs.RealHead; this.RealFlow = rhs.RealFlow; this.SumMoney = rhs.SumMoney; this.RealPower = rhs.RealPower; this.SumPower = rhs.SumPower; this.SumFlow = rhs.SumFlow; this.WaterLevelQ = rhs.WaterLevelQ; this.WaterLevelH = rhs.WaterLevelH; this.OpenPumpCount = rhs.OpenPumpCount; this.WaterLevelC = rhs.WaterLevelC; } internal AnaPrjPointTime( IStation.Calc.ErQuCalcBaseHelper.TimePoint t, IStation.CalcModel.StationTimeData td, int openPumpCount) { this.Time = t.Time; this.ReservoirDropFlowTotal = t.ReservoirDropFlowTotal; this.OpenPumpCount = openPumpCount; this.RealHead = td.Head; this.RealFlow = td.Flow; this.RealPower = td.Power; this.SumMoney = td.SumMoney; this.SumPower = td.SumPower; this.SumFlow = td.SumFlow; this.WaterLevelC = t.WaterLevelC; this.WaterLevelQ = Math.Round(td.WaterLevelQ, 2); this.WaterLevelH = Math.Round(td.WaterLevelH, 4); //this.PumpDatas = td.PumpDatas; } internal AnaPrjPointTime(IStation.Calc.ErQuCalcBaseHelper.TimePoint t ) { this.Time = t.Time; this.ReservoirDropFlowTotal = t.ReservoirDropFlowTotal; this.WaterLevelC = t.WaterLevelC ; this.WaterLevelQ = t.WaterLevelC ; } // public DateTime Time { get; set; } public int OpenPumpCount { get; set; } public double RealHead { get; set; } public double RealFlow { get; set; }//瞬时值, 不考虑时间段 public double RealPower { get; set; }//瞬时值, 不考虑时间段 public double SumFlow { get; set; }//流量 , 考虑时间段 public double SumPower { get; set; }//用电量 , 考虑时间段 public double SumMoney { get; set; }//费电 , 考虑时间段 public double WaterLevelQ { get; set; }//前池液位 public double WaterLevelH { get; set; }//水库液位 public double WaterLevelC { get; set; }//长江水位 public double ReservoirDropFlowTotal { get; set; }//水库总供水量 //public List PumpDatas { get; set; } } }