NGToolsCSharp/NGTools/Pages/A_FLowCal/pzCal.aspx.cs
2024-09-13 16:44:30 +08:00

152 lines
4.8 KiB
C#

using NG_Tools;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace NGTools.Pages.A_FLowCal
{
public partial class pzCal : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["action"] == "Cal")
{
string[] tempPar = Request["Par"].Split(',');
Flowcal(tempPar);
}
}
private void Flowcal(string[] par)
{
double[] ngCom = new double[21];
double[] tempPar = new double[110];
for (int i = 0; i < par.Length; i++)
{
if (i != 11)
{
tempPar[i] = double.Parse(par[i]);
}
else
{
for (int j = 0; j < 21; j++)
{
ngCom[j] = double.Parse(par[11].Split('_')[j]) / 100;
}
}
}
FlowCal NGFLOW = new FlowCal();
NG_Cal.FlowParStruct flPar = new NG_Cal.FlowParStruct();
NG_Cal.GasPropsSTRUCT gasPar = new NG_Cal.GasPropsSTRUCT();
gasPar.adMixture = ngCom;
UnitConvert MyConvert = new UnitConvert();
flPar.dMeterType = (int)tempPar[0]; //流量计类别
flPar.dCoreType = (int)tempPar[1]; //节流装置类型
flPar.dFlowCalbz = (int)tempPar[2]; //流量计算标准
flPar.dZcalbz = (int)tempPar[3]; //压缩因子计算标准
flPar.dCbtj = (int)tempPar[4]; //'计量参比条件
flPar.dPb_M = tempPar[5]; //计量参比条件压力
flPar.dTb_M = tempPar[6]; //计量参比条件温度
flPar.dPb_E = tempPar[7]; //燃烧参比条件压力
flPar.dTb_E = tempPar[8]; //燃烧参比条件温度
flPar.dPatmUnit = (int)tempPar[10]; //当地大气压单位
flPar.dPatm = MyConvert.Converter("yl", tempPar[9], flPar.dPatmUnit, 0, 4); ; //当地大气压
flPar.dNG_Compents = gasPar.adMixture; //天然气组分
flPar.dPtmode = (int)tempPar[12]; //取压方式
flPar.dPipeType = (int)tempPar[13]; //管道类型
flPar.dPipeD = tempPar[14]/1000; //管道内径
flPar.dLenUnit = (int)tempPar[15]; //长度单位
flPar.dPipeDtemp = tempPar[16]; //管道内径参考温度
flPar.dPileDtempUint = (int)tempPar[17]; //温度单位
flPar.dPipeMaterial = (int)tempPar[18]; //管道材料
flPar.dOrificeD = tempPar[19]/1000; //喷嘴喉径换算成米
flPar.dOrificeUnit = (int)tempPar[20]; //长度单位
flPar.dOrificeDtemp = tempPar[21]; //孔板内径参考温度
flPar.dOrificeDtempUnit = (int)tempPar[22]; //温度单位
flPar.dOrificeMaterial = (int)tempPar[23]; //孔板材料
flPar.dOrificeSharpness = (int)tempPar[24]; //锐利度系数计算方法
flPar.dOrificeRk = tempPar[25]; //孔板入口圆弧半径
flPar.dOrificeRkLenUint = (int)tempPar[26]; //长度单位
flPar.dPfUnit = (int)tempPar[28]; //压力单位
flPar.dPf = MyConvert.Converter("yl", tempPar[27], flPar.dPfUnit, 0, 4); //输入压力
flPar.dPfType = (int)tempPar[29]; //压力类型
flPar.dTfUnit = (int)tempPar[31]; //温度单位
flPar.dTf = MyConvert.Converter("wd", tempPar[30], flPar.dTfUnit, 1, 4); //输入温度
flPar.dDpUnit = (int)tempPar[33]; //压力单位
flPar.dDp = MyConvert.Converter("yl", tempPar[32], flPar.dDpUnit, 0, 4); //输入压力; //输入差压
flPar.dVFlowUnit = (int)tempPar[34]; //体积流量单位
flPar.dMFlowUnit = (int)tempPar[35]; //质量流量单位
flPar.dEFlowUnit = (int)tempPar[36]; //能量流量单位
flPar.dCd = tempPar[37]; //流出系数
//将压力换算为绝压
if (flPar.dPfType == 0)
{
flPar.dPf = flPar.dPf + flPar.dPatm;
}
gasPar.dCbtj = flPar.dCbtj;
gasPar.dPf = flPar.dPf;
gasPar.dTf = flPar.dTf;
switch (gasPar.dCbtj)
{
case 2:
gasPar.dPb = 101325;
gasPar.dTb = 273.15;
break;
case 1:
gasPar.dPb = 101325;
gasPar.dTb = 288.15;
break;
case 0:
gasPar.dPb = 101325;
gasPar.dTb = 293.15;
break;
}
NG_Tools.NG_Cal NG_Cal = new NG_Cal();
NG_Cal.Crit(ref gasPar, 0.0);
NGFLOW.NozellFLowCal(ref gasPar, ref flPar);
tempPar[56] = flPar.dVFlowb * 86400;
tempPar[57] = flPar.dVFlowf * 3600;
tempPar[58] = flPar.dMFlowb;
tempPar[59] = flPar.dEFlowb;
tempPar[65] = gasPar.dZf;
tempPar[80] = gasPar.dKappa;
tempPar[82] = gasPar.dCstar;
StringBuilder Json = new StringBuilder();
Json.Append("[");
for (int i = 0; i < tempPar.Length; i++)
{
Json.Append(tempPar[i].ToString() + ",");
}
string json = (Json.Replace(",", "", Json.Length - 1, 1).Append("]")).ToString();
Response.Write(json);
Response.End();
}
}
}