Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into LeachmanCompressor
Browse files Browse the repository at this point in the history
  • Loading branch information
victorigi99 committed Mar 6, 2025
2 parents b42b51f + ac8fe05 commit 02163c2
Show file tree
Hide file tree
Showing 6 changed files with 287 additions and 38 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<version>${revision}</version>

<properties>
<revision>3.0.19</revision>
<revision>3.0.20</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<checkstyle.config.location>checkstyle_neqsim.xml</checkstyle.config.location>
Expand Down
2 changes: 1 addition & 1 deletion pomJava21.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<version>${revision}${sha1}${changelist}</version>

<properties>
<revision>3.0.19</revision>
<revision>3.0.20</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sha1/>
Expand Down
2 changes: 1 addition & 1 deletion pomJava8.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<version>${revision}${sha1}${changelist}-Java8</version>

<properties>
<revision>3.0.19</revision>
<revision>3.0.20</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sha1 />
Expand Down
69 changes: 34 additions & 35 deletions src/main/java/neqsim/process/equipment/stream/Stream.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public class Stream extends ProcessEquipmentBaseClass implements StreamInterface

protected SystemInterface thermoSystem;

// todo: is streamNumber ever anything besides 0 and 1? consider removing along with
// todo: is streamNumber ever anything besides 0 and 1? consider removing along
// with
// numberOfStreams?
protected int streamNumber = 0;
/** Constant <code>numberOfStreams=0</code>. */
Expand Down Expand Up @@ -68,12 +69,13 @@ public Stream(String name) {
* </p>
*
* <p>
* NB! This construct uses the input stream object internally, i.e., it is not cloned. Use
* NB! This construct uses the input stream object internally, i.e., it is not
* cloned. Use
* <code>streamObject.clone(newName)</code> rather than
* <code>new Stream(newName,streamObject)</code>
* </p>
*
* @param name name of stream
* @param name name of stream
* @param stream Stream to use as internal Stream.
*/
public Stream(String name, StreamInterface stream) {
Expand All @@ -89,10 +91,11 @@ public Stream(String name, StreamInterface stream) {
* </p>
*
* <p>
* NB! This construct uses the input thermoSystem object internally, i.e., it is not cloned.
* NB! This construct uses the input thermoSystem object internally, i.e., it is
* not cloned.
* </p>
*
* @param name name of stream
* @param name name of stream
* @param thermoSystem System to use as internal System.
*/
public Stream(String name, SystemInterface thermoSystem) {
Expand Down Expand Up @@ -179,7 +182,8 @@ public Stream clone() {
try {
clonedSystem = (Stream) super.clone();
} catch (Exception ex) {
logger.error(ex.getMessage());;
logger.error(ex.getMessage());
;
}
if (stream != null) {
clonedSystem.setStream(stream.clone());
Expand Down Expand Up @@ -251,8 +255,7 @@ public void setThermoSystemFromPhase(SystemInterface thermoSystem, String phaseT
} else if (thermoSystem.hasPhaseType("oil")) {
this.thermoSystem = thermoSystem.phaseToSystem(thermoSystem.getPhaseNumberOfPhase("oil"));
} else if (thermoSystem.hasPhaseType("aqueous")) {
this.thermoSystem =
thermoSystem.phaseToSystem(thermoSystem.getPhaseNumberOfPhase("aqueous"));
this.thermoSystem = thermoSystem.phaseToSystem(thermoSystem.getPhaseNumberOfPhase("aqueous"));
} else {
logger.warn("no phase of type " + phaseTypeName);
logger.warn("...returning empty system ");
Expand Down Expand Up @@ -368,8 +371,7 @@ && getSpecification().equals("TP")) {
double gasEnthalpy = thermoSystem.getPhase(0).getEnthalpy();
double liquidEnthalpy = thermoSystem.getPhase(1).getEnthalpy();

double enthalpySpec =
getGasQuality() * gasEnthalpy + (1.0 - getGasQuality()) * liquidEnthalpy;
double enthalpySpec = getGasQuality() * gasEnthalpy + (1.0 - getGasQuality()) * liquidEnthalpy;
thermoOps.PHflash(enthalpySpec);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
Expand Down Expand Up @@ -472,7 +474,7 @@ public void phaseEnvelope() {
SystemInterface localSyst = getFluid().clone();
ThermodynamicOperations ops = new ThermodynamicOperations(localSyst);
ops.setRunAsThread(true);
ops.calcPTphaseEnvelope(true);
ops.calcPTphaseEnvelope2();
ops.waitAndCheckForFinishedCalculation(10000);
ops.displayResult();
// ops.getJfreeChart();
Expand All @@ -484,7 +486,7 @@ public double CCB(String unit) {
SystemInterface localSyst = getFluid().clone();
ThermodynamicOperations ops = new ThermodynamicOperations(localSyst);
ops.setRunAsThread(true);
ops.calcPTphaseEnvelope(true);
ops.calcPTphaseEnvelope2();
ops.waitAndCheckForFinishedCalculation(10000);
if (unit.equals("bara") || unit.equals("bar")) {
return ops.get("cricondenbar")[1];
Expand All @@ -505,7 +507,7 @@ public double CCT(String unit) {
SystemInterface localSyst = getFluid().clone();
ThermodynamicOperations ops = new ThermodynamicOperations(localSyst);
ops.setRunAsThread(true);
ops.calcPTphaseEnvelope(true);
ops.calcPTphaseEnvelope2();
ops.waitAndCheckForFinishedCalculation(10000);
if (unit.equals("bara") || unit.equals("bar")) {
return ops.get("cricondentherm")[1];
Expand Down Expand Up @@ -582,9 +584,9 @@ public String[][] reportResults() {
* </p>
*
* @param propertyName a {@link java.lang.String} object
* @param unit a {@link java.lang.String} object
* @param phase a {@link java.lang.String} object
* @param component a {@link java.lang.String} object
* @param unit a {@link java.lang.String} object
* @param phase a {@link java.lang.String} object
* @param component a {@link java.lang.String} object
* @return a {@link java.lang.Object} object
*/
public Object getProperty(String propertyName, String unit, String phase, String component) {
Expand All @@ -611,17 +613,15 @@ public double GCV() {
@Override
public double getHydrocarbonDewPoint(String temperatureUnit, double refpressure,
String refPressureUnit) {
HydrocarbonDewPointAnalyser dewPointAnalyser =
new HydrocarbonDewPointAnalyser("dew point analyser", this);
HydrocarbonDewPointAnalyser dewPointAnalyser = new HydrocarbonDewPointAnalyser("dew point analyser", this);
dewPointAnalyser.setReferencePressure(refpressure);
return dewPointAnalyser.getMeasuredValue(temperatureUnit);
}

/** {@inheritDoc} */
@Override
public double getGCV(String unit, double refTVolume, double refTCombustion) {
Standard_ISO6976 standard =
new Standard_ISO6976(getFluid().clone(), refTVolume, refTCombustion, unit);
Standard_ISO6976 standard = new Standard_ISO6976(getFluid().clone(), refTVolume, refTCombustion, unit);
standard.setReferenceState("real");
standard.calculate();
return standard.getValue("SuperiorCalorificValue") * 1.0e3;
Expand All @@ -630,8 +630,7 @@ public double getGCV(String unit, double refTVolume, double refTCombustion) {
/** {@inheritDoc} */
@Override
public double getWI(String unit, double refTVolume, double refTCombustion) {
Standard_ISO6976 standard =
new Standard_ISO6976(getFluid().clone(), refTVolume, refTCombustion, unit);
Standard_ISO6976 standard = new Standard_ISO6976(getFluid().clone(), refTVolume, refTCombustion, unit);
standard.setReferenceState("real");
standard.calculate();
return standard.getValue("SuperiorWobbeIndex") * 1.0e3;
Expand All @@ -640,8 +639,7 @@ public double getWI(String unit, double refTVolume, double refTCombustion) {
/** {@inheritDoc} */
@Override
public Standard_ISO6976 getISO6976(String unit, double refTVolume, double refTCombustion) {
Standard_ISO6976 standard =
new Standard_ISO6976(getFluid().clone(), refTVolume, refTCombustion, unit);
Standard_ISO6976 standard = new Standard_ISO6976(getFluid().clone(), refTVolume, refTCombustion, unit);
standard.setReferenceState("real");
return standard;
}
Expand All @@ -660,7 +658,8 @@ public double LCV() {
* Setter for the field <code>stream</code>.
* </p>
*
* @param stream a {@link neqsim.process.equipment.stream.StreamInterface} object
* @param stream a {@link neqsim.process.equipment.stream.StreamInterface}
* object
*/
public void setStream(StreamInterface stream) {
this.stream = stream;
Expand Down Expand Up @@ -702,21 +701,21 @@ public ArrayList<String[]> getReport() {

ArrayList<String[]> report = new ArrayList<String[]>();
report.add(phases.toArray(new String[0]));
report.add(new String[] {"temperature",
report.add(new String[] { "temperature",
Double.toString(getTemperature(neqsim.util.unit.Units.getSymbol("temperature"))),
neqsim.util.unit.Units.getSymbol("temperature")});
report.add(new String[] {"pressure",
neqsim.util.unit.Units.getSymbol("temperature") });
report.add(new String[] { "pressure",
Double.toString(getPressure(neqsim.util.unit.Units.getSymbol("pressure"))),
neqsim.util.unit.Units.getSymbol("pressure")});
report.add(new String[] {"mass flow",
neqsim.util.unit.Units.getSymbol("pressure") });
report.add(new String[] { "mass flow",
Double.toString(getFlowRate(neqsim.util.unit.Units.getSymbol("mass flow"))),
neqsim.util.unit.Units.getSymbol("mass flow")});
report.add(new String[] {"molar flow",
neqsim.util.unit.Units.getSymbol("mass flow") });
report.add(new String[] { "molar flow",
Double.toString(getFlowRate(neqsim.util.unit.Units.getSymbol("molar flow"))),
neqsim.util.unit.Units.getSymbol("molar flow")});
report.add(new String[] {"volume flow",
neqsim.util.unit.Units.getSymbol("molar flow") });
report.add(new String[] { "volume flow",
Double.toString(getFlowRate(neqsim.util.unit.Units.getSymbol("volume flow"))),
neqsim.util.unit.Units.getSymbol("volume flow")});
neqsim.util.unit.Units.getSymbol("volume flow") });
return report;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,33 @@ public double getMeasuredValue(String unit) {
logger.error(ex.getMessage(), ex);
}
return tempFluid.getTemperature(unit);
} else if (method.equals("CPA")) {
SystemInterface tempFluid = stream.getThermoSystem().clone();
SystemInterface tempFluid2 = tempFluid.setModel("CPAs-SRK-EOS-statoil");
tempFluid2.setMultiPhaseCheck(true);
tempFluid2.setPressure(referencePressure);
tempFluid2.setTemperature(0.1, "C");
ThermodynamicOperations thermoOps = new ThermodynamicOperations(tempFluid2);
try {
thermoOps.waterDewPointTemperatureMultiphaseFlash();
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
return tempFluid2.getTemperature(unit);
} else if (method.equals("CPA hydrate")) {
SystemInterface tempFluid = stream.getThermoSystem().clone();
SystemInterface tempFluid2 = tempFluid.setModel("CPAs-SRK-EOS-statoil");
tempFluid2.setMultiPhaseCheck(true);
tempFluid2.setHydrateCheck(true);
tempFluid2.setPressure(referencePressure);
tempFluid2.setTemperature(0.1, "C");
ThermodynamicOperations thermoOps = new ThermodynamicOperations(tempFluid2);
try {
thermoOps.hydrateFormationTemperature();
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
return tempFluid2.getTemperature(unit);
} else {
SystemInterface tempFluid = stream.getThermoSystem().clone();
SystemInterface tempFluid2 = tempFluid.setModel("GERG-water-EOS");
Expand Down
Loading

0 comments on commit 02163c2

Please sign in to comment.