更新 ruoyi-ngtools/src/main/java/com/ruoyi/ngCalTools/controller/GasController.java

修改类的初始化
This commit is contained in:
ldeyun 2025-02-24 07:37:17 +00:00
parent e35df8935d
commit 17c74ab82b

View File

@ -27,12 +27,12 @@ return tempPar;
} }
public int NG_Cal_Init() { public int NG_Cal_Init() {
//create object for calculating density //create object for calculating density
if (null == detailService) { if (null == (detailService=new DetailService())) {
return GasConstants.MEMORY_ALLOCATION_ERROR; return GasConstants.MEMORY_ALLOCATION_ERROR;
} }
//create object for calculating thermodynamic properties //create object for calculating thermodynamic properties
if (null == thermService) { if (null == (thermService=new ThermService())) {
return GasConstants.MEMORY_ALLOCATION_ERROR; return GasConstants.MEMORY_ALLOCATION_ERROR;
} }
@ -48,7 +48,7 @@ return tempPar;
} }
public double SOS(GasProps gasProps) { public double SOS(GasProps gasProps) {
// check if library is ready; initialize if necessary // check if library is ready; initialize if necessary
if (null == detailService || null == thermService) { if (null == (detailService=new DetailService()) || null == (thermService=new ThermService())) {
NG_Cal_UnInit(); NG_Cal_UnInit();
NG_Cal_Init(); NG_Cal_Init();
} }
@ -81,7 +81,7 @@ return tempPar;
int i; int i;
//check objects for readiness; try to initialize if not //check objects for readiness; try to initialize if not
if (null == detailService || null == thermService) if (null == (detailService=new DetailService()) || null == (thermService=new ThermService()))
{ {
NG_Cal_UnInit(); NG_Cal_UnInit();
@ -146,7 +146,7 @@ return tempPar;
} }
public double Zcal(GasProps gasProps, double dPlenumVelocity) public double Zcal(GasProps gasProps, double dPlenumVelocity)
{ {
if (null == detailService || null == thermService) if (null == (detailService=new DetailService()) || null == (thermService=new ThermService()))
{ {
NG_Cal_UnInit(); NG_Cal_UnInit();
if (GasConstants.NG_Cal_INITIALIZED != NG_Cal_Init()) if (GasConstants.NG_Cal_INITIALIZED != NG_Cal_Init())