tangxu
2022-11-02 05f522e321a742f03bf1e3e26edaeb5147da42f4
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace IStation.Calculation
{
    internal class shys南汇北泵站 : PlanAnaBaseCalculator
    {
        public shys南汇北泵站()
        {
            this._corpID = 4;
            this._dispatchAnaCalc = new IStation.Calculation.DispatchAna.Calculator_OptAna_SHYS_南汇北();
        }
 
        /// <summary>
        /// 测点字典(这个每个泵站都不一样)
        /// </summary>
        private Tuple<string, long> monitor出水总管1压力 = new Tuple<string, long>("_0402010503030107003", 739);
        private Tuple<string, long> monitor出水总管1瞬时流量 = new Tuple<string, long>("_0402010503030102003", 740);
        private Tuple<string, long> monitor出水总管2压力 = new Tuple<string, long>("_0402010503030207004", 742);
        private Tuple<string, long> monitor出水总管2瞬时流量 = new Tuple<string, long>("_0402010503030202003", 743);
        private Tuple<string, long> monitor进水总管1压力 = new Tuple<string, long>("_0402010503030107001", 733);
        private Tuple<string, long> monitor进水总管2压力 = new Tuple<string, long>("_0402010503030207002", 736);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="tagname"></param>
        /// <returns></returns>
        public override bool Is液位Monitor(string tagname)
        {
            return false;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="tagname"></param>
        /// <returns></returns>
        public override string GetMonitorNameByTag(string tagname)
        {
            if (monitor出水总管1压力.Item1 == tagname)
                return "出水总管1压力";
            if (monitor出水总管1瞬时流量.Item1 == tagname)
                return "出水总管1瞬时流量";
            if (monitor出水总管2压力.Item1 == tagname)
                return "出水总管2压力";
            if (monitor出水总管2瞬时流量.Item1 == tagname)
                return "出水总管2瞬时流量";
            if (monitor进水总管1压力.Item1 == tagname)
                return "进水总管1压力";
            if (monitor进水总管2压力.Item1 == tagname)
                return "进水总管2压力";
            return "未知测点";
        }
        /// <summary>
        /// 根据三高提供的参数,构建调度分析所需的参数, (这个每个泵站都不一样)
        /// </summary>
        /// <param name="allRecords_hour"></param>
        /// <param name="error_info"></param>
        /// <returns></returns>
        protected override DispatchAna.Model.RequestParasComplex BuildDispatchAnaRequest(
            List<IStation.Dto.MonitorRecord4SG> allRecords_hour,
            out string error_info)
        {
            if (allRecords_hour == null || allRecords_hour.Count == 0)
            {
                error_info = "南汇北泵站测点数据为空";
                return null;
            }
            var complex_dispatch_request = new DispatchAna.Model.RequestParasComplex();
            var inlet_press1 = allRecords_hour.Find(x => x.MonitorTag == monitor进水总管1压力.Item1);
            if (inlet_press1 == null)
            {
                error_info = "南汇北泵站进水总管1压力测点未找到";
                return null;
            }
            var inlet_press2 = allRecords_hour.Find(x => x.MonitorTag == monitor进水总管2压力.Item1);
            if (inlet_press2 == null)
            {
                error_info = "南汇北泵站进水总管2压力测点未找到";
                return null;
            }
 
 
            var pipe1_flow = allRecords_hour.Find(x => x.MonitorTag == monitor出水总管1瞬时流量.Item1);
            if (pipe1_flow == null)
            {
                error_info = "南汇北泵站水管道1流量测点未找到";
                return null;
            }
 
            var pipe1_press = allRecords_hour.Find(x => x.MonitorTag == monitor出水总管1压力.Item1);
            if (pipe1_press == null)
            {
                error_info = "南汇北泵站水管道1压力测点未找到";
                return null;
            }
 
 
            var pipe2_flow = allRecords_hour.Find(x => x.MonitorTag == monitor出水总管2瞬时流量.Item1);
            if (pipe2_flow == null)
            {
                error_info = "南汇北泵站水管道2流量测点未找到";
                return null;
            }
 
            var pipe2_press = allRecords_hour.Find(x => x.MonitorTag == monitor出水总管2压力.Item1);
            if (pipe2_press == null)
            {
                error_info = "南汇北泵站水管道2压力测点未找到";
                return null;
            }
 
 
            complex_dispatch_request.CorpID = this._corpID;
            complex_dispatch_request.StationID = this._stationID;
            complex_dispatch_request.SchemeNumber = 1;
            complex_dispatch_request.PressValueType = DispatchAna.Model.RequestParasComplex.ePressValueType.压力;
            complex_dispatch_request.InletPipePara = new List<DispatchAna.Model.InletPipePara>()
                        {
                            new DispatchAna.Model.InletPipePara()
                            {
                                Name="进口压力1", 
                                IsWaterLevel=false,
                                Value =  inlet_press1.RecordValue 
                            },
                            new DispatchAna.Model.InletPipePara()
                            {
                                Name="进口压力2",
                                IsWaterLevel=false,
                                Value =  inlet_press2.RecordValue
                            }
                        };
            complex_dispatch_request.OutletPipePara = new List<DispatchAna.Model.OutletPipePara>();
            complex_dispatch_request.OutletPipePara.Add(new DispatchAna.Model.OutletPipePara()
            {
                Name = "总管路1",
                IsWaterLevel = false,
                TargetFlow =  pipe1_flow.RecordValue ,
                TargetPress =  pipe1_press.RecordValue 
            });
            complex_dispatch_request.OutletPipePara.Add(new DispatchAna.Model.OutletPipePara()
            {
                Name = "总管路2",
                IsWaterLevel = false,
                TargetFlow =   pipe2_flow.RecordValue ,
                TargetPress =   pipe2_press.RecordValue 
            });
 
            error_info = null;
            return complex_dispatch_request;
        }
 
 
    }
}