tangxu
2022-10-08 990a641f72d8ae753d5de70de97ccf7c6f5a90ff
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
using IStation.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace IStation.EtaCalculation.SMI.Station
{
    /// <summary>
    /// 所有泵  且都有独立的流量计 , 有 出口压力计, 有开机状态测点 , 有进口压力 
    /// </summary>
    public class EtaAnalyCalculator4南市水厂 : EtaAnalyCalculator泵站4都是独立流量计_有运行状态, IEtaStationAnalyCalculator
    {
        /// <summary>
        ///     
        /// </summary>
        /// <param name="context"></param>
        /// <param name="error_info"></param>
        /// <returns></returns>
        public override bool Calculate(EtaStationAnalyContextItem context, out string error_info)
        {
            if (context == null)
            {
                error_info = "上下文参数为空";
                return false;
            }
            this._threshold_flow = 50;//如果此泵开了,  防止零点飘流, 判断流量计值是否正常 
            this._stationID = context.ID;
 
            //初始化机泵
            if (!InitialPumpList(context, out error_info))
            { 
                return false;
            }
 
            //核心分析
            var stat8x = base.CalculateCore(context, out error_info);
            if (stat8x == false)
            { 
                return false;
            }
 
             
            //添加子管路分析结果
            //三条管路 1578576583663423488(南汇1)  123      1578576400481390592 南汇2号管 456      1578576274077650944 川沙管 (78910)
            var _sub_pipe_id = new long[] { 1578576583663423488, 1578576400481390592, 1578576274077650944 };//子管路ID
            return AddSubPipeAnaList(_sub_pipe_id);
        }
 
 
 
        #region  初始化机泵
        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        /// <param name="error_info"></param>
        /// <returns></returns>
        protected override bool InitialPumpList(Model.EtaStationAnalyContextItem context, out string error_info)
        {
            var monitor_id_pump_flow_array = new long[] { 1578578225339174912, 1578578226492608512, 1578578227692179456, 1578578228858195968, 1578578230078738432, 1578578231458664448, 1578578232800841728, 1578578234004606976, 1578578235476807680, 1578578236709933056 };// 流量计
            var monitor_id_run_status_array = new long[] { 1578578225230123008, 1578578226429693952, 1578578227629264896, 1578578228791087104, 1578578230015823872, 1578578231395749888, 1578578232742121472, 1578578233941692416, 1578578235413893120, 1578578236647018496 };//运行状态 
            var monitor_id_inlet_press_array = new long[] { 1578578225251094528, 1578578226446471168, 1578578227646042112, 1578578228812058624, 1578578230032601088, 1578578231412527104, 1578578232758898688, 1578578233958469632, 1578578235430670336, 1578578236663795712 };//进口压力计
            var monitor_id_outlet_press_array = new long[] { 1578578225305620480, 1578578226463248384, 1578578227662819328, 1578578228828835840, 1578578230049378304, 1578578231429304320, 1578578232771481600, 1578578233975246848, 1578578235447447552, 1578578236676378624 };//出口压力
            var monitor_id_motor_power_array = new long[] { 1578578225414672384, 1578578226568105984, 1578578227767676928, 1578578228933693440, 1578578230154235904, 1578578231534161920, 1578578232876339200, 1578578234080104448, 1578578235552305152, 1578578236751876096 };//瞬间功率
            var monitor_id_motor_frequence_array = new long[] { 1578578225355952128, 1578578226509385728, 1578578227708956672, 1578578228874973184, 1578578230095515648, 1578578231475441664, 1578578232817618944, 1578578234021384192, 1578578235493584896, 0 };//最后一台是工频泵
            var monitor_id_motor_zhuansu_array = new long[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };//转速
            var is液位代替进口压力 = false;
 
 
 
            //初始化机泵
            this._machineCount = 10;
            var machine_id_array = new long[] 
               { 1565518966233894912, 1565519456896159744, 
                1565519699792498688, 1565519918001164288, 1565520158938763264, 1565520282846892032, 
                1565520398509019136, 1565520554755231744, 1565520692710084608, 1565520809135575040 };
 
            this._allMachineList = InitialPumpMachineList(
                context,
                machine_id_array,//机泵ID 
                monitor_id_run_status_array,//运行状态 
                monitor_id_pump_flow_array,// 流量计
                is液位代替进口压力,
                monitor_id_inlet_press_array,//进口压力计
                monitor_id_outlet_press_array,//出口压力
                monitor_id_motor_power_array,//瞬间功率
                monitor_id_motor_frequence_array,//频率
                monitor_id_motor_zhuansu_array,//转速 
                       null,//电流
                out error_info);
            if (_allMachineList == null)
            {
                IStation.LogHelper.Error(error_info);
                return false ;
            }
 
 
 
            error_info = null;
            return true;
        }
        #endregion
 
        #region 子管路分析结果
        private bool AddSubPipeAnaList(long[] _sub_pipe_id)
        {
            this._pipeAnaResultList = new List<EtaMultiRealRecordPure>();
 
            EtaMultiRealRecordPure result_pipe_1 = new EtaMultiRealRecordPure();//一号管 分析结果
 
            result_pipe_1.ObjectType = IStation.ObjectType.PipeLine ;
            result_pipe_1.ObjectID = _sub_pipe_id[0]; 
            result_pipe_1.InitialRunList(this._machineCount);//用泵站总数量
            result_pipe_1.AnalyStatus =  Model.Eta.eAnalyStatus.Normal ;
 
            BuildConnectResult(null, result_pipe_1, 
                new List<IStation.Calculation.Eta.Model.PumpAnaResult>() { 
                    this._allMachineList[0], 
                    this._allMachineList[1],
                    this._allMachineList[2] });
            this._pipeAnaResultList.Add(result_pipe_1);
 
 
 
            EtaMultiRealRecordPure result_pipe_2 = new EtaMultiRealRecordPure();//2号管 分析结果 
            result_pipe_2.ObjectType = IStation.ObjectType.PipeLine;
            result_pipe_2.ObjectID = _sub_pipe_id[1]; 
            result_pipe_2.InitialRunList(this._machineCount);//用泵站总数量
            result_pipe_2.AnalyStatus = Model.Eta.eAnalyStatus.Normal;
 
            BuildConnectResult(null, result_pipe_2, new List<IStation.Calculation.Eta.Model.PumpAnaResult>() { this._allMachineList[3], this._allMachineList[4], this._allMachineList[5] });
            this._pipeAnaResultList.Add(result_pipe_2);
 
 
 
 
            EtaMultiRealRecordPure result_pipe_3 = new EtaMultiRealRecordPure();//一号管 分析结果 
            result_pipe_3.ObjectType = IStation.ObjectType.PipeLine;
            result_pipe_3.ObjectID = _sub_pipe_id[2]; 
            result_pipe_3.InitialRunList(this._machineCount);//用泵站总数量
            result_pipe_3.AnalyStatus = Model.Eta.eAnalyStatus.Normal;
 
            BuildConnectResult(null, result_pipe_3, new List<IStation.Calculation.Eta.Model.PumpAnaResult>() { this._allMachineList[6], this._allMachineList[7], this._allMachineList[8], this._allMachineList[9] });
            this._pipeAnaResultList.Add(result_pipe_3);
 
 
 
            return true ;
        }
 
        #endregion
    }
 
 
 
 
}