Class: KerbalDyn::OrbitalManeuver::Hohmann

Inherits:
Base
  • Object
show all
Defined in:
lib/kerbaldyn/orbital_maneuver/hohmann.rb

Overview

A special 2-burn orbital maneuver between two circular orbits.

Note that all orbits are circulairzed before being used.

The first burn moves the opposite side of the orbit to the radius of the destination orbit, and the second burn–done when reaching the destination radius–moves the opposite side (where you started) to circularize your orbit.

– TODO: To facilitate elliptical orbits, assume coplanar/coaxial, and take options to use periapsis, semimajor_axis, or apoapsis for each orbit. TODO: ALWAYS use semimajor axis here, so that we can assume circular on lead angle and time; make another class for elliptics and eventually replace this as a subclass with default args. ++

Instance Attribute Summary

Attributes inherited from Base

#final_orbit, #initial_orbit

Instance Method Summary collapse

Methods inherited from Base

#delta_mean_anomaly, #delta_t, #delta_time, #delta_velocities, #delta_velocity, #mean_anomalies, #mean_lead_angle, #mean_lead_time, #moving_to_higher_orbit?, #orbital_radii, #relative_anomaly_delta, #times, #velocities

Methods included from Mixin::ParameterAttributes

included

Constructor Details

#initialize(initial_orbit, final_orbit, options = {}) ⇒ Hohmann

Returns a new instance of Hohmann.



18
19
20
# File 'lib/kerbaldyn/orbital_maneuver/hohmann.rb', line 18

def initialize(initial_orbit, final_orbit, options={})
  super(initial_orbit.circularize, final_orbit.circularize, options)
end

Instance Method Details

#burn_eventsObject



35
36
37
38
39
40
41
42
43
44
# File 'lib/kerbaldyn/orbital_maneuver/hohmann.rb', line 35

def burn_events
  vs = [self.transfer_orbit.periapsis_velocity, self.transfer_orbit.apoapsis_velocity]
  vs.reverse! if( initial_orbit.semimajor_axis > final_orbit.semimajor_axis )
  v1,v2 = vs

  return [
    BurnEvent.new(:initial_velocity => self.initial_orbit.mean_velocity, :final_velocity => v1, :time => 0.0, :orbital_radius => self.initial_orbit.semimajor_axis, :mean_anomaly => 0.0),
    BurnEvent.new(:initial_velocity => v2, :final_velocity => self.final_orbit.mean_velocity, :time => self.transfer_orbit.period/2.0, :orbital_radius => self.final_orbit.semimajor_axis, :mean_anomaly => Math::PI)
  ]
end

#orbitsObject



31
32
33
# File 'lib/kerbaldyn/orbital_maneuver/hohmann.rb', line 31

def orbits
  return [self.initial_orbit, self.transfer_orbit, self.final_orbit]
end

#transfer_orbitObject

The elliptical orbit used to transfer from the initial_orbit to the final_orbit.



24
25
26
27
28
29
# File 'lib/kerbaldyn/orbital_maneuver/hohmann.rb', line 24

def transfer_orbit
  r1 = self.initial_orbit.periapsis
  r2 = self.final_orbit.apoapsis
  # TODO: It should be the Orbit's job to min/max periapsis and apoapsis, and then set angles appropriately.
  return @transfer_orbit ||= Orbit.new(self.initial_orbit.primary_body, :periapsis => [r1,r2].min, :apoapsis => [r1,r2].max)
end