Class Splitter

All Implemented Interfaces:
Serializable, Runnable, CapacityConstrainedEquipment, ProcessEquipmentInterface, SplitterInterface, SimulationInterface, NamedInterface

Splitter 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.
    • mechanicalDesign

      private SplitterMechanicalDesign mechanicalDesign
      Mechanical design for the splitter.
    • splitterCapacityConstraints

      private Map<String, CapacityConstraint> splitterCapacityConstraints
      Splitter capacity constraints map.
    • splitterCapacityAnalysisEnabled

      private boolean splitterCapacityAnalysisEnabled
      Whether capacity analysis is enabled.
    • designPressureDrop

      private double designPressureDrop
      Design pressure drop [bar].
    • maxDesignVelocity

      private double maxDesignVelocity
      Maximum design velocity [m/s].
    • thermoSystem

      SystemInterface thermoSystem
    • gasSystem

      SystemInterface gasSystem
    • waterSystem

      SystemInterface waterSystem
    • liquidSystem

      SystemInterface liquidSystem
    • thermoSystemCloned

      SystemInterface thermoSystemCloned
    • inletStream

      StreamInterface inletStream
    • splitStream

      StreamInterface[] splitStream
    • splitNumber

      protected int splitNumber
    • splitFactor

      double[] splitFactor
    • flowRates

      double[] flowRates
    • flowUnit

      String flowUnit
    • oldSplitFactor

      protected double[] oldSplitFactor
    • lastTemperature

      protected double lastTemperature
    • lastPressure

      protected double lastPressure
    • lastFlowRate

      protected double lastFlowRate
    • lastComposition

      protected double[] lastComposition
  • Constructor Details

    • Splitter

      public Splitter(String name)
      Constructor for Splitter.
      Parameters:
      name - name of splitter
    • Splitter

      public Splitter(String name, StreamInterface inStream)
      Constructor for Splitter.
      Parameters:
      name - name of splitter
      inStream - input stream
    • Splitter

      public Splitter(String name, StreamInterface inletStream, int number_of_splits)

      Constructor for Splitter.

      Parameters:
      name - a String object
      inletStream - a StreamInterface object
      number_of_splits - an int
  • Method Details

    • getMechanicalDesign

      public MechanicalDesign 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
    • getInletStream

      public StreamInterface getInletStream()

      Getter for the field inletStream.

      Returns:
      a StreamInterface object
    • setSplitNumber

      public void setSplitNumber(int number_of_splits)

      setSplitNumber.

      Specified by:
      setSplitNumber in interface SplitterInterface
      Parameters:
      number_of_splits - a int
    • setSplitFactors

      public void setSplitFactors(double[] splitFact)

      setSplitFactors.

      Parameters:
      splitFact - an array of type double
    • setFlowRates

      public void setFlowRates(double[] flowRates, String flowUnit)

      setFlowRates.

      Parameters:
      flowRates - an array of type double
      flowUnit - a String object
    • calcSplitFactors

      public void calcSplitFactors()

      calcSplitFactors.

    • setInletStream

      public void setInletStream(StreamInterface inletStream)

      setInletStream.

      Specified by:
      setInletStream in interface SplitterInterface
      Parameters:
      inletStream - a StreamInterface object
    • getSplitStream

      public StreamInterface getSplitStream(int i)

      getSplitStream.

      Specified by:
      getSplitStream in interface SplitterInterface
      Parameters:
      i - a int
      Returns:
      a Stream object
    • 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
    • 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
    • getSplitFactor

      public double getSplitFactor(int i)

      Getter for the field splitFactor.

      Parameters:
      i - a int
      Returns:
      a double
    • getSplitFactors

      public double[] getSplitFactors()

      getSplitFactors.

      Returns:
      an array of type double
    • getSplitNumber

      public int getSplitNumber()

      getSplitNumber.

      Returns:
      number of split outlets
    • 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
    • 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
    • displayResult

      public void displayResult()

      displayResult.

      Specified by:
      displayResult in interface ProcessEquipmentInterface
      Overrides:
      displayResult in class ProcessEquipmentBaseClass
    • 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 splitter setup before execution. Checks that:

      • Equipment has a valid name
      • Inlet stream is connected
      • Split factors are valid (sum to 1.0, all non-negative)
      • At least one split outlet is defined
      Specified by:
      validateSetup in interface ProcessEquipmentInterface
      Returns:
      validation result with errors and warnings
    • initializeSplitterCapacityConstraints

      private void initializeSplitterCapacityConstraints()
      Initialize splitter capacity constraints.
    • setDesignPressureDrop

      public void setDesignPressureDrop(double pressureDrop)
      Sets the design pressure drop.
      Parameters:
      pressureDrop - design pressure drop in bar
    • getDesignPressureDrop

      public double getDesignPressureDrop()
      Gets the design pressure drop.
      Returns:
      design pressure drop in bar
    • setMaxDesignVelocity

      public void setMaxDesignVelocity(double velocity)
      Sets the maximum design velocity.
      Parameters:
      velocity - max design velocity in m/s
    • getMaxDesignVelocity

      public double getMaxDesignVelocity()
      Gets the maximum design velocity.
      Returns:
      max design velocity in m/s
    • isCapacityAnalysisEnabled

      public boolean isCapacityAnalysisEnabled()
      Checks if capacity analysis is enabled for this equipment.

      When disabled, this equipment is excluded from bottleneck detection, capacity utilization summaries, and optimization routines. The equipment still tracks its constraints but doesn't contribute to system-level analysis.

      Specified by:
      isCapacityAnalysisEnabled in interface CapacityConstrainedEquipment
      Overrides:
      isCapacityAnalysisEnabled in class ProcessEquipmentBaseClass
      Returns:
      true if capacity analysis is enabled (default is true)
    • setCapacityAnalysisEnabled

      public void setCapacityAnalysisEnabled(boolean enabled)
      Enables or disables capacity analysis for this equipment.

      When disabled, this equipment is excluded from:

      • System bottleneck detection (ProcessSystem.findBottleneck())
      • Capacity utilization summaries (ProcessSystem.getCapacityUtilizationSummary())
      • Equipment near capacity lists (ProcessSystem.getEquipmentNearCapacityLimit())
      • Optimization constraint checking

      The equipment still calculates and tracks its constraints internally.

      Specified by:
      setCapacityAnalysisEnabled in interface CapacityConstrainedEquipment
      Overrides:
      setCapacityAnalysisEnabled in class ProcessEquipmentBaseClass
      Parameters:
      enabled - true to include in capacity analysis, false to exclude
    • getCapacityConstraints

      public Map<String, CapacityConstraint> getCapacityConstraints()
      Gets all capacity constraints defined for this equipment.

      The map keys are constraint names (e.g., "speed", "gasLoadFactor") and values are the corresponding CapacityConstraint objects containing design values, current values, and utilization calculations.

      Specified by:
      getCapacityConstraints in interface CapacityConstrainedEquipment
      Returns:
      unmodifiable map of constraint name to CapacityConstraint
    • getBottleneckConstraint

      public CapacityConstraint getBottleneckConstraint()
      Gets the constraint with the highest utilization (the bottleneck).

      This method identifies which constraint is closest to or exceeding its design limit. Use this to determine what is limiting equipment capacity.

      Specified by:
      getBottleneckConstraint in interface CapacityConstrainedEquipment
      Returns:
      the bottleneck constraint, or null if no constraints are defined
    • isCapacityExceeded

      public boolean isCapacityExceeded()
      Checks if any capacity constraint is violated (exceeds 100% utilization).

      A violated constraint means the equipment is operating beyond its design capacity. For HARD constraints, this may indicate equipment trip or failure. For SOFT constraints, this indicates reduced efficiency or accelerated wear.

      Specified by:
      isCapacityExceeded in interface CapacityConstrainedEquipment
      Returns:
      true if any constraint utilization exceeds 1.0 (100%)
    • isHardLimitExceeded

      public boolean isHardLimitExceeded()
      Checks if any HARD constraint limit is exceeded.

      HARD limits represent absolute equipment limits (e.g., maximum speed) that cannot be exceeded without equipment trip or damage. This is more severe than general capacity exceedance.

      Specified by:
      isHardLimitExceeded in interface CapacityConstrainedEquipment
      Returns:
      true if any HARD constraint's max value is exceeded
    • getMaxUtilization

      public double getMaxUtilization()
      Gets the maximum utilization across all constraints.

      This gives a single number representing how close the equipment is to its limiting constraint. Values above 1.0 indicate the equipment is over capacity.

      Specified by:
      getMaxUtilization in interface CapacityConstrainedEquipment
      Returns:
      maximum utilization as fraction (1.0 = 100% of design capacity)
    • addCapacityConstraint

      public void addCapacityConstraint(CapacityConstraint constraint)
      Adds a new capacity constraint to this equipment.

      This allows dynamic addition of constraints at runtime. Constraints can be added during equipment configuration or based on operating conditions.

      Specified by:
      addCapacityConstraint in interface CapacityConstrainedEquipment
      Parameters:
      constraint - the constraint to add
    • removeCapacityConstraint

      public boolean removeCapacityConstraint(String constraintName)
      Removes a capacity constraint by name.
      Specified by:
      removeCapacityConstraint in interface CapacityConstrainedEquipment
      Parameters:
      constraintName - the name of the constraint to remove
      Returns:
      true if the constraint was found and removed
    • clearCapacityConstraints

      public void clearCapacityConstraints()
      Clears all capacity constraints from this equipment.
      Specified by:
      clearCapacityConstraints in interface CapacityConstrainedEquipment