Skip to content

Commit

Permalink
update model
Browse files Browse the repository at this point in the history
  • Loading branch information
EvenSol committed Nov 17, 2024
1 parent 8d01ca8 commit b95f5b4
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 53 deletions.
46 changes: 33 additions & 13 deletions src/main/java/neqsim/process/equipment/compressor/Compressor.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ public Compressor(String name) {
* </p>
*
* @param name a {@link java.lang.String} object
* @param inletStream a {@link neqsim.process.equipment.stream.StreamInterface}
* object
* @param inletStream a {@link neqsim.process.equipment.stream.StreamInterface} object
*/
public Compressor(String name, StreamInterface inletStream) {
this(name);
Expand Down Expand Up @@ -926,8 +925,7 @@ public SystemInterface getThermoSystem() {
* Getter for the field <code>compressorChart</code>.
* </p>
*
* @return a {@link neqsim.process.equipment.compressor.CompressorChartInterface}
* object
* @return a {@link neqsim.process.equipment.compressor.CompressorChartInterface} object
*/
public CompressorChartInterface getCompressorChart() {
return compressorChart;
Expand All @@ -938,8 +936,7 @@ public CompressorChartInterface getCompressorChart() {
* Setter for the field <code>compressorChart</code>.
* </p>
*
* @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;
Expand Down Expand Up @@ -972,6 +969,19 @@ public double getDistanceToSurge() {
/ getCompressorChart().getSurgeCurve().getSurgeFlow(getPolytropicFluidHead()) - 1;
}

/** {@inheritDoc} */
@Override
public double getSurgeFlowRateMargin() {
return getInletStream().getFlowRate("m3/hr")
- getCompressorChart().getSurgeCurve().getSurgeFlow(getPolytropicFluidHead());
}

/** {@inheritDoc} */
@Override
public double getSurgeFlowRate() {
return getCompressorChart().getSurgeCurve().getSurgeFlow(getPolytropicFluidHead());
}

/**
* <p>
* isStoneWall.
Expand All @@ -990,8 +1000,7 @@ public boolean isStoneWall(double flow, double head) {
* Setter for the field <code>antiSurge</code>.
* </p>
*
* @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;
Expand Down Expand Up @@ -1252,9 +1261,7 @@ public void setUseGERG2008(boolean useGERG2008) {
* Getter for the field <code>propertyProfile</code>.
* </p>
*
* @return a
* {@link neqsim.process.equipment.compressor.CompressorPropertyProfile}
* object
* @return a {@link neqsim.process.equipment.compressor.CompressorPropertyProfile} object
*/
public CompressorPropertyProfile getPropertyProfile() {
return propertyProfile;
Expand All @@ -1265,8 +1272,7 @@ public CompressorPropertyProfile getPropertyProfile() {
* Setter for the field <code>propertyProfile</code>.
* </p>
*
* @param propertyProfile a
* {@link neqsim.process.equipment.compressor.CompressorPropertyProfile}
* @param propertyProfile a {@link neqsim.process.equipment.compressor.CompressorPropertyProfile}
* object
*/
public void setPropertyProfile(CompressorPropertyProfile propertyProfile) {
Expand Down Expand Up @@ -1459,4 +1465,18 @@ public void setIsSetMaxOutletPressure(boolean isSetMaxOutletPressure) {
public double getActualCompressionRatio() {
return actualCompressionRatio;
}

/**
* <p>
* Set CompressorChartType
* </p>
*
*/
public void setCompressorChartType(String type) {
if (type.equals("simple")) {
compressorChart = new CompressorChart();
} else {
compressorChart = new CompressorChartAlternativeMapLookup();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,37 +73,73 @@ public interface CompressorInterface extends ProcessEquipmentInterface, TwoPortI
public AntiSurge getAntiSurge();

/**
* <p>getDistanceToSurge.</p>
* <p>
* getDistanceToSurge.
* </p>
*
* @return a double
*/
public double getDistanceToSurge();

/**
* <p>setMaximumSpeed.</p>
* <p>
* setMaximumSpeed.
* </p>
*
* @param maxSpeed a double
*/
public void setMaximumSpeed(double maxSpeed);

/**
* <p>setMinimumSpeed.</p>
* <p>
* setMinimumSpeed.
* </p>
*
* @param minspeed a double
*/
public void setMinimumSpeed(double minspeed);

/**
* <p>getMaximumSpeed.</p>
* <p>
* getMaximumSpeed.
* </p>
*
* @return a double
*/
public double getMaximumSpeed();

/**
* <p>getMinimumSpeed.</p>
* <p>
* getMinimumSpeed.
* </p>
*
* @return a double
*/
public double getMinimumSpeed();

/**
* <p>
* getSurgeFlowRateMargin.
* </p>
*
* @return a double
*/
public double getSurgeFlowRateMargin();

/**
* <p>
* getSurgeFlowRate.
* </p>
*
* @return a double
*/
public double getSurgeFlowRate();

/**
* <p>
* Set CompressorChartType
* </p>
*
*/
public void setCompressorChartType(String type);
}
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,19 @@ void testSetHeadUnit() {

@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);
SystemInterface testFluid = new SystemPrEos(273.15 + 29.96, 75.7);

testFluid.addComponent("nitrogen", 0.7823);
testFluid.addComponent("CO2", 1.245);
testFluid.addComponent("methane", 88.4681);
testFluid.addComponent("ethane", 4.7652);
testFluid.addComponent("propane", 2.3669);
testFluid.addComponent("i-butane", 0.845);
testFluid.addComponent("n-butane", 0.873);
testFluid.addComponent("i-pentane", 0.0243);
testFluid.addComponent("n-pentane", 0.02947);
testFluid.addComponent("n-hexane", 0.024);
testFluid.addComponent("n-heptane", 0.01735);
testFluid.setMixingRule("classic");

testFluid.setTemperature(30.0, "C");
Expand All @@ -199,12 +203,14 @@ public void runCurveTest() {
stream_1.run();

Compressor comp1 = new Compressor("compressor 1", stream_1);
comp1.setCompressorChartType("interpolate");
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, 9659, 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},
Expand All @@ -214,43 +220,43 @@ public void runCurveTest() {
{7109.83, 7948.87, 8832.08, 9715.29, 10598.5, 10801.6},
{7598.9, 8229.85, 9144.28, 10058.7, 10973.1, 11338.9},
{8334.1, 8641.35, 9601.5, 10561.6, 11521.8, 11963.5}};
double[][] head = new double[][] {{61.885, 59.639, 56.433, 52.481, 49.132},

{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[][] {{61.885, 59.639, 56.433, 52.481, 49.132},
{71.416, 69.079, 65.589, 61.216, 55.858}, {81.621, 79.311, 75.545, 70.727, 64.867, 62.879,},
{92.493, 90.312, 86.3, 81.079, 74.658, 70.216},
{103.512, 102.073, 97.83, 92.254, 85.292, 77.638},
{114.891, 114.632, 110.169, 104.221, 96.727, 87.002, 85.262},
{118.595, 114.252, 108.203, 100.55, 90.532, 87.54},
{126.747, 123.376, 117.113, 109.056, 98.369, 92.632},
{139.082, 137.398, 130.867, 122.264, 110.548, 103.247},};
double[][] polyEff = new double[][] {{78.3, 78.2, 77.2, 75.4, 73.4},

{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}};
{78.3, 78.3, 77.5, 75.8, 73}, {78.2, 78.4, 77.7, 76.1, 73.5, 72.5},
{78.2, 78.4, 77.9, 76.4, 74, 71.9}, {78.3, 78.4, 78, 76.7, 74.5, 71.2},
{78.3, 78.4, 78.1, 77, 74.9, 71.3, 70.5}, {78.4, 78.1, 77.1, 75, 71.4, 70.2},
{78.3, 78.2, 77.2, 75.2, 71.7, 69.5}, {78.2, 78.2, 77.3, 75.5, 72.2, 69.6}};

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};
new double[] {4512.7, 4862.47, 5237.84, 5642.94, 6221.77, 6888.85, 7109.83, 7598.9};
double[] surgehead =
new double[] {61.885, 71.416, 81.621, 92.493, 103.512, 114.891, 118.595, 126.747};
comp1.getCompressorChart().getSurgeCurve().setCurve(chartConditions, surgeflow, surgehead);
// comp1.getAntiSurge().setActive(true);
comp1.getAntiSurge().setSurgeControlFactor(1.1);
comp1.getAntiSurge().setSurgeControlFactor(1.0);
comp1.run();

System.out.println("speed " + comp1.getSpeed());
System.out.println("out pres " + comp1.getOutletPressure());
System.out.println("out temp " + (comp1.getOutTemperature() - 273.15));
System.out.println("feed flow " + (comp1.getInletStream().getFlowRate("m3/hr")));
System.out.println("polytropic head " + comp1.getPolytropicFluidHead());
System.out.println("polytropic efficiency " + comp1.getPolytropicEfficiency());
System.out.println("dist to surge " + comp1.getDistanceToSurge());
System.out.println("surge flow rate margin " + comp1.getSurgeFlowRateMargin());
System.out.println("surge flow rate " + comp1.getSurgeFlowRate());
}

}

0 comments on commit b95f5b4

Please sign in to comment.