class Gtengine::Simple::Compressor

Constants

DEFAULTS

Attributes

average[RW]
g[RW]
input[RW]
options[RW]
output[RW]
pi_k[RW]

Public Class Methods

new(input, pi_k, options = {}) click to toggle source
# File lib/gtengine/simple/compressor.rb, line 8
def initialize(input, pi_k, options = {})
  @input, @pi_k = input, pi_k.to_f
  @options = DEFAULTS.merge(options)
  cycle
end

Public Instance Methods

alfa() click to toggle source
# File lib/gtengine/simple/compressor.rb, line 38
def alfa
  1.577 * 0.0000001 * t_vyh ** 2.383 + 1.774
end
cp() click to toggle source
# File lib/gtengine/simple/compressor.rb, line 34
def cp
  average.average_cp
end
cycle() click to toggle source
# File lib/gtengine/simple/compressor.rb, line 55
def cycle
  @average = Gtengine::Gas.new(input.t.to_f, input.p.to_f)
  5.times { update_average }
  @output = Gtengine::Gas.new(t_vyh, p_vyh)
end
info() click to toggle source
# File lib/gtengine/simple/compressor.rb, line 61
def info
  puts "== Compressor Pi_k: #{@pi_k}, КДП: #{kpd}, Cp_sr: #{cp}, K: #{k}"
  puts "==== Вход T: #{input.t.to_i} K, P: #{input.p.to_i} Па"
  puts "==== Выход T: #{output.t.to_i} K, P: #{output.p.to_i} Па, ALFA: #{alfa}\n\n"
end
k() click to toggle source
# File lib/gtengine/simple/compressor.rb, line 30
def k
  average.average_k
end
kpd() click to toggle source
# File lib/gtengine/simple/compressor.rb, line 14
def kpd
  options[:kpd]
end
l_k() click to toggle source
# File lib/gtengine/simple/compressor.rb, line 26
def l_k
  average.cp * t_vyh * (pi_k ** ((k - 1.0) / k) - 1.0) / kpd
end
p_vh() click to toggle source
# File lib/gtengine/simple/compressor.rb, line 46
def p_vh
  input.p
end
p_vyh() click to toggle source
# File lib/gtengine/simple/compressor.rb, line 22
def p_vyh
  input.p * pi_k
end
t_vh() click to toggle source
# File lib/gtengine/simple/compressor.rb, line 42
def t_vh
  input.t
end
t_vyh() click to toggle source
# File lib/gtengine/simple/compressor.rb, line 18
def t_vyh
  input.t * (1.0 + ((pi_k ** ((k - 1.0) / k) - 1.0) / kpd))
end
update_average() click to toggle source
# File lib/gtengine/simple/compressor.rb, line 50
def update_average
  @average.t = (t_vh + t_vyh) / 2.0
  @average.p = (p_vh + p_vyh) / 2.0
end