Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
EvenSol committed Jan 10, 2025
1 parent 58c04dd commit 78fea0a
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ public void calculate() {
Zmix20 -= Math.pow(Zmixtemp20, 2.0);
molRefm3 =
volRefP * 1.0e5 * 1.0 / (R * (getVolRefT() + 273.15) * getValue("CompressionFactor"));
// System.out.println("molRefm3 " + molRefm3);
}

/** {@inheritDoc} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import neqsim.process.equipment.stream.Stream;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkEos;
import neqsim.thermodynamicoperations.ThermodynamicOperations;
Expand Down Expand Up @@ -164,6 +165,44 @@ void testCalculate2() {
*/
}


@Test
void testCalculate3() {
SystemInterface testSystem = new SystemSrkEos(273.15, 1.0);
testSystem.addComponent("methane", 0.92470);
testSystem.addComponent("ethane", 0.035);
testSystem.addComponent("propane", 0.0098);
testSystem.addComponent("n-butane", 0.00220);
testSystem.addComponent("i-butane", 0.0034);
testSystem.addComponent("n-pentane", 0.0006);
testSystem.addComponent("nitrogen", 0.0175);
testSystem.addComponent("CO2", 0.0068);
testSystem.createDatabase(true);
testSystem.setMixingRule(2);

testSystem.init(0);
Standard_ISO6976 standard = new Standard_ISO6976(testSystem, 15, 15, "volume");
standard.setReferenceState("real");
standard.setReferenceType("volume");
standard.calculate();
Assertions.assertEquals(0.99764929782, standard.getValue("CompressionFactor"), 1e-3);
Assertions.assertEquals(35144.8789915, standard.getValue("InferiorCalorificValue"), 5);
Assertions.assertEquals(38959.473378295, standard.getValue("GCV"), 1e-5);

Assertions.assertEquals(50107.49824498, standard.getValue("SuperiorWobbeIndex"), 1e-5);
Assertions.assertEquals(45201.380041, standard.getValue("InferiorWobbeIndex"), 1e-5);

Assertions.assertEquals(0.60453397833045, standard.getValue("RelativeDensity"), 1e-5);
Assertions.assertEquals(0.99770997554, standard.getValue("CompressionFactor"), 1e-5);
Assertions.assertEquals(17.477845, standard.getValue("MolarMass"), 1e-5);

Stream testStream = new Stream("testStream", testSystem);
testStream.run();
Assertions.assertEquals(50107.49824498, testStream.getWI("volume", 15, 15) / 1e3, 1e-5);
Assertions.assertEquals(38959.473378, testStream.getGCV("volume", 15, 15) / 1e3, 1e-5);

}

@Test
@Disabled
void testDisplay() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,37 @@ void testCalculate2() {
*/
}

@Test
void testCalculate3() {
SystemInterface testSystem = new SystemSrkEos(273.15, 1.0);
testSystem.addComponent("methane", 0.92470);
testSystem.addComponent("ethane", 0.035);
testSystem.addComponent("propane", 0.0098);
testSystem.addComponent("n-butane", 0.00220);
testSystem.addComponent("i-butane", 0.0034);
testSystem.addComponent("n-pentane", 0.0006);
testSystem.addComponent("nitrogen", 0.0175);
testSystem.addComponent("CO2", 0.0068);
testSystem.createDatabase(true);
testSystem.setMixingRule(2);

testSystem.init(0);
Standard_ISO6976_2016 standard = new Standard_ISO6976_2016(testSystem, 15, 15, "volume");
standard.setReferenceState("real");
standard.setReferenceType("volume");
standard.calculate();
Assertions.assertEquals(0.99764929782, standard.getValue("CompressionFactor"), 1e-3);
Assertions.assertEquals(35144.8789915, standard.getValue("InferiorCalorificValue"), 5);
Assertions.assertEquals(38956.94693, standard.getValue("GCV"), 1e-5);

Assertions.assertEquals(50105.17975854, standard.getValue("SuperiorWobbeIndex"), 1e-5);
Assertions.assertEquals(45201.5624460, standard.getValue("InferiorWobbeIndex"), 1e-5);

Assertions.assertEquals(0.6045115156, standard.getValue("RelativeDensity"), 1e-5);
Assertions.assertEquals(0.99773023373, standard.getValue("CompressionFactor"), 1e-5);
Assertions.assertEquals(17.477288925, standard.getValue("MolarMass"), 1e-5);
}

@Test
@Disabled
void testDisplay() {
Expand Down

0 comments on commit 78fea0a

Please sign in to comment.