From ade0fd548c4698be0cc281d9c46b6c0c72cfa835 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Mon, 2 Dec 2024 19:23:10 +0100 Subject: [PATCH] update compressor calc (#1197) * update compressor calc * update --- .../equipment/compressor/Compressor.java | 244 ++++++++++-------- .../equipment/compressor/CompressorTest.java | 50 +++- 2 files changed, 185 insertions(+), 109 deletions(-) diff --git a/src/main/java/neqsim/process/equipment/compressor/Compressor.java b/src/main/java/neqsim/process/equipment/compressor/Compressor.java index e97c295d93..3219e9cf63 100644 --- a/src/main/java/neqsim/process/equipment/compressor/Compressor.java +++ b/src/main/java/neqsim/process/equipment/compressor/Compressor.java @@ -55,6 +55,7 @@ public class Compressor extends TwoPortEquipment implements CompressorInterface public double polytropicEfficiency = 1.0; public boolean usePolytropicCalc = false; public boolean powerSet = false; + public boolean calcPressureOut = false; private CompressorChartInterface compressorChart = new CompressorChart(); private AntiSurge antiSurge = new AntiSurge(); private double polytropicHead = 0; @@ -81,9 +82,8 @@ public Compressor(String name) { * Constructor for Compressor. *
* - * @param name a {@link java.lang.String} object - * @param inletStream a {@link neqsim.process.equipment.stream.StreamInterface} - * object + * @param name a {@link java.lang.String} object + * @param inletStream a {@link neqsim.process.equipment.stream.StreamInterface} object */ public Compressor(String name, StreamInterface inletStream) { this(name); @@ -95,7 +95,7 @@ public Compressor(String name, StreamInterface inletStream) { * Constructor for Compressor. * * - * @param name Name of compressor + * @param name Name of compressor * @param interpolateMapLookup a boolean */ public Compressor(String name, boolean interpolateMapLookup) { @@ -151,7 +151,7 @@ public void setOutletPressure(double pressure) { * * * @param pressure a double - * @param unit a {@link java.lang.String} object + * @param unit a {@link java.lang.String} object */ public void setOutletPressure(double pressure, String unit) { this.pressure = pressure; @@ -261,8 +261,8 @@ public double solveEfficiency(double outTemperature) { * findOutPressure. * * - * @param hinn a double - * @param hout a double + * @param hinn a double + * @param hout a double * @param polytropicEfficiency a double * @return a double */ @@ -325,13 +325,44 @@ public void run(UUID id) { } setOutletPressure(outpres); } - if (useOutTemperature) { + if (isCalcPressureOut()) { + double actualFlowRate = thermoSystem.getFlowRate("m3/hr"); + double z_inlet = thermoSystem.getZ(); + double MW = thermoSystem.getMolarMass(); + double efficiency = 0.8; + if (usePolytropicCalc) { + efficiency = getPolytropicEfficiency(); + } else { + efficiency = getIsentropicEfficiency(); + } + polytropicHead = dH / getThermoSystem().getFlowRate("kg/sec") / 1000.0 * efficiency; + polytropicFluidHead = polytropicHead; + polytropicHeadMeter = polytropicFluidHead * 1000.0 / ThermodynamicConstantsInterface.gravity; + double temperature_inlet = thermoSystem.getTemperature(); + if (getCompressorChart().useRealKappa()) { + kappa = thermoSystem.getGamma(); + } else { + kappa = thermoSystem.getGamma2(); + } + double n = 1.0 / (1.0 - (kappa - 1.0) / kappa * 1.0 / (getPolytropicEfficiency())); + double pressureRatio = Math.pow((polytropicFluidHead * 1000.0 + (n / (n - 1.0) * z_inlet + * ThermodynamicConstantsInterface.R * (temperature_inlet) / MW)) + / (n / (n - 1.0) * z_inlet * ThermodynamicConstantsInterface.R * (temperature_inlet) + / MW), + n / (n - 1.0)); + setOutletPressure(pressureRatio * getInletPressure()); + + } + if (useOutTemperature) + + { if (useRigorousPolytropicMethod) { solveEfficiency(outTemperature); polytropicHead = getPower() / getThermoSystem().getFlowRate("kg/sec") / 1000.0 * getPolytropicEfficiency(); polytropicFluidHead = polytropicHead; - polytropicHeadMeter = polytropicFluidHead * 1000.0 / ThermodynamicConstantsInterface.gravity; + polytropicHeadMeter = + polytropicFluidHead * 1000.0 / ThermodynamicConstantsInterface.gravity; return; } else { double MW = thermoSystem.getMolarMass(); @@ -347,7 +378,8 @@ public void run(UUID id) { double[] gergProps; gergProps = getThermoSystem().getPhase(0).getProperties_GERG2008(); densOutIsentropic = getThermoSystem().getPhase(0).getDensity_GERG2008(); - enthalpyOutIsentropic = gergProps[7] * getThermoSystem().getPhase(0).getNumberOfMolesInPhase(); + enthalpyOutIsentropic = + gergProps[7] * getThermoSystem().getPhase(0).getNumberOfMolesInPhase(); } thermoSystem.setTemperature(outTemperature); thermoOps.TPflash(); @@ -434,13 +466,15 @@ public void run(UUID id) { z_inlet = gergProps[1]; } - double polytropEff = getCompressorChart().getPolytropicEfficiency(actualFlowRate, currentSpeed); + double polytropEff = + getCompressorChart().getPolytropicEfficiency(actualFlowRate, currentSpeed); setPolytropicEfficiency(polytropEff / 100.0); polytropicHead = getCompressorChart().getPolytropicHead(actualFlowRate, currentSpeed); double temperature_inlet = thermoSystem.getTemperature(); double n = 1.0 / (1.0 - (kappa - 1.0) / kappa * 1.0 / (polytropEff / 100.0)); - polytropicFluidHead = (getCompressorChart().getHeadUnit().equals("meter")) ? polytropicHead / 1000.0 * 9.81 - : polytropicHead; + polytropicFluidHead = + (getCompressorChart().getHeadUnit().equals("meter")) ? polytropicHead / 1000.0 * 9.81 + : polytropicHead; double pressureRatio = Math.pow((polytropicFluidHead * 1000.0 + (n / (n - 1.0) * z_inlet * ThermodynamicConstantsInterface.R * (temperature_inlet) / MW)) / (n / (n - 1.0) * z_inlet * ThermodynamicConstantsInterface.R * (temperature_inlet) @@ -451,17 +485,18 @@ public void run(UUID id) { // Calculate the derivative of pressure with respect to speed double polytropEffDelta = getCompressorChart().getPolytropicEfficiency(actualFlowRate, currentSpeed + deltaSpeed); - double polytropicHeadDelta = getCompressorChart().getPolytropicHead(actualFlowRate, - currentSpeed + deltaSpeed); + double polytropicHeadDelta = + getCompressorChart().getPolytropicHead(actualFlowRate, currentSpeed + deltaSpeed); double nDelta = 1.0 / (1.0 - (kappa - 1.0) / kappa * 1.0 / (polytropEffDelta / 100.0)); double polytropicFluidHeadDelta = (getCompressorChart().getHeadUnit().equals("meter")) ? polytropicHeadDelta / 1000.0 * 9.81 : polytropicHeadDelta; - double pressureRatioDelta = Math.pow((polytropicFluidHeadDelta * 1000.0 + (nDelta / (nDelta - 1.0) * z_inlet - * ThermodynamicConstantsInterface.R * (temperature_inlet) / MW)) - / (nDelta / (nDelta - 1.0) * z_inlet * ThermodynamicConstantsInterface.R - * (temperature_inlet) / MW), - nDelta / (nDelta - 1.0)); + double pressureRatioDelta = + Math.pow((polytropicFluidHeadDelta * 1000.0 + (nDelta / (nDelta - 1.0) * z_inlet + * ThermodynamicConstantsInterface.R * (temperature_inlet) / MW)) + / (nDelta / (nDelta - 1.0) * z_inlet * ThermodynamicConstantsInterface.R + * (temperature_inlet) / MW), + nDelta / (nDelta - 1.0)); double pressureDelta = thermoSystem.getPressure() * pressureRatioDelta; double dPressure_dSpeed = (pressureDelta - currentPressure) / deltaSpeed; @@ -510,7 +545,8 @@ public void run(UUID id) { z_inlet = gergProps[1]; } - double polytropEff = getCompressorChart().getPolytropicEfficiency(actualFlowRate, getSpeed()); + double polytropEff = + getCompressorChart().getPolytropicEfficiency(actualFlowRate, getSpeed()); setPolytropicEfficiency(polytropEff / 100.0); polytropicHead = getCompressorChart().getPolytropicHead(actualFlowRate, getSpeed()); double temperature_inlet = thermoSystem.getTemperature(); @@ -608,9 +644,11 @@ public void run(UUID id) { } } } else if (polytropicMethod.equals("schultz")) { - double schultzX = thermoSystem.getTemperature() / thermoSystem.getVolume() * thermoSystem.getdVdTpn() - - 1.0; - double schultzY = -thermoSystem.getPressure() / thermoSystem.getVolume() * thermoSystem.getdVdPtn(); + double schultzX = + thermoSystem.getTemperature() / thermoSystem.getVolume() * thermoSystem.getdVdTpn() + - 1.0; + double schultzY = + -thermoSystem.getPressure() / thermoSystem.getVolume() * thermoSystem.getdVdPtn(); thermoSystem.setPressure(getOutletPressure(), pressureUnit); thermoOps.PSflash(entropy); thermoSystem.initProperties(); @@ -621,10 +659,11 @@ public void run(UUID id) { double[] gergProps; gergProps = getThermoSystem().getPhase(0).getProperties_GERG2008(); densOutIsentropic = getThermoSystem().getPhase(0).getDensity_GERG2008(); - enthalpyOutIsentropic = gergProps[7] * getThermoSystem().getPhase(0).getNumberOfMolesInPhase(); + enthalpyOutIsentropic = + gergProps[7] * getThermoSystem().getPhase(0).getNumberOfMolesInPhase(); } - double isenthalpicvolumeexponent = Math.log(getOutletPressure() / presinn) - / Math.log(densOutIsentropic / densInn); + double isenthalpicvolumeexponent = + Math.log(getOutletPressure() / presinn) / Math.log(densOutIsentropic / densInn); double nV = (1.0 + schultzX) / (1.0 / isenthalpicvolumeexponent * (1.0 / polytropicEfficiency + schultzX) - schultzY * (1.0 / polytropicEfficiency - 1.0)); @@ -651,10 +690,11 @@ public void run(UUID id) { double[] gergProps; gergProps = getThermoSystem().getPhase(0).getProperties_GERG2008(); densOutIsentropic = getThermoSystem().getPhase(0).getDensity_GERG2008(); - enthalpyOutIsentropic = gergProps[7] * getThermoSystem().getPhase(0).getNumberOfMolesInPhase(); + enthalpyOutIsentropic = + gergProps[7] * getThermoSystem().getPhase(0).getNumberOfMolesInPhase(); } - double isenthalpicvolumeexponent = Math.log(getOutletPressure() / presinn) - / Math.log(densOutIsentropic / densInn); + double isenthalpicvolumeexponent = + Math.log(getOutletPressure() / presinn) / Math.log(densOutIsentropic / densInn); double term = isenthalpicvolumeexponent / (isenthalpicvolumeexponent - 1.0) * (polytropicEfficiency); double term2 = 1e5 * (getOutletPressure() / densOutIsentropic - presinn / densInn); @@ -711,7 +751,8 @@ public void run(UUID id) { outStream.setThermoSystem(getThermoSystem()); outStream.setCalculationIdentifier(id); - polytropicFluidHead = getPower() / getThermoSystem().getFlowRate("kg/sec") / 1000.0 * getPolytropicEfficiency(); + polytropicFluidHead = + getPower() / getThermoSystem().getFlowRate("kg/sec") / 1000.0 * getPolytropicEfficiency(); polytropicHeadMeter = polytropicFluidHead * 1000.0 / 9.81; actualCompressionRatio = getOutletPressure() / presinn; setCalculationIdentifier(id); @@ -753,7 +794,8 @@ public void runTransient(double dt, UUID id) { thermoSystem = outStream.getThermoSystem().clone(); thermoSystem.initPhysicalProperties(PhysicalPropertyType.MASS_DENSITY); - polytropicEfficiency = compressorChart.getPolytropicEfficiency(inStream.getFlowRate("m3/hr"), speed) / 100.0; + polytropicEfficiency = + compressorChart.getPolytropicEfficiency(inStream.getFlowRate("m3/hr"), speed) / 100.0; polytropicFluidHead = head * polytropicEfficiency; dH = polytropicFluidHead * 1000.0 * thermoSystem.getMolarMass() / getPolytropicEfficiency() * inStream.getThermoSystem().getTotalNumberOfMoles(); @@ -768,17 +810,17 @@ public void runTransient(double dt, UUID id) { public void generateCompressorCurves() { double flowRef = getThermoSystem().getFlowRate("m3/hr"); double factor = flowRef / 4000.0; - double[] chartConditions = new double[] { 0.3, 1.0, 1.0, 1.0 }; - double[] speed = new double[] { 12913, 12298, 11683, 11098, 10453, 9224, 8609, 8200 }; + double[] chartConditions = new double[] {0.3, 1.0, 1.0, 1.0}; + double[] speed = new double[] {12913, 12298, 11683, 11098, 10453, 9224, 8609, 8200}; double[][] flow = new double[][] { - { 2789.1285, 3174.0375, 3689.2288, 4179.4503, 4570.2768, 4954.7728, 5246.0329, 5661.0331 }, - { 2571.1753, 2943.7254, 3440.2675, 3837.4448, 4253.0898, 4668.6643, 4997.1926, 5387.4952 }, - { 2415.3793, 2763.0706, 3141.7095, 3594.7436, 4047.6467, 4494.1889, 4853.7353, 5138.7858 }, - { 2247.2043, 2799.7342, 3178.3428, 3656.1551, 4102.778, 4394.1591, 4648.3224, 4840.4998 }, - { 2072.8397, 2463.9483, 2836.4078, 3202.5266, 3599.6333, 3978.0203, 4257.0022, 4517.345 }, - { 1835.9552, 2208.455, 2618.1322, 2940.8034, 3244.7852, 3530.1279, 3753.3738, 3895.9746 }, - { 1711.3386, 1965.8848, 2356.9431, 2685.9247, 3008.5154, 3337.2855, 3591.5092 }, - { 1636.5807, 2002.8708, 2338.0319, 2642.1245, 2896.4894, 3113.6264, 3274.8764, 3411.2977 } }; + {2789.1285, 3174.0375, 3689.2288, 4179.4503, 4570.2768, 4954.7728, 5246.0329, 5661.0331}, + {2571.1753, 2943.7254, 3440.2675, 3837.4448, 4253.0898, 4668.6643, 4997.1926, 5387.4952}, + {2415.3793, 2763.0706, 3141.7095, 3594.7436, 4047.6467, 4494.1889, 4853.7353, 5138.7858}, + {2247.2043, 2799.7342, 3178.3428, 3656.1551, 4102.778, 4394.1591, 4648.3224, 4840.4998}, + {2072.8397, 2463.9483, 2836.4078, 3202.5266, 3599.6333, 3978.0203, 4257.0022, 4517.345}, + {1835.9552, 2208.455, 2618.1322, 2940.8034, 3244.7852, 3530.1279, 3753.3738, 3895.9746}, + {1711.3386, 1965.8848, 2356.9431, 2685.9247, 3008.5154, 3337.2855, 3591.5092}, + {1636.5807, 2002.8708, 2338.0319, 2642.1245, 2896.4894, 3113.6264, 3274.8764, 3411.2977}}; for (int i = 0; i < flow.length; i++) { for (int j = 0; j < flow[i].length; j++) { @@ -786,14 +828,15 @@ public void generateCompressorCurves() { } } - double[][] head = new double[][] { { 80.0375, 78.8934, 76.2142, 71.8678, 67.0062, 60.6061, 53.0499, 39.728 }, - { 72.2122, 71.8369, 68.9009, 65.8341, 60.7167, 54.702, 47.2749, 35.7471 }, - { 65.1576, 64.5253, 62.6118, 59.1619, 54.0455, 47.0059, 39.195, 31.6387 }, - { 58.6154, 56.9627, 54.6647, 50.4462, 44.4322, 38.4144, 32.9084, 28.8109 }, - { 52.3295, 51.0573, 49.5283, 46.3326, 42.3685, 37.2502, 31.4884, 25.598 }, - { 40.6578, 39.6416, 37.6008, 34.6603, 30.9503, 27.1116, 23.2713, 20.4546 }, - { 35.2705, 34.6359, 32.7228, 31.0645, 27.0985, 22.7482, 18.0113 }, - { 32.192, 31.1756, 29.1329, 26.833, 23.8909, 21.3324, 18.7726, 16.3403 }, }; + double[][] head = + new double[][] {{80.0375, 78.8934, 76.2142, 71.8678, 67.0062, 60.6061, 53.0499, 39.728}, + {72.2122, 71.8369, 68.9009, 65.8341, 60.7167, 54.702, 47.2749, 35.7471}, + {65.1576, 64.5253, 62.6118, 59.1619, 54.0455, 47.0059, 39.195, 31.6387}, + {58.6154, 56.9627, 54.6647, 50.4462, 44.4322, 38.4144, 32.9084, 28.8109}, + {52.3295, 51.0573, 49.5283, 46.3326, 42.3685, 37.2502, 31.4884, 25.598}, + {40.6578, 39.6416, 37.6008, 34.6603, 30.9503, 27.1116, 23.2713, 20.4546}, + {35.2705, 34.6359, 32.7228, 31.0645, 27.0985, 22.7482, 18.0113}, + {32.192, 31.1756, 29.1329, 26.833, 23.8909, 21.3324, 18.7726, 16.3403},}; for (int i = 0; i < head.length; i++) { for (int j = 0; j < head[i].length; j++) { @@ -801,22 +844,22 @@ public void generateCompressorCurves() { } } double[][] polyEff = new double[][] { - { 77.2452238409573, 79.4154186459363, 80.737960012489, 80.5229826589649, 79.2210931638144, - 75.4719133864634, 69.6034181197298, 58.7322388482707 }, - { 77.0107837113504, 79.3069974136389, 80.8941189021135, 80.7190194665918, 79.5313242980328, - 75.5912622896367, 69.6846136362097, 60.0043057990909 }, - { 77.0043065299874, 79.1690958847856, 80.8038169975675, 80.6543975614197, 78.8532389102705, - 73.6664774270613, 66.2735600426727, 57.671664571658 }, - { 77.0716623789093, 80.4629750233093, 81.1390811169072, 79.6374242667478, 75.380928428817, - 69.5332969549779, 63.7997587622339, 58.8120614497758 }, - { 76.9705872525642, 79.8335492585324, 80.9468133671171, 80.5806471927835, 78.0462158225426, - 73.0403707523258, 66.5572286338589, 59.8624822515064 }, - { 77.5063036680357, 80.2056198362559, 81.0339108025933, 79.6085962687939, 76.3814534404405, - 70.8027503005902, 64.6437367160571, 60.5299349982342 }, - { 77.8175271586685, 80.065165942218, 81.0631362122632, 79.8955051771299, 76.1983240929369, - 69.289982774309, 60.8567149372229 }, - { 78.0924334304045, 80.9353551568667, 80.7904437766234, 78.8639325223295, 75.2170936751143, - 70.3105081673411, 65.5507568533569, 61.0391468300337 } }; + {77.2452238409573, 79.4154186459363, 80.737960012489, 80.5229826589649, 79.2210931638144, + 75.4719133864634, 69.6034181197298, 58.7322388482707}, + {77.0107837113504, 79.3069974136389, 80.8941189021135, 80.7190194665918, 79.5313242980328, + 75.5912622896367, 69.6846136362097, 60.0043057990909}, + {77.0043065299874, 79.1690958847856, 80.8038169975675, 80.6543975614197, 78.8532389102705, + 73.6664774270613, 66.2735600426727, 57.671664571658}, + {77.0716623789093, 80.4629750233093, 81.1390811169072, 79.6374242667478, 75.380928428817, + 69.5332969549779, 63.7997587622339, 58.8120614497758}, + {76.9705872525642, 79.8335492585324, 80.9468133671171, 80.5806471927835, 78.0462158225426, + 73.0403707523258, 66.5572286338589, 59.8624822515064}, + {77.5063036680357, 80.2056198362559, 81.0339108025933, 79.6085962687939, 76.3814534404405, + 70.8027503005902, 64.6437367160571, 60.5299349982342}, + {77.8175271586685, 80.065165942218, 81.0631362122632, 79.8955051771299, 76.1983240929369, + 69.289982774309, 60.8567149372229}, + {78.0924334304045, 80.9353551568667, 80.7904437766234, 78.8639325223295, 75.2170936751143, + 70.3105081673411, 65.5507568533569, 61.0391468300337}}; getCompressorChart().setCurves(chartConditions, speed, flow, head, polyEff); getCompressorChart().setHeadUnit("kJ/kg"); @@ -836,7 +879,7 @@ public void displayResult() { getThermoSystem().initPhysicalProperties(); String[][] table = new String[50][5]; - String[] names = { "", "Phase 1", "Phase 2", "Phase 3", "Unit" }; + String[] names = {"", "Phase 1", "Phase 2", "Phase 3", "Unit"}; table[0][0] = ""; table[0][1] = ""; table[0][2] = ""; @@ -862,51 +905,48 @@ public void displayResult() { // Double.longValue(thermoSystem.getPhases()[i].getBeta()); buf = new StringBuffer(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 3][0] = "PhaseFraction"; - table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 3][i + 1] = nf - .format(getThermoSystem().getPhases()[i].getBeta(), buf, test).toString(); + table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 3][i + 1] = + nf.format(getThermoSystem().getPhases()[i].getBeta(), buf, test).toString(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 3][4] = "[-]"; buf = new StringBuffer(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 4][0] = "MolarMass"; - table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 4][i + 1] = nf - .format(getThermoSystem().getPhases()[i].getMolarMass() * 1000, buf, test).toString(); + table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 4][i + 1] = + nf.format(getThermoSystem().getPhases()[i].getMolarMass() * 1000, buf, test).toString(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 4][4] = "[kg/kmol]"; buf = new StringBuffer(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 5][0] = "Cp"; - table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 5][i + 1] = nf - .format((getThermoSystem().getPhases()[i].getCp() + table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 5][i + 1] = + nf.format((getThermoSystem().getPhases()[i].getCp() / getThermoSystem().getPhases()[i].getNumberOfMolesInPhase() * 1.0 - / getThermoSystem().getPhases()[i].getMolarMass() * 1000), buf, test) - .toString(); + / getThermoSystem().getPhases()[i].getMolarMass() * 1000), buf, test).toString(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 5][4] = "[kJ/kg*K]"; buf = new StringBuffer(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 7][0] = "Viscosity"; - table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 7][i + 1] = nf - .format((getThermoSystem().getPhases()[i].getPhysicalProperties().getViscosity()), buf, - test) - .toString(); + table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 7][i + 1] = + nf.format((getThermoSystem().getPhases()[i].getPhysicalProperties().getViscosity()), buf, + test).toString(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 7][4] = "[kg/m*sec]"; buf = new StringBuffer(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 8][0] = "Conductivity"; - table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 8][i + 1] = nf - .format(getThermoSystem().getPhases()[i].getPhysicalProperties().getConductivity(), buf, - test) - .toString(); + table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 8][i + 1] = + nf.format(getThermoSystem().getPhases()[i].getPhysicalProperties().getConductivity(), buf, + test).toString(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 8][4] = "[W/m*K]"; buf = new StringBuffer(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 10][0] = "Pressure"; - table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 10][i + 1] = Double - .toString(getThermoSystem().getPhases()[i].getPressure()); + table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 10][i + 1] = + Double.toString(getThermoSystem().getPhases()[i].getPressure()); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 10][4] = "[bar]"; buf = new StringBuffer(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 11][0] = "Temperature"; - table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 11][i + 1] = Double - .toString(getThermoSystem().getPhases()[i].getTemperature()); + table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 11][i + 1] = + Double.toString(getThermoSystem().getPhases()[i].getTemperature()); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 11][4] = "[K]"; Double.toString(getThermoSystem().getPhases()[i].getTemperature()); @@ -1008,9 +1048,7 @@ public SystemInterface getThermoSystem() { * Getter for the fieldcompressorChart
.
*
*
- * @return a
- * {@link neqsim.process.equipment.compressor.CompressorChartInterface}
- * object
+ * @return a {@link neqsim.process.equipment.compressor.CompressorChartInterface} object
*/
public CompressorChartInterface getCompressorChart() {
return compressorChart;
@@ -1021,9 +1059,7 @@ public CompressorChartInterface getCompressorChart() {
* Setter for the field compressorChart
.
*
*
- * @param compressorChart a
- * {@link neqsim.process.equipment.compressor.CompressorChart}
- * object
+ * @param compressorChart a {@link neqsim.process.equipment.compressor.CompressorChart} object
*/
public void setCompressorChart(CompressorChart compressorChart) {
this.compressorChart = compressorChart;
@@ -1087,8 +1123,7 @@ public boolean isStoneWall(double flow, double head) {
* Setter for the field antiSurge
.
*
*
- * @param antiSurge a {@link neqsim.process.equipment.compressor.AntiSurge}
- * object
+ * @param antiSurge a {@link neqsim.process.equipment.compressor.AntiSurge} object
*/
public void setAntiSurge(AntiSurge antiSurge) {
this.antiSurge = antiSurge;
@@ -1283,7 +1318,7 @@ public void setPressure(double pressure) {
*
*
* @param pressure a double
- * @param unit a {@link java.lang.String} object
+ * @param unit a {@link java.lang.String} object
*/
public void setPressure(double pressure, String unit) {
setOutletPressure(pressure);
@@ -1349,9 +1384,7 @@ public void setUseGERG2008(boolean useGERG2008) {
* Getter for the field propertyProfile
.
*
*
- * @return a
- * {@link neqsim.process.equipment.compressor.CompressorPropertyProfile}
- * object
+ * @return a {@link neqsim.process.equipment.compressor.CompressorPropertyProfile} object
*/
public CompressorPropertyProfile getPropertyProfile() {
return propertyProfile;
@@ -1362,9 +1395,8 @@ public CompressorPropertyProfile getPropertyProfile() {
* Setter for the field propertyProfile
.
*
*
- * @param propertyProfile a
- * {@link neqsim.process.equipment.compressor.CompressorPropertyProfile}
- * object
+ * @param propertyProfile a {@link neqsim.process.equipment.compressor.CompressorPropertyProfile}
+ * object
*/
public void setPropertyProfile(CompressorPropertyProfile propertyProfile) {
this.propertyProfile = propertyProfile;
@@ -1583,4 +1615,12 @@ public boolean isSolveSpeed() {
public void setSolveSpeed(boolean solveSpeed) {
this.solveSpeed = solveSpeed;
}
+
+ public boolean isCalcPressureOut() {
+ return calcPressureOut;
+ }
+
+ public void setCalcPressureOut(boolean calcPressureOut) {
+ this.calcPressureOut = calcPressureOut;
+ }
}
diff --git a/src/test/java/neqsim/process/equipment/compressor/CompressorTest.java b/src/test/java/neqsim/process/equipment/compressor/CompressorTest.java
index 830504be8b..bf5b6e523a 100644
--- a/src/test/java/neqsim/process/equipment/compressor/CompressorTest.java
+++ b/src/test/java/neqsim/process/equipment/compressor/CompressorTest.java
@@ -12,7 +12,6 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import neqsim.process.equipment.compressor.Compressor;
import neqsim.process.equipment.stream.Stream;
import neqsim.process.processmodel.ProcessSystem;
import neqsim.thermo.system.SystemSrkEos;
@@ -150,8 +149,7 @@ public void testCompressorWithSrk() {
inletStream.setFlowRate(gasFlowRate, "MSm3/day");
inletStream.run();
neqsim.process.equipment.compressor.Compressor compressor1 =
- new neqsim.process.equipment.compressor.Compressor("Compressor1",
- inletStream);
+ new neqsim.process.equipment.compressor.Compressor("Compressor1", inletStream);
compressor1.setUsePolytropicCalc(true);
compressor1.setOutletPressure(pressure_Out);
compressor1.setOutTemperature(358.0);
@@ -179,8 +177,7 @@ public void testCompressorWithGERG2008() {
inletStream.setFlowRate(gasFlowRate, "MSm3/day");
inletStream.run();
neqsim.process.equipment.compressor.Compressor compressor1 =
- new neqsim.process.equipment.compressor.Compressor("Compressor1",
- inletStream);
+ new neqsim.process.equipment.compressor.Compressor("Compressor1", inletStream);
compressor1.setUsePolytropicCalc(true);
compressor1.setOutletPressure(pressure_Out);
compressor1.setOutTemperature(358.0);
@@ -210,8 +207,7 @@ public void testCompressorWithGERG2008_2() {
inletStream.setFlowRate(gasFlowRate, "MSm3/day");
inletStream.run();
neqsim.process.equipment.compressor.Compressor compressor1 =
- new neqsim.process.equipment.compressor.Compressor("Compressor1",
- inletStream);
+ new neqsim.process.equipment.compressor.Compressor("Compressor1", inletStream);
compressor1.setOutletPressure(pressure_Out);
compressor1.setPolytropicEfficiency(0.56);
compressor1.setUsePolytropicCalc(true);
@@ -256,4 +252,44 @@ public void testMultiPhaseCompression() {
processOps.run();
assertEquals(compressor1.getPower(), 3712607.597542703, 1110.01);
}
+
+ /**
+ * + * test Multi Phase Compression. + *
+ */ + @Test + public void testPowerEffSpec() { + SystemSrkEos testSystem = new SystemSrkEos(315.0, 10.0); + testSystem.addComponent("nitrogen", 2.0); + testSystem.addComponent("methane", 50.0); + testSystem.setMixingRule(2); + + processOps = new ProcessSystem(); + Stream inletStream = new Stream("feed stream", testSystem); + inletStream.setPressure(10, "bara"); + inletStream.setTemperature(30, "C"); + inletStream.setFlowRate(1, "MSm3/day"); + compressor1 = new Compressor(unitName, inletStream); + compressor1.setPower(2000000); + compressor1.setUsePolytropicCalc(true); + compressor1.setPolytropicEfficiency(0.8); + compressor1.setCalcPressureOut(true); + processOps.add(inletStream); + processOps.add(compressor1); + processOps.run(); + assertEquals(30.610386, compressor1.getOutletPressure(), 0.01); + // compressor1.getOutletStream().getFluid().prettyPrint(); + + processOps = new ProcessSystem(); + compressor1 = new Compressor(unitName, inletStream); + compressor1.setUsePolytropicCalc(true); + compressor1.setPolytropicEfficiency(0.8); + compressor1.setOutletPressure(30.61); + processOps.add(inletStream); + processOps.add(compressor1); + processOps.run(); + assertEquals(139.7216108, compressor1.getOutletStream().getTemperature("C"), 0.01); + // compressor1.getOutletStream().getFluid().prettyPrint(); + } }