Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Units missing from many variables in Aviary #559

Open
hschilling opened this issue Oct 8, 2024 · 0 comments
Open

Units missing from many variables in Aviary #559

hschilling opened this issue Oct 8, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@hschilling
Copy link
Member

Description

Aviary models seem to be missing information about the units for many of the variables.

If an Aviary run is done with optimization history turned on, the resulting case recorder file has metadata for the variables but the units for many variables that should have units, instead have units of None.

Example

Run this script to generate the driver history file.

"""
Run the a mission with a simple external component that computes the wing
and horizontal tail mass.
"""
from copy import deepcopy
import aviary.api as av

from aviary.examples.external_subsystems.simple_weight.simple_weight_builder import WingWeightBuilder


phase_info = deepcopy(av.default_height_energy_phase_info)
# Here we just add the simple weight system to only the pre-mission
phase_info['pre_mission']['external_subsystems'] = [WingWeightBuilder()]

prob = av.AviaryProblem()

# Load aircraft and options data from user
# Allow for user overrides here
prob.load_inputs('models/test_aircraft/aircraft_for_bench_FwFm.csv', phase_info)

# 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")

prob.add_design_variables()

prob.add_objective()

prob.setup()

prob.set_initial_guesses()

prob.run_aviary_problem(suppress_solver_print=True, optimization_history_filename='driver_history_run_simple_weight.db')

print('Engine Mass', prob.get_val(av.Aircraft.Engine.MASS))
print('Wing Mass', prob.get_val(av.Aircraft.Wing.MASS))
print('Horizontal Tail Mass', prob.get_val(av.Aircraft.HorizontalTail.MASS))

print('done')

The units for the variables from the metadata is shown here

mission:objectives:fuel units are 'None'
mission:constraints:range_residual units are 'None'
gtow_constraint.GTOW units are 'None'
mission:constraints:mass_residual units are 'None'
traj.phases.climb->path_constraint->throttle units are 'unitless'
traj.climb.collocation_constraint.defects:mass units are 'None'
traj.climb.collocation_constraint.defects:distance units are 'None'
traj.phases.cruise->initial_boundary_constraint->throttle units are 'unitless'
traj.phases.cruise->final_boundary_constraint->throttle units are 'unitless'
traj.cruise.collocation_constraint.defects:mass units are 'None'
traj.cruise.collocation_constraint.defects:distance units are 'None'
traj.phases.descent->path_constraint->throttle units are 'unitless'
traj.descent.collocation_constraint.defects:mass units are 'None'
traj.descent.collocation_constraint.defects:distance units are 'None'
mission:design:gross_mass units are 'lbm'
mission:summary:gross_mass units are 'lbm'
traj.climb.t_duration units are 'None'
traj.climb.states:mass units are 'None'
traj.climb.states:distance units are 'None'
traj.cruise.t_duration units are 'None'
traj.cruise.states:mass units are 'None'
traj.cruise.states:distance units are 'None'
traj.descent.t_duration units are 'None'
traj.descent.states:mass units are 'None'
traj.descent.states:distance units are 'None'

Aviary Version

0.9.4-dev

Relevant environment information

No response

@hschilling hschilling added the bug Something isn't working label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant