yangyin
2024-11-03 144f2cfce3bf16c1c8ad53b0ca2ee91e4c93b492
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Runtime.InteropServices.JavaScript.JSType;
 
namespace DPumpHydr.WinFrmUI.Volute.ViewModel
{
    public class SectionBaseInfo
    {
        /// <summary>
        /// 截面形状类型 
        /// </summary>
        public eSectionShapeType ShapeType { get; set; }
 
        /// <summary>
        /// 平均流速
        /// </summary>
        public double V3 { get; set; }
 
        /// <summary>
        /// 开始截面编号
        /// </summary>
        public int StartSectionNumber { get; set; }
 
        public List<double> GaMa1 { get; set; }
        public List<double> GaMa2{ get; set;}
        public List<double> Area { get; set; }
 
        //断面信息
        public List<int> Index { get; set; }//断面序号  第8断面就是8 第一断面就是1
        public List<double> H { get; set; }//高度
        public double R_out { get; set; }//外围的半径 
        public List<double> R_Left { get; set; }//角度1边对应的圆角半径 UG中R1
        public List<double> R_Right { get; set; }//角度2边对应的圆角半径 UG中R2
        public double BaseWidth { get; set; }//底部宽度 就是B3
        public double BaseCircleRadius { get; set; }//底部圆半径 就是D3/2
 
        /// <summary>
        /// 计算平均流速
        /// </summary>
        /// <param name="hdr_info"></param>
        /// <param name="geom_info"></param>
        public void CalcV3(HdrBaseInfo hdr_info, GeomBaseInfo geom_info)
        {
            //UG里面用的是 m_H应该错了
            var g = 9.81;
            this.V3 = Math.Round(geom_info.K3 * Math.Sqrt(2 * g * hdr_info.Q), 2);
        }
        /// <summary>
        /// 计算面积
        /// </summary>
        /// <param name="hdr_info"></param>
        /// <param name="geom_info"></param>
        /// <param name="v3"></param>
        public void CalcArea(HdrBaseInfo hdr_info, GeomBaseInfo geom_info, double v3)
        {
            this.V3 = v3;
            var area8 = Math.Round(hdr_info.Q * 1000000 / (3600 * v3), 1);
            int i = 0;
            if (this.Area == null)
            {
                this.GaMa1 = new List<double>(10);
                this.GaMa2 = new List<double>(10);
                this.Area = new List<double>(10);
                for (i = 0; i < 10; i++)
                {
                    this.GaMa1.Add(0);
                    this.GaMa2.Add(0);
                    this.Area.Add(0);
                }
            }
            this.Area[8] = area8;
 
            if (geom_info.IsQieYuJiYuan)
            {//隔舌切于基圆
                for (i = StartSectionNumber; i < 8; i++)
                    Area[i] = Math.Round(area8 * (45 * i - geom_info.FAI0) / (360 - geom_info.FAI0), 1);
            }
            else
            {//采用正常切面
                for (i = StartSectionNumber; i < 8; i++)
                    Area[i] = Math.Round(area8 * 45 * i / 360, 1);
            }
 
            if (StartSectionNumber == 2)
                Area[1] = Area[2];
            Area[0] = Area[1];
        }
        /// <summary>
        /// 初始化形状类型
        /// </summary>
        /// <param name="hdr_info"></param>
        /// <param name="geom_info"></param>
        /// <param name="shapeType"></param>
        public void IntialShapeType(HdrBaseInfo hdr_info, GeomBaseInfo geom_info, eSectionShapeType shapeType)
        {
            this.ShapeType = shapeType;
 
            double m_gama81, m_gama82;
            switch (shapeType)
            {
                case eSectionShapeType.对称:
                    m_gama81 = 15.0;
                    m_gama82 = 15.0;
                    break;
                case eSectionShapeType.不对称:
                    m_gama81 = 15.0;
                    m_gama82 = 30.0;
                    break;
                case eSectionShapeType.矩形:
                    m_gama81 = 0.0;
                    m_gama82 = 0.0;
                    break;
                default:
                    m_gama81 = 0.0;
                    m_gama82 = 0.0;
                    break;
            }
 
 
            InitialGama(hdr_info, geom_info, m_gama81, m_gama82);//设置gama r1 /gama r2
        }
        /// <summary>
        /// 初始化gama
        /// </summary>
        /// <returns></returns>
        public string InitialGama(HdrBaseInfo hdr_info, GeomBaseInfo geom_info, double m_gama81, double m_gama82)
        {
            if (this.GaMa1 == null)
            {
                this.GaMa1 = new List<double>(10);
                this.GaMa2 = new List<double>(10);
                this.Area = new List<double>(10);
                for (int i = 0; i < 10; i++)
                {
                    this.GaMa1.Add(0);
                    this.GaMa2.Add(0);
                    this.Area.Add(0);
                }
            }
            if (ShapeType == eSectionShapeType.矩形)//断面形状:矩形
            {
                for (int i = 0; i < GaMa1.Count; i++)
                {
                    this.GaMa1[i] = 0;
                    this.GaMa2[i] = 0;
                }
 
                return null;
            }
 
            if ((m_gama81 < 8.0) || (m_gama82 < 8.0))
            {
                return "输入的第8断面的角度过小,请重新输入";
            }
            this.GaMa1[8] = m_gama81;
            this.GaMa2[8] = m_gama82;
 
            this.GaMa1[7] = m_gama81 - 1;
            this.GaMa2[7] = m_gama82 - 1;
 
            this.GaMa1[6] = m_gama81 - 2;
            this.GaMa2[6] = m_gama82 - 2;
 
            this.GaMa1[5] = m_gama81 - 3;
            this.GaMa2[5] = m_gama82 - 3;
 
            this.GaMa1[4] = m_gama81 - 4;
            this.GaMa2[4] = m_gama82 - 4;
 
            this.GaMa1[3] = m_gama81 - 5;
            this.GaMa2[3] = m_gama82 - 5;
 
            this.GaMa1[2] = m_gama81 - 6;
            this.GaMa2[2] = m_gama82 - 6;
 
            this.GaMa1[1] = m_gama81 - 7;
            this.GaMa2[1] = m_gama82 - 7;
 
 
            if (geom_info.FAI0 > 45)//没有第一端面        
            {
                this.GaMa1[1] = 0;
                this.GaMa2[1] = 0;
            }
 
            return null;
        }
        /// <summary>
        /// 初始化1-8断面参数
        /// </summary>
        public void InitialAllParameters(HdrBaseInfo BaseInfo , GeomBaseInfo geom_info )
        {
            this.Index = new List<int>(10);
            this.H = new List<double>(10);
            this.R_Left = new List<double>(10);
            this.R_Right = new List<double>(10);
            bool isFirst = true;
            for (int i = 0; i < 10; i++)
            {
                this.Index.Add(0);
                this.Index[i] = i;
                this.H.Add(0);
                this.R_Left.Add(0);
                this.R_Right.Add(0);
                if(i == 0 )
                {
                    continue;
                }
                CalcHeightByArea(geom_info, Index[i]);
            }
            for (int i = 8; i > 0; i--)
            {
                CalculateR(BaseInfo, geom_info, Index[i], isFirst);
                if (isFirst)
                {
                    isFirst = false;
                }
            }
 
        }
        /// <summary>
        /// 根据面积计算高度
        /// </summary>
        public void CalcHeightByArea(GeomBaseInfo geom_info, int index)
        {
            double a = (Math.Tan(this.GaMa1[index] * Math.PI / 180) + Math.Tan(this.GaMa2[index] * Math.PI / 180)) / 2;
            double b = geom_info.B3;
 
            double c = (90 + this.GaMa2[index]) / 360 * Math.PI * this.R_Left[index] * this.R_Left[index] + (90 + this.GaMa1[index]) / 360 * Math.PI * this.R_Right[index] * this.R_Right[index]
                - this.R_Left[index] * this.R_Left[index] * Math.Tan((45 + this.GaMa2[index] / 2) * Math.PI / 180) - this.R_Right[index] * this.R_Right[index] * Math.Tan((45 + this.GaMa1[index] / 2) * Math.PI / 180) - this.Area[index];
            double delta = b * b - 4 * a * c;
            if (delta < 0)
            {
                this.H[index] = -1;
                return;
            }
            if (this.ShapeType == eSectionShapeType.矩形)//矩形
            {
                this.H[index] = Math.Round((-c / b), 1) ;
                return ;
            }
            else
            {
                if (delta < 0)
                {
                    this.H[index] = -1;
                    return;
                }
                this.H[index] = Math.Round((-b + Math.Sqrt(delta)) / (2 * a), 1);
                return ;
            }
        }
        /// <summary>
        /// 断面参数计算
        /// </summary>
        private double DecreaseR = 0.5;
        public bool CalculateR(HdrBaseInfo BaseInfo ,GeomBaseInfo geom_info, int index, bool isFirst)
        {
            this.BaseWidth = geom_info.B3;
            this.BaseCircleRadius = geom_info.D3 / 2;
            if (!isFirst)
            {
                this.R_Left[index] = this.R_Left[index+1] - DecreaseR;
                this.R_Right[index] = this.R_Right[index+1] - DecreaseR;
 
                if (this.R_Left[index] > (this.H[index] + 1))
                    this.R_Left[index] = Math.Round(this.H[index] * 0.85 - 1, 0);
                if (this.R_Right[index] > (this.H[index] + 1))
                    this.R_Right[index] = Math.Round(this.H[index] * 0.85 - 1, 0);
 
                if (this.R_Left[index] < 2)
                    this.R_Left[index] = 2;
                if (this.R_Right[index] < 2)
                    this.R_Right[index] = 2;
            }
            else//是第一次计算
            {
 
                //赋值:R1 R2 R3 R4 
                if (this.ShapeType == eSectionShapeType.对称) //type=0:对称梯形
                    this.R_Left[index] = Math.Round(geom_info.B3 * 0.55 + 0.5 - 4, 0);
                else if (this.ShapeType == eSectionShapeType.不对称)//type=1:不对称梯形
                    this.R_Left[index] = Math.Round(geom_info.B3 * 0.55 + 0.5 - 4, 0);
                else if (this.ShapeType == eSectionShapeType.矩形)//type=2:矩形
                    this.R_Left[index] = Math.Round(geom_info.B3 * 0.4 + 0.5 - 2, 0);
 
 
                if (BaseInfo.IsSXB)
                    this.R_Left[index] = Math.Round(this.R_Left[index] / 2, 0);
                //if (DesignMode == YSSnxOpen::DesignMode::AssPawuQnshQw1)
                //{
                //    R_Left = int(R_Left * 0.7);
                //}
                double m_R3 = 0;
                double t = 0;
                if (geom_info.B3 <= 35)
                    m_R3 = 5;
                else if (geom_info.B3 <= 60 && geom_info.B3 > 35)
                {
                    t = Math.Round(geom_info.B3 * 0.6, 0) - Math.Round(geom_info.B3 * 0.6 / 10.0, 0) * 10;
                    if (t <= 2)
                        m_R3 = Math.Round(geom_info.B3 * 0.6 / 10.0, 0) * 10;
                    else if (t > 2 && t <= 7)
                        m_R3 = Math.Round(geom_info.B3 * 0.6 / 10.0, 0) * 10 + 5;
                    else if (t > 7)
                        m_R3 = Math.Round(geom_info.B3 * 0.6 / 10.0, 0) * 10 + 10;
                }
                else if (geom_info.B3 > 60 && geom_info.B3 <= 90)
                {
                    t = Math.Round(geom_info.B3 * 0.9, 0) - Math.Round(geom_info.B3 * 0.9 / 10.0, 0) * 10;
                    if (t <= 2)
                        m_R3 = Math.Round(geom_info.B3 * 0.9 / 10.0, 0) * 10;
                    else if (t > 2 && t <= 7)
                        m_R3 = Math.Round(geom_info.B3 * 0.9 / 10.0, 0) * 10 + 5;
                    else if (t > 7)
                        m_R3 = Math.Round(geom_info.B3 * 0.9 / 10.0, 0) * 10 + 10;
                }
                else if (geom_info.B3 > 90)
                {
                    t = Math.Round(geom_info.B3 * 0.3, 0) - Math.Round(geom_info.B3 * 0.3 / 10.0, 0) * 10;
                    if (t <= 2)
                        m_R3 = Math.Round(geom_info.B3 * 0.3 / 10.0, 0) * 10;
                    else if (t > 2 && t <= 7)
                        m_R3 = Math.Round(geom_info.B3 * 0.3 / 10.0, 0) * 10 + 5;
                    else if (t > 7)
                        m_R3 = Math.Round(geom_info.B3 * 0.3 / 10.0, 0) * 10 + 10;
                }
 
                this.R_Right[index] = this.R_Left[index];
                R_out = 1000.0;
 
                //截面R1 和 R4的减少角度 DecreaseR
                if (geom_info.B3 < 15)
                {
                    DecreaseR = 0.5;
                }
                else if (geom_info.B3 >= 15 && geom_info.B3 < 25)
                {
                    DecreaseR = 1;
                }
                else if (geom_info.B3 >= 25 && geom_info.B3 < 45)
                {
                    DecreaseR = 1.5;
                }
                else if (geom_info.B3 >= 45)
                {
                    DecreaseR = 2;
                }
 
                if (BaseInfo.IsSXB)
                    DecreaseR = 1;
            }
 
            return true;
        }
 
        
 
        public void EditSingleShape(SectionShapePara sectionShapePara,int index)
        {
            this.GaMa1[index] = sectionShapePara.Gama_Left;
            this.GaMa2[index] = sectionShapePara.Gama_Right;
            this.H[index] = sectionShapePara.H;
            this.R_out = sectionShapePara.R_out;
            this.R_Left[index] = sectionShapePara.R_Left;
            this.R_Right[index] = sectionShapePara.R_Right;
        }
 
    }
}