Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update #1183

Closed
wants to merge 8 commits into from
Closed

update #1183

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<version>${revision}${sha1}${changelist}</version>

<properties>
<revision>3.0.4</revision>
<revision>3.0.5</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sha1/>
Expand Down
2 changes: 1 addition & 1 deletion pomJava21.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<version>${revision}${sha1}${changelist}</version>

<properties>
<revision>3.0.4</revision>
<revision>3.0.5</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sha1/>
Expand Down
2 changes: 1 addition & 1 deletion pomJava8.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<version>${revision}${sha1}${changelist}-Java8</version>

<properties>
<revision>3.0.4</revision>
<revision>3.0.5</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sha1 />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ public double solve(double xin) {
xNew2 = xNew;
}

if (xNew < 0) {
xNew = 0;
if (xNew < -0.99) {
xNew = -0.99;
// System.out.println("x++...........");
}
if (xNew > 1.5) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ public double getRefComponentViscosity(double temp, double pres) {
visRefG = (1.0 - HTAN) / 2.0;
double viscRef3 = visRefG * Math.exp(viscRefK[0] + viscRefK[3] / temp) * (temp6 - 1.0);

System.out.println("ref visc2 " + viscRef2);
System.out.println("ref visc3 " + viscRef3);
// System.out.println("ref visc2 " + viscRef2);
// System.out.println("ref visc3 " + viscRef3);
double refVisc = (viscRefO + viscRef1 + viscRef2 + viscRef3) / 1.0e7;
// System.out.println("ref visc " + refVisc);
return refVisc;
Expand Down
50 changes: 37 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,22 @@ 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 if (type.equals("interpolate")) {
compressorChart = new CompressorChartAlternativeMapLookup();
} else if (type.equals("interpolate and extrapolate")) {
compressorChart = new CompressorChartAlternativeMapLookupExtrapolate();
} else {
compressorChart = new CompressorChart();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,23 @@ public void addCurve(double speed, double[] flow, double[] head, double[] polytr
chartValues.add(curve);
}

/** {@inheritDoc} */
/**
* {@inheritDoc}
*
* This method initializes the compressor performance curves, including speed, flow, head, and
* polytropic efficiency.
*
* <p>
* The method takes chart conditions and initializes internal variables for different performance
* parameters based on input arrays for speed, flow, head, and polytropic efficiency. It also
* normalizes these parameters by calculating reduced values based on speed.
*
* @param chartConditions An array of conditions used for the compressor chart. (Currently unused)
* @param speed An array representing the compressor speed values.
* @param flow A 2D array representing the flow rates at different speeds.
* @param head A 2D array representing the head values at different speeds.
* @param polyEff A 2D array representing the polytropic efficiency values at different speeds.
*/
@Override
public void setCurves(double[] chartConditions, double[] speed, double[][] flow, double[][] head,
double[][] polyEff) {
Expand All @@ -75,9 +91,16 @@ public void setCurves(double[] chartConditions, double[] speed, double[][] flow,
this.polytropicEfficiency = polyEff;
this.flow = flow;

this.redhead = new double[head.length][head[0].length];
this.redpolytropicEfficiency = new double[polyEff.length][polyEff[0].length];
this.redflow = new double[flow.length][flow[0].length];
// Dynamically initialize arrays based on the maximum length of flow, head, and polyEff
int maxLength = 0;
for (double[] f : flow) {
if (f.length > maxLength)
maxLength = f.length;
}

this.redhead = new double[head.length][maxLength];
this.redpolytropicEfficiency = new double[polyEff.length][maxLength];
this.redflow = new double[flow.length][maxLength];

for (int i = 0; i < speed.length; i++) {
if (speed[i] > maxSpeedCurve) {
Expand All @@ -88,7 +111,8 @@ public void setCurves(double[] chartConditions, double[] speed, double[][] flow,
}
CompressorCurve curve = new CompressorCurve(speed[i], flow[i], head[i], polyEff[i]);
chartValues.add(curve);
for (int j = 0; j < flow[i].length; j++) {

for (int j = 0; j < flow[i].length; j++) { // Handle differing lengths for each speed
redflow[i][j] = flow[i][j] / speed[i];
redpolytropicEfficiency[i][j] = polyEff[i][j];
redhead[i][j] = head[i][j] / speed[i] / speed[i];
Expand All @@ -98,6 +122,13 @@ public void setCurves(double[] chartConditions, double[] speed, double[][] flow,
// TODO: MLLU: not correct. speed[0] should be the requested speed
fanLawCorrectionFitter.add(speed[i] / speed[0], flow[i][j] / flowFanLaw);
}

// Fill remaining slots with default values (e.g., 0) if arrays are shorter
for (int j = flow[i].length; j < maxLength; j++) {
redflow[i][j] = 0;
redpolytropicEfficiency[i][j] = 0;
redhead[i][j] = 0;
}
}

referenceSpeed = (maxSpeedCurve + minSpeedCurve) / 2.0;
Expand Down
Loading