From 90137108fd8420d0209a607a51cef1a5f26f5477 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Sat, 16 Mar 2024 15:18:37 +0000 Subject: [PATCH] test oilstab --- .../processSystem/OilGasProcessTest.java | 203 ++++++++++++++++++ 1 file changed, 203 insertions(+) diff --git a/src/test/java/neqsim/processSimulation/processSystem/OilGasProcessTest.java b/src/test/java/neqsim/processSimulation/processSystem/OilGasProcessTest.java index d8cf896156..4ef650aa64 100644 --- a/src/test/java/neqsim/processSimulation/processSystem/OilGasProcessTest.java +++ b/src/test/java/neqsim/processSimulation/processSystem/OilGasProcessTest.java @@ -2,7 +2,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; +import neqsim.processSimulation.processEquipment.compressor.Compressor; +import neqsim.processSimulation.processEquipment.distillation.DistillationColumn; +import neqsim.processSimulation.processEquipment.heatExchanger.Cooler; import neqsim.processSimulation.processEquipment.heatExchanger.Heater; +import neqsim.processSimulation.processEquipment.mixer.Mixer; import neqsim.processSimulation.processEquipment.pump.Pump; import neqsim.processSimulation.processEquipment.separator.Separator; import neqsim.processSimulation.processEquipment.stream.Stream; @@ -126,4 +130,203 @@ public void runProcess() throws InterruptedException { // System.out.println("recycle flow " + recycle1.getOutletStream().getFlowRate("kg/hr")); // valveLP1.getOutletStream().getFluid().prettyPrint(); } + + @Test + public void runProcessOilSepWithStabColumn() throws InterruptedException { + + SystemInterface thermoSystem = new SystemSrkEos(298.0, 10.0); + thermoSystem.addComponent("nitrogen", 51.0); + thermoSystem.addComponent("CO2", 51.0); + thermoSystem.addComponent("methane", 51.0); + thermoSystem.addComponent("ethane", 51.0); + thermoSystem.addComponent("propane", 51.0); + thermoSystem.addComponent("i-butane", 51.0); + thermoSystem.addComponent("n-butane", 51.0); + thermoSystem.addComponent("iC5", 51.0); + thermoSystem.addComponent("nC5", 1.0); + + thermoSystem.addTBPfraction("C6", 1.0, 86.0 / 1000.0, 0.66); + thermoSystem.addTBPfraction("C7", 1.0, 91.0 / 1000.0, 0.74); + thermoSystem.addTBPfraction("C8", 1.0, 103.0 / 1000.0, 0.77); + thermoSystem.addTBPfraction("C9", 1.0, 117.0 / 1000.0, 0.79); + thermoSystem.addPlusFraction("C10_C12", 1.0, 145.0 / 1000.0, 0.80); + thermoSystem.addPlusFraction("C13_C14", 1.0, 181.0 / 1000.0, 0.8279); + thermoSystem.addPlusFraction("C15_C16", 1.0, 212.0 / 1000.0, 0.837); + thermoSystem.addPlusFraction("C17_C19", 1.0, 248.0 / 1000.0, 0.849); + thermoSystem.addPlusFraction("C20_C22", 1.0, 289.0 / 1000.0, 0.863); + thermoSystem.addPlusFraction("C23_C25", 1.0, 330.0 / 1000.0, 0.875); + thermoSystem.addPlusFraction("C26_C30", 1.0, 387.0 / 1000.0, 0.88); + thermoSystem.addPlusFraction("C31_C38", 1.0, 471.0 / 1000.0, 0.90); + thermoSystem.addPlusFraction("C38_C80", 1.0, 662.0 / 1000.0, 0.92); + thermoSystem.setMixingRule("classic"); + + double topsidePressure = 80.0; + double topsideTemperature = 46.16; + double temperatureOilHeater = 90.0; + double secondStagePressure = 26.78; + double thirdStagePressure = 8.96; + double fourthStagePressure = 3; + double firstStageSuctionCoolerTemperature = 45.0; + double secondStageSuctionCoolerTemperature = 40.0; + + StreamInterface wellFluid = new Stream(thermoSystem); + wellFluid.setFlowRate(1757595.58297715, "kg/hr"); + + Heater feedTPsetter = new Heater(wellFluid); + feedTPsetter.setName("inletTP"); + feedTPsetter.setOutPressure(topsidePressure, "bara"); + feedTPsetter.setOutTemperature(topsideTemperature, "C"); + + StreamInterface feedToOffshoreProcess = new Stream(feedTPsetter.getOutStream()); + feedToOffshoreProcess.setName("feed to offshore"); + + Separator firstStageSeparator = new Separator(feedToOffshoreProcess); + firstStageSeparator.setName("1st stage separator"); + + ThrottlingValve oilThrotValve = new ThrottlingValve(firstStageSeparator.getLiquidOutStream()); + oilThrotValve.setName("valve oil from first stage"); + oilThrotValve.setOutletPressure(secondStagePressure); + + Heater oilHeatEx = new Heater(oilThrotValve.getOutStream()); + oilHeatEx.setName("oil heat exchanger"); + oilHeatEx.setOutTemperature(temperatureOilHeater, "C"); + + Separator secondStageSeparator = new Separator(oilHeatEx.getOutStream()); + secondStageSeparator.setName("2nd stage separator"); + + ThrottlingValve oilThrotValve2 = new ThrottlingValve(secondStageSeparator.getLiquidOutStream()); + oilThrotValve2.setName("valve oil from second stage"); + oilThrotValve2.setOutletPressure(thirdStagePressure); + + StreamInterface oilThirdStageToSep = (Stream) wellFluid.clone(); + oilThirdStageToSep.setFlowRate(1.0, "kg/hr"); + + Separator thirdStageSeparator = new Separator(oilThrotValve2.getOutStream()); + thirdStageSeparator.setName("3rd stage separator"); + + ThrottlingValve oilThrotValve3 = new ThrottlingValve(thirdStageSeparator.getLiquidOutStream()); + oilThrotValve3.setName("valve oil from third stage"); + oilThrotValve3.setOutletPressure(fourthStagePressure); + + DistillationColumn stabilizer = new DistillationColumn(5, true, false); + stabilizer.setName("stabilizer"); + stabilizer.addFeedStream(oilThrotValve3.getOutStream(), 5); + stabilizer.getReboiler().setOutTemperature(273.15 + 100); + stabilizer.setTopPressure(fourthStagePressure); + stabilizer.setBottomPressure(fourthStagePressure); + + StreamInterface stableOil = new Stream(stabilizer.getLiquidOutStream()); + stableOil.setName("stable oil"); + + Cooler firstStageCooler = new Cooler(stabilizer.getGasOutStream()); + firstStageCooler.setName("1st stage cooler"); + firstStageCooler.setOutTemperature(firstStageSuctionCoolerTemperature, "C"); + + Separator firstStageScrubber = new Separator(firstStageCooler.getOutStream()); + firstStageScrubber.setName("1st stage scrubber"); + + Compressor firstStageCompressor = new Compressor(firstStageScrubber.getGasOutStream()); + firstStageCompressor.setName("1st stage compressor"); + firstStageCompressor.setOutletPressure(thirdStagePressure); + firstStageCompressor.setIsentropicEfficiency(0.75); + + Mixer secondStageGasMixer = new Mixer("2nd stage mixer"); + secondStageGasMixer.addStream(thirdStageSeparator.getGasOutStream()); + secondStageGasMixer.addStream(firstStageCompressor.getOutStream()); + + Cooler secondStageCooler = new Cooler(secondStageGasMixer.getOutStream()); + secondStageCooler.setName("2nd stage cooler"); + secondStageCooler.setOutTemperature(secondStageSuctionCoolerTemperature, "C"); + + Separator secondStageScrubber = new Separator(secondStageCooler.getOutStream()); + secondStageScrubber.setName("2nd stage scrubber"); + + Compressor secondStageCompressor = new Compressor(secondStageScrubber.getGasOutStream()); + secondStageCompressor.setName("2nd stage compressor"); + secondStageCompressor.setOutletPressure(secondStagePressure); + secondStageCompressor.setIsentropicEfficiency(0.75); + + Mixer thirdStageMixer = new Mixer("3rd stage mixer"); + thirdStageMixer.addStream(secondStageSeparator.getGasOutStream()); + thirdStageMixer.addStream(secondStageCompressor.getOutStream()); + + Cooler thirdStageCooler = new Cooler(thirdStageMixer.getOutStream()); + thirdStageCooler.setName("3rd stage cooler"); + thirdStageCooler.setOutTemperature(secondStageSuctionCoolerTemperature, "C"); + + Separator thirdStageScrubber = new Separator(thirdStageCooler.getOutStream()); + thirdStageScrubber.setName("3rd stage scrubber"); + + Compressor thirdStageCompressor = new Compressor(thirdStageScrubber.getGasOutStream()); + thirdStageCompressor.setName("3rd stage compressor"); + thirdStageCompressor.setOutletPressure(topsidePressure); + thirdStageCompressor.setIsentropicEfficiency(0.75); + + Mixer richGasMixer = new Mixer("fourth Stage mixer"); + richGasMixer.addStream(thirdStageCompressor.getOutStream()); + richGasMixer.addStream(firstStageSeparator.getGasOutStream()); + + Cooler dewPointControlCooler = new Cooler(richGasMixer.getOutStream()); + dewPointControlCooler.setName("dew point cooler"); + dewPointControlCooler.setOutTemperature(35.0, "C"); + + Mixer lpLiqmixer = new Mixer("LP liq mixer"); + lpLiqmixer.addStream(firstStageScrubber.getLiquidOutStream()); + lpLiqmixer.addStream(secondStageScrubber.getLiquidOutStream()); + lpLiqmixer.addStream(thirdStageScrubber.getLiquidOutStream()); + + Pump pumpLiquid = new Pump(lpLiqmixer.getOutStream()); + pumpLiquid.setName("pump1"); + pumpLiquid.setOutletPressure(secondStagePressure); + + Recycle recycle1 = new Recycle("recyle"); + recycle1.addStream(pumpLiquid.getOutStream()); + recycle1.setOutletStream(oilThirdStageToSep); + recycle1.setFlowAccuracy(1e-3); + + neqsim.processSimulation.processSystem.ProcessSystem operations = + new neqsim.processSimulation.processSystem.ProcessSystem(); + operations.add(wellFluid); + operations.add(feedTPsetter); + operations.add(feedToOffshoreProcess); + operations.add(firstStageSeparator); + operations.add(oilThrotValve); + operations.add(oilHeatEx); + operations.add(secondStageSeparator); + operations.add(oilThrotValve2); + operations.add(oilThirdStageToSep); + operations.add(thirdStageSeparator); + operations.add(oilThrotValve3); + operations.add(stabilizer); + operations.add(stableOil); + operations.add(firstStageCooler); + + operations.add(firstStageScrubber); + operations.add(firstStageCompressor); + operations.add(secondStageGasMixer); + operations.add(secondStageCooler); + operations.add(secondStageScrubber); + operations.add(secondStageCompressor); + + operations.add(thirdStageMixer); + operations.add(thirdStageCooler); + operations.add(thirdStageScrubber); + operations.add(thirdStageCompressor); + operations.add(richGasMixer); + operations.add(dewPointControlCooler); + + operations.add(lpLiqmixer); + operations.add(pumpLiquid); + operations.add(recycle1); + Thread thread = operations.runAsThread(); + thread.join(1 * 60 * 1000); + secondStageSeparator.addStream(oilThirdStageToSep); + thread = operations.runAsThread(); + thread.join(1 * 60 * 1000); + double massbalance = (feedToOffshoreProcess.getFluid().getFlowRate("kg/hr") + - dewPointControlCooler.getOutStream().getFlowRate("kg/hr") + - stableOil.getFlowRate("kg/hr")) / (feedToOffshoreProcess.getFluid().getFlowRate("kg/hr")); + + assertEquals(0.0, massbalance * 100, 1.0); + } }