PipeSegment - abhishekvraman/Propylean GitHub Wiki

DESCRIPTION:

Class to create object which represents a pipe or pipe fittings or a full series of segments. All the properties associated with a piping used in the process industry to analyse can be accessed as object property.

SAMPLE USE CASES:

# Importing and setting basic properties.
from propylean.equipment.static import PipeSegment
# or
from propylean import PipeSegment
from propylean import properties as prop
ps_1 = PipeSegment(tag="ps_1", ID=prop.Length(10, "inch"), length=(10, "m"))
print(ps_1)
ps_1.inlet_pressure = prop.Pressure(5, "bar")
ps_1.elevation = prop.Length(10, "m") # or just (10, "m")

# Connecting with MaterialStream
from propylean.streams import MaterialStream
condensate = MaterialStream(tag="condensate")
condensate.components = prop.Components(fractions={"water": 1}, type="mass")
ps_1.connect_stream(condensate, "in", stream_governed=False) 

# Get pressure drop.
print(ps_1.pressure_drop)

# Set series of data with property
import pandas as pd
ps_1.pressure_drop.time_series = pd.read_csv("condensate_pipe_data.csv")

Have a look at sample pump circuit calculations.

Input Parameters and properties

       PARAMETERS:
           ID:
               Required: Yes, if OD and thickness not provided
               Type: int or float or property.Lenght(recommended)
               Acceptable values: Non-negative values
               Default value: None
               Description: Internal Diameter of the pipe segment.
       
           OD:
               Required: Yes, if ID not provided
               Type: int or float or property.Lenght(recommended)
               Acceptable values: Non-negative values
               Default value: None
               Description: Outer Diameter of the pipe segment.
           
           thickness:
               Required: Yes, if ID not provided
               Type: int or float or property.Lenght(recommended)
               Acceptable values: Non-negative values
               Default value: None
               Description: Wall thickness of the pipe segment.
           
           length:
               Required: Yes, for straight tube
               Type: int or float or property.Lenght(recommended)
               Acceptable values: Non-negative values
               Default value: None
               Description: length of the pipe segment.
           
           elevation:
               Required: No
               Type: int or float or property.Lenght(recommended)
               Acceptable values: All values
               Default value: 0 m
               Description: elevation of the pipe segment.
       
           segment_type:
               Required: No
               Type: int
               Acceptable values: 1 to 13.
               Default value: 1
               Description: Segment type/fitting type of the pipe segment.
                            Segments can be of following types and in range of numbers below:
                            1. Straight Tube
                            2. Elbow
                            3. Tee (straight through)
                            4. Tee (through branch)
                            5. Butterfly valve 
                            6. Ball valve (full bore)
                            7. Gate valve(full open)
                            8. Globe valve (full open)
                            9. Swing check valve
                            10. Wafer disk check valve
                            11. Lift check valve
                            12. Reducer
                            13. Expander
           
           material:
               Required: No
               Type: int
               Acceptable values: 1 to 5.
               Default value: 1
               Description: Material type of the pipe segment.
                            Segment material can be of following types and in range of numbers below:
                            1. Raw Steel
                            2. Carbon Steel
                            3. Cast Iron
                            4. Stainless Steel
                            5. PVC
           
           shape:
               Required: Yes, only if segment_type is 12(Reducer) or 13(Expander)
               Type: tuple
               Description: Shape of segment type is reducer or expander.
                            For e.g. reducer of 20X18 can be set using tuple (20, 18)
           
           segment_frame:
               Required: No
               Type: Pandas DataFrame
               Description: List of PipeSegment objects in with columns as above arguments.
                            >>> import pandas as pd
                            For below list of segements, DataFrame to be created is as follows:
                               +-----------------------------------------------------------------------------+
                               | Segment Type   |  ID    |  length   |  material     | elevation  | Shape    |
                               | Straight Tube  | 20 cm  |  10 m     | Carbon Steel  | 2 m down   |          |
                               | Elbow          | 20 cm  |  NA       | Carbon Steel  | NA         |          |
                               | Ball Valve     | 20 cm  |  NA       | Carbon Steel  | NA         |          |
                               | Reducer        |        |  NA       | Carbon Steel  | NA         | (20, 18) |
                               +-----------------------------------------------------------------------------+
                               Note: OD and tickness can also be sepcified instead of ID. If all are provided,
                                     ID will be considered
                            >>> segment_frame = pd.DataFrame({'segment_type': [1, 2, 6, 12],
                                                              'ID': [(20, 'cm'), (20, 'cm'), (20, 'cm'), (18, 'cm')],
                                                              'length': [(10, 'm'), None, None, None],
                                                              'material': [2, 2, 2, 2],
                                                              'elevation': [(-2, 'm'), None, None, None],
                                                              'shape': [None, None, None, (20, 18)]})
       PROPERTIES:
          Properties can be accessed using the dot '.' operator. 
          For e.g. `feed_inlet_line.inlet_pressure`

          inlet_pressure
             Type: Pressure
             Description: Inlet pressure of the PipeSegment.

          outlet_pressure
            Type: Pressure
            Description: Outlet pressure of the PipeSegment.

         inlet_temperature
            Type: Temperature
            Description: Inlet temperature of the PipeSegment.

         outlet_temperature
            Type: Temperature
            Description: Outlet temperature of the PipeSegment.

         inlet_mass_flowrate
            Type: MassFlowRate
            Description: Inlet mass flowrate of the PipeSegment.
      
         outlet_mass_flowrate
            Type: MassFlowRate
            Description: Outlet mass flowrate of the PipeSegment.
         
         pressure_drop
            Type: Pressure
            Description: Pressure drop in the pipe segment/fitting.
                         NOTE: Pressure drop is automatically calculated and cannot be set.
                               Connect PipeSegment with material stream with properties for calulations.

       RETURN VALUE:
           Type: PipeSegment
           Description: Returns an object of type PipeSegment with all properties of
                        a pipe segments and fittings used in process industry piping.