using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DPumpHydr.OpenFwUI.Volute
{
///
/// 单个端面参数
///
public class SectionShapePara
{
///
///
///
public int Index { get; set; }//断面序号 第8断面就是8 第一断面就是1
public double Gama_Left { get; set; }//角度1
public double Gama_Right { get; set; }//角度2
public double H { get; set; }//高度
public double R_out { get; set; }//外围的半径 UG中R4
public double R_Left { get; set; }//角度1边对应的圆角半径 UG中R1
public double R_Right { get; set; }//角度2边对应的圆角半径 UG中R2
public double SectionArea { get; set; }//面积:由occ计算
public double BaseWidth { get; set; }//底部宽度 就是B3
public double BaseCircleRadius { get; set; }//底部圆半径 就是D3/2
public eSectionShapeType ShapeType { get; set; }
///
/// 根据面积计算高度
///
public double CalcHeightByArea(eSectionShapeType SectionType)
{
double a = (Math.Tan(Gama_Left * Math.PI / 180) + Math.Tan(Gama_Right * Math.PI / 180)) / 2;
double b = BaseWidth;
double c = (90 + Gama_Right) / 360 * Math.PI * R_Left * R_Left + (90 + Gama_Left) / 360 * Math.PI * R_Right * R_Right
- R_Left * R_Left * Math.Tan((45 + Gama_Right / 2) * Math.PI / 180) - R_Right * R_Right * Math.Tan((45 + Gama_Left / 2) * Math.PI / 180) - SectionArea;
double delta = b * b - 4 * a * c;
if (delta < 0) return -1;
if (SectionType == eSectionShapeType.矩形)//矩形
{
return -c / b;
}
else
{
if (delta < 0) return -1;
return (-b + Math.Sqrt(delta)) / (2 * a);
}
}
///
/// 验证是否合理
///
///
/// 、
//public bool Verify(out string error)
//{
// error = "";
// bool isverify = true;
// if ((this.H - this.R_Left) * Math.Tan(this.Gama_Left)+(this.H - this.R_Right) * Math.Tan(this.R_Right)+this.BaseWidth >= this.R_Right + this.R_Left)
// {
// error = "输入的直径非法!";
// isverify = false;
// }
// if(this.Gama_Left > 45 || this.Gama_Right > 45)
// {
// error = "输入的角度非法!";
// isverify = false;
// }
// return isverify;
//}
}
}