Class: Pulo::Pipeline
- Inherits:
-
Object
- Object
- Pulo::Pipeline
- Defined in:
- lib/pulo/machine/hydraulics/pipe.rb
Instance Attribute Summary collapse
-
#cost ⇒ Object
readonly
Returns the value of attribute cost.
-
#flow ⇒ Object
Returns the value of attribute flow.
-
#flow_velocity ⇒ Object
readonly
Returns the value of attribute flow_velocity.
-
#friction_gradient ⇒ Object
readonly
Returns the value of attribute friction_gradient.
-
#friction_head ⇒ Object
readonly
Returns the value of attribute friction_head.
-
#hydraulic_power ⇒ Object
readonly
Returns the value of attribute hydraulic_power.
-
#inlet_pressure ⇒ Object
readonly
Returns the value of attribute inlet_pressure.
-
#inside_cylinder ⇒ Object
readonly
Returns the value of attribute inside_cylinder.
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#mass ⇒ Object
readonly
Returns the value of attribute mass.
-
#outlet_pressure ⇒ Object
readonly
Returns the value of attribute outlet_pressure.
-
#outside_cylinder ⇒ Object
readonly
Returns the value of attribute outside_cylinder.
-
#pipe_type ⇒ Object
readonly
Returns the value of attribute pipe_type.
-
#static_head ⇒ Object
readonly
Returns the value of attribute static_head.
-
#total_head ⇒ Object
readonly
Returns the value of attribute total_head.
-
#wall_area ⇒ Object
readonly
Returns the value of attribute wall_area.
-
#wall_density ⇒ Object
readonly
Returns the value of attribute wall_density.
-
#wall_thickness ⇒ Object
readonly
Returns the value of attribute wall_thickness.
-
#wall_volume ⇒ Object
readonly
Returns the value of attribute wall_volume.
Instance Method Summary collapse
- #head_for_flow ⇒ Object
-
#initialize(args) ⇒ Pipeline
constructor
A new instance of Pipeline.
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
#cost ⇒ Object (readonly)
Returns the value of attribute cost.
34 35 36 |
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 34 def cost @cost end |
#flow ⇒ Object
Returns the value of attribute flow.
32 33 34 |
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 32 def flow @flow end |
#flow_velocity ⇒ Object (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_gradient ⇒ Object (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_head ⇒ Object (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_power ⇒ Object (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_pressure ⇒ Object (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_cylinder ⇒ Object (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 |
#length ⇒ Object (readonly)
Returns the value of attribute length.
28 29 30 |
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 28 def length @length end |
#mass ⇒ Object (readonly)
Returns the value of attribute mass.
29 30 31 |
# File 'lib/pulo/machine/hydraulics/pipe.rb', line 29 def mass @mass end |
#outlet_pressure ⇒ Object (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_cylinder ⇒ Object (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_type ⇒ Object (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_head ⇒ Object (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_head ⇒ Object (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_area ⇒ Object (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_density ⇒ Object (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_thickness ⇒ Object (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_volume ⇒ Object (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_flow ⇒ Object
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 |