Class: KerbalDyn::Part::LiquidFuelEngine

Inherits:
Base
  • Object
show all
Defined in:
lib/kerbaldyn/part/liquid_fuel_engine.rb

Constant Summary collapse

IspSurfaceGravity =

The surface gravity, as used for Isp calculations; this was determined experimentally.

9.8072

Instance Attribute Summary

Attributes inherited from Base

#attributes, #errors

Instance Method Summary collapse

Methods inherited from Base

#[], #category, #category_name, #cost, #crash_tolerance, #description, #drag, #impact_tolerance, #initialize, load_part, #mass, #max_temp, #maximum_drag, #minimum_drag, #module, #module_class, module_class, #name, #title, #to_hash, #to_json

Constructor Details

This class inherits a constructor from KerbalDyn::Part::Base

Instance Method Details

#fuel_consumption(tank) ⇒ Object

This is the volume-wise fuel flow. Multiply by 1000.0 to get liters/s instead of m^3/s.

It needs a fuel tank to calculate from, as fuel densities vary by tank.



46
47
48
# File 'lib/kerbaldyn/part/liquid_fuel_engine.rb', line 46

def fuel_consumption(tank)
  return self.mass_flow_rate / tank.fuel_density
end

#gimbal_rangeObject



63
64
65
# File 'lib/kerbaldyn/part/liquid_fuel_engine.rb', line 63

def gimbal_range
  return self['gimbal_range'].to_s
end

#heat_productionObject



24
25
26
# File 'lib/kerbaldyn/part/liquid_fuel_engine.rb', line 24

def heat_production
  return self['heatProduction'].to_f
end

#ispObject



16
17
18
# File 'lib/kerbaldyn/part/liquid_fuel_engine.rb', line 16

def isp
  return self['Isp'].to_f
end

#mass_flow_rateObject

Calculated mass fuel flow.

To calculate the fuel flow in liters, one must multiply by 1000.0 and divide by the fuel tank density



32
33
34
# File 'lib/kerbaldyn/part/liquid_fuel_engine.rb', line 32

def mass_flow_rate
  return self.max_thrust / (self.isp * IspSurfaceGravity)
end

#max_thrustObject Also known as: thrust



7
8
9
# File 'lib/kerbaldyn/part/liquid_fuel_engine.rb', line 7

def max_thrust
  return self['maxThrust'].to_f
end

#min_thrustObject



12
13
14
# File 'lib/kerbaldyn/part/liquid_fuel_engine.rb', line 12

def min_thrust
  return self['minThrust'].to_f
end

#thrust_vectored?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/kerbaldyn/part/liquid_fuel_engine.rb', line 59

def thrust_vectored?
  return self['thrustVectoringCapable'].to_s.downcase == 'true'
end

#vac_fuel_consumption(tank) ⇒ Object

This is the volume-wise fuel flow. Multiply by 1000.0 to get liters/s instead of m^3/s.

It needs a fuel tank to calculate from, as fuel densities vary by tank.



55
56
57
# File 'lib/kerbaldyn/part/liquid_fuel_engine.rb', line 55

def vac_fuel_consumption(tank)
  return self.vac_mass_flow_rate / tank.fuel_density
end

#vac_ispObject



20
21
22
# File 'lib/kerbaldyn/part/liquid_fuel_engine.rb', line 20

def vac_isp
  return self['vacIsp'].to_f
end

#vac_mass_flow_rateObject

Calculated mass fuel flow.



37
38
39
# File 'lib/kerbaldyn/part/liquid_fuel_engine.rb', line 37

def vac_mass_flow_rate
  return self.max_thrust / (self.vac_isp * IspSurfaceGravity)
end