Class Splitter

All Implemented Interfaces:
Serializable, Runnable, CapacityConstrainedEquipment, ProcessEquipmentInterface, SplitterInterface, ProcessElementInterface, 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
    • getInletStreams

      public List<StreamInterface> getInletStreams()
      Returns all inlet streams connected to this equipment. Subclasses override to report their specific inlets. Used by graph builders, DEXPI export, and auto-instrumentation to discover topology without instanceof checks.
      Specified by:
      getInletStreams in interface ProcessEquipmentInterface
      Returns:
      unmodifiable list of inlet streams (empty by default)
    • getOutletStreams

      public List<StreamInterface> getOutletStreams()
      Returns all outlet streams produced by this equipment. Subclasses override to report their specific outlets. Used by graph builders, DEXPI export, and auto-instrumentation to discover topology without instanceof checks.
      Specified by:
      getOutletStreams in interface ProcessEquipmentInterface
      Returns:
      unmodifiable list of outlet streams (empty by default)
    • 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.

      Returns an unmodifiable map of constraint name to constraint object. Constraints are used by the optimization framework to detect bottlenecks, enforce limits, and guide production allocation. Equipment subclasses populate this map via ProcessEquipmentInterface.addCapacityConstraint(CapacityConstraint).

      Specified by:
      getCapacityConstraints in interface CapacityConstrainedEquipment
      Specified by:
      getCapacityConstraints in interface ProcessEquipmentInterface
      Overrides:
      getCapacityConstraints in class ProcessEquipmentBaseClass
      Returns:
      unmodifiable map of constraint name to constraint, empty if none defined
    • getBottleneckConstraint

      public CapacityConstraint getBottleneckConstraint()
      Gets the bottleneck (most limiting) constraint for this equipment.

      Returns the enabled constraint with the highest utilization ratio. If no constraints are defined or enabled, returns null.

      Specified by:
      getBottleneckConstraint in interface CapacityConstrainedEquipment
      Specified by:
      getBottleneckConstraint in interface ProcessEquipmentInterface
      Overrides:
      getBottleneckConstraint in class ProcessEquipmentBaseClass
      Returns:
      the most limiting constraint, or null if none
    • 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
      Specified by:
      isCapacityExceeded in interface ProcessEquipmentInterface
      Overrides:
      isCapacityExceeded in class ProcessEquipmentBaseClass
      Returns:
      true if any enabled 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
      Specified by:
      isHardLimitExceeded in interface ProcessEquipmentInterface
      Overrides:
      isHardLimitExceeded in class ProcessEquipmentBaseClass
      Returns:
      true if any enabled HARD constraint's max value is exceeded
    • getMaxUtilization

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

      Returns the highest utilization ratio across all enabled constraints. Values above 1.0 indicate the equipment is over capacity. Returns 0.0 if no constraints are defined or enabled.

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

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

      Constraints can be added at any time. If a constraint with the same name already exists, it is replaced. Use the fluent builder API on CapacityConstraint to configure the constraint before adding.

      Specified by:
      addCapacityConstraint in interface CapacityConstrainedEquipment
      Specified by:
      addCapacityConstraint in interface ProcessEquipmentInterface
      Overrides:
      addCapacityConstraint in class ProcessEquipmentBaseClass
      Parameters:
      constraint - the capacity constraint to add (ignored if null)
    • 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