Skip to content

Commit

Permalink
add HC analyser and test
Browse files Browse the repository at this point in the history
  • Loading branch information
EvenSol committed Jan 9, 2025
1 parent c9c23ec commit bbd31b2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import org.apache.logging.log4j.Logger;
import neqsim.process.equipment.stream.StreamInterface;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.util.empiric.BukacekWaterInGas;
import neqsim.thermodynamicoperations.ThermodynamicOperations;
import neqsim.util.ExcludeFromJacocoGeneratedReport;

Expand All @@ -22,8 +21,8 @@ public class HydrocarbonDewPointAnalyser extends StreamMeasurementDeviceBaseClas
/** Logger object for class. */
static Logger logger = LogManager.getLogger(WaterDewPointAnalyser.class);

private double referencePressure = 40.0;
private String method = "Bukacek";
private double referencePressure = 50.0;
private String method = "EOS";

/**
* <p>
Expand Down Expand Up @@ -66,35 +65,19 @@ public void displayResult() {
/** {@inheritDoc} */
@Override
public double getMeasuredValue(String unit) {
if (method.equals("Bukacek")) {
SystemInterface tempFluid = stream.getThermoSystem().clone();
tempFluid.setTemperature(BukacekWaterInGas
.waterDewPointTemperature(tempFluid.getComponent("water").getx(), referencePressure));
return tempFluid.getTemperature(unit);
} else if (method.equals("multiphase")) {
SystemInterface tempFluid = stream.getThermoSystem().clone();
tempFluid.setPressure(referencePressure);
tempFluid.setTemperature(0.1, "C");
ThermodynamicOperations thermoOps = new ThermodynamicOperations(tempFluid);
try {
thermoOps.waterDewPointTemperatureMultiphaseFlash();
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
return tempFluid.getTemperature(unit);
} else {
SystemInterface tempFluid = stream.getThermoSystem().clone();
SystemInterface tempFluid2 = tempFluid.setModel("GERG-water-EOS");
tempFluid2.setPressure(referencePressure);
tempFluid2.setTemperature(-17.0, "C");
ThermodynamicOperations thermoOps = new ThermodynamicOperations(tempFluid2);
try {
thermoOps.waterDewPointTemperatureFlash();
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
return tempFluid2.getTemperature(unit);
SystemInterface tempFluid = stream.getThermoSystem().clone();
if (tempFluid.hasComponent("water")) {
tempFluid.removeComponent("water");
}
tempFluid.setPressure(referencePressure);
tempFluid.setTemperature(-10.0, "C");
ThermodynamicOperations thermoOps = new ThermodynamicOperations(tempFluid);
try {
thermoOps.dewPointTemperatureFlash(false);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
return tempFluid.getTemperature(unit);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package neqsim.process.measurementdevice;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import neqsim.process.equipment.stream.Stream;
import neqsim.process.processmodel.ProcessSystem;
Expand All @@ -8,16 +9,17 @@

public class HydrocarbonDewPointAnalyserTest {
@Test
void testGetMethod() {
void testHCdewPoint() {
SystemInterface thermoSystem = new SystemSrkEos(298.0, 50.0);
thermoSystem.addComponent("methane", 1.0);
thermoSystem.addComponent("ethane", 1.0);
thermoSystem.addComponent("propane", 1.0);
thermoSystem.addComponent("i-butane", 1.0);
thermoSystem.addComponent("n-butane", 1.0);
thermoSystem.addComponent("i-pentane", 1.0);
thermoSystem.addComponent("n-pentane", 1.0);

thermoSystem.addComponent("ethane", .01);
thermoSystem.addComponent("propane", 0.001);
thermoSystem.addComponent("i-butane", 0.001);
thermoSystem.addComponent("n-butane", 0.001);
thermoSystem.addComponent("i-pentane", 0.001);
thermoSystem.addComponent("n-pentane", 0.0001);
thermoSystem.addComponent("water", 0.001);
thermoSystem.setMixingRule("classic");
Stream stream1 = new Stream("stream 1", thermoSystem);
HydrocarbonDewPointAnalyser hc_analyser =
new HydrocarbonDewPointAnalyser("hc analyser", stream1);
Expand All @@ -26,6 +28,10 @@ void testGetMethod() {
process1.add(hc_analyser);

process1.run();
hc_analyser.setReferencePressure(40.0);
hc_analyser.getMeasuredValue("C");
Assertions.assertEquals(-14.0173918, hc_analyser.getMeasuredValue("C"), 1e-5);


}
}

0 comments on commit bbd31b2

Please sign in to comment.