Exemplo n.º 1
0
    def test_add_nodes(self, mock_conn):
        """Should call KRPC's add_node() twice with the correct kargs."""
        vessel = mock_conn().space_center.active_vessel
        vessel.orbit.semi_major_axis = 2
        vessel.orbit.body.gravitational_parameter = 1
        mock_conn().space_center.ut = 0

        transfer = HohmannTransfer(target_sma=3)
        transfer.add_nodes()

        expect_calls = [
            call(prograde=transfer.initial_dV, ut=0),
            call(prograde=transfer.final_dV, ut=transfer.transfer_time)
        ]

        control = mock_conn().space_center.active_vessel.control
        control.add_node.assert_has_calls(expect_calls)
Exemplo n.º 2
0
"""
Adds two nodes for a Hohmann transfer to a given altitude.

Currently checks that the initial orbit is reasonably circular.
"""

from HohmannTransfer import HohmannTransfer

DELAY = 180  # in seconds
transfer = HohmannTransfer(delay=DELAY)

TARGET_ALTITUDE = 100 * 1000  # in meters
transfer.target_altitude = TARGET_ALTITUDE

print(transfer)

transfer.add_nodes()