tangxu
2024-04-30 26d8996e55c33186800031f7c305688035bb3182
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
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<AnaPrjBlockTime>();
                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<AnaPrjBlockTime> BlockTimes { get; set; }
        public List<AnaPrjPointTime> 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<AnaPrj>
        {
            private eCalcOptType sortType;
            public Comparer(eCalcOptType type)
            {
                sortType = type;
            }
 
            #region IComparer<FeatPoint> 成员
            int IComparer<AnaPrj>.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<AnaPrjBlockTime> 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; 
        }
        public AnaPrjPointTime(
            IStation.CalcModel.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;
        }
        public AnaPrjPointTime(IStation.CalcModel.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<IStation.CalcModel.PumpTimeData> PumpDatas { get; set; } 
    }
}