def read_boom_data(boom_name_=""):
    values = database.read_aircraft_specifications()
    design_type_ = values[objects][boom_name_][design_type]
    part = values[objects][boom_name_][boom_type]
    if design_type_ == unconventional_design:
        return read_boom_values(values[part][boom_name_])
    else:
        return read_fuselage_values(values["boom"][boom_name_])
def delete_control_surface_objects(value=""):
    data = database.read_aircraft_specifications()
    try:
        array = data[control_surface_objects]
        array.remove(value)
        data[control_surface_objects] = array
    except:
        pass
    database.write_aircraft_specification(data)
def read_parent_data(surface_name="",key=""):
    values = database.read_aircraft_specifications()
    design_type_ = values[objects][surface_name][design_type]
    surface_type_ = values[objects][surface_name][surface_type]
    if design_type_ == unconventional_design:
            return values[lifting_surface][surface_name][key]

    else:
            return values[lifting_surface][surface_name][key]
def write_control_surface_to_objects(surface_name="",parent__=""):
    data = database.read_aircraft_specifications()
    try:
        val = data[objects]
        val[surface_name] = {surface_name: {parent_:parent__}}
    except Exception as e:
        logging.error(e)
        data.update({objects: {surface_name: {parent_:parent__}}})
    database.write_aircraft_specification(data)
def delete_control_surface_from_objects(surface_name=""):
    data = database.read_aircraft_specifications()
    try:
        array = data[objects]
        array.pop(surface_name)
        data[objects] = array
    except:
        pass
    database.write_aircraft_specification(data)
예제 #6
0
def get_parameters_from_conventional_boom(boom_name=""):
    values = database.read_aircraft_specifications()[boom][boom_name]
    nose_radius_ = values.get(nose_width)
    nose_length_ = values.get(nose_length)
    nose_position_z_ = values.get(nose_position_z)

    cockpit_height_ = values.get(cockpit_height)
    cockpit_length_ = values.get(cockpit_length)
    cockpit_width_ = values.get(cockpit_width)
    cockpit_position_x_ = values.get(cockpit_position_x)
    cockpit_position_y_ = values.get(cockpit_position_y)
    cockpit_position_z_ = values.get(cockpit_position_z)

    tail_tip_position_ = values.get(tail_tip_position)
    nose_tip_position_ = values.get(nose_tip_position)

    tail_radius_ = values.get(tail_width)
    tail_length_ = values.get(tail_length)
    tip_radius_ = values.get(tip_width)
    tail_position_z_ = values.get(tail_position_z)

    section_1_length_ = values.get(section_1_length)
    section_1_radius_ = values.get(section_1_width)
    section_1_position_z_ = values.get(section_1_position_z)

    section_2_radius_ = values.get(section_2_width)
    section_2_length_ = values.get(section_2_length)
    section_2_position_z_ = values.get(section_2_position_z)

    section_3_length_ = values.get(section_3_length)
    section_3_radius_ = values.get(section_3_width)
    section_3_position_z_ = values.get(section_3_position_z)
    radii = list(
        np.array([
            nose_radius_, section_1_radius_, section_2_radius_,
            section_3_radius_, tail_radius_
        ]) / divider)
    x = list(
        np.array([
            nose_length_,
            sum([nose_length_, section_1_length_, section_2_length_]),
            sum([
                nose_length_, section_1_length_, section_2_length_,
                section_3_length_
            ]),
            sum([
                nose_length_, section_1_length_, section_2_length_,
                section_3_length_, tail_length_
            ])
        ]) / divider)
    z = list(
        np.array([
            nose_position_z_, section_1_position_z_, section_2_position_z_,
            section_3_position_z_, tail_position_z_
        ]) / 2000)
    return radii, x, z
def write_boom_objects(value=""):
    data = database.read_aircraft_specifications()
    try:
        array = data[boom_objects]
        if not array.__contains__(value):
            array.append(value)
        data[boom_objects] = array
    except:
        data.update({boom_objects: [value]})
    database.write_aircraft_specification(data)
def read_surface_data(surface_name=""):
    values = database.read_aircraft_specifications()
    design_type_ = values[objects][surface_name][design_type]
    surface_type_ = values[objects][surface_name][surface_type]

    if design_type_ == unconventional_design:
        return read_lifting_surface_params(
            values[lifting_surface][surface_name])
    else:
        return read_w_h_v(values[lifting_surface][surface_name],
                          part=surface_type_)
def write_control_surface_objects(value=""):
    data = database.read_aircraft_specifications()
    try:
        array = data[control_surface_objects]
        if not array.__contains__(value):
            array.append(value)
        data[control_surface_objects] = array
    except Exception as e:

        data.update({control_surface_objects: [value]})
    database.write_aircraft_specification(data)
def get_surface_type(surface_name = ""):
    _type=""
    values = get_parent_name(surface_name)
    surface_type_=database.read_aircraft_specifications()[values][surface_type]
    if surface_type_==wing:
        _type=aileron_
    elif surface_type_==tailplane:
        _type=elevator_
    elif surface_type_==fin:
        _type=rudder_

    return _type
예제 #11
0
def get_parameters_from_conventional_wing(surface_name=""):
    values = database.read_aircraft_specifications(
    )[lifting_surface][surface_name]
    root_chord = values.get(chord)
    dihedral_ = values.get(dihedral)
    sweep_ = values.get(sweep)
    twist_ = values.get(twist)
    span_ = values.get(span)
    taper_ratio_ = values[taper_ratio]
    profile_ = values.get(profile)
    tip_chord = root_chord / taper_ratio_
    return span_ / divider, tip_chord / divider, root_chord / divider, dihedral_, sweep_, profile_
def read_surface_data(surface_name=""):
    values=database.read_aircraft_specifications()[control_surface][surface_name]
    root_location_x_ = values.get(root_le_position_x)
    root_location_y_ = values.get(root_le_position_y)
    root_location_z_ = values.get(root_le_position_z)
    rot_x_ = values.get(rotation_x)
    rot_y_ = values.get(rotation_y)
    rot_z_ = values.get(rotation_z)
    parent__=values.get(parent_)
    span_ = values.get(span)
    chord_ = values.get(chord)
    return root_location_x_, root_location_y_, root_location_z_, rot_x_, rot_y_, rot_z_, span_, chord_,parent__
def write_boom_to_objects(boom_name="", boom_type_="", design_type_=""):
    data = database.read_aircraft_specifications()
    try:
        val = data[objects]
        val[boom_name] = {boom_type: boom_type_, design_type: design_type_}
    except Exception as e:
        logging.error(e)
        data.update({
            objects: {
                boom_name: {
                    boom_type: boom_type_,
                    design_type: design_type_
                }
            }
        })
    database.write_aircraft_specification(data)
def read_landing_gear_values():
    values = database.read_aircraft_specifications()
    values = values[landing_gear]
    landing_gear_type_ = values.get(landing_gear_type)
    struct_length_main_gear_ = values.get(struct_length_main_gear)
    tire_diameter_ = values.get(tire_diameter)
    wheel_diameter_ = values.get(wheel_diameter)
    struct_length_aux_ = values.get(struct_length_aux)
    aux_gear_position_x_ = values.get(aux_gear_position_x)
    aux_gear_position_y_ = values.get(aux_gear_position_y)
    aux_gear_position_z_ = values.get(aux_gear_position_z)
    rol_gear_position_x_ = values.get(rol_gear_position_x)
    rol_gear_position_y_ = values.get(rol_gear_position_y)
    rol_gear_position_z_ = values.get(rol_gear_position_z)
    return landing_gear_type_, struct_length_main_gear_, struct_length_aux_, \
           aux_gear_position_x_, aux_gear_position_y_, aux_gear_position_z_, \
           rol_gear_position_x_, rol_gear_position_y_, rol_gear_position_z_,wheel_diameter_,tire_diameter_,
def write_lifting_surface_to_objects(surface_name="",
                                     surface_type_="",
                                     design_type_=""):
    data = database.read_aircraft_specifications()
    try:
        val = data[objects]
        val[surface_name] = {
            surface_type: surface_type_,
            design_type: design_type_
        }
    except Exception as e:
        logging.error(e)
        data.update({
            objects: {
                surface_name: {
                    surface_type: surface_type_,
                    design_type: design_type_
                }
            }
        })
    database.write_aircraft_specification(data)
예제 #16
0
def get_parameters_from_sections_lifting_surface(surface_name=""):
    values = database.read_aircraft_specifications()
    parameters = values[lifting_surface][surface_name]
    profile_ = values[lifting_surface][surface_name][profile]
    x_list = [
        parameters[section_1_x], parameters[section_2_x],
        parameters[section_3_x], parameters[section_4_x],
        parameters[section_5_x]
    ]
    y_list = [
        parameters[section_1_y], parameters[section_2_y],
        parameters[section_3_y], parameters[section_4_y],
        parameters[section_5_y]
    ]
    chords = [
        parameters[section_1_chord], parameters[section_2_chord],
        parameters[section_3_chord], parameters[section_4_chord],
        parameters[section_5_chord]
    ]
    z_list = [[
        parameters[section_1_z], parameters[section_2_z],
        parameters[section_3_z], parameters[section_4_z],
        parameters[section_5_z]
    ]]
    avg_chord = np.average(np.array(chords))
    y = np.array(y_list, dtype=float)
    z = np.array(z_list, dtype=float)
    x = np.array([0., 1., 1.5, 3.5, 4., 6.], dtype=float)
    dihedral_ = 0
    try:
        dihedral_ = np.arctan(max([np.gradient(z, y)]))
    except:
        pass
    sweep_ = max(np.arctan(np.gradient(y_list, x_list)))
    span_ = max(y_list)
    tip_chord = min(chords)
    root_chord = max(chords)
    return span_ / divider, tip_chord / divider, root_chord / divider, dihedral_, sweep_, profile_
def read_control_surface_objects():
    data = database.read_aircraft_specifications()
    return data[control_surface_objects]
def get_sweep_and_dihedral(part=""):
    values = database.read_aircraft_specifications()[part]
    sweep_ = values[part + "_sweep"]
    dihedral_ = values.get(part + "_dihedral")
    return sweep_, dihedral_
def get_parent_name(surface_name = ""):
    values = database.read_aircraft_specifications()[control_surface][surface_name]
    return values.get(parent_)
def read_lifting_surface_objects():
    data = database.read_aircraft_specifications()
    return data[lifting_surface_objects]
def read_root_position(part=""):
    values = database.read_aircraft_specifications()[part]
    root_location_x_ = values[part + "_root_position_x"]
    root_location_y_ = values.get(part + "_root_position_y")
    root_location_z_ = values.get(part + "_root_position_z")
    return root_location_x_, root_location_y_, root_location_z_
def get_surface_object_data(boom_name_=""):
    values = database.read_aircraft_specifications()
    design_type_ = values[objects][boom_name_][design_type]
    part_type_ = values[objects][boom_name_][surface_type]
    return design_type_, part_type_
예제 #23
0
def get_parameters_from_unconventional_boom(boom_name=""):
    values = database.read_aircraft_specifications()[boom][boom_name]
    fuselage_length = values.get(boom_length)
    fuselage_diameter = values.get(boom_diameter)
    root_position_x_ = values.get(root_position_x)
    root_position_y_ = values.get(root_position_y)
    root_position_z_ = values.get(root_position_z)

    nose_width_ = values.get(nose_width)
    nose_height_ = values.get(nose_height)
    nose_length_ = values.get(nose_length)
    nose_position_z_ = values.get(nose_position_z)

    xz_mirror_ = values.get(xz_mirror)
    xy_mirror_ = values.get(xy_mirror)
    yz_mirror_ = values.get(yz_mirror)

    cockpit_height_ = values.get(cockpit_height)
    cockpit_length_ = values.get(cockpit_length)
    cockpit_width_ = values.get(cockpit_width)
    cockpit_position_x_ = values.get(cockpit_position_x)
    cockpit_position_y_ = values.get(cockpit_position_y)
    cockpit_position_z_ = values.get(cockpit_position_z)

    tail_tip_position_ = values.get(tail_tip_position)
    nose_tip_position_ = values.get(nose_tip_position)

    tail_profile_ = values.get(tail_profile)
    nose_profile_ = values.get(nose_profile)
    section_1_profile_ = values.get(section_1_profile)
    section_2_profile_ = values.get(section_2_profile)
    section_3_profile_ = values.get(section_3_profile)

    tail_length_ = values.get(tail_length)
    tail_width_ = values.get(tail_width)
    tip_width_ = values.get(tip_width)
    tail_height_ = values.get(tail_height)
    tip_height_ = values.get(tip_height)
    tail_position_z_ = values.get(tail_position_z)

    section_1_length_ = values.get(section_1_length)
    section_1_width_ = values.get(section_1_width)
    section_1_height_ = values.get(section_1_height)
    section_1_position_z_ = values.get(section_1_position_z)

    section_2_width_ = values.get(section_2_width)
    section_2_height_ = values.get(section_2_height)
    section_2_length_ = values.get(section_2_length)
    section_2_position_z_ = values.get(section_2_position_z)

    section_3_length_ = values.get(section_3_length)
    section_3_width_ = values.get(section_3_width)
    section_3_height_ = values.get(section_3_height)
    section_3_position_z_ = values.get(section_3_position_z)
    s = list(
        np.array([
            get_area(nose_width_, nose_height_),
            get_area(section_1_width_, section_1_height_),
            get_area(section_2_width_, section_2_height_),
            get_area(section_3_width_, section_3_height_),
            get_area(tail_width_, tail_height_)
        ]) / divider)
    x = list(
        np.array([
            nose_length_,
            sum([nose_length_, section_1_length_, section_2_length_]),
            sum([
                nose_length_, section_1_length_, section_2_length_,
                section_3_length_
            ]),
            sum([
                nose_length_, section_1_length_, section_2_length_,
                section_3_length_, tail_length_
            ])
        ]) / divider)
    return s, x
def read_boom_objects():
    data = database.read_aircraft_specifications()
    return data[boom_objects]