From e4e6761578f1a91a301e7e31842ee81b7bd7e485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Thu, 26 Sep 2024 10:02:54 +0200 Subject: [PATCH 1/4] chore: update checkstyle --- .devcontainer/devcontainer.json | 2 +- .vscode/settings.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index af7f782aa4..74f679ded3 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -38,7 +38,7 @@ }, "java.format.settings.url": "https://raw.githubusercontent.com/google/styleguide/gh-pages/eclipse-java-google-style.xml", "java.saveActions.organizeImports": true, - "java.checkstyle.version": "10.15.0", + "java.checkstyle.version": "10.18.1", "java.checkstyle.configuration": "${workspaceFolder}/checkstyle_neqsim.xml", "[xml]": { "editor.tabSize": 4, diff --git a/.vscode/settings.json b/.vscode/settings.json index 5f1e5434c3..73a30604ea 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,7 +9,7 @@ }, "java.format.settings.url": "https://raw.githubusercontent.com/google/styleguide/gh-pages/eclipse-java-google-style.xml", "java.saveActions.organizeImports": true, - "java.checkstyle.version": "10.15.0", + "java.checkstyle.version": "10.18.1", "java.checkstyle.configuration": "${workspaceFolder}/checkstyle_neqsim.xml", "java.debug.settings.hotCodeReplace": "never", "[xml]": { From d08dde15ea7340d1ed3c89e3f35fed501c5b570f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Thu, 26 Sep 2024 10:03:04 +0200 Subject: [PATCH 2/4] style: formatting --- .../compressor/Compressor.java | 1 - .../sysNewtonRhapsonPhaseEnvelope.java | 18 ++++++++---------- .../processSystem/ReferenceProcessTest.java | 2 -- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/main/java/neqsim/processSimulation/processEquipment/compressor/Compressor.java b/src/main/java/neqsim/processSimulation/processEquipment/compressor/Compressor.java index a90c17c481..8c21ffd8a3 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/compressor/Compressor.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/compressor/Compressor.java @@ -1425,5 +1425,4 @@ public void setIsSetMaxOutletPressure(boolean isSetMaxOutletPressure) { public double getActualCompressionRatio() { return actualCompressionRatio; } - } diff --git a/src/main/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/sysNewtonRhapsonPhaseEnvelope.java b/src/main/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/sysNewtonRhapsonPhaseEnvelope.java index 414ce03217..6ae23169a3 100644 --- a/src/main/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/sysNewtonRhapsonPhaseEnvelope.java +++ b/src/main/java/neqsim/thermodynamicOperations/phaseEnvelopeOps/multicomponentEnvelopeOps/sysNewtonRhapsonPhaseEnvelope.java @@ -74,17 +74,15 @@ public class sysNewtonRhapsonPhaseEnvelope implements java.io.Serializable { * Constructor for sysNewtonRhapsonPhaseEnvelope. *

*/ - public sysNewtonRhapsonPhaseEnvelope() { - } + public sysNewtonRhapsonPhaseEnvelope() {} /** *

* Constructor for sysNewtonRhapsonPhaseEnvelope. *

* - * @param system a {@link neqsim.thermo.system.SystemInterface} - * object - * @param numberOfPhases a int + * @param system a {@link neqsim.thermo.system.SystemInterface} object + * @param numberOfPhases a int * @param numberOfComponents a int */ public sysNewtonRhapsonPhaseEnvelope(SystemInterface system, int numberOfPhases, @@ -182,7 +180,8 @@ public void findSpecEq() { int speceq2 = 0; for (int i = 0; i < numberOfComponents + 2; i++) { - double testVal = Math.abs((Math.exp(u.get(i, 0)) - Math.exp(uold.get(i, 0))) / Math.exp(uold.get(i, 0))); + double testVal = + Math.abs((Math.exp(u.get(i, 0)) - Math.exp(uold.get(i, 0))) / Math.exp(uold.get(i, 0))); // the most sensitive variable is calculated not by the difference, // but from the sensibility vector in the original Michelsen code @@ -266,8 +265,9 @@ public void setJac2() { + system.getPhase(1).getComponents()[i].getK() * dxidlnk[i]; } for (int i = 0; i < numberOfComponents; i++) { - double dlnxdlnK = -1.0 / (1.0 + system.getBeta() * system.getPhase(0).getComponents()[i].getK() - - system.getBeta()) * system.getBeta() * system.getPhase(0).getComponents()[i].getK(); + double dlnxdlnK = + -1.0 / (1.0 + system.getBeta() * system.getPhase(0).getComponents()[i].getK() + - system.getBeta()) * system.getBeta() * system.getPhase(0).getComponents()[i].getK(); double dlnydlnK = 1.0 - 1.0 / (system.getPhase(0).getComponents()[i].getK() * system.getBeta() + 1 - system.getBeta()) * system.getBeta() * system.getPhase(0).getComponents()[i].getK(); @@ -645,7 +645,5 @@ public void solve(int np) { init(); uold = u.copy(); - } - } diff --git a/src/test/java/neqsim/processSimulation/processSystem/ReferenceProcessTest.java b/src/test/java/neqsim/processSimulation/processSystem/ReferenceProcessTest.java index 41fa3104fa..8660fc057b 100644 --- a/src/test/java/neqsim/processSimulation/processSystem/ReferenceProcessTest.java +++ b/src/test/java/neqsim/processSimulation/processSystem/ReferenceProcessTest.java @@ -113,7 +113,5 @@ public void testProcess() { assertEquals(15.0, gasMixer.getOutStream().getTemperature("C"), 0.01); assertEquals(2278.2594247, exportgas.getFlowRate("Sm3/hr") / exportoil.getFlowRate("idSm3/hr"), 0.01); - } - } From 3c73abf7ae876674785291ba7aebd33e2a02c18a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Thu, 26 Sep 2024 10:08:43 +0200 Subject: [PATCH 3/4] refact: use constructor with name input --- .../processSystem/MLA_bug_test.java | 17 +- .../processSystem/waterDegasserTest.java | 7 +- .../util/example/MEGinjection.java | 241 +++++++++--------- .../util/example/OffshoreProcess3.java | 9 +- .../util/example/OnshoreProcess1.java | 62 ++--- .../util/example/TestSlugcatcher.java | 10 +- .../util/example/threePhaseSeparation.java | 158 ++++++------ 7 files changed, 243 insertions(+), 261 deletions(-) diff --git a/src/test/java/neqsim/processSimulation/processSystem/MLA_bug_test.java b/src/test/java/neqsim/processSimulation/processSystem/MLA_bug_test.java index cc38f05532..09b8b77352 100644 --- a/src/test/java/neqsim/processSimulation/processSystem/MLA_bug_test.java +++ b/src/test/java/neqsim/processSimulation/processSystem/MLA_bug_test.java @@ -96,10 +96,9 @@ public void runProcessTEG() throws InterruptedException { p.add(feedToAbsorber); WaterDewPointAnalyser waterDewPointAnalyserToAbsorber = - new WaterDewPointAnalyser(feedToAbsorber); + new WaterDewPointAnalyser("water dew point gas to absorber", feedToAbsorber); waterDewPointAnalyserToAbsorber.setMethod("multiphase"); waterDewPointAnalyserToAbsorber.setReferencePressure(85.0); - waterDewPointAnalyserToAbsorber.setName("water dew point gas to absorber"); p.add(waterDewPointAnalyserToAbsorber); StreamInterface TEGFeed = new Stream("TEG feed", feedTEG); @@ -144,9 +143,9 @@ public void runProcessTEG() throws InterruptedException { new Stream("pipelineSetTP stream", pipelineSetTP.getOutStream()); p.add(pipelineSetTPStream); - WaterDewPointAnalyser waterDewPointAnalyser3 = new WaterDewPointAnalyser(dehydratedGasSetWater); + WaterDewPointAnalyser waterDewPointAnalyser3 = + new WaterDewPointAnalyser("water dew point analyser3", dehydratedGasSetWater); waterDewPointAnalyser3.setReferencePressure(70.0); - waterDewPointAnalyser3.setName("water dew point analyser3"); p.add(waterDewPointAnalyser3); StreamInterface dehydratedGas = new Stream("dry gas from absorber", absorber.getGasOutStream()); @@ -155,13 +154,12 @@ public void runProcessTEG() throws InterruptedException { StreamInterface richTEG = new Stream("rich TEG from absorber", absorber.getLiquidOutStream()); p.add(richTEG); - WaterDewPointAnalyser waterDewPointAnalyser2 = new WaterDewPointAnalyser(dehydratedGas); + WaterDewPointAnalyser waterDewPointAnalyser2 = + new WaterDewPointAnalyser("water dew point analyser", dehydratedGas); waterDewPointAnalyser2.setReferencePressure(70.0); - waterDewPointAnalyser2.setName("water dew point analyser"); p.add(waterDewPointAnalyser2); - ThrottlingValve glycol_flash_valve = new ThrottlingValve(richTEG); - glycol_flash_valve.setName("Rich TEG HP flash valve"); + ThrottlingValve glycol_flash_valve = new ThrottlingValve("Rich TEG HP flash valve", richTEG); glycol_flash_valve.setOutletPressure(4.8); p.add(glycol_flash_valve); @@ -210,8 +208,7 @@ public void runProcessTEG() throws InterruptedException { strippingGas.setPressure(1.2, "bara"); p.add(strippingGas); - StreamInterface gasToReboiler = strippingGas.clone(); - gasToReboiler.setName("gas to reboiler"); + StreamInterface gasToReboiler = strippingGas.clone("gas to reboiler"); p.add(gasToReboiler); DistillationColumn column = new DistillationColumn("TEG regeneration column", 1, true, true); diff --git a/src/test/java/neqsim/processSimulation/processSystem/waterDegasserTest.java b/src/test/java/neqsim/processSimulation/processSystem/waterDegasserTest.java index 4cef57cca4..8aaaec7062 100644 --- a/src/test/java/neqsim/processSimulation/processSystem/waterDegasserTest.java +++ b/src/test/java/neqsim/processSimulation/processSystem/waterDegasserTest.java @@ -224,8 +224,8 @@ public void runProcess2() throws InterruptedException { * inlet_stream_test_sep.setFlowRate(472.5621656362427, "kg/hr"); inlet_stream_test_sep.run(); * * neqsim.processSimulation.processEquipment.separator.ThreePhaseSeparator test_separator = new - * neqsim.processSimulation.processEquipment.separator.ThreePhaseSeparator( - * inlet_stream_test_sep); test_separator.setName("TEST_SEPARATOR"); test_separator.run(); + * neqsim.processSimulation.processEquipment.separator.ThreePhaseSeparator("TEST_SEPARATOR", + * inlet_stream_test_sep); test_separator.run(); * * neqsim.processSimulation.processEquipment.heatExchanger.Heater heater_TP_setter_test_stream = * new neqsim.processSimulation.processEquipment.heatExchanger.Heater( @@ -235,8 +235,7 @@ public void runProcess2() throws InterruptedException { * heater_TP_setter_test_stream.run(); * * neqsim.processSimulation.processEquipment.mixer.StaticMixer mixing_degasser = new - * neqsim.processSimulation.processEquipment.mixer.StaticMixer(); - * mixing_degasser.setName("MIXING_BEFORE_THE_DEGASSER"); + * neqsim.processSimulation.processEquipment.mixer.StaticMixer(MIXING_BEFORE_THE_DEGASSER); * mixing_degasser.addStream(heater_TP_setter_main_stream.getOutStream()); * mixing_degasser.addStream(heater_TP_setter_test_stream.getOutStream()); * mixing_degasser.run(); diff --git a/src/test/java/neqsim/processSimulation/util/example/MEGinjection.java b/src/test/java/neqsim/processSimulation/util/example/MEGinjection.java index c5a9bc5020..1ed26d758e 100644 --- a/src/test/java/neqsim/processSimulation/util/example/MEGinjection.java +++ b/src/test/java/neqsim/processSimulation/util/example/MEGinjection.java @@ -18,125 +18,124 @@ * @since 2.2.3 */ public class MEGinjection { - /** - *

- * main. - *

- * - * @param args an array of {@link java.lang.String} objects - */ - public static void main(String[] args) { - // Create the input fluid to the TEG process and saturate it with water at - // scrubber conditions - neqsim.thermo.system.SystemInterface feedGas = - new neqsim.thermo.system.SystemSrkCPAstatoil(273.15 + 42.0, 10.00); - feedGas.addComponent("nitrogen", 1.03); - feedGas.addComponent("CO2", 1.42); - feedGas.addComponent("methane", 83.88); - feedGas.addComponent("ethane", 8.07); - feedGas.addComponent("propane", 3.54); - feedGas.addComponent("i-butane", 0.54); - feedGas.addComponent("n-butane", 0.84); - feedGas.addComponent("i-pentane", 0.21); - feedGas.addComponent("n-pentane", 0.19); - feedGas.addComponent("n-hexane", 0.28); - feedGas.addComponent("n-heptane", 1.28); - feedGas.addComponent("n-octane", 1.28); - feedGas.addComponent("n-nonane", 2.28); - feedGas.addComponent("water", 2.0); - feedGas.addComponent("MEG", 0.0); - feedGas.createDatabase(true); - feedGas.setMixingRule(10); - feedGas.setMultiPhaseCheck(true); - - Stream feedGasStream = new Stream("feed fluid", feedGas); - feedGasStream.run(); - feedGasStream.setFlowRate(11.23, "MSm3/day"); - feedGasStream.setTemperature(50.0, "C"); - feedGasStream.setPressure(55.00, "bara"); - - neqsim.thermo.system.SystemInterface feedMEG = feedGas.clone(); - feedMEG.setMolarComposition(new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0, 0.0, 0.0, 0.1, 0.9}); - - Stream MEGFeed = new Stream("lean MEG feed stream", feedMEG); - MEGFeed.setFlowRate(1000.0, "kg/hr"); - MEGFeed.setTemperature(50.0, "C"); - MEGFeed.setPressure(55.0, "bara"); - - StaticMixer feedGasMEGmixer = new StaticMixer("MEG-gas mixer"); - feedGasMEGmixer.addStream(feedGasStream); - feedGasMEGmixer.addStream(MEGFeed); - - Heater pipeline = new Heater("gas-MEG pipeline", feedGasMEGmixer.getOutletStream()); - pipeline.setOutTemperature(273.15 + 35.5); - pipeline.setOutPressure(80.2); - - Stream mixerStream = (Stream) pipeline.getOutletStream(); - mixerStream.setName("feed gas and MEG"); - - Adjuster adjuster = new Adjuster("MEG adjuster"); - adjuster.setAdjustedVariable(MEGFeed, "mass flow"); - adjuster.setTargetVariable(mixerStream, "mass fraction", 0.6, "-", "aqueous", "MEG"); - - neqsim.processSimulation.processSystem.ProcessSystem MEGwelloperations = - new neqsim.processSimulation.processSystem.ProcessSystem(); - MEGwelloperations.add(feedGasStream); - MEGwelloperations.add(MEGFeed); - MEGwelloperations.add(feedGasMEGmixer); - MEGwelloperations.add(pipeline); - MEGwelloperations.add(mixerStream); - MEGwelloperations.add(adjuster); - - MEGwelloperations.run(); - // operations.run(); - - MEGwelloperations.save("c:/temp/MEGinjection.neqsim"); - - Stream feedStream = new Stream("feed to onhore", - (Stream) MEGwelloperations.getUnit("feed gas and MEG")); - - ThrottlingValve onshoreChockeValve = new ThrottlingValve("onshore choke valve", feedStream); - onshoreChockeValve.setOutletPressure(70.3); - - ThreePhaseSeparator slugCatcher = - new ThreePhaseSeparator("slug catcher", onshoreChockeValve.getOutletStream()); - - neqsim.thermo.system.SystemInterface feedMEGOnshore = feedGas.clone(); - feedMEG.setMolarComposition(new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0, 0.0, 0.0, 0.1, 0.9}); - - Stream MEGFeedOnshore = new Stream("lean MEG feed stream", feedMEGOnshore); - MEGFeedOnshore.setFlowRate(1000.0, "kg/hr"); - MEGFeedOnshore.setTemperature(35.0, "C"); - MEGFeedOnshore.setPressure(80.0, "bara"); - - neqsim.processSimulation.processEquipment.splitter.Splitter MEGsplitter = - new Splitter("MEG splitter", MEGFeedOnshore); - MEGsplitter.setSplitFactors(new double[] {0.1, 0.1, 0.8}); - - StaticMixer MEGmixer1 = new StaticMixer("MEG mixer 1"); - MEGmixer1.addStream(slugCatcher.getGasOutStream()); - MEGmixer1.addStream(MEGsplitter.getSplitStream(0)); - - ThrottlingValve DPvalve1 = new ThrottlingValve("DP valve 1", MEGmixer1.getOutletStream()); - DPvalve1.setOutletPressure(70.0); - - neqsim.processSimulation.processSystem.ProcessSystem onshoreOperations = - new neqsim.processSimulation.processSystem.ProcessSystem(); - onshoreOperations.add(feedStream); - onshoreOperations.add(onshoreChockeValve); - onshoreOperations.add(slugCatcher); - onshoreOperations.add(MEGFeedOnshore); - onshoreOperations.add(MEGsplitter); - onshoreOperations.add(MEGmixer1); - onshoreOperations.add(DPvalve1); - - onshoreOperations.run(); - - onshoreOperations.save("c:/temp/MEGonshore.neqsim"); - - // feedGasMEGmixer.getThermoSystem().display(); - DPvalve1.getThermoSystem().display(); - } + /** + *

+ * main. + *

+ * + * @param args an array of {@link java.lang.String} objects + */ + public static void main(String[] args) { + // Create the input fluid to the TEG process and saturate it with water at + // scrubber conditions + neqsim.thermo.system.SystemInterface feedGas = + new neqsim.thermo.system.SystemSrkCPAstatoil(273.15 + 42.0, 10.00); + feedGas.addComponent("nitrogen", 1.03); + feedGas.addComponent("CO2", 1.42); + feedGas.addComponent("methane", 83.88); + feedGas.addComponent("ethane", 8.07); + feedGas.addComponent("propane", 3.54); + feedGas.addComponent("i-butane", 0.54); + feedGas.addComponent("n-butane", 0.84); + feedGas.addComponent("i-pentane", 0.21); + feedGas.addComponent("n-pentane", 0.19); + feedGas.addComponent("n-hexane", 0.28); + feedGas.addComponent("n-heptane", 1.28); + feedGas.addComponent("n-octane", 1.28); + feedGas.addComponent("n-nonane", 2.28); + feedGas.addComponent("water", 2.0); + feedGas.addComponent("MEG", 0.0); + feedGas.createDatabase(true); + feedGas.setMixingRule(10); + feedGas.setMultiPhaseCheck(true); + + Stream feedGasStream = new Stream("feed fluid", feedGas); + feedGasStream.run(); + feedGasStream.setFlowRate(11.23, "MSm3/day"); + feedGasStream.setTemperature(50.0, "C"); + feedGasStream.setPressure(55.00, "bara"); + + neqsim.thermo.system.SystemInterface feedMEG = feedGas.clone(); + feedMEG.setMolarComposition( + new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.9}); + + Stream MEGFeed = new Stream("lean MEG feed stream", feedMEG); + MEGFeed.setFlowRate(1000.0, "kg/hr"); + MEGFeed.setTemperature(50.0, "C"); + MEGFeed.setPressure(55.0, "bara"); + + StaticMixer feedGasMEGmixer = new StaticMixer("MEG-gas mixer"); + feedGasMEGmixer.addStream(feedGasStream); + feedGasMEGmixer.addStream(MEGFeed); + + Heater pipeline = new Heater("gas-MEG pipeline", feedGasMEGmixer.getOutletStream()); + pipeline.setOutTemperature(273.15 + 35.5); + pipeline.setOutPressure(80.2); + + Stream mixerStream = new Stream("feed gas and MEG", pipeline.getOutletStream()); + + Adjuster adjuster = new Adjuster("MEG adjuster"); + adjuster.setAdjustedVariable(MEGFeed, "mass flow"); + adjuster.setTargetVariable(mixerStream, "mass fraction", 0.6, "-", "aqueous", "MEG"); + + neqsim.processSimulation.processSystem.ProcessSystem MEGwelloperations = + new neqsim.processSimulation.processSystem.ProcessSystem(); + MEGwelloperations.add(feedGasStream); + MEGwelloperations.add(MEGFeed); + MEGwelloperations.add(feedGasMEGmixer); + MEGwelloperations.add(pipeline); + MEGwelloperations.add(mixerStream); + MEGwelloperations.add(adjuster); + + MEGwelloperations.run(); + // operations.run(); + + MEGwelloperations.save("c:/temp/MEGinjection.neqsim"); + + Stream feedStream = + new Stream("feed to onhore", (Stream) MEGwelloperations.getUnit("feed gas and MEG")); + + ThrottlingValve onshoreChockeValve = new ThrottlingValve("onshore choke valve", feedStream); + onshoreChockeValve.setOutletPressure(70.3); + + ThreePhaseSeparator slugCatcher = + new ThreePhaseSeparator("slug catcher", onshoreChockeValve.getOutletStream()); + + neqsim.thermo.system.SystemInterface feedMEGOnshore = feedGas.clone(); + feedMEG.setMolarComposition( + new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.9}); + + Stream MEGFeedOnshore = new Stream("lean MEG feed stream", feedMEGOnshore); + MEGFeedOnshore.setFlowRate(1000.0, "kg/hr"); + MEGFeedOnshore.setTemperature(35.0, "C"); + MEGFeedOnshore.setPressure(80.0, "bara"); + + neqsim.processSimulation.processEquipment.splitter.Splitter MEGsplitter = + new Splitter("MEG splitter", MEGFeedOnshore); + MEGsplitter.setSplitFactors(new double[] {0.1, 0.1, 0.8}); + + StaticMixer MEGmixer1 = new StaticMixer("MEG mixer 1"); + MEGmixer1.addStream(slugCatcher.getGasOutStream()); + MEGmixer1.addStream(MEGsplitter.getSplitStream(0)); + + ThrottlingValve DPvalve1 = new ThrottlingValve("DP valve 1", MEGmixer1.getOutletStream()); + DPvalve1.setOutletPressure(70.0); + + neqsim.processSimulation.processSystem.ProcessSystem onshoreOperations = + new neqsim.processSimulation.processSystem.ProcessSystem(); + onshoreOperations.add(feedStream); + onshoreOperations.add(onshoreChockeValve); + onshoreOperations.add(slugCatcher); + onshoreOperations.add(MEGFeedOnshore); + onshoreOperations.add(MEGsplitter); + onshoreOperations.add(MEGmixer1); + onshoreOperations.add(DPvalve1); + + onshoreOperations.run(); + + onshoreOperations.save("c:/temp/MEGonshore.neqsim"); + + // feedGasMEGmixer.getThermoSystem().display(); + DPvalve1.getThermoSystem().display(); + } } diff --git a/src/test/java/neqsim/processSimulation/util/example/OffshoreProcess3.java b/src/test/java/neqsim/processSimulation/util/example/OffshoreProcess3.java index 58fd9b2c76..e4b46fe6a8 100644 --- a/src/test/java/neqsim/processSimulation/util/example/OffshoreProcess3.java +++ b/src/test/java/neqsim/processSimulation/util/example/OffshoreProcess3.java @@ -106,8 +106,7 @@ public static void main(String[] args) { ThreePhaseSeparator lpseparator = new ThreePhaseSeparator("3rd stage separator", valvempValve.getOutletStream()); - Stream stableOilStream = (Stream) lpseparator.getOilOutStream(); - stableOilStream.setName("stable oil"); + Stream stableOilStream = new Stream("stable oil", lpseparator.getOilOutStream()); Compressor lpcompressor = new Compressor("1st stage recompressor", lpseparator.getGasOutStream()); @@ -129,9 +128,9 @@ public static void main(String[] args) { * coolingWater.setFlowRate(500900.2, "kg/hr"); coolingWater.setTemperature(10.0, "C"); * coolingWater.setPressure(10.0, "bara"); * - * HeatExchanger heatEx = new HeatExchanger(lpcompressor.getOutStream()); - * heatEx.setName("LP heat Exchanger"); heatEx.setGuessOutTemperature(273.15+40.0); - * heatEx.setUAvalue(45000.0); heatEx.setFeedStream(1, coolingWater); + * HeatExchanger heatEx = new HeatExchanger("LP heat Exchanger",lpcompressor.getOutStream()); + * heatEx.setGuessOutTemperature(273.15+40.0); heatEx.setUAvalue(45000.0); + * heatEx.setFeedStream(1, coolingWater); */ Cooler lpHeatExchanger = diff --git a/src/test/java/neqsim/processSimulation/util/example/OnshoreProcess1.java b/src/test/java/neqsim/processSimulation/util/example/OnshoreProcess1.java index 08af4bb433..d3a50ceee8 100644 --- a/src/test/java/neqsim/processSimulation/util/example/OnshoreProcess1.java +++ b/src/test/java/neqsim/processSimulation/util/example/OnshoreProcess1.java @@ -300,10 +300,10 @@ public static void main(String[] args) { MeasurementDeviceInterface reservoirTemperaturTransmitter = new TemperatureTransmitter(stream_1); MeasurementDeviceInterface reservoirPressureTransmitter = new PressureTransmitter(stream_1); - WaterContentAnalyser waterAnalyser = new WaterContentAnalyser(separator.getGasOutStream()); - waterAnalyser.setName("Snohvit Total Water Analyser"); - MolarMassAnalyser molarMassAnalyser = new MolarMassAnalyser(separator.getGasOutStream()); - molarMassAnalyser.setName("Snohvit molar mass analyser"); + WaterContentAnalyser waterAnalyser = + new WaterContentAnalyser("Snohvit Total Water Analyser", separator.getGasOutStream()); + MolarMassAnalyser molarMassAnalyser = + new MolarMassAnalyser("Snohvit molar mass analyser", separator.getGasOutStream()); StreamInterface stream_2 = separator.getGasOutStream(); stream_2.setName("Gas From Snohvit Reservoir"); @@ -322,10 +322,10 @@ public static void main(String[] args) { // Albatross reservoir stream Stream stream_3 = new Stream("Stream2", testSystem2); Separator separator2 = new Separator("Separator 2", stream_3); - WaterContentAnalyser waterAnalyser2 = new WaterContentAnalyser(separator2.getGasOutStream()); - waterAnalyser2.setName("Albatross Total Water Analyser"); - MolarMassAnalyser molarMassAnalyser2 = new MolarMassAnalyser(separator2.getGasOutStream()); - molarMassAnalyser2.setName("Albatross molar mass analyser"); + WaterContentAnalyser waterAnalyser2 = + new WaterContentAnalyser("Albatross Total Water Analyser", separator2.getGasOutStream()); + MolarMassAnalyser molarMassAnalyser2 = + new MolarMassAnalyser("Albatross molar mass analyser", separator2.getGasOutStream()); StreamInterface stream_4 = separator2.getGasOutStream(); stream_4.setName("Gas From Albatross Reservoir"); @@ -338,8 +338,8 @@ public static void main(String[] args) { mixer1.addStream(valve1.getOutletStream()); mixer1.addStream(valve2.getOutletStream()); - WaterContentAnalyser waterAnalyser3 = new WaterContentAnalyser(mixer1.getOutletStream()); - waterAnalyser3.setName("Total Water Analyser"); + WaterContentAnalyser waterAnalyser3 = + new WaterContentAnalyser("Total Water Analyser", mixer1.getOutletStream()); // Pipeline SimpleTPoutPipeline pipeLine1 = @@ -358,43 +358,38 @@ public static void main(String[] args) { ThreePhaseSeparator slugCatcher = new ThreePhaseSeparator("slugCatcher", pipeLine1.getOutletStream()); - VolumeFlowTransmitter volumeTransmitter2 = - new VolumeFlowTransmitter(slugCatcher.getOilOutStream()); + VolumeFlowTransmitter volumeTransmitter2 = new VolumeFlowTransmitter( + "Condensate Volume Flow From Slug Catcher", slugCatcher.getOilOutStream()); volumeTransmitter2.setMeasuredPhaseNumber(0); - volumeTransmitter2.setName("Condensate Volume Flow From Slug Catcher"); - VolumeFlowTransmitter volumeTransmitter1 = - new VolumeFlowTransmitter(slugCatcher.getWaterOutStream()); + VolumeFlowTransmitter volumeTransmitter1 = new VolumeFlowTransmitter( + "MEG Volume FLow From Slug Catcher", slugCatcher.getWaterOutStream()); volumeTransmitter1.setMeasuredPhaseNumber(0); - volumeTransmitter1.setName("MEG Volume FLow From Slug Catcher"); - VolumeFlowTransmitter volumeTransmitter3 = - new VolumeFlowTransmitter(slugCatcher.getGasOutStream()); + VolumeFlowTransmitter volumeTransmitter3 = new VolumeFlowTransmitter( + "Gas Volume FLow From Slug Catcher", slugCatcher.getGasOutStream()); volumeTransmitter3.setMeasuredPhaseNumber(0); - volumeTransmitter3.setName("Gas Volume FLow From Slug Catcher"); - // Stream stream_5 = new Stream(slugCatcher.getWaterOutStream()); - // stream_5.setName("MEG stream from slugcatcher"); + // Stream stream_5 = new Stream("MEG stream from + // slugcatcher",slugCatcher.getWaterOutStream()); Heater condensateheater1 = new Heater("Condensate heater1", slugCatcher.getOilOutStream()); condensateheater1.setdT(23.4); - // Heater gasHeater = new Heater(slugCatcher.getGasOutStream()); - // gasHeater.setName("Gas heater after slugcatcher"); + // Heater gasHeater = new Heater("Gas heater after slugcatcher", + // slugCatcher.getGasOutStream()); // gasHeater.setdT(30.0); ThreePhaseSeparator condensateSeparator = new ThreePhaseSeparator("condensateSeparator", condensateheater1.getOutletStream()); - // Heater MEGheater1 = new Heater(stream_5); - // MEGheater1.setName("MEG heater1"); + // Heater MEGheater1 = new Heater("MEG heater1",stream_5); // MEGheater1.setdT(23.4); // SnohvitCO2RemovalModule co2Module = new SnohvitCO2RemovalModule(); // co2Module.addInputStream("streamToAbsorber", gasHeater.getOutStream()); - // Heater MEGheater2 = new Heater(MEGheater1.getOutStream()); - // MEGheater2.setName("MEG heater2"); + // Heater MEGheater2 = new Heater("MEG heater2", MEGheater1.getOutStream()); // MEGheater2.setdT(20.0); // ThrottlingValve valve3 = new ThrottlingValve("MEG flash valve 1", @@ -405,11 +400,9 @@ public static void main(String[] args) { // separator", valve3.getOutStream()); // VolumeFlowTransmitter volumeTransmitter5= new - // VolumeFlowTransmitter(separator3.getGasOutStream()); - // volumeTransmitter5.setName("MEG Valve 1 Gas Volume FLow"); + // VolumeFlowTransmitter("MEG Valve 1 Gas Volume FLow",separator3.getGasOutStream()); - // Heater MEGheater3 = new Heater(separator3.getWaterOutStream()); - // MEGheater3.setName("MEG heater3"); + // Heater MEGheater3 = new Heater("MEG heater3", separator3.getWaterOutStream()); // MEGheater3.setdT(-35.0); // ThrottlingValve valve4 = new ThrottlingValve("MEG flash valve 2", @@ -431,13 +424,10 @@ public static void main(String[] args) { // GasHeater.setdT(-35.0); // CO2-removal - // Stream streamToCO2removal = new Stream(slugCatcher.getGasOutStream()); - // streamToCO2removal.setName("Gas to CO2 removal"); + // Stream streamToCO2removal = new Stream("Gas to CO2 removal",slugCatcher.getGasOutStream()); // VolumeFlowTransmitter volumeTransmitter_StreamToCO2removal = new - // VolumeFlowTransmitter(streamToCO2removal); + // VolumeFlowTransmitter("Stream to CO2 removal Volume FLow",streamToCO2removal); // volumeTransmitter_StreamToCO2removal.setUnit("Nm^3/day"); - // volumeTransmitter_StreamToCO2removal.setName("Stream to CO2 removal - // Volume FLow"); neqsim.processSimulation.processSystem.ProcessSystem operations = new neqsim.processSimulation.processSystem.ProcessSystem(); diff --git a/src/test/java/neqsim/processSimulation/util/example/TestSlugcatcher.java b/src/test/java/neqsim/processSimulation/util/example/TestSlugcatcher.java index da9fc4eddc..b714133beb 100644 --- a/src/test/java/neqsim/processSimulation/util/example/TestSlugcatcher.java +++ b/src/test/java/neqsim/processSimulation/util/example/TestSlugcatcher.java @@ -54,15 +54,13 @@ public static void main(String args[]) { new ThreePhaseSeparator("Separator 1", valve1.getOutletStream()); Stream stream_2 = new Stream("stream_2", separator2.getGasOutStream()); - VolumeFlowTransmitter volumeTransmitter3 = - new VolumeFlowTransmitter(separator2.getGasOutStream()); + VolumeFlowTransmitter volumeTransmitter3 = new VolumeFlowTransmitter( + "Gas Volume FLow From Slug Catcher", separator2.getGasOutStream()); volumeTransmitter3.setMeasuredPhaseNumber(0); - volumeTransmitter3.setName("Gas Volume FLow From Slug Catcher"); - VolumeFlowTransmitter volumeTransmitter4 = - new VolumeFlowTransmitter(separator2.getWaterOutStream()); + VolumeFlowTransmitter volumeTransmitter4 = new VolumeFlowTransmitter( + "Water Volume FLow From Slug Catcher", separator2.getWaterOutStream()); volumeTransmitter4.setMeasuredPhaseNumber(0); - volumeTransmitter4.setName("Water Volume FLow From Slug Catcher"); neqsim.processSimulation.processSystem.ProcessSystem operations = new neqsim.processSimulation.processSystem.ProcessSystem(); diff --git a/src/test/java/neqsim/processSimulation/util/example/threePhaseSeparation.java b/src/test/java/neqsim/processSimulation/util/example/threePhaseSeparation.java index b17acb4281..426e1d77db 100644 --- a/src/test/java/neqsim/processSimulation/util/example/threePhaseSeparation.java +++ b/src/test/java/neqsim/processSimulation/util/example/threePhaseSeparation.java @@ -6,98 +6,98 @@ import neqsim.processSimulation.processEquipment.valve.ThrottlingValve; /** - *

threePhaseSeparation class.

+ *

+ * threePhaseSeparation class. + *

* * @author asmund * @version $Id: $Id * @since 2.2.3 */ public class threePhaseSeparation { - /** - * This method is just meant to test the thermo package. - * - * @param args an array of {@link java.lang.String} objects - */ - public static void main(String args[]) { - neqsim.thermo.system.SystemInterface system1 = - new neqsim.thermo.system.SystemSrkCPAs((273.15 + 15.0), 80.00); - system1.addComponent("CO2", 0.309); - system1.addComponent("nitrogen", 1.854); - system1.addComponent("methane", 94.90446); - system1.addComponent("ethane", 1.623); - system1.addComponent("propane", 0.535); - system1.addComponent("i-butane", 0.111293); - system1.addComponent("n-butane", 0.1547122); - system1.addComponent("iC5", 0.05894036); - system1.addComponent("n-pentane", 0.04441738); - system1.addComponent("benzene", 0.001207753); - system1.addComponent("toluene", 0.002350627); - system1.addComponent("m-Xylene", 0.00359331); - system1.addTBPfraction("C6", 0.04242109, 85.11 / 1000.0, 0.724); - system1.addTBPfraction("C7", 0.05719361, 98.4 / 1000.0, 0.751); - system1.addTBPfraction("C8", 0.03807916, 111.74 / 1000.0, 0.779); - system1.addTBPfraction("C9", 0.0203721, 125.19 / 1000.0, 0.793); - system1.addTBPfraction("C10", 0.01497714, 137.83 / 1000.0, 0.798); - system1.addTBPfraction("C11", 0.00929271, 149.0 / 1000.0, 0.803); - system1.addTBPfraction("C12", 0.00619347, 163.0 / 1000.0, 0.809); - system1.addTBPfraction("C13", 0.004102369, 176.0 / 1000.0, 0.815); - system1.addTBPfraction("C14", 0.002625117, 191.0 / 1000.0, 0.824); - system1.addTBPfraction("C15", 0.00168187, 207.0 / 1000.0, 0.829); - system1.addTBPfraction("C16", 0.001092967, 221.0 / 1000.0, 0.843); - system1.addTBPfraction("C17", 0.0006937096, 237.0 / 1000.0, 0.848); - system1.addTBPfraction("C18", 0.0004341923, 249.0 / 1000.0, 0.852); - system1.addTBPfraction("C19", 0.000329387, 261.0 / 1000.0, 0.855); - system1.addTBPfraction("CN1", 0.0008534124, 304.7 / 1000.0, 0.865); - system1.addTBPfraction("CN2", 5.340066E-005, 432.55 / 1000.0, 0.88); - system1.addComponent("TEG", 1.0e-10); - system1.addComponent("MEG", .3); - system1.addComponent("water", 1.0); + /** + * This method is just meant to test the thermo package. + * + * @param args an array of {@link java.lang.String} objects + */ + public static void main(String args[]) { + neqsim.thermo.system.SystemInterface system1 = + new neqsim.thermo.system.SystemSrkCPAs((273.15 + 15.0), 80.00); + system1.addComponent("CO2", 0.309); + system1.addComponent("nitrogen", 1.854); + system1.addComponent("methane", 94.90446); + system1.addComponent("ethane", 1.623); + system1.addComponent("propane", 0.535); + system1.addComponent("i-butane", 0.111293); + system1.addComponent("n-butane", 0.1547122); + system1.addComponent("iC5", 0.05894036); + system1.addComponent("n-pentane", 0.04441738); + system1.addComponent("benzene", 0.001207753); + system1.addComponent("toluene", 0.002350627); + system1.addComponent("m-Xylene", 0.00359331); + system1.addTBPfraction("C6", 0.04242109, 85.11 / 1000.0, 0.724); + system1.addTBPfraction("C7", 0.05719361, 98.4 / 1000.0, 0.751); + system1.addTBPfraction("C8", 0.03807916, 111.74 / 1000.0, 0.779); + system1.addTBPfraction("C9", 0.0203721, 125.19 / 1000.0, 0.793); + system1.addTBPfraction("C10", 0.01497714, 137.83 / 1000.0, 0.798); + system1.addTBPfraction("C11", 0.00929271, 149.0 / 1000.0, 0.803); + system1.addTBPfraction("C12", 0.00619347, 163.0 / 1000.0, 0.809); + system1.addTBPfraction("C13", 0.004102369, 176.0 / 1000.0, 0.815); + system1.addTBPfraction("C14", 0.002625117, 191.0 / 1000.0, 0.824); + system1.addTBPfraction("C15", 0.00168187, 207.0 / 1000.0, 0.829); + system1.addTBPfraction("C16", 0.001092967, 221.0 / 1000.0, 0.843); + system1.addTBPfraction("C17", 0.0006937096, 237.0 / 1000.0, 0.848); + system1.addTBPfraction("C18", 0.0004341923, 249.0 / 1000.0, 0.852); + system1.addTBPfraction("C19", 0.000329387, 261.0 / 1000.0, 0.855); + system1.addTBPfraction("CN1", 0.0008534124, 304.7 / 1000.0, 0.865); + system1.addTBPfraction("CN2", 5.340066E-005, 432.55 / 1000.0, 0.88); + system1.addComponent("TEG", 1.0e-10); + system1.addComponent("MEG", .3); + system1.addComponent("water", 1.0); - system1.createDatabase(true); - system1.setMixingRule(9); - system1.setMultiPhaseCheck(true); - Stream stream_1 = new Stream("Stream1", system1); + system1.createDatabase(true); + system1.setMixingRule(9); + system1.setMultiPhaseCheck(true); + Stream stream_1 = new Stream("Stream1", system1); - ThreePhaseSeparator separator = new ThreePhaseSeparator("Separator", stream_1); + ThreePhaseSeparator separator = new ThreePhaseSeparator("Separator", stream_1); - Stream stream_2 = new Stream("gas from scrubber", separator.getGasOutStream()); - // Stream stream_3 = new Stream(separator.getOilOutStream()); - // stream_3.setName("oil from scrubber"); - // Stream stream_4 = new Stream(separator.getWaterOutStream()); - // stream_4.setName("water from scrubber"); + Stream stream_2 = new Stream("gas from scrubber", separator.getGasOutStream()); + // Stream stream_3 = new Stream("oil from scrubber", separator.getOilOutStream()); + // Stream stream_4 = new Stream("water from scrubber", separator.getWaterOutStream()); - MoleFractionControllerUtil waterRemoval = new MoleFractionControllerUtil(stream_2); - // waterRemoval.setMoleFraction("water", 15.0e-6); - waterRemoval.setComponentRate("TEG", 55.0, "litre/MSm^3"); - // werRemoval.setRelativeMoleFractionReduction("water", -0.99); - // waterRemoval.getOutStream(); + MoleFractionControllerUtil waterRemoval = new MoleFractionControllerUtil(stream_2); + // waterRemoval.setMoleFraction("water", 15.0e-6); + waterRemoval.setComponentRate("TEG", 55.0, "litre/MSm^3"); + // werRemoval.setRelativeMoleFractionReduction("water", -0.99); + // waterRemoval.getOutStream(); - MoleFractionControllerUtil TEGsaturator = - new MoleFractionControllerUtil(waterRemoval.getOutletStream()); - TEGsaturator.setMoleFraction("water", 5.0e-6); - // TEGsaturator.getOutStream(); + MoleFractionControllerUtil TEGsaturator = + new MoleFractionControllerUtil(waterRemoval.getOutletStream()); + TEGsaturator.setMoleFraction("water", 5.0e-6); + // TEGsaturator.getOutStream(); - ThrottlingValve LP_valve = new ThrottlingValve("LPventil", TEGsaturator.getOutletStream()); - LP_valve.setOutletPressure(5.0); + ThrottlingValve LP_valve = new ThrottlingValve("LPventil", TEGsaturator.getOutletStream()); + LP_valve.setOutletPressure(5.0); - // ThreePhaseSeparator separator2 = new ThreePhaseSeparator("Separator LP", - // LP_valve.getOutStream()); + // ThreePhaseSeparator separator2 = new ThreePhaseSeparator("Separator LP", + // LP_valve.getOutStream()); - neqsim.processSimulation.processSystem.ProcessSystem operations = - new neqsim.processSimulation.processSystem.ProcessSystem(); - operations.add(stream_1); - operations.add(separator); - // operations.add(stream_2); - // operations.add(stream_3); - // operations.add(stream_4); - // operations.add(waterRemoval); - // operations.add(TEGsaturator); - // operations.add(LP_valve); - // operations.add(separator2); + neqsim.processSimulation.processSystem.ProcessSystem operations = + new neqsim.processSimulation.processSystem.ProcessSystem(); + operations.add(stream_1); + operations.add(separator); + // operations.add(stream_2); + // operations.add(stream_3); + // operations.add(stream_4); + // operations.add(waterRemoval); + // operations.add(TEGsaturator); + // operations.add(LP_valve); + // operations.add(separator2); - operations.run(); - operations.displayResult(); - // stream_1.displayResult(); - // waterRemoval.displayResult(); - } + operations.run(); + operations.displayResult(); + // stream_1.displayResult(); + // waterRemoval.displayResult(); + } } From 988d1907cab5da22ae491a856ee82726e923cbd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Thu, 26 Sep 2024 10:15:58 +0200 Subject: [PATCH 4/4] chore: remove println --- .../readDataFromFile/DataReader.java | 4 ++-- src/test/java/neqsim/thermo/system/SystemPCSAFTTest.java | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/neqsim/statistics/experimentalSampleCreation/readDataFromFile/DataReader.java b/src/main/java/neqsim/statistics/experimentalSampleCreation/readDataFromFile/DataReader.java index a06fb2a630..8bc5b6458c 100644 --- a/src/main/java/neqsim/statistics/experimentalSampleCreation/readDataFromFile/DataReader.java +++ b/src/main/java/neqsim/statistics/experimentalSampleCreation/readDataFromFile/DataReader.java @@ -60,7 +60,6 @@ public void readData() { file.readLine(); } do { - System.out.println("test"); String s = file.readLine(); tokenizer = new StringTokenizer(s); tokenizer.nextToken(); @@ -78,7 +77,8 @@ public void readData() { * Getter for the field sampleObjectList. *

* - * @return a {@link java.util.ArrayList} of {@link neqsim.statistics.experimentalSampleCreation.readDataFromFile.DataObject} + * @return a {@link java.util.ArrayList} of + * {@link neqsim.statistics.experimentalSampleCreation.readDataFromFile.DataObject} */ public ArrayList getSampleObjectList() { return sampleObjectList; diff --git a/src/test/java/neqsim/thermo/system/SystemPCSAFTTest.java b/src/test/java/neqsim/thermo/system/SystemPCSAFTTest.java index c2efb5f109..157790342e 100644 --- a/src/test/java/neqsim/thermo/system/SystemPCSAFTTest.java +++ b/src/test/java/neqsim/thermo/system/SystemPCSAFTTest.java @@ -14,7 +14,6 @@ public void testInit() { ThermodynamicOperations ops = new ThermodynamicOperations(testSystem); ops.TPflash(); testSystem.initProperties(); - System.out.println("test"); double cp = testSystem.getCp(); assertEquals(208.85116193406583, cp, 0.1); }