Class CompressorChartMWInterpolation
- All Implemented Interfaces:
Serializable, Cloneable, CompressorChartInterface
This class allows storing multiple compressor maps, each measured at a different molecular weight (or gas composition), and interpolates between them based on the actual operating molecular weight.
Use case: When compressor maps are measured at several discrete MW values (e.g., 18, 20, 22 g/mol), this class interpolates the performance parameters (head, efficiency) for an actual MW that falls between the measured values.
Interpolation method: Linear interpolation between the two nearest MW maps. Extrapolation uses the nearest boundary map.
- Version:
- 1.0
- Author:
- NeqSim Development Team
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classInternal class to hold interpolation indices and fraction. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanFlag to allow extrapolation outside the MW range.private booleanFlag to auto-generate stone wall curves when maps are added.private booleanFlag to auto-generate surge curves when maps are added.private StreamInterfaceReference to inlet stream for automatic MW detection.private booleanFlag indicating if interpolation is needed.private static final org.apache.logging.log4j.LoggerLogger object for class.private List<CompressorChart> List of compressor charts corresponding to each MW.List of MW values for which maps are defined, sorted in ascending order.private doubleCurrent operating molecular weight for interpolation.private static final longSerialization version UID.private booleanFlag to automatically use the inlet stream's molecular weight.Fields inherited from class CompressorChart
chartConditions, chartSpeeds, chartValues, fanLawCorrectionFitter, fanLawCorrectionFunc, flow, flowPolytropicEfficiency, head, isStoneWall, isSurge, maxSpeedCurve, minSpeedCurve, polytropicEfficiency, redflow, redflowPolytropicEfficiency, redhead, redpolytropicEfficiency, reducedFlowFitter, reducedHeadFitter, reducedHeadFitterFunc, reducedPolytropicEfficiencyFitter, reducedPolytropicEfficiencyFunc, referenceSpeed, refMW, refPressure, refTemperature, refZ, speed, stoneWallCurve, surgeCurve -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for CompressorChartMWInterpolation. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMapAtMW(double molecularWeight, double[] speed, double[][] flow, double[][] head, double[][] polyEff) Add a multi-speed compressor map at a specific molecular weight.voidaddMapAtMW(double molecularWeight, double[] speed, double[][] flow, double[][] head, double[][] flowPolyEff, double[][] polyEff) Add a multi-speed compressor map at a specific molecular weight with separate flow arrays.voidaddMapAtMW(double molecularWeight, double[] chartConditions, double[] speed, double[][] flow, double[][] head, double[][] polyEff) Add a compressor map at a specific molecular weight.voidaddMapAtMW(double molecularWeight, double[] chartConditions, double[] speed, double[][] flow, double[][] head, double[][] flowPolyEff, double[][] polyEff) Add a compressor map at a specific molecular weight.voidaddMapAtMW(double molecularWeight, double speed, double[] flow, double[] head, double[] polyEff) Add a single-speed compressor map at a specific molecular weight.voidaddMapAtMW(double molecularWeight, double speed, double[] flow, double[] head, double[] flowPolyEff, double[] polyEff) Add a single-speed compressor map at a specific molecular weight with separate flow arrays.findInterpolationIndices(double mw) Find the two nearest MW maps and their interpolation weight.private intfindMapIndex(double molecularWeight) Find the index of a map by molecular weight.voidGenerate stone wall curves for all MW maps.voidGenerate surge curves for all MW maps.getChartAtMW(double molecularWeight) Get the chart at a specific MW.doublegetDistanceToStoneWall(double head, double flow) Get the distance to stone wall as a ratio, using interpolated stone wall curve.doublegetDistanceToSurge(double head, double flow) Get the distance to surge as a ratio, using interpolated surge curve.Get the inlet stream reference.Get the list of molecular weights for which maps are defined.intGet the number of MW maps defined.doubleGet the operating molecular weight.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.doublegetStoneWallFlow(double head) Get interpolated stone wall flow at a given head.doublegetStoneWallFlowAtSpeed(double speed) Get the stone wall flow at a specific speed, interpolated between MW maps.doublegetStoneWallHeadAtSpeed(double speed) Get the stone wall head at a specific speed, interpolated between MW maps.doublegetSurgeFlow(double head) Get interpolated surge flow at a given head.doublegetSurgeFlowAtSpeed(double speed) Get the surge flow at a specific speed, interpolated between MW maps.doublegetSurgeHeadAtSpeed(double speed) Get the surge head at a specific speed, interpolated between MW maps.booleanCheck if extrapolation outside the MW range is allowed.booleanCheck if auto-generation of stone wall curves is enabled.booleanCheck if auto-generation of surge curves is enabled.booleanCheck if MW interpolation is enabled.booleanisStoneWall(double head, double flow) Check if operating point is at stone wall (choke), using interpolated stone wall curve.booleanisSurge(double head, double flow) Check if operating point is in surge, using interpolated surge curve.booleanCheck if automatic MW detection from inlet stream is enabled.private doublelinearInterpolate(double valueLower, double valueUpper, double fraction) Linear interpolation between two values.voidsetAllowExtrapolation(boolean allow) Enable or disable extrapolation outside the MW range.voidsetAutoGenerateStoneWallCurves(boolean autoGenerate) Enable auto-generation of stone wall curves when maps are added.voidsetAutoGenerateSurgeCurves(boolean autoGenerate) Enable auto-generation of surge curves when maps are added.voidsetHeadUnit(String headUnit) Set the head unit for all maps.voidsetInletStream(StreamInterface stream) Set the inlet stream reference for automatic MW detection.voidsetInterpolationEnabled(boolean enabled) Enable or disable MW interpolation.voidsetOperatingMW(double mw) Set the operating molecular weight for interpolation.voidsetStoneWallCurveAtMW(double molecularWeight, double[] chartConditions, double[] stoneWallFlow, double[] stoneWallHead) Set stone wall curve for a specific MW map.voidsetSurgeCurveAtMW(double molecularWeight, double[] chartConditions, double[] surgeFlow, double[] surgeHead) Set surge curve for a specific MW map.voidsetUseActualMW(boolean useActual) Set whether to automatically use the inlet stream's molecular weight.private voidUpdate the operating MW from the inlet stream's fluid.Methods inherited from class CompressorChart
addCurve, addCurve, addSurgeCurve, checkStoneWall, checkSurge1, checkSurge2, equals, fitReducedCurve, generateStoneWallCurve, generateSurgeCurve, getChartConditions, getDischargeTemperatures, getFlow, getFlows, getGamma, getHeads, getHeadUnit, getInletPressure, getInletTemperature, getMaxSpeedCurve, getMinSpeedCurve, getPolytropicEfficiencies, getPolytropicExponent, getPowers, getPressureRatios, getReferenceDensity, getSpeed, getSpeeds, getSpeedValue, getStoneWallCurve, getSurgeCurve, hashCode, isUseCompressorChart, plot, polytropicEfficiency, setCurves, setCurves, setGamma, setInletPressure, setInletTemperature, setMaxSpeedCurve, setMinSpeedCurve, setPolytropicExponent, setReferenceConditions, setReferenceDensity, setStoneWallCurve, setSurgeCurve, setUseCompressorChart, setUseRealKappa, useRealKappaMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface CompressorChartInterface
getRatioToMaxSpeed, getRatioToMinSpeed, isHigherThanMaxSpeed, isLowerThanMinSpeed, isSpeedWithinRange
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialization version UID.- See Also:
-
logger
private static final org.apache.logging.log4j.Logger loggerLogger object for class. -
mapMolecularWeights
-
mapCharts
List of compressor charts corresponding to each MW. -
operatingMW
private double operatingMWCurrent operating molecular weight for interpolation. -
interpolationEnabled
private boolean interpolationEnabledFlag indicating if interpolation is needed. -
autoGenerateSurgeCurves
private boolean autoGenerateSurgeCurvesFlag to auto-generate surge curves when maps are added. -
autoGenerateStoneWallCurves
private boolean autoGenerateStoneWallCurvesFlag to auto-generate stone wall curves when maps are added. -
allowExtrapolation
private boolean allowExtrapolationFlag to allow extrapolation outside the MW range. -
useActualMW
private boolean useActualMWFlag to automatically use the inlet stream's molecular weight. -
inletStream
Reference to inlet stream for automatic MW detection.
-
-
Constructor Details
-
CompressorChartMWInterpolation
public CompressorChartMWInterpolation()Default constructor for CompressorChartMWInterpolation.
-
-
Method Details
-
addMapAtMW
public void addMapAtMW(double molecularWeight, double[] chartConditions, double[] speed, double[][] flow, double[][] head, double[][] polyEff) Add a compressor map at a specific molecular weight.Multiple maps can be added at different MW values. The maps are stored sorted by MW.
- Parameters:
molecularWeight- the molecular weight (g/mol) at which this map was measuredchartConditions- reference conditions [temp °C, pres bara, density kg/m³, MW g/mol]speed- array of speed values (RPM)flow- 2D array of flow values for each speed curve (m³/hr)head- 2D array of head values for each speed curve (kJ/kg or meter)polyEff- 2D array of polytropic efficiency values for each speed curve (%)
-
addMapAtMW
public void addMapAtMW(double molecularWeight, double[] speed, double[][] flow, double[][] head, double[][] polyEff) Add a multi-speed compressor map at a specific molecular weight.Convenience method without chartConditions - uses default conditions based on MW.
- Parameters:
molecularWeight- the molecular weight (g/mol) at which this map was measuredspeed- array of speed values (RPM)flow- 2D array of flow values for each speed curve (m³/hr)head- 2D array of head values for each speed curve (kJ/kg or meter)polyEff- 2D array of polytropic efficiency values for each speed curve (%)
-
addMapAtMW
public void addMapAtMW(double molecularWeight, double[] speed, double[][] flow, double[][] head, double[][] flowPolyEff, double[][] polyEff) Add a multi-speed compressor map at a specific molecular weight with separate flow arrays.Convenience method without chartConditions - uses default conditions based on MW.
- Parameters:
molecularWeight- the molecular weight (g/mol) at which this map was measuredspeed- array of speed values (RPM)flow- 2D array of flow values for head curves (m³/hr)head- 2D array of head values for each speed curve (kJ/kg or meter)flowPolyEff- 2D array of flow values for efficiency curves (m³/hr)polyEff- 2D array of polytropic efficiency values for each speed curve (%)
-
addMapAtMW
public void addMapAtMW(double molecularWeight, double speed, double[] flow, double[] head, double[] polyEff) Add a single-speed compressor map at a specific molecular weight.This is a convenience method for single-speed compressors where flow, head, and efficiency are 1D arrays for a single speed curve.
- Parameters:
molecularWeight- the molecular weight (g/mol) at which this map was measuredspeed- the compressor speed (RPM)flow- array of flow values (m³/hr)head- array of head values (kJ/kg or meter)polyEff- array of polytropic efficiency values (%)
-
addMapAtMW
public void addMapAtMW(double molecularWeight, double speed, double[] flow, double[] head, double[] flowPolyEff, double[] polyEff) Add a single-speed compressor map at a specific molecular weight with separate flow arrays.This is a convenience method for single-speed compressors where efficiency is measured at different flow points than head.
- Parameters:
molecularWeight- the molecular weight (g/mol) at which this map was measuredspeed- the compressor speed (RPM)flow- array of flow values for head curve (m³/hr)head- array of head values (kJ/kg or meter)flowPolyEff- array of flow values for efficiency curve (m³/hr)polyEff- array of polytropic efficiency values (%)
-
addMapAtMW
public void addMapAtMW(double molecularWeight, double[] chartConditions, double[] speed, double[][] flow, double[][] head, double[][] flowPolyEff, double[][] polyEff) Add a compressor map at a specific molecular weight.Multiple maps can be added at different MW values. The maps are stored sorted by MW.
- Parameters:
molecularWeight- the molecular weight (g/mol) at which this map was measuredchartConditions- reference conditions [temp °C, pres bara, density kg/m³, MW g/mol]speed- array of speed values (RPM)flow- 2D array of flow values for each speed curve (m³/hr)head- 2D array of head values for each speed curve (kJ/kg or meter)flowPolyEff- 2D array of flow values for efficiency curves (m³/hr)polyEff- 2D array of polytropic efficiency values for each speed curve (%)
-
setOperatingMW
public void setOperatingMW(double mw) Set the operating molecular weight for interpolation.The polytropic head and efficiency will be interpolated between maps based on this MW.
- Parameters:
mw- the operating molecular weight in g/mol
-
getOperatingMW
public double getOperatingMW()Get the operating molecular weight.- Returns:
- the operating molecular weight in g/mol
-
setInterpolationEnabled
public void setInterpolationEnabled(boolean enabled) Enable or disable MW interpolation.When disabled, the chart behaves like a standard CompressorChart using the first added map.
- Parameters:
enabled- true to enable interpolation, false to disable
-
isInterpolationEnabled
public boolean isInterpolationEnabled()Check if MW interpolation is enabled.- Returns:
- true if interpolation is enabled
-
setAutoGenerateSurgeCurves
public void setAutoGenerateSurgeCurves(boolean autoGenerate) Enable auto-generation of surge curves when maps are added.- Parameters:
autoGenerate- true to auto-generate surge curves
-
isAutoGenerateSurgeCurves
public boolean isAutoGenerateSurgeCurves()Check if auto-generation of surge curves is enabled.- Returns:
- true if auto-generation is enabled
-
setAutoGenerateStoneWallCurves
public void setAutoGenerateStoneWallCurves(boolean autoGenerate) Enable auto-generation of stone wall curves when maps are added.- Parameters:
autoGenerate- true to auto-generate stone wall curves
-
isAutoGenerateStoneWallCurves
public boolean isAutoGenerateStoneWallCurves()Check if auto-generation of stone wall curves is enabled.- Returns:
- true if auto-generation is enabled
-
getNumberOfMaps
public int getNumberOfMaps()Get the number of MW maps defined.- Returns:
- number of MW maps
-
getMapMolecularWeights
-
setAllowExtrapolation
public void setAllowExtrapolation(boolean allow) Enable or disable extrapolation outside the MW range.When enabled, linear extrapolation is used for MW values outside the range of defined maps. When disabled (default), the nearest boundary map is used.
- Parameters:
allow- true to enable extrapolation, false to use boundary maps
-
isAllowExtrapolation
public boolean isAllowExtrapolation()Check if extrapolation outside the MW range is allowed.- Returns:
- true if extrapolation is allowed
-
setUseActualMW
public void setUseActualMW(boolean useActual) Set whether to automatically use the inlet stream's molecular weight.When enabled (default), the operating MW is automatically updated from the inlet stream's fluid molecular weight before each calculation. This ensures the compressor chart uses the actual gas composition.
- Parameters:
useActual- true to use inlet stream's MW automatically
-
isUseActualMW
public boolean isUseActualMW()Check if automatic MW detection from inlet stream is enabled.- Returns:
- true if using inlet stream's MW automatically
-
setInletStream
Set the inlet stream reference for automatic MW detection.- Parameters:
stream- the inlet stream
-
getInletStream
Get the inlet stream reference.- Returns:
- the inlet stream, or null if not set
-
updateOperatingMWFromStream
private void updateOperatingMWFromStream()Update the operating MW from the inlet stream's fluid.Called automatically before calculations if useActualMW is enabled.
-
findInterpolationIndices
Find the two nearest MW maps and their interpolation weight.- Parameters:
mw- the target molecular weight- Returns:
- InterpolationIndices containing lower index, upper index, and interpolation fraction
-
getPolytropicHead
public double getPolytropicHead(double flow, double speed) Get method for polytropic head from reference curves.Returns the polytropic head interpolated between MW maps based on the operating MW.
- 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.Returns the polytropic efficiency interpolated between MW maps based on the operating MW.
- Specified by:
getPolytropicEfficiencyin interfaceCompressorChartInterface- Overrides:
getPolytropicEfficiencyin classCompressorChart- Parameters:
flow- [m3/h], speed in [rpm].speed- a double- Returns:
- polytropic efficiency [%].
-
getSurgeFlowAtSpeed
public double getSurgeFlowAtSpeed(double speed) Get the surge flow at a specific speed, interpolated between MW maps.- Specified by:
getSurgeFlowAtSpeedin interfaceCompressorChartInterface- Overrides:
getSurgeFlowAtSpeedin classCompressorChart- Parameters:
speed- the compressor speed in RPM- Returns:
- the surge flow interpolated for the operating MW
-
getStoneWallFlowAtSpeed
public double getStoneWallFlowAtSpeed(double speed) Get the stone wall flow at a specific speed, interpolated between MW maps.- Specified by:
getStoneWallFlowAtSpeedin interfaceCompressorChartInterface- Overrides:
getStoneWallFlowAtSpeedin classCompressorChart- Parameters:
speed- the compressor speed in RPM- Returns:
- the stone wall flow interpolated for the operating MW
-
getSurgeHeadAtSpeed
public double getSurgeHeadAtSpeed(double speed) Get the surge head at a specific speed, interpolated between MW maps.- Specified by:
getSurgeHeadAtSpeedin interfaceCompressorChartInterface- Overrides:
getSurgeHeadAtSpeedin classCompressorChart- Parameters:
speed- the compressor speed in RPM- Returns:
- the surge head interpolated for the operating MW
-
getStoneWallHeadAtSpeed
public double getStoneWallHeadAtSpeed(double speed) Get the stone wall head at a specific speed, interpolated between MW maps.- Specified by:
getStoneWallHeadAtSpeedin interfaceCompressorChartInterface- Overrides:
getStoneWallHeadAtSpeedin classCompressorChart- Parameters:
speed- the compressor speed in RPM- Returns:
- the stone wall head interpolated for the operating MW
-
isSurge
public boolean isSurge(double head, double flow) Check if operating point is in surge, using interpolated surge curve.- Parameters:
head- the polytropic headflow- the volumetric flow- Returns:
- true if the operating point is below the surge curve (in surge)
-
isStoneWall
public boolean isStoneWall(double head, double flow) Check if operating point is at stone wall (choke), using interpolated stone wall curve.- Parameters:
head- the polytropic headflow- the volumetric flow- Returns:
- true if the operating point is beyond the stone wall curve (choked)
-
getSurgeFlow
public double getSurgeFlow(double head) Get interpolated surge flow at a given head.- Parameters:
head- the polytropic head- Returns:
- the surge flow interpolated for the operating MW
-
getStoneWallFlow
public double getStoneWallFlow(double head) Get interpolated stone wall flow at a given head.- Parameters:
head- the polytropic head- Returns:
- the stone wall flow interpolated for the operating MW
-
getDistanceToSurge
public double getDistanceToSurge(double head, double flow) Get the distance to surge as a ratio, using interpolated surge curve.- Parameters:
head- the polytropic headflow- the current volumetric flow- Returns:
- ratio (current flow / surge flow) - 1; positive means above surge
-
getDistanceToStoneWall
public double getDistanceToStoneWall(double head, double flow) Get the distance to stone wall as a ratio, using interpolated stone wall curve.- Parameters:
head- the polytropic headflow- the current volumetric flow- Returns:
- ratio (stone wall flow / current flow) - 1; positive means below stone wall
-
linearInterpolate
private double linearInterpolate(double valueLower, double valueUpper, double fraction) Linear interpolation between two values.- Parameters:
valueLower- the value at the lower boundvalueUpper- the value at the upper boundfraction- the interpolation fraction (0.0 = lower, 1.0 = upper)- Returns:
- the interpolated value
-
setSurgeCurveAtMW
public void setSurgeCurveAtMW(double molecularWeight, double[] chartConditions, double[] surgeFlow, double[] surgeHead) Set surge curve for a specific MW map.- Parameters:
molecularWeight- the MW of the map to updatechartConditions- reference conditionssurgeFlow- array of surge flow valuessurgeHead- array of surge head values
-
setStoneWallCurveAtMW
public void setStoneWallCurveAtMW(double molecularWeight, double[] chartConditions, double[] stoneWallFlow, double[] stoneWallHead) Set stone wall curve for a specific MW map.- Parameters:
molecularWeight- the MW of the map to updatechartConditions- reference conditionsstoneWallFlow- array of stone wall flow valuesstoneWallHead- array of stone wall head values
-
generateAllSurgeCurves
public void generateAllSurgeCurves()Generate surge curves for all MW maps. -
generateAllStoneWallCurves
public void generateAllStoneWallCurves()Generate stone wall curves for all MW maps. -
findMapIndex
private int findMapIndex(double molecularWeight) Find the index of a map by molecular weight.- Parameters:
molecularWeight- the MW to find- Returns:
- the index, or -1 if not found
-
getChartAtMW
Get the chart at a specific MW.- Parameters:
molecularWeight- the MW to find- Returns:
- the CompressorChart at that MW, or null if not found
-
setHeadUnit
Set the head unit for all maps.- Specified by:
setHeadUnitin interfaceCompressorChartInterface- Overrides:
setHeadUnitin classCompressorChart- Parameters:
headUnit- the unit of head (e.g., "kJ/kg" or "meter")
-