Skip to content

Commit

Permalink
compcurve
Browse files Browse the repository at this point in the history
  • Loading branch information
EvenSol committed Nov 16, 2024
1 parent 1165af2 commit 1996323
Showing 1 changed file with 77 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
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.compressor.CompressorChart;
import neqsim.process.equipment.stream.Stream;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemPrEos;
import neqsim.thermo.system.SystemSrkEos;

public class CompressorChartTest {
Expand Down Expand Up @@ -178,4 +177,80 @@ void testSetHeadUnit() {
"neqsim.util.exception.InvalidInputException: CompressorChart:setHeadUnit - Input headUnit does not support value doesNotExist",
thrown.getMessage());
}

@Test
public void runCurveTest() {
SystemInterface testFluid = new SystemPrEos(273.15 + 30.0, 75.7);

testFluid.addComponent("nitrogen", 0.7);
testFluid.addComponent("CO2", 1.32);
testFluid.addComponent("methane", 88.0);
testFluid.addComponent("ethane", 4.76);
testFluid.addComponent("propane", 2.4);
testFluid.addComponent("i-butane", 0.3);
testFluid.addComponent("n-butane", 0.8);
testFluid.setMixingRule("classic");

testFluid.setTemperature(30.0, "C");
testFluid.setPressure(75.7, "bara");
testFluid.setTotalFlowRate(16.67, "MSm3/day");

Stream stream_1 = new Stream("Stream1", testFluid);
stream_1.run();

Compressor comp1 = new Compressor("compressor 1", stream_1);
comp1.setUsePolytropicCalc(true);
comp1.setSpeed(8765);

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

double[] speed = new double[] {7000, 7500, 8000, 8500, 9000, 9500, 10000, 10500};
double[][] flow = new double[][] {{4512.7, 5120.8, 5760.9, 6401, 6868.27},
{4862.47, 5486.57, 6172.39, 6858.21, 7550.89},
{5237.84, 5852.34, 6583.88, 7315.43, 8046.97, 8266.43},
{5642.94, 6218.11, 6995.38, 7772.64, 8549.9, 9000.72},
{6221.77, 6583.88, 7406.87, 8229.85, 9052.84, 9768.84},
{6888.85, 6949.65, 7818.36, 8687.07, 9555.77, 10424.5, 10546.1},
{7109.83, 7948.87, 8832.08, 9715.29, 10598.5, 10801.6},
{7598.9, 8229.85, 9144.28, 10058.7, 10973.1, 11338.9}};
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}};

comp1.getCompressorChart().setCurves(chartConditions, speed, flow, head, polyEff);
comp1.getCompressorChart().setHeadUnit("kJ/kg");

double[] surgeflow =
new double[] {4512.7, 4862.47, 5237.84, 5642.94, 6221.77, 6888.85, 7109.83, 7598.9, 8334.1};
double[] surgehead = new double[] {84512.7, 4862.47, 5237.84, 5642.94, 6221.77, 6888.85,
7109.83, 7598.9, 8334.1};
comp1.getCompressorChart().getSurgeCurve().setCurve(chartConditions, surgeflow, surgehead);
// comp1.getAntiSurge().setActive(true);
comp1.getAntiSurge().setSurgeControlFactor(1.1);

}

}

0 comments on commit 1996323

Please sign in to comment.