Class CompressorChartAlternativeMapLookup
- All Implemented Interfaces:
Serializable, Cloneable, CompressorChartInterface
- Direct Known Subclasses:
CompressorChartAlternativeMapLookupExtrapolate
CompressorChartAlternativeMapLookup class.
- Version:
- $Id: $Id
- Author:
- asmund
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) double[](package private) org.apache.commons.math3.analysis.polynomials.PolynomialFunction(package private) doubleprivate String(package private) boolean(package private) boolean(package private) static org.apache.logging.log4j.LoggerLogger object for class.(package private) org.apache.commons.math3.analysis.polynomials.PolynomialFunction(package private) org.apache.commons.math3.analysis.polynomials.PolynomialFunction(package private) double(package private) double(package private) double(package private) double(package private) doubleprivate static final longSerialization version UID.private booleanprivate booleanFields inherited from class CompressorChart
chartSpeeds, chartValues, fanLawCorrectionFitter, flow, flowPolytropicEfficiency, head, maxSpeedCurve, minSpeedCurve, polytropicEfficiency, redflow, redflowPolytropicEfficiency, redhead, redpolytropicEfficiency, reducedFlowFitter, reducedHeadFitter, reducedPolytropicEfficiencyFitter, speed, stoneWallCurve, surgeCurve -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for CompressorChartAlternativeMapLookup. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCurve(double speed, double[] flow, double[] head, double[] polytropicEfficiency) This method is used add a curve to the CompressorChart object.voidaddCurve(double speed, double[] flow, double[] head, double[] flowPolytropicEfficiency, double[] polytropicEfficiency) This method is used add a curve to the CompressorChart object.voidaddSurgeCurve(double[] flow, double[] head) addSurgeCurve.static intbisect_left(Double[] A, double x) bisect_left.static intbisect_left(Double[] A, double x, int lo, int hi) bisect_left.booleancheckStoneWall(double flow, double speed) checkStoneWall.booleancheckSurge1(double flow, double head) checkSurge1.booleancheckSurge2(double flow, double speed) checkSurge2.double[]Get the chart conditions (e.g., reference molecular weight).getChartValues.getClosestRefSpeeds(double speed) getClosestRefSpeeds.getCurveAtRefSpeed(double refSpeed) getCurveAtRefSpeed.doublegetFlow(double head, double speed, double guessFlow) getFlow.double[][]getFlows()Get the flow values for all compressor curves.doubleGetter for the fieldgearRatio.double[][]getHeads()Get the head values for all compressor curves.get the selected unit of head.doubleGetter for the fieldmaxSpeedCurve.doubleGetter for the fieldminSpeedCurve.double[][]Get the polytropic efficiency values for all compressor curves.doublegetPolytropicEfficiency(double flow, double speed) Get method for polytropic efficiency from reference curves.doublegetPolytropicHead(double flow, double speed) Get method for polytropic head from reference curves.intgetSpeed(double flow, double head) getSpeed.double[]Get the speed values for all compressor curves.doublegetSpeedValue(double flow, double head) Calculate the speed required to achieve a given head at a given flow rate.getStoneWallCurve.getSurgeCurve.booleanChecks if set to use compressor chart for compressor calculations (chart is set for compressor).static voidmain.voidplot()plot.doublepolytropicEfficiency(double flow, double speed) polytropicEfficiency.voidPretty print all CompressorCurve objects in chartValues.voidsetCurves(double[] chartConditions, double[] speed, double[][] flow, double[][] head, double[][] polyEff) This method is used add a set of curves to the CompressorChart object.voidsetCurves(double[] chartConditions, double[] speed, double[][] flow, double[][] head, double[][] flowPolyEff, double[][] polyEff) This method is used add a set of curves to the CompressorChart object.voidsetGearRatio(double GR) Setter for the fieldgearRatio.voidsetHeadUnit(String headUnit) set unit of head.voidsetReferenceConditions(double refMW, double refTemperature, double refPressure, double refZ) Set method for the reference conditions of the compressor chart.voidsetStoneWallCurve(StoneWallCurve stoneWallCurve) setStoneWallCurve.voidsetSurgeCurve(SafeSplineSurgeCurve surgeCurve) setSurgeCurve.voidsetUseCompressorChart(boolean useCompressorChart) Set compressor calculations to use compressor chart.voidsetUseRealKappa(boolean useRealKappa) set method for kappa setting. true = real kappa is used, false = ideal kappa is usedbooleanget method for kappa setting. true = real kappa is used, false = ideal kappa is usedMethods inherited from class CompressorChart
equals, fitReducedCurve, generateStoneWallCurve, generateSurgeCurve, getDischargeTemperatures, getGamma, getInletPressure, getInletTemperature, getPolytropicExponent, getPowers, getPressureRatios, getReferenceDensity, getStoneWallFlowAtSpeed, getStoneWallHeadAtSpeed, getSurgeFlowAtSpeed, getSurgeHeadAtSpeed, hashCode, setGamma, setInletPressure, setInletTemperature, setMaxSpeedCurve, setMinSpeedCurve, setPolytropicExponent, setReferenceDensityMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface CompressorChartInterface
equals, generateStoneWallCurve, generateSurgeCurve, getDischargeTemperatures, getGamma, getInletPressure, getInletStream, getInletTemperature, getOperatingMW, getPolytropicExponent, getPowers, getPressureRatios, getRatioToMaxSpeed, getRatioToMinSpeed, getReferenceDensity, getStoneWallFlowAtSpeed, getStoneWallHeadAtSpeed, getSurgeFlowAtSpeed, getSurgeHeadAtSpeed, hashCode, isHigherThanMaxSpeed, isLowerThanMinSpeed, isSpeedWithinRange, setGamma, setInletPressure, setInletStream, setInletTemperature, setOperatingMW, setPolytropicExponent, setReferenceDensity
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialization version UID.- See Also:
-
logger
static org.apache.logging.log4j.Logger loggerLogger object for class. -
isSurge
boolean isSurge -
isStoneWall
boolean isStoneWall -
refMW
double refMW -
headUnit
-
useCompressorChart
private boolean useCompressorChart -
refTemperature
double refTemperature -
refPressure
double refPressure -
referenceSpeed
double referenceSpeed -
refZ
double refZ -
useRealKappa
private boolean useRealKappa -
chartConditions
double[] chartConditions -
reducedHeadFitterFunc
org.apache.commons.math3.analysis.polynomials.PolynomialFunction reducedHeadFitterFunc -
reducedPolytropicEfficiencyFunc
org.apache.commons.math3.analysis.polynomials.PolynomialFunction reducedPolytropicEfficiencyFunc -
fanLawCorrectionFunc
org.apache.commons.math3.analysis.polynomials.PolynomialFunction fanLawCorrectionFunc -
gearRatio
double gearRatio
-
-
Constructor Details
-
CompressorChartAlternativeMapLookup
public CompressorChartAlternativeMapLookup()Constructor for CompressorChartAlternativeMapLookup.
-
-
Method Details
-
addCurve
public void addCurve(double speed, double[] flow, double[] head, double[] polytropicEfficiency) This method is used add a curve to the CompressorChart object.- Specified by:
addCurvein interfaceCompressorChartInterface- Overrides:
addCurvein classCompressorChart- Parameters:
speed- a doubleflow- an array of type doublehead- an array of type doublepolytropicEfficiency- an array of type double
-
addCurve
public void addCurve(double speed, double[] flow, double[] head, double[] flowPolytropicEfficiency, double[] polytropicEfficiency) This method is used add a curve to the CompressorChart object.- Specified by:
addCurvein interfaceCompressorChartInterface- Overrides:
addCurvein classCompressorChart- Parameters:
speed- a doubleflow- an array of type doublehead- an array of type doubleflowPolytropicEfficiency- an array of type doublepolytropicEfficiency- an array of type double
-
setCurves
public void setCurves(double[] chartConditions, double[] speed, double[][] flow, double[][] head, double[][] polyEff) This method is used add a set of curves to the CompressorChart object.This method initializes the compressor performance curves, including speed, flow, head, and polytropic efficiency.
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.
Sets the compressor curves based on the provided chart conditions, speed, flow, head, and polytropic efficiency values.
- Specified by:
setCurvesin interfaceCompressorChartInterface- Overrides:
setCurvesin classCompressorChart- Parameters:
chartConditions- an array of type doublespeed- an array of type doubleflow- an array of type doublehead- an array of type doublepolyEff- an array of type double
-
setCurves
public void setCurves(double[] chartConditions, double[] speed, double[][] flow, double[][] head, double[][] flowPolyEff, double[][] polyEff) This method is used add a set of curves to the CompressorChart object.This method initializes the compressor performance curves, including speed, flow, head, and polytropic efficiency.
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.
Sets the compressor curves based on the provided chart conditions, speed, flow, head, flowPolytrpicEfficiency and polytropic efficiency values.
- Specified by:
setCurvesin interfaceCompressorChartInterface- Overrides:
setCurvesin classCompressorChart- Parameters:
chartConditions- an array of type doublespeed- an array of type doubleflow- an array of type doublehead- an array of type doubleflowPolyEff- an array of type doublepolyEff- an array of type double
-
getClosestRefSpeeds
getClosestRefSpeeds.
Retrieves the closest reference speeds to the given speed from the compressor chart values. The method returns a list containing one or two speeds: - If the given speed matches a reference speed, the list contains only that speed. - If the given speed is between two reference speeds, the list contains both speeds. - If the given speed is less than the lowest reference speed, the list contains the lowest reference speed. - If the given speed is greater than the highest reference speed, the list contains the highest reference speed.
- Parameters:
speed- the speed to find the closest reference speeds for- Returns:
- a
ArrayListof the closest reference speeds
-
getPolytropicHead
public double getPolytropicHead(double flow, double speed) Get method for polytropic head from reference curves.This method interpolates the polytropic head values from reference speeds closest to the given speed and averages them to estimate the polytropic head at the specified flow and speed.
- Specified by:
getPolytropicHeadin interfaceCompressorChartInterface- Overrides:
getPolytropicHeadin classCompressorChart- Parameters:
flow- [m3/h], speed in [rpm].speed- a double- Returns:
- polytropic head in unit [getHeadUnit]
-
getPolytropicEfficiency
public double getPolytropicEfficiency(double flow, double speed) Get method for polytropic efficiency from reference curves.Calculates the polytropic efficiency of the compressor for a given flow and speed. The method interpolates the efficiency values from reference speed curves and averages them to estimate the efficiency at the specified conditions.
- Specified by:
getPolytropicEfficiencyin interfaceCompressorChartInterface- Overrides:
getPolytropicEfficiencyin classCompressorChart- Parameters:
flow- [m3/h], speed in [rpm].speed- a double- Returns:
- polytropic efficiency [%].
-
addSurgeCurve
public void addSurgeCurve(double[] flow, double[] head) addSurgeCurve.
- Overrides:
addSurgeCurvein classCompressorChart- Parameters:
flow- an array of type doublehead- an array of type double
-
getCurveAtRefSpeed
getCurveAtRefSpeed.
- Parameters:
refSpeed- a double- Returns:
- a
CompressorCurveobject
-
getGearRatio
public double getGearRatio()Getter for the field
gearRatio.- Returns:
- a double
-
setGearRatio
public void setGearRatio(double GR) Setter for the field
gearRatio.- Parameters:
GR- a double
-
polytropicEfficiency
public double polytropicEfficiency(double flow, double speed) polytropicEfficiency.
- Overrides:
polytropicEfficiencyin classCompressorChart- Parameters:
flow- a doublespeed- a double- Returns:
- a double
-
getSpeed
public int getSpeed(double flow, double head) getSpeed.
- Specified by:
getSpeedin interfaceCompressorChartInterface- Overrides:
getSpeedin classCompressorChart- Parameters:
flow- a doublehead- a double- Returns:
- a int
-
getSpeedValue
public double getSpeedValue(double flow, double head) Calculate the speed required to achieve a given head at a given flow rate.This method uses a robust Newton-Raphson algorithm with fan-law based initial guess, bounds protection, damped updates, and bisection fallback for reliable convergence both within and outside the defined speed curve range.
- Specified by:
getSpeedValuein interfaceCompressorChartInterface- Overrides:
getSpeedValuein classCompressorChart- Parameters:
flow- the volumetric flow rate in m³/hrhead- the required polytropic head in the chart's head unit (kJ/kg or meter)- Returns:
- the calculated speed in RPM (as double for precision)
-
checkSurge1
public boolean checkSurge1(double flow, double head) checkSurge1.
checkSurge1.
- Overrides:
checkSurge1in classCompressorChart- Parameters:
flow- a doublehead- a double- Returns:
- a boolean
-
checkSurge2
public boolean checkSurge2(double flow, double speed) checkSurge2.
checkSurge2.
- Overrides:
checkSurge2in classCompressorChart- Parameters:
flow- a doublespeed- a double- Returns:
- a boolean
-
checkStoneWall
public boolean checkStoneWall(double flow, double speed) checkStoneWall.
checkStoneWall.
- Overrides:
checkStoneWallin classCompressorChart- Parameters:
flow- a doublespeed- a double- Returns:
- a boolean
-
setReferenceConditions
public void setReferenceConditions(double refMW, double refTemperature, double refPressure, double refZ) Set method for the reference conditions of the compressor chart.- Specified by:
setReferenceConditionsin interfaceCompressorChartInterface- Overrides:
setReferenceConditionsin classCompressorChart- Parameters:
refMW- a doublerefTemperature- a doublerefPressure- a doublerefZ- a double
-
getSurgeCurve
getSurgeCurve.
- Specified by:
getSurgeCurvein interfaceCompressorChartInterface- Overrides:
getSurgeCurvein classCompressorChart- Returns:
- a
SafeSplineSurgeCurveobject
-
setSurgeCurve
setSurgeCurve.
- Specified by:
setSurgeCurvein interfaceCompressorChartInterface- Overrides:
setSurgeCurvein classCompressorChart- Parameters:
surgeCurve- aSafeSplineSurgeCurveobject
-
getStoneWallCurve
getStoneWallCurve.
- Specified by:
getStoneWallCurvein interfaceCompressorChartInterface- Overrides:
getStoneWallCurvein classCompressorChart- Returns:
- a
StoneWallCurveobject
-
setStoneWallCurve
setStoneWallCurve.
- Specified by:
setStoneWallCurvein interfaceCompressorChartInterface- Overrides:
setStoneWallCurvein classCompressorChart- Parameters:
stoneWallCurve- aStoneWallCurveobject
-
main
-
isUseCompressorChart
public boolean isUseCompressorChart()Checks if set to use compressor chart for compressor calculations (chart is set for compressor).- Specified by:
isUseCompressorChartin interfaceCompressorChartInterface- Overrides:
isUseCompressorChartin classCompressorChart- Returns:
- a boolean
-
setUseCompressorChart
public void setUseCompressorChart(boolean useCompressorChart) Set compressor calculations to use compressor chart.- Specified by:
setUseCompressorChartin interfaceCompressorChartInterface- Overrides:
setUseCompressorChartin classCompressorChart- Parameters:
useCompressorChart- a boolean
-
getHeadUnit
get the selected unit of head.- Specified by:
getHeadUnitin interfaceCompressorChartInterface- Overrides:
getHeadUnitin classCompressorChart- Returns:
- unit of head
-
setHeadUnit
set unit of head.- Specified by:
setHeadUnitin interfaceCompressorChartInterface- Overrides:
setHeadUnitin classCompressorChart- Parameters:
headUnit- aStringobject
-
useRealKappa
public boolean useRealKappa()get method for kappa setting. true = real kappa is used, false = ideal kappa is used- Specified by:
useRealKappain interfaceCompressorChartInterface- Overrides:
useRealKappain classCompressorChart- Returns:
- true/false flag
-
setUseRealKappa
public void setUseRealKappa(boolean useRealKappa) set method for kappa setting. true = real kappa is used, false = ideal kappa is used- Specified by:
setUseRealKappain interfaceCompressorChartInterface- Overrides:
setUseRealKappain classCompressorChart- Parameters:
useRealKappa- a boolean
-
bisect_left
-
bisect_left
-
plot
public void plot()plot.
- Specified by:
plotin interfaceCompressorChartInterface- Overrides:
plotin classCompressorChart
-
getFlow
public double getFlow(double head, double speed, double guessFlow) getFlow.
- Specified by:
getFlowin interfaceCompressorChartInterface- Overrides:
getFlowin classCompressorChart- Parameters:
head- a doublespeed- a doubleguessFlow- a double- Returns:
- a double
-
getMinSpeedCurve
public double getMinSpeedCurve()Getter for the field
minSpeedCurve.- Specified by:
getMinSpeedCurvein interfaceCompressorChartInterface- Overrides:
getMinSpeedCurvein classCompressorChart- Returns:
- the minimum speed curve value in RPM
-
getMaxSpeedCurve
public double getMaxSpeedCurve()Getter for the field
maxSpeedCurve.- Specified by:
getMaxSpeedCurvein interfaceCompressorChartInterface- Overrides:
getMaxSpeedCurvein classCompressorChart- Returns:
- a double
-
prettyPrintChartValues
public void prettyPrintChartValues()Pretty print all CompressorCurve objects in chartValues. -
getChartValues
-
getSpeeds
public double[] getSpeeds()Get the speed values for all compressor curves.Returns the speed values from the chartValues curves.
- Specified by:
getSpeedsin interfaceCompressorChartInterface- Overrides:
getSpeedsin classCompressorChart- Returns:
- an array of speed values in RPM, or null if not set
-
getFlows
public double[][] getFlows()Get the flow values for all compressor curves.Returns the flow values from the chartValues curves.
- Specified by:
getFlowsin interfaceCompressorChartInterface- Overrides:
getFlowsin classCompressorChart- Returns:
- a 2D array where each row corresponds to a speed and contains flow values in m3/hr, or null if not set
-
getHeads
public double[][] getHeads()Get the head values for all compressor curves.Returns the head values from the chartValues curves.
- Specified by:
getHeadsin interfaceCompressorChartInterface- Overrides:
getHeadsin classCompressorChart- Returns:
- a 2D array where each row corresponds to a speed and contains head values in the unit specified by getHeadUnit(), or null if not set
-
getPolytropicEfficiencies
public double[][] getPolytropicEfficiencies()Get the polytropic efficiency values for all compressor curves.Returns the polytropic efficiency values from the chartValues curves.
- Specified by:
getPolytropicEfficienciesin interfaceCompressorChartInterface- Overrides:
getPolytropicEfficienciesin classCompressorChart- Returns:
- a 2D array where each row corresponds to a speed and contains polytropic efficiency values in %, or null if not set
-
getChartConditions
public double[] getChartConditions()Get the chart conditions (e.g., reference molecular weight).Returns the chart conditions.
- Specified by:
getChartConditionsin interfaceCompressorChartInterface- Overrides:
getChartConditionsin classCompressorChart- Returns:
- an array of chart condition values, or null if not set
-