Aviary icon indicating copy to clipboard operation
Aviary copied to clipboard

add/improve unit tests in FLOPS based mission

Open xjjiang opened this issue 1 year ago • 1 comments

Summary

This PR adds missing output value checks and partial checks within mission/flops_based. Some test_IO() functions are added.

Utility function assert_match_varnames() is enhanced to allow users to specify exclude_inputs and exclude_outputs. This allows us to run test_IO() even if there are inputs/outputs that are not Aviary variable on purpose.

No unit tests are added for detailed_landing_phases.py and detailed_takeoff_phases.py. Currently, there is only one case for detailed landing/detailed takeoff. It is currently tested already.

A TODO in mission/flops_based/ode/test/test_mission_eom.py: This test compares against full_mission_test_data in ascent, cruise, and descent phases. The numbers match in ascent and descent phases. My guess is that the number in cruise in full_mission_test_data has wrong units. Note: my number 760.55416759 ft/min = 3.86361517135375 m/s which is the expected number.

A TODO in mission/flops_based/ode/test/test_required_thrust.py: Should thrust_required be an Aviary variable? There are other inputs/outputs in mission/flops_based/ode/ that are not in Aviary variable hierarchy. They can be identified by implementing test_IO() function. I didn't do it.

A TODO in mission/flops_based/phases/build_landing.py: Detailed landing is not currently enabled. This is already a AnalysisError in Aviary. It should be copied to Aviary Issues.

A TODO in mission/flops_based/phases/build_takeoff.py: Detailed takeoff is not currently enabled. This is already a AnalysisError in Aviary. It should be copied to Aviary Issues.

Documentation in docs/developer_guide/unit_tests.md is enriched. An interesting statistics:

  • assert_near_equal: 80%
  • assert_check_partials: 15%
  • assert_match_varnames: 4%
  • all other tests: < 1%

This PR is part of issue 270 "Complete code coverage for unittesting".

Related Issues

  • Resolves #

Backwards incompatibilities

None

New Dependencies

None

xjjiang avatar Aug 14 '24 17:08 xjjiang

@jkirk5 I strongly suspect that ALTITUDE_RATE_MAX in validation_cases/validation_data/flops_data/full_mission_test_data.py should be 760.55416759 instead of 3.86361517135375. Note that 760.55416759 ft/min = 3.86361517135375 m/s.

xjjiang avatar Aug 19 '24 15:08 xjjiang