Class PipelineMechanicalDesign

java.lang.Object
neqsim.process.mechanicaldesign.MechanicalDesign
neqsim.process.mechanicaldesign.pipeline.PipelineMechanicalDesign
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
RiserMechanicalDesign, TopsidePipingMechanicalDesign

public class PipelineMechanicalDesign extends MechanicalDesign
Mechanical design class for pipelines.

This class integrates pipeline mechanical design calculations with the NeqSim mechanical design framework, providing:

  • Wall thickness calculation per ASME B31.3/B31.4/B31.8 and DNV-OS-F101
  • CO2 corrosion rate assessment per NORSOK M-506
  • Material selection and corrosion allowance per NORSOK M-001
  • Integration with TORG (Technical Requirements Documents)
  • JSON export for data exchange
  • Database lookup for material properties and design standards

Usage Example

AdiabaticPipe pipe = new AdiabaticPipe("pipeline", stream);
pipe.setDiameter(0.508); // 20 inch
pipe.setLength(50000.0); // 50 km

// Initialize mechanical design
pipe.initMechanicalDesign();
PipelineMechanicalDesign design = (PipelineMechanicalDesign) pipe.getMechanicalDesign();

// Set design conditions
design.setMaxOperationPressure(150.0); // bara
design.setMaxOperationTemperature(80.0 + 273.15); // K

// Apply company standards
design.setCompanySpecificDesignStandards("Equinor");
design.readDesignSpecifications();

// Calculate design
design.calcDesign();

// Export to JSON
String json = design.toJson();
Version:
2.0
Author:
ESOL
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Serialization version UID.
      See Also:
    • innerDiameter

      double innerDiameter
      Inner diameter in meters.
    • designStandardCode

      String designStandardCode
      Design standard code.
    • calculator

      private transient PipeMechanicalDesignCalculator calculator
      Internal calculator for standards-based calculations.
    • pipelineLength

      private double pipelineLength
      Pipeline length in meters.
    • materialGrade

      private String materialGrade
      Material grade per API 5L.
    • locationClass

      private int locationClass
      Location class per ASME B31.8.
    • dataSource

      private transient PipelineMechanicalDesignDataSource dataSource
      Data source for loading from database.
    • corrosionModel

      private transient NorsokM506CorrosionRate corrosionModel
      NORSOK M-506 corrosion rate model.
    • materialSelector

      private transient NorsokM001MaterialSelection materialSelector
      NORSOK M-001 material selection model.
    • designLifeYears

      private double designLifeYears
      Design life in years for corrosion allowance calculation.
    • inhibitorEfficiency

      private double inhibitorEfficiency
      Inhibitor efficiency (0 to 1) for corrosion rate calculation.
    • glycolWeightFraction

      private double glycolWeightFraction
      Glycol (MEG) weight fraction in aqueous phase (0 to 1).
  • Constructor Details

  • Method Details

    • initializeFromPipeline

      private void initializeFromPipeline()
      Initialize design parameters from pipeline equipment.
    • getDataSource

      public PipelineMechanicalDesignDataSource getDataSource()
      Get the data source for database access.
      Returns:
      the data source instance
    • getCalculator

      public PipeMechanicalDesignCalculator getCalculator()
      Get the internal calculator for standards-based calculations.
      Returns:
      the calculator instance
    • loadFromDatabase

      public void loadFromDatabase()
      Load all design parameters from database tables.

      This method loads material properties and design factors from the NeqSim process design database based on the configured material grade and company identifier.

    • loadMaterialFromDatabase

      public void loadMaterialFromDatabase(String grade)
      Load material properties from database.
      Parameters:
      grade - API 5L material grade (e.g., "X52", "X65", "X70")
    • loadDesignFactorsFromDatabase

      public void loadDesignFactorsFromDatabase()
      Load design factors from database for the current company.
    • readDesignSpecifications

      public void readDesignSpecifications()

      readDesignSpecifications.

      Overrides:
      readDesignSpecifications in class MechanicalDesign
    • calcDesign

      public void calcDesign()

      calcDesign.

      Overrides:
      calcDesign in class MechanicalDesign
    • getMAOP

      public double getMAOP(String unit)
      Get the calculated MAOP (Maximum Allowable Operating Pressure).
      Parameters:
      unit - pressure unit ("bar", "MPa", "psi")
      Returns:
      MAOP in specified unit
    • getTestPressure

      public double getTestPressure()
      Get the calculated test pressure.
      Returns:
      test pressure in MPa
    • isDesignSafe

      public boolean isDesignSafe()
      Check if the mechanical design is within safe limits.
      Returns:
      true if design is safe
    • setMaterialGrade

      public void setMaterialGrade(String grade)
      Set the material grade per API 5L.
      Parameters:
      grade - material grade (e.g., "X52", "X65", "X70")
    • getMaterialGrade

      public String getMaterialGrade()
      Get the material grade.
      Returns:
      material grade
    • setLocationClass

      public void setLocationClass(int locationClass)
      Set the location class per ASME B31.8.
      Parameters:
      locationClass - location class 1-4
    • getLocationClass

      public int getLocationClass()
      Get the location class.
      Returns:
      location class 1-4
    • setDesignStandardCode

      public void setDesignStandardCode(String code)
      Set the design standard code.
      Parameters:
      code - design standard code
    • getDesignStandardCode

      public String getDesignStandardCode()
      Get the design standard code.
      Returns:
      design standard code
    • getPipelineLength

      public double getPipelineLength()
      Get the pipeline length.
      Returns:
      pipeline length in meters
    • setPipelineLength

      public void setPipelineLength(double length)
      Set the pipeline length.
      Parameters:
      length - pipeline length in meters
    • getCorrosionModel

      public NorsokM506CorrosionRate getCorrosionModel()
      Returns the NORSOK M-506 corrosion rate model for this pipeline.

      The model is lazily initialized with default parameters. Use the setter methods on the returned model to configure conditions, or call runCorrosionAnalysis() to auto-populate from the pipeline's operating stream.

      Returns:
      the corrosion rate model
    • getMaterialSelector

      public NorsokM001MaterialSelection getMaterialSelector()
      Returns the NORSOK M-001 material selection model for this pipeline.
      Returns:
      the material selection model
    • setDesignLifeYears

      public void setDesignLifeYears(double years)
      Sets the design life for corrosion allowance calculations.
      Parameters:
      years - design life in years (typically 20-30)
    • getDesignLifeYears

      public double getDesignLifeYears()
      Gets the design life for corrosion allowance calculations.
      Returns:
      design life in years
    • setInhibitorEfficiency

      public void setInhibitorEfficiency(double efficiency)
      Sets the inhibitor efficiency for corrosion calculations.
      Parameters:
      efficiency - inhibitor efficiency (0.0 = none, 1.0 = perfect)
    • setGlycolWeightFraction

      public void setGlycolWeightFraction(double fraction)
      Sets the glycol (MEG/DEG) weight fraction for corrosion calculations.
      Parameters:
      fraction - glycol weight fraction (0.0 to 1.0)
    • runCorrosionAnalysis

      public void runCorrosionAnalysis()
      Runs a complete corrosion analysis using the pipeline's operating conditions.

      This method extracts temperature, pressure, fluid composition, and flow velocity from the pipeline equipment and its inlet/outlet streams. It then runs the NORSOK M-506 corrosion rate calculation followed by the NORSOK M-001 material selection evaluation.

      The corrosion allowance result is automatically applied to the mechanical design calculator so that subsequent wall thickness calculations include the correct corrosion allowance.

    • populateFromStream

      private void populateFromStream(NorsokM506CorrosionRate model, StreamInterface stream)
      Populates the corrosion model with conditions extracted from a process stream.
      Parameters:
      model - the corrosion rate model to populate
      stream - the process stream to extract conditions from
    • getMoleFractionSafe

      private double getMoleFractionSafe(SystemInterface fluid, int phaseNum, String componentName)
      Safely gets a component mole fraction from a fluid phase.
      Parameters:
      fluid - the fluid system
      phaseNum - the phase number
      componentName - the component name
      Returns:
      mole fraction, or 0 if component not present
    • getCorrosionRate

      public double getCorrosionRate()
      Gets the calculated corrosion rate after running corrosion analysis.
      Returns:
      corrected corrosion rate in mm/yr, or -1 if not yet calculated
    • getRecommendedMaterial

      public String getRecommendedMaterial()
      Gets the recommended material grade from corrosion analysis.
      Returns:
      recommended material string, or empty string if not yet evaluated
    • getRecommendedCorrosionAllowanceMm

      public double getRecommendedCorrosionAllowanceMm()
      Gets the recommended corrosion allowance from corrosion analysis.
      Returns:
      corrosion allowance in mm, or -1 if not yet evaluated
    • toJson

      public String toJson()
      Export mechanical design data to JSON format.

      This method creates a MechanicalDesignResponse object and serializes it to JSON using Gson. The JSON includes equipment identification, weight breakdown, design conditions, dimensions, and materials information.

      Usage example:

      
      MechanicalDesign mecDesign = separator.getMechanicalDesign();
      mecDesign.calcDesign();
      String json = mecDesign.toJson();
      
      
      Overrides:
      toJson in class MechanicalDesign
      Returns:
      JSON string representation of the mechanical design
    • main

      public static void main(String[] args)

      main.

      Parameters:
      args - an array of String objects