using System; using System.Collections.Generic; 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(10); this.GaMa_Right = new List(10); this.Area = new List(10); this.H = new List(10); this.R_Left = new List(10); this.R_Right = new List(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 eSectionShapeType ShapeType { get; set; } = eSectionShapeType.对称; /// /// 平均流速 /// public double V3 { get; set; } /// /// 开始截面编号 /// public int StartSectionNumber { get; set; } public List GaMa_Left { get; set; } public List GaMa_Right{ get; set;} public List Area { get; set; } //断面信息 public List H { get; set; }//高度 public double R_out { get; set; }//外围的半径 public List R_Left { get; set; }//角度1边对应的圆角半径 UG中R1 public List R_Right { get; set; }//角度2边对应的圆角半径 UG中R2 public double BaseWidth { get; set; }//底部宽度 就是B3 public double BaseCircleRadius { get; set; }//底部圆半径 就是D3/2 /// /// /// /// /// 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.BaseCircleRadius = this.BaseCircleRadius; return model; } /// /// /// /// /// 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 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; } /// /// 计算平均流速 /// /// /// public static double CalcV3(HdrBaseInfo hdr_info, GeomBaseInfo geom_info) { //UG里面用的是 m_H应该错了 var g = 9.81; return Math.Round(geom_info.K3 * Math.Sqrt(2 * g * hdr_info.Q), 2); } /// /// 计算初始化所有参数 /// /// /// /// public void ResetAllParas(HdrBaseInfo hdr_info, GeomBaseInfo geom_info, double v3) { 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, v3); // CheckChamferR(); } /// /// V3改了, 重新计算面积和高度 /// /// /// /// public void CalcParaV3(HdrBaseInfo hdr_info, GeomBaseInfo geom_info, double v3) { this.V3 = v3; 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(); } /// /// 计算面积 /// /// /// 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]; } /// /// 初始化gama /// /// 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; } /// /// 根据面积计算高度 /// 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 ; } } /// /// 初始化倒角R半径 /// /// /// 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 - 4, 0); else if (this.ShapeType == eSectionShapeType.不对称)//type=1:不对称梯形 this.R_Left[8] = Math.Round(geom_info.B3 * 0.55 + 0.5 - 4, 0); else if (this.ShapeType == eSectionShapeType.矩形)//type=2:矩形 this.R_Left[8] = Math.Round(geom_info.B3 * 0.4 + 0.5 - 2, 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]; this.R_out = 1000.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--) { this.R_Left[index] = this.R_Left[index + 1] - DecreaseR; this.R_Right[index] = this.R_Right[index + 1] - DecreaseR; } } /// /// 保证倒角R半径 在合理范围内 /// private void CheckChamferR() { for (int index = 7; 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); if (this.R_Left[index] < 2) this.R_Left[index] = 2; if (this.R_Right[index] < 2) this.R_Right[index] = 2; } } } }