Class Separator

All Implemented Interfaces:
Serializable, Runnable, ProcessEquipmentInterface, SeparatorInterface, StateVectorProvider, SimulationInterface, NamedInterface
Direct Known Subclasses:
GasScrubber, GasScrubberSimple, Hydrocyclone, Hydrocyclone, NeqGasScrubber, SimpleAbsorber, ThreePhaseSeparator, TwoPhaseSeparator

public class Separator extends ProcessEquipmentBaseClass implements SeparatorInterface, StateVectorProvider

Separator class.

Version:
$Id: $Id
Author:
Even Solbraa
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

      SystemInterface thermoSystem
    • gasSystem

      SystemInterface gasSystem
    • waterSystem

      SystemInterface waterSystem
    • liquidSystem

      SystemInterface liquidSystem
    • thermoSystemCloned

      SystemInterface thermoSystemCloned
    • thermoSystem2

      SystemInterface thermoSystem2
    • isInitTransient

      boolean isInitTransient
    • orientation

      private String orientation
      Orientation of separator. "horizontal" or "vertical"
    • gasOutStream

      StreamInterface gasOutStream
    • liquidOutStream

      StreamInterface liquidOutStream
    • pressureDrop

      private double pressureDrop
    • numberOfInputStreams

      public int numberOfInputStreams
    • inletStreamMixer

      Mixer inletStreamMixer
    • efficiency

      private double efficiency
    • liquidCarryoverFraction

      private double liquidCarryoverFraction
    • gasCarryunderFraction

      private double gasCarryunderFraction
    • specifiedStream

      private String specifiedStream
    • oilInGas

      private double oilInGas
    • oilInGasSpec

      private String oilInGasSpec
    • waterInGas

      private double waterInGas
    • waterInGasSpec

      private String waterInGasSpec
    • gasInLiquid

      private double gasInLiquid
    • gasInLiquidSpec

      private String gasInLiquidSpec
    • separatorLength

      private double separatorLength
      Length of separator volume.
    • internalDiameter

      private double internalDiameter
      Inner diameter/height of separator volume.
    • internalRadius

      private double internalRadius
    • liquidLevel

      protected double liquidLevel
      Liquid level height in meters (default set to 50% of internal diameter).
    • MIN_HEADSPACE_FRACTION

      private static final double MIN_HEADSPACE_FRACTION
      See Also:
    • MIN_HEADSPACE_VOLUME

      private static final double MIN_HEADSPACE_VOLUME
      See Also:
    • sepCrossArea

      private double sepCrossArea
      Separator cross sectional area.
    • separatorVolume

      private double separatorVolume
      Separator volume.
    • liquidVolume

      double liquidVolume
    • gasVolume

      double gasVolume
    • designLiquidLevelFraction

      private double designLiquidLevelFraction
    • separatorSection

      ArrayList<SeparatorSection> separatorSection
    • separatorMechanicalDesign

      SeparatorMechanicalDesign separatorMechanicalDesign
    • lastEnthalpy

      private double lastEnthalpy
    • lastFlowRate

      private double lastFlowRate
    • lastPressure

      private double lastPressure
    • setHeatInput

      private boolean setHeatInput
    • heatInput

      private double heatInput
    • heatInputUnit

      private String heatInputUnit
  • Constructor Details

    • Separator

      public Separator(String name)
      Constructor for Separator.
      Parameters:
      name - Name of separator
    • Separator

      public Separator(String name, StreamInterface inletStream)
      Constructor for Separator.
      Parameters:
      name - a String object
      inletStream - a StreamInterface object
  • Method Details

    • initializeTransientCalculation

      public void initializeTransientCalculation()
      Initializes separator for transient calculations.
    • getMechanicalDesign

      public SeparatorMechanicalDesign 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
    • setInletStream

      public void setInletStream(StreamInterface inletStream)

      setInletStream.

      Parameters:
      inletStream - a StreamInterface object
    • addStream

      public void addStream(StreamInterface newStream)

      addStream.

      Parameters:
      newStream - a StreamInterface object
    • getLiquidOutStream

      public StreamInterface getLiquidOutStream()

      Getter for the field liquidOutStream.

      Returns:
      a StreamInterface object
    • getGasOutStream

      public StreamInterface getGasOutStream()

      Getter for the field gasOutStream.

      Returns:
      a StreamInterface object
    • getGas

      public StreamInterface getGas()

      getGas.

      Returns:
      a StreamInterface object
    • getLiquid

      public StreamInterface getLiquid()

      getLiquid.

      Returns:
      a StreamInterface object
    • getThermoSystem

      public SystemInterface getThermoSystem()

      getThermoSystem.

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

      public void setEntrainment(double val, String specType, String specifiedStream, String phaseFrom, String phaseTo)

      setEntrainment.

      Parameters:
      val - a double specifying the entrainment amount
      specType - a String object describing the specification unit
      specifiedStream - a String object describing the reference stream
      phaseFrom - a String object describing the phase entrained from
      phaseTo - a String object describing the phase entrained to
    • 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
    • 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
    • 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
    • setTempPres

      public void setTempPres(double temp, double pres)

      setTempPres.

      Parameters:
      temp - a double
      pres - a double
    • getEfficiency

      public double getEfficiency()

      Getter for the field efficiency.

      Returns:
      a double
    • setEfficiency

      public void setEfficiency(double efficiency)

      Setter for the field efficiency.

      Parameters:
      efficiency - a double
    • getLiquidCarryoverFraction

      public double getLiquidCarryoverFraction()

      Getter for the field liquidCarryoverFraction.

      Returns:
      a double
    • setLiquidCarryoverFraction

      public void setLiquidCarryoverFraction(double liquidCarryoverFraction)

      Setter for the field liquidCarryoverFraction.

      Parameters:
      liquidCarryoverFraction - a double
    • getGasCarryunderFraction

      public double getGasCarryunderFraction()

      Getter for the field gasCarryunderFraction.

      Returns:
      a double
    • setGasCarryunderFraction

      public void setGasCarryunderFraction(double gasCarryunderFraction)

      Setter for the field gasCarryunderFraction.

      Parameters:
      gasCarryunderFraction - a double
    • setLiquidLevel

      public void setLiquidLevel(double liquidlev)

      Setter for the field liquidLevel.

      Specified by:
      setLiquidLevel in interface SeparatorInterface
      Parameters:
      liquidlev - a double
    • getLiquidLevel

      public double getLiquidLevel()

      Getter for the field liquidLevel in percentage.

      Returns:
      a double
    • getPressureDrop

      public double getPressureDrop()

      Getter for the field pressureDrop.

      Returns:
      the pressureDrop
    • setPressureDrop

      public void setPressureDrop(double pressureDrop)

      Setter for the field pressureDrop.

      Parameters:
      pressureDrop - the pressureDrop to set
    • getInternalDiameter

      public double getInternalDiameter()

      Getter for the field internalDiameter.

      Returns:
      the diameter
    • setInternalDiameter

      public void setInternalDiameter(double diameter)

      setInternalDiameter.

      Specified by:
      setInternalDiameter in interface SeparatorInterface
      Parameters:
      diameter - a double
    • getGasSuperficialVelocity

      public double getGasSuperficialVelocity()

      getGasSuperficialVelocity.

      Returns:
      a double
    • getGasLoadFactor

      public double getGasLoadFactor()

      getGasLoadFactor.

      Returns:
      a double
    • getGasLoadFactor

      public double getGasLoadFactor(int phaseNumber)

      getGasLoadFactor.

      Parameters:
      phaseNumber - a int
      Returns:
      a double
    • getDeRatedGasLoadFactor

      public double getDeRatedGasLoadFactor()

      getDeRatedGasLoadFactor.

      Returns:
      a double
    • getDeRatedGasLoadFactor

      public double getDeRatedGasLoadFactor(int phaseNum)

      getDeRatedGasLoadFactor.

      Parameters:
      phaseNum - a int
      Returns:
      a double
    • getOrientation

      public String getOrientation()

      Getter for the field orientation.

      Returns:
      the orientation
    • setOrientation

      public void setOrientation(String orientation)

      Setter for the field orientation.

      Parameters:
      orientation - the orientation to set
    • liquidArea

      public double liquidArea(double level)

      Calculates both gas and liquid fluid section areas for horizontal separators. Results can be used for volume calculation, gas superficial velocity, and settling time.

      Parameters:
      level - current liquid level inside the separator [m]
      Returns:
      separator liquid area.
    • calcLiquidVolume

      public double calcLiquidVolume()

      calculates liquid volume based on separator type.

      Returns:
      liquid level in the separator
    • updateHoldupVolumes

      private void updateHoldupVolumes()
      Keeps cached gas/liquid holdup volumes aligned with current geometry and level.
    • enforceHeadspace

      protected void enforceHeadspace()
    • getMaxLiquidHeight

      private double getMaxLiquidHeight()
    • getMinGasVolume

      private double getMinGasVolume()
    • clampLiquidHeight

      private double clampLiquidHeight(double height)
    • getInnerSurfaceArea

      public double getInnerSurfaceArea()
      Calculates the total inner surface area of the separator, including shell and heads.
      Returns:
      inner surface area in square meters
    • getWettedArea

      public double getWettedArea()
      Estimates the wetted inner surface area based on current liquid level and orientation.

      For horizontal separators, the wetted area uses the circular segment defined by the liquid level to apportion the cylindrical shell and head areas. For vertical separators, the wetted area is the side area up to the current level plus the bottom head.

      Returns:
      wetted area in square meters
    • getUnwettedArea

      public double getUnwettedArea()
      Estimates the unwetted (dry) area as the remaining inner area not in contact with liquid.
      Returns:
      unwetted area in square meters
    • evaluateFireExposure

      Evaluates fire exposure using the separator geometry and process conditions.
      Parameters:
      config - fire scenario configuration
      Returns:
      aggregated fire exposure result
    • evaluateFireExposure

      public SeparatorFireExposure.FireExposureResult evaluateFireExposure(SeparatorFireExposure.FireScenarioConfig config, Flare flare, double flareGroundDistanceM)
      Evaluates fire exposure using separator geometry and process conditions while accounting for flare radiation based on the real flaring heat duty.
      Parameters:
      config - fire scenario configuration
      flare - flare supplying heat duty and radiation parameters
      flareGroundDistanceM - horizontal distance from flare base to separator [m]
      Returns:
      aggregated fire exposure result
    • levelFromVolume

      public double levelFromVolume(double volumeTarget)

      Estimates liquid level based on volume for horizontal separators using bisection method. Vertical separators too. tol and maxIter are bisection loop parameters.

      Parameters:
      volumeTarget - desired liquid volume to be held in the separator [m3]
      Returns:
      liquid level in the separator
    • getSeparatorLength

      public double getSeparatorLength()

      Getter for the field separatorLength.

      Returns:
      the separatorLength
    • setSeparatorLength

      public void setSeparatorLength(double separatorLength)

      Setter for the field separatorLength.

      Parameters:
      separatorLength - the separatorLength to set
    • getSeparatorSection

      public SeparatorSection getSeparatorSection(int i)

      Getter for the field separatorSection.

      Parameters:
      i - a int
      Returns:
      a SeparatorSection object
    • getSeparatorSection

      public SeparatorSection getSeparatorSection(String name)

      Getter for the field separatorSection.

      Parameters:
      name - a String object
      Returns:
      a SeparatorSection object
    • getSeparatorSections

      public ArrayList<SeparatorSection> getSeparatorSections()

      getSeparatorSections.

      Returns:
      a ArrayList object
    • addSeparatorSection

      public void addSeparatorSection(String name, String type)

      addSeparatorSection.

      Parameters:
      name - a String object
      type - a String object
    • getDesignLiquidLevelFraction

      public double getDesignLiquidLevelFraction()

      Getter for the field designLiquidLevelFraction.

      Returns:
      the designGasLevelFraction
    • setDesignLiquidLevelFraction

      public void setDesignLiquidLevelFraction(double designLiquidLevelFraction)

      Setter for the field designLiquidLevelFraction.

      Parameters:
      designLiquidLevelFraction - a double
    • getPressure

      public double getPressure()

      Getter for the field pressure.

      Specified by:
      getPressure in interface ProcessEquipmentInterface
      Overrides:
      getPressure in class ProcessEquipmentBaseClass
      Returns:
      Pressure in bara
    • 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
    • getMassBalance

      public double getMassBalance(String unit)

      getMassBalance.

      Specified by:
      getMassBalance in interface ProcessEquipmentInterface
      Overrides:
      getMassBalance 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
    • 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
    • getFeedStream

      public StreamInterface getFeedStream()

      getFeedStream.

      Returns:
      a StreamInterface object
    • 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 ProcessEquipmentBaseClass
      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 ProcessEquipmentBaseClass
      Parameters:
      cfg - report configuration
      Returns:
      json string
    • setHeatInput

      public void setHeatInput(double heatInput)
      Set heat input to the separator (e.g., from flare radiation, external heating).
      Specified by:
      setHeatInput in interface SeparatorInterface
      Parameters:
      heatInput - heat duty in watts
    • setHeatInput

      public void setHeatInput(double heatInput, String unit)
      Set heat input to the separator with specified unit.
      Specified by:
      setHeatInput in interface SeparatorInterface
      Parameters:
      heatInput - heat duty value
      unit - heat duty unit (W, kW, MW, J/s, etc.)
    • setHeatDuty

      public void setHeatDuty(double heatDuty)
      Set heat duty (alias for setHeatInput).
      Parameters:
      heatDuty - heat duty in watts
    • setHeatDuty

      public void setHeatDuty(double heatDuty, String unit)
      Set heat duty with unit (alias for setHeatInput).
      Parameters:
      heatDuty - heat duty value
      unit - heat duty unit
    • setDuty

      public void setDuty(double heatDuty)
      Set heat duty (alias preserved for compatibility with energy-stream style naming).
      Parameters:
      heatDuty - heat duty in watts
    • setDuty

      public void setDuty(double heatDuty, String unit)
      Set heat duty with unit (alias preserved for compatibility with energy-stream style naming).
      Parameters:
      heatDuty - heat duty value
      unit - heat duty unit
    • getHeatInput

      public double getHeatInput()
      Get heat input in watts.
      Specified by:
      getHeatInput in interface SeparatorInterface
      Returns:
      heat input in watts
    • getHeatInput

      public double getHeatInput(String unit)
      Get heat input in specified unit.
      Specified by:
      getHeatInput in interface SeparatorInterface
      Parameters:
      unit - desired unit (W, kW, MW)
      Returns:
      heat input in specified unit
    • getHeatDuty

      public double getHeatDuty()
      Get heat duty (alias for getHeatInput).
      Returns:
      heat duty in watts
    • getHeatDuty

      public double getHeatDuty(String unit)
      Get heat duty in specified unit.
      Parameters:
      unit - desired unit
      Returns:
      heat duty in specified unit
    • isSetHeatInput

      public boolean isSetHeatInput()
      Check if heat input is set.
      Specified by:
      isSetHeatInput in interface SeparatorInterface
      Returns:
      true if heat input is explicitly set
    • 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:

      • pressure - Separator pressure [bar]
      • temperature - Separator temperature [K]
      • liquid_level - Liquid level fraction [0-1]
      • gas_density - Gas phase density [kg/m³]
      • liquid_density - Liquid phase density [kg/m³]
      • gas_flow - Gas outlet flow [kg/s]
      • liquid_flow - Liquid outlet flow [kg/s]
      • gas_load_factor - Gas load factor [-]
      Specified by:
      getStateVector in interface StateVectorProvider
      Returns:
      current state vector
    • validateSetup

      public ValidationResult validateSetup()
      Validate the process equipment before execution.

      Checks for common setup errors:

      • Equipment has a valid name
      • Input streams connected
      • Operating parameters in valid ranges

      Validates the separator setup before execution. Checks that:

      • Equipment has a valid name
      • At least one inlet stream is connected
      • Separator dimensions are positive
      • Liquid level is within valid range
      Specified by:
      validateSetup in interface ProcessEquipmentInterface
      Returns:
      validation result with errors and warnings
    • builder

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

      Example usage:

      Separator sep = Separator.builder("V-100").inletStream(feed).orientation("horizontal")
          .length(5.0).diameter(2.0).liquidLevel(0.5).build();
      
      Parameters:
      name - the name of the separator
      Returns:
      a new Builder instance