OpenMDAO / Aviary

NASA's aircraft analysis, design, and optimization tool
https://openmdao.github.io/Aviary/
Other
143 stars 66 forks source link

Overrides not working for PASSENGER_MASS, BAGGAGE_MASS, and PASSENGER_PAYLOAD_MASS #610

Open ehariton opened 1 week ago

ehariton commented 1 week ago

Description

Using a LEAPS-based mass calculation and trying to overload / set the PASSENGER_MASS, BAGGAGE_MASS, or PASSENGER_PAYLOAD_MASS, none of these will affect Aircraft.CrewPayload.TOTAL_PAYLOAD_MASS.

The computations for Aircraft.CrewPayload.TOTAL_PAYLOAD_MASS happen in CargoMass() in cargo.py. And what we can see from there is all the calculations for the problematic overloads happen in the same compute. In order to make these individual values overridable, this combined compute would need to be split up into separate computes, so that the values can be promoted between components. Overriding only works between components.

Additionally, there is no warning saying that the values could not be overloaded! In fact there is a confirmation that the values were overloaded, even if that overload did not impact anything.

The following variables have been overridden:
  'aircraft:crew_and_payload:baggage_mass  0  kg
  'aircraft:crew_and_payload:passenger_mass  0  kg

Three test cases can be observed from the included example code:

  1. All .set_vals() are commented out, results in objective values ~ 2.5
  2. BAGGAGE_MASS and PASSENGER_MASS set_vals() are = 0, results in objective values ~2.5
  3. TOTAL_PAYLOAD_MASS set_val() = 0, results in objective values ~2.2

Example

import aviary.api as av from example_phase_info import phase_info from aviary.variable_info.variables import Aircraft

prob = av.AviaryProblem()

Load aircraft and options data from user

Allow for user overrides here

aviary_inputs = prob.load_inputs( 'models/test_aircraft/aircraft_for_bench_FwFm.csv', phase_info)

aviary_inputs.set_val(Aircraft.CrewPayload.BAGGAGE_MASS, 0, 'kg') aviary_inputs.set_val(Aircraft.CrewPayload.PASSENGER_MASS, 0, 'kg')

aviary_inputs.set_val(Aircraft.CrewPayload.TOTAL_PAYLOAD_MASS, 0, 'kg')

Preprocess inputs

prob.check_and_preprocess_inputs()

prob.add_pre_mission_systems()

prob.add_phases()

prob.add_post_mission_systems()

Link phases and variables

prob.link_phases()

prob.add_driver("SLSQP", max_iter=100)

prob.add_design_variables()

Load optimization problem formulation

Detail which variables the optimizer can control

prob.add_objective()

prob.setup()

prob.set_initial_guesses()

prob.run_aviary_problem()

Aviary Version

0.9.4-dev

Relevant environment information

pip freeze -e git+ssh://git@developer.nasa.gov/AATT-SAI/Aero_Perf_Component.git@742aa8ae41dcf623fc3d9e0fffbedfbed9b6d4cf#egg=aeroperf_wrapper -e git+ssh://git@developer.nasa.gov/AATT-SAI/MBSAE-AircraftDict.git@8b82ca5e0b7e9d5c629b32e70cf1e3e0d24decc4#egg=aircraft_dictionary ansicolors==1.1.8 attrs==23.2.0 bleach==6.1.0 bokeh==3.2.2 certifi==2023.7.22

Editable install with no version control (charm==0.1.0)

-e /mnt/c/OMDAO/OpenVSP/python/CHARM charset-normalizer==3.2.0 colorcet==3.0.1 contourpy==1.1.1 coverage==4.5.4 cycler==0.11.0

Editable install with no version control (degen-geom==0.0.1)

-e /mnt/c/OMDAO/OpenVSP/python/degen_geom -e git+ssh://git@github.com/OpenMDAO/dymos.git@37b96dde482ac4a07457ccbbdb7db2a2a37605ee#egg=dymos exceptiongroup==1.1.3 fastjsonschema==2.19.1 fonttools==4.42.1 fortranformat==2.0.0 holoviews==1.18.1 hvplot==0.9.1 idna==3.4 importlib-metadata==7.0.1 importlib-resources==6.1.0 iniconfig==2.0.0 Jinja2==3.1.2 jsonschema==4.21.1 jsonschema-specifications==2023.12.1 jupyter_core==5.7.1 kiwisolver==1.4.5 linkify-it-py==2.0.2 Markdown==3.5.1 markdown-it-py==3.0.0 MarkupSafe==2.1.3 matplotlib==3.8.0 mdit-py-plugins==0.4.0 mdolab-baseclasses==1.8.0 mdurl==0.1.2 mpi4py @ file:///home/conda/feedstock_root/build_artifacts/mpi4py_1695451909161/work nbformat==5.9.2 networkx==3.1 numpy @ file:///home/conda/feedstock_root/build_artifacts/numpy_1695290879892/work/dist/numpy-1.26.0-cp39-cp39-linux_x86_64.whl#sha256=2145d30cdd6d3c9c4a4be216bb158edeac64e1c9aba388e733918d65b9481735 -e git+ssh://git@github.com/OpenMDAO/om-Aviary.git@ae0915aaf6cd3124708581c1f1a2402a171b39b2#egg=om_aviary -e git+ssh://git@github.com/OpenMDAO/pyCycle.git@d2f89d4c771f15d62f25e68849e6e17e510cdd87#egg=om_pycycle -e git+https://github.com/OpenMDAO/OpenMDAO.git@d625443054e62a645da5b16eb8a2be50a236f85d#egg=openmdao

Editable install with no version control (openvsp==3.31.1)

-e /mnt/c/OMDAO/OpenVSP/python/openvsp packaging==23.1 pandas==2.1.1 panel==1.3.6 param==2.0.1 parameterized==0.9.0 petsc4py @ file:///home/conda/feedstock_root/build_artifacts/petsc4py_1695599261071/work Pillow==10.0.1 platformdirs==4.2.0 plotly==5.17.0 pluggy==1.3.0 pyct==0.5.0 pycycle==3.0.0 -e git+https://github.com/mdolab/pyoptsparse@cae6954e67ad58b03b535cc015e9d0118d89695e#egg=pyoptsparse pyparsing==3.1.1 pytest==7.4.2 python-dateutil==2.8.2 pytz==2023.3.post1 pyviz_comms==3.0.0 pyXDSM==2.3.0 PyYAML==6.0.1 referencing==0.33.0 requests==2.31.0 rpds-py==0.18.0 scipy==1.11.2 simupy==1.1.2 six==1.16.0 sqlitedict==2.1.0 tenacity==8.2.3 testflo==1.4.12 tomli==2.0.1 tornado==6.3.3 tqdm==4.66.1 traitlets==5.14.1 -e git+ssh://git@developer.nasa.gov/earetski/TTBW.git@cbb05078beb33d97eec99f0e56f81bebebb8ca6a#egg=ttbw typing_extensions==4.9.0 tzdata==2023.3 uc-micro-py==1.0.2 urllib3==2.0.5

Editable install with no version control (utilities==0.1.0)

-e /mnt/c/OMDAO/OpenVSP/python/utilities -e git+ssh://git@developer.nasa.gov/AATT-SAI/OpenVSP.git@3cbad544ac200cb5cf3b4f4f00a9e4ef131d2d4a#egg=vsp_wrappers webencodings==0.5.1 xyzservices==2023.7.0 zipp==3.17.0

ehariton commented 3 days ago

This issue is referenced in the user guide and the multi_mission example and that should also be updated when this fix is in:

(...aviary/docs/examples/multi_mission.ipynb) (...aviary/examples/multi_mission/run_multimission_example_large_single_aisle.py)

Additionally, preprocessor.py should be updated to read: "please set Aircraft.CrewPayload.PASSENGER_PAYLOAD_MASS to zero" instead of "please set Aircraft.CrewPayload.TOTAL_PAYLOAD_MASS to zero" in two places.