Skip to content

Commit

Permalink
add more pump chart lookup tables (#1260)
Browse files Browse the repository at this point in the history
  • Loading branch information
EvenSol authored Jan 25, 2025
1 parent 540fed8 commit eff99d2
Show file tree
Hide file tree
Showing 4 changed files with 164 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/main/java/neqsim/process/equipment/pump/Pump.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class Pump extends TwoPortEquipment implements PumpInterface {
public double isentropicEfficiency = 1.0;
public boolean powerSet = false;
private String pressureUnit = "bara";
private PumpChart pumpChart = new PumpChart();
private PumpChartInterface pumpChart = new PumpChart();

/**
* Constructor for Pump.
Expand Down Expand Up @@ -439,7 +439,7 @@ public double getSpeed() {
*
* @return a {@link neqsim.process.equipment.pump.PumpChart} object
*/
public PumpChart getPumpChart() {
public PumpChartInterface getPumpChart() {
return pumpChart;
}

Expand All @@ -449,4 +449,21 @@ public String toJson() {
return new GsonBuilder().serializeSpecialFloatingPointValues().create()
.toJson(new PumpResponse(this));
}

/**
* {@inheritDoc}
*
* <p>
* Set CompressorChartType
* </p>
*/
public void setPumpChartType(String type) {
if (type.equals("simple") || type.equals("fan law")) {
pumpChart = new PumpChart();
} else if (type.equals("interpolate and extrapolate")) {
pumpChart = new PumpChartAlternativeMapLookupExtrapolate();
} else {
pumpChart = new PumpChart();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package neqsim.process.equipment.pump;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import neqsim.process.equipment.compressor.CompressorChartAlternativeMapLookupExtrapolate;

/**
* <p>
* CompressorChartAlternativeMapLookupExtrapolate class.
* </p>
*
* @author ASMF
*/
public class PumpChartAlternativeMapLookupExtrapolate
extends CompressorChartAlternativeMapLookupExtrapolate implements PumpChartInterface {
/** Serialization version UID. */
private static final long serialVersionUID = 1000;
/** Logger object for class. */
static Logger logger = LogManager.getLogger(PumpChartAlternativeMapLookupExtrapolate.class);
boolean usePumpChart = false;

@Override
public double getHead(double flow, double speed) {
// Implement the method logic here
return getPolytropicHead(flow, speed);
}

@Override
public boolean isUsePumpChart() {
// Implement the method logic here
return usePumpChart;
}

@Override
public double getEfficiency(double flow, double speed) {
// Implement the method logic here
return getPolytropicEfficiency(flow, speed);
}

@Override
public void setUsePumpChart(boolean usePumpChart) {
this.usePumpChart = usePumpChart;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,13 @@ public interface PumpInterface extends ProcessEquipmentInterface, TwoPortInterfa
* @return a double
*/
public double getPower();

/**
* <p>
* setPumpChartType.
* </p>
*
* @param type a {@link java.lang.String} object
*/
public void setPumpChartType(String type);
}
92 changes: 92 additions & 0 deletions src/test/java/neqsim/process/equipment/pump/PumpChartTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import neqsim.process.equipment.stream.Stream;

public class PumpChartTest {
@Test
Expand All @@ -22,4 +23,95 @@ void testSetHeadUnit() {
"neqsim.util.exception.InvalidInputException: PumpChart:setHeadUnit - Input headUnit does not support value doesNotExist",
thrown.getMessage());
}

@Test
void testPumpChart() {

neqsim.thermo.system.SystemInterface feedGas =
new neqsim.thermo.system.SystemSrkEos(273.15 + 20.0, 10.00);
feedGas.addComponent("water", 1.0);

Stream feedGasStream = new Stream("feed fluid", feedGas);
feedGasStream.setFlowRate(4000.0 * 1000, "kg/hr");
feedGasStream.setTemperature(20.0, "C");
feedGasStream.setPressure(1.0, "bara");
feedGasStream.run();

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}};
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[][] 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}};

double[] chartConditions = new double[] {0.3, 1.0, 1.0, 1.0};


Pump pump1 = new Pump("pump 1", feedGasStream);
pump1.getPumpChart().setCurves(chartConditions, speed, flow, head, polyEff);
pump1.getPumpChart().setHeadUnit("meter");
pump1.getPumpChart().setUsePumpChart(true);
pump1.setSpeed(12913);
pump1.run();

double active_speed = 12913;
Assertions.assertEquals(3974.8455, pump1.getInletStream().getFlowRate("m3/hr"), 1.0);
Assertions.assertEquals(71.33705748,
pump1.getPumpChart().getHead(pump1.getInletStream().getFlowRate("m3/hr"), active_speed),
1.0);
Assertions.assertEquals(80.76, pump1.getPumpChart()
.getEfficiency(pump1.getInletStream().getFlowRate("m3/hr"), active_speed), 0.1);
Assertions.assertEquals(7.99577554, pump1.getOutletStream().getPressure("bara"), 0.01);
Assertions.assertEquals(956.42763, pump1.getPower("kW"), 0.01);

pump1 = new Pump("pump 1", feedGasStream);
pump1.setPumpChartType("interpolate and extrapolate");
pump1.getPumpChart().setCurves(chartConditions, speed, flow, head, polyEff);
pump1.getPumpChart().setHeadUnit("meter");
pump1.getPumpChart().setUsePumpChart(true);
pump1.setSpeed(12913);
pump1.run();

Assertions.assertEquals(3974.8455, pump1.getInletStream().getFlowRate("m3/hr"), 1.0);
Assertions.assertEquals(73.92214701,
pump1.getPumpChart().getHead(pump1.getInletStream().getFlowRate("m3/hr"), active_speed),
1.0);
Assertions.assertEquals(80.76, pump1.getPumpChart()
.getEfficiency(pump1.getInletStream().getFlowRate("m3/hr"), active_speed), 0.1);
Assertions.assertEquals(8.2492862, pump1.getOutletStream().getPressure("bara"), 0.01);
Assertions.assertEquals(990.9909569, pump1.getPower("kW"), 0.01);
}


}

0 comments on commit eff99d2

Please sign in to comment.