Class CompressorChartAlternativeMapLookup

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

public class CompressorChartAlternativeMapLookup extends CompressorChart implements CompressorChartInterface, Serializable

CompressorChartAlternativeMapLookup 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.
    • isSurge

      boolean isSurge
    • 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
    • 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:
      addCurve in interface CompressorChartInterface
      Overrides:
      addCurve in class CompressorChart
      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
      Overrides:
      addCurve in class CompressorChart
      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.

      Sets the compressor curves based on the provided chart conditions, speed, flow, head, and polytropic efficiency values.

      Specified by:
      setCurves in interface CompressorChartInterface
      Overrides:
      setCurves in class CompressorChart
      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.

      Sets the compressor curves based on the provided chart conditions, speed, flow, head, flowPolytrpicEfficiency and polytropic efficiency values.

      Specified by:
      setCurves in interface CompressorChartInterface
      Overrides:
      setCurves in class CompressorChart
      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
    • getClosestRefSpeeds

      public ArrayList<Double> getClosestRefSpeeds(double speed)

      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 ArrayList of 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:
      getPolytropicHead in interface CompressorChartInterface
      Overrides:
      getPolytropicHead in class CompressorChart
      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:
      getPolytropicEfficiency in interface CompressorChartInterface
      Overrides:
      getPolytropicEfficiency in class CompressorChart
      Parameters:
      flow - [m3/h], speed in [rpm].
      speed - a double
      Returns:
      polytropic efficiency [%].
    • addSurgeCurve

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

      addSurgeCurve.

      Overrides:
      addSurgeCurve in class CompressorChart
      Parameters:
      flow - an array of type double
      head - an array of type double
    • getCurveAtRefSpeed

      public CompressorCurve getCurveAtRefSpeed(double refSpeed)

      getCurveAtRefSpeed.

      Parameters:
      refSpeed - a double
      Returns:
      a CompressorCurve object
    • 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:
      polytropicEfficiency in class CompressorChart
      Parameters:
      flow - a double
      speed - a double
      Returns:
      a double
    • getSpeed

      public int getSpeed(double flow, double head)

      getSpeed.

      Specified by:
      getSpeed in interface CompressorChartInterface
      Overrides:
      getSpeed in class CompressorChart
      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 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:
      getSpeedValue in interface CompressorChartInterface
      Overrides:
      getSpeedValue in class CompressorChart
      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)
    • checkSurge1

      public boolean checkSurge1(double flow, double head)

      checkSurge1.

      checkSurge1.

      Overrides:
      checkSurge1 in class CompressorChart
      Parameters:
      flow - a double
      head - a double
      Returns:
      a boolean
    • checkSurge2

      public boolean checkSurge2(double flow, double speed)

      checkSurge2.

      checkSurge2.

      Overrides:
      checkSurge2 in class CompressorChart
      Parameters:
      flow - a double
      speed - a double
      Returns:
      a boolean
    • checkStoneWall

      public boolean checkStoneWall(double flow, double speed)

      checkStoneWall.

      checkStoneWall.

      Overrides:
      checkStoneWall in class CompressorChart
      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
      Overrides:
      setReferenceConditions in class CompressorChart
      Parameters:
      refMW - a double
      refTemperature - a double
      refPressure - a double
      refZ - a double
    • getSurgeCurve

      public SafeSplineSurgeCurve getSurgeCurve()

      getSurgeCurve.

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

      public void setSurgeCurve(SafeSplineSurgeCurve surgeCurve)

      setSurgeCurve.

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

      public StoneWallCurve getStoneWallCurve()

      getStoneWallCurve.

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

      public void setStoneWallCurve(StoneWallCurve stoneWallCurve)

      setStoneWallCurve.

      Specified by:
      setStoneWallCurve in interface CompressorChartInterface
      Overrides:
      setStoneWallCurve in class CompressorChart
      Parameters:
      stoneWallCurve - a StoneWallCurve object
    • main

      public static void main(String[] args)

      main.

      Parameters:
      args - an array of String objects
    • 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
      Overrides:
      isUseCompressorChart in class CompressorChart
      Returns:
      a boolean
    • setUseCompressorChart

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

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

      public void setHeadUnit(String headUnit)
      set unit of head.
      Specified by:
      setHeadUnit in interface CompressorChartInterface
      Overrides:
      setHeadUnit in class CompressorChart
      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
      Overrides:
      useRealKappa in class CompressorChart
      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
      Overrides:
      setUseRealKappa in class CompressorChart
      Parameters:
      useRealKappa - a boolean
    • bisect_left

      public static int bisect_left(Double[] A, double x)

      bisect_left.

      Parameters:
      A - an array of Double objects
      x - a double
      Returns:
      a int
    • bisect_left

      public static int bisect_left(Double[] A, double x, int lo, int hi)

      bisect_left.

      Parameters:
      A - an array of Double objects
      x - a double
      lo - a int
      hi - a int
      Returns:
      a int
    • plot

      public void plot()

      plot.

      Specified by:
      plot in interface CompressorChartInterface
      Overrides:
      plot in class CompressorChart
    • getFlow

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

      getFlow.

      Specified by:
      getFlow in interface CompressorChartInterface
      Overrides:
      getFlow in class CompressorChart
      Parameters:
      head - a double
      speed - a double
      guessFlow - a double
      Returns:
      a double
    • getMinSpeedCurve

      public double getMinSpeedCurve()

      Getter for the field minSpeedCurve.

      Specified by:
      getMinSpeedCurve in interface CompressorChartInterface
      Overrides:
      getMinSpeedCurve in class CompressorChart
      Returns:
      the minimum speed curve value in RPM
    • getMaxSpeedCurve

      public double getMaxSpeedCurve()

      Getter for the field maxSpeedCurve.

      Specified by:
      getMaxSpeedCurve in interface CompressorChartInterface
      Overrides:
      getMaxSpeedCurve in class CompressorChart
      Returns:
      a double
    • prettyPrintChartValues

      public void prettyPrintChartValues()
      Pretty print all CompressorCurve objects in chartValues.
    • getChartValues

      public ArrayList<CompressorCurve> getChartValues()

      getChartValues.

      Returns:
      a ArrayList object
    • getSpeeds

      public double[] getSpeeds()
      Get the speed values for all compressor curves.

      Returns the speed values from the chartValues curves.

      Specified by:
      getSpeeds in interface CompressorChartInterface
      Overrides:
      getSpeeds in class CompressorChart
      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:
      getFlows in interface CompressorChartInterface
      Overrides:
      getFlows in class CompressorChart
      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:
      getHeads in interface CompressorChartInterface
      Overrides:
      getHeads in class CompressorChart
      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:
      getPolytropicEfficiencies in interface CompressorChartInterface
      Overrides:
      getPolytropicEfficiencies in class CompressorChart
      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:
      getChartConditions in interface CompressorChartInterface
      Overrides:
      getChartConditions in class CompressorChart
      Returns:
      an array of chart condition values, or null if not set