diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
index 49bcf06..3b7891b 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
@@ -1,9 +1,14 @@
package com.ruoyi;
+import org.apache.catalina.connector.Connector;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
+import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;
import java.net.InetAddress;
@@ -18,15 +23,42 @@ import java.net.UnknownHostException;
public class RuoYiApplication
{
public static void main(String[] args) throws UnknownHostException {
- // System.setProperty("spring.devtools.restart.enabled", "false");
-// SpringApplication.run(RuoYiApplication.class, args);
ConfigurableApplicationContext application = SpringApplication.run(RuoYiApplication.class, args);
Environment env = application.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
- String port = env.getProperty("server.port");
- String path = env.getProperty("server.servlet.context-path");
+ // 获取 HTTPS 端口
+ String httpsport = env.getProperty("server.port");
+ // 获取 HTTP 端口
+ String httpport = env.getProperty("server.http.port");
+ String path = env.getProperty("server.servlet.context-path", "/");
+
+ if (httpsport == null) {
+ httpsport = "未配置";
+ }
+ if (httpport == null) {
+ httpport = "未配置";
+ }
+
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n\t" +
- "Local: \thttp://localhost:" + port + path + "\n\t" +
- "NetWork: \thttp://"+ip+":" + port + path + "\n\t" );
+ "Local: \thttps://localhost:" + httpsport + path + "\n\t" +
+ "NetWork: \thttps://" + ip + ":" + httpsport + path + "\n\t" +
+ "Local: \thttp://localhost:" + httpport + path + "\n\t" +
+ "NetWork: \thttp://" + ip + ":" + httpport + path + "\n\t");
+ }
+
+ @Value("${server.http.port}")
+ private int httpPort;
+
+ @Bean
+ public ServletWebServerFactory servletContainer() {
+ TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
+ tomcat.addAdditionalTomcatConnectors(createStandardConnector());
+ return tomcat;
+ }
+
+ private Connector createStandardConnector() {
+ Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
+ connector.setPort(httpPort);
+ return connector;
}
}
diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml
index b39ec82..60a520b 100644
--- a/ruoyi-admin/src/main/resources/application-druid.yml
+++ b/ruoyi-admin/src/main/resources/application-druid.yml
@@ -2,12 +2,14 @@
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
- driverClassName: org.mariadb.jdbc.Driver
+# driverClassName: org.mariadb.jdbc.Driver
+ driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源 String url = "jdbc:mariadb://192.168.3.154:3306/ry-vue?user=yourUsername&password=yourPassword
master:
- url: jdbc:mariadb://192.168.3.154:3306/ry-vue?useSSL=false&characterEncoding=utf8&serverTimezone=UTC"
- username: root
+ url: jdbc:mysql://192.168.3.246:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+# url: jdbc:mariadb://192.168.3.154:3306/ry-vue?useSSL=false&characterEncoding=utf8&serverTimezone=Asia/Shanghai
+ username: yjly
password: 4877017Ldy
# 从库数据源
slave:
diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml
index f6099b9..8eb8a89 100644
--- a/ruoyi-admin/src/main/resources/application.yml
+++ b/ruoyi-admin/src/main/resources/application.yml
@@ -13,23 +13,25 @@ ruoyi:
# 验证码类型 math 数字计算 char 字符验证
captchaType: math
-# 开发环境配置
server:
- # 服务器的HTTP端口,默认为8080
- port: 9090
+ port: 8443 # HTTPS 端口
servlet:
- # 应用的访问路径
context-path: /
tomcat:
- # tomcat的URI编码
uri-encoding: UTF-8
- # 连接数满后的排队数,默认为100
accept-count: 1000
threads:
- # tomcat最大线程数,默认为200
max: 800
- # Tomcat启动初始化的线程数,默认值10
min-spare: 100
+ ssl:
+ enabled: true
+ key-store: classpath:ngtools.cn.jks
+ key-store-password: kvp09gai
+ key-store-type: JKS
+ protocol: TLS
+ # 配置 HTTP 连接器
+ http:
+ port: 9090 # HTTP 端口
# 日志配置
logging:
@@ -68,13 +70,13 @@ spring:
# redis 配置
redis:
# 地址
- host: 192.168.3.154
+ host: 192.168.3.246
# 端口,默认为6379
port: 6379
# 数据库索引
database: 0
# 密码
- password:
+ password: 4877017Ldy
# 连接超时时间
timeout: 10s
lettuce:
diff --git a/ruoyi-admin/src/main/resources/ngtools.cn.jks b/ruoyi-admin/src/main/resources/ngtools.cn.jks
new file mode 100644
index 0000000..9804c70
Binary files /dev/null and b/ruoyi-admin/src/main/resources/ngtools.cn.jks differ
diff --git a/ruoyi-ngtools/pom.xml b/ruoyi-ngtools/pom.xml
index 20bbcd4..d92ddb9 100644
--- a/ruoyi-ngtools/pom.xml
+++ b/ruoyi-ngtools/pom.xml
@@ -27,6 +27,10 @@
lombok
provided
+
+ com.ruoyi
+ ruoyi-system
+
\ No newline at end of file
diff --git a/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/controller/FlowController.java b/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/controller/FlowController.java
new file mode 100644
index 0000000..f94207d
--- /dev/null
+++ b/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/controller/FlowController.java
@@ -0,0 +1,1157 @@
+package com.ruoyi.ngCalTools.controller;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.ngCalTools.model.FlowProps;
+import com.ruoyi.ngCalTools.model.GasProps;
+import com.ruoyi.ngCalTools.service.DetailService;
+import com.ruoyi.ngCalTools.service.GBT11062Service;
+import com.ruoyi.ngCalTools.service.ThermService;
+import com.ruoyi.system.controller.UnitConvert;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.swing.*;
+
+@RestController
+@RequestMapping("/flowCalcTools")
+public class FlowController {
+
+ private final UnitConvert unitConvert;
+ public ThermService thermService;
+ public DetailService detailService;
+ public GBT11062Service gbt11062Service;
+ public GasController gasController;
+ public FlowController(UnitConvert unitConvert,GasController gasController) {
+ this.unitConvert = unitConvert;
+ this.gasController=gasController;
+ }
+ @PostMapping("/flowCalc")
+ public AjaxResult flowCalc(@RequestBody FlowProps flowProps) {
+ GasProps gasProps = new GasProps();
+ thermService = new ThermService();
+ detailService = new DetailService();
+ gbt11062Service = new GBT11062Service();
+
+ //大气压力转换成Pa
+ double tempPatm = unitConvert.ConvertUniter("pressure", flowProps.getdPatm(), flowProps.getdPatmUnit(), 0);
+ //压力转换成Pa
+ double tempPf = unitConvert.ConvertUniter("pressure", flowProps.getdPf(), flowProps.getdPfUnit(), 0);
+
+ //压力转换成Pa
+ double tempDP = unitConvert.ConvertUniter("pressure", flowProps.getdDp(), flowProps.getdDpUnit(), 0);
+ //温度转换成K
+ double tempTf = unitConvert.ConvertUniter("temperature", flowProps.getdTf(), flowProps.getdTfUnit(), 2);
+ if (flowProps.getdPfType() == 0) //0是表压
+ {
+ gasProps.dPf = tempPatm + tempPf;
+ flowProps.setdPf(tempPatm + tempPf);
+ } else {
+ gasProps.dPf = tempPf;
+ flowProps.setdPf(tempPf);
+ }
+ gasProps.dTf = tempTf;
+ flowProps.setdDp(tempDP);
+ flowProps.setdTf(tempTf);
+
+ gasProps.dCbtj = flowProps.getdCbtj();
+ String[] stringArray = flowProps.getdngComponents().split("_");
+ double[] doubleArray = new double[stringArray.length]; // 遍历字符串数组,将每个元素转换为 double 类型
+ for (int i = 0; i < stringArray.length; i++) {
+ try {
+ doubleArray[i] = Double.parseDouble(stringArray[i]) / 100;
+ } catch (NumberFormatException e) {
+ // 处理转换异常
+ System.err.println("无法将字符串 " + stringArray[i] + " 转换为 double 类型: " + e.getMessage());
+ }
+ }
+ gasProps.adMixture = doubleArray;
+ gasController.ngCalcVoid(flowProps, gasProps); //计算临界流函数所有参数都计算了
+
+ //计算流量
+ switch (flowProps.getdMeterType()) {
+ case 0: //差压式流量计
+ OFlowCal(gasProps, flowProps);
+ break;
+ case 1:// 速度式流量计
+ SdFlowCal(gasProps, flowProps);
+ break;
+ case 2: //容积式流量计
+ SdFlowCal(gasProps, flowProps);
+ break;
+ case 3:// 临界流函数流量计
+ NozellFLowCal(gasProps, flowProps);
+ break;
+ }
+ Object[] resultArray = {flowProps, gasProps};
+ return AjaxResult.success(resultArray);
+ }
+ /**
+ 速度式流量计算
+ */
+ public final void SdFlowCal(GasProps gasProps,FlowProps flowProps)
+ {
+ //工况体积流量 m³、s
+ flowProps.setdVFlowf(flowProps.getdPulseNum() / flowProps.getdMeterFactor());
+ //标况体积流量 m³、s
+ flowProps.setdVFlowb(FlowConvert_WorkToBase(flowProps, gasProps));
+ //标况质量流量
+ flowProps.setdMFlowb(flowProps.getdVFlowb() * gasProps.dRhob);
+ //标况能量流量
+ flowProps.setdEFlowb(flowProps.getdVFlowb() * gasProps.dHhvm);
+
+ }
+ /**
+ 标准孔板流量计算
+ */
+ public void OFlowCal(GasProps gasProps,FlowProps flowProps){
+
+ flowProps.setdOrificeD(flowProps.getdOrificeD() * (1 + 0.000001 * (flowProps.getdOrificeMaterial()) * (flowProps.getdTf() - 293.15)));
+ flowProps.setdPipeD(flowProps.getdPipeD() * (1 + 0.000001 * (flowProps.getdPipeMaterial()) * (flowProps.getdTf() - 293.15)));
+ flowProps.setdBeta(flowProps.getdOrificeD() / flowProps.getdPipeD());
+// flowProps.setdBeta(0.5972);
+
+ //求渐近速度系数 E
+ flowProps.setdE(1 / Math.pow((1 - Math.pow(flowProps.getdBeta(), 4)), 0.5));
+// flowProps.setdE(1.0615);
+
+ //求相对密度系数 FG
+ // LiuTiType = 1
+ flowProps.setdFG(Math.pow((1 / gasProps.dRD_Real), 0.5));
+// flowProps.setdFG(1.2531);
+ //求流动温度系数 'FT
+ flowProps.setdFT(Math.pow((293.15 / flowProps.getdTf()), 0.5));
+// flowProps.setdFT(1.0086);
+ //求等熵指数?????????????????????????????????
+
+ flowProps.setdKappa(gasProps.dKappa);
+// flowProps.setdKappa(1.357);
+
+ //求动力粘度 dlnd
+ flowProps.setdDViscosity(Dlndjs(flowProps.getdPf(), flowProps.getdTf(), 2, 1));
+// flowProps.setdDViscosity(0.01096);
+
+ //求可膨胀系数
+ flowProps.setdDExpCoefficient(KePenZhang_JiSuan(flowProps.getdPf() , flowProps.getdDp(), flowProps.getdBeta(), gasProps.getdKappa(), flowProps.getdCoreType(), 0));
+// flowProps.setdDExpCoefficient(0.9977);
+
+// gasProps.dFpv=1.0195;
+// gasProps.dHhvv=39.944;
+// gasProps.dRD_Real=0.6368;
+
+ //迭代计算流量和流出系数
+
+ double conQvA = 0;
+ conQvA = 0.0000031795 * (1530000.0D * gasProps.dRD_Real / (flowProps.getdDViscosity() * flowProps.getdOrificeD())) * flowProps.getdE() * Math.pow(flowProps.getdOrificeD(), 2) * gasProps.dFpv * flowProps.getdFG() * flowProps.getdDExpCoefficient() * flowProps.getdFT() * Math.sqrt(flowProps.getdPf() * flowProps.getdDp() / 1e6);
+ double[] XQv = new double[4];
+ double[] CQv = new double[4];
+ double[] dQv = new double[4];
+ double Qn = 0;
+ int n = 0;
+ XQv[0] = 1000000.0F;
+ boolean xhFlag=true;
+ _100000:
+
+ while(xhFlag) {
+ for (n = 1; n <= 2; n++) {
+ CQv[n] = C_JiSuan(flowProps.getdOrificeD(), flowProps.getdBeta(), XQv[n - 1], conQvA, flowProps.getdPtmode(), flowProps.getdCoreType(), 0);
+ XQv[n] = conQvA * CQv[n];
+ dQv[n] = XQv[n] - XQv[n - 1];
+ }
+ if (XQv[2] == XQv[1] || dQv[2] == dQv[1]) {
+ Qn = conQvA * flowProps.getdDViscosity() * flowProps.getdOrificeD() * CQv[2] / (1530000.0D * gasProps.dRD_Real);
+ //管道雷诺数
+ flowProps.setdRnPipe(XQv[2]);
+ //流出系数
+ flowProps.setdCd(CQv[2]);
+
+ }
+ if (Math.abs((conQvA - XQv[2] / CQv[1]) / conQvA) > 0.00000000000000005) {
+ XQv[0] = XQv[n - 1] - dQv[n - 1] * ((XQv[n - 1] - XQv[n - 2]) / (dQv[n - 1] - dQv[n - 2]));
+//C# TO JAVA CONVERTER TODO TASK: There is no 'goto' in Java:
+ continue _100000;
+ }
+ else
+ {
+ xhFlag=false;
+ }
+ }
+
+ //孔板锐利度系数Bk
+ flowProps.setdOrificeSharpness(1);
+ if (flowProps.getdCoreType() == 0)
+ {
+ flowProps.setdBk((flowProps.getdOrificeSharpness() == 0) ? (BkTable(flowProps.getdOrificeRk(), flowProps.getdOrificeD(), 1)) : (flowProps.getdOrificeSharpness()));
+ }
+ else
+ {
+ flowProps.setdBk(1);
+ }
+
+
+ //管道粗糙度系数 Gme
+ flowProps.setdRoughNessPipe(CcdXsjs(flowProps.getdPipeType(), flowProps.getdPipeD(), flowProps.getdBeta(), flowProps.getdRnPipe()));
+ //修正后的流出系数
+ flowProps.setdCd(flowProps.getdCd() * flowProps.getdBk() * flowProps.getdRoughNessPipe());
+// flowProps.setdCd(0.6039);
+ //标况体积流量 m³、s
+ flowProps.setdVFlowb(Qn * flowProps.getdBk() * flowProps.getdRoughNessPipe());
+ //工况体积流量
+ flowProps.setdVFlowf(FlowConvert_BaseToWork(flowProps, gasProps));
+ //标况质量流量
+ flowProps.setdMFlowb(flowProps.getdVFlowb() * gasProps.dRhob);
+ //标况能量流量
+ flowProps.setdEFlowb(flowProps.getdVFlowb() * gasProps.dHhvv);
+ //管道内天然气流速
+ flowProps.setdVelocityFlow(flowProps.getdVFlowf() / (3.1415926 * Math.pow((flowProps.getdPipeD() / 2000), 2)));
+ //压力损失
+ flowProps.setdPressLost(YaLiSunShi(flowProps.getdCd(), flowProps.getdBeta(), flowProps.getdDp(), flowProps.getdCoreType()));
+ }
+
+ /**
+ 天然气音速喷嘴流量计算
+ */
+ public final void NozellFLowCal( GasProps gasProps,FlowProps flowProps)
+ {
+ double dAnt; // 喷嘴喉部面积
+ //double dCR;//临界流系数
+ double dP1Z; //滞止压力
+ double dT1Z; //滞止温度
+ //double dPbeta;//上下游压力比
+ double dDcorrect; // 考虑膨胀系数后的管道直径
+ double ddcorrect; // 考虑膨胀系数后的喉部直径
+ double dBeta; //直径比
+ double dQm;
+ try
+ {
+ ddcorrect = flowProps.getdOrificeD() * (1 + 0.000001 * (flowProps.getdOrificeMaterial()) * (flowProps.getdTf() - 293.15));
+ dDcorrect = flowProps.getdPipeD() * (1 + 0.000001 * (flowProps.getdOrificeMaterial()) * (flowProps.getdTf() - 293.15));
+ dBeta = ddcorrect / dDcorrect;
+ dAnt = 3.1415926 * (ddcorrect / 2) * (ddcorrect / 2);
+ //ptNGcal.SOS(ref gasProps);
+
+ //dCR = gasProps.dCstar * Math.Sqrt(gasProps.dZf);
+ dP1Z = flowProps.getdPf() * (1 + gasProps.dKappa / 2 * Math.pow((2 / (gasProps.dKappa + 1)), ((gasProps.dKappa + 1) / (gasProps.dKappa - 1))) * Math.pow(dBeta, 4));
+ dT1Z = flowProps.getdTf() * (1 + (gasProps.dKappa - 1) / 2 * (2 / Math.pow((gasProps.dKappa + 1), ((gasProps.dKappa + 1) / (gasProps.dKappa - 1)))) * Math.pow(dBeta, 4));
+ // dQm = dAnt * flowProps.dCd * gasProps.dCstar * dP1Z / Math.Sqrt(8314.51 * dT1Z / gasProps.dMrx);
+ dQm = dAnt * flowProps.getdCd() * gasProps.dCstar * Math.sqrt(gasProps.dZf * dP1Z * gasProps.dRhof);
+
+ if (dBeta > 0.25)
+ {
+ dQm = dQm * BetaG25(dP1Z, dT1Z, dBeta, gasProps);
+ }
+ flowProps.setdMFlowb(dQm);
+ flowProps.setdVFlowb(flowProps.getdMFlowb() / gasProps.dRhob);
+ //标况能量流量
+ flowProps.setdEFlowb(flowProps.getdVFlowb() * gasProps.dHhvm);
+ flowProps.setdVFlowf(FlowConvert_BaseToWork(flowProps, gasProps));
+ }
+ catch (RuntimeException ex)
+ {
+
+ }
+ }
+
+ private double BetaG25(double P0, double T0, double BetaB, GasProps gasProps)
+ {
+ double[] nik0 = new double[9];
+ double[] Sik0 = new double[9];
+ double[] Tik0 = new double[9];
+ double[] nik1 = new double[9];
+ double[] Sik1 = new double[9];
+ double[] Tik1 = new double[9];
+ double C0 = 0;
+ double C1 = 0;
+ double Pai = 0;
+ double Tuo = 0;
+ double b = 0;
+ double F0 = 0;
+ double F1 = 0;
+ double Rf = 0.65;
+ // 直径比大于0.25的修正因子
+ nik0[0] = 1.068826e-3;
+ nik0[1] = 1.199593e-2;
+ nik0[2] = -1.48292e-3;
+ nik0[3] = 2.764799e-4;
+ nik0[4] = 7.920711e-5;
+ nik0[5] = 1.11278e-3;
+ nik0[6] = -6.815626e-5;
+ nik0[7] = 3.86249e-8;
+
+ nik1[0] = -3.46148e-3;
+ nik1[1] = 5.28029e-3;
+ nik1[2] = 1.195016e-2;
+ nik1[3] = 1.664232e-3;
+ nik1[4] = 1.159371e-3;
+ nik1[5] = 7.260461e-3;
+ nik1[6] = -7.541933e-4;
+ nik1[7] = 2.613967e-7;
+
+ Sik0[0] = 0;
+ Sik0[1] = 0;
+ Sik0[2] = 0.5;
+ Sik0[3] = 1;
+ Sik0[4] = 2;
+ Sik0[5] = 3;
+ Sik0[6] = 5;
+ Sik0[7] = 10;
+
+ Sik1[0] = 0;
+ Sik1[1] = 0;
+ Sik1[2] = 0;
+ Sik1[3] = 1;
+ Sik1[4] = 1.5;
+ Sik1[5] = 3;
+ Sik1[6] = 5;
+ Sik1[7] = 10;
+
+ Tik0[0] = -1;
+ Tik0[1] = 0;
+ Tik0[2] = -6;
+ Tik0[3] = -1;
+ Tik0[4] = -2;
+ Tik0[5] = -8;
+ Tik0[6] = -10;
+ Tik0[7] = -18;
+
+ Tik1[0] = -3;
+ Tik1[1] = -1;
+ Tik1[2] = 0;
+ Tik1[3] = -2;
+ Tik1[4] = -4;
+ Tik1[5] = -10;
+ Tik1[6] = -12;
+ Tik1[7] = -15;
+
+ Pai = P0 / (gasProps.dPc * 1000000);
+ Tuo = T0 / gasProps.dTC;
+ for (int i = 0; i <= 7; i += 1)
+ {
+ C0 = C0 + nik0[i] * Math.pow(Pai, Sik0[i]) * Math.pow(Tuo, Tik0[i]);
+ C1 = C1 + nik1[i] * Math.pow(Pai, Sik1[i]) * Math.pow(Tuo, Tik1[i]);
+ }
+ b = 25.879 * Math.pow(BetaB, 6) - 32.693 * Math.pow(BetaB, 5) + 34.276 * Math.pow(BetaB, 4) - 6.0199 * Math.pow(BetaB, 3) - 1.1156 * Math.pow(BetaB, 2) - 0.1122 * BetaB + 0.0047;
+ F0 = 1 + b * C0;
+ F1 = 1 + b * C1;
+ return (1 - Rf) * F0 + Rf * F1;
+ }
+
+ //压力损失计算
+ public final double YaLiSunShi(double tempLiuChuXiShu, double tempZjb, double tempDp, int JieLiuZhuangZhi)
+ {
+ double ylss = 0;
+ switch (JieLiuZhuangZhi)
+ {
+ case 0:
+ ylss = (tempDp * (Math.sqrt(1 - tempZjb) - tempLiuChuXiShu * Math.pow(tempZjb, 2)) / (Math.sqrt(1 - tempZjb) + tempLiuChuXiShu * Math.pow(tempZjb, 2)));
+ break;
+ case 1:
+ ylss = (tempDp * (Math.sqrt(1 - tempZjb) - tempLiuChuXiShu * Math.pow(tempZjb, 2)) / (Math.sqrt(1 - tempZjb) + tempLiuChuXiShu * Math.pow(tempZjb, 2)));
+ break;
+ case 2:
+ ylss = (tempDp * (Math.sqrt(1 - tempZjb) - tempLiuChuXiShu * Math.pow(tempZjb, 2)) / (Math.sqrt(1 - tempZjb) + tempLiuChuXiShu * Math.pow(tempZjb, 2)));
+ break;
+ }
+ return ylss;
+ }
+ //查表计算粘度μ
+ // VBConversions Note: Former VB static variables moved to class level because they aren't supported in C#.
+ private final double[][] Dlndjs_Dlnd_Data = new double[8][11];
+ private final double[] Dlndjs_Dlnd_T = new double[8];
+ private final double[] Dlndjs_Dlnd_P = new double[11];
+
+ public final double Dlndjs(double tempP_jy, double tempT, int PU, int TU)
+ {
+ double s1 = 0;
+ double s2 = 0;
+ double ky = 0;
+ double kx = 0;
+ int i = 0;
+ int m = 0;
+ int n = 0;
+ //On Error Resume Next VBConversions Warning: On Error Resume Next not supported in C#
+ Dlndjs_Dlnd_T[0] = -15 + 273.15;
+ Dlndjs_Dlnd_T[1] = 0 + 273.15;
+ Dlndjs_Dlnd_T[2] = 15 + 273.15;
+ Dlndjs_Dlnd_T[3] = 30 + 273.15;
+ Dlndjs_Dlnd_T[4] = 45 + 273.15;
+ Dlndjs_Dlnd_T[5] = 60 + 273.15;
+ Dlndjs_Dlnd_T[6] = 75 + 273.15;
+ Dlndjs_Dlnd_T[7] = 90 + 273.15;
+
+ Dlndjs_Dlnd_P[0] = 0.1F;
+ Dlndjs_Dlnd_P[1] = 1;
+ Dlndjs_Dlnd_P[2] = 2;
+ Dlndjs_Dlnd_P[3] = 3;
+ Dlndjs_Dlnd_P[4] = 4;
+ Dlndjs_Dlnd_P[5] = 5;
+ Dlndjs_Dlnd_P[6] = 6;
+ Dlndjs_Dlnd_P[7] = 7;
+ Dlndjs_Dlnd_P[8] = 8;
+ Dlndjs_Dlnd_P[9] = 9;
+ Dlndjs_Dlnd_P[10] = 10;
+ Dlndjs_Dlnd_Data[0][0] = 976;
+ Dlndjs_Dlnd_Data[1][0] = 1027;
+ Dlndjs_Dlnd_Data[2][0] = 1071;
+ Dlndjs_Dlnd_Data[3][0] = 1123;
+ Dlndjs_Dlnd_Data[4][0] = 1167;
+ Dlndjs_Dlnd_Data[5][0] = 1213;
+ Dlndjs_Dlnd_Data[6][0] = 1260;
+ Dlndjs_Dlnd_Data[7][0] = 1303;
+ Dlndjs_Dlnd_Data[0][1] = 991;
+ Dlndjs_Dlnd_Data[1][1] = 1040;
+ Dlndjs_Dlnd_Data[2][1] = 1082;
+ Dlndjs_Dlnd_Data[3][1] = 1135;
+ Dlndjs_Dlnd_Data[4][1] = 1178;
+ Dlndjs_Dlnd_Data[5][1] = 1224;
+ Dlndjs_Dlnd_Data[6][1] = 1270;
+ Dlndjs_Dlnd_Data[7][1] = 1312;
+ Dlndjs_Dlnd_Data[0][2] = 1014;
+ Dlndjs_Dlnd_Data[1][2] = 1063;
+ Dlndjs_Dlnd_Data[2][2] = 1106;
+ Dlndjs_Dlnd_Data[3][2] = 1153;
+ Dlndjs_Dlnd_Data[4][2] = 1196;
+ Dlndjs_Dlnd_Data[5][2] = 1239;
+ Dlndjs_Dlnd_Data[6][2] = 1281;
+ Dlndjs_Dlnd_Data[7][2] = 1323;
+ Dlndjs_Dlnd_Data[0][3] = 1044;
+ Dlndjs_Dlnd_Data[1][3] = 1091;
+ Dlndjs_Dlnd_Data[2][3] = 1127;
+ Dlndjs_Dlnd_Data[3][3] = 1174;
+ Dlndjs_Dlnd_Data[4][3] = 1216;
+ Dlndjs_Dlnd_Data[5][3] = 1257;
+ Dlndjs_Dlnd_Data[6][3] = 1297;
+ Dlndjs_Dlnd_Data[7][3] = 1338;
+ Dlndjs_Dlnd_Data[0][4] = 1073;
+ Dlndjs_Dlnd_Data[1][4] = 1118;
+ Dlndjs_Dlnd_Data[2][4] = 1149;
+ Dlndjs_Dlnd_Data[3][4] = 1195;
+ Dlndjs_Dlnd_Data[4][4] = 1236;
+ Dlndjs_Dlnd_Data[5][4] = 1275;
+ Dlndjs_Dlnd_Data[6][4] = 1313;
+ Dlndjs_Dlnd_Data[7][4] = 1352;
+ Dlndjs_Dlnd_Data[0][5] = 1114;
+ Dlndjs_Dlnd_Data[1][5] = 1151;
+ Dlndjs_Dlnd_Data[2][5] = 1180;
+ Dlndjs_Dlnd_Data[3][5] = 1224;
+ Dlndjs_Dlnd_Data[4][5] = 1261;
+ Dlndjs_Dlnd_Data[5][5] = 1297;
+ Dlndjs_Dlnd_Data[6][5] = 1333;
+ Dlndjs_Dlnd_Data[7][5] = 1372;
+ Dlndjs_Dlnd_Data[0][6] = 1156;
+ Dlndjs_Dlnd_Data[1][6] = 1185;
+ Dlndjs_Dlnd_Data[2][6] = 1211;
+ Dlndjs_Dlnd_Data[3][6] = 1253;
+ Dlndjs_Dlnd_Data[4][6] = 1287;
+ Dlndjs_Dlnd_Data[5][6] = 1320;
+ Dlndjs_Dlnd_Data[6][6] = 1352;
+ Dlndjs_Dlnd_Data[7][6] = 1391;
+ Dlndjs_Dlnd_Data[0][7] = 1207;
+ Dlndjs_Dlnd_Data[1][7] = 1230;
+ Dlndjs_Dlnd_Data[2][7] = 1250;
+ Dlndjs_Dlnd_Data[3][7] = 1289;
+ Dlndjs_Dlnd_Data[4][7] = 1318;
+ Dlndjs_Dlnd_Data[5][7] = 1346;
+ Dlndjs_Dlnd_Data[6][7] = 1374;
+ Dlndjs_Dlnd_Data[7][7] = 1412;
+ Dlndjs_Dlnd_Data[0][8] = 1261;
+ Dlndjs_Dlnd_Data[1][8] = 1276;
+ Dlndjs_Dlnd_Data[2][8] = 1289;
+ Dlndjs_Dlnd_Data[3][8] = 1324;
+ Dlndjs_Dlnd_Data[4][8] = 1350;
+ Dlndjs_Dlnd_Data[5][8] = 1373;
+ Dlndjs_Dlnd_Data[6][8] = 1396;
+ Dlndjs_Dlnd_Data[7][8] = 1432;
+ Dlndjs_Dlnd_Data[0][9] = 1331;
+ Dlndjs_Dlnd_Data[1][9] = 1331;
+ Dlndjs_Dlnd_Data[2][9] = 1335;
+ Dlndjs_Dlnd_Data[3][9] = 1366;
+ Dlndjs_Dlnd_Data[4][9] = 1385;
+ Dlndjs_Dlnd_Data[5][9] = 1403;
+ Dlndjs_Dlnd_Data[6][9] = 1424;
+ Dlndjs_Dlnd_Data[7][9] = 1456;
+ Dlndjs_Dlnd_Data[0][10] = 1405;
+ Dlndjs_Dlnd_Data[1][10] = 1389;
+ Dlndjs_Dlnd_Data[2][10] = 1383;
+ Dlndjs_Dlnd_Data[3][10] = 1409;
+ Dlndjs_Dlnd_Data[4][10] = 1421;
+ Dlndjs_Dlnd_Data[5][10] = 1435;
+ Dlndjs_Dlnd_Data[6][10] = 1451;
+ Dlndjs_Dlnd_Data[7][10] = 1482;
+
+ if (tempT < Dlndjs_Dlnd_T[0])
+ {
+ tempT = Dlndjs_Dlnd_T[0];
+ }
+ if (tempT > Dlndjs_Dlnd_T[7])
+ {
+ tempT = Dlndjs_Dlnd_T[7];
+ }
+ if (tempP_jy < Dlndjs_Dlnd_P[0])
+ {
+ tempP_jy = Dlndjs_Dlnd_P[0];
+ }
+ if (tempP_jy > Dlndjs_Dlnd_P[10])
+ {
+ tempP_jy = Dlndjs_Dlnd_P[10];
+ }
+
+ for ( i = 0; i <= 6; i++)
+ {
+ if (tempT >= Dlndjs_Dlnd_T[i] && tempT <= Dlndjs_Dlnd_T[i + 1])
+ {
+ m = i;
+ break;
+ }
+ }
+
+ for (i = 0; i <= 9; i++)
+ {
+ if (tempP_jy >= Dlndjs_Dlnd_P[i] && tempP_jy <= Dlndjs_Dlnd_P[i + 1])
+ {
+ n = i;
+ break;
+ }
+ }
+
+ if (Dlndjs_Dlnd_P[n + 1] - Dlndjs_Dlnd_P[n] != 0)
+ {
+ ky = (tempP_jy - Dlndjs_Dlnd_P[n]) / (Dlndjs_Dlnd_P[n + 1] - Dlndjs_Dlnd_P[n]);
+ }
+ else
+ {
+ ky = 0;
+ }
+ if (Dlndjs_Dlnd_T[m + 1] - Dlndjs_Dlnd_T[m] != 0)
+ {
+ kx = (tempT - Dlndjs_Dlnd_T[m]) / (Dlndjs_Dlnd_T[m + 1] - Dlndjs_Dlnd_T[m]);
+ }
+ else
+ {
+ kx = 0;
+ }
+ s1 = Dlndjs_Dlnd_Data[m][n] + (Dlndjs_Dlnd_Data[m][n + 1] - Dlndjs_Dlnd_Data[m][n]) * ky;
+ s2 = Dlndjs_Dlnd_Data[m + 1][n] + (Dlndjs_Dlnd_Data[m + 1][n + 1] - Dlndjs_Dlnd_Data[m + 1][n]) * ky;
+ return (s1 + (s2 - s1) * kx) / 100000.0D;
+ }
+ //可膨胀系数计算
+ private double KePenZhang_JiSuan(double tempP_jy, double tempDp_Pa, double tempZjb, double tempDszs, int JIeliuType, int JiSuanBiaoZhun) // 求可膨胀系数
+ {
+ double returnValue = 0;
+ //0标准孔板
+ //1ISA1932喷嘴
+ //2长径喷嘴
+ //3文丘里喷嘴
+ //4粗铸收缩段经典文丘里管
+ //5机械加工收缩段经典文丘里管
+ //6粗焊铁板收缩段经典文丘里管
+ //7 1/4圆孔板
+
+ double tuo = 0;
+ switch (JIeliuType)
+ {
+ case 0: //孔板流量计算
+ switch (JiSuanBiaoZhun)
+ {
+ case 0: //6143-2004
+ tuo = (tempP_jy - tempDp_Pa) / (tempP_jy );
+ returnValue = 1 - (0.351 + 0.256 * Math.pow(tempZjb, 4) + 0.93 * Math.pow(tempZjb, 8)) * (1 - Math.pow(tuo, (1 / tempDszs)));
+ break;
+ case 1: //6143-1996
+ returnValue = 1 - (0.41 + 0.35 * Math.pow(tempZjb, 4)) * tempDp_Pa / ( tempP_jy * tempDszs);
+ break;
+
+ }
+ break;
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ switch (JiSuanBiaoZhun)
+ {
+ case 0:
+
+ //标准喷嘴 iso5167-2002
+ tuo = (tempP_jy - tempDp_Pa) / (tempP_jy );
+ returnValue = Math.pow((((tempDszs * Math.pow(tuo, (2 / tempDszs))) / (tempDszs - 1)) * ((1 - Math.pow(tempZjb, 4)) / (1 - Math.pow(tempZjb, 4) * Math.pow(tuo, (2 / tempDszs)))) * ((1 - Math.pow(tuo, ((tempDszs - 1) / tempDszs))) / (1 - tuo))), 0.5);
+ break;
+
+ case 1: //iso5167-93
+ returnValue = 1 - (0.41 + 0.35 * Math.pow(tempZjb, 4)) * tempDp_Pa / ( tempP_jy * tempDszs);
+ break;
+ }
+ break;
+ case 7: //1/4圆孔板
+ returnValue = 1 - (0.41 + 0.35 * Math.pow(tempZjb, 4)) * tempDp_Pa / ( tempP_jy * tempDszs);
+ break;
+ case 8: //锥形入口孔板
+ tuo = (tempP_jy - tempDp_Pa) / (tempP_jy );
+ returnValue = 1 - (0.351 + 0.256 * Math.pow(tempZjb, 4) + 0.93 * Math.pow(tempZjb, 8)) * (1 - Math.pow(tuo, (1 / tempDszs)));
+
+ tuo = (tempP_jy - tempDp_Pa) / (tempP_jy );
+
+ returnValue = 0.5 * (returnValue + Math.pow((((tempDszs * Math.pow(tuo, (2 / tempDszs))) / (tempDszs - 1)) * ((1 - Math.pow(tempZjb, 4)) / (1 - Math.pow(tempZjb, 4) * Math.pow(tuo, (2 / tempDszs)))) * ((1 - Math.pow(tuo, ((tempDszs - 1) / tempDszs))) / (1 - tuo))), 0.5));
+ break;
+ case 9: //偏心孔板
+ returnValue = 1 - (0.41 + 0.35 * Math.pow(tempZjb, 4)) * tempDp_Pa / ( tempP_jy * tempDszs);
+ break;
+
+ }
+ return returnValue;
+ }
+ //流出系数计算
+ public final double C_JiSuan(double tempGj, double tempZjb, double tempReD, double tempconQvA, int tempQyfs, int JieLiuType, int JiSuanBiaoZhun)
+ {
+ double returnValue = 0;
+ //流出系数计算函数
+ //输入:直径比,雷诺数,取压方式,节流装置类型,计算采用标准
+ //输出:流出系数
+
+ //jieliutype
+
+ //0标准孔板
+ //1ISA1932喷嘴
+ //2长径喷嘴
+ //3文丘里喷嘴
+ //4粗铸收缩段经典文丘里管
+ //5机械加工收缩段经典文丘里管
+ //6粗焊铁板收缩段经典文丘里管
+
+ double L1 = 0;
+ double L2 = 0;
+ switch (JieLiuType)
+ {
+ case 0: //孔板
+ switch (tempQyfs)
+ {
+ case 0:
+ L1 = 25.4 / tempGj;
+ L2 = L1;
+ break;
+ case 1:
+ L1 = 0;
+ L2 = 0;
+ break;
+ case 2:
+ L1 = 1;
+ L2 = 0.47F;
+ break;
+ }
+
+ switch (JiSuanBiaoZhun)
+ {
+ case 0: //6143-2004
+ if (tempGj >= 71.12)
+ {
+ returnValue = 0.5961 + 0.0261 * Math.pow(tempZjb, 2) - 0.216 * Math.pow(tempZjb, 8) + 0.000521 * Math.pow((1000000.0D * tempZjb / tempReD), 0.7) + (0.0188 + 0.0063 * Math.pow((19000 * tempZjb / tempReD), 0.8)) * Math.pow(tempZjb, 3.5) * Math.pow((1000000.0D / tempReD), 0.3) + (0.043 + 0.08 * Math.exp(-10 * L1) - 0.123 * Math.exp(-7 * L1)) * (1 - 0.11 * Math.pow((19000 * tempZjb / tempReD), 0.8)) * (Math.pow(tempZjb, 4) * Math.pow((1 - Math.pow(tempZjb, 4)), (-1))) - 0.031 * (2 * L2 / (1 - tempZjb) - 0.8 * Math.pow((2 * L2 / (1 - tempZjb)), 1.1)) * Math.pow(tempZjb, 1.3);
+
+ }
+ else if (tempGj < 71.12)
+ {
+ returnValue = (0.5961 + 0.0261 * Math.pow(tempZjb, 2) - 0.216 * Math.pow(tempZjb, 8) + 0.000521 * Math.pow((1000000.0D * tempZjb / tempReD), 0.7) + (0.0188 + 0.0063 * Math.pow((19000 * tempZjb / tempReD), 0.8)) * Math.pow(tempZjb, 3.5) * Math.pow((1000000.0D / tempReD), 0.3) + (0.043 + 0.08 * Math.exp(-10 * L1) - 0.123 * Math.exp(-7 * L1)) * (1 - 0.11 * Math.pow((19000 * tempZjb / tempReD), 0.8)) * Math.pow(tempZjb, 4) * Math.pow((1 - Math.pow(tempZjb, 4)), (-1)) - 0.031 * (2 * L2 / (1 - tempZjb) - 0.8 * Math.pow((2 * L2 * (1 - tempZjb)), 1.1)) * Math.pow(tempZjb, 1.3) + 0.011 * (0.75 - tempZjb) * (2.8 - tempGj / 25.4));
+ }
+ break;
+ case 1: //6143-1996
+ if (0.09 * L1 >= 0.039)
+ {
+ returnValue = 0.5959 + 0.0312 * Math.pow(tempZjb, (2.1)) - 0.184 * Math.pow(tempZjb, 8) + 0.0029 * Math.pow(tempZjb, 2.5) * Math.pow((1000000.0D / tempReD), 0.75) + 0.039 * Math.pow(tempZjb, 4) * Math.pow((1 - Math.pow(tempZjb, 4)), (-1)) - 0.0337 * L1 * Math.pow(tempZjb, 3);
+ }
+ else if (0.09 * L1 < 0.039)
+ {
+ returnValue = (0.5959 + 0.0312 * Math.pow(tempZjb, (2.1)) - 0.184 * Math.pow(tempZjb, 8) + 0.0029 * Math.pow(tempZjb, 2.5) * Math.pow((1000000.0D / tempReD), 0.75) + 0.09 * L1 * Math.pow(tempZjb, 4) * Math.pow((1 - Math.pow(tempZjb, 4)), (-1)) - 0.0337 * L1 * Math.pow(tempZjb, 3));
+ }
+ break;
+ }
+ break;
+
+
+
+ case 1: //ISA1932喷嘴
+ returnValue = (0.99 - 0.2262 * Math.pow(tempZjb, 4.1) - (0.00175 * Math.pow(tempZjb, 2) - 0.0033 * Math.pow(tempZjb, 4.15)) * (1000000.0D / Math.pow(tempReD, 1.15)));
+ break;
+
+ case 2: //长径喷嘴
+ returnValue = (0.9965 - 0.00653 * Math.pow(tempZjb, 0.5) * Math.pow((1000000.0D / tempReD), 0.5));
+ break;
+ case 3: //文丘里喷嘴
+ returnValue = (0.9858 - 0.196 * Math.pow(tempZjb, 4.5));
+ break;
+ case 4: //粗铸收缩段经典文丘里管
+ returnValue = (0.984F);
+ break;
+ case 5: //机械加工收缩段经典文丘里管
+ returnValue = (0.995F);
+ break;
+ case 6: //粗焊铁板收缩段经典文丘里管
+ returnValue = (0.985F);
+ break;
+ case 7: //1/4圆孔板
+ returnValue = 0.73823 - 0.3309 * tempZjb - 1.1615 * Math.pow(tempZjb, 2) + 1.5084 * Math.pow(tempZjb, 3);
+ break;
+ case 8: //锥形入口孔板
+ returnValue = (0.734F);
+ break;
+ case 9: //偏心孔板
+ returnValue = 0.9355 - 1.6889 * tempZjb + 3.0428 * Math.pow(tempZjb, 2) - 1.7989 * Math.pow(tempZjb, 3);
+
+
+ break;
+ }
+ double tempRed1 = 0;
+ switch (JieLiuType)
+ {
+ case 0: //孔板流量计算
+ tempRed1 = tempconQvA * returnValue;
+ switch (JieLiuType)
+ {
+ case 0:
+ if (tempRed1 < (170 * Math.pow(tempZjb, 2) * tempGj))
+ {
+ JOptionPane.showMessageDialog(null, "雷诺数超过标准孔板的使用范围!停止计算!", "提示", JOptionPane.PLAIN_MESSAGE);
+ return returnValue;
+ }
+ break;
+ case 1:
+ if (tempZjb >= 0.1 & tempZjb <= 0.56)
+ {
+ if (tempRed1 < 5000)
+ {
+ JOptionPane.showMessageDialog(null, "雷诺数超过标准喷嘴的使用范围!停止计算!", "提示", JOptionPane.PLAIN_MESSAGE);
+ return returnValue;
+ }
+ }
+ if (tempZjb > 0.56)
+ {
+ if (tempRed1 < (16000 * Math.pow(tempZjb, 2) * tempGj))
+ {
+ JOptionPane.showMessageDialog(null, "雷诺数超过标准喷嘴的使用范围!停止计算!", "提示", JOptionPane.PLAIN_MESSAGE);
+ return returnValue;
+ }
+ }
+ break;
+ }
+ break;
+
+ case 1: //标准喷嘴
+ tempRed1 = tempconQvA * returnValue;
+ if (tempZjb >= 0.3 & tempZjb < 0.44)
+ {
+ if (tempRed1 < 70000 | tempRed1 > 10000000.0D)
+ {
+ JOptionPane.showMessageDialog(null, "雷诺数超过标准喷嘴的使用范围!停止计算!", "提示", JOptionPane.PLAIN_MESSAGE);
+ }
+ }
+ if (tempZjb >= 0.44 & tempZjb < 0.8)
+ {
+ if (tempRed1 < 20000 | tempRed1 > 10000000.0D)
+ {
+ JOptionPane.showMessageDialog(null, "雷诺数超过标准喷嘴的使用范围!停止计算!", "提示", JOptionPane.PLAIN_MESSAGE);
+ }
+ }
+ break;
+
+
+ case 2: //长径喷嘴
+ tempRed1 = tempconQvA * returnValue;
+ if (tempRed1 < 10000.0D | tempRed1 > 10000000.0D)
+ {
+ JOptionPane.showMessageDialog(null, "雷诺数超过长径喷嘴的使用范围!停止计算!", "提示", JOptionPane.PLAIN_MESSAGE);
+ }
+ break;
+ case 3: //文丘里喷嘴
+ tempRed1 = tempconQvA * returnValue;
+ if (tempRed1 < 150000.0D | tempRed1 > 2000000.0D)
+ {
+ JOptionPane.showMessageDialog(null, "雷诺数超过文丘里喷嘴的使用范围!停止计算!", "提示", JOptionPane.PLAIN_MESSAGE);
+ }
+ break;
+ case 4: //粗铸收缩段经典文丘里管
+ tempRed1 = tempconQvA * returnValue;
+ if (tempRed1 < 200000.0D | tempRed1 > 2000000.0D)
+ {
+ JOptionPane.showMessageDialog(null, "雷诺数超过粗铸收缩段经典文丘里管的使用范围!停止计算!", "提示", JOptionPane.PLAIN_MESSAGE);
+ return returnValue;
+ }
+ break;
+ case 5: //机械加工收缩段经典文丘里管
+ tempRed1 = tempconQvA * returnValue;
+ if (tempRed1 < 200000.0D | tempRed1 > 1000000.0D)
+ {
+ JOptionPane.showMessageDialog(null, "雷诺数超过机械加工收缩段经典文丘里管的使用范围!停止计算!", "提示", JOptionPane.PLAIN_MESSAGE);
+ }
+ break;
+ case 6: //粗焊铁板收缩段经典文丘里管
+ tempRed1 = tempconQvA * returnValue;
+ if (tempRed1 < 200000.0D | tempRed1 > 2000000.0D)
+ {
+ JOptionPane.showMessageDialog(null, "雷诺数超过粗焊铁板收缩段经典文丘里管的使用范围!停止计算!", "提示", JOptionPane.PLAIN_MESSAGE);
+ }
+ break;
+
+ //标准孔板
+ //ISA1932喷嘴
+ //长径喷嘴
+ //文丘里喷嘴
+ //粗铸收缩段经典文丘里管
+ //机械加工收缩段经典文丘里管
+ //粗焊铁板收缩段经典文丘里管
+
+
+
+
+ }
+ return returnValue;
+ }
+
+ private double BkTable(double temPrk, double tempKj, int tempBkjsff)
+ {
+
+ double[] BkTable_x = new double[10];
+ double[] BkTable_Y = new double[10];
+
+
+ //On Error Resume Next VBConversions Warning: On Error Resume Next not supported in C#
+
+ if (tempBkjsff == 1)
+ {
+
+ double tempRkBiKj = 0;
+ tempRkBiKj = temPrk / tempKj;
+
+ // static double[] x = new double[10]; //VBConversions Note: Static variable moved to class level and renamed BkTable_x. Local static variables are not supported in C#.
+ // static double[] Y = new double[10]; //VBConversions Note: Static variable moved to class level and renamed BkTable_Y. Local static variables are not supported in C#.
+ int i = 0;
+ int xIndex = 0;
+ //If x(0) = 0 Then
+ BkTable_x[0] = 0.0004F;
+ BkTable_x[1] = 0.001F;
+ BkTable_x[2] = 0.002F;
+ BkTable_x[3] = 0.004F;
+ BkTable_x[4] = 0.006F;
+ BkTable_x[5] = 0.008F;
+ BkTable_x[6] = 0.01F;
+ BkTable_x[7] = 0.012F;
+ BkTable_x[8] = 0.014F;
+ BkTable_x[9] = 0.015F;
+
+ BkTable_Y[0] = 1;
+ BkTable_Y[1] = 1.005F;
+ BkTable_Y[2] = 1.012F;
+ BkTable_Y[3] = 1.022F;
+ BkTable_Y[4] = 1.032F;
+ BkTable_Y[5] = 1.04F;
+ BkTable_Y[6] = 1.048F;
+ BkTable_Y[7] = 1.055F;
+ BkTable_Y[8] = 1.062F;
+ BkTable_Y[9] = 1.065F;
+ //End If
+
+ if (tempRkBiKj <= 0.0004)
+ {
+ return 1;
+
+ }
+ if (tempRkBiKj > 0.015)
+ {
+ return 1.065F;
+
+ }
+
+ for (i = 0; i <= 8; i++)
+ {
+ if (tempRkBiKj >= BkTable_x[i] && tempRkBiKj <= BkTable_x[i + 1])
+ {
+ xIndex = i;
+ break;
+ }
+ }
+ return BkTable_Y[xIndex] + (tempRkBiKj - BkTable_x[xIndex]) * (BkTable_Y[xIndex + 1] - BkTable_Y[xIndex]) / (BkTable_x[xIndex + 1] - BkTable_x[xIndex]);
+ }
+ return 0;
+ }
+ //管道粗糙度计算
+ private double CcdXsjs(double tempPipeType, double tempGj, double tempZjb, double TempRed)
+ {
+ double returnValue = 0;
+ //粗糙度系数计算
+ double Jdccd = 0; //绝对粗糙度
+ double Xdccd = 0; //相对粗糙度
+ //Dim CcdXs As single
+ double s1 = 0;
+ double s2 = 0;
+ double ky = 0;
+ double kx = 0;
+ int i = 0;
+ int m = 0;
+ int n = 0;
+ if (tempPipeType == 0)
+ {
+ Jdccd = 0.029F;
+
+ Jdccd = 0.075F;
+ }
+ else if (tempPipeType == 2)
+ {
+ Jdccd = 0.075F;
+
+ Jdccd = 0.075F;
+ }
+ else if (tempPipeType == 4)
+ {
+ Jdccd = 0.1F;
+
+ Jdccd = 0.15F;
+ }
+ else if (tempPipeType == 6)
+ {
+ Jdccd = 1;
+
+ Jdccd = 2.1F;
+ }
+ else if (tempPipeType == 8)
+ {
+ Jdccd = 0.04F;
+
+ Jdccd = 0.15F;
+ }
+ else if (tempPipeType == 10)
+ {
+ Jdccd = 0.13F;
+
+ Jdccd = 0.25F;
+ }
+ Xdccd = tempGj / Jdccd;
+ if (Xdccd < 400)
+ {
+ JOptionPane.showMessageDialog(null, "粗糙度取得太高,粗略计算", "提示", JOptionPane.PLAIN_MESSAGE);
+ Xdccd = 400;
+ }
+ if (Xdccd >= 3400)
+ {
+ Xdccd = 3400;
+ }
+
+ if (Xdccd < 3200 & Math.pow(tempZjb, 2) > 0.1 & Math.pow(tempZjb, 2) < 0.64)
+ {
+
+ int[] Xdccdb = new int[10];
+ double[] Btf = new double[8];
+ double[][] CcdXsb = new double[10][8];
+
+ Xdccdb[0] = 400;
+ Xdccdb[1] = 800;
+ Xdccdb[2] = 1200;
+ Xdccdb[3] = 1600;
+ Xdccdb[4] = 2000;
+ Xdccdb[5] = 2400;
+ Xdccdb[6] = 2800;
+ Xdccdb[7] = 3200;
+ Xdccdb[8] = 3400;
+
+ Btf[0] = 0.1F;
+ Btf[1] = 0.2F;
+ Btf[2] = 0.3F;
+ Btf[3] = 0.4F;
+ Btf[4] = 0.5F;
+ Btf[5] = 0.6F;
+ Btf[6] = 0.64F;
+
+ CcdXsb[0][0] = 1.002;
+ CcdXsb[1][0] = 1;
+ CcdXsb[2][0] = 1;
+ CcdXsb[3][0] = 1;
+ CcdXsb[4][0] = 1;
+ CcdXsb[5][0] = 1;
+ CcdXsb[6][0] = 1;
+ CcdXsb[7][0] = 1;
+ CcdXsb[8][0] = 1;
+ CcdXsb[0][1] = 1.003;
+ CcdXsb[1][1] = 1.002;
+ CcdXsb[2][1] = 1.001;
+ CcdXsb[3][1] = 1;
+ CcdXsb[4][1] = 1;
+ CcdXsb[5][1] = 1;
+ CcdXsb[6][1] = 1;
+ CcdXsb[7][1] = 1;
+ CcdXsb[8][0] = 1;
+ CcdXsb[0][2] = 1.006;
+ CcdXsb[1][2] = 1.004;
+ CcdXsb[2][2] = 1.002;
+ CcdXsb[3][2] = 1.001;
+ CcdXsb[4][2] = 1;
+ CcdXsb[5][2] = 1;
+ CcdXsb[6][2] = 1;
+ CcdXsb[7][2] = 1;
+ CcdXsb[8][0] = 1;
+ CcdXsb[0][3] = 1.009;
+ CcdXsb[1][3] = 1.006;
+ CcdXsb[2][3] = 1.004;
+ CcdXsb[3][3] = 1.002;
+ CcdXsb[4][3] = 1.001;
+ CcdXsb[5][3] = 1;
+ CcdXsb[6][3] = 1;
+ CcdXsb[7][3] = 1;
+ CcdXsb[8][0] = 1;
+ CcdXsb[0][4] = 1.014;
+ CcdXsb[1][4] = 1.009;
+ CcdXsb[2][4] = 1.006;
+ CcdXsb[3][4] = 1.004;
+ CcdXsb[4][4] = 1.002;
+ CcdXsb[5][4] = 1.001;
+ CcdXsb[6][4] = 1;
+ CcdXsb[7][4] = 1;
+ CcdXsb[8][0] = 1;
+ CcdXsb[0][5] = 1.02;
+ CcdXsb[1][5] = 1.013;
+ CcdXsb[2][5] = 1.009;
+ CcdXsb[3][5] = 1.006;
+ CcdXsb[4][5] = 1.003;
+ CcdXsb[5][5] = 1.002;
+ CcdXsb[6][5] = 1;
+ CcdXsb[7][5] = 1;
+ CcdXsb[8][0] = 1;
+ CcdXsb[0][6] = 1.024;
+ CcdXsb[1][6] = 1.016;
+ CcdXsb[2][6] = 1.011;
+ CcdXsb[3][6] = 1.007;
+ CcdXsb[4][6] = 1.004;
+ CcdXsb[5][6] = 1.002;
+ CcdXsb[6][6] = 1.002;
+ CcdXsb[7][6] = 1;
+ CcdXsb[8][0] = 1;
+
+ for (i = 0; i <= 8; i++)
+ {
+ if (Xdccd >= Xdccdb[i] && Xdccd <= Xdccdb[i + 1])
+ {
+ m = i;
+ break;
+ }
+ }
+ for (i = 0; i <= 6; i++)
+ {
+ if (Math.pow(tempZjb, 2) >= Btf[i] && Math.pow(tempZjb, 2) <= Btf[i + 1])
+ {
+ n = i;
+ break;
+ }
+ }
+
+ ky = (Btf[n + 1] - Btf[n] != 0) ? ((Math.pow(tempZjb, 2) - Btf[n]) / (Btf[n + 1] - Btf[n])) : 0;
+
+ kx = (Xdccdb[m + 1] - Xdccdb[m] != 0) ? ((Xdccd - Xdccdb[m]) / (Xdccdb[m + 1] - Xdccdb[m])) : 0;
+
+ s1 = CcdXsb[m][n] + (CcdXsb[m][n + 1] - CcdXsb[m][n]) * ky;
+ s2 = CcdXsb[m + 1][n] + (CcdXsb[m + 1][n + 1] - CcdXsb[m + 1][n]) * ky;
+ returnValue = s1 + (s2 - s1) * kx;
+
+ returnValue = TempRed > 1000000.0 ? returnValue : ((returnValue - 1) * Math.pow((Math.log10(TempRed) / 2), 2) + 1);
+
+ }
+ else
+ {
+ returnValue = 1;
+ }
+ return returnValue;
+ }
+
+ // #########################################################################
+ // ######################'流量转换 标况转工况##############################
+ // ########################################################################
+ public static double FlowConvert_BaseToWork(FlowProps flowProps, GasProps gasProps)
+ {
+ double tempPn = 0;
+ double tempTn = 0;
+
+ try
+ {
+
+ if (gasProps.dZf == 0 || gasProps.dZb == 0)
+ {
+ return 0.0;
+ }
+
+
+ switch (gasProps.dCbtj)
+ {
+ case 2:
+ tempPn = 101325;
+ tempTn = 273.15;
+ break;
+
+ case 1:
+ tempPn = 101325;
+ tempTn = 288.15;
+ break;
+
+ case 0:
+ tempPn = 101325;
+ tempTn = 293.15;
+ break;
+
+ case 3:
+ tempPn = 10155981;
+ tempTn = 288.7055555;
+ break;
+ }
+
+
+ flowProps.setdVFlowf(flowProps.getdVFlowb() * (tempPn * flowProps.getdTf() * gasProps.dZf) / (flowProps.getdPf() * tempTn * gasProps.dZb));
+ return flowProps.getdVFlowf();
+ // WARNING: ErrDo: is not supported
+ }
+ catch (RuntimeException exc)
+ {
+ return 0.0;
+
+ }
+ }
+
+ // #########################################################################
+ // ######################流量转换工况转标况##############################
+ // ########################################################################
+ public static double FlowConvert_WorkToBase(FlowProps flowProps, GasProps gasProps)
+ {
+ double tempPn = 0;
+ double tempTn = 0;
+
+ // WARNING: On Error GOTO ErrDo is not supported
+ try
+ {
+
+ switch (gasProps.dCbtj)
+ {
+ case 2:
+ tempPn = 101325;
+ tempTn = 273.15;
+ break;
+
+ case 1:
+ tempPn = 101325;
+ tempTn = 288.15;
+ break;
+
+ case 0:
+ tempPn = 101325;
+ tempTn = 293.15;
+ break;
+
+ case 3:
+ tempPn = 0.10155981;
+ tempTn = 288.7055555;
+ break;
+ }
+ flowProps.setdVFlowb(flowProps.getdVFlowf() * (flowProps.getdPf() * tempTn * gasProps.dZb) / (tempPn * flowProps.getdTf() * gasProps.dZf));
+ return flowProps.getdVFlowb();
+ // WARNING: ErrDo: is not supported
+ }
+ catch (RuntimeException exc)
+ {
+ return 0.0;
+ }
+
+ }
+}
diff --git a/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/controller/GasController.java b/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/controller/GasController.java
index b580443..08f64ab 100644
--- a/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/controller/GasController.java
+++ b/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/controller/GasController.java
@@ -2,11 +2,15 @@ package com.ruoyi.ngCalTools.controller;
// GasController.java
+import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.ngCalTools.model.GasProps;
+import com.ruoyi.ngCalTools.model.FlowProps;
import com.ruoyi.ngCalTools.service.DetailService;
import com.ruoyi.ngCalTools.service.GBT11062Service;
import com.ruoyi.ngCalTools.service.ThermService;
import com.ruoyi.ngCalTools.utils.GasConstants;
+import com.ruoyi.system.controller.SysUnitConvertController;
+import com.ruoyi.system.controller.UnitConvert;
import org.springframework.web.bind.annotation.*;
@RestController
@@ -14,25 +18,68 @@ import org.springframework.web.bind.annotation.*;
public class GasController {
+ private final UnitConvert unitConvert;
public ThermService thermService;
public DetailService detailService;
public GBT11062Service gbt11062Service;
+ public GasController(UnitConvert unitConvert) {
+ this.unitConvert = unitConvert;
+ }
+ @PostMapping ("/ngCalc")
+ public AjaxResult ngCalc(@RequestBody FlowProps flowProps) {
+ thermService = new ThermService();
+ detailService = new DetailService();
+ gbt11062Service = new GBT11062Service();
+ GasProps gasProps = new GasProps();
+ //大气压力转换成Pa
+ double tempPatm = unitConvert.ConvertUniter("pressure", flowProps.getdPatm(), flowProps.getdPatmUnit(), 0);
+ //压力转换成Pa
+ double tempPf = unitConvert.ConvertUniter("pressure", flowProps.getdPf(), flowProps.getdPfUnit(), 0);
+ //温度转换成K
+ double tempTf = unitConvert.ConvertUniter("temperature", flowProps.getdTf(), flowProps.getdTfUnit(), 2);
+ if (flowProps.getdPfType() == 0) //0是表压
+ {
+ gasProps.dPf = tempPatm + tempPf;
+ } else {
+ gasProps.dPf = tempPf;
+ }
+ gasProps.dTf = tempTf;
+ gasProps.dCbtj = flowProps.getdCbtj();
+ String[] stringArray = flowProps.getdngComponents().split("_");
+ double[] doubleArray = new double[stringArray.length]; // 遍历字符串数组,将每个元素转换为 double 类型
+ for (int i = 0; i < stringArray.length; i++) {
+ try {
+ doubleArray[i] = Double.parseDouble(stringArray[i]) / 100;
+ } catch (NumberFormatException e) {
+ // 处理转换异常
+ System.err.println("无法将字符串 " + stringArray[i] + " 转换为 double 类型: " + e.getMessage());
+ }
+ }
+ gasProps.adMixture = doubleArray;
+ Crit(gasProps, 0); //计算临界流函数所有参数都计算了
+ return AjaxResult.success(gasProps);
+ }
- @PostMapping ("/calculate")
- public GasProps calculateProperties(@RequestBody GasProps tempPar) {
- Zcal(tempPar, 0);
-return tempPar;
+
+
+ public void ngCalcVoid( FlowProps flowProps,GasProps gasProps) {
+ thermService = new ThermService();
+ detailService = new DetailService();
+ gbt11062Service = new GBT11062Service();
+
+ Crit(gasProps, 0); //计算临界流函数所有参数都计算了
}
+
public int NG_Cal_Init() {
//create object for calculating density
- if (null == detailService) {
+ if (null == (detailService=new DetailService())) {
return GasConstants.MEMORY_ALLOCATION_ERROR;
}
//create object for calculating thermodynamic properties
- if (null == thermService) {
+ if (null == (thermService=new ThermService())) {
return GasConstants.MEMORY_ALLOCATION_ERROR;
}
@@ -46,30 +93,6 @@ return tempPar;
return 0;
}
- public double SOS(GasProps gasProps) {
- // check if library is ready; initialize if necessary
- if (null == detailService || null == thermService) {
- NG_Cal_UnInit();
- NG_Cal_Init();
- }
- switch (gasProps.dCbtj) {
- case 2:
- gasProps.dPb = 101325;
- gasProps.dTb = 273.15;
- break;
- case 1:
- gasProps.dPb = 101325;
- gasProps.dTb = 288.15;
- break;
- case 0:
- gasProps.dPb = 101325;
- gasProps.dTb = 293.15;
- break;
- }
- detailService.run(gasProps);
- gasProps.dCstar = 0;
- return gasProps.dSOS;
- }
public double Crit(GasProps gasProps, double dPlenumVelocity)
{
@@ -144,52 +167,6 @@ return tempPar;
return gasProps.dCstar;
}
- public double Zcal(GasProps gasProps, double dPlenumVelocity)
- {
- if (null == detailService || null == thermService)
- {
- NG_Cal_UnInit();
- if (GasConstants.NG_Cal_INITIALIZED != NG_Cal_Init())
- {
- gasProps.lStatus =GasConstants. MEMORY_ALLOCATION_ERROR; return 0.0;
- }
- }
- switch (gasProps.dCbtj)
- {
- case 2:
- gasProps.dPb = 101325;
- gasProps.dTb = 273.15;
- break;
- case 1:
- gasProps.dPb = 101325;
- gasProps.dTb = 288.15;
- break;
- case 0:
- gasProps.dPb = 101325;
- gasProps.dTb = 293.15;
- break;
- }
- thermService.Run( gasProps, detailService);
- gbt11062Service.Run( gasProps);
- return gasProps.dZf;
-
- }
- double Cperf(GasProps gasProps)
- {
-
- double k, root, exponent;
-
- k = gasProps.dKappa; root = 2.0 / (k + 1.0);
- exponent = (k + 1.0) / (k - 1.0);
-
- return (Math.sqrt(k * Math.pow(root, exponent)));
-
- }
-
- double CRi(GasProps gasProps)
- {
- return (Cperf(gasProps) / Math.sqrt(gasProps.dZf));
- }
}
diff --git a/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/model/flowProps.java b/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/model/FlowProps.java
similarity index 58%
rename from ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/model/flowProps.java
rename to ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/model/FlowProps.java
index 23db842..f2e6022 100644
--- a/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/model/flowProps.java
+++ b/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/model/FlowProps.java
@@ -1,8 +1,521 @@
package com.ruoyi.ngCalTools.model;
-public class flowProps {
+public class FlowProps {
// 流量计算输入参数信息
private int dFlowCalbz; // 流量计算标准
+
+ public int getdZcalbz() {
+ return dZcalbz;
+ }
+
+ public void setdZcalbz(int dZcalbz) {
+ this.dZcalbz = dZcalbz;
+ }
+
+ public int getdFlowCalbz() {
+ return dFlowCalbz;
+ }
+
+ public void setdFlowCalbz(int dFlowCalbz) {
+ this.dFlowCalbz = dFlowCalbz;
+ }
+
+ public int getdCbtj() {
+ return dCbtj;
+ }
+
+ public void setdCbtj(int dCbtj) {
+ this.dCbtj = dCbtj;
+ }
+
+ public double getdPb_M() {
+ return dPb_M;
+ }
+
+ public void setdPb_M(double dPb_M) {
+ this.dPb_M = dPb_M;
+ }
+
+ public double getdTb_M() {
+ return dTb_M;
+ }
+
+ public void setdTb_M(double dTb_M) {
+ this.dTb_M = dTb_M;
+ }
+
+ public double getdPb_E() {
+ return dPb_E;
+ }
+
+ public void setdPb_E(double dPb_E) {
+ this.dPb_E = dPb_E;
+ }
+
+ public double getdTb_E() {
+ return dTb_E;
+ }
+
+ public void setdTb_E(double dTb_E) {
+ this.dTb_E = dTb_E;
+ }
+
+ public double getdPatm() {
+ return dPatm;
+ }
+
+ public void setdPatm(double dPatm) {
+ this.dPatm = dPatm;
+ }
+
+ public int getdPatmUnit() {
+ return dPatmUnit;
+ }
+
+ public void setdPatmUnit(int dPatmUnit) {
+ this.dPatmUnit = dPatmUnit;
+ }
+
+ public String getdngComponents() {
+ return dngComponents;
+ }
+
+ public void setdngComponents(String dngComponents) {
+ this.dngComponents = dngComponents;
+ }
+
+ public int getdMeterType() {
+ return dMeterType;
+ }
+
+ public void setdMeterType(int dMeterType) {
+ this.dMeterType = dMeterType;
+ }
+
+ public int getdCoreType() {
+ return dCoreType;
+ }
+
+ public void setdCoreType(int dCoreType) {
+ this.dCoreType = dCoreType;
+ }
+
+ public int getdPtmode() {
+ return dPtmode;
+ }
+
+ public void setdPtmode(int dPtmode) {
+ this.dPtmode = dPtmode;
+ }
+
+ public int getdPipeType() {
+ return dPipeType;
+ }
+
+ public void setdPipeType(int dPipeType) {
+ this.dPipeType = dPipeType;
+ }
+
+ public double getdPipeD() {
+ return dPipeD;
+ }
+
+ public void setdPipeD(double dPipeD) {
+ this.dPipeD = dPipeD;
+ }
+
+ public int getdLenUnit() {
+ return dLenUnit;
+ }
+
+ public void setdLenUnit(int dLenUnit) {
+ this.dLenUnit = dLenUnit;
+ }
+
+ public double getdPipeDtemp() {
+ return dPipeDtemp;
+ }
+
+ public void setdPipeDtemp(double dPipeDtemp) {
+ this.dPipeDtemp = dPipeDtemp;
+ }
+
+ public int getdPileDtempUint() {
+ return dPileDtempUint;
+ }
+
+ public void setdPileDtempUint(int dPileDtempUint) {
+ this.dPileDtempUint = dPileDtempUint;
+ }
+
+ public double getdPipeMaterial() {
+ return dPipeMaterial;
+ }
+
+ public void setdPipeMaterial(double dPipeMaterial) {
+ this.dPipeMaterial = dPipeMaterial;
+ }
+
+ public double getdOrificeD() {
+ return dOrificeD;
+ }
+
+ public void setdOrificeD(double dOrificeD) {
+ this.dOrificeD = dOrificeD;
+ }
+
+ public int getdOrificeUnit() {
+ return dOrificeUnit;
+ }
+
+ public void setdOrificeUnit(int dOrificeUnit) {
+ this.dOrificeUnit = dOrificeUnit;
+ }
+
+ public double getdOrificeDtemp() {
+ return dOrificeDtemp;
+ }
+
+ public void setdOrificeDtemp(double dOrificeDtemp) {
+ this.dOrificeDtemp = dOrificeDtemp;
+ }
+
+ public int getdOrificeDtempUnit() {
+ return dOrificeDtempUnit;
+ }
+
+ public void setdOrificeDtempUnit(int dOrificeDtempUnit) {
+ this.dOrificeDtempUnit = dOrificeDtempUnit;
+ }
+
+ public double getdOrificeMaterial() {
+ return dOrificeMaterial;
+ }
+
+ public void setdOrificeMaterial(double dOrificeMaterial) {
+ this.dOrificeMaterial = dOrificeMaterial;
+ }
+
+ public int getdOrificeSharpness() {
+ return dOrificeSharpness;
+ }
+
+ public void setdOrificeSharpness(int dOrificeSharpness) {
+ this.dOrificeSharpness = dOrificeSharpness;
+ }
+
+ public double getdOrificeRk() {
+ return dOrificeRk;
+ }
+
+ public void setdOrificeRk(double dOrificeRk) {
+ this.dOrificeRk = dOrificeRk;
+ }
+
+ public int getdOrificeRkLenUint() {
+ return dOrificeRkLenUint;
+ }
+
+ public void setdOrificeRkLenUint(int dOrificeRkLenUint) {
+ this.dOrificeRkLenUint = dOrificeRkLenUint;
+ }
+
+ public double getdPf() {
+ return dPf;
+ }
+
+ public void setdPf(double dPf) {
+ this.dPf = dPf;
+ }
+
+ public int getdPfUnit() {
+ return dPfUnit;
+ }
+
+ public void setdPfUnit(int dPfUnit) {
+ this.dPfUnit = dPfUnit;
+ }
+
+ public int getdPfType() {
+ return dPfType;
+ }
+
+ public void setdPfType(int dPfType) {
+ this.dPfType = dPfType;
+ }
+
+ public double getdTf() {
+ return dTf;
+ }
+
+ public void setdTf(double dTf) {
+ this.dTf = dTf;
+ }
+
+ public int getdTfUnit() {
+ return dTfUnit;
+ }
+
+ public void setdTfUnit(int dTfUnit) {
+ this.dTfUnit = dTfUnit;
+ }
+
+ public double getdDp() {
+ return dDp;
+ }
+
+ public void setdDp(double dDp) {
+ this.dDp = dDp;
+ }
+
+ public int getdDpUnit() {
+ return dDpUnit;
+ }
+
+ public void setdDpUnit(int dDpUnit) {
+ this.dDpUnit = dDpUnit;
+ }
+
+ public int getdVFlowUnit() {
+ return dVFlowUnit;
+ }
+
+ public void setdVFlowUnit(int dVFlowUnit) {
+ this.dVFlowUnit = dVFlowUnit;
+ }
+
+ public int getdMFlowUnit() {
+ return dMFlowUnit;
+ }
+
+ public void setdMFlowUnit(int dMFlowUnit) {
+ this.dMFlowUnit = dMFlowUnit;
+ }
+
+ public int getdEFlowUnit() {
+ return dEFlowUnit;
+ }
+
+ public void setdEFlowUnit(int dEFlowUnit) {
+ this.dEFlowUnit = dEFlowUnit;
+ }
+
+ public double getdCd() {
+ return dCd;
+ }
+
+ public void setdCd(double dCd) {
+ this.dCd = dCd;
+ }
+
+ public double getdMeterFactor() {
+ return dMeterFactor;
+ }
+
+ public void setdMeterFactor(double dMeterFactor) {
+ this.dMeterFactor = dMeterFactor;
+ }
+
+ public double getdPulseNum() {
+ return dPulseNum;
+ }
+
+ public void setdPulseNum(double dPulseNum) {
+ this.dPulseNum = dPulseNum;
+ }
+
+ public double getdVFlowMax() {
+ return dVFlowMax;
+ }
+
+ public void setdVFlowMax(double dVFlowMax) {
+ this.dVFlowMax = dVFlowMax;
+ }
+
+ public double getdVFlowMin() {
+ return dVFlowMin;
+ }
+
+ public void setdVFlowMin(double dVFlowMin) {
+ this.dVFlowMin = dVFlowMin;
+ }
+
+ public double getdVFlowCon() {
+ return dVFlowCon;
+ }
+
+ public void setdVFlowCon(double dVFlowCon) {
+ this.dVFlowCon = dVFlowCon;
+ }
+
+ public double getdPfRange() {
+ return dPfRange;
+ }
+
+ public void setdPfRange(double dPfRange) {
+ this.dPfRange = dPfRange;
+ }
+
+ public double getdDpRange() {
+ return dDpRange;
+ }
+
+ public void setdDpRange(double dDpRange) {
+ this.dDpRange = dDpRange;
+ }
+
+ public double getdTfRange() {
+ return dTfRange;
+ }
+
+ public void setdTfRange(double dTfRange) {
+ this.dTfRange = dTfRange;
+ }
+
+ public double getdE() {
+ return dE;
+ }
+
+ public void setdE(double dE) {
+ this.dE = dE;
+ }
+
+ public double getdFG() {
+ return dFG;
+ }
+
+ public void setdFG(double dFG) {
+ this.dFG = dFG;
+ }
+
+ public double getdFT() {
+ return dFT;
+ }
+
+ public void setdFT(double dFT) {
+ this.dFT = dFT;
+ }
+
+ public double getdDViscosity() {
+ return dDViscosity;
+ }
+
+ public void setdDViscosity(double dDViscosity) {
+ this.dDViscosity = dDViscosity;
+ }
+
+ public double getdDExpCoefficient() {
+ return dDExpCoefficient;
+ }
+
+ public void setdDExpCoefficient(double dDExpCoefficient) {
+ this.dDExpCoefficient = dDExpCoefficient;
+ }
+
+ public double getdRnPipe() {
+ return dRnPipe;
+ }
+
+ public void setdRnPipe(double dRnPipe) {
+ this.dRnPipe = dRnPipe;
+ }
+
+ public double getdBk() {
+ return dBk;
+ }
+
+ public void setdBk(double dBk) {
+ this.dBk = dBk;
+ }
+
+ public double getdRoughNessPipe() {
+ return dRoughNessPipe;
+ }
+
+ public void setdRoughNessPipe(double dRoughNessPipe) {
+ this.dRoughNessPipe = dRoughNessPipe;
+ }
+
+ public double getdCdCorrect() {
+ return dCdCorrect;
+ }
+
+ public void setdCdCorrect(double dCdCorrect) {
+ this.dCdCorrect = dCdCorrect;
+ }
+
+ public double getdCdNozell() {
+ return dCdNozell;
+ }
+
+ public void setdCdNozell(double dCdNozell) {
+ this.dCdNozell = dCdNozell;
+ }
+
+ public double getdVFlowb() {
+ return dVFlowb;
+ }
+
+ public void setdVFlowb(double dVFlowb) {
+ this.dVFlowb = dVFlowb;
+ }
+
+ public double getdVFlowf() {
+ return dVFlowf;
+ }
+
+ public void setdVFlowf(double dVFlowf) {
+ this.dVFlowf = dVFlowf;
+ }
+
+ public double getdMFlowb() {
+ return dMFlowb;
+ }
+
+ public void setdMFlowb(double dMFlowb) {
+ this.dMFlowb = dMFlowb;
+ }
+
+ public double getdEFlowb() {
+ return dEFlowb;
+ }
+
+ public void setdEFlowb(double dEFlowb) {
+ this.dEFlowb = dEFlowb;
+ }
+
+ public double getdVelocityFlow() {
+ return dVelocityFlow;
+ }
+
+ public void setdVelocityFlow(double dVelocityFlow) {
+ this.dVelocityFlow = dVelocityFlow;
+ }
+
+ public double getdPressLost() {
+ return dPressLost;
+ }
+
+ public void setdPressLost(double dPressLost) {
+ this.dPressLost = dPressLost;
+ }
+
+ public double getdBeta() {
+ return dBeta;
+ }
+
+ public void setdBeta(double dBeta) {
+ this.dBeta = dBeta;
+ }
+
+ public double getdKappa() {
+ return dKappa;
+ }
+
+ public void setdKappa(double dKappa) {
+ this.dKappa = dKappa;
+ }
+
private int dZcalbz; // 压缩因子计算标准
private int dCbtj; // 计量参比条件压力
private double dPb_M; // 计量参比条件压力
@@ -11,7 +524,7 @@ public class flowProps {
private double dTb_E; // 燃烧参比条件温度
private double dPatm; // 当地大气压
private int dPatmUnit; // 当地大气压单位
- private double[] dNG_Compents; // 天然气组分
+ private String dngComponents; // 天然气组分
private int dMeterType; // 流量计类别
private int dCoreType; // 节流装置类型
@@ -21,13 +534,13 @@ public class flowProps {
private int dLenUnit; // 长度单位
private double dPipeDtemp; // 管道内径参考温度
private int dPileDtempUint; // 温度单位
- private int dPipeMaterial; // 管道材料
+ private double dPipeMaterial; // 管道材料
private double dOrificeD; // 孔板孔径
private int dOrificeUnit; // 长度单位
private double dOrificeDtemp; // 孔板内径参考温度
private int dOrificeDtempUnit; // 温度单位
- private int dOrificeMaterial; // 孔板材料
+ private double dOrificeMaterial; // 孔板材料
private int dOrificeSharpness; // 锐利度系数计算方法
private double dOrificeRk; // 孔板入口圆弧半径
private int dOrificeRkLenUint; // 长度单位
@@ -71,519 +584,9 @@ public class flowProps {
private double dBeta; // 直径比
private double dKappa; // 等熵指数
+
// Getters and Setters
- public int getDFlowCalbz() {
- return dFlowCalbz;
- }
- public void setDFlowCalbz(int dFlowCalbz) {
- this.dFlowCalbz = dFlowCalbz;
- }
-
- public int getDZcalbz() {
- return dZcalbz;
- }
-
- public void setDZcalbz(int dZcalbz) {
- this.dZcalbz = dZcalbz;
- }
-
- public int getDCbtj() {
- return dCbtj;
- }
-
- public void setDCbtj(int dCbtj) {
- this.dCbtj = dCbtj;
- }
-
- public double getDPb_M() {
- return dPb_M;
- }
-
- public void setDPb_M(double dPb_M) {
- this.dPb_M = dPb_M;
- }
-
- public double getDTb_M() {
- return dTb_M;
- }
-
- public void setDTb_M(double dTb_M) {
- this.dTb_M = dTb_M;
- }
-
- public double getDPb_E() {
- return dPb_E;
- }
-
- public void setDPb_E(double dPb_E) {
- this.dPb_E = dPb_E;
- }
-
- public double getDTb_E() {
- return dTb_E;
- }
-
- public void setDTb_E(double dTb_E) {
- this.dTb_E = dTb_E;
- }
-
- public double getDPatm() {
- return dPatm;
- }
-
- public void setDPatm(double dPatm) {
- this.dPatm = dPatm;
- }
-
- public int getDPatmUnit() {
- return dPatmUnit;
- }
-
- public void setDPatmUnit(int dPatmUnit) {
- this.dPatmUnit = dPatmUnit;
- }
-
- public double[] getDNG_Compents() {
- return dNG_Compents;
- }
-
- public void setDNG_Compents(double[] dNG_Compents) {
- this.dNG_Compents = dNG_Compents;
- }
-
- public int getDMeterType() {
- return dMeterType;
- }
-
- public void setDMeterType(int dMeterType) {
- this.dMeterType = dMeterType;
- }
-
- public int getDCoreType() {
- return dCoreType;
- }
-
- public void setDCoreType(int dCoreType) {
- this.dCoreType = dCoreType;
- }
-
- public int getDPtmode() {
- return dPtmode;
- }
-
- public void setDPtmode(int dPtmode) {
- this.dPtmode = dPtmode;
- }
-
- public int getDPipeType() {
- return dPipeType;
- }
-
- public void setDPipeType(int dPipeType) {
- this.dPipeType = dPipeType;
- }
-
- public double getDPipeD() {
- return dPipeD;
- }
-
- public void setDPipeD(double dPipeD) {
- this.dPipeD = dPipeD;
- }
-
- public int getDLenUnit() {
- return dLenUnit;
- }
-
- public void setDLenUnit(int dLenUnit) {
- this.dLenUnit = dLenUnit;
- }
-
- public double getDPipeDtemp() {
- return dPipeDtemp;
- }
-
- public void setDPipeDtemp(double dPipeDtemp) {
- this.dPipeDtemp = dPipeDtemp;
- }
-
- public int getDPileDtempUint() {
- return dPileDtempUint;
- }
-
- public void setDPileDtempUint(int dPileDtempUint) {
- this.dPileDtempUint = dPileDtempUint;
- }
-
- public int getDPipeMaterial() {
- return dPipeMaterial;
- }
-
- public void setDPipeMaterial(int dPipeMaterial) {
- this.dPipeMaterial = dPipeMaterial;
- }
-
- public double getDOrificeD() {
- return dOrificeD;
- }
-
- public void setDOrificeD(double dOrificeD) {
- this.dOrificeD = dOrificeD;
- }
-
- public int getDOrificeUnit() {
- return dOrificeUnit;
- }
-
- public void setDOrificeUnit(int dOrificeUnit) {
- this.dOrificeUnit = dOrificeUnit;
- }
-
- public double getDOrificeDtemp() {
- return dOrificeDtemp;
- }
-
- public void setDOrificeDtemp(double dOrificeDtemp) {
- this.dOrificeDtemp = dOrificeDtemp;
- }
-
- public int getDOrificeDtempUnit() {
- return dOrificeDtempUnit;
- }
-
- public void setDOrificeDtempUnit(int dOrificeDtempUnit) {
- this.dOrificeDtempUnit = dOrificeDtempUnit;
- }
-
- public int getDOrificeMaterial() {
- return dOrificeMaterial;
- }
-
- public void setDOrificeMaterial(int dOrificeMaterial) {
- this.dOrificeMaterial = dOrificeMaterial;
- }
-
- public int getDOrificeSharpness() {
- return dOrificeSharpness;
- }
-
- public void setDOrificeSharpness(int dOrificeSharpness) {
- this.dOrificeSharpness = dOrificeSharpness;
- }
-
- public double getDOrificeRk() {
- return dOrificeRk;
- }
-
- public void setDOrificeRk(double dOrificeRk) {
- this.dOrificeRk = dOrificeRk;
- }
-
- public int getDOrificeRkLenUint() {
- return dOrificeRkLenUint;
- }
-
- public void setDOrificeRkLenUint(int dOrificeRkLenUint) {
- this.dOrificeRkLenUint = dOrificeRkLenUint;
- }
-
- public double getDPf() {
- return dPf;
- }
-
- public void setDPf(double dPf) {
- this.dPf = dPf;
- }
-
- public int getDPfUnit() {
- return dPfUnit;
- }
-
- public void setDPfUnit(int dPfUnit) {
- this.dPfUnit = dPfUnit;
- }
-
- public int getDPfType() {
- return dPfType;
- }
-
- public void setDPfType(int dPfType) {
- this.dPfType = dPfType;
- }
-
- public double getDTf() {
- return dTf;
- }
-
- public void setDTf(double dTf) {
- this.dTf = dTf;
- }
-
- public int getDTfUnit() {
- return dTfUnit;
- }
-
- public void setDTfUnit(int dTfUnit) {
- this.dTfUnit = dTfUnit;
- }
-
- public double getDDp() {
- return dDp;
- }
-
- public void setDDp(double dDp) {
- this.dDp = dDp;
- }
-
- public int getDDpUnit() {
- return dDpUnit;
- }
-
- public void setDDpUnit(int dDpUnit) {
- this.dDpUnit = dDpUnit;
- }
-
- public int getDVFlowUnit() {
- return dVFlowUnit;
- }
-
- public void setDVFlowUnit(int dVFlowUnit) {
- this.dVFlowUnit = dVFlowUnit;
- }
-
- public int getDMFlowUnit() {
- return dMFlowUnit;
- }
-
- public void setDMFlowUnit(int dMFlowUnit) {
- this.dMFlowUnit = dMFlowUnit;
- }
-
- public int getDEFlowUnit() {
- return dEFlowUnit;
- }
-
- public void setDEFlowUnit(int dEFlowUnit) {
- this.dEFlowUnit = dEFlowUnit;
- }
-
- public double getDCd() {
- return dCd;
- }
-
- public void setDCd(double dCd) {
- this.dCd = dCd;
- }
-
- public double getDMeterFactor() {
- return dMeterFactor;
- }
-
- public void setDMeterFactor(double dMeterFactor) {
- this.dMeterFactor = dMeterFactor;
- }
-
- public double getDPulseNum() {
- return dPulseNum;
- }
-
- public void setDPulseNum(double dPulseNum) {
- this.dPulseNum = dPulseNum;
- }
-
- public double getDVFlowMax() {
- return dVFlowMax;
- }
-
- public void setDVFlowMax(double dVFlowMax) {
- this.dVFlowMax = dVFlowMax;
- }
-
- public double getDVFlowMin() {
- return dVFlowMin;
- }
-
- public void setDVFlowMin(double dVFlowMin) {
- this.dVFlowMin = dVFlowMin;
- }
-
- public double getDVFlowCon() {
- return dVFlowCon;
- }
-
- public void setDVFlowCon(double dVFlowCon) {
- this.dVFlowCon = dVFlowCon;
- }
-
- public double getDPfRange() {
- return dPfRange;
- }
-
- public void setDPfRange(double dPfRange) {
- this.dPfRange = dPfRange;
- }
-
- public double getDDpRange() {
- return dDpRange;
- }
-
- public void setDDpRange(double dDpRange) {
- this.dDpRange = dDpRange;
- }
-
- public double getDTfRange() {
- return dTfRange;
- }
-
- public void setDTfRange(double dTfRange) {
- this.dTfRange = dTfRange;
- }
-
- public double getDE() {
- return dE;
- }
-
- public void setDE(double dE) {
- this.dE = dE;
- }
-
- public double getDFG() {
- return dFG;
- }
-
- public void setDFG(double dFG) {
- this.dFG = dFG;
- }
-
- public double getDFT() {
- return dFT;
- }
-
- public void setDFT(double dFT) {
- this.dFT = dFT;
- }
-
- public double getDDViscosity() {
- return dDViscosity;
- }
-
- public void setDDViscosity(double dDViscosity) {
- this.dDViscosity = dDViscosity;
- }
-
- public double getDDExpCoefficient() {
- return dDExpCoefficient;
- }
-
- public void setDDExpCoefficient(double dDExpCoefficient) {
- this.dDExpCoefficient = dDExpCoefficient;
- }
-
- public double getDRnPipe() {
- return dRnPipe;
- }
-
- public void setDRnPipe(double dRnPipe) {
- this.dRnPipe = dRnPipe;
- }
-
- public double getDBk() {
- return dBk;
- }
-
- public void setDBk(double dBk) {
- this.dBk = dBk;
- }
-
- public double getDRoughNessPipe() {
- return dRoughNessPipe;
- }
-
- public void setDRoughNessPipe(double dRoughNessPipe) {
- this.dRoughNessPipe = dRoughNessPipe;
- }
-
- public double getDCdCorrect() {
- return dCdCorrect;
- }
-
- public void setDCdCorrect(double dCdCorrect) {
- this.dCdCorrect = dCdCorrect;
- }
-
- public double getDCdNozell() {
- return dCdNozell;
- }
-
- public void setDCdNozell(double dCdNozell) {
- this.dCdNozell = dCdNozell;
- }
-
- public double getDVFlowb() {
- return dVFlowb;
- }
-
- public void setDVFlowb(double dVFlowb) {
- this.dVFlowb = dVFlowb;
- }
-
- public double getDVFlowf() {
- return dVFlowf;
- }
-
- public void setDVFlowf(double dVFlowf) {
- this.dVFlowf = dVFlowf;
- }
-
- public double getDMFlowb() {
- return dMFlowb;
- }
-
- public void setDMFlowb(double dMFlowb) {
- this.dMFlowb = dMFlowb;
- }
-
- public double getDEFlowb() {
- return dEFlowb;
- }
-
- public void setDEFlowb(double dEFlowb) {
- this.dEFlowb = dEFlowb;
- }
-
- public double getDVelocityFlow() {
- return dVelocityFlow;
- }
-
- public void setDVelocityFlow(double dVelocityFlow)
- {
- this.dVelocityFlow= dVelocityFlow;
- }
-
- public double getDPressLost() {
- return dPressLost;
- }
-
- public void setDPressLost(double dPressLost) {
- this.dPressLost = dPressLost;
- }
-
- public double getDKappa() {
- return dKappa;
- }
-
- public void setDKappa(double dKappa) {
- this.dKappa = dKappa;
- }
-
- public double getDBeta() {
- return dBeta;
- }
-
- public void setDBeta(double dBeta) {
- this.dBeta = dBeta;
- }
}
diff --git a/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/model/GasProps.java b/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/model/GasProps.java
index 7642deb..6eb9149 100644
--- a/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/model/GasProps.java
+++ b/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/model/GasProps.java
@@ -4,8 +4,452 @@ public class GasProps {
// corresponds to the control group in meter classes
public int lStatus; // calculation status 计算状态
public boolean bForceUpdate; // 执行全部计算的标志 signal to perform full calculation
+
+
+
public double[] adMixture; // 气体摩尔组成 Composition in mole fraction
public double[] adMixtureV; // 气体体积组成 Composition in mole fraction
+
+ public double[] getAdMixtureD() {
+ return adMixtureD;
+ }
+
+ public void setAdMixtureD(double[] adMixtureD) {
+ this.adMixtureD = adMixtureD;
+ }
+
+ public int getlStatus() {
+ return lStatus;
+ }
+
+ public void setlStatus(int lStatus) {
+ this.lStatus = lStatus;
+ }
+
+ public boolean isbForceUpdate() {
+ return bForceUpdate;
+ }
+
+ public void setbForceUpdate(boolean bForceUpdate) {
+ this.bForceUpdate = bForceUpdate;
+ }
+
+ public double[] getAdMixture() {
+ return adMixture;
+ }
+
+ public void setAdMixture(double[] adMixture) {
+ this.adMixture = adMixture;
+ }
+
+ public double[] getAdMixtureV() {
+ return adMixtureV;
+ }
+
+ public void setAdMixtureV(double[] adMixtureV) {
+ this.adMixtureV = adMixtureV;
+ }
+
+ public int getdCbtj() {
+ return dCbtj;
+ }
+
+ public void setdCbtj(int dCbtj) {
+ this.dCbtj = dCbtj;
+ }
+
+ public double getdPb() {
+ return dPb;
+ }
+
+ public void setdPb(double dPb) {
+ this.dPb = dPb;
+ }
+
+ public double getdTb() {
+ return dTb;
+ }
+
+ public void setdTb(double dTb) {
+ this.dTb = dTb;
+ }
+
+ public double getdPf() {
+ return dPf;
+ }
+
+ public void setdPf(double dPf) {
+ this.dPf = dPf;
+ }
+
+ public double getdTf() {
+ return dTf;
+ }
+
+ public void setdTf(double dTf) {
+ this.dTf = dTf;
+ }
+
+ public double getdMrx() {
+ return dMrx;
+ }
+
+ public void setdMrx(double dMrx) {
+ this.dMrx = dMrx;
+ }
+
+ public double getdZb() {
+ return dZb;
+ }
+
+ public void setdZb(double dZb) {
+ this.dZb = dZb;
+ }
+
+ public double getdZf() {
+ return dZf;
+ }
+
+ public void setdZf(double dZf) {
+ this.dZf = dZf;
+ }
+
+ public double getdFpv() {
+ return dFpv;
+ }
+
+ public void setdFpv(double dFpv) {
+ this.dFpv = dFpv;
+ }
+
+ public double getdDb() {
+ return dDb;
+ }
+
+ public void setdDb(double dDb) {
+ this.dDb = dDb;
+ }
+
+ public double getdDf() {
+ return dDf;
+ }
+
+ public void setdDf(double dDf) {
+ this.dDf = dDf;
+ }
+
+ public double getdRhob() {
+ return dRhob;
+ }
+
+ public void setdRhob(double dRhob) {
+ this.dRhob = dRhob;
+ }
+
+ public double getdRhof() {
+ return dRhof;
+ }
+
+ public void setdRhof(double dRhof) {
+ this.dRhof = dRhof;
+ }
+
+ public double getdRD_Ideal() {
+ return dRD_Ideal;
+ }
+
+ public void setdRD_Ideal(double dRD_Ideal) {
+ this.dRD_Ideal = dRD_Ideal;
+ }
+
+ public double getdRD_Real() {
+ return dRD_Real;
+ }
+
+ public void setdRD_Real(double dRD_Real) {
+ this.dRD_Real = dRD_Real;
+ }
+
+ public double getdHo() {
+ return dHo;
+ }
+
+ public void setdHo(double dHo) {
+ this.dHo = dHo;
+ }
+
+ public double getdH() {
+ return dH;
+ }
+
+ public void setdH(double dH) {
+ this.dH = dH;
+ }
+
+ public double getdS() {
+ return dS;
+ }
+
+ public void setdS(double dS) {
+ this.dS = dS;
+ }
+
+ public double getdCpi() {
+ return dCpi;
+ }
+
+ public void setdCpi(double dCpi) {
+ this.dCpi = dCpi;
+ }
+
+ public double getdCp() {
+ return dCp;
+ }
+
+ public void setdCp(double dCp) {
+ this.dCp = dCp;
+ }
+
+ public double getdCv() {
+ return dCv;
+ }
+
+ public void setdCv(double dCv) {
+ this.dCv = dCv;
+ }
+
+ public double getDk() {
+ return dk;
+ }
+
+ public void setDk(double dk) {
+ this.dk = dk;
+ }
+
+ public double getdKappa() {
+ return dKappa;
+ }
+
+ public void setdKappa(double dKappa) {
+ this.dKappa = dKappa;
+ }
+
+ public double getdSOS() {
+ return dSOS;
+ }
+
+ public void setdSOS(double dSOS) {
+ this.dSOS = dSOS;
+ }
+
+ public double getdCstar() {
+ return dCstar;
+ }
+
+ public void setdCstar(double dCstar) {
+ this.dCstar = dCstar;
+ }
+
+ public double getdHhvMol() {
+ return dHhvMol;
+ }
+
+ public void setdHhvMol(double dHhvMol) {
+ this.dHhvMol = dHhvMol;
+ }
+
+ public double getdLhvMol() {
+ return dLhvMol;
+ }
+
+ public void setdLhvMol(double dLhvMol) {
+ this.dLhvMol = dLhvMol;
+ }
+
+ public double getdHhvv() {
+ return dHhvv;
+ }
+
+ public void setdHhvv(double dHhvv) {
+ this.dHhvv = dHhvv;
+ }
+
+ public double getdLhvv() {
+ return dLhvv;
+ }
+
+ public void setdLhvv(double dLhvv) {
+ this.dLhvv = dLhvv;
+ }
+
+ public double getdHhvm() {
+ return dHhvm;
+ }
+
+ public void setdHhvm(double dHhvm) {
+ this.dHhvm = dHhvm;
+ }
+
+ public double getdLhvm() {
+ return dLhvm;
+ }
+
+ public void setdLhvm(double dLhvm) {
+ this.dLhvm = dLhvm;
+ }
+
+ public double getdZb11062() {
+ return dZb11062;
+ }
+
+ public void setdZb11062(double dZb11062) {
+ this.dZb11062 = dZb11062;
+ }
+
+ public double getdRhob11062() {
+ return dRhob11062;
+ }
+
+ public void setdRhob11062(double dRhob11062) {
+ this.dRhob11062 = dRhob11062;
+ }
+
+ public double getdRhof11062() {
+ return dRhof11062;
+ }
+
+ public void setdRhof11062(double dRhof11062) {
+ this.dRhof11062 = dRhof11062;
+ }
+
+ public double getdRD_Ideal11062() {
+ return dRD_Ideal11062;
+ }
+
+ public void setdRD_Ideal11062(double dRD_Ideal11062) {
+ this.dRD_Ideal11062 = dRD_Ideal11062;
+ }
+
+ public double getdRD_Real11062() {
+ return dRD_Real11062;
+ }
+
+ public void setdRD_Real11062(double dRD_Real11062) {
+ this.dRD_Real11062 = dRD_Real11062;
+ }
+
+ public double getdWobbeIndex() {
+ return dWobbeIndex;
+ }
+
+ public void setdWobbeIndex(double dWobbeIndex) {
+ this.dWobbeIndex = dWobbeIndex;
+ }
+
+ public double getdPc() {
+ return dPc;
+ }
+
+ public void setdPc(double dPc) {
+ this.dPc = dPc;
+ }
+
+ public double getdTC() {
+ return dTC;
+ }
+
+ public void setdTC(double dTC) {
+ this.dTC = dTC;
+ }
+
+ public double getdBzsx() {
+ return dBzsx;
+ }
+
+ public void setdBzsx(double dBzsx) {
+ this.dBzsx = dBzsx;
+ }
+
+ public double getdBzxx() {
+ return dBzxx;
+ }
+
+ public void setdBzxx(double dBzxx) {
+ this.dBzxx = dBzxx;
+ }
+
+ public double getdTotalC() {
+ return dTotalC;
+ }
+
+ public void setdTotalC(double dTotalC) {
+ this.dTotalC = dTotalC;
+ }
+
+ public double getdC2() {
+ return dC2;
+ }
+
+ public void setdC2(double dC2) {
+ this.dC2 = dC2;
+ }
+
+ public double getdC2j() {
+ return dC2j;
+ }
+
+ public void setdC2j(double dC2j) {
+ this.dC2j = dC2j;
+ }
+
+ public double getdC3j() {
+ return dC3j;
+ }
+
+ public void setdC3j(double dC3j) {
+ this.dC3j = dC3j;
+ }
+
+ public double getdC4j() {
+ return dC4j;
+ }
+
+ public void setdC4j(double dC4j) {
+ this.dC4j = dC4j;
+ }
+
+ public double getdC5j() {
+ return dC5j;
+ }
+
+ public void setdC5j(double dC5j) {
+ this.dC5j = dC5j;
+ }
+
+ public double getdC6j() {
+ return dC6j;
+ }
+
+ public void setdC6j(double dC6j) {
+ this.dC6j = dC6j;
+ }
+
+ public double getdC3C4() {
+ return dC3C4;
+ }
+
+ public void setdC3C4(double dC3C4) {
+ this.dC3C4 = dC3C4;
+ }
+
+ public String getDngComponents() {
+ return dngComponents;
+ }
+
+ public void setDngComponents(String dngComponents) {
+ this.dngComponents = dngComponents;
+ }
+
public double[] adMixtureD; // 气体质量组成 Composition in mole fraction
public int dCbtj; // 参比条件 101325 0,15,20
public double dPb; // 参比压力 Contract base Pressure (Pa)
@@ -50,459 +494,20 @@ public class GasProps {
public double dRD_Real11062; // 真实气体的相对密度real gas relative density
public double dWobbeIndex; // 真实气体的沃泊指数
- public double Pc; // 临界压力
- public double TC; // 临界温度
- public double Bzsx; // 爆炸上限
- public double Bzxx; // 爆炸下限
- public double TotalC; // 总炭含量 (kg/m3)
- public double C2; // C2组分含量 (kg/m3)
- public double C2j; // C2以上组分含量 (kg/m3)
- public double C3j; // C3以上组分含量 (kg/m3)
- public double C4j; // C4以上组分含量 (kg/m3)
- public double C5j; // C5以上组分含量 (kg/m3)
- public double C6j; // C6以上组分含量 (kg/m3)
- public double C3C4; // C3C4组分含量 (kg/m3)
- public String dngComponents; //组分的组合字符串 从前端传过来
+ public double dPc; // 临界压力
+ public double dTC; // 临界温度
+ public double dBzsx; // 爆炸上限
+ public double dBzxx; // 爆炸下限
+ public double dTotalC; // 总炭含量 (kg/m3)
+ public double dC2; // C2组分含量 (kg/m3)
+ public double dC2j; // C2以上组分含量 (kg/m3)
+ public double dC3j; // C3以上组分含量 (kg/m3)
+ public double dC4j; // C4以上组分含量 (kg/m3)
+ public double dC5j; // C5以上组分含量 (kg/m3)
+ public double dC6j; // C6以上组分含量 (kg/m3)
+ public double dC3C4; // C3C4组分含量 (kg/m3)
+ public String dngComponents; //组分的组合字符串 从前端传过来
- // Getters and Setters
- public String getDngComponents() {
- return dngComponents;
- }
- public void setDngComponents(String dngComponents) {
- this.dngComponents = dngComponents;
- }
-
- public int getLStatus() {
- return lStatus;
- }
-
- public void setLStatus(int lStatus) {
- this.lStatus = lStatus;
- }
-
- public boolean isBForceUpdate() {
- return bForceUpdate;
- }
-
- public void setBForceUpdate(boolean bForceUpdate) {
- this.bForceUpdate = bForceUpdate;
- }
-
- public double[] getAdMixture() {
- return adMixture;
- }
-
- public void setAdMixture(double[] adMixture) {
- this.adMixture = adMixture;
- }
-
- public double[] getAdMixtureV() {
- return adMixtureV;
- }
-
- public void setAdMixtureV(double[] adMixtureV) {
- this.adMixtureV = adMixtureV;
- }
-
- public double[] getAdMixtureD() {
- return adMixtureD;
- }
-
- public void setAdMixtureD(double[] adMixtureD) {
- this.adMixtureD = adMixtureD;
- }
-
- public int getDCbtj() {
- return dCbtj;
- }
-
- public void setDCbtj(int dCbtj) {
- this.dCbtj = dCbtj;
- }
-
- public double getDPb() {
- return dPb;
- }
-
- public void setDPb(double dPb) {
- this.dPb = dPb;
- }
-
- public double getDTb() {
- return dTb;
- }
-
- public void setDTb(double dTb) {
- this.dTb = dTb;
- }
-
- public double getDPf() {
- return dPf;
- }
-
- public void setDPf(double dPf) {
- this.dPf = dPf;
- }
-
- public double getDTf() {
- return dTf;
- }
-
- public void setDTf(double dTf) {
- this.dTf = dTf;
- }
-
- public double getDMrx() {
- return dMrx;
- }
-
- public void setDMrx(double dMrx) {
- this.dMrx = dMrx;
- }
-
- public double getDZb() {
- return dZb;
- }
-
- public void setDZb(double dZb) {
- this.dZb = dZb;
- }
-
- public double getDZf() {
- return dZf;
- }
-
- public void setDZf(double dZf) {
- this.dZf = dZf;
- }
-
- public double getDFpv() {
- return dFpv;
- }
-
- public void setDFpv(double dFpv) {
- this.dFpv = dFpv;
- }
-
- public double getDDb() {
- return dDb;
- }
-
- public void setDDb(double dDb) {
- this.dDb = dDb;
- }
-
- public double getDDf() {
- return dDf;
- }
-
- public void setDDf(double dDf) {
- this.dDf = dDf;
- }
-
- public double getDRhob() {
- return dRhob;
- }
-
- public void setDRhob(double dRhob) {
- this.dRhob = dRhob;
- }
-
- public double getDRhof() {
- return dRhof;
- }
-
- public void setDRhof(double dRhof) {
- this.dRhof = dRhof;
- }
-
- public double getDRD_Ideal() {
- return dRD_Ideal;
- }
-
- public void setDRD_Ideal(double dRD_Ideal) {
- this.dRD_Ideal = dRD_Ideal;
- }
-
- public double getDRD_Real() {
- return dRD_Real;
- }
-
- public void setDRD_Real(double dRD_Real) {
- this.dRD_Real = dRD_Real;
- }
-
- public double getDHo() {
- return dHo;
- }
-
- public void setDHo(double dHo) {
- this.dHo = dHo;
- }
-
- public double getDH() {
- return dH;
- }
-
- public void setDH(double dH) {
- this.dH = dH;
- }
-
- public double getDS() {
- return dS;
- }
-
- public void setDS(double dS) {
- this.dS = dS;
- }
-
- public double getDCpi() {
- return dCpi;
- }
-
- public void setDCpi(double dCpi) {
- this.dCpi = dCpi;
- }
-
- public double getDCp() {
- return dCp;
- }
-
- public void setDCp(double dCp) {
- this.dCp = dCp;
- }
-
- public double getDCv() {
- return dCv;
- }
-
- public void setDCv(double dCv) {
- this.dCv = dCv;
- }
-
- public double getDk() {
- return dk;
- }
-
- public void setDk(double dk) {
- this.dk = dk;
- }
-
- public double getDKappa() {
- return dKappa;
- }
-
- public void setDKappa(double dKappa) {
- this.dKappa = dKappa;
- }
-
- public double getDSOS() {
- return dSOS;
- }
-
- public void setDSOS(double dSOS) {
- this.dSOS = dSOS;
- }
-
- public double getDCstar() {
- return dCstar;
- }
-
- public void setDCstar(double dCstar) {
- this.dCstar = dCstar;
- }
-
- public double getDHhvMol() {
- return dHhvMol;
- }
-
- public void setDHhvMol(double dHhvMol) {
- this.dHhvMol = dHhvMol;
- }
-
- public double getDLhvMol() {
- return dLhvMol;
- }
-
- public void setDLhvMol(double dLhvMol) {
- this.dLhvMol = dLhvMol;
- }
-
- public double getDHhvv() {
- return dHhvv;
- }
-
- public void setDHhvv(double dHhvv) {
- this.dHhvv = dHhvv;
- }
-
- public double getDLhvv() {
- return dLhvv;
- }
-
- public void setDLhvv(double dLhvv) {
- this.dLhvv = dLhvv;
- }
-
- public double getDHhvm() {
- return dHhvm;
- }
-
- public void setDHhvm(double dHhvm) {
- this.dHhvm = dHhvm;
- }
-
- public double getDLhvm() {
- return dLhvm;
- }
-
- public void setDLhvm(double dLhvm) {
- this.dLhvm = dLhvm;
- }
-
- public double getDZb11062() {
- return dZb11062;
- }
-
- public void setDZb11062(double dZb11062) {
- this.dZb11062 = dZb11062;
- }
-
- public double getDRhob11062() {
- return dRhob11062;
- }
-
- public void setDRhob11062(double dRhob11062) {
- this.dRhob11062 = dRhob11062;
- }
-
- public double getDRhof11062() {
- return dRhof11062;
- }
-
- public void setDRhof11062(double dRhof11062) {
- this.dRhof11062 = dRhof11062;
- }
-
- public double getDRD_Ideal11062() {
- return dRD_Ideal11062;
- }
-
- public void setDRD_Ideal11062(double dRD_Ideal11062) {
- this.dRD_Ideal11062 = dRD_Ideal11062;
- }
-
- public double getDRD_Real11062() {
- return dRD_Real11062;
- }
-
- public void setDRD_Real11062(double dRD_Real11062) {
- this.dRD_Real11062 = dRD_Real11062;
- }
-
- public double getDWobbeIndex() {
- return dWobbeIndex;
- }
-
- public void setDWobbeIndex(double dWobbeIndex) {
- this.dWobbeIndex = dWobbeIndex;
- }
-
- public double getPc() {
- return Pc;
- }
-
- public void setPc(double pc) {
- this.Pc = pc;
- }
-
- public double getTC() {
- return TC;
- }
-
- public void setTC(double tc) {
- this.TC = tc;
- }
-
- public double getBzsx() {
- return Bzsx;
- }
-
- public void setBzsx(double bzsx) {
- this.Bzsx = bzsx;
- }
-
- public double getBzxx() {
- return Bzxx;
- }
-
- public void setBzxx(double bzxx) {
- this.Bzxx = bzxx;
- }
-
- public double getTotalC() {
- return TotalC;
- }
-
- public void setTotalC(double totalC) {
- this.TotalC = totalC;
- }
-
- public double getC2() {
- return C2;
- }
-
- public void setC2(double c2) {
- this.C2 = c2;
- }
-
- public double getC2j() {
- return C2j;
- }
-
- public void setC2j(double c2j) {
- this.C2j = c2j;
- }
-
- public double getC3j() {
- return C3j;
- }
-
- public void setC3j(double c3j) {
- this.C3j = c3j;
- }
-
- public double getC4j() {
- return C4j;
- }
-
- public void setC4j(double c4j) {
- this.C4j = c4j;
- }
-
- public double getC5j() {
- return C5j;
- }
-
- public void setC5j(double c5j) {
- this.C5j = c5j;
- }
-
- public double getC6j() {
- return C6j;
- }
-
- public void setC6j(double c6j) {
- this.C6j = c6j;
- }
-
- public double getC3C4() {
- return C3C4;
- }
-
- public void setC3C4(double c3c4) {
- this.C3C4 = c3c4;
- }
}
diff --git a/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/service/DetailService.java b/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/service/DetailService.java
index c35cf89..b549bdc 100644
--- a/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/service/DetailService.java
+++ b/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/service/DetailService.java
@@ -6,7 +6,7 @@ import org.springframework.stereotype.Service;
@Service
public class DetailService {
- private static final int NUMBER_OF_COMPONENTS = 21;
+
private static final double RGASKJ = 8.314510e-3;
// 成员变量转换
@@ -124,7 +124,22 @@ public class DetailService {
public double dd2BdT2;
- // 其他成员变量...
+ // 构造函数
+ public DetailService()
+ {
+ //initialize history-sensitive variables
+ dOldMixID = 0.0; // mixture ID from previous calc
+ dOldPb = 0.0; // base pressure from previous calc
+ dOldTb = 0.0; // base temperature from previous calc
+ dOldPf = 0.0; // flowing pressure from previous calc
+ dOldTf = 0.0; // flowing temperature from previous calc
+
+ //initialize gas component array used within this class
+ for (int i = 0; i < GasConstants.NUMBEROFCOMPONENTS; i++) dXi[i] = 0;
+ // function table() populates tables of static constants
+ table();
+
+ }
public void run(GasProps gasProps) {
// 实现转换后的逻辑
@@ -132,7 +147,7 @@ public class DetailService {
int i;
// Check for gas composition change
- gasProps.bForceUpdate = gasProps.bForceUpdate || compositionChange(gasProps);
+ gasProps.bForceUpdate = (gasProps.bForceUpdate || compositionChange(gasProps));
// assign component IDs and values
if (gasProps.bForceUpdate) {
@@ -224,10 +239,9 @@ public class DetailService {
private boolean compositionChange(GasProps gasProps) {
double dMixID = 0.0;
- for (int i = 0; i < NUMBER_OF_COMPONENTS; i++) {
- dMixID += ((i + 2) * gasProps.getAdMixture()[i]);
- }
- if (dMixID != dOldMixID) {
+ for (int i = 0; i < GasConstants.NUMBEROFCOMPONENTS; i++) {
+ dMixID += ((i + 2) * gasProps.adMixture[i]);
+ }if (dMixID != dOldMixID) {
dOldMixID = dMixID;
return true;
}
@@ -238,10 +252,10 @@ public class DetailService {
int j, k;
// table 5 parameters; declared locally to this function
- double[] adTable5Mri = new double[GasConstants.NUMBEROFCOMPONENTS];
- double[] adTable5Ei = new double[GasConstants.NUMBEROFCOMPONENTS];
- double[] adTable5Ki = new double[GasConstants.NUMBEROFCOMPONENTS];
- double[] adTable5Gi = new double[GasConstants.NUMBEROFCOMPONENTS];
+ double[] adTable5Mri;
+ double[] adTable5Ei;
+ double[] adTable5Ki;
+ double[] adTable5Gi;
// 初始化adTable5Mri数组
adTable5Mri = new double[]{16.0430, 28.0135, 44.0100, 30.0700, 44.0970, 18.0153, 34.0820, 2.0159, 28.0100, 31.9988, 58.1230, 58.1230, 72.1500, 72.1500, 86.1770, 100.2040, 114.2310, 128.2580, 142.2850, 4.0026, 39.9480};
diff --git a/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/service/GBT11062Service.java b/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/service/GBT11062Service.java
index f0c3907..9afe7f4 100644
--- a/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/service/GBT11062Service.java
+++ b/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/service/GBT11062Service.java
@@ -50,89 +50,89 @@ public class GBT11062Service {
double dMair = 28.9626;
double dZair = 0;
-DetailService detailService;
- public void Run(GasProps ptAGA10) {
+
+ public void Run(GasProps gasProps) {
for (int i = 0; i < GasConstants.NUMBEROFCOMPONENTS; i++) dXi[i] = 0;
iNCC = -1;
for (i = 0; i < GasConstants.NUMBEROFCOMPONENTS; i++) {
- if (ptAGA10.adMixture[i] > 0.0) {
+ if (gasProps.adMixture[i] > 0.0) {
iNCC = iNCC + 1;
aiCID[iNCC] = i;
- dXi[iNCC] = ptAGA10.adMixture[i];
+ dXi[iNCC] = gasProps.adMixture[i];
}
}
iNCC = iNCC + 1;
for (i = 0; i < GasConstants.NUMBEROFCOMPONENTS; i++) {
- if (ptAGA10.adMixture[i] != 0) {
- ptAGA10.Pc += adTablePc[i] * ptAGA10.adMixture[i];
- ptAGA10.TC += adTableTc[i] * ptAGA10.adMixture[i];
+ if (gasProps.adMixture[i] != 0) {
+ gasProps.dPc += adTablePc[i] * gasProps.adMixture[i];
+ gasProps.dTC += adTableTc[i] * gasProps.adMixture[i];
if (adTableBzsx[i] != 0) {
- ptAGA10.Bzsx += ptAGA10.adMixture[i] / adTableBzsx[i];
- ptAGA10.Bzxx += ptAGA10.adMixture[i] / adTableBzxx[i];
+ gasProps.dBzsx += gasProps.adMixture[i] / adTableBzsx[i];
+ gasProps.dBzxx += gasProps.adMixture[i] / adTableBzxx[i];
}
if (i >= 10 & i <= 18) {
- ptAGA10.C4j += ptAGA10.adMixture[i] * adTableMri[i];
+ gasProps.dC4j += gasProps.adMixture[i] * adTableMri[i];
}
if (i >= 12 & i <= 18) {
- ptAGA10.C5j += ptAGA10.adMixture[i] * adTableMri[i];
+ gasProps.dC5j += gasProps.adMixture[i] * adTableMri[i];
}
if (i >= 14 & i <= 18) {
- ptAGA10.C6j += ptAGA10.adMixture[i] * adTableMri[i];
+ gasProps.dC6j += gasProps.adMixture[i] * adTableMri[i];
}
if (i == 3) {
- ptAGA10.C2 += ptAGA10.adMixture[i] * adTableMri[i];
+ gasProps.dC2 += gasProps.adMixture[i] * adTableMri[i];
}
- switch (ptAGA10.dCbtj) {
+ switch (gasProps.dCbtj) {
case 2:
- ptAGA10.dZb11062 += adTableSqrtbj[0][i] * ptAGA10.adMixture[i];
- ptAGA10.dHhvMol += adTableHhvMol[0][i] * ptAGA10.adMixture[i];
- ptAGA10.dLhvMol += adTableLhvMol[0][i] * ptAGA10.adMixture[i];
+ gasProps.dZb11062 += adTableSqrtbj[0][i] * gasProps.adMixture[i];
+ gasProps.dHhvMol += adTableHhvMol[0][i] * gasProps.adMixture[i];
+ gasProps.dLhvMol += adTableLhvMol[0][i] * gasProps.adMixture[i];
dZair = 0.99941;
break;
case 1:
- ptAGA10.dZb11062 += adTableSqrtbj[1][i] * ptAGA10.adMixture[i];
- ptAGA10.dHhvMol += adTableHhvMol[1][i] * ptAGA10.adMixture[i];
- ptAGA10.dLhvMol += adTableLhvMol[1][i] * ptAGA10.adMixture[i];
+ gasProps.dZb11062 += adTableSqrtbj[1][i] * gasProps.adMixture[i];
+ gasProps.dHhvMol += adTableHhvMol[1][i] * gasProps.adMixture[i];
+ gasProps.dLhvMol += adTableLhvMol[1][i] * gasProps.adMixture[i];
dZair = 0.99958;
break;
case 0:
- ptAGA10.dZb11062 += adTableSqrtbj[2][i] * ptAGA10.adMixture[i];
- ptAGA10.dHhvMol += adTableHhvMol[2][i] * ptAGA10.adMixture[i];
- ptAGA10.dLhvMol += adTableLhvMol[2][i] * ptAGA10.adMixture[i];
+ gasProps.dZb11062 += adTableSqrtbj[2][i] * gasProps.adMixture[i];
+ gasProps.dHhvMol += adTableHhvMol[2][i] * gasProps.adMixture[i];
+ gasProps.dLhvMol += adTableLhvMol[2][i] * gasProps.adMixture[i];
dZair = 0.99963;
break;
}
}
}
- ptAGA10.Bzsx = 1 / ptAGA10.Bzsx;
- ptAGA10.Bzxx = 1 / ptAGA10.Bzxx;
- ptAGA10.dZb11062 = 1 - ptAGA10.dZb11062 * ptAGA10.dZb11062;
- ptAGA10.dHhvm = ptAGA10.dHhvMol / ptAGA10.dMrx;
- ptAGA10.dLhvm = ptAGA10.dLhvMol / ptAGA10.dMrx;
- ptAGA10.dHhvv = ptAGA10.dHhvMol * ptAGA10.dPb / ptAGA10.dTb / 8314.510 / ptAGA10.dZb11062;
- ptAGA10.dLhvv = ptAGA10.dLhvMol * ptAGA10.dPb / ptAGA10.dTb / 8314.510 / ptAGA10.dZb11062;
- ptAGA10.dRD_Ideal11062 = ptAGA10.dMrx / dMair;
- ptAGA10.dRD_Real11062 = ptAGA10.dRD_Ideal11062 * dZair / ptAGA10.dZb11062;
+ gasProps.dBzsx = 1 / gasProps.dBzsx;
+ gasProps.dBzxx = 1 / gasProps.dBzxx;
+ gasProps.dZb11062 = 1 - gasProps.dZb11062 * gasProps.dZb11062;
+ gasProps.dHhvm = gasProps.dHhvMol / gasProps.dMrx;
+ gasProps.dLhvm = gasProps.dLhvMol / gasProps.dMrx;
+ gasProps.dHhvv = gasProps.dHhvMol * gasProps.dPb / gasProps.dTb / 8314.510 / gasProps.dZb11062;
+ gasProps.dLhvv = gasProps.dLhvMol * gasProps.dPb / gasProps.dTb / 8314.510 / gasProps.dZb11062;
+ gasProps.dRD_Ideal11062 = gasProps.dMrx / dMair;
+ gasProps.dRD_Real11062 = gasProps.dRD_Ideal11062 * dZair / gasProps.dZb11062;
- ptAGA10.dRhob11062 = ptAGA10.dMrx * ptAGA10.dPb / 8314.51 / ptAGA10.dTb / ptAGA10.dZb11062;
- ptAGA10.dRhof11062 = ptAGA10.dMrx * ptAGA10.dPf / 8314.51 / ptAGA10.dTf / ptAGA10.dZf;
- ptAGA10.dWobbeIndex = ptAGA10.dHhvv / Math.sqrt(ptAGA10.dRD_Real11062);
- ptAGA10.C3j = ptAGA10.C4j + ptAGA10.adMixture[4] * adTableMri[4];
- ptAGA10.C2j = ptAGA10.C3j + ptAGA10.adMixture[3] * adTableMri[3];
- ptAGA10.C3C4 = ptAGA10.adMixture[4] * adTableMri[4] + ptAGA10.adMixture[10] * adTableMri[10] + ptAGA10.adMixture[11] * adTableMri[11];
- ptAGA10.TotalC = ptAGA10.C2j + ptAGA10.adMixture[0] * adTableMri[0];
+ gasProps.dRhob11062 = gasProps.dMrx * gasProps.dPb / 8314.51 / gasProps.dTb / gasProps.dZb11062;
+ gasProps.dRhof11062 = gasProps.dMrx * gasProps.dPf / 8314.51 / gasProps.dTf / gasProps.dZf;
+ gasProps.dWobbeIndex = gasProps.dHhvv / Math.sqrt(gasProps.dRD_Real11062);
+ gasProps.dC3j = gasProps.dC4j + gasProps.adMixture[4] * adTableMri[4];
+ gasProps.dC2j = gasProps.dC3j + gasProps.adMixture[3] * adTableMri[3];
+ gasProps.dC3C4 = gasProps.adMixture[4] * adTableMri[4] + gasProps.adMixture[10] * adTableMri[10] + gasProps.adMixture[11] * adTableMri[11];
+ gasProps.dTotalC = gasProps.dC2j + gasProps.adMixture[0] * adTableMri[0];
- ptAGA10.TotalC = ptAGA10.TotalC * ptAGA10.dPb / 8314.51 / ptAGA10.dTb / ptAGA10.dZb11062;
- ptAGA10.C2 = ptAGA10.C2 * ptAGA10.dPb / 8314.51 / ptAGA10.dTb / ptAGA10.dZb11062;
- ptAGA10.C3C4 = ptAGA10.C3C4 * ptAGA10.dPb / 8314.51 / ptAGA10.dTb / ptAGA10.dZb11062;
- ptAGA10.C2j = ptAGA10.C2j * ptAGA10.dPb / 8314.51 / ptAGA10.dTb / ptAGA10.dZb11062;
- ptAGA10.C3j = ptAGA10.C3j * ptAGA10.dPb / 8314.51 / ptAGA10.dTb / ptAGA10.dZb11062;
- ptAGA10.C4j = ptAGA10.C4j * ptAGA10.dPb / 8314.51 / ptAGA10.dTb / ptAGA10.dZb11062;
- ptAGA10.C5j = ptAGA10.C5j * ptAGA10.dPb / 8314.51 / ptAGA10.dTb / ptAGA10.dZb11062;
- ptAGA10.C6j = ptAGA10.C6j * ptAGA10.dPb / 8314.51 / ptAGA10.dTb / ptAGA10.dZb11062;
+ gasProps.dTotalC = gasProps.dTotalC * gasProps.dPb / 8314.51 / gasProps.dTb / gasProps.dZb11062;
+ gasProps.dC2 = gasProps.dC2 * gasProps.dPb / 8314.51 / gasProps.dTb / gasProps.dZb11062;
+ gasProps.dC3C4 = gasProps.dC3C4 * gasProps.dPb / 8314.51 / gasProps.dTb / gasProps.dZb11062;
+ gasProps.dC2j = gasProps.dC2j * gasProps.dPb / 8314.51 / gasProps.dTb / gasProps.dZb11062;
+ gasProps.dC3j = gasProps.dC3j * gasProps.dPb / 8314.51 / gasProps.dTb / gasProps.dZb11062;
+ gasProps.dC4j = gasProps.dC4j * gasProps.dPb / 8314.51 / gasProps.dTb / gasProps.dZb11062;
+ gasProps.dC5j = gasProps.dC5j * gasProps.dPb / 8314.51 / gasProps.dTb / gasProps.dZb11062;
+ gasProps.dC6j = gasProps.dC6j * gasProps.dPb / 8314.51 / gasProps.dTb / gasProps.dZb11062;
}
diff --git a/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/service/ThermService.java b/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/service/ThermService.java
index 4a9854f..c5a6831 100644
--- a/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/service/ThermService.java
+++ b/ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/service/ThermService.java
@@ -54,13 +54,14 @@ public class ThermService {
{0.0, 4.9680, 0.0, 100.0, 0.0, 100.0, 0.0, 100.0, 0.0, 100.0, 0.0},
{0.0, 4.9680, 0.0, 100.0, 0.0, 100.0, 0.0, 100.0, 0.0, 100.0, 0.0}
};
-
- public void calculateThermodynamicProperties(GasProps gasProps) {
- // 实现热力学计算逻辑
- double cp = calculateCpiMolar(gasProps);
- gasProps.setDCpi(cp * 1000 / gasProps.getDMrx());
- // 其他计算...
+ public ThermService()
+ {
+ // initialize 3 history-sensitive variables
+ dSi = 0.0;
+ dTold = 0.0;
+ dMrxold = 0.0;
}
+
public void Run(GasProps gasProps, DetailService detailService)
{
//local variables
@@ -86,7 +87,7 @@ public class ThermService {
gasProps.dKappa = (c * gasProps.dRhof) / gasProps.dPf;
return;
}
- private double calculateCpiMolar(GasProps gasProps) {
+ private double CpiMolar(GasProps gasProps) {
double cp = 0.0;
double Cpx;
double DT, FT, HT, JT;
@@ -213,7 +214,7 @@ public class ThermService {
double Hinc = 0.0;
double Sinc = 0.0;
double Smixing = 0.0;
- double Cp = calculateCpiMolar(gasProps);
+ double Cp = CpiMolar(gasProps);
double Si;
gasProps.dHo = Ho(gasProps);
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysTreeDictController.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysTreeDictController.java
index 81892bd..75c6df7 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysTreeDictController.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysTreeDictController.java
@@ -1,10 +1,13 @@
package com.ruoyi.system.controller;
+
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
+
+
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -36,6 +39,8 @@ public class SysTreeDictController extends BaseController
{
@Autowired
private ISysTreeDictService sysTreeDictService;
+ @Autowired
+ private SysUnitConvertController sysUnitConvertController;
/**
* 查询树形字典列表
@@ -62,6 +67,8 @@ public class SysTreeDictController extends BaseController
util.exportExcel(response, list, "树形字典数据");
}
+
+
/**
* 获取树形字典详细信息
*/
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUnitConvertController.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUnitConvertController.java
index fea6da4..d26a1a2 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUnitConvertController.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUnitConvertController.java
@@ -1,7 +1,12 @@
package com.ruoyi.system.controller;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
+
+import com.ruoyi.system.service.impl.SysUnitConvertServiceImpl;
+import org.springframework.context.annotation.ComponentScan;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -29,8 +34,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
*/
@RestController
@RequestMapping("/system/sysUnitConvert")
-public class SysUnitConvertController extends BaseController
-{
+public class SysUnitConvertController extends BaseController {
@Autowired
private ISysUnitConvertService sysUnitConvertService;
@@ -39,11 +43,10 @@ public class SysUnitConvertController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('system:sysUnitConvert:list')")
@GetMapping("/list")
- public TableDataInfo list(SysUnitConvert sysUnitConvert)
- {
+ public TableDataInfo list(SysUnitConvert sysUnitConvert) {
startPage();
List list = sysUnitConvertService.selectSysUnitConvertList(sysUnitConvert);
- TableDataInfo tableDataInfo=getDataTable(list);
+ TableDataInfo tableDataInfo = getDataTable(list);
return tableDataInfo;
}
@@ -53,8 +56,7 @@ public class SysUnitConvertController extends BaseController
@PreAuthorize("@ss.hasPermi('system:sysUnitConvert:export')")
@Log(title = "单位换算", businessType = BusinessType.EXPORT)
@PostMapping("/export")
- public void export(HttpServletResponse response, SysUnitConvert sysUnitConvert)
- {
+ public void export(HttpServletResponse response, SysUnitConvert sysUnitConvert) {
List list = sysUnitConvertService.selectSysUnitConvertList(sysUnitConvert);
ExcelUtil util = new ExcelUtil(SysUnitConvert.class);
util.exportExcel(response, list, "单位换算数据");
@@ -65,11 +67,11 @@ public class SysUnitConvertController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('system:sysUnitConvert:query')")
@GetMapping(value = "/{id}")
- public AjaxResult getInfo(@PathVariable("id") Long id)
- {
+ public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(sysUnitConvertService.selectSysUnitConvertById(id));
}
+
/**
* 新增单位换算
*/
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/UnitConvert.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/UnitConvert.java
new file mode 100644
index 0000000..940d532
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/UnitConvert.java
@@ -0,0 +1,100 @@
+package com.ruoyi.system.controller;
+
+import com.ruoyi.system.domain.SysUnitConvert;
+import com.ruoyi.system.service.ISysUnitConvertService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+
+@Component
+public class UnitConvert {
+
+ private final ISysUnitConvertService sysUnitConvertService;
+
+ @Autowired
+ public UnitConvert(ISysUnitConvertService sysUnitConvertService) {
+ this.sysUnitConvertService = sysUnitConvertService;
+ }
+
+ public double ConvertUniter(String unitType, double oldValue, int oldUnit, int newUnit) {
+ // 查询旧单位信息
+ if ("temperature".equalsIgnoreCase(unitType)) {
+ return handleTemperatureConversion(BigDecimal.valueOf(oldValue), (long) oldUnit, (long) newUnit).doubleValue();
+ } else {
+ SysUnitConvert tempUnit = new SysUnitConvert();
+ tempUnit.setUnitType(unitType);
+ tempUnit.setUnitOrder((long) oldUnit);
+
+ SysUnitConvert oldUnitInfo = sysUnitConvertService.selectSysUnitConvertUnitByTypeOrder(tempUnit);
+ if (oldUnitInfo == null) {
+ throw new IllegalArgumentException("旧单位 '" + oldUnit + "' 不存在或不可用");
+ }
+ tempUnit=new SysUnitConvert();;
+ tempUnit.setUnitType(unitType);
+ tempUnit.setBaseUnit("Y");
+
+ SysUnitConvert baseUnitInfo = sysUnitConvertService.selectSysUnitConvertUnitByTypeOrder(tempUnit);
+ if (baseUnitInfo == null) {
+ throw new IllegalArgumentException("基准单位 不存在或不可用");
+ }
+ tempUnit=new SysUnitConvert();
+ tempUnit.setUnitType(unitType);
+ tempUnit.setUnitOrder((long) newUnit);
+ // 查询新单位信息
+ SysUnitConvert newUnitInfo = sysUnitConvertService.selectSysUnitConvertUnitByTypeOrder(tempUnit);
+ if (newUnitInfo == null) {
+ throw new IllegalArgumentException("新单位 '" + newUnit + "' 不存在或不可用");
+ }
+
+ BigDecimal oldFactor = oldUnitInfo.getConversionFactor();
+ BigDecimal newFactor = newUnitInfo.getConversionFactor();
+
+ // 检查旧单位转换因子是否为零
+ if (oldFactor.compareTo(BigDecimal.ZERO) == 0) {
+ throw new ArithmeticException("旧单位 '" + oldUnit + "' 的转换因子为零,无法进行转换");
+ }
+
+ // 计算基准值:oldValue / oldFactor
+ int scale = 20; // 设置足够大的精度以避免精度丢失
+ BigDecimal baseValue = BigDecimal.valueOf(oldValue).divide(oldFactor, scale, RoundingMode.HALF_UP);
+
+ // 计算新值:baseValue * newFactor
+ BigDecimal newValue = baseValue.multiply(newFactor);
+
+ // 四舍五入到合理的小数位数(例如10位)
+ newValue = newValue.setScale(10, RoundingMode.HALF_UP);
+
+ return newValue.doubleValue();
+ }
+ }
+
+ // 温度转换方法
+ public BigDecimal handleTemperatureConversion(BigDecimal oldValue, Long oldUnit, Long newUnit) {
+ final BigDecimal THIRTY_TWO = BigDecimal.valueOf(32);
+ final BigDecimal FIVE = BigDecimal.valueOf(5);
+ final BigDecimal NINE = BigDecimal.valueOf(9);
+ final BigDecimal TWO_HUNDRED_SEVENTY_THREE_POINT_ONE_FIVE = BigDecimal.valueOf(273.15);
+ // 使用原始值计算
+ BigDecimal celsius;
+ if (oldUnit == 0) {
+ celsius = oldValue;
+ } else if (oldUnit == 1) {
+ celsius = oldValue.subtract(THIRTY_TWO).multiply(FIVE).divide(NINE, 10, RoundingMode.HALF_UP);
+ } else if (oldUnit == 2) {
+ celsius = oldValue.subtract(TWO_HUNDRED_SEVENTY_THREE_POINT_ONE_FIVE);
+ } else {
+ throw new IllegalArgumentException("无效温度单位");
+ }
+
+ if (newUnit == 0) {
+ return celsius;
+ } else if (newUnit == 1) {
+ return celsius.multiply(NINE).divide(FIVE, 10, RoundingMode.HALF_UP).add(THIRTY_TWO);
+ } else if (newUnit == 2) {
+ return celsius.add(TWO_HUNDRED_SEVENTY_THREE_POINT_ONE_FIVE);
+ }
+ throw new IllegalArgumentException("无效温度单位");
+ }
+}
\ No newline at end of file
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUnitConvertMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUnitConvertMapper.java
index 4e97d65..04bcae3 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUnitConvertMapper.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUnitConvertMapper.java
@@ -58,4 +58,13 @@ public interface SysUnitConvertMapper
* @return 结果
*/
public int deleteSysUnitConvertByIds(Long[] ids);
+
+
+ /**
+ * 查询单位换算
+ *
+ * @param sysUnitConvert 需要删除的数据主键集合
+ * @return 结果
+ */
+ public SysUnitConvert selectSysUnitConvertUnitByTypeOrder(SysUnitConvert sysUnitConvert);
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUnitConvertService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUnitConvertService.java
index 82d36be..96112db 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUnitConvertService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUnitConvertService.java
@@ -27,6 +27,14 @@ public interface ISysUnitConvertService
*/
public List selectSysUnitConvertList(SysUnitConvert sysUnitConvert);
+ /**
+ * 查询单位
+ *
+ * @param sysUnitConvert 单位换算
+ * @return 单位换算集合
+ */
+ public SysUnitConvert selectSysUnitConvertUnitByTypeOrder(SysUnitConvert sysUnitConvert);
+
/**
* 新增单位换算
*
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUnitConvertServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUnitConvertServiceImpl.java
index 0cec580..f4e2ea7 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUnitConvertServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUnitConvertServiceImpl.java
@@ -43,6 +43,20 @@ public class SysUnitConvertServiceImpl implements ISysUnitConvertService
return sysUnitConvertMapper.selectSysUnitConvertList(sysUnitConvert);
}
+
+
+ /**
+ * 查询单位换算
+ *
+ * @param sysUnitConvert 单位换算
+ * @return 单位换算
+ */
+
+ @Override
+ public SysUnitConvert selectSysUnitConvertUnitByTypeOrder(SysUnitConvert sysUnitConvert) {
+ return sysUnitConvertMapper.selectSysUnitConvertUnitByTypeOrder(sysUnitConvert);
+ }
+
/**
* 新增单位换算
*
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUnitConvertMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUnitConvertMapper.xml
index 0943484..383b26f 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysUnitConvertMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysUnitConvertMapper.xml
@@ -1,37 +1,60 @@
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
- select id, unit_type, unit_name, base_unit, conversion_factor, unit_type_name, status, unit_order from sys_unit_convert
+ select id,
+ unit_type,
+ unit_name,
+ base_unit,
+ conversion_factor,
+ unit_type_name,
+ status,
+ unit_order
+ from sys_unit_convert
-
+
+
+
+