Class Pipeline

All Implemented Interfaces:
Serializable, Runnable, CapacityConstrainedEquipment, PipeLineInterface, ProcessEquipmentInterface, TwoPortInterface, SimulationInterface, NamedInterface
Direct Known Subclasses:
AdiabaticPipe, AdiabaticTwoPhasePipe, MultiphasePipe, OnePhasePipeLine, PipeBeggsAndBrills, SimpleTPoutPipeline, TubingPerformance, TwoFluidPipe, TwoPhasePipeLine, WaterHammerPipe

public class Pipeline extends TwoPortEquipment implements PipeLineInterface, CapacityConstrainedEquipment
Base class for pipeline simulation models.

This class provides the foundation for all pipeline models in NeqSim. It implements the PipeLineInterface with default implementations that can be overridden by specialized subclasses.

Subclasses

Version:
2.0
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.
    • fileName

      protected String fileName
    • pipe

      protected FlowSystemInterface pipe
    • system

      protected SystemInterface system
    • length

      protected double length
      Total pipe length in meters.
    • diameter

      protected double diameter
      Pipe inner diameter in meters.
    • roughness

      protected double roughness
      Pipe wall roughness in meters.
    • wallThickness

      protected double wallThickness
      Pipe wall thickness in meters.
    • elevation

      protected double elevation
      Elevation change from inlet to outlet in meters.
    • inletElevation

      protected double inletElevation
      Inlet elevation above reference in meters.
    • outletElevation

      protected double outletElevation
      Outlet elevation above reference in meters.
    • angle

      protected double angle
      Pipe angle from horizontal in degrees.
    • heatTransferCoefficient

      protected double heatTransferCoefficient
      Overall heat transfer coefficient in W/(m²·K).
    • surfaceTemperature

      protected double surfaceTemperature
      Constant surface temperature in Kelvin.
    • adiabatic

      protected boolean adiabatic
      Flag for adiabatic operation.
    • ambientTemperature

      protected double ambientTemperature
      Ambient temperature in Kelvin.
    • innerHeatTransferCoefficient

      protected double innerHeatTransferCoefficient
      Inner (fluid-side) heat transfer coefficient in W/(m²·K).
    • outerHeatTransferCoefficient

      protected double outerHeatTransferCoefficient
      Outer (external) heat transfer coefficient in W/(m²·K).
    • pipeMaterial

      protected String pipeMaterial
      Pipe material.
    • pipeSchedule

      protected String pipeSchedule
      Pipe schedule.
    • pipeWallConductivity

      protected double pipeWallConductivity
      Pipe wall thermal conductivity in W/(m·K).
    • insulationThickness

      protected double insulationThickness
      Insulation thickness in meters.
    • insulationConductivity

      protected double insulationConductivity
      Insulation thermal conductivity in W/(m·K).
    • insulationType

      protected String insulationType
      Insulation type/material.
    • coatingThickness

      protected double coatingThickness
      Coating thickness in meters.
    • coatingConductivity

      protected double coatingConductivity
      Coating thermal conductivity in W/(m·K).
    • burialDepth

      protected double burialDepth
      Burial depth in meters.
    • soilConductivity

      protected double soilConductivity
      Soil thermal conductivity in W/(m·K).
    • buried

      protected boolean buried
      Flag for buried pipe.
    • designPressure

      protected double designPressure
      Design pressure in MPa.
    • designTemperature

      protected double designTemperature
      Design temperature in Celsius.
    • materialGrade

      protected String materialGrade
      Material grade per API 5L.
    • designCode

      protected String designCode
      Design code (e.g., ASME_B31_8).
    • locationClass

      protected int locationClass
      Location class per ASME B31.8.
    • corrosionAllowance

      protected double corrosionAllowance
      Corrosion allowance in meters.
    • mechanicalDesignCalculator

      protected transient PipeMechanicalDesignCalculator mechanicalDesignCalculator
      Mechanical design calculator.
    • pressureDrop

      protected double pressureDrop
      Calculated pressure drop in bar.
    • flowRegime

      protected String flowRegime
      Flow regime string.
    • liquidHoldup

      protected double liquidHoldup
      Liquid holdup fraction.
    • reynoldsNumber

      protected double reynoldsNumber
      Reynolds number.
    • frictionFactor

      protected double frictionFactor
      Friction factor.
    • velocity

      protected double velocity
      Flow velocity in m/s.
    • pressureProfile

      protected double[] pressureProfile
      Pressure profile along pipe.
    • temperatureProfile

      protected double[] temperatureProfile
      Temperature profile along pipe.
    • liquidHoldupProfile

      protected double[] liquidHoldupProfile
      Liquid holdup profile along pipe.
    • numberOfIncrements

      protected int numberOfIncrements
      Number of computational increments.
    • fittings

      protected Fittings fittings
      Collection of pipe fittings for equivalent length calculations.

      Fittings such as bends, valves, tees, and reducers contribute additional pressure drop beyond the straight pipe friction loss. This is accounted for using the equivalent length method, where each fitting is assigned an L/D ratio representing the length of straight pipe (in diameters) that would produce the same pressure drop.

    • useFittings

      protected boolean useFittings
      Flag to enable/disable fittings in pressure drop calculations.

      When true (default), the equivalent length from fittings is added to the physical pipe length in pressure drop calculations. Set to false to temporarily exclude fittings.

    • flowPattern

      String flowPattern
    • times

      double[] times
    • equilibriumHeatTransfer

      boolean equilibriumHeatTransfer
    • equilibriumMassTransfer

      boolean equilibriumMassTransfer
    • numberOfLegs

      int numberOfLegs
    • numberOfNodesInLeg

      int numberOfNodesInLeg
    • legHeights

      double[] legHeights
    • legPositions

      double[] legPositions
    • pipeDiameters

      double[] pipeDiameters
    • outerTemperature

      double[] outerTemperature
    • pipeWallRoughness

      double[] pipeWallRoughness
    • outerHeatTransferCoeffs

      double[] outerHeatTransferCoeffs
    • wallHeatTransferCoeffs

      double[] wallHeatTransferCoeffs
    • pipelineMechanicalDesign

      PipelineMechanicalDesign pipelineMechanicalDesign
    • capacityConstraints

      private final Map<String, CapacityConstraint> capacityConstraints
      Storage for capacity constraints.
  • Constructor Details

    • Pipeline

      public Pipeline(String name)
      Constructor for Pipeline.
      Parameters:
      name - the equipment name
    • Pipeline

      public Pipeline(String name, StreamInterface inStream)
      Constructor for Pipeline with inlet stream.
      Parameters:
      name - the equipment name
      inStream - the inlet stream
  • Method Details

    • setLength

      public void setLength(double length)
      Set the total pipe length.
      Specified by:
      setLength in interface PipeLineInterface
      Parameters:
      length - the pipe length in meters
    • getLength

      public double getLength()
      Get the total pipe length.
      Specified by:
      getLength in interface PipeLineInterface
      Returns:
      the pipe length in meters
    • setDiameter

      public void setDiameter(double diameter)
      Set the pipe inner diameter.
      Specified by:
      setDiameter in interface PipeLineInterface
      Parameters:
      diameter - the inner diameter in meters
    • getDiameter

      public double getDiameter()
      Get the pipe inner diameter.
      Specified by:
      getDiameter in interface PipeLineInterface
      Returns:
      the inner diameter in meters
    • setPipeWallRoughness

      public void setPipeWallRoughness(double roughness)
      Set the pipe wall roughness.
      Specified by:
      setPipeWallRoughness in interface PipeLineInterface
      Parameters:
      roughness - the wall roughness in meters
    • getPipeWallRoughness

      public double getPipeWallRoughness()
      Get the pipe wall roughness.
      Specified by:
      getPipeWallRoughness in interface PipeLineInterface
      Returns:
      the wall roughness in meters
    • setElevation

      public void setElevation(double elevation)
      Set the elevation change from inlet to outlet.
      Specified by:
      setElevation in interface PipeLineInterface
      Parameters:
      elevation - elevation change in meters (positive = uphill)
    • getElevation

      public double getElevation()
      Get the elevation change from inlet to outlet.
      Specified by:
      getElevation in interface PipeLineInterface
      Returns:
      elevation change in meters
    • setInletElevation

      public void setInletElevation(double inletElevation)
      Set the inlet elevation above reference.
      Specified by:
      setInletElevation in interface PipeLineInterface
      Parameters:
      inletElevation - inlet elevation in meters
    • getInletElevation

      public double getInletElevation()
      Get the inlet elevation above reference.
      Specified by:
      getInletElevation in interface PipeLineInterface
      Returns:
      inlet elevation in meters
    • setOutletElevation

      public void setOutletElevation(double outletElevation)
      Set the outlet elevation above reference.
      Specified by:
      setOutletElevation in interface PipeLineInterface
      Parameters:
      outletElevation - outlet elevation in meters
    • getOutletElevation

      public double getOutletElevation()
      Get the outlet elevation above reference.
      Specified by:
      getOutletElevation in interface PipeLineInterface
      Returns:
      outlet elevation in meters
    • setAngle

      public void setAngle(double angle)
      Set the angle of the pipe from horizontal.
      Specified by:
      setAngle in interface PipeLineInterface
      Parameters:
      angle - angle in degrees (0 = horizontal, 90 = vertical upward)
    • getAngle

      public double getAngle()
      Get the angle of the pipe from horizontal.
      Specified by:
      getAngle in interface PipeLineInterface
      Returns:
      angle in degrees (0 = horizontal, 90 = vertical upward)
    • setWallThickness

      public void setWallThickness(double thickness)
      Set the pipe wall thickness.
      Specified by:
      setWallThickness in interface PipeLineInterface
      Parameters:
      thickness - wall thickness in meters
    • getWallThickness

      public double getWallThickness()
      Get the pipe wall thickness.
      Specified by:
      getWallThickness in interface PipeLineInterface
      Returns:
      wall thickness in meters
    • setNumberOfLegs

      public void setNumberOfLegs(int number)
      Set number of pipe legs/segments.
      Specified by:
      setNumberOfLegs in interface PipeLineInterface
      Parameters:
      number - number of legs
    • getNumberOfLegs

      public int getNumberOfLegs()
      Get number of pipe legs/segments.
      Specified by:
      getNumberOfLegs in interface PipeLineInterface
      Returns:
      number of legs
    • setNumberOfNodesInLeg

      public void setNumberOfNodesInLeg(int number)
      Set number of computational nodes in each leg.
      Specified by:
      setNumberOfNodesInLeg in interface PipeLineInterface
      Parameters:
      number - number of nodes per leg
    • setNumberOfIncrements

      public void setNumberOfIncrements(int numberOfIncrements)
      Set number of computational increments/segments.
      Specified by:
      setNumberOfIncrements in interface PipeLineInterface
      Parameters:
      numberOfIncrements - number of increments for pressure drop calculation
    • getNumberOfIncrements

      public int getNumberOfIncrements()
      Get number of computational increments/segments.
      Specified by:
      getNumberOfIncrements in interface PipeLineInterface
      Returns:
      number of increments
    • setHeightProfile

      public void setHeightProfile(double[] heights)
      Set the height profile along the pipe.
      Specified by:
      setHeightProfile in interface PipeLineInterface
      Parameters:
      heights - array of heights at each leg boundary (length = numberOfLegs + 1)
    • setLegPositions

      public void setLegPositions(double[] positions)
      Set the position of each leg along the pipe.
      Specified by:
      setLegPositions in interface PipeLineInterface
      Parameters:
      positions - array of positions at each leg boundary in meters
    • setPipeDiameters

      public void setPipeDiameters(double[] diameters)
      Set pipe diameters for each segment.
      Specified by:
      setPipeDiameters in interface PipeLineInterface
      Parameters:
      diameters - array of diameters for each leg boundary
    • setPipeWallRoughness

      public void setPipeWallRoughness(double[] rough)
      Set wall roughness for each segment.
      Specified by:
      setPipeWallRoughness in interface PipeLineInterface
      Parameters:
      rough - array of roughness values for each leg
    • setOuterTemperatures

      public void setOuterTemperatures(double[] outerTemp)
      Set outer temperatures for heat transfer calculations.
      Specified by:
      setOuterTemperatures in interface PipeLineInterface
      Parameters:
      outerTemp - array of outer temperatures in Kelvin for each leg
    • setOutletPressure

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

      public void setOutletTemperature(double temperature)
      Set outlet temperature of twoport.
      Specified by:
      setOutletTemperature in interface PipeLineInterface
      Specified by:
      setOutletTemperature in interface TwoPortInterface
      Overrides:
      setOutletTemperature in class TwoPortEquipment
      Parameters:
      temperature - value to set in kelvin
    • getPressureDrop

      public double getPressureDrop()
      Get the total pressure drop across the pipeline.
      Specified by:
      getPressureDrop in interface PipeLineInterface
      Returns:
      pressure drop in bar
    • getOutletPressure

      public double getOutletPressure(String unit)
      Get the outlet pressure.
      Specified by:
      getOutletPressure in interface PipeLineInterface
      Parameters:
      unit - pressure unit (e.g., "bara", "barg", "Pa", "MPa")
      Returns:
      outlet pressure in specified unit
    • getOutletTemperature

      public double getOutletTemperature(String unit)
      Get the outlet temperature.
      Specified by:
      getOutletTemperature in interface PipeLineInterface
      Parameters:
      unit - temperature unit (e.g., "K", "C")
      Returns:
      outlet temperature in specified unit
    • getVelocity

      public double getVelocity()
      Get the flow velocity in the pipe.
      Specified by:
      getVelocity in interface PipeLineInterface
      Returns:
      velocity in m/s
    • getSuperficialVelocity

      public double getSuperficialVelocity(int phaseNumber)
      Get the superficial velocity for a specific phase.
      Specified by:
      getSuperficialVelocity in interface PipeLineInterface
      Parameters:
      phaseNumber - phase index (0=gas, 1=liquid)
      Returns:
      superficial velocity in m/s
    • getSuperficialVelocity

      public double getSuperficialVelocity(int phaseNum, int node)
      Get superficial velocity for a phase at a specific node.
      Parameters:
      phaseNum - phase index (0=gas, 1=liquid)
      node - node index
      Returns:
      superficial velocity in m/s
    • getFlowRegime

      public String getFlowRegime()
      Get the determined flow regime.
      Specified by:
      getFlowRegime in interface PipeLineInterface
      Returns:
      flow regime as string (e.g., "stratified", "slug", "annular", "dispersed bubble")
    • getLiquidHoldup

      public double getLiquidHoldup()
      Get the liquid holdup fraction.
      Specified by:
      getLiquidHoldup in interface PipeLineInterface
      Returns:
      liquid holdup as fraction (0-1)
    • getReynoldsNumber

      public double getReynoldsNumber()
      Get the Reynolds number for the flow.
      Specified by:
      getReynoldsNumber in interface PipeLineInterface
      Returns:
      Reynolds number (dimensionless)
    • getFrictionFactor

      public double getFrictionFactor()
      Get the friction factor.
      Specified by:
      getFrictionFactor in interface PipeLineInterface
      Returns:
      Darcy friction factor (dimensionless)
    • getPressureProfile

      public double[] getPressureProfile()
      Get the pressure profile along the pipe.
      Specified by:
      getPressureProfile in interface PipeLineInterface
      Returns:
      array of pressures in bar at each increment
    • getTemperatureProfile

      public double[] getTemperatureProfile()
      Get the temperature profile along the pipe.
      Specified by:
      getTemperatureProfile in interface PipeLineInterface
      Returns:
      array of temperatures in Kelvin at each increment
    • getLiquidHoldupProfile

      public double[] getLiquidHoldupProfile()
      Get the liquid holdup profile along the pipe.
      Specified by:
      getLiquidHoldupProfile in interface PipeLineInterface
      Returns:
      array of liquid holdup values at each increment
    • setHeatTransferCoefficient

      public void setHeatTransferCoefficient(double coefficient)
      Set the overall heat transfer coefficient.
      Specified by:
      setHeatTransferCoefficient in interface PipeLineInterface
      Parameters:
      coefficient - heat transfer coefficient in W/(m²·K)
    • getHeatTransferCoefficient

      public double getHeatTransferCoefficient()
      Get the overall heat transfer coefficient.
      Specified by:
      getHeatTransferCoefficient in interface PipeLineInterface
      Returns:
      heat transfer coefficient in W/(m²·K)
    • setConstantSurfaceTemperature

      public void setConstantSurfaceTemperature(double temperature)
      Set the constant surface temperature for heat transfer.
      Specified by:
      setConstantSurfaceTemperature in interface PipeLineInterface
      Parameters:
      temperature - surface temperature in Kelvin
    • isAdiabatic

      public boolean isAdiabatic()
      Check if the pipe is operating in adiabatic mode.
      Specified by:
      isAdiabatic in interface PipeLineInterface
      Returns:
      true if adiabatic (no heat transfer)
    • setAdiabatic

      public void setAdiabatic(boolean adiabatic)
      Set whether the pipe operates in adiabatic mode.
      Specified by:
      setAdiabatic in interface PipeLineInterface
      Parameters:
      adiabatic - true for no heat transfer
    • setPipeMaterial

      public void setPipeMaterial(String material)
      Set the pipe material.
      Specified by:
      setPipeMaterial in interface PipeLineInterface
      Parameters:
      material - pipe material name (e.g., "carbon steel", "stainless steel", "duplex")
    • getPipeMaterial

      public String getPipeMaterial()
      Get the pipe material.
      Specified by:
      getPipeMaterial in interface PipeLineInterface
      Returns:
      pipe material name
    • setPipeSchedule

      public void setPipeSchedule(String schedule)
      Set the pipe schedule.
      Specified by:
      setPipeSchedule in interface PipeLineInterface
      Parameters:
      schedule - pipe schedule (e.g., "40", "80", "STD", "XS")
    • getPipeSchedule

      public String getPipeSchedule()
      Get the pipe schedule.
      Specified by:
      getPipeSchedule in interface PipeLineInterface
      Returns:
      pipe schedule
    • setInsulationThickness

      public void setInsulationThickness(double thickness)
      Set the insulation thickness.
      Specified by:
      setInsulationThickness in interface PipeLineInterface
      Parameters:
      thickness - insulation thickness in meters
    • getInsulationThickness

      public double getInsulationThickness()
      Get the insulation thickness.
      Specified by:
      getInsulationThickness in interface PipeLineInterface
      Returns:
      insulation thickness in meters
    • setInsulationConductivity

      public void setInsulationConductivity(double conductivity)
      Set the insulation thermal conductivity.
      Specified by:
      setInsulationConductivity in interface PipeLineInterface
      Parameters:
      conductivity - thermal conductivity in W/(m·K)
    • getInsulationConductivity

      public double getInsulationConductivity()
      Get the insulation thermal conductivity.
      Specified by:
      getInsulationConductivity in interface PipeLineInterface
      Returns:
      thermal conductivity in W/(m·K)
    • setInsulationType

      public void setInsulationType(String insulationType)
      Set the insulation type/material.
      Specified by:
      setInsulationType in interface PipeLineInterface
      Parameters:
      insulationType - insulation type (e.g., "polyurethane", "mineral wool", "aerogel")
    • getInsulationType

      public String getInsulationType()
      Get the insulation type/material.
      Specified by:
      getInsulationType in interface PipeLineInterface
      Returns:
      insulation type
    • setCoatingThickness

      public void setCoatingThickness(double thickness)
      Set the coating thickness.
      Specified by:
      setCoatingThickness in interface PipeLineInterface
      Parameters:
      thickness - coating thickness in meters
    • getCoatingThickness

      public double getCoatingThickness()
      Get the coating thickness.
      Specified by:
      getCoatingThickness in interface PipeLineInterface
      Returns:
      coating thickness in meters
    • setCoatingConductivity

      public void setCoatingConductivity(double conductivity)
      Set the coating thermal conductivity.
      Specified by:
      setCoatingConductivity in interface PipeLineInterface
      Parameters:
      conductivity - thermal conductivity in W/(m·K)
    • getCoatingConductivity

      public double getCoatingConductivity()
      Get the coating thermal conductivity.
      Specified by:
      getCoatingConductivity in interface PipeLineInterface
      Returns:
      thermal conductivity in W/(m·K)
    • setPipeWallConductivity

      public void setPipeWallConductivity(double conductivity)
      Set the pipe wall thermal conductivity.
      Specified by:
      setPipeWallConductivity in interface PipeLineInterface
      Parameters:
      conductivity - thermal conductivity in W/(m·K)
    • getPipeWallConductivity

      public double getPipeWallConductivity()
      Get the pipe wall thermal conductivity.
      Specified by:
      getPipeWallConductivity in interface PipeLineInterface
      Returns:
      thermal conductivity in W/(m·K)
    • setOuterHeatTransferCoefficient

      public void setOuterHeatTransferCoefficient(double coefficient)
      Set the outer (external) heat transfer coefficient.

      This is the convective heat transfer coefficient between the pipe outer surface (or insulation outer surface if insulated) and the surrounding environment.

      Typical values:

      • Still air: 5-25 W/(m²·K)
      • Flowing air: 10-100 W/(m²·K)
      • Buried in soil: 1-5 W/(m²·K)
      • Still water: 100-500 W/(m²·K)
      • Flowing seawater: 500-2000 W/(m²·K)
      Specified by:
      setOuterHeatTransferCoefficient in interface PipeLineInterface
      Parameters:
      coefficient - outer heat transfer coefficient in W/(m²·K)
    • getOuterHeatTransferCoefficient

      public double getOuterHeatTransferCoefficient()
      Get the outer (external) heat transfer coefficient.
      Specified by:
      getOuterHeatTransferCoefficient in interface PipeLineInterface
      Returns:
      outer heat transfer coefficient in W/(m²·K)
    • setInnerHeatTransferCoefficient

      public void setInnerHeatTransferCoefficient(double coefficient)
      Set the inner (fluid-side) heat transfer coefficient.

      This is the convective heat transfer coefficient between the fluid and the pipe inner wall. If not set, it can be calculated automatically based on flow conditions.

      Specified by:
      setInnerHeatTransferCoefficient in interface PipeLineInterface
      Parameters:
      coefficient - inner heat transfer coefficient in W/(m²·K)
    • getInnerHeatTransferCoefficient

      public double getInnerHeatTransferCoefficient()
      Get the inner (fluid-side) heat transfer coefficient.
      Specified by:
      getInnerHeatTransferCoefficient in interface PipeLineInterface
      Returns:
      inner heat transfer coefficient in W/(m²·K)
    • setOuterHeatTransferCoefficients

      public void setOuterHeatTransferCoefficients(double[] coefficients)
      Set outer heat transfer coefficients for each pipe segment.
      Specified by:
      setOuterHeatTransferCoefficients in interface PipeLineInterface
      Parameters:
      coefficients - array of outer heat transfer coefficients in W/(m²·K)
    • setWallHeatTransferCoefficients

      public void setWallHeatTransferCoefficients(double[] coefficients)
      Set inner (wall) heat transfer coefficients for each pipe segment.
      Specified by:
      setWallHeatTransferCoefficients in interface PipeLineInterface
      Parameters:
      coefficients - array of wall heat transfer coefficients in W/(m²·K)
    • setAmbientTemperatures

      public void setAmbientTemperatures(double[] temperatures)
      Set ambient/surrounding temperatures for each pipe segment.
      Specified by:
      setAmbientTemperatures in interface PipeLineInterface
      Parameters:
      temperatures - array of ambient temperatures in Kelvin
    • setAmbientTemperature

      public void setAmbientTemperature(double temperature)
      Set the ambient temperature.
      Specified by:
      setAmbientTemperature in interface PipeLineInterface
      Parameters:
      temperature - ambient temperature in Kelvin
    • getAmbientTemperature

      public double getAmbientTemperature()
      Get the ambient temperature.
      Specified by:
      getAmbientTemperature in interface PipeLineInterface
      Returns:
      ambient temperature in Kelvin
    • calculateOverallHeatTransferCoefficient

      public double calculateOverallHeatTransferCoefficient()
      Calculate the overall heat transfer coefficient based on pipe buildup.

      This method calculates the overall U-value considering:

      • Inner fluid-side convection
      • Pipe wall conduction
      • Coating conduction (if present)
      • Insulation conduction (if present)
      • Outer convection

      The calculation uses the resistance analogy for cylindrical geometries.

      Specified by:
      calculateOverallHeatTransferCoefficient in interface PipeLineInterface
      Returns:
      overall heat transfer coefficient in W/(m²·K) based on inner diameter
    • setBurialDepth

      public void setBurialDepth(double depth)
      Set the burial depth below ground surface.
      Specified by:
      setBurialDepth in interface PipeLineInterface
      Parameters:
      depth - burial depth in meters
    • getBurialDepth

      public double getBurialDepth()
      Get the burial depth.
      Specified by:
      getBurialDepth in interface PipeLineInterface
      Returns:
      burial depth in meters
    • setSoilConductivity

      public void setSoilConductivity(double conductivity)
      Set the soil thermal conductivity.
      Specified by:
      setSoilConductivity in interface PipeLineInterface
      Parameters:
      conductivity - soil thermal conductivity in W/(m·K)
    • getSoilConductivity

      public double getSoilConductivity()
      Get the soil thermal conductivity.
      Specified by:
      getSoilConductivity in interface PipeLineInterface
      Returns:
      soil thermal conductivity in W/(m·K)
    • isBuried

      public boolean isBuried()
      Check if the pipe is buried.
      Specified by:
      isBuried in interface PipeLineInterface
      Returns:
      true if pipe is buried
    • setBuried

      public void setBuried(boolean buried)
      Set whether the pipe is buried.
      Specified by:
      setBuried in interface PipeLineInterface
      Parameters:
      buried - true if pipe is buried
    • addFitting

      public void addFitting(String name, double LdivD)
      Add a fitting with a specified L/D ratio.

      The L/D ratio represents the equivalent length of the fitting in terms of pipe diameters. For example, a standard 90° elbow has L/D ≈ 30, meaning it causes the same pressure drop as 30 diameters of straight pipe.

      Example usage:

      pipe.addFitting("90-degree elbow", 30.0);
      pipe.addFitting("gate valve", 8.0);
      
      Parameters:
      name - descriptive name for the fitting
      LdivD - equivalent length ratio (L/D), dimensionless
    • addFittingFromDatabase

      public void addFittingFromDatabase(String name)
      Add a fitting by name, loading L/D from database.

      The fitting name must exist in the 'fittings' database table. Standard fitting names include:

      • "Standard elbow (R=1.5D), 90deg" - L/D = 16
      • "Standard elbow (R=1D), 90deg" - L/D = 30
      • "Gate valve, fully open" - L/D = 8
      • "Globe valve, fully open" - L/D = 340
      Parameters:
      name - fitting name as stored in database
    • addStandardFitting

      public boolean addStandardFitting(String type)
      Add a standard fitting type with predefined L/D value.

      Uses built-in L/D values from Crane TP-410. See Fittings.addStandard(String) for available types.

      Parameters:
      type - standard fitting type
      Returns:
      true if fitting was added, false if type not recognized
    • addFittings

      public void addFittings(String name, double LdivD, int count)
      Add multiple identical fittings with specified L/D ratio.

      Convenience method for adding several fittings of the same type. For example, adding 6 elbows with L/D = 30:

      pipe.addFittings("90-degree elbow", 30.0, 6);
      
      Parameters:
      name - fitting name
      LdivD - L/D ratio for each fitting
      count - number of fittings to add
    • addStandardFittings

      public boolean addStandardFittings(String type, int count)
      Add multiple standard fittings of the same type.
      Parameters:
      type - standard fitting type (e.g., "elbow_90_standard", "valve_gate_open")
      count - number of fittings to add
      Returns:
      true if fittings were added, false if type not recognized
    • getFittings

      public Fittings getFittings()
      Get the fittings collection.
      Returns:
      Fittings object containing all added fittings
    • clearFittings

      public void clearFittings()
      Clear all fittings from the pipe.
    • getTotalFittingsLdRatio

      public double getTotalFittingsLdRatio()
      Get the total L/D ratio of all fittings.

      This is the sum of all individual fitting L/D ratios.

      Returns:
      total L/D ratio (dimensionless)
    • getEquivalentLength

      public double getEquivalentLength()
      Calculate the total equivalent length from all fittings.

      The equivalent length is calculated as:

      L_eq = Σ(L/D)_i × D
      

      where D is the pipe internal diameter.

      Returns:
      equivalent length from fittings in meters
    • getEffectiveLength

      public double getEffectiveLength()
      Get the effective pipe length for pressure drop calculations.

      The effective length includes both the physical pipe length and the equivalent length from all fittings:

      L_eff = L_physical + L_equivalent
            = L_physical + Σ(L/D)_i × D
      

      This effective length should be used in the Darcy-Weisbach equation:

      ΔP = f × (L_eff / D) × (ρV² / 2)
      
      Returns:
      effective pipe length in meters
    • setUseFittings

      public void setUseFittings(boolean enable)
      Enable or disable fittings in pressure drop calculations.

      When disabled, the equivalent length from fittings is not added to the physical pipe length. This is useful for comparing pressure drop with and without fittings.

      Parameters:
      enable - true to include fittings (default), false to exclude
    • isUseFittings

      public boolean isUseFittings()
      Check if fittings are enabled in pressure drop calculations.
      Returns:
      true if fittings are included, false if excluded
    • getNumberOfFittings

      public int getNumberOfFittings()
      Get the number of fittings added to this pipe.
      Returns:
      number of fittings
    • printFittingsSummary

      public void printFittingsSummary()
      Print a summary of all fittings to the console.
    • setOutputFileName

      public void setOutputFileName(String name)
      Set output file name for detailed results.
      Specified by:
      setOutputFileName in interface PipeLineInterface
      Parameters:
      name - output file name
    • setInitialFlowPattern

      public void setInitialFlowPattern(String flowPattern)
      Set initial flow pattern for simulation initialization.
      Specified by:
      setInitialFlowPattern in interface PipeLineInterface
      Parameters:
      flowPattern - initial flow pattern (e.g., "stratified", "slug")
    • getPipe

      public FlowSystemInterface getPipe()
      Get the underlying flow system (for advanced models).
      Specified by:
      getPipe in interface PipeLineInterface
      Returns:
      flow system interface or null if not applicable
    • setPipeSpecification

      public void setPipeSpecification(double nominalDiameter, String specification)
      Set pipe specification from database.
      Specified by:
      setPipeSpecification in interface PipeLineInterface
      Parameters:
      nominalDiameter - nominal diameter in mm or inches
      specification - pipe specification code (e.g., "API 5L", "ANSI B36.10")
    • initMechanicalDesign

      public void initMechanicalDesign()

      Initialize a initMechanicalDesign for the equipment.

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

      public PipelineMechanicalDesign getMechanicalDesign()

      Get a mechanicalDesign for the equipment.

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

      public PipeMechanicalDesignCalculator getMechanicalDesignCalculator()
      Get the mechanical design calculator for this pipeline.

      The calculator provides standards-based calculations for:

      • Wall thickness calculation per ASME B31.3/B31.4/B31.8 or DNV-OS-F101
      • Maximum Allowable Operating Pressure (MAOP)
      • Stress analysis (hoop, longitudinal, von Mises)
      • Test pressure calculation
      Specified by:
      getMechanicalDesignCalculator in interface PipeLineInterface
      Returns:
      mechanical design calculator
    • setDesignPressure

      public void setDesignPressure(double pressure)
      Set design pressure for mechanical design calculations.
      Specified by:
      setDesignPressure in interface PipeLineInterface
      Parameters:
      pressure - design pressure in MPa
    • getDesignPressure

      public double getDesignPressure()
      Get design pressure.
      Specified by:
      getDesignPressure in interface PipeLineInterface
      Returns:
      design pressure in MPa
    • setDesignPressure

      public void setDesignPressure(double pressure, String unit)
      Set design pressure with unit.
      Specified by:
      setDesignPressure in interface PipeLineInterface
      Parameters:
      pressure - design pressure value
      unit - pressure unit ("MPa", "bar", "bara", "psi")
    • setDesignTemperature

      public void setDesignTemperature(double temperature)
      Set maximum design temperature for mechanical design.
      Specified by:
      setDesignTemperature in interface PipeLineInterface
      Parameters:
      temperature - design temperature in Celsius
    • getDesignTemperature

      public double getDesignTemperature()
      Get maximum design temperature.
      Specified by:
      getDesignTemperature in interface PipeLineInterface
      Returns:
      design temperature in Celsius
    • setMaterialGrade

      public void setMaterialGrade(String grade)
      Set the pipe material grade per API 5L.
      Specified by:
      setMaterialGrade in interface PipeLineInterface
      Parameters:
      grade - material grade (e.g., "X42", "X52", "X65", "X70", "X80")
    • getMaterialGrade

      public String getMaterialGrade()
      Get the pipe material grade.
      Specified by:
      getMaterialGrade in interface PipeLineInterface
      Returns:
      material grade
    • setDesignCode

      public void setDesignCode(String code)
      Set the design code for wall thickness and pressure calculations.
      Specified by:
      setDesignCode in interface PipeLineInterface
      Parameters:
      code - design code (e.g., "ASME_B31_8", "ASME_B31_4", "ASME_B31_3", "DNV_OS_F101")
    • getDesignCode

      public String getDesignCode()
      Get the design code.
      Specified by:
      getDesignCode in interface PipeLineInterface
      Returns:
      design code
    • setLocationClass

      public void setLocationClass(int locationClass)
      Set the location class per ASME B31.8.

      Location classes:

      • Class 1: Offshore and remote areas (F=0.72)
      • Class 2: Fringe areas (F=0.60)
      • Class 3: Suburban areas (F=0.50)
      • Class 4: Urban areas (F=0.40)
      Specified by:
      setLocationClass in interface PipeLineInterface
      Parameters:
      locationClass - location class 1-4
    • getLocationClass

      public int getLocationClass()
      Get the location class.
      Specified by:
      getLocationClass in interface PipeLineInterface
      Returns:
      location class 1-4
    • setCorrosionAllowance

      public void setCorrosionAllowance(double allowance)
      Set the corrosion allowance.
      Specified by:
      setCorrosionAllowance in interface PipeLineInterface
      Parameters:
      allowance - corrosion allowance in meters
    • getCorrosionAllowance

      public double getCorrosionAllowance()
      Get the corrosion allowance.
      Specified by:
      getCorrosionAllowance in interface PipeLineInterface
      Returns:
      corrosion allowance in meters
    • calculateMinimumWallThickness

      public double calculateMinimumWallThickness()
      Calculate minimum required wall thickness based on design code.
      Specified by:
      calculateMinimumWallThickness in interface PipeLineInterface
      Returns:
      minimum wall thickness in meters
    • calculateMAOP

      public double calculateMAOP()
      Calculate Maximum Allowable Operating Pressure (MAOP).
      Specified by:
      calculateMAOP in interface PipeLineInterface
      Returns:
      MAOP in MPa
    • getMAOP

      public double getMAOP(String unit)
      Get MAOP in specified unit.
      Specified by:
      getMAOP in interface PipeLineInterface
      Parameters:
      unit - pressure unit ("MPa", "bar", "psi")
      Returns:
      MAOP in specified unit
    • calculateTestPressure

      public double calculateTestPressure()
      Calculate hydrostatic test pressure.
      Specified by:
      calculateTestPressure in interface PipeLineInterface
      Returns:
      test pressure in MPa
    • calculateHoopStress

      public double calculateHoopStress()
      Calculate hoop stress at operating pressure.
      Specified by:
      calculateHoopStress in interface PipeLineInterface
      Returns:
      hoop stress in MPa
    • calculateVonMisesStress

      public double calculateVonMisesStress(double deltaT)
      Calculate von Mises equivalent stress.
      Specified by:
      calculateVonMisesStress in interface PipeLineInterface
      Parameters:
      deltaT - temperature change from installation in Celsius
      Returns:
      von Mises stress in MPa
    • isMechanicalDesignSafe

      public boolean isMechanicalDesignSafe()
      Check if the mechanical design is within allowable stress limits.
      Specified by:
      isMechanicalDesignSafe in interface PipeLineInterface
      Returns:
      true if design stress is below allowable limit
    • generateMechanicalDesignReport

      public String generateMechanicalDesignReport()
      Generate a mechanical design report.
      Specified by:
      generateMechanicalDesignReport in interface PipeLineInterface
      Returns:
      formatted design report string
    • 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
    • setPipeOuterHeatTransferCoefficients

      public void setPipeOuterHeatTransferCoefficients(double[] heatCoefs)
      Set pipe outer heat transfer coefficients for each leg.
      Parameters:
      heatCoefs - array of heat transfer coefficients
    • setPipeWallHeatTransferCoefficients

      public void setPipeWallHeatTransferCoefficients(double[] heatCoefs)
      Set pipe wall heat transfer coefficients for each leg.
      Parameters:
      heatCoefs - array of heat transfer coefficients
    • setEquilibriumMassTransfer

      public void setEquilibriumMassTransfer(boolean equilibriumMassTransfer)
      Set equilibrium mass transfer flag.
      Parameters:
      equilibriumMassTransfer - true to enable equilibrium mass transfer
    • setEquilibriumHeatTransfer

      public void setEquilibriumHeatTransfer(boolean equilibriumHeatTransfer)
      Set equilibrium heat transfer flag.
      Parameters:
      equilibriumHeatTransfer - true to enable equilibrium heat transfer
    • 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
    • displayResult

      public void displayResult()

      displayResult.

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

      public double[] getTimes()
      Get the time array for transient simulations.
      Returns:
      array of times in seconds
    • setTimeSeries

      public void setTimeSeries(double[] times, SystemInterface[] systems, int timestepininterval)
      Set time series for transient simulation.
      Parameters:
      times - array of times
      systems - array of thermodynamic systems at each time
      timestepininterval - number of time steps in each interval
    • 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
    • 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
    • initializeCapacityConstraints

      protected void initializeCapacityConstraints()
      Initializes default capacity constraints for the pipeline.

      NOTE: All constraints are disabled by default for backwards compatibility. Enable specific constraints when pipeline capacity analysis is needed (e.g., after sizing).

    • 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