Skip to content

Commit b669d58

Browse files
authored
update tests (#1251)
1 parent 58c04dd commit b669d58

File tree

3 files changed

+70
-1
lines changed

3 files changed

+70
-1
lines changed

src/main/java/neqsim/standards/gasquality/Standard_ISO6976.java

-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ public void calculate() {
245245
Zmix20 -= Math.pow(Zmixtemp20, 2.0);
246246
molRefm3 =
247247
volRefP * 1.0e5 * 1.0 / (R * (getVolRefT() + 273.15) * getValue("CompressionFactor"));
248-
// System.out.println("molRefm3 " + molRefm3);
249248
}
250249

251250
/** {@inheritDoc} */

src/test/java/neqsim/standards/gasquality/Standard_ISO6976Test.java

+39
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import org.junit.jupiter.api.BeforeAll;
66
import org.junit.jupiter.api.Disabled;
77
import org.junit.jupiter.api.Test;
8+
import neqsim.process.equipment.stream.Stream;
89
import neqsim.thermo.system.SystemInterface;
910
import neqsim.thermo.system.SystemSrkEos;
1011
import neqsim.thermodynamicoperations.ThermodynamicOperations;
@@ -164,6 +165,44 @@ void testCalculate2() {
164165
*/
165166
}
166167

168+
169+
@Test
170+
void testCalculate3() {
171+
SystemInterface testSystem = new SystemSrkEos(273.15, 1.0);
172+
testSystem.addComponent("methane", 0.92470);
173+
testSystem.addComponent("ethane", 0.035);
174+
testSystem.addComponent("propane", 0.0098);
175+
testSystem.addComponent("n-butane", 0.00220);
176+
testSystem.addComponent("i-butane", 0.0034);
177+
testSystem.addComponent("n-pentane", 0.0006);
178+
testSystem.addComponent("nitrogen", 0.0175);
179+
testSystem.addComponent("CO2", 0.0068);
180+
testSystem.createDatabase(true);
181+
testSystem.setMixingRule(2);
182+
183+
testSystem.init(0);
184+
Standard_ISO6976 standard = new Standard_ISO6976(testSystem, 15, 15, "volume");
185+
standard.setReferenceState("real");
186+
standard.setReferenceType("volume");
187+
standard.calculate();
188+
Assertions.assertEquals(0.99764929782, standard.getValue("CompressionFactor"), 1e-3);
189+
Assertions.assertEquals(35144.8789915, standard.getValue("InferiorCalorificValue"), 5);
190+
Assertions.assertEquals(38959.473378295, standard.getValue("GCV"), 1e-5);
191+
192+
Assertions.assertEquals(50107.49824498, standard.getValue("SuperiorWobbeIndex"), 1e-5);
193+
Assertions.assertEquals(45201.380041, standard.getValue("InferiorWobbeIndex"), 1e-5);
194+
195+
Assertions.assertEquals(0.60453397833045, standard.getValue("RelativeDensity"), 1e-5);
196+
Assertions.assertEquals(0.99770997554, standard.getValue("CompressionFactor"), 1e-5);
197+
Assertions.assertEquals(17.477845, standard.getValue("MolarMass"), 1e-5);
198+
199+
Stream testStream = new Stream("testStream", testSystem);
200+
testStream.run();
201+
Assertions.assertEquals(50107.49824498, testStream.getWI("volume", 15, 15) / 1e3, 1e-5);
202+
Assertions.assertEquals(38959.473378, testStream.getGCV("volume", 15, 15) / 1e3, 1e-5);
203+
204+
}
205+
167206
@Test
168207
@Disabled
169208
void testDisplay() {

src/test/java/neqsim/standards/gasquality/Standard_ISO6976_2016_Test.java

+31
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,37 @@ void testCalculate2() {
132132
*/
133133
}
134134

135+
@Test
136+
void testCalculate3() {
137+
SystemInterface testSystem = new SystemSrkEos(273.15, 1.0);
138+
testSystem.addComponent("methane", 0.92470);
139+
testSystem.addComponent("ethane", 0.035);
140+
testSystem.addComponent("propane", 0.0098);
141+
testSystem.addComponent("n-butane", 0.00220);
142+
testSystem.addComponent("i-butane", 0.0034);
143+
testSystem.addComponent("n-pentane", 0.0006);
144+
testSystem.addComponent("nitrogen", 0.0175);
145+
testSystem.addComponent("CO2", 0.0068);
146+
testSystem.createDatabase(true);
147+
testSystem.setMixingRule(2);
148+
149+
testSystem.init(0);
150+
Standard_ISO6976_2016 standard = new Standard_ISO6976_2016(testSystem, 15, 15, "volume");
151+
standard.setReferenceState("real");
152+
standard.setReferenceType("volume");
153+
standard.calculate();
154+
Assertions.assertEquals(0.99764929782, standard.getValue("CompressionFactor"), 1e-3);
155+
Assertions.assertEquals(35144.8789915, standard.getValue("InferiorCalorificValue"), 5);
156+
Assertions.assertEquals(38956.94693, standard.getValue("GCV"), 1e-5);
157+
158+
Assertions.assertEquals(50105.17975854, standard.getValue("SuperiorWobbeIndex"), 1e-5);
159+
Assertions.assertEquals(45201.5624460, standard.getValue("InferiorWobbeIndex"), 1e-5);
160+
161+
Assertions.assertEquals(0.6045115156, standard.getValue("RelativeDensity"), 1e-5);
162+
Assertions.assertEquals(0.99773023373, standard.getValue("CompressionFactor"), 1e-5);
163+
Assertions.assertEquals(17.477288925, standard.getValue("MolarMass"), 1e-5);
164+
}
165+
135166
@Test
136167
@Disabled
137168
void testDisplay() {

0 commit comments

Comments
 (0)