Skip to content

Commit

Permalink
rename variables
Browse files Browse the repository at this point in the history
  • Loading branch information
asmfstatoil committed Feb 29, 2024
1 parent 8ceb4a1 commit 9acbcc1
Show file tree
Hide file tree
Showing 46 changed files with 242 additions and 287 deletions.
38 changes: 17 additions & 21 deletions src/main/java/neqsim/thermo/component/Component.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,41 +194,38 @@ public Component(int number, double TC, double PC, double M, double a, double mo
* Constructor for Component.
* </p>
*
* @param component_name Name of component.
* @param name Name of component.
* @param moles Total number of moles of component.
* @param molesInPhase Number of moles in phase.
* @param compnumber Index number of component in phase object component array.
* @param compIndex Index number of component in phase object component array.
*/
public Component(String component_name, double moles, double molesInPhase, int compnumber) {
createComponent(component_name, moles, molesInPhase, compnumber);
public Component(String name, double moles, double molesInPhase, int compIndex) {
createComponent(name, moles, molesInPhase, compIndex);
}

/** {@inheritDoc} */
@Override
public void createComponent(String component_name, double moles, double molesInPhase,
int compnumber) {
if (component_name == null) {
public void createComponent(String name, double moles, double molesInPhase, int compIndex) {
if (name == null) {
throw new RuntimeException(new neqsim.util.exception.InvalidInputException(this,
"createComponent", "component_name", "can not be null"));
"createComponent", "name", "can not be null"));
}
if (component_name.trim() == "") {
if (name.trim() == "") {
throw new RuntimeException(new neqsim.util.exception.InvalidInputException(this,
"createComponent", "component_name", "can not be empty"));
"createComponent", "name", "can not be empty"));
}
component_name = ComponentInterface.getComponentNameFromAlias(component_name);
componentName = component_name;
name = ComponentInterface.getComponentNameFromAlias(name);
componentName = name;
numberOfMoles = moles;
numberOfMolesInPhase = molesInPhase;
java.sql.ResultSet dataSet = null;
try (neqsim.util.database.NeqSimDataBase database = new neqsim.util.database.NeqSimDataBase()) {
if (!component_name.equals("default")) {
if (!name.equals("default")) {
try {
if (NeqSimDataBase.createTemporaryTables()) {
dataSet = database
.getResultSet(("SELECT * FROM comptemp WHERE name='" + component_name + "'"));
dataSet = database.getResultSet(("SELECT * FROM comptemp WHERE name='" + name + "'"));
} else {
dataSet =
database.getResultSet(("SELECT * FROM comp WHERE name='" + component_name + "'"));
dataSet = database.getResultSet(("SELECT * FROM comp WHERE name='" + name + "'"));
}
dataSet.next();
dataSet.getString("ID");
Expand All @@ -237,9 +234,8 @@ public void createComponent(String component_name, double moles, double molesInP
try {
dataSet.close();
// logger.info("no parameters in tempcomp -- trying comp.. " +
// component_name);
dataSet =
database.getResultSet(("SELECT * FROM comp WHERE name='" + component_name + "'"));
// name);
dataSet = database.getResultSet(("SELECT * FROM comp WHERE name='" + name + "'"));
dataSet.next();
} catch (Exception e2) {
throw new RuntimeException(e2);
Expand Down Expand Up @@ -445,7 +441,7 @@ public void createComponent(String component_name, double moles, double molesInP
waxFormer = Integer.parseInt(dataSet.getString("waxformer")) == 1;
// System.out.println(componentName + " pure component parameters: ok...");
}
componentNumber = compnumber;
componentNumber = compIndex;
} catch (Exception ex) {
logger.error("error in comp", ex);
}
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/neqsim/thermo/component/ComponentBWRS.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,18 @@ public class ComponentBWRS extends ComponentSrk {
* Constructor for ComponentBWRS.
* </p>
*
* @param component_name Name of component.
* @param name Name of component.
* @param moles Total number of moles of component.
* @param molesInPhase Number of moles in phase.
* @param compnumber Index number of component in phase object component array.
* @param compIndex Index number of component in phase object component array.
*/
public ComponentBWRS(String component_name, double moles, double molesInPhase, int compnumber) {
super(component_name, moles, molesInPhase, compnumber);
public ComponentBWRS(String name, double moles, double molesInPhase, int compIndex) {
super(name, moles, molesInPhase, compIndex);

try (neqsim.util.database.NeqSimDataBase database = new neqsim.util.database.NeqSimDataBase()) {
java.sql.ResultSet dataSet = null;
try {
dataSet = database
.getResultSet(("SELECT * FROM mbwr32param WHERE name='" + component_name + "'"));
dataSet = database.getResultSet(("SELECT * FROM mbwr32param WHERE name='" + name + "'"));
dataSet.next();
dataSet.getClob("name");
} catch (Exception ex) {
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/neqsim/thermo/component/ComponentCSPsrk.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ public class ComponentCSPsrk extends ComponentSrk {
* Constructor for ComponentCSPsrk.
* </p>
*
* @param component_name Name of component.
* @param name Name of component.
* @param moles Total number of moles of component.
* @param molesInPhase Number of moles in phase.
* @param compnumber Index number of component in phase object component array.
* @param compIndex Index number of component in phase object component array.
*/
public ComponentCSPsrk(String component_name, double moles, double molesInPhase, int compnumber) {
super(component_name, moles, molesInPhase, compnumber);
public ComponentCSPsrk(String name, double moles, double molesInPhase, int compIndex) {
super(name, moles, molesInPhase, compIndex);
}

/**
Expand Down
19 changes: 8 additions & 11 deletions src/main/java/neqsim/thermo/component/ComponentDesmukhMather.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,25 @@ public class ComponentDesmukhMather extends ComponentGE {
* Constructor for ComponentDesmukhMather.
* </p>
*
* @param component_name Name of component.
* @param name Name of component.
* @param moles Total number of moles of component.
* @param molesInPhase Number of moles in phase.
* @param compnumber Index number of component in phase object component array.
* @param compIndex Index number of component in phase object component array.
*/
public ComponentDesmukhMather(String component_name, double moles, double molesInPhase,
int compnumber) {
super(component_name, moles, molesInPhase, compnumber);
public ComponentDesmukhMather(String name, double moles, double molesInPhase, int compIndex) {
super(name, moles, molesInPhase, compIndex);
java.sql.ResultSet dataSet = null;

try (neqsim.util.database.NeqSimDataBase database = new neqsim.util.database.NeqSimDataBase()) {
if (!component_name.equals("default")) {
if (!name.equals("default")) {
try {
dataSet =
database.getResultSet(("SELECT * FROM comptemp WHERE name='" + component_name + "'"));
dataSet = database.getResultSet(("SELECT * FROM comptemp WHERE name='" + name + "'"));
dataSet.next();
dataSet.getString("FORMULA");
} catch (Exception ex) {
dataSet.close();
logger.info("no parameters in tempcomp -- trying comp.. " + component_name);
dataSet =
database.getResultSet(("SELECT * FROM comp WHERE name='" + component_name + "'"));
logger.info("no parameters in tempcomp -- trying comp.. " + name);
dataSet = database.getResultSet(("SELECT * FROM comp WHERE name='" + name + "'"));
dataSet.next();
}
deshMathIonicDiameter = Double.parseDouble(dataSet.getString("DeshMatIonicDiameter"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@ public class ComponentElectrolyteCPA extends ComponentModifiedFurstElectrolyteEo
* Constructor for ComponentElectrolyteCPA.
* </p>
*
* @param component_name Name of component.
* @param name Name of component.
* @param moles Total number of moles of component.
* @param molesInPhase Number of moles in phase.
* @param compnumber Index number of component in phase object component array.
* @param compIndex Index number of component in phase object component array.
*/
public ComponentElectrolyteCPA(String component_name, double moles, double molesInPhase,
int compnumber) {
super(component_name, moles, molesInPhase, compnumber);
public ComponentElectrolyteCPA(String name, double moles, double molesInPhase, int compIndex) {
super(name, moles, molesInPhase, compIndex);
xsite = new double[numberOfAssociationSites];
xsitedni = new double[numberOfAssociationSites][100];
xsitedV = new double[numberOfAssociationSites];
Expand Down Expand Up @@ -601,7 +600,7 @@ public double[][] getXsitedni() {
* </p>
*
* @param xNumb a int
* @param compNumbi a int
* @param compIndexi a int
* @return a double
*/
public double getXsitedni(int xNumb, int compNumbi) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,13 @@ public class ComponentElectrolyteCPAOld extends ComponentModifiedFurstElectrolyt
* Constructor for ComponentElectrolyteCPAOld.
* </p>
*
* @param component_name Name of component.
* @param name Name of component.
* @param moles Total number of moles of component.
* @param molesInPhase Number of moles in phase.
* @param compnumber Index number of component in phase object component array.
* @param compIndex Index number of component in phase object component array.
*/
public ComponentElectrolyteCPAOld(String component_name, double moles, double molesInPhase,
int compnumber) {
super(component_name, moles, molesInPhase, compnumber);
public ComponentElectrolyteCPAOld(String name, double moles, double molesInPhase, int compIndex) {
super(name, moles, molesInPhase, compIndex);
xsite = new double[numberOfAssociationSites];
xsitedV = new double[numberOfAssociationSites];
xsiteOld = new double[numberOfAssociationSites];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ public class ComponentElectrolyteCPAstatoil extends ComponentElectrolyteCPA {
* Constructor for ComponentElectrolyteCPAstatoil.
* </p>
*
* @param component_name Name of component.
* @param name Name of component.
* @param moles Total number of moles of component.
* @param molesInPhase Number of moles in phase.
* @param compnumber Index number of component in phase object component array.
* @param compIndex Index number of component in phase object component array.
*/
public ComponentElectrolyteCPAstatoil(String component_name, double moles, double molesInPhase,
int compnumber) {
super(component_name, moles, molesInPhase, compnumber);
public ComponentElectrolyteCPAstatoil(String name, double moles, double molesInPhase,
int compIndex) {
super(name, moles, molesInPhase, compIndex);
}

/**
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/neqsim/thermo/component/ComponentEos.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ public abstract class ComponentEos extends Component implements ComponentEosInte
* Constructor for ComponentEos.
* </p>
*
* @param component_name Name of component.
* @param name Name of component.
* @param moles Total number of moles of component.
* @param molesInPhase Number of moles in phase.
* @param compnumber Index number of component in phase object component array.
* @param compIndex Index number of component in phase object component array.
*/
public ComponentEos(String component_name, double moles, double molesInPhase, int compnumber) {
super(component_name, moles, molesInPhase, compnumber);
public ComponentEos(String name, double moles, double molesInPhase, int compIndex) {
super(name, moles, molesInPhase, compIndex);
}

/**
Expand Down Expand Up @@ -732,8 +732,8 @@ public double getdUdVdnS(PhaseInterface phase) {
* </p>
*
* @param phase a {@link neqsim.thermo.phase.PhaseInterface} object
* @param compNumb1 a int
* @param compNumb2 a int
* @param compIndex1 a int
* @param compIndex2 a int
* @return a double
*/
public double getdUdndnSV(PhaseInterface phase, int compNumb1, int compNumb2) {
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/neqsim/thermo/component/ComponentGE.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ public abstract class ComponentGE extends Component implements ComponentGEInterf
* Constructor for ComponentGE.
* </p>
*
* @param component_name Name of component.
* @param name Name of component.
* @param moles Total number of moles of component.
* @param molesInPhase Number of moles in phase.
* @param compnumber Index number of component in phase object component array.
* @param compIndex Index number of component in phase object component array.
*/
public ComponentGE(String component_name, double moles, double molesInPhase, int compnumber) {
super(component_name, moles, molesInPhase, compnumber);
public ComponentGE(String name, double moles, double molesInPhase, int compIndex) {
super(name, moles, molesInPhase, compIndex);
}

/** {@inheritDoc} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@ public class ComponentGENRTLmodifiedHV extends ComponentGeNRTL {
* Constructor for ComponentGENRTLmodifiedHV.
* </p>
*
* @param component_name Name of component.
* @param name Name of component.
* @param moles Total number of moles of component.
* @param molesInPhase Number of moles in phase.
* @param compnumber Index number of component in phase object component array.
* @param compIndex Index number of component in phase object component array.
*/
public ComponentGENRTLmodifiedHV(String component_name, double moles, double molesInPhase,
int compnumber) {
super(component_name, moles, molesInPhase, compnumber);
public ComponentGENRTLmodifiedHV(String name, double moles, double molesInPhase, int compIndex) {
super(name, moles, molesInPhase, compIndex);
}

/** {@inheritDoc} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@ public class ComponentGENRTLmodifiedWS extends ComponentGeNRTL {
* Constructor for ComponentGENRTLmodifiedWS.
* </p>
*
* @param component_name Name of component.
* @param name Name of component.
* @param moles Total number of moles of component.
* @param molesInPhase Number of moles in phase.
* @param compnumber Index number of component in phase object component array.
* @param compIndex Index number of component in phase object component array.
*/
public ComponentGENRTLmodifiedWS(String component_name, double moles, double molesInPhase,
int compnumber) {
super(component_name, moles, molesInPhase, compnumber);
public ComponentGENRTLmodifiedWS(String name, double moles, double molesInPhase, int compIndex) {
super(name, moles, molesInPhase, compIndex);
}

/** {@inheritDoc} */
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/neqsim/thermo/component/ComponentGERG2004.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ public class ComponentGERG2004 extends ComponentEos {
* Constructor for ComponentGERG2004.
* </p>
*
* @param component_name Name of component.
* @param name Name of component.
* @param moles Total number of moles of component.
* @param molesInPhase Number of moles in phase.
* @param compnumber Index number of component in phase object component array.
* @param compIndex Index number of component in phase object component array.
*/
public ComponentGERG2004(String component_name, double moles, double molesInPhase,
int compnumber) {
super(component_name, moles, molesInPhase, compnumber);
public ComponentGERG2004(String name, double moles, double molesInPhase, int compIndex) {
super(name, moles, molesInPhase, compIndex);
}

/**
Expand Down
19 changes: 8 additions & 11 deletions src/main/java/neqsim/thermo/component/ComponentGEUnifac.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,17 @@ public class ComponentGEUnifac extends ComponentGEUniquac {
* Constructor for ComponentGEUnifac.
* </p>
*
* @param component_name Name of component.
* @param name Name of component.
* @param moles Total number of moles of component.
* @param molesInPhase Number of moles in phase.
* @param compnumber Index number of component in phase object component array.
* @param compIndex Index number of component in phase object component array.
*/
public ComponentGEUnifac(String component_name, double moles, double molesInPhase,
int compnumber) {
super(component_name, moles, molesInPhase, compnumber);
public ComponentGEUnifac(String name, double moles, double molesInPhase, int compIndex) {
super(name, moles, molesInPhase, compIndex);
if (!this.getClass().equals(ComponentGEUnifac.class)) {
return;
}
if (component_name.contains("_PC")) {
if (name.contains("_PC")) {
double number = getMolarMass() / 0.014;
int intNumb = (int) Math.round(number) - 2;
unifacGroups.add(new UNIFACgroup(1, 2));
Expand All @@ -62,22 +61,20 @@ public ComponentGEUnifac(String component_name, double moles, double molesInPhas
try (neqsim.util.database.NeqSimDataBase database = new neqsim.util.database.NeqSimDataBase()) {
java.sql.ResultSet dataSet = null;
try {
dataSet =
database.getResultSet(("SELECT * FROM unifaccomp WHERE Name='" + component_name + "'"));
dataSet = database.getResultSet(("SELECT * FROM unifaccomp WHERE Name='" + name + "'"));
dataSet.next();
dataSet.getClob("name");
} catch (Exception ex) {
dataSet.close();
dataSet =
database.getResultSet(("SELECT * FROM unifaccomp WHERE Name='" + component_name + "'"));
dataSet = database.getResultSet(("SELECT * FROM unifaccomp WHERE Name='" + name + "'"));
dataSet.next();
}

for (int p = 1; p < numberOfUnifacSubGroups; p++) {
int temp = Integer.parseInt(dataSet.getString("sub" + Integer.toString(p)));
if (temp > 0) {
unifacGroups.add(new UNIFACgroup(p, temp));
// System.out.println("comp " + component_name + " adding UNIFAC group " + p);
// System.out.println("comp " + name + " adding UNIFAC group " + p);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ public class ComponentGEUnifacPSRK extends ComponentGEUnifac {
* Constructor for ComponentGEUnifacPSRK.
* </p>
*
* @param component_name Name of component.
* @param name Name of component.
* @param moles Total number of moles of component.
* @param molesInPhase Number of moles in phase.
* @param compnumber Index number of component in phase object component array.
* @param compIndex Index number of component in phase object component array.
*/
public ComponentGEUnifacPSRK(String component_name, double moles, double molesInPhase,
int compnumber) {
super(component_name, moles, molesInPhase, compnumber);
public ComponentGEUnifacPSRK(String name, double moles, double molesInPhase, int compIndex) {
super(name, moles, molesInPhase, compIndex);
}

/**
Expand Down
Loading

0 comments on commit 9acbcc1

Please sign in to comment.