diff --git a/src/main/java/neqsim/processSimulation/processEquipment/separator/Separator.java b/src/main/java/neqsim/processSimulation/processEquipment/separator/Separator.java index e1a9448031..5d785b0241 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/separator/Separator.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/separator/Separator.java @@ -302,7 +302,10 @@ public void runTransient(double dt, UUID id) { // double liqoutMoles = liquidOutStream.getThermoSystem().getNumberOfMoles(); thermoSystem.init(3); gasOutStream.getThermoSystem().init(3); - liquidOutStream.getThermoSystem().init(3); + if (liquidOutStream.getThermoSystem().hasPhaseType("oil")) { + liquidOutStream.getThermoSystem().init(3); + } + double volume1 = thermoSystem.getVolume(); // System.out.println("volume1 " + volume1); double deltaEnergy = inletStreamMixer.getOutletStream().getThermoSystem().getEnthalpy() diff --git a/src/test/java/neqsim/processSimulation/processSystem/ProcessSystemRunTransientTest.java b/src/test/java/neqsim/processSimulation/processSystem/ProcessSystemRunTransientTest.java index 61636c3bcb..8e4893484a 100644 --- a/src/test/java/neqsim/processSimulation/processSystem/ProcessSystemRunTransientTest.java +++ b/src/test/java/neqsim/processSimulation/processSystem/ProcessSystemRunTransientTest.java @@ -85,6 +85,7 @@ public void testDynamicCalculation() { flowController.setControllerSetPoint(63.5); flowController.setControllerParameters(0.1, 0.10, 0.0); + p = new ProcessSystem(); p.add(stream1); p.add(valve1); p.add(separator1); @@ -170,6 +171,7 @@ public void testDynamicCalculation2() { separatorPressureController.setControllerSetPoint(7.0); separatorPressureController.setControllerParameters(0.5, 10.0, 0.0); + p = new ProcessSystem(); p.add(stream1); p.add(valve1); @@ -214,4 +216,51 @@ public void testDynamicCalculation2() { } } } + + @Test + public void testDynamicCalculation3() { + neqsim.thermo.system.SystemInterface testSystem2 = + new neqsim.thermo.system.SystemSrkEos((273.15 + 25.0), 100.00); + testSystem2.addComponent("methane", 1.1); + testSystem2.addComponent("n-heptane", 1.1); + testSystem2.setMixingRule(2); + + + Stream feedStreeam = new Stream("Purge Stream", testSystem2); + + Separator separator1 = new Separator("separator_1"); + separator1.addStream(feedStreeam); + separator1.setCalculateSteadyState(false); + separator1.setInternalDiameter(1.0); + separator1.setSeparatorLength(3.0); + + ThrottlingValve gasValve = new ThrottlingValve("valve_gas", separator1.getGasOutStream()); + gasValve.setOutletPressure(7.0); + gasValve.setPercentValveOpening(50); + + ThrottlingValve liquidValve = new ThrottlingValve("valve_gas", separator1.getLiquidOutStream()); + liquidValve.setOutletPressure(7.0); + liquidValve.setPercentValveOpening(50); + + p = new ProcessSystem(); + p.add(feedStreeam); + p.add(separator1); + p.add(gasValve); + p.add(liquidValve); + + p.run(); + + feedStreeam.setFlowRate(1e-10, "kg/sec"); + liquidValve.setPercentValveOpening(1e-10); + System.out.println("pressure " + separator1.getPressure()); + p.runTransient(0.01); + System.out.println("pressure " + separator1.getPressure()); + p.runTransient(0.01); + System.out.println("pressure " + separator1.getPressure()); + p.runTransient(0.01); + System.out.println("pressure " + separator1.getPressure()); + p.runTransient(0.01); + System.out.println("pressure " + separator1.getPressure()); + + } }