chenn
2025-03-28 9dba1b6adc0bbb4aa8cc531f4e6d822bf1a56be3
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
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks; 
 
namespace DPumpHydr.WinFrmUI.Volute.ViewModel
{
    public class SectionBundleInfo
    {
        public SectionBundleInfo() 
        {
            this.GaMa_Left = new List<double>(10);
            this.GaMa_Right = new List<double>(10);
            this.Area = new List<double>(10);
            this.H = new List<double>(10);
            this.R_Left = new List<double>(10);
            this.R_Right = new List<double>(10);
            for (int i = 0; i < 10; i++)
            {
                this.GaMa_Left.Add(0);
                this.GaMa_Right.Add(0);
                this.Area.Add(0);
                this.H.Add(0);
                this.R_Left.Add(0);
                this.R_Right.Add(0);
            }
        }
        public SectionBundleInfo Copy()
        {
            return new SectionBundleInfo
            {
                GaMa_Left = this.GaMa_Left != null ? new List<double>(this.GaMa_Left) : null,
                GaMa_Right = this.GaMa_Right != null ? new List<double>(this.GaMa_Right) : null,
                Area = this.Area != null ? new List<double>(this.Area) : null,
                H = this.H != null ? new List<double>(this.H) : null,
                R_Left = this.R_Left != null ? new List<double>(this.R_Left) : null,
                R_Right = this.R_Right != null ? new List<double>(this.R_Right) : null,
                BaseWidth = this.BaseWidth,
                ShapeType = this.ShapeType,
                V3 = this.V3,
                K3 = this.K3,
                StartSectionNumber = this.StartSectionNumber,
                BaseCircleRadius = this.BaseCircleRadius,
                R_out = this.R_out
 
            };
        }
 
        public bool IsSame(SectionBundleInfo para)
        {
            if (para == null)
                return false;
 
 
            if (this.ShapeType != para.ShapeType)
                return false;
            if (this.V3 != para.V3)
                return false;
            if (this.K3 != para.K3)
                return false;
 
            if (para.H == null || this.H == null || para.H.Count != this.H.Count)
                return false;
            for(int i=0;i< para.H.Count; i++)
            {
                if (para.H[i] != this.H[i])
                    return false;
            }
 
            if (para.GaMa_Left == null || this.GaMa_Left == null || para.GaMa_Left.Count != this.GaMa_Left.Count)
                return false;
            for (int i = 0; i < para.GaMa_Left.Count; i++)
            {
                if (para.GaMa_Left[i] != this.GaMa_Left[i])
                    return false;
            }
 
            if (para.GaMa_Right == null || this.GaMa_Right == null || para.GaMa_Right.Count != this.GaMa_Right.Count)
                return false;
            for (int i = 0; i < para.GaMa_Right.Count; i++)
            {
                if (para.GaMa_Right[i] != this.GaMa_Right[i])
                    return false;
            }
 
 
            if (para.R_Left == null || this.R_Left == null || para.R_Left.Count != this.R_Left.Count)
                return false;
            for (int i = 0; i < para.R_Left.Count; i++)
            {
                if (para.R_Left[i] != this.R_Left[i])
                    return false;
            }
 
            if (para.R_Right == null || this.R_Right == null || para.R_Right.Count != this.R_Right.Count)
                return false;
            for (int i = 0; i < para.R_Right.Count; i++)
            {
                if (para.R_Right[i] != this.R_Right[i])
                    return false;
            }
 
            return true;
        }
        /// <summary>
        /// 截面形状类型  0对称 1不对称 2矩形
        /// </summary>
        public eSectionShapeType ShapeType { get; set; } = eSectionShapeType.对称;
 
        /// <summary>
        /// 平均流速
        /// </summary>
        public double V3 { get; set; }
 
        /// <summary>
        /// 速度系数
        /// </summary>
        public double K3 { get; set; }
        /// <summary>
        /// 开始截面编号
        /// </summary>
        public int StartSectionNumber { get; set; }
        /// <summary>
        /// 左侧gama角度 1开始
        /// </summary>
        public List<double> GaMa_Left { get; set; }
        /// <summary>
        /// 右侧gama角度 1开始
        /// </summary>
        public List<double> GaMa_Right{ get; set;}
        /// <summary>
        /// 断面面积 1开始
        /// </summary>
        public List<double> Area { get; set; }
 
        //断面信息 
        /// <summary>
        /// 高度 1开始
        /// </summary>
        public List<double> H { get; set; }
        /// <summary>
        /// 外围的半径 
        /// </summary>
        public double R_out { get; set; }
        /// <summary>
        /// 角度1边对应的圆角半径 UG中R1 1开始
        /// </summary>
        public List<double> R_Left { get; set; }
        /// <summary>
        /// 角度2边对应的圆角半径 UG中R2 1开始
        /// </summary>
        public List<double> R_Right { get; set; }
        /// <summary>
        /// 底部宽度 就是B3
        /// </summary>
        public double BaseWidth { get; set; }
        /// <summary>
        /// 底部圆半径 就是D3/2
        /// </summary>
        public double BaseCircleRadius { get; set; }
 
        /// <summary>
        /// 从所有断面参数中获取到单个断面的参数
        /// </summary>
        /// <param name="index">第几断面</param>
        /// <returns></returns>
        public SectionShapePara ToSectionShapePara(int index)
        {
            SectionShapePara model = new SectionShapePara();
            model.Index = index;
            model.Gama_Left = this.GaMa_Left[index];
            model.Gama_Right = this.GaMa_Right[index];
            model.H = this.H[index];
            model.R_out = this.R_out;
            model.R_Left = this.R_Left[index];
            model.R_Right = this.R_Right[index];
            model.ShapeType = this.ShapeType; 
            model.BaseWidth = this.BaseWidth;
            model.SectionArea = this.Area[index];
            model.BaseCircleRadius = this.BaseCircleRadius;
            return model;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public void FromSectionShapePara(SectionShapePara model)
        {
            var index = model.Index;
            this.GaMa_Left[index] = model.Gama_Left;
            this.GaMa_Right[index] = model.Gama_Right;
            this.H[index] = model.H;
            this.R_Left[index] = model.R_Left;
            this.R_Right[index] = model.R_Right;
        }
        public void InitialK3(HdrBaseInfo hdr_info, GeomBaseInfo gemo_info)
        {
            //计算并设置K3
            if (hdr_info.ns < 170)
                K3 = Math.Round((69.1549 - 0.446605 * hdr_info.ns + 0.0014497 * hdr_info.ns * hdr_info.ns) / 100, 3);
            else
                K3 = 0.35;//0.347;
 
            if (hdr_info.ShapeType == 2)
                K3 = Math.Round(K3 * 0.9, 3);//0.8 环形
 
            //自己添加的,防止双吸泵截面过小
            if (hdr_info.IsSXB)
                K3 = Math.Round(K3 * 0.85, 3);// 双吸泵
                                              //排污泵
                                              //if (DesignMode == YSSnxOpen::DesignMode::AssPawuQnshQw1)
                                              //{
                                              //    K3 = K3 * 0.75;
                                              //}
 
 
                                             
                                 
            var g = 9.81;
            this.V3 = Math.Round(K3 * Math.Sqrt(2 * g * hdr_info.H), 2); // 计算平均流速
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sectionShapePara"></param>
        /// <param name="index"></param>
        public void SetShapeInfo(SectionShapePara sectionShapePara, int index)
        {
            this.GaMa_Left[index] = sectionShapePara.Gama_Left;
            this.GaMa_Right[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;
        }
       
        
 
        /// <summary>
        /// 计算初始化所有参数
        /// </summary>
        /// <param name="hdr_info"></param>
        /// <param name="geom_info"></param>
        /// <param name="v3"></param>
        public void ResetAllParas(HdrBaseInfo hdr_info, GeomBaseInfo geom_info )
        {
            this.R_out = 1500.0;
            if (geom_info.D3 > 1000)
                this.R_out = 6000.0;
            else if (geom_info.D3 > 500)
                this.R_out = 3000.0;
            else if (geom_info.D3 > 300)
                this.R_out = 2000.0;
            else
                this.R_out = 1500.0;
 
            InitialK3(hdr_info, geom_info);
 
            this.BaseWidth = geom_info.B3;
            this.BaseCircleRadius = geom_info.D3 / 2;
 
            //
            InitialChamferR(hdr_info, geom_info);
 
            //
            InitialGama(hdr_info, geom_info);
 
            //
            CalcParaV3(hdr_info, geom_info );
 
            //
            CheckChamferR();
        }
        
        public void RecalculateArea(HdrBaseInfo hdr_info, GeomBaseInfo geom_info)
        {
            CalcAllArea(hdr_info, geom_info);
            for (int i = 1; i <= 8; i++)
            {
                CalcHeightByArea(geom_info, i);
            }
            CheckChamferR();
        }
        /// <summary>
        /// V3改了, 重新计算面积和高度
        /// </summary>
        /// <param name="hdr_info"></param>
        /// <param name="geom_info"></param>
        /// <param name="v3"></param>
        public void CalcParaV3(HdrBaseInfo hdr_info, GeomBaseInfo geom_info )
        { 
            this.BaseWidth = geom_info.B3;
            this.BaseCircleRadius = geom_info.D3 / 2;
 
            //
            CalcAllArea(hdr_info, geom_info);
 
            //计算高度H
            for (int i = 1; i <= 8; i++)
            {
                CalcHeightByArea(geom_info, i);
            }
 
            CheckChamferR();
        }
 
 
        /// <summary>
        /// 计算面积
        /// </summary>
        /// <param name="hdr_info"></param>
        /// <param name="geom_info"></param>
        private void CalcAllArea(HdrBaseInfo hdr_info, GeomBaseInfo geom_info)
        {
            var area8 = Math.Round(hdr_info.Q * 1000000 / (3600 * this.V3), 1);
            this.Area[8] = area8;
            int i = 0;
            // 
            //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>
        /// 初始化gama
        /// </summary>
        /// <returns></returns>
        public string InitialGama(HdrBaseInfo hdr_info, GeomBaseInfo geom_info )
        {
            double m_gama81, m_gama82;
            switch (this.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;
            }
 
 
            if (ShapeType == eSectionShapeType.矩形)//断面形状:矩形
            {
                for (int i = 0; i < GaMa_Left.Count; i++)
                {
                    this.GaMa_Left[i] = 0;
                    this.GaMa_Right[i] = 0;
                }
 
                return null;
            }
 
            if ((m_gama81 < 8.0) || (m_gama82 < 8.0))
            {
                return "输入的第8断面的角度过小,请重新输入";
            }
            this.GaMa_Left[8] = m_gama81;
            this.GaMa_Right[8] = m_gama82;
 
            this.GaMa_Left[7] = m_gama81 - 1;
            this.GaMa_Right[7] = m_gama82 - 1;
 
            this.GaMa_Left[6] = m_gama81 - 2;
            this.GaMa_Right[6] = m_gama82 - 2;
 
            this.GaMa_Left[5] = m_gama81 - 3;
            this.GaMa_Right[5] = m_gama82 - 3;
 
            this.GaMa_Left[4] = m_gama81 - 4;
            this.GaMa_Right[4] = m_gama82 - 4;
 
            this.GaMa_Left[3] = m_gama81 - 5;
            this.GaMa_Right[3] = m_gama82 - 5;
 
            this.GaMa_Left[2] = m_gama81 - 6;
            this.GaMa_Right[2] = m_gama82 - 6;
 
            this.GaMa_Left[1] = m_gama81 - 7;
            this.GaMa_Right[1] = m_gama82 - 7;
 
 
            //if (geom_info.FAI0 > 45)//没有第一端面        
            //{
            //    this.GaMa_Left[1] = 0;
            //    this.GaMa_Right[1] = 0;
            //}
 
            return null;
        }
 
        /// <summary>
        /// 根据面积计算高度
        /// </summary>
        public void CalcHeightByArea(GeomBaseInfo geom_info, int index)
        {
            double a = (Math.Tan(this.GaMa_Left[index] * Math.PI / 180) + Math.Tan(this.GaMa_Right[index] * Math.PI / 180)) / 2;
            double b = geom_info.B3;
 
            double c = (90 + this.GaMa_Right[index]) / 360 * Math.PI * this.R_Left[index] * this.R_Left[index] + (90 + this.GaMa_Left[index]) / 360 * Math.PI * this.R_Right[index] * this.R_Right[index]
                - this.R_Left[index] * this.R_Left[index] * Math.Tan((45 + this.GaMa_Right[index] / 2) * Math.PI / 180) - this.R_Right[index] * this.R_Right[index] * Math.Tan((45 + this.GaMa_Left[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>
        /// 初始化倒角R半径
        /// </summary>
        /// <param name="base_info"></param>
        /// <param name="geom_info"></param>
        private void InitialChamferR(HdrBaseInfo base_info, GeomBaseInfo geom_info)
        {
            //赋值:R1 R2 R3 R4 
            if (this.ShapeType == eSectionShapeType.对称) //type=0:对称梯形
                this.R_Left[8] = Math.Round(geom_info.B3 * 0.55 + 0.5 - 5, 0);
            else if (this.ShapeType == eSectionShapeType.不对称)//type=1:不对称梯形
                this.R_Left[8] = Math.Round(geom_info.B3 * 0.55 + 0.5 - 5, 0);
            else if (this.ShapeType == eSectionShapeType.矩形)//type=2:矩形
                this.R_Left[8] = Math.Round(geom_info.B3 * 0.4 + 0.5 - 3, 0);
 
 
            if (base_info.IsSXB)
                this.R_Left[8] = Math.Round(this.R_Left[8] / 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[8] = this.R_Left[8];
  
 
            //截面R1 和 R4的减少角度 DecreaseR
            double DecreaseR = 0.5;
            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 (base_info.IsSXB)
                DecreaseR = 1;
 
            for (int index = 7; index >= 1; index--)
            {
                this.R_Left[index] = this.R_Left[index + 1] - DecreaseR;
                if (this.R_Left[index] < 1)
                    this.R_Left[index] = 1;
                this.R_Right[index] = this.R_Right[index + 1] - DecreaseR;
                if (this.R_Right[index] < 1)
                    this.R_Right[index] = 1;
            }
        }
 
        /// <summary>
        /// 保证倒角R半径 在合理范围内
        /// </summary>
        private void CheckChamferR()
        {
            for (int index = 8; index >= 1; index--)
            { 
                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);
 
 
                for (int k = 0; k < 10; k++)
                {
                    bool isChange = false;
                    if (this.R_Left[index] * (1+Math.Sin(this.GaMa_Left[index]*Math.PI/180)) > this.H[index] - 3)
                    {
                        isChange = true;
                        this.R_Left[index] = (this.H[index] - 3 )/(1 + Math.Sin(this.GaMa_Left[index] * Math.PI / 180));
                    }
                    if (this.R_Right[index] * (1 + Math.Sin(this.GaMa_Right[index] * Math.PI / 180)) > this.H[index] - 3)
                    {
                        isChange = true;
                        this.R_Right[index] = (this.H[index] - 3) / (1 + Math.Sin(this.GaMa_Right[index] * Math.PI / 180));
                    }
                    if (isChange)
                        continue;
                    else
                        break;
                }
 
 
                if (this.R_Left[index] < 1)
                    this.R_Left[index] = 1;
                if (this.R_Right[index] < 1)
                    this.R_Right[index] = 1;
            }
        }
        public List<double> CalInitialR(HdrBaseInfo base_info, GeomBaseInfo geom_info)
        {
            List<double> R = new List<double>(Enumerable.Repeat(0.0, 10));
            //赋值:R1 R2 R3 R4 
            if (this.ShapeType == eSectionShapeType.对称) //type=0:对称梯形
                R[8] = Math.Round(geom_info.B3 * 0.55 + 0.5 - 5, 0);
            else if (this.ShapeType == eSectionShapeType.不对称)//type=1:不对称梯形
                R[8] = Math.Round(geom_info.B3 * 0.55 + 0.5 - 5, 0);
            else if (this.ShapeType == eSectionShapeType.矩形)//type=2:矩形
                R[8] = Math.Round(geom_info.B3 * 0.4 + 0.5 - 3, 0);
 
 
            if (base_info.IsSXB)
                R[8] = Math.Round(R[8] / 2, 0);
 
 
            //截面R1 和 R4的减少角度 DecreaseR
            double DecreaseR = 0.5;
            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 (base_info.IsSXB)
                DecreaseR = 1;
 
            for (int index = 7; index >= 1; index--)
            {
                R[index] = R[index + 1] - DecreaseR;
                if (R[index] < 1)
                    R[index] = 1;
               R[index] = R[index + 1] - DecreaseR;
            }
            return R;
        }
        /// <summary>
        /// 更改gama之后重新计算高度
        /// </summary>
        public double CalcHeight(GeomBaseInfo geom_info, int index, double GaMa, double R)
        {
            double a = (Math.Tan(GaMa * Math.PI / 180) + Math.Tan(GaMa * Math.PI / 180)) / 2;
            double b = geom_info.B3;
 
            double c = (90 + GaMa) / 360 * Math.PI * R * R + (90 + GaMa) / 360 * Math.PI * R * R
                - R * R * Math.Tan((45 + GaMa / 2) * Math.PI / 180) - R * R * Math.Tan((45 + GaMa / 2) * Math.PI / 180) - this.Area[index];
            double delta = b * b - 4 * a * c;
            if (delta < 0)
            {
                return -1;
            }
            if (this.ShapeType == eSectionShapeType.矩形 || GaMa == 0)//矩形
            {
 
                return Math.Round((-c / b), 1);
            }
            else
            {
                if (delta < 0)
                {
                    return -1;
                }
                var bb = (-b + Math.Sqrt(delta)) / (2 * a);
                return Math.Round((-b + Math.Sqrt(delta)) / (2 * a), 1);
            }
        }
        public double HCalR(GeomBaseInfo geom_info, int index, double GaMa, double H)
        {
            double a = (Math.Tan(GaMa * Math.PI / 180) + Math.Tan(GaMa * Math.PI / 180)) / 2;
            double b = geom_info.B3;
            double R = 0;
            if (this.ShapeType == eSectionShapeType.矩形)
                R = Math.Sqrt((H * b - this.Area[index]) / (2 * Math.Tan((45 + GaMa / 2) * Math.PI / 180) - 2 * (90 + GaMa) / 360 * Math.PI));
            else
                R = Math.Sqrt((a * H * H + b * H - this.Area[index]) / (2 * Math.Tan((45 + GaMa / 2) * Math.PI / 180) - 2 * (90 + GaMa) / 360 * Math.PI));
            return Math.Round(R,1);
        }
        /// <summary>
        /// 更改gama之后,并且高度重新计算之后,保证圆角还是在正常的范围
        /// 传出值,但目前没有更改类中的值 仅用于断面参数总览界面 默认对称使用左边参数
        /// </summary>
        public double CheckChamferR(double Height, int index, double Gama,double R)
        {
            var R_Left = R;
                if (R_Left > (Height + 1))
                R_Left = Math.Round(Height * 0.85 - 1, 0);
            var conditionHeight = Height;
             if (R_out !=1500)
            {
                conditionHeight = conditionHeight-3;
            }
 
                if (R_Left * (1 + Math.Sin(Gama * Math.PI / 180)) > conditionHeight)
                {
                R_Left = conditionHeight / (1 + Math.Sin(Gama * Math.PI / 180));
                }
 
 
                if (R_Left < 1)
                R_Left = 1;
                bool isPlausible = false;
            while (!isPlausible)
            {
                //目前这个只检测对称的 //若不对称更换半径角度等参数重新计算另一边x
                var x = Math.Tan(Gama * Math.PI / 180) * (Height
                         - (Math.Tan(Gama * Math.PI / 180) * Math.Tan(Gama / 2 * Math.PI / 180) * R_Left)
                         - (Math.Tan(Gama * Math.PI / 180) * R_Left) - R_Left);
                var c = this.R_out / 1000;
                var TopWidth = this.BaseWidth + (2 * x);
                var Slash = (Height - R_Left - (Math.Sin(Gama * Math.PI / 180) * R_Left)) / Math.Cos(Gama * Math.PI / 180);
                if ((this.ShapeType != eSectionShapeType.矩形 && (TopWidth < c || Slash < c)) || R_Left == 0 )
                {
                        R_Left = R_Left - 1;
                }
                else
                {
                    isPlausible = true;
                }
                if(R_Left <= 0)
                {
                    break;
                }
            }
 
            if (R_Left<=0)
            {
                R_Left = 1;
            }
            return Math.Round(R_Left,1);
         }
    }
}