Class Compressor

All Implemented Interfaces:
Serializable, Runnable, CompressorInterface, ProcessEquipmentInterface, TwoPortInterface, StateVectorProvider, SimulationInterface, NamedInterface
Direct Known Subclasses:
Expander

public class Compressor extends TwoPortEquipment implements CompressorInterface, StateVectorProvider

Compressor class.

Version:
$Id: $Id
Author:
esol
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.
    • thermoSystem

      public SystemInterface thermoSystem
    • outTemperature

      private double outTemperature
    • useOutTemperature

      private boolean useOutTemperature
    • compressionRatio

      private double compressionRatio
    • actualCompressionRatio

      private double actualCompressionRatio
    • useCompressionRatio

      private boolean useCompressionRatio
    • maxOutletPressure

      private double maxOutletPressure
    • isSetMaxOutletPressure

      private boolean isSetMaxOutletPressure
    • propertyProfile

      private CompressorPropertyProfile propertyProfile
    • dH

      public double dH
    • inletEnthalpy

      public double inletEnthalpy
    • solveSpeed

      private boolean solveSpeed
    • pressure

      public double pressure
    • speed

      private double speed
    • maxspeed

      private double maxspeed
    • minspeed

      private double minspeed
    • isentropicEfficiency

      public double isentropicEfficiency
    • polytropicEfficiency

      public double polytropicEfficiency
    • usePolytropicCalc

      public boolean usePolytropicCalc
    • powerSet

      public boolean powerSet
    • calcPressureOut

      public boolean calcPressureOut
    • compressorChart

      private CompressorChartInterface compressorChart
    • antiSurge

      private AntiSurge antiSurge
    • polytropicHead

      private double polytropicHead
    • polytropicFluidHead

      private double polytropicFluidHead
    • polytropicHeadMeter

      private double polytropicHeadMeter
    • polytropicExponent

      private double polytropicExponent
    • numberOfCompressorCalcSteps

      private int numberOfCompressorCalcSteps
    • useRigorousPolytropicMethod

      private boolean useRigorousPolytropicMethod
    • useGERG2008

      private boolean useGERG2008
    • useLeachman

      private boolean useLeachman
    • useVega

      private boolean useVega
    • limitSpeed

      private boolean limitSpeed
    • useEnergyEfficiencyChart

      private boolean useEnergyEfficiencyChart
    • operatingState

      private CompressorState operatingState
    • driver

      private CompressorDriver driver
    • operatingHistory

      private CompressorOperatingHistory operatingHistory
    • startupProfile

      private StartupProfile startupProfile
    • shutdownProfile

      private ShutdownProfile shutdownProfile
    • eventListeners

      private transient List<CompressorEventListener> eventListeners
    • rotationalInertia

      private double rotationalInertia
    • maxAccelerationRate

      private double maxAccelerationRate
    • maxDecelerationRate

      private double maxDecelerationRate
    • targetSpeed

      private double targetSpeed
    • autoSpeedMode

      private boolean autoSpeedMode
    • degradationFactor

      private double degradationFactor
    • foulingFactor

      private double foulingFactor
    • operatingHours

      private double operatingHours
    • surgeWarningThreshold

      private double surgeWarningThreshold
    • surgeCriticalThreshold

      private double surgeCriticalThreshold
    • stoneWallWarningThreshold

      private double stoneWallWarningThreshold
    • startupElapsedTime

      private double startupElapsedTime
    • shutdownElapsedTime

      private double shutdownElapsedTime
    • speedAtShutdownStart

      private double speedAtShutdownStart
    • surgeWarningActive

      private boolean surgeWarningActive
    • surgeCriticalActive

      private boolean surgeCriticalActive
    • speedLimitWarningActive

      private boolean speedLimitWarningActive
    • previousActualFlow

      private double previousActualFlow
    • previousPolyHead

      private double previousPolyHead
    • mechanicalDesign

      CompressorMechanicalDesign mechanicalDesign
    • mechanicalLosses

      private CompressorMechanicalLosses mechanicalLosses
      Mechanical losses model for seal gas and bearing calculations.
    • pressureUnit

      private String pressureUnit
    • polytropicMethod

      private String polytropicMethod
  • Constructor Details

    • Compressor

      public Compressor(String name)
      Constructor for Compressor.
      Parameters:
      name - Name of compressor
    • Compressor

      public Compressor(String name, StreamInterface inletStream)

      Constructor for Compressor.

      Parameters:
      name - a String object
      inletStream - a StreamInterface object
    • Compressor

      public Compressor(String name, boolean interpolateMapLookup)

      Constructor for Compressor.

      Parameters:
      name - Name of compressor
      interpolateMapLookup - a boolean
  • Method Details

    • getMechanicalDesign

      public CompressorMechanicalDesign getMechanicalDesign()

      Get a mechanicalDesign for the equipment.

      Specified by:
      getMechanicalDesign in interface ProcessEquipmentInterface
      Overrides:
      getMechanicalDesign in class ProcessEquipmentBaseClass
      Returns:
      a MechanicalDesign object
    • initMechanicalDesign

      public void initMechanicalDesign()

      Initialize a initMechanicalDesign for the equipment.

      Specified by:
      initMechanicalDesign in interface ProcessEquipmentInterface
      Overrides:
      initMechanicalDesign in class ProcessEquipmentBaseClass
    • getMechanicalLosses

      public CompressorMechanicalLosses getMechanicalLosses()
      Get the mechanical losses model for seal gas and bearing calculations.
      Returns:
      mechanical losses model, or null if not configured
    • setMechanicalLosses

      public void setMechanicalLosses(CompressorMechanicalLosses mechanicalLosses)
      Set the mechanical losses model.
      Parameters:
      mechanicalLosses - the mechanical losses model
    • initMechanicalLosses

      public CompressorMechanicalLosses initMechanicalLosses()
      Initialize a default mechanical losses model based on current compressor configuration.

      This creates a mechanical losses model with typical parameters for a centrifugal compressor with dry gas seals and tilting pad bearings.

      Returns:
      the initialized mechanical losses model
    • initMechanicalLosses

      public CompressorMechanicalLosses initMechanicalLosses(double shaftDiameterMm)
      Initialize a mechanical losses model with specified shaft diameter.
      Parameters:
      shaftDiameterMm - shaft diameter in mm
      Returns:
      the initialized mechanical losses model
    • updateMechanicalLosses

      public void updateMechanicalLosses()
      Update mechanical losses model with current operating conditions.

      Call this after running the compressor to update seal gas consumption and bearing losses.

    • getSealGasConsumption

      public double getSealGasConsumption()
      Get total seal gas consumption including primary leakage, buffer gas, and separation gas.
      Returns:
      seal gas consumption in Nm³/hr, or 0.0 if mechanical losses not configured
    • getBearingLoss

      public double getBearingLoss()
      Get total bearing power loss.
      Returns:
      bearing power loss in kW, or 0.0 if mechanical losses not configured
    • getMechanicalEfficiency

      public double getMechanicalEfficiency()
      Get mechanical efficiency accounting for bearing and seal friction losses.
      Returns:
      mechanical efficiency (0-1), or 0.98 if mechanical losses not configured
    • copy

      public Compressor copy()
      Create deep copy.
      Overrides:
      copy in class ProcessEquipmentBaseClass
      Returns:
      a deep copy of the unit operation/process equipment
    • setInletStream

      public void setInletStream(StreamInterface inletStream)
      Set inlet Stream of twoport.
      Specified by:
      setInletStream in interface TwoPortInterface
      Overrides:
      setInletStream in class TwoPortEquipment
      Parameters:
      inletStream - value to set
    • solveAntiSurge

      public void solveAntiSurge()

      solveAntiSurge.

    • setOutletPressure

      public void setOutletPressure(double pressure)
      Set outlet pressure of twoport.
      Specified by:
      setOutletPressure in interface TwoPortInterface
      Overrides:
      setOutletPressure in class TwoPortEquipment
      Parameters:
      pressure - value to set in unit bara
    • setOutletPressure

      public void setOutletPressure(double pressure, String unit)

      setOutletPressure.

      Parameters:
      pressure - a double
      unit - a String object
    • getOutletPressure

      public double getOutletPressure()
      Get outlet pressure of twoport.
      Specified by:
      getOutletPressure in interface TwoPortInterface
      Overrides:
      getOutletPressure in class TwoPortEquipment
      Returns:
      outlet pressure of TwoPortEquipment in unit bara
    • getEnergy

      public double getEnergy()

      getEnergy.

      Specified by:
      getEnergy in interface CompressorInterface
      Returns:
      a double
    • getPower

      public double getPower()

      getPower.

      Returns:
      a double
    • getPower

      public double getPower(String unit)

      getPower.

      Parameters:
      unit - a String object
      Returns:
      a double
    • setPower

      public void setPower(double p)

      setPower.

      Parameters:
      p - a double
    • solveEfficiency

      public double solveEfficiency(double outTemperature)
      Calculates polytropic or isentropic efficiency.
      Parameters:
      outTemperature - a double
      Returns:
      a double
    • findOutPressure

      public double findOutPressure(double hinn, double hout, double polytropicEfficiency)

      findOutPressure.

      Parameters:
      hinn - a double
      hout - a double
      polytropicEfficiency - a double
      Returns:
      a double
    • run

      public void run(UUID id)

      In this method all thermodynamic and unit operations will be calculated in a steady state calculation.

      Specified by:
      run in interface SimulationInterface
      Parameters:
      id - UUID
    • useEnergyEfficiencyChart

      private boolean useEnergyEfficiencyChart()
    • setUseEnergyEfficiencyChart

      public void setUseEnergyEfficiencyChart(boolean useEnergyEfficiencyChart)
    • runTransient

      public void runTransient(double dt, UUID id)

      runTransient

      This method calculates thermodynamic and unit operations using difference equations if available and calculateSteadyState is true. Use setCalculateSteadyState to set the parameter. Sets calc identifier UUID.
      Specified by:
      runTransient in interface SimulationInterface
      Parameters:
      dt - Delta time [s]
      id - Calculation identifier
    • generateCompressorCurves

      public void generateCompressorCurves()

      generateCompressorCurves.

    • displayResult

      public void displayResult()

      displayResult.

      Specified by:
      displayResult in interface ProcessEquipmentInterface
      Overrides:
      displayResult in class ProcessEquipmentBaseClass
    • getResultTable

      public String[][] getResultTable()

      getResultTable.

      Specified by:
      getResultTable in interface ProcessEquipmentInterface
      Overrides:
      getResultTable in class ProcessEquipmentBaseClass
      Returns:
      an array of String objects
    • getTotalWork

      public double getTotalWork()

      getTotalWork.

      Returns:
      a double
    • getIsentropicEfficiency

      public double getIsentropicEfficiency()

      getIsentropicEfficiency.

      Specified by:
      getIsentropicEfficiency in interface CompressorInterface
      Returns:
      a double
    • setIsentropicEfficiency

      public void setIsentropicEfficiency(double isentropicEfficiency)

      setIsentropicEfficiency.

      Specified by:
      setIsentropicEfficiency in interface CompressorInterface
      Parameters:
      isentropicEfficiency - a double
    • usePolytropicCalc

      public boolean usePolytropicCalc()

      usePolytropicCalc.

      Returns:
      the usePolytropicCalc
    • setUsePolytropicCalc

      public void setUsePolytropicCalc(boolean usePolytropicCalc)

      Setter for the field usePolytropicCalc.

      Parameters:
      usePolytropicCalc - the usePolytropicCalc to set
    • getPolytropicEfficiency

      public double getPolytropicEfficiency()

      getPolytropicEfficiency.

      Specified by:
      getPolytropicEfficiency in interface CompressorInterface
      Returns:
      a double
    • setPolytropicEfficiency

      public void setPolytropicEfficiency(double polytropicEfficiency)

      setPolytropicEfficiency.

      Specified by:
      setPolytropicEfficiency in interface CompressorInterface
      Parameters:
      polytropicEfficiency - a double
    • getThermoSystem

      public SystemInterface getThermoSystem()

      getThermoSystem.

      Specified by:
      getThermoSystem in interface ProcessEquipmentInterface
      Overrides:
      getThermoSystem in class ProcessEquipmentBaseClass
      Returns:
      a SystemInterface object
    • getCompressorChart

      public CompressorChartInterface getCompressorChart()

      Getter for the field compressorChart.

      Returns:
      a CompressorChartInterface object
    • setCompressorChart

      public void setCompressorChart(CompressorChartInterface compressorChart)

      Setter for the field compressorChart.

      Parameters:
      compressorChart - a CompressorChartInterface object
    • getAntiSurge

      public AntiSurge getAntiSurge()

      getAntiSurge.

      Specified by:
      getAntiSurge in interface CompressorInterface
      Returns:
      a AntiSurge object
    • isSurge

      public boolean isSurge(double flow, double head)

      isSurge.

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

      public double getDistanceToSurge()

      getDistanceToSurge.

      Specified by:
      getDistanceToSurge in interface CompressorInterface
      Returns:
      a double
    • getSurgeFlowRateMargin

      public double getSurgeFlowRateMargin()

      getSurgeFlowRateMargin.

      Specified by:
      getSurgeFlowRateMargin in interface CompressorInterface
      Returns:
      a double
    • getSurgeFlowRate

      public double getSurgeFlowRate()

      getSurgeFlowRate.

      Specified by:
      getSurgeFlowRate in interface CompressorInterface
      Returns:
      a double
    • getSurgeFlowRateStd

      public double getSurgeFlowRateStd()
      Specified by:
      getSurgeFlowRateStd in interface CompressorInterface
    • isStoneWall

      public boolean isStoneWall()
      Description copied from interface: CompressorInterface

      isStoneWall.

      Specified by:
      isStoneWall in interface CompressorInterface
      Returns:
      a boolean
    • getDistanceToStoneWall

      public double getDistanceToStoneWall()
      Calculate the distance to the stone wall (choke) limit.

      Returns a positive value indicating the percentage margin to stone wall. For example, 0.5 means the stone wall is 50% above the current flow rate.

      For single speed compressors where the stone wall curve is not active, this method uses the maximum flow point at the current speed. For multi-speed compressors, it uses the stone wall curve interpolation.

      Returns:
      distance to stone wall as a ratio (stone wall flow / current flow - 1)
    • isStoneWall

      public boolean isStoneWall(double flow, double head)

      isStoneWall.

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

      public void setAntiSurge(AntiSurge antiSurge)

      Setter for the field antiSurge.

      Parameters:
      antiSurge - a AntiSurge object
    • getSafetyFactorCorrectedFlowHeadAtCurrentSpeed

      public double[] getSafetyFactorCorrectedFlowHeadAtCurrentSpeed()

      Get the safety-factor-corrected surge flow and head at the current compressor speed.

      This method returns the safe minimum operating point by applying the surge control factor (typically 1.05 for 5% margin) to the surge flow at the current speed. The head is calculated at this safe flow rate using the compressor chart. This is particularly useful for single speed compressors where speed cannot be adjusted to move away from surge.

      Returns:
      A double array with two elements: [0] = safe surge flow (m3/hr), [1] = head at safe flow (kJ/kg or meter depending on chart headUnit)
    • getSpeed

      public double getSpeed()

      Getter for the field speed.

      Returns:
      a double
    • isHigherThanMaxSpeed

      public boolean isHigherThanMaxSpeed()
      Check if the current compressor speed is higher than the maximum speed in the compressor curves.

      This method is useful for detecting when the compressor is operating outside its design envelope (requires speed extrapolation beyond the defined curves).

      Returns:
      true if the current speed exceeds the maximum curve speed, false otherwise
    • isHigherThanMaxSpeed

      public boolean isHigherThanMaxSpeed(double calculatedSpeed)
      Check if a calculated speed is higher than the maximum speed in the compressor curves.
      Parameters:
      calculatedSpeed - the speed to check in RPM
      Returns:
      true if the calculated speed exceeds the maximum curve speed, false otherwise
    • getRatioToMaxSpeed

      public double getRatioToMaxSpeed()
      Get the ratio of the current compressor speed to the maximum speed in the compressor curves.

      A ratio greater than 1.0 indicates the speed exceeds the maximum curve speed.

      Returns:
      the ratio speed/maxSpeedCurve (dimensionless), or NaN if chart not set
    • getRatioToMaxSpeed

      public double getRatioToMaxSpeed(double calculatedSpeed)
      Get the ratio of a calculated speed to the maximum speed in the compressor curves.
      Parameters:
      calculatedSpeed - the speed to compare in RPM
      Returns:
      the ratio calculatedSpeed/maxSpeedCurve (dimensionless), or NaN if chart not set
    • isLowerThanMinSpeed

      public boolean isLowerThanMinSpeed()
      Check if the current compressor speed is lower than the minimum speed in the compressor curves.

      This method is useful for detecting when the compressor is operating below its design envelope (requires speed extrapolation below the defined curves), which may indicate turndown issues.

      Returns:
      true if the current speed is below the minimum curve speed, false otherwise
    • isLowerThanMinSpeed

      public boolean isLowerThanMinSpeed(double calculatedSpeed)
      Check if a calculated speed is lower than the minimum speed in the compressor curves.
      Parameters:
      calculatedSpeed - the speed to check in RPM
      Returns:
      true if the calculated speed is below the minimum curve speed, false otherwise
    • getRatioToMinSpeed

      public double getRatioToMinSpeed()
      Get the ratio of the current compressor speed to the minimum speed in the compressor curves.

      A ratio less than 1.0 indicates the speed is below the minimum curve speed.

      Returns:
      the ratio speed/minSpeedCurve (dimensionless), or NaN if chart not set
    • getRatioToMinSpeed

      public double getRatioToMinSpeed(double calculatedSpeed)
      Get the ratio of a calculated speed to the minimum speed in the compressor curves.
      Parameters:
      calculatedSpeed - the speed to compare in RPM
      Returns:
      the ratio calculatedSpeed/minSpeedCurve (dimensionless), or NaN if chart not set
    • isSpeedWithinRange

      public boolean isSpeedWithinRange()
      Check if the current compressor speed is within the defined compressor curve speed range.
      Returns:
      true if the speed is within [minSpeedCurve, maxSpeedCurve], false otherwise
    • isSpeedWithinRange

      public boolean isSpeedWithinRange(double calculatedSpeed)
      Check if a calculated speed is within the defined compressor curve speed range.
      Parameters:
      calculatedSpeed - the speed to check in RPM
      Returns:
      true if the speed is within [minSpeedCurve, maxSpeedCurve], false otherwise
    • setSpeed

      public void setSpeed(double speed)

      Setter for the field speed.

      Parameters:
      speed - a int
    • getPolytropicHead

      public double getPolytropicHead(String unit)

      Getter for the field polytropicHead.

      Parameters:
      unit - a String object
      Returns:
      a double
    • getPolytropicHead

      public double getPolytropicHead()

      Getter for the field polytropicHead.

      Returns:
      a double
    • getPolytropicFluidHead

      public double getPolytropicFluidHead()

      Getter for the field polytropicFluidHead.

      Returns:
      a double
    • getPolytropicExponent

      public double getPolytropicExponent()

      Getter for the field polytropicExponent.

      Returns:
      a double
    • getPolytropicHeadMeter

      public double getPolytropicHeadMeter()

      Getter for the field polytropicHeadMeter.

      Returns:
      a double
    • setPolytropicHeadMeter

      public void setPolytropicHeadMeter(double polytropicHeadMeter)

      Setter for the field polytropicHeadMeter.

      Parameters:
      polytropicHeadMeter - a double
    • getOutTemperature

      public double getOutTemperature()

      Getter for the field outTemperature.

      Returns:
      a double
    • setOutTemperature

      public void setOutTemperature(double outTemperature)

      Setter for the field outTemperature.

      Parameters:
      outTemperature - a double
    • useOutTemperature

      public void useOutTemperature(boolean useOutTemperature)

      useOutTemperature.

      Parameters:
      useOutTemperature - a boolean
    • getNumberOfCompressorCalcSteps

      public int getNumberOfCompressorCalcSteps()

      Getter for the field numberOfCompressorCalcSteps.

      Returns:
      the number of calculation steps in compressor
    • setNumberOfCompressorCalcSteps

      public void setNumberOfCompressorCalcSteps(int numberOfCompressorCalcSteps)

      Setter for the field numberOfCompressorCalcSteps.

      Parameters:
      numberOfCompressorCalcSteps - a int
    • isUseRigorousPolytropicMethod

      public boolean isUseRigorousPolytropicMethod()

      isUseRigorousPolytropicMethod.

      Returns:
      a boolean
    • setUseRigorousPolytropicMethod

      public void setUseRigorousPolytropicMethod(boolean useRigorousPolytropicMethod)

      Setter for the field useRigorousPolytropicMethod.

      Parameters:
      useRigorousPolytropicMethod - a boolean
    • setPressure

      public void setPressure(double pressure)

      Setter for the field pressure.

      Specified by:
      setPressure in interface ProcessEquipmentInterface
      Overrides:
      setPressure in class ProcessEquipmentBaseClass
      Parameters:
      pressure - a double
    • setPressure

      public void setPressure(double pressure, String unit)

      Setter for the field pressure.

      Parameters:
      pressure - a double
      unit - a String object
    • getEntropyProduction

      public double getEntropyProduction(String unit)

      getEntropyProduction.

      Specified by:
      getEntropyProduction in interface ProcessEquipmentInterface
      Overrides:
      getEntropyProduction in class ProcessEquipmentBaseClass
      Parameters:
      unit - a String object
      Returns:
      a double
    • getExergyChange

      public double getExergyChange(String unit, double surroundingTemperature)
      Get exergy change production of the process equipment.
      Specified by:
      getExergyChange in interface ProcessEquipmentInterface
      Overrides:
      getExergyChange in class ProcessEquipmentBaseClass
      Parameters:
      unit - Supported units are J and kJ
      surroundingTemperature - The surrounding temperature in Kelvin
      Returns:
      change in exergy in specified unit
    • getPolytropicMethod

      public String getPolytropicMethod()

      Getter for the field polytropicMethod.

      Returns:
      a String object
    • setPolytropicMethod

      public void setPolytropicMethod(String polytropicMethod)

      Setter for the field polytropicMethod.

      Parameters:
      polytropicMethod - a String object
    • isUseGERG2008

      public boolean isUseGERG2008()
      Getter for property useGERG2008.
      Returns:
      Value
    • setUseGERG2008

      public void setUseGERG2008(boolean useGERG2008)
      Setter for property useGERG2008.
      Parameters:
      useGERG2008 - Value to set
    • isUseLeachman

      public boolean isUseLeachman()
      Getter for property useLeachman.
      Returns:
      Value
    • setUseLeachman

      public void setUseLeachman(boolean useLeachman)
      Setter for property useLeachman.
      Parameters:
      useLeachman - Value to set
    • isUseVega

      public boolean isUseVega()
      Getter for property useVega.
      Returns:
      Value
    • setUseVega

      public void setUseVega(boolean useVega)
      Setter for property useVega.
      Parameters:
      useVega - Value to set
    • getPropertyProfile

      public CompressorPropertyProfile getPropertyProfile()

      Getter for the field propertyProfile.

      Returns:
      a CompressorPropertyProfile object
    • setPropertyProfile

      public void setPropertyProfile(CompressorPropertyProfile propertyProfile)

      Setter for the field propertyProfile.

      Parameters:
      propertyProfile - a CompressorPropertyProfile object
    • runController

      public void runController(double dt, UUID id)

      runController.

      Parameters:
      dt - a double
      id - Calculation identifier
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface ProcessEquipmentInterface
      Overrides:
      hashCode in class ProcessEquipmentBaseClass
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in interface ProcessEquipmentInterface
      Overrides:
      equals in class ProcessEquipmentBaseClass
    • setMaximumSpeed

      public void setMaximumSpeed(double maxSpeed)

      setMaximumSpeed.

      Specified by:
      setMaximumSpeed in interface CompressorInterface
      Parameters:
      maxSpeed - a double
    • setMinimumSpeed

      public void setMinimumSpeed(double minspeed)

      setMinimumSpeed.

      Specified by:
      setMinimumSpeed in interface CompressorInterface
      Parameters:
      minspeed - a double
    • getMaximumSpeed

      public double getMaximumSpeed()

      getMaximumSpeed.

      Specified by:
      getMaximumSpeed in interface CompressorInterface
      Returns:
      a double
    • getMinimumSpeed

      public double getMinimumSpeed()

      getMinimumSpeed.

      Specified by:
      getMinimumSpeed in interface CompressorInterface
      Returns:
      a double
    • setCompressionRatio

      public void setCompressionRatio(double compRatio)

      Setter for the field compressionRatio.

      Parameters:
      compRatio - a double
    • getCompressionRatio

      public double getCompressionRatio()

      Getter for the field compressionRatio.

      Returns:
      a double
    • toJson

      public String toJson()

      Serializes the Process Equipment along with its state to a JSON string.

      Specified by:
      toJson in interface ProcessEquipmentInterface
      Overrides:
      toJson in class TwoPortEquipment
      Returns:
      json string.
    • toJson

      public String toJson(ReportConfig cfg)
      Serializes the Process Equipment with configurable level of detail.
      Specified by:
      toJson in interface ProcessEquipmentInterface
      Overrides:
      toJson in class TwoPortEquipment
      Parameters:
      cfg - report configuration
      Returns:
      json string
    • getMaxOutletPressure

      public double getMaxOutletPressure()

      Getter for the field maxOutletPressure.

      Returns:
      a double
    • setMaxOutletPressure

      public void setMaxOutletPressure(double maxOutletPressure)

      Setter for the field maxOutletPressure.

      Parameters:
      maxOutletPressure - a double
    • isSetMaxOutletPressure

      public boolean isSetMaxOutletPressure()

      isSetMaxOutletPressure.

      Returns:
      a boolean
    • setIsSetMaxOutletPressure

      public void setIsSetMaxOutletPressure(boolean isSetMaxOutletPressure)

      Setter for the field isSetMaxOutletPressure.

      Parameters:
      isSetMaxOutletPressure - a boolean
    • getActualCompressionRatio

      public double getActualCompressionRatio()

      Getter for the field actualCompressionRatio.

      Returns:
      a double
    • setCompressorChartType

      public void setCompressorChartType(String type)

      Set CompressorChartType

      Specified by:
      setCompressorChartType in interface CompressorInterface
      Parameters:
      type - a String object
    • generateCompressorChart

      public void generateCompressorChart()
      Generates a compressor chart based on the current operating point.

      This is a convenience method that creates a single-speed compressor chart using the compressor's current speed and operating conditions. The chart type will match the compressor's current chart type setting.

      Example usage:

      compressor.setSpeed(10000);
      compressor.run();
      compressor.generateCompressorChart(); // Generates chart at current speed
      
    • generateCompressorChart

      public void generateCompressorChart(int numberOfSpeeds)
      Generates a compressor chart with multiple speed curves.

      Creates a multi-speed compressor chart centered around the current speed. The speeds are distributed from 80% to 120% of the current speed.

      Parameters:
      numberOfSpeeds - Number of speed curves to generate (must be at least 1)
    • generateCompressorChart

      public void generateCompressorChart(String generationOption)
      Generates a compressor chart with specified options.

      Available generation options:

      • "normal curves" - Standard 5-point curves with surge, design, and stonewall points
      • "mid range" - 3-point simplified curves
      Parameters:
      generationOption - The generation option to use
    • generateCompressorChart

      public void generateCompressorChart(String generationOption, int numberOfSpeeds)
      Generates a compressor chart with specified options and number of speeds.

      This is the main chart generation method that provides full control over the generated chart. The generated chart will automatically use the compressor's current chart type (simple, interpolate, or interpolate and extrapolate).

      Example usage:

      // Generate 5-speed chart with normal curves
      compressor.generateCompressorChart("normal curves", 5);
      
      // Generate 3-speed chart with simplified curves
      compressor.generateCompressorChart("mid range", 3);
      
      Parameters:
      generationOption - The generation option: "normal curves" or "mid range"
      numberOfSpeeds - Number of speed curves to generate (must be at least 1)
    • generateCompressorChartFromTemplate

      public void generateCompressorChartFromTemplate(String templateName, int numberOfSpeeds)
      Generates a compressor chart from a predefined template.

      Templates provide realistic compressor curve shapes based on typical compressor characteristics. Available templates:

      • "CENTRIFUGAL_STANDARD" - Standard centrifugal compressor curves
      • "CENTRIFUGAL_HIGH_FLOW" - High flow, lower head compressor
      • "CENTRIFUGAL_HIGH_HEAD" - High head, narrower operating range

      Example usage:

      compressor.generateCompressorChartFromTemplate("CENTRIFUGAL_STANDARD", 9);
      
      Parameters:
      templateName - Name of the template to use
      numberOfSpeeds - Number of speed curves to generate
    • generateCompressorChart

      public void generateCompressorChart(String generationOption, double[] speeds)
      Generates a compressor chart with specific speed values.

      This method allows precise control over which speeds are included in the chart.

      Parameters:
      generationOption - The generation option: "normal curves" or "mid range"
      speeds - Array of speed values in RPM
    • getCompressorChartType

      public String getCompressorChartType()
      Gets the current compressor chart type as a string.
      Returns:
      The chart type: "simple", "interpolate", or "interpolate and extrapolate"
    • isSolveSpeed

      public boolean isSolveSpeed()

      isSolveSpeed.

      Returns:
      a boolean
    • setSolveSpeed

      public void setSolveSpeed(boolean solveSpeed)

      Setter for the field solveSpeed.

      Parameters:
      solveSpeed - a boolean
    • isCalcPressureOut

      public boolean isCalcPressureOut()

      isCalcPressureOut.

      Returns:
      a boolean
    • setCalcPressureOut

      public void setCalcPressureOut(boolean calcPressureOut)

      Setter for the field calcPressureOut.

      Parameters:
      calcPressureOut - a boolean
    • isLimitSpeed

      public boolean isLimitSpeed()
      Checks if the compressor speed is limited.
      Returns:
      true if the compressor speed is limited, false otherwise.
    • setLimitSpeed

      public void setLimitSpeed(boolean limitSpeed)
      Sets whether the compressor speed should be limited.
      Parameters:
      limitSpeed - true to limit the compressor speed, false otherwise.
    • getExergyChange

      public double getExergyChange(String unit)

      getExergyChange.

      Specified by:
      getExergyChange in interface ProcessEquipmentInterface
      Parameters:
      unit - a String object
      Returns:
      a double
    • getCapacityDuty

      public double getCapacityDuty()

      getCapacityDuty.

      Specified by:
      getCapacityDuty in interface ProcessEquipmentInterface
      Returns:
      a double
    • getCapacityMax

      public double getCapacityMax()

      getCapacityMax.

      Specified by:
      getCapacityMax in interface ProcessEquipmentInterface
      Returns:
      a double
    • getStateVector

      public StateVector getStateVector()
      Get the current state as a standardized vector.

      The state vector should include all observable variables relevant for control and monitoring. Values should be in physical units with appropriate bounds.

      Returns state vector containing:

      • inlet_pressure - Inlet pressure [bar]
      • outlet_pressure - Outlet pressure [bar]
      • inlet_temperature - Inlet temperature [K]
      • outlet_temperature - Outlet temperature [K]
      • compression_ratio - Compression ratio [-]
      • polytropic_efficiency - Polytropic efficiency [fraction]
      • isentropic_efficiency - Isentropic efficiency [fraction]
      • power - Shaft power [kW]
      • speed - Rotational speed [rpm]
      • surge_margin - Distance to surge [%]
      • polytropic_head - Polytropic head [kJ/kg]
      • inlet_flow - Inlet mass flow [kg/s]
      Specified by:
      getStateVector in interface StateVectorProvider
      Returns:
      current state vector
    • getOperatingState

      public CompressorState getOperatingState()
      Get the current operating state of the compressor.
      Returns:
      the current CompressorState
    • setOperatingState

      public void setOperatingState(CompressorState state)
      Set the operating state of the compressor.
      Parameters:
      state - the new operating state
    • getDriver

      public CompressorDriver getDriver()
      Get the compressor driver model.
      Returns:
      the driver model, or null if not set
    • setDriver

      public void setDriver(CompressorDriver driver)
      Set the compressor driver model.
      Parameters:
      driver - the driver model
    • setDriver

      public void setDriver(DriverType type, double ratedPower)
      Create and set a new driver with specified type and rated power.
      Parameters:
      type - driver type
      ratedPower - rated power in kW
    • getOperatingHistory

      public CompressorOperatingHistory getOperatingHistory()
      Get the operating history tracker.
      Returns:
      the operating history, or null if not enabled
    • enableOperatingHistory

      public void enableOperatingHistory()
      Enable operating history tracking.
    • disableOperatingHistory

      public void disableOperatingHistory()
      Disable operating history tracking.
    • recordOperatingPoint

      public void recordOperatingPoint(double time)
      Record the current operating point to history.
      Parameters:
      time - simulation time in seconds
    • getStartupProfile

      public StartupProfile getStartupProfile()
      Get the startup profile.
      Returns:
      the startup profile, or null if not set
    • setStartupProfile

      public void setStartupProfile(StartupProfile profile)
      Set the startup profile.
      Parameters:
      profile - the startup profile
    • getShutdownProfile

      public ShutdownProfile getShutdownProfile()
      Get the shutdown profile.
      Returns:
      the shutdown profile, or null if not set
    • setShutdownProfile

      public void setShutdownProfile(ShutdownProfile profile)
      Set the shutdown profile.
      Parameters:
      profile - the shutdown profile
    • addEventListener

      public void addEventListener(CompressorEventListener listener)
      Add an event listener for compressor events.
      Parameters:
      listener - the event listener to add
    • removeEventListener

      public void removeEventListener(CompressorEventListener listener)
      Remove an event listener.
      Parameters:
      listener - the event listener to remove
    • getRotationalInertia

      public double getRotationalInertia()
      Get the rotational inertia of the compressor rotor.
      Returns:
      inertia in kg⋅m²
    • setRotationalInertia

      public void setRotationalInertia(double inertia)
      Set the rotational inertia of the compressor rotor.
      Parameters:
      inertia - inertia in kg⋅m²
    • getMaxAccelerationRate

      public double getMaxAccelerationRate()
      Get the maximum acceleration rate.
      Returns:
      max acceleration in RPM/s
    • setMaxAccelerationRate

      public void setMaxAccelerationRate(double rate)
      Set the maximum acceleration rate.
      Parameters:
      rate - max acceleration in RPM/s
    • getMaxDecelerationRate

      public double getMaxDecelerationRate()
      Get the maximum deceleration rate.
      Returns:
      max deceleration in RPM/s
    • setMaxDecelerationRate

      public void setMaxDecelerationRate(double rate)
      Set the maximum deceleration rate.
      Parameters:
      rate - max deceleration in RPM/s
    • getTargetSpeed

      public double getTargetSpeed()
      Get the target speed for dynamic control.
      Returns:
      target speed in RPM
    • setTargetSpeed

      public void setTargetSpeed(double speed)
      Set the target speed for dynamic control.
      Parameters:
      speed - target speed in RPM
    • isAutoSpeedMode

      public boolean isAutoSpeedMode()
      Check if auto-speed mode is enabled.

      In auto-speed mode, the compressor automatically calculates the required speed from the current operating point (flow and head) using the compressor chart.

      Returns:
      true if auto-speed mode is enabled
    • setAutoSpeedMode

      public void setAutoSpeedMode(boolean enabled)
      Enable or disable auto-speed mode.
      Parameters:
      enabled - true to enable auto-speed mode
    • getDegradationFactor

      public double getDegradationFactor()
      Get the performance degradation factor.
      Returns:
      degradation factor (1.0 = new, less than 1.0 = degraded)
    • setDegradationFactor

      public void setDegradationFactor(double factor)
      Set the performance degradation factor.
      Parameters:
      factor - degradation factor (1.0 = new, less than 1.0 = degraded)
    • getFoulingFactor

      public double getFoulingFactor()
      Get the fouling factor.
      Returns:
      fouling factor (0 = clean, higher = more fouled)
    • setFoulingFactor

      public void setFoulingFactor(double factor)
      Set the fouling factor.
      Parameters:
      factor - fouling factor (0 = clean, higher = more fouled)
    • getOperatingHours

      public double getOperatingHours()
      Get the total operating hours.
      Returns:
      operating hours
    • setOperatingHours

      public void setOperatingHours(double hours)
      Set the total operating hours.
      Parameters:
      hours - operating hours
    • addOperatingHours

      public void addOperatingHours(double hours)
      Add operating time.
      Parameters:
      hours - hours to add
    • getSurgeWarningThreshold

      public double getSurgeWarningThreshold()
      Get the surge warning threshold.
      Returns:
      threshold as ratio (e.g., 0.15 = 15% margin)
    • setSurgeWarningThreshold

      public void setSurgeWarningThreshold(double threshold)
      Set the surge warning threshold.
      Parameters:
      threshold - threshold as ratio
    • getSurgeCriticalThreshold

      public double getSurgeCriticalThreshold()
      Get the surge critical threshold.
      Returns:
      threshold as ratio (e.g., 0.05 = 5% margin)
    • setSurgeCriticalThreshold

      public void setSurgeCriticalThreshold(double threshold)
      Set the surge critical threshold.
      Parameters:
      threshold - threshold as ratio
    • getStoneWallWarningThreshold

      public double getStoneWallWarningThreshold()
      Get the stone wall warning threshold.
      Returns:
      threshold as ratio
    • setStoneWallWarningThreshold

      public void setStoneWallWarningThreshold(double threshold)
      Set the stone wall warning threshold.
      Parameters:
      threshold - threshold as ratio
    • checkSurgeMargin

      public void checkSurgeMargin()
      Check surge margin and fire events if thresholds are crossed.
    • checkStoneWallMargin

      public void checkStoneWallMargin()
      Check stone wall margin and fire events if threshold is crossed.
    • checkSpeedLimits

      public void checkSpeedLimits()
      Check speed limits and fire events if limits are exceeded.
    • checkPowerLimits

      public void checkPowerLimits()
      Check driver power limits and fire events if limits are exceeded.
    • startCompressor

      public void startCompressor(double targetOperatingSpeed)
      Start the compressor following the startup profile.
      Parameters:
      targetOperatingSpeed - the final target speed in RPM
    • stopCompressor

      public void stopCompressor(ShutdownProfile.ShutdownType type)
      Stop the compressor following the shutdown profile.
      Parameters:
      type - the type of shutdown
    • stopCompressor

      public void stopCompressor()
      Normal shutdown.
    • emergencyShutdown

      public void emergencyShutdown()
      Emergency shutdown (ESD).
    • updateDynamicState

      public void updateDynamicState(double timeStep)
      Update the compressor state during a transient simulation step.

      This method should be called during dynamic simulation to update the compressor speed, state, and fire appropriate events.

      Parameters:
      timeStep - the time step in seconds
    • updateStartup

      private void updateStartup(double timeStep)
      Update startup sequence.
      Parameters:
      timeStep - time step in seconds
    • updateShutdown

      private void updateShutdown(double timeStep)
      Update shutdown sequence.
      Parameters:
      timeStep - time step in seconds
    • updateSpeedWithInertia

      private void updateSpeedWithInertia(double targetSpd, double timeStep)
      Update speed considering inertia constraints.
      Parameters:
      targetSpd - target speed in RPM
      timeStep - time step in seconds
    • updateAutoSpeed

      private void updateAutoSpeed()
      Update speed automatically based on operating point.
    • getEffectivePolytropicHead

      public double getEffectivePolytropicHead()
      Get the effective polytropic head accounting for degradation.
      Returns:
      effective head in kJ/kg
    • getEffectivePolytropicEfficiency

      public double getEffectivePolytropicEfficiency()
      Get the effective efficiency accounting for degradation.
      Returns:
      effective polytropic efficiency
    • fireSurgeApproachEvent

      private void fireSurgeApproachEvent(double surgeMargin, boolean isCritical)
      Fire surge approach event to all listeners.
      Parameters:
      surgeMargin - current surge margin
      isCritical - true if critical threshold
    • fireSurgeOccurredEvent

      private void fireSurgeOccurredEvent(double surgeMargin)
      Fire surge occurred event.
      Parameters:
      surgeMargin - current surge margin
    • fireSpeedLimitExceededEvent

      private void fireSpeedLimitExceededEvent(double currentSpeed, double ratio)
      Fire speed limit exceeded event.
      Parameters:
      currentSpeed - current speed
      ratio - ratio to max speed
    • fireSpeedBelowMinimumEvent

      private void fireSpeedBelowMinimumEvent(double currentSpeed, double ratio)
      Fire speed below minimum event.
      Parameters:
      currentSpeed - current speed
      ratio - ratio to min speed
    • firePowerLimitExceededEvent

      private void firePowerLimitExceededEvent(double currentPower, double maxPower)
      Fire power limit exceeded event.
      Parameters:
      currentPower - current power in kW
      maxPower - max available power in kW
    • fireStateChangeEvent

      private void fireStateChangeEvent(CompressorState oldState, CompressorState newState)
      Fire state change event.
      Parameters:
      oldState - previous state
      newState - new state
    • fireStoneWallApproachEvent

      private void fireStoneWallApproachEvent(double stoneWallMargin)
      Fire stone wall approach event.
      Parameters:
      stoneWallMargin - margin to stone wall
    • fireStartupCompleteEvent

      private void fireStartupCompleteEvent()
      Fire startup complete event.
    • fireShutdownCompleteEvent

      private void fireShutdownCompleteEvent()
      Fire shutdown complete event.
    • acknowledgeTrip

      public void acknowledgeTrip()
      Acknowledge a tripped compressor to allow restart.
    • resetDynamicState

      public void resetDynamicState()
      Reset all dynamic simulation state.
    • builder

      public static Compressor.Builder builder(String name)
      Creates a new Builder for constructing a Compressor with a fluent API.

      Example usage:

      Compressor comp = Compressor.builder("K-100").inletStream(feed).outletPressure(50.0, "bara")
          .polytropicEfficiency(0.75).speed(8000).build();
      
      Parameters:
      name - the name of the compressor
      Returns:
      a new Builder instance