From 2fa6701ca5795c784765e05de6de35a25ab84a29 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Fri, 22 Sep 2023 20:46:51 +0000 Subject: [PATCH] fixed bug and added test --- .../util/generator/PropertyGenerator.java | 2 +- .../util/generator/PropertyGeneratorTest.java | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 src/test/java/neqsim/util/generator/PropertyGeneratorTest.java diff --git a/src/main/java/neqsim/util/generator/PropertyGenerator.java b/src/main/java/neqsim/util/generator/PropertyGenerator.java index e51f4fc183..533b9ccde2 100644 --- a/src/main/java/neqsim/util/generator/PropertyGenerator.java +++ b/src/main/java/neqsim/util/generator/PropertyGenerator.java @@ -129,7 +129,7 @@ public HashMap calculate() { Z[i] = fluid.getZ(); viscosity[i] = fluid.getViscosity("cP"); enthalpy[i] = fluid.getEnthalpy("J/mol"); - entropy[i] = fluid.getEnthalpy("J/molK"); + entropy[i] = fluid.getEntropy("J/molK"); Cp[i] = fluid.getCp("kJ/kgK"); Cv[i] = fluid.getCp("kJ/kgK"); density[i] = fluid.getDensity("kg/m3"); diff --git a/src/test/java/neqsim/util/generator/PropertyGeneratorTest.java b/src/test/java/neqsim/util/generator/PropertyGeneratorTest.java new file mode 100644 index 0000000000..ecf4828481 --- /dev/null +++ b/src/test/java/neqsim/util/generator/PropertyGeneratorTest.java @@ -0,0 +1,36 @@ +package neqsim.util.generator; + +import org.junit.jupiter.api.Test; +import neqsim.thermo.system.SystemInterface; +import neqsim.thermo.system.SystemSrkEos; + +public class PropertyGeneratorTest { + @Test + void testCalculate() { + + SystemInterface fluid = new SystemSrkEos(273.15 + 45.0, 22.0); + fluid.addComponent("water", 0.1); + fluid.addComponent("nitrogen", 0.02); + fluid.addComponent("CO2", 0.03); + fluid.addComponent("H2S", 0.01); + fluid.addComponent("methane", 0.80); + fluid.addComponent("ethane", 0.04); + fluid.addComponent("propane", 0.03); + fluid.addComponent("i-butane", 0.02); + fluid.addComponent("n-butane", 0.01); + fluid.addComponent("i-pentane", 0.01); + fluid.addComponent("n-pentane", 0.01); + fluid.addComponent("n-hexane", 0.01); + fluid.addComponent("nC10", 0.1); + fluid.setMixingRule(2); + fluid.useVolumeCorrection(true); + fluid.setMultiPhaseCheck(true); + + double[] temps = new double[] {280.0, 290.0}; + double[] pres = new double[] {10.0, 20.0}; + PropertyGenerator generator = new PropertyGenerator(fluid, temps, pres); + generator.calculate(); + + + } +}