Example #1
0
 def test_airborne_helicopter_radio_refinement(self):
     '''
     Confirms that the beginning and end are trimmed to match the radio signal,
     not the (smoothed) AGL data.
     '''
     gog = M(name='Gear On Ground',
             array=np.ma.array([0] * 3 + [1] * 5 + [0] * 10 + [1] * 5,
                               dtype=int),
             frequency=1,
             offset=0,
             values_mapping={
                 1: 'Ground',
                 0: 'Air'
             })
     agl = P(name='Altitude AGL',
             array=np.ma.array([0.0] * 6 + [20.0] * 12 + [0.0] * 5,
                               dtype=float))
     rad = P(name='Altitude Radio',
             array=np.ma.array([0.0] * 7 + [10.0] * 10 + [0.0] * 6,
                               dtype=float))
     rtr = buildsection('Rotors Turning', 0, 40)
     node = Airborne()
     node.derive(rad, agl, gog, rtr)
     self.assertEqual(node[0].start_edge, 6.1)
     self.assertEqual(node[0].stop_edge, 16.9)
 def test_offshore_section(self):
     offshore = buildsection('Offshore', 5, 100)
     pitch = P('Pitch', self.null)
     roll = P('Roll', self.null)
     phase = OnDeck()
     phase.derive(self.gnds, pitch, roll, offshore)
     self.assertEqual(phase.get_first().slice, slice(10, 90))
Example #3
0
 def test_airborne_helicopter_cant_fly_without_rotor_turning(self):
     gog = M(name='Gear On Ground',
             array=np.ma.array([1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1], dtype=int),
             values_mapping={1:'Ground', 0:'Air'})
     agl = P(name='Altitude AGL',
             array=np.ma.array([0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 2, 0], dtype=float),
             frequency=0.2)
     rtr = buildsection('Rotors Turning', 0, 0)
     node = Airborne()
     node.derive(agl, agl, gog, rtr)
     self.assertEqual(len(node), 0)
Example #4
0
 def setUp(self):
     self.node_class = TakeoffDatetime
     self.takeoff_datetime = self.node_class()
     self.takeoff_datetime.set_flight_attr = Mock()
     self.start_dt = A('Start Datetime', value=datetime(1970, 1, 1))
     self.liftoff = KTI(name='Liftoff', frequency=2, items=[
         KeyTimeInstance(index=64),
     ])
     self.rto = buildsection('Rejected Takeoff', 15, 20)
     self.off_blocks = KTI(name='Off Blocks', frequency=0.25, items=[
         KeyTimeInstance(index=3),
     ])
Example #5
0
 def test_airborne_helicopter_short(self):
     gog = M(name='Gear On Ground',
             array=np.ma.array([0]*3+[1]*5+[0]*10+[1]*5, dtype=int),
             frequency=1,
             offset=0,
             values_mapping={1:'Ground', 0:'Air'})
     agl = P(name='Altitude AGL',
             array=np.ma.array([2.0, 0.0, 0.0]+[0.0]*4+[20.0]*10+[0.0]*6, dtype=float))
     rtr = buildsection('Rotors Turning', 0, 40)
     node = Airborne()
     node.derive(agl, agl, gog, rtr)
     self.assertEqual(len(node), 1)
Example #6
0
 def test_airborne_helicopter_overlap(self):
     gog = M(name='Gear On Ground',
             array=np.ma.array([1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1], dtype=int),
             values_mapping={1:'Ground', 0:'Air'})
     agl = P(name='Altitude AGL',
             array=np.ma.array([0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 2, 0], dtype=float),
             frequency=0.2)
     rtr = buildsection('Rotors Turning', 0, 40)
     node = Airborne()
     node.derive(agl, agl, gog, rtr)
     self.assertEqual(len(node), 2)
     self.assertEqual(node[0].slice.start, 3.2)
     self.assertEqual(node[0].slice.stop, 6)
     self.assertEqual(node[1].slice.start, 8)
     self.assertEqual(node[1].slice.stop, 10.5)
 def test_airborne_helicopter_radio_refinement(self):
     '''
     Confirms that the beginning and end are trimmed to match the radio signal,
     not the (smoothed) AGL data.
     '''
     gog = M(name='Gear On Ground',
             array=np.ma.array([0]*3+[1]*5+[0]*10+[1]*5, dtype=int),
             frequency=1,
             offset=0,
             values_mapping={1:'Ground', 0:'Air'})
     agl = P(name='Altitude AGL',
             array=np.ma.array([0.0]*6+[20.0]*12+[0.0]*5, dtype=float))
     rad = P(name='Altitude Radio',
             array=np.ma.array([0.0]*7+[10.0]*10+[0.0]*6, dtype=float))
     rtr = buildsection('Rotors Turning', 0, 40)
     node = Airborne()
     node.derive(rad, agl, gog, rtr)
     self.assertEqual(node[0].start_edge, 6.1)
     self.assertEqual(node[0].stop_edge, 16.9)
Example #8
0
    def test_derive(self):
        '''
        Tests every flow, but does not test every conceivable set of arguments.
        '''
        type_node = FlightType()
        type_node.set_flight_attr = Mock()
        # Liftoff and Touchdown.
        fast = S('Fast', items=[slice(5,10)])
        liftoffs = KTI('Liftoff', items=[KeyTimeInstance(5, 'a')])
        touchdowns = KTI('Touchdown', items=[KeyTimeInstance(10, 'x')])
        type_node.derive(None, fast, None, liftoffs, touchdowns, None, None, None)
        type_node.set_flight_attr.assert_called_once_with(
            FlightType.Type.COMPLETE)
        # Would be 'COMPLETE', but 'AFR Type' overrides it.
        afr_type = A('AFR Type', value=FlightType.Type.FERRY)
        type_node.set_flight_attr = Mock()
        type_node.derive(afr_type, fast, None, liftoffs, touchdowns, None, None, None)
        type_node.set_flight_attr.assert_called_once_with(FlightType.Type.FERRY)
        # Liftoff missing.
        empty_liftoffs = KTI('Liftoff')
        type_node.set_flight_attr = Mock()
        try:
            type_node.derive(None, fast, None, empty_liftoffs, touchdowns, None, None, None)
        except InvalidFlightType as err:
            self.assertEqual(err.flight_type, 'TOUCHDOWN_ONLY')
        # Touchdown missing.
        empty_touchdowns = KTI('Touchdown')
        type_node.set_flight_attr = Mock()
        try:
            type_node.derive(None, fast, None, liftoffs, empty_touchdowns, None, None, None)
        except InvalidFlightType as err:
            self.assertEqual(err.flight_type, 'LIFTOFF_ONLY')

        # Liftoff and Touchdown missing, only Fast.
        type_node.set_flight_attr = Mock()
        type_node.derive(None, fast, None, empty_liftoffs, empty_touchdowns, None,
                         None, None)
        type_node.set_flight_attr.assert_called_once_with(
            FlightType.Type.INCOMPLETE)
        # Liftoff, Touchdown and Fast missing.
        empty_fast = fast = S('Fast')
        type_node.set_flight_attr = Mock()
        type_node.derive(None, empty_fast, None, empty_liftoffs, empty_touchdowns,
                         None, None, None)
        type_node.set_flight_attr.assert_called_once_with(
            FlightType.Type.INCOMPLETE)
        # Liftoff, Touchdown and Fast missing, RTO.
        rto = buildsection('Rejected Takeoff', 5, 10)
        type_node.set_flight_attr = Mock()
        type_node.derive(None, empty_fast, None, empty_liftoffs, empty_touchdowns,
                         None, rto, None)
        type_node.set_flight_attr.assert_called_once_with(
            FlightType.Type.REJECTED_TAKEOFF)
        # Liftoff after Touchdown.
        late_liftoffs = KTI('Liftoff', items=[KeyTimeInstance(20, 'a')])
        type_node.set_flight_attr = Mock()
        try:
            type_node.derive(None, fast, None, late_liftoffs, touchdowns, None, None, None)
        except InvalidFlightType as err:
            self.assertEqual(err.flight_type, 'TOUCHDOWN_BEFORE_LIFTOFF')
        # Touch and Go before Touchdown.
        afr_type = A('AFR Type', value=FlightType.Type.TRAINING)
        touch_and_gos = KTI('Touch And Go', items=[KeyTimeInstance(7, 'a')])
        type_node.set_flight_attr = Mock()
        type_node.derive(afr_type, fast, None, liftoffs, touchdowns, touch_and_gos,
                         None, None)
        type_node.set_flight_attr.assert_called_once_with(
            FlightType.Type.TRAINING)
        # Touch and Go after Touchdown.
        afr_type = A('AFR Type', value=FlightType.Type.TRAINING)
        touch_and_gos = KTI('Touch And Go', items=[KeyTimeInstance(15, 'a')])
        type_node.set_flight_attr = Mock()
        try:
            type_node.derive(afr_type, fast, None, liftoffs, touchdowns,
                             touch_and_gos, None, None)
        except InvalidFlightType as err:
            self.assertEqual(err.flight_type, 'LIFTOFF_ONLY')
 def setUp(self):
     self.node_class = NoseDownAttitudeAdoption
     self.climbs = buildsection('Initial Climb', 10, 40)
     self.offshore = buildsection('Offshore', 5, 35)
Example #10
0
 def setUp(self):
     self.node_class = NoseDownAttitudeAdoption
     self.climbs = buildsection('Initial Climb', 10, 40)
     self.operational_combinations = [('Pitch', 'Initial Climb')]