Class: Pulo::Pipeline

Inherits:
Object
  • Object
show all
Defined in:
lib/pulo/machine/hydraulics/pipe.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Pipeline

Returns a new instance of Pipeline.



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 36

def initialize(args)

  @pipe_type_ref=args[:pipe]
  @pipe_type=PipeTypes.new().pipe_types[@pipe_type_ref]

  @length=args[:length]
  @cost=@length*@pipe_type[:unit_cost]/@pipe_type[:unit_length]
  @inside_cylinder=Cylinder.new(diameter: @pipe_type[:id], length: @length)
  @outside_cylinder=Cylinder.new(diameter: @pipe_type[:od], length: @length)
  @wall_thickness=@outside_cylinder.radius-@inside_cylinder.radius
  @wall_area=@outside_cylinder.area-@inside_cylinder.area
  @wall_volume=@outside_cylinder.volume-@inside_cylinder.volume
  @mass=@wall_volume*@pipe_type[:density]

  args[:static_head] ? @static_head=args[:static_head] : @static_head=Length.meters(0)
  args[:inlet_pressure] ? @inlet_pressure=args[:inlet_pressure] : @inlet_pressure=Pressure.pascals(0)
  args[:outlet_pressure] ? @outlet_pressure=args[:outlet_pressure] : @outlet_pressure=Pressure.pascals(0)
  @pressure_head=(@outlet_pressure-@inlet_pressure)/(Water.standard_density*Acceleration.standard_gravity)
end

Instance Attribute Details

#costObject (readonly)

Returns the value of attribute cost.



34
35
36
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 34

def cost
  @cost
end

#flowObject

Returns the value of attribute flow.



32
33
34
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 32

def flow
  @flow
end

#flow_velocityObject (readonly)

Returns the value of attribute flow_velocity.



33
34
35
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 33

def flow_velocity
  @flow_velocity
end

#friction_gradientObject (readonly)

Returns the value of attribute friction_gradient.



33
34
35
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 33

def friction_gradient
  @friction_gradient
end

#friction_headObject (readonly)

Returns the value of attribute friction_head.



33
34
35
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 33

def friction_head
  @friction_head
end

#hydraulic_powerObject (readonly)

Returns the value of attribute hydraulic_power.



33
34
35
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 33

def hydraulic_power
  @hydraulic_power
end

#inlet_pressureObject (readonly)

Returns the value of attribute inlet_pressure.



32
33
34
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 32

def inlet_pressure
  @inlet_pressure
end

#inside_cylinderObject (readonly)

Returns the value of attribute inside_cylinder.



28
29
30
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 28

def inside_cylinder
  @inside_cylinder
end

#lengthObject (readonly)

Returns the value of attribute length.



28
29
30
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 28

def length
  @length
end

#massObject (readonly)

Returns the value of attribute mass.



29
30
31
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 29

def mass
  @mass
end

#outlet_pressureObject (readonly)

Returns the value of attribute outlet_pressure.



32
33
34
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 32

def outlet_pressure
  @outlet_pressure
end

#outside_cylinderObject (readonly)

Returns the value of attribute outside_cylinder.



28
29
30
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 28

def outside_cylinder
  @outside_cylinder
end

#pipe_typeObject (readonly)

Returns the value of attribute pipe_type.



30
31
32
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 30

def pipe_type
  @pipe_type
end

#static_headObject (readonly)

Returns the value of attribute static_head.



33
34
35
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 33

def static_head
  @static_head
end

#total_headObject (readonly)

Returns the value of attribute total_head.



33
34
35
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 33

def total_head
  @total_head
end

#wall_areaObject (readonly)

Returns the value of attribute wall_area.



29
30
31
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 29

def wall_area
  @wall_area
end

#wall_densityObject (readonly)

Returns the value of attribute wall_density.



31
32
33
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 31

def wall_density
  @wall_density
end

#wall_thicknessObject (readonly)

Returns the value of attribute wall_thickness.



29
30
31
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 29

def wall_thickness
  @wall_thickness
end

#wall_volumeObject (readonly)

Returns the value of attribute wall_volume.



29
30
31
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 29

def wall_volume
  @wall_volume
end

Instance Method Details

#head_for_flowObject



63
64
65
66
67
68
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 63

def head_for_flow()
  k=(@pipe_type[:Chw]**1.85)*@inside_cylinder.face.diameter.meters.value**4.87
  @friction_gradient=Dimensionless.n(10.67*@flow.cubic_meter_per_second.value**1.85/k)
  @friction_head=@length * @friction_gradient
  @total_head=@friction_head+@static_head+@pressure_head
end