Class PipelineMechanicalDesign
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
RiserMechanicalDesign, TopsidePipingMechanicalDesign
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 Summary
FieldsModifier and TypeFieldDescriptionprivate PipeMechanicalDesignCalculatorInternal calculator for standards-based calculations.private NorsokM506CorrosionRateNORSOK M-506 corrosion rate model.Data source for loading from database.private doubleDesign life in years for corrosion allowance calculation.(package private) StringDesign standard code.private doubleGlycol (MEG) weight fraction in aqueous phase (0 to 1).private doubleInhibitor efficiency (0 to 1) for corrosion rate calculation.(package private) doubleInner diameter in meters.private intLocation class per ASME B31.8.private StringMaterial grade per API 5L.private NorsokM001MaterialSelectionNORSOK M-001 material selection model.private doublePipeline length in meters.private static final longSerialization version UID.Fields inherited from class MechanicalDesign
costEstimate, designStandard, maxDesignCv, maxDesignDuty, maxDesignGassVolumeFlow, maxDesignOilVolumeFlow, maxDesignPower, maxDesignPressureDrop, maxDesignVelocity, maxDesignVolumeFlow, maxDesignWaterVolumeFlow, minDesignDuty, minDesignGassVolumeFLow, minDesignOilFLow, minDesignPower, minDesignVolumeFLow, minDesignWaterVolumeFLow, moduleHeight, moduleLength, moduleWidth, outerDiameter, tantanLength, wallThickness, weightElectroInstrument, weightNozzle, weightPiping, weightStructualSteel, weightVessel, weigthInternals, weigthVesselShell -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for PipelineMechanicalDesign. -
Method Summary
Modifier and TypeMethodDescriptionvoidcalcDesign.Get the internal calculator for standards-based calculations.Returns the NORSOK M-506 corrosion rate model for this pipeline.doubleGets the calculated corrosion rate after running corrosion analysis.Get the data source for database access.doubleGets the design life for corrosion allowance calculations.Get the design standard code.intGet the location class.doubleGet the calculated MAOP (Maximum Allowable Operating Pressure).Get the material grade.Returns the NORSOK M-001 material selection model for this pipeline.private doublegetMoleFractionSafe(SystemInterface fluid, int phaseNum, String componentName) Safely gets a component mole fraction from a fluid phase.doubleGet the pipeline length.doubleGets the recommended corrosion allowance from corrosion analysis.Gets the recommended material grade from corrosion analysis.doubleGet the calculated test pressure.private voidInitialize design parameters from pipeline equipment.booleanCheck if the mechanical design is within safe limits.voidLoad design factors from database for the current company.voidLoad all design parameters from database tables.voidloadMaterialFromDatabase(String grade) Load material properties from database.static voidmain.private voidpopulateFromStream(NorsokM506CorrosionRate model, StreamInterface stream) Populates the corrosion model with conditions extracted from a process stream.voidreadDesignSpecifications.voidRuns a complete corrosion analysis using the pipeline's operating conditions.voidsetDesignLifeYears(double years) Sets the design life for corrosion allowance calculations.voidsetDesignStandardCode(String code) Set the design standard code.voidsetGlycolWeightFraction(double fraction) Sets the glycol (MEG/DEG) weight fraction for corrosion calculations.voidsetInhibitorEfficiency(double efficiency) Sets the inhibitor efficiency for corrosion calculations.voidsetLocationClass(int locationClass) Set the location class per ASME B31.8.voidsetMaterialGrade(String grade) Set the material grade per API 5L.voidsetPipelineLength(double length) Set the pipeline length.toJson()Export mechanical design data to JSON format.Methods inherited from class MechanicalDesign
addDesignDataSource, calculateCostEstimate, costEstimateToJson, displayResults, equals, generateBillOfMaterials, getApplicableStandards, getBareModuleCost, getCompanySpecificDesignStandards, getConstrutionMaterial, getCorrosionAllowance, getCostEstimate, getDefaultLiquidDensity, getDefaultLiquidViscosity, getDesignCorrosionAllowance, getDesignDataSources, getDesignJointEfficiency, getDesignLimitData, getDesignMaxPressureLimit, getDesignMaxTemperatureLimit, getDesignMinPressureLimit, getDesignMinTemperatureLimit, getDesignStandard, getDuty, getGrassRootsCost, getHeatTransferArea, getInnerDiameter, getInstallationManHours, getJointEfficiency, getLastMarginResult, getMaterialDesignStandard, getMaterialPipeDesignStandard, getMaxAllowableStress, getMaxDesignCv, getMaxDesignGassVolumeFlow, getMaxDesignOilVolumeFlow, getMaxDesignPressure, getMaxDesignPressureDrop, getMaxDesignVelocity, getMaxDesignVolumeFlow, getMaxDesignWaterVolumeFlow, getMaxOperationPressure, getMaxOperationTemperature, getMinDesignGassVolumeFLow, getMinDesignOilFLow, getMinDesignPressure, getMinDesignVolumeFLow, getMinDesignWaterVolumeFLow, getMinOperationPressure, getMinOperationTemperature, getModuleHeight, getModuleLength, getModuleWidth, getOuterDiameter, getPower, getPressureMarginFactor, getProcessEquipment, getPurchasedEquipmentCost, getRecommendedStandards, getResponse, getTantanLength, getTensileStrength, getTotalModuleCost, getVolumeTotal, getWallThickness, getWeightElectroInstrument, getWeightNozzle, getWeightPiping, getWeightStructualSteel, getWeightTotal, getWeightVessel, getWeigthInternals, getWeigthVesselShell, hasDesignStandard, hashCode, initMechanicalDesign, isHasSetCompanySpecificDesignStandards, setCompanySpecificDesignStandards, setConstrutionMaterial, setCorrosionAllowance, setCostEstimateCepci, setCostEstimateLocationFactor, setCostEstimateMaterial, setDefaultLiquidDensity, setDefaultLiquidViscosity, setDesign, setDesignDataSource, setDesignDataSources, setDesignStandard, setDesignStandard, setDesignStandard, setDesignStandard, setDesignStandards, setHasSetCompanySpecificDesignStandards, setInnerDiameter, setJointEfficiency, setMaterialDesignStandard, setMaterialPipeDesignStandard, setMaxDesignCv, setMaxDesignDuty, setMaxDesignGassVolumeFlow, setMaxDesignOilVolumeFlow, setMaxDesignPower, setMaxDesignPressureDrop, setMaxDesignVelocity, setMaxDesignVolumeFlow, setMaxDesignWaterVolumeFlow, setMaxOperationPressure, setMaxOperationTemperature, setMinDesignDuty, setMinDesignGassVolumeFLow, setMinDesignOilFLow, setMinDesignPower, setMinDesignVolumeFLow, setMinDesignWaterVolumeFLow, setMinOperationPressure, setMinOperationTemperature, setModuleHeight, setModuleLength, setModuleWidth, setOuterDiameter, setPressureMarginFactor, setProcessEquipment, setTantanLength, setTensileStrength, setWallThickness, setWeightElectroInstrument, setWeightNozzle, setWeightPiping, setWeightStructualSteel, setWeightTotal, setWeightVessel, setWeigthInternals, setWeigthVesselShell, toCompactJson, validateOperatingEnvelope, validateOperatingEnvelope
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialization version UID.- See Also:
-
innerDiameter
double innerDiameterInner diameter in meters. -
designStandardCode
String designStandardCodeDesign standard code. -
calculator
Internal calculator for standards-based calculations. -
pipelineLength
private double pipelineLengthPipeline length in meters. -
materialGrade
Material grade per API 5L. -
locationClass
private int locationClassLocation class per ASME B31.8. -
dataSource
Data source for loading from database. -
corrosionModel
NORSOK M-506 corrosion rate model. -
materialSelector
NORSOK M-001 material selection model. -
designLifeYears
private double designLifeYearsDesign life in years for corrosion allowance calculation. -
inhibitorEfficiency
private double inhibitorEfficiencyInhibitor efficiency (0 to 1) for corrosion rate calculation. -
glycolWeightFraction
private double glycolWeightFractionGlycol (MEG) weight fraction in aqueous phase (0 to 1).
-
-
Constructor Details
-
PipelineMechanicalDesign
Constructor for PipelineMechanicalDesign.- Parameters:
equipment- aProcessEquipmentInterfaceobject
-
-
Method Details
-
initializeFromPipeline
private void initializeFromPipeline()Initialize design parameters from pipeline equipment. -
getDataSource
Get the data source for database access.- Returns:
- the data source instance
-
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
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:
readDesignSpecificationsin classMechanicalDesign
-
calcDesign
-
getMAOP
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
Set the material grade per API 5L.- Parameters:
grade- material grade (e.g., "X52", "X65", "X70")
-
getMaterialGrade
-
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
Set the design standard code.- Parameters:
code- design standard code
-
getDesignStandardCode
-
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
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
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
Populates the corrosion model with conditions extracted from a process stream.- Parameters:
model- the corrosion rate model to populatestream- the process stream to extract conditions from
-
getMoleFractionSafe
Safely gets a component mole fraction from a fluid phase.- Parameters:
fluid- the fluid systemphaseNum- the phase numbercomponentName- 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
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
Export mechanical design data to JSON format.This method creates a
MechanicalDesignResponseobject 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:
toJsonin classMechanicalDesign- Returns:
- JSON string representation of the mechanical design
-
main
-