Class CompressorChart

java.lang.Object
neqsim.process.equipment.compressor.CompressorChart
All Implemented Interfaces:
Serializable, Cloneable, CompressorChartInterface
Direct Known Subclasses:
CompressorChartAlternativeMapLookup, CompressorChartMWInterpolation

public class CompressorChart extends Object implements CompressorChartInterface, Serializable

CompressorChart class.

Version:
$Id: $Id
Author:
asmund
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Serialization version UID.
      See Also:
    • logger

      static org.apache.logging.log4j.Logger logger
      Logger object for class.
    • referenceDensity

      private double referenceDensity
      Reference gas density in kg/m3 for power calculations.
    • inletPressure

      private double inletPressure
      Inlet pressure in bara for pressure ratio calculations.
    • polytropicExponent

      private double polytropicExponent
      Polytropic exponent for pressure ratio calculations.
    • inletTemperature

      private double inletTemperature
      Inlet temperature in Kelvin for discharge temperature calculations.
    • gamma

      private double gamma
      Heat capacity ratio (gamma = Cp/Cv) for temperature calculations.
    • powerCurves

      private double[][] powerCurves
      Calculated power curves [speed][points] in kW.
    • pressureRatioCurves

      private double[][] pressureRatioCurves
      Calculated pressure ratio curves [speed][points].
    • dischargeTemperatureCurves

      private double[][] dischargeTemperatureCurves
      Calculated discharge temperature curves [speed][points] in Kelvin.
    • chartValues

    • chartSpeeds

      ArrayList<Double> chartSpeeds
    • surgeCurve

    • stoneWallCurve

      StoneWallCurve stoneWallCurve
    • isSurge

      boolean isSurge
    • maxSpeedCurve

      double maxSpeedCurve
    • minSpeedCurve

      double minSpeedCurve
    • isStoneWall

      boolean isStoneWall
    • refMW

      double refMW
    • headUnit

      private String headUnit
    • useCompressorChart

      private boolean useCompressorChart
    • refTemperature

      double refTemperature
    • refPressure

      double refPressure
    • referenceSpeed

      double referenceSpeed
    • refZ

      double refZ
    • useRealKappa

      private boolean useRealKappa
    • chartConditions

      double[] chartConditions
    • reducedHeadFitter

      final org.apache.commons.math3.fitting.WeightedObservedPoints reducedHeadFitter
    • reducedFlowFitter

      final org.apache.commons.math3.fitting.WeightedObservedPoints reducedFlowFitter
    • fanLawCorrectionFitter

      final org.apache.commons.math3.fitting.WeightedObservedPoints fanLawCorrectionFitter
    • reducedPolytropicEfficiencyFitter

      final org.apache.commons.math3.fitting.WeightedObservedPoints reducedPolytropicEfficiencyFitter
    • 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
    • speed

      double[] speed
    • flow

      double[][] flow
    • flowPolytropicEfficiency

      double[][] flowPolytropicEfficiency
    • polytropicEfficiency

      double[][] polytropicEfficiency
    • redflow

      double[][] redflow
    • redflowPolytropicEfficiency

      double[][] redflowPolytropicEfficiency
    • redhead

      double[][] redhead
    • redpolytropicEfficiency

      double[][] redpolytropicEfficiency
  • Constructor Details

    • CompressorChart

      public CompressorChart()

      Constructor for CompressorChart.

  • Method Details

    • generateSurgeCurve

      public void generateSurgeCurve()
      Generates the surge curve by taking the head value at the lowest flow for each speed from the compressor chart values.
      Specified by:
      generateSurgeCurve in interface CompressorChartInterface
    • generateStoneWallCurve

      public void generateStoneWallCurve()

      generateStoneWallCurve.

      Generates the stone wall curve by taking the head value at the highest flow for each speed from the compressor chart values.

      Specified by:
      generateStoneWallCurve in interface CompressorChartInterface
    • 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:
      addCurve in interface CompressorChartInterface
      Parameters:
      speed - a double
      flow - an array of type double
      head - an array of type double
      polytropicEfficiency - 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:
      addCurve in interface CompressorChartInterface
      Parameters:
      speed - a double
      flow - an array of type double
      head - an array of type double
      flowPolytropicEfficiency - an array of type double
      polytropicEfficiency - 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.

      Specified by:
      setCurves in interface CompressorChartInterface
      Parameters:
      chartConditions - an array of type double
      speed - an array of type double
      flow - an array of type double
      head - an array of type double
      polyEff - 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.

      Specified by:
      setCurves in interface CompressorChartInterface
      Parameters:
      chartConditions - an array of type double
      speed - an array of type double
      flow - an array of type double
      head - an array of type double
      flowPolyEff - an array of type double
      polyEff - an array of type double
    • fitReducedCurve

      public void fitReducedCurve()

      fitReducedCurve.

    • getPolytropicHead

      public double getPolytropicHead(double flow, double speed)
      Get method for polytropic head from reference curves.
      Specified by:
      getPolytropicHead in interface CompressorChartInterface
      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.
      Specified by:
      getPolytropicEfficiency in interface CompressorChartInterface
      Parameters:
      flow - [m3/h], speed in [rpm].
      speed - a double
      Returns:
      polytropic efficiency [%].
    • getSpeed

      public int getSpeed(double flow, double head)

      getSpeed.

      Specified by:
      getSpeed in interface CompressorChartInterface
      Parameters:
      flow - a double
      head - 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 fan law relationships: Head ∝ Speed². The algorithm uses a robust Newton-Raphson method with:

      • Fan-law based initial guess for fast convergence
      • Bounds protection to prevent divergence
      • Damped updates for stability
      • Bisection fallback if Newton-Raphson fails

      The method works both within and outside the defined speed curve range by using the underlying fan law extrapolation of the compressor map.

      Specified by:
      getSpeedValue in interface CompressorChartInterface
      Parameters:
      flow - the volumetric flow rate in m³/hr
      head - the required polytropic head in the chart's head unit (kJ/kg or meter)
      Returns:
      the calculated speed in RPM (as double for precision)
    • getFlow

      public double getFlow(double head, double speed, double guessFlow)

      getFlow.

      Specified by:
      getFlow in interface CompressorChartInterface
      Parameters:
      head - a double
      speed - a double
      guessFlow - a double
      Returns:
      a double
    • addSurgeCurve

      public void addSurgeCurve(double[] flow, double[] head)

      addSurgeCurve.

      Parameters:
      flow - an array of type double
      head - an array of type double
    • polytropicEfficiency

      public double polytropicEfficiency(double flow, double speed)

      polytropicEfficiency.

      Parameters:
      flow - a double
      speed - a double
      Returns:
      a double
    • checkSurge1

      public boolean checkSurge1(double flow, double head)

      checkSurge1.

      Parameters:
      flow - a double
      head - a double
      Returns:
      a boolean
    • checkSurge2

      public boolean checkSurge2(double flow, double speed)

      checkSurge2.

      Parameters:
      flow - a double
      speed - a double
      Returns:
      a boolean
    • checkStoneWall

      public boolean checkStoneWall(double flow, double speed)

      checkStoneWall.

      Parameters:
      flow - a double
      speed - 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:
      setReferenceConditions in interface CompressorChartInterface
      Parameters:
      refMW - a double
      refTemperature - a double
      refPressure - a double
      refZ - a double
    • getSurgeCurve

      public SafeSplineSurgeCurve getSurgeCurve()

      getSurgeCurve.

      Specified by:
      getSurgeCurve in interface CompressorChartInterface
      Returns:
      a SafeSplineSurgeCurve object
    • setSurgeCurve

      public void setSurgeCurve(SafeSplineSurgeCurve surgeCurve)

      setSurgeCurve.

      Specified by:
      setSurgeCurve in interface CompressorChartInterface
      Parameters:
      surgeCurve - a SafeSplineSurgeCurve object
    • getStoneWallCurve

      public StoneWallCurve getStoneWallCurve()

      getStoneWallCurve.

      Specified by:
      getStoneWallCurve in interface CompressorChartInterface
      Returns:
      a StoneWallCurve object
    • setStoneWallCurve

      public void setStoneWallCurve(StoneWallCurve stoneWallCurve)

      setStoneWallCurve.

      Specified by:
      setStoneWallCurve in interface CompressorChartInterface
      Parameters:
      stoneWallCurve - a StoneWallCurve object
    • isUseCompressorChart

      public boolean isUseCompressorChart()
      Checks if set to use compressor chart for compressor calculations (chart is set for compressor).
      Specified by:
      isUseCompressorChart in interface CompressorChartInterface
      Returns:
      a boolean
    • setUseCompressorChart

      public void setUseCompressorChart(boolean useCompressorChart)
      Set compressor calculations to use compressor chart.
      Specified by:
      setUseCompressorChart in interface CompressorChartInterface
      Parameters:
      useCompressorChart - a boolean
    • getHeadUnit

      public String getHeadUnit()
      get the selected unit of head.
      Specified by:
      getHeadUnit in interface CompressorChartInterface
      Returns:
      unit of head
    • setHeadUnit

      public void setHeadUnit(String headUnit)
      set unit of head.
      Specified by:
      setHeadUnit in interface CompressorChartInterface
      Parameters:
      headUnit - a String object
    • useRealKappa

      public boolean useRealKappa()
      get method for kappa setting. true = real kappa is used, false = ideal kappa is used
      Specified by:
      useRealKappa in interface CompressorChartInterface
      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:
      setUseRealKappa in interface CompressorChartInterface
      Parameters:
      useRealKappa - a boolean
    • plot

      public void plot()

      plot.

      Specified by:
      plot in interface CompressorChartInterface
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface CompressorChartInterface
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in interface CompressorChartInterface
      Overrides:
      equals in class Object
    • getMaxSpeedCurve

      public double getMaxSpeedCurve()

      Getter for the field maxSpeedCurve.

      Specified by:
      getMaxSpeedCurve in interface CompressorChartInterface
      Returns:
      a double
    • setMaxSpeedCurve

      public void setMaxSpeedCurve(double maxSpeedCurve)

      Setter for the field maxSpeedCurve.

      Parameters:
      maxSpeedCurve - a double
    • getMinSpeedCurve

      public double getMinSpeedCurve()

      Getter for the field minSpeedCurve.

      Specified by:
      getMinSpeedCurve in interface CompressorChartInterface
      Returns:
      the minimum speed curve value in RPM
    • setMinSpeedCurve

      public void setMinSpeedCurve(double minSpeedCurve)

      Setter for the field minSpeedCurve.

      Parameters:
      minSpeedCurve - a double
    • getSurgeFlowAtSpeed

      public double getSurgeFlowAtSpeed(double speed)

      Get the surge flow (minimum flow) at a specific speed.

      This method finds the compressor curve closest to the specified speed and returns the minimum flow on that curve. This is useful for single speed compressors where the surge curve is not active, as well as for multi-speed compressors to get the surge point at a specific speed.

      Specified by:
      getSurgeFlowAtSpeed in interface CompressorChartInterface
      Parameters:
      speed - The compressor speed in RPM
      Returns:
      The surge flow (minimum flow) at the specified speed in m3/hr, or Double.NaN if no curves exist
    • getSurgeHeadAtSpeed

      public double getSurgeHeadAtSpeed(double speed)

      Get the surge head (polytropic head at minimum flow) at a specific speed.

      This method finds the compressor curve closest to the specified speed and returns the polytropic head at the minimum flow point (surge point) on that curve.

      Specified by:
      getSurgeHeadAtSpeed in interface CompressorChartInterface
      Parameters:
      speed - The compressor speed in RPM
      Returns:
      The surge head at the specified speed in kJ/kg or meter (depending on headUnit), or Double.NaN if no curves exist
    • getStoneWallFlowAtSpeed

      public double getStoneWallFlowAtSpeed(double speed)

      Get the stone wall flow (maximum flow) at a specific speed.

      This method finds the compressor curve closest to the specified speed and returns the maximum flow on that curve (choke limit). This is useful for single speed compressors where the stone wall curve is not active.

      Specified by:
      getStoneWallFlowAtSpeed in interface CompressorChartInterface
      Parameters:
      speed - The compressor speed in RPM
      Returns:
      The stone wall flow (maximum flow) at the specified speed in m3/hr, or Double.NaN if no curves exist
    • getStoneWallHeadAtSpeed

      public double getStoneWallHeadAtSpeed(double speed)

      Get the stone wall head (polytropic head at maximum flow) at a specific speed.

      This method finds the compressor curve closest to the specified speed and returns the polytropic head at the maximum flow point (choke limit) on that curve.

      Specified by:
      getStoneWallHeadAtSpeed in interface CompressorChartInterface
      Parameters:
      speed - The compressor speed in RPM
      Returns:
      The stone wall head at the specified speed in kJ/kg or meter (depending on headUnit), or Double.NaN if no curves exist
    • getSpeeds

      public double[] getSpeeds()
      Get the speed values for all compressor curves.
      Specified by:
      getSpeeds in interface CompressorChartInterface
      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.
      Specified by:
      getFlows in interface CompressorChartInterface
      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.
      Specified by:
      getHeads in interface CompressorChartInterface
      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.
      Specified by:
      getPolytropicEfficiencies in interface CompressorChartInterface
      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).
      Specified by:
      getChartConditions in interface CompressorChartInterface
      Returns:
      an array of chart condition values, or null if not set
    • setReferenceDensity

      public void setReferenceDensity(double density)
      Set the reference density for power and pressure ratio calculations.
      Specified by:
      setReferenceDensity in interface CompressorChartInterface
      Parameters:
      density - the reference gas density in kg/m3
    • getReferenceDensity

      public double getReferenceDensity()
      Get the reference density used for calculations.
      Specified by:
      getReferenceDensity in interface CompressorChartInterface
      Returns:
      the reference density in kg/m3, or NaN if not set
    • setInletPressure

      public void setInletPressure(double pressure)
      Set the inlet pressure for pressure ratio calculations.
      Specified by:
      setInletPressure in interface CompressorChartInterface
      Parameters:
      pressure - the inlet pressure in bara
    • getInletPressure

      public double getInletPressure()
      Get the inlet pressure.
      Specified by:
      getInletPressure in interface CompressorChartInterface
      Returns:
      the inlet pressure in bara, or NaN if not set
    • setPolytropicExponent

      public void setPolytropicExponent(double exponent)
      Set the polytropic exponent for pressure ratio calculations.
      Specified by:
      setPolytropicExponent in interface CompressorChartInterface
      Parameters:
      exponent - the polytropic exponent (n)
    • getPolytropicExponent

      public double getPolytropicExponent()
      Get the polytropic exponent.
      Specified by:
      getPolytropicExponent in interface CompressorChartInterface
      Returns:
      the polytropic exponent, or NaN if not set
    • getPowers

      public double[][] getPowers()
      Get the power values for all compressor curves.

      Power is calculated from: P = mass_flow * head / efficiency. This curve is critical for driver selection and energy analysis.

      Specified by:
      getPowers in interface CompressorChartInterface
      Returns:
      a 2D array where each row corresponds to a speed and contains power values in kW, or null if not available
    • getPressureRatios

      public double[][] getPressureRatios()
      Get the pressure ratio values for all compressor curves.

      Pressure ratio is calculated from polytropic head and gas properties. Useful for process design and control system configuration.

      Specified by:
      getPressureRatios in interface CompressorChartInterface
      Returns:
      a 2D array where each row corresponds to a speed and contains pressure ratio values (dimensionless), or null if not available
    • calculatePowerCurves

      private void calculatePowerCurves()
      Calculate power curves from flow, head, and efficiency.

      Power is calculated as: P = (density * volumeFlow * head) / efficiency where volumeFlow is in m3/hr, head is in kJ/kg (or converted from meters), and efficiency is in fraction (0-1).

    • calculatePressureRatioCurves

      private void calculatePressureRatioCurves()
      Calculate pressure ratio curves from head and gas properties.

      Pressure ratio is calculated from polytropic head using: PR = [1 + (n-1)/n * H / (Z*R*T/MW)]^(n/(n-1)) Simplified: PR = exp(n/(n-1) * ln(1 + (n-1)/n * H * MW / (Z*R*T)))

    • setInletTemperature

      public void setInletTemperature(double temperature)
      Set the inlet temperature for discharge temperature calculations.
      Specified by:
      setInletTemperature in interface CompressorChartInterface
      Parameters:
      temperature - the inlet temperature in Kelvin
    • getInletTemperature

      public double getInletTemperature()
      Get the inlet temperature.
      Specified by:
      getInletTemperature in interface CompressorChartInterface
      Returns:
      the inlet temperature in Kelvin, or NaN if not set
    • setGamma

      public void setGamma(double gamma)
      Set the heat capacity ratio (gamma = Cp/Cv) for temperature calculations.
      Specified by:
      setGamma in interface CompressorChartInterface
      Parameters:
      gamma - the heat capacity ratio (typically 1.2-1.4 for gases)
    • getGamma

      public double getGamma()
      Get the heat capacity ratio.
      Specified by:
      getGamma in interface CompressorChartInterface
      Returns:
      the heat capacity ratio, or NaN if not set
    • getDischargeTemperatures

      public double[][] getDischargeTemperatures()
      Get the discharge temperature values for all compressor curves.

      Discharge temperature is calculated from inlet temperature, pressure ratio, and polytropic efficiency using: T2 = T1 * PR^((n-1)/n) where n is related to efficiency and heat capacity ratio. This is important for downstream equipment design and material temperature limits.

      Specified by:
      getDischargeTemperatures in interface CompressorChartInterface
      Returns:
      a 2D array where each row corresponds to a speed and contains discharge temperature values in Kelvin, or null if not available
    • calculateDischargeTemperatureCurves

      private void calculateDischargeTemperatureCurves()
      Calculate discharge temperature curves from pressure ratio and gas properties.

      Discharge temperature is calculated using the polytropic process relation: T2 = T1 * PR^((n-1)/n) where PR is pressure ratio and n is polytropic exponent related to efficiency: (n-1)/n = (gamma-1)/gamma / eta_polytropic

      This is critical for:

      • Downstream equipment design
      • Material temperature limits
      • Intercooler requirements