Class Stream

All Implemented Interfaces:
Serializable, Cloneable, Runnable, ProcessEquipmentInterface, StreamInterface, SimulationInterface, NamedInterface
Direct Known Subclasses:
DexpiStream, DexpiStream, EquilibriumStream, IronIonSaturationStream, NeqStream, ScalePotentialCheckStream

public class Stream extends ProcessEquipmentBaseClass implements StreamInterface, Cloneable

Stream 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

      protected SystemInterface thermoSystem
    • streamNumber

      protected int streamNumber
    • numberOfStreams

      protected static int numberOfStreams
      Constant numberOfStreams=0.
    • gasQuality

      private double gasQuality
    • stream

      protected StreamInterface stream
    • lastTemperature

      protected double lastTemperature
    • lastPressure

      protected double lastPressure
    • lastFlowRate

      protected double lastFlowRate
    • lastComposition

      protected double[] lastComposition
  • Constructor Details

    • Stream

      public Stream(String name)
      Constructor for Stream.
      Parameters:
      name - name of stream
    • Stream

      public Stream(String name, StreamInterface stream)

      Constructor for Stream.

      NB! This construct uses the input stream object internally, i.e., it is not cloned. Use streamObject.clone(newName) rather than new Stream(newName,streamObject)

      Parameters:
      name - name of stream
      stream - Stream to use as internal Stream.
    • Stream

      public Stream(String name, SystemInterface thermoSystem)

      Constructor for Stream.

      NB! This construct uses the input thermoSystem object internally, i.e., it is not cloned.

      Parameters:
      name - name of stream
      thermoSystem - System to use as internal System.
  • Method Details

    • getGasQuality

      public double getGasQuality()

      Getter for the field gasQuality.

      Returns:
      the gasQuality
    • setGasQuality

      public void setGasQuality(double gasQuality)

      Setter for the field gasQuality.

      Parameters:
      gasQuality - the gasQuality to set
    • getHydrateEquilibriumTemperature

      public double getHydrateEquilibriumTemperature()

      getHydrateEquilibriumTemperature.

      Specified by:
      getHydrateEquilibriumTemperature in interface StreamInterface
      Returns:
      a double
    • getSolidFormationTemperature

      public double getSolidFormationTemperature(String solidName)

      getSolidFormationTemperature.

      Parameters:
      solidName - a String object
      Returns:
      a double
    • clone

      public Stream clone()

      Clone object.

      Specified by:
      clone in interface StreamInterface
      Overrides:
      clone in class Object
      Returns:
      a StreamInterface object
    • clone

      public Stream clone(String name)

      Clone object and set a new name.

      Specified by:
      clone in interface StreamInterface
      Parameters:
      name - Name of cloned object
      Returns:
      a StreamInterface object
    • getTemperature

      public double getTemperature()

      Getter for the field temperature.

      Specified by:
      getTemperature in interface ProcessEquipmentInterface
      Specified by:
      getTemperature in interface StreamInterface
      Overrides:
      getTemperature in class ProcessEquipmentBaseClass
      Returns:
      a double
    • getTemperature

      public double getTemperature(String unit)

      Getter for the field temperature converted to specified unit.

      Specified by:
      getTemperature in interface ProcessEquipmentInterface
      Specified by:
      getTemperature in interface StreamInterface
      Overrides:
      getTemperature in class ProcessEquipmentBaseClass
      Parameters:
      unit - a String object
      Returns:
      a double
    • getMolarRate

      public double getMolarRate()

      getMolarRate.

      Specified by:
      getMolarRate in interface StreamInterface
      Returns:
      a double
    • setThermoSystem

      public void setThermoSystem(SystemInterface thermoSystem)

      setThermoSystem.

      Specified by:
      setThermoSystem in interface StreamInterface
      Parameters:
      thermoSystem - a SystemInterface object
    • setFluid

      public void setFluid(SystemInterface fluid)

      setFluid.

      Specified by:
      setFluid in interface StreamInterface
      Parameters:
      fluid - a SystemInterface object
    • setThermoSystemFromPhase

      public void setThermoSystemFromPhase(SystemInterface thermoSystem, String phaseTypeName)

      setThermoSystemFromPhase.

      Specified by:
      setThermoSystemFromPhase in interface StreamInterface
      Parameters:
      thermoSystem - a SystemInterface object
      phaseTypeName - a String object
    • setEmptyThermoSystem

      public void setEmptyThermoSystem(SystemInterface thermoSystem)

      setEmptyThermoSystem.

      Specified by:
      setEmptyThermoSystem in interface StreamInterface
      Parameters:
      thermoSystem - a SystemInterface object
    • getThermoSystem

      public SystemInterface getThermoSystem()

      getThermoSystem.

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

      public void setFlowRate(double flowrate, String unit)

      setFlowRate.

      Specified by:
      setFlowRate in interface StreamInterface
      Parameters:
      flowrate - a double
      unit - a String object
    • setPressure

      public void setPressure(double pressure, String unit)

      setPressure.

      Specified by:
      setPressure in interface StreamInterface
      Parameters:
      pressure - a double
      unit - a String object
    • setTemperature

      public void setTemperature(double temperature, String unit)

      setTemperature.

      Specified by:
      setTemperature in interface StreamInterface
      Parameters:
      temperature - a double
      unit - a String object
    • runTPflash

      public void runTPflash()

      runTPflash.

      Specified by:
      runTPflash in interface StreamInterface
    • needRecalculation

      public boolean needRecalculation()

      Check if process equipment needs recalculating.

      Specified by:
      needRecalculation in interface ProcessEquipmentInterface
      Returns:
      true or false
    • 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
    • runController

      public void runController(double dt, UUID id)

      runController.

      Parameters:
      dt - a double
      id - UUID of run
    • flashStream

      public void flashStream()

      flashStream.

      Specified by:
      flashStream in interface StreamInterface
    • phaseEnvelope

      public void phaseEnvelope()

      phaseEnvelope.

    • CCB

      public double CCB(String unit)

      Calculate and return cricondenbar.

      Specified by:
      CCB in interface StreamInterface
      Parameters:
      unit - a String object
      Returns:
      Calculated cricondenbar in specified unit
    • CCT

      public double CCT(String unit)

      Calculate and return cricondentherm.

      Specified by:
      CCT in interface StreamInterface
      Parameters:
      unit - a String object
      Returns:
      Calculated cricondentherm in specified unit
    • TVP

      public double TVP(double temperature, String unit)

      Calculates the True Vapor Pressure (TVP) of the stream.

      Specified by:
      TVP in interface StreamInterface
      Parameters:
      temperature - a double
      unit - a String object
      Returns:
      a double
    • getTVP

      public double getTVP(double referenceTemperature, String unit, String returnUnit)

      Calculates the True Vapor Pressure (TVP) of the stream.

      Specified by:
      getTVP in interface StreamInterface
      Parameters:
      referenceTemperature - a double
      unit - a String object
      returnUnit - a String object
      Returns:
      a double
    • getRVP

      public double getRVP(double referenceTemperature, String unit, String returnUnit)

      Calculates the Reid Vapor Pressure (RVP) of the stream.

      Specified by:
      getRVP in interface StreamInterface
      Parameters:
      referenceTemperature - a double
      unit - a String object
      returnUnit - a String object
      Returns:
      a double
    • getRVP

      public double getRVP(double referenceTemperature, String unit, String returnUnit, String rvpMethod)
      Calculates the Reid Vapor Pressure (RVP) of the stream.
      Specified by:
      getRVP in interface StreamInterface
      Parameters:
      referenceTemperature - the reference temperature at which RVP is calculated
      unit - the unit of the reference temperature
      returnUnit - the unit in which the RVP should be returned
      rvpMethod - the method used to calculate RVP
      Returns:
      the calculated RVP in the specified return unit
    • reportResults

      public String[][] reportResults()

      reportResults.

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

      public Object getProperty(String propertyName, String unit, String phase, String component)

      getProperty.

      Parameters:
      propertyName - a String object
      unit - a String object
      phase - a String object
      component - a String object
      Returns:
      a Object object
    • GCV

      public double GCV()

      GCV.

      Specified by:
      GCV in interface StreamInterface
      Returns:
      a double
    • getHydrocarbonDewPoint

      public double getHydrocarbonDewPoint(String temperatureUnit, double refpressure, String refPressureUnit)
      Calculates the hydrocarbon dew point of the stream.
      Specified by:
      getHydrocarbonDewPoint in interface StreamInterface
      Parameters:
      temperatureUnit - the unit of the temperature to be used (e.g., "C" for Celsius, "K" for Kelvin)
      refpressure - the reference pressure at which the dew point is to be calculated
      refPressureUnit - the unit of the reference pressure (e.g., "bar", "Pa")
      Returns:
      the hydrocarbon dew point temperature in the specified temperature unit
    • getGCV

      public double getGCV(String unit, double refTVolume, double refTCombustion)

      getGCV.

      Specified by:
      getGCV in interface StreamInterface
      Parameters:
      unit - a String
      refTVolume - a double in Celcius
      refTCombustion - a double in Celcius
      Returns:
      a double
    • getWI

      public double getWI(String unit, double refTVolume, double refTCombustion)

      getWI.

      Specified by:
      getWI in interface StreamInterface
      Parameters:
      unit - a String
      refTVolume - a double in Celcius
      refTCombustion - a double in Celcius
      Returns:
      a double
    • getISO6976

      public Standard_ISO6976 getISO6976(String unit, double refTVolume, double refTCombustion)

      getWI.

      Specified by:
      getISO6976 in interface StreamInterface
      Parameters:
      unit - a String
      refTVolume - a double in Celcius
      refTCombustion - a double in Celcius
      Returns:
      a Standard_ISO6976
    • LCV

      public double LCV()

      LCV.

      Specified by:
      LCV in interface StreamInterface
      Returns:
      a double
    • setStream

      public void setStream(StreamInterface stream)

      Setter for the field stream.

      Parameters:
      stream - a StreamInterface object
    • setInletStream

      public void setInletStream(StreamInterface stream)

      Setter for the field stream.

      Parameters:
      stream - a StreamInterface object
    • getOutletStream

      public StreamInterface getOutletStream()
      Gets the outlet stream.
      Returns:
      the outlet stream as a StreamInterface object.
    • getFluid

      public SystemInterface getFluid()

      getFluid.

      Specified by:
      getFluid in interface ProcessEquipmentInterface
      Returns:
      a SystemInterface object
    • getReport

      public ArrayList<String[]> getReport()

      getReport.

      Returns:
      a String 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
    • 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 stream setup before execution. Checks that:

      • Equipment has a valid name
      • Thermodynamic system is set and valid
      • Temperature and pressure are in valid ranges
      Specified by:
      validateSetup in interface ProcessEquipmentInterface
      Returns:
      validation result with errors and warnings