Class: Pulo::Steam::SteamTurbine

Inherits:
Object
  • Object
show all
Defined in:
lib/pulo/machine/steam/steam_turbine.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(inlet_pressure: nil, inlet_temperature: nil, outlet_pressure: nil, isentropic_efficiency: nil, mechanical_efficiency: nil, electrical_power: nil, mass_flow: nil) ⇒ SteamTurbine

Returns a new instance of SteamTurbine.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/pulo/machine/steam/steam_turbine.rb', line 8

def initialize(inlet_pressure: nil, inlet_temperature:nil,outlet_pressure: nil,isentropic_efficiency: nil, mechanical_efficiency: nil,
              electrical_power: nil, mass_flow:nil)

  raise "Need all parameters" unless isentropic_efficiency && mechanical_efficiency &&
      inlet_pressure && outlet_pressure && inlet_temperature &&
      (electrical_power || mass_flow)

  @electrical_power=electrical_power
  @isentropic_efficiency=isentropic_efficiency
  @mechanical_efficiency=mechanical_efficiency

  @inlet_steam=WaterSteam.new(pressure: inlet_pressure, temperature: inlet_temperature)
  outlet_ideal=WaterSteam.new(pressure: outlet_pressure, specific_entropy: @inlet_steam.specific_entropy)
  outlet_enthalpy=outlet_enthalpy_from_isentropic(@inlet_steam.specific_enthalpy,outlet_ideal.specific_enthalpy,@isentropic_efficiency)
  @outlet_steam=WaterSteam.new(pressure: outlet_pressure,specific_enthalpy: outlet_enthalpy)
  if @electrical_power
    energy_output=@electrical_power/@mechanical_efficiency
    outlet_steam.mass_flow=energy_output/(@inlet_steam.specific_enthalpy-outlet_enthalpy)
  else
    outlet_steam.mass_flow=mass_flow
    energy_output=mass_flow*(@inlet_steam.specific_enthalpy-outlet_enthalpy)
    @electrical_power=energy_output*@mechanical_efficiency
  end
  inlet_steam.mass_flow=outlet_steam.mass_flow
end

Instance Attribute Details

#electrical_powerObject (readonly)

Returns the value of attribute electrical_power.



6
7
8
# File 'lib/pulo/machine/steam/steam_turbine.rb', line 6

def electrical_power
  @electrical_power
end

#inlet_steamObject (readonly)

Returns the value of attribute inlet_steam.



4
5
6
# File 'lib/pulo/machine/steam/steam_turbine.rb', line 4

def inlet_steam
  @inlet_steam
end

#isentropic_efficiencyObject (readonly)

Returns the value of attribute isentropic_efficiency.



5
6
7
# File 'lib/pulo/machine/steam/steam_turbine.rb', line 5

def isentropic_efficiency
  @isentropic_efficiency
end

#mechanical_efficiencyObject (readonly)

Returns the value of attribute mechanical_efficiency.



5
6
7
# File 'lib/pulo/machine/steam/steam_turbine.rb', line 5

def mechanical_efficiency
  @mechanical_efficiency
end

#outlet_steamObject (readonly)

Returns the value of attribute outlet_steam.



4
5
6
# File 'lib/pulo/machine/steam/steam_turbine.rb', line 4

def outlet_steam
  @outlet_steam
end

Instance Method Details

#isentropic_efficiency_from_enthalpy(inlet_enthalpy, outlet_enthalpy, ideal_outlet_enthalpy) ⇒ Object



34
35
36
# File 'lib/pulo/machine/steam/steam_turbine.rb', line 34

def isentropic_efficiency_from_enthalpy inlet_enthalpy,outlet_enthalpy,ideal_outlet_enthalpy
  (inlet_enthalpy-outlet_enthalpy)/(inlet_enthalpy-ideal_outlet_enthalpy)
end

#outlet_enthalpy_from_isentropic(inlet_enthalpy, ideal_outlet_enthalpy, isentropic_efficiency) ⇒ Object



37
38
39
# File 'lib/pulo/machine/steam/steam_turbine.rb', line 37

def outlet_enthalpy_from_isentropic inlet_enthalpy,ideal_outlet_enthalpy,isentropic_efficiency
  inlet_enthalpy-isentropic_efficiency*(inlet_enthalpy-ideal_outlet_enthalpy)
end