Skip to content
Snippets Groups Projects

Updated LH2 tank design method

Merged s-roscher requested to merge feature/tank_design_lh2 into main
4 files
+ 2
191
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -25,28 +25,6 @@ from matplotlib import pyplot as plt
import sys
import numpy as np
# Import own modules.
# from pyunitconversion import constants
# import pyaircraftgeometry2 as geom2
# import pyaixml as aixml
# def read_aerodynamic_surface(paths, component, wing_id):
# acxml = aixml.openDocument(paths["path_to_aircraft_exchange_file"])
# airfoil_data_dir = f"{paths["project_directory"]}/geometryData/airfoilData"
# aerodynamic_surface = geom2.factory.WingFactory(acxml, airfoil_data_dir).create(
# f"{component}/specific/geometry/aerodynamic_surface@{wing_id}")
# return aerodynamic_surface
# def read_spar(paths, component, wing_id, spar_id):
# acxml = aixml.openDocument(paths["path_to_aircraft_exchange_file"])
# airfoil_data_dir = f"{paths["project_directory"]}/geometryData/airfoilData"
# spar = geom2.factory.SparFactory(acxml, airfoil_data_dir).create(
# f"{component}/specific/geometry/aerodynamic_surface@{wing_id}/spars/spar@{spar_id}")
# return spar
def prepare_geometrical_data(paths_and_names, dict_ac_data, dict_tank_design, runtime_output):
"""Prepare geometrical data for further use.
@@ -166,16 +144,6 @@ def prepare_wing_tanks(dict_ac_data, dict_tank_design, runtime_output):
:return dict dict_tank_design: Dictionary containing tank design parameter
"""
# TODO: Divide dict into 'left' and 'right'?
"""AircraftGeometry2 Test."""
# print(constants.AU)
# wing = read_aerodynamic_surface(paths_and_names, 'wing', wing_id)
# span = geom2.measure.span(wing)
# chord_at_tip = geom2.measure.chord(wing,-span/2)
# offset_leading_edge_x = geom2.measure.offset_LE(wing,-span/2).x()
# thickness_maximum_at_root = geom2.measure.thickness_max(wing.sections[0])
# spar = read_spar(paths_and_names, 'wing', wing_id, '0')
# spar_area = geom2.measure.area(spar)
# print(list(dir(geom2)))
"""Extract wing information for further operations."""
# Extract wing ID and information on wing symmetry.
@@ -247,14 +215,6 @@ def prepare_wing_tanks(dict_ac_data, dict_tank_design, runtime_output):
tmp_dict['sections'][section]['position']['y']*100, 0)))
# Add thickness_ratio.
tmp_dict['sections'][section]['thickness_ratio'] = dict_ac_data['wing_thickness_to_length'][i]
# Add 'thickness_ratio' (derived from the profile name).
# profile_name = tmp_dict['sections'][section]['profile']
# if profile_name.startswith(("naca", "n", "F15")):
# tmp_dict['sections'][section]['thickness_ratio'] = int(profile_name[-2:])/100
# else:
# # Not implemented yet.
# runtime_output.critical('Error: Thickness ratio cannot be extracted! Program aborted.')
# sys.exit('Exit information: Thickness ratio cannot be extracted from profile name!')
# Add 'tmp_dict' to 'dict_tank_design'.
dict_tank_design['geometry']['wing'] = tmp_dict
@@ -450,14 +410,6 @@ def prepare_trim_tank(dict_ac_data, dict_tank_design, runtime_output):
tmp_dict['sections'][section]['position']['y']*100, 0)))
# Add thickness_ratio.
tmp_dict['sections'][section]['thickness_ratio'] = dict_ac_data['horizontal_stabilizer_thickness_to_length'][i]
# # Add 'thickness_ratio' (derived from the profile name).
# profile_name = tmp_dict['sections'][section]['profile']
# if profile_name.startswith(("naca", "n", "F15")):
# tmp_dict['sections'][section]['thickness_ratio'] = int(profile_name[-2:])/100
# else:
# # Not implemented yet.
# runtime_output.critical('Error: Thickness ratio cannot be extracted! Program aborted.')
# sys.exit('Exit information: Thickness ratio cannot be extracted from profile name!')
# Add 'tmp_dict' to 'dict_tank_design'.
dict_tank_design['geometry']['horizontal_stabilizer'] = tmp_dict
@@ -604,8 +556,6 @@ def prepare_additional_center_tank(dict_ac_data, dict_tank_design, runtime_outpu
:return _type_: _description_
"""
# Extract wing position and index.
# wing_id = next(key for key, value in dict_ac_data['wing_name'].items()
# if value == 'main_wing').split('ID')[-1]
position_wing = dict_ac_data['wing_position_x']
idx_wing = int(round(position_wing*100, 0))
# Extract fuselage length.
@@ -726,38 +676,9 @@ def prepare_for_liquid_hydrogen(dict_ac_data, dict_tank_design, runtime_output):
diameter_usable = [diameter_outside_max[idx]*factor_usable_diameter for idx in range(0, n_points)]
dict_tank_design['geometry']['fuselage']['diameter_usable'] = diameter_usable
# TEST
# plt.plot(x_coord, dict_tank_design['geometry']['fuselage']['widths'])
# plt.plot(x_coord, dict_tank_design['geometry']['fuselage']['heights'])
# plt.plot(width_fuselage_external_interpolated[500:600])
# plt.plot(height_fuselage_external_interpolated[500:600])
# plt.plot(x_coord_array, fuselage_section_origin_z_interpolated)
# plt.show()
# widths = dict_tank_design['geometry']['fuselage']['widths']
# heights = dict_tank_design['geometry']['fuselage']['heights']
# widths = width_fuselage_external_interpolated
# heights = height_fuselage_external_interpolated
# for i in range(len(widths) - 1):
# # Check if the next width or height is smaller than the current
# smaller_width = round(widths[i + 1],4) < round(widths[i],4)
# smaller_height = round(heights[i + 1], 4) < round(heights[i], 4)
# if smaller_width or smaller_height:
# idx = i # Return the index where the tail section starts
# print(heights[i])
# print(heights[i + 1])
# break
# else:
# idx = None
# TEST END
# Find index and x-coordinate of begin of tail section.
idx_begin_tail_section = determine_begin_tail_section(width_fuselage_external_interpolated,
height_fuselage_external_interpolated)
# x_coord_begin_tail_section = x_coord_array[idx_begin_tail_section]
# Find x-coordinate of pressure bulkhead.
# x_coord_pressure_bulkhead = x_coord_begin_tail_section + tail_length_before_bulkhead
# dict_tank_design['geometry']['raw_data']['x_coord_pressure_bulkhead'] = x_coord_pressure_bulkhead
# Check if second iteration loop (tanks already written to acXML). If second iteration loop, the available length
# in the tail cone is assumed to equal the total length of the tail cone tank.
Loading