Пример #1
0
    def test_flatten_arrangement_2layer_locations_complicated(self):
        """
        test flatten applies correct locations
        """
        self.mass1.location = layout.Point(4, -5, 6)
        self.mass2.location = layout.Point(3, 2, 1)

        arrangement = layout.Arrangement("arrangement1", *[self.mass1, self.mass2])
        arrangement.location = layout.Point(3, -2, 7)
        arrangement2 = layout.Arrangement("arrangement2", *[self.mass3, self.mass4])
        arrangement2.location = layout.Point(-5, 0, 12)
        arrangement3 = layout.Arrangement("arrangement3", arrangement,
                                                          arrangement2,
                                                          self.mass1)
        arrangement3.location = layout.Point(1, 7, 0)

        flattened_arrangement = arrangement3.flatten()
        mass_list = flattened_arrangement.all_mass_objects
        expected_mass_list = self.mass_list + [self.mass1]

        self.assertEqual(mass_list[0].location, layout.Point(8, 0 , 13))
        self.assertEqual(mass_list[1].location, layout.Point(7, 7 , 8))
        self.assertEqual(mass_list[2].location, layout.Point(-4, 7 , 12))
        self.assertEqual(mass_list[3].location, layout.Point(-4, 7 , 12))
        self.assertEqual(mass_list[4].location, layout.Point(5, 2, 6))
Пример #2
0
 def test_location_setting(self):
     """
     test the mass_object can be given a location and cog change
     """
     mass_object = layout.MassObject(self.geometry, 1, "name")
     mass_object.location = layout.Point(1,2,3)
     self.assertEqual(mass_object.location, layout.Point(1,2,3))
     self.assertEqual(mass_object.center_of_gravity_global,
                       layout.Point(1.5, 3, 4.5))
Пример #3
0
 def test_center_of_gravity_negative(self):
     """
     tests the calculation of the center of gravity with masses in different
     locations
     """
     self.mass1.location = layout.Point(-6, -5, -4)
     geometry = layout.Cuboid(1,2,3)
     mass2 = layout.MassObject(geometry, 1, "name2")
     arrangement = layout.Arrangement("arrangement1", self.mass1, mass2)
     self.assertEqual(arrangement.center_of_gravity,
                      layout.Point(-2.5, -1.5, -0.5))
Пример #4
0
 def test_center_of_gravity_global(self):
     """
     tests the calculation of the center of gravity global
     """
     self.mass1.location = layout.Point(6, 5, 4)
     geometry = layout.Cuboid(1,2,3)
     mass2 = layout.MassObject(geometry, 1, "name2")
     arrangement = layout.Arrangement("arrangement1", self.mass1, mass2)
     arrangement.location = layout.Point(1, 2, 3)
     self.assertEqual(arrangement.center_of_gravity_global,
                      layout.Point(4.5, 5.5, 6.5))
Пример #5
0
 def test_cog(self):
     """
     test the center of gravity is initially the centroid
     """
     mass_object = layout.MassObject(self.geometry, 1, "name")
     self.assertEqual(mass_object.center_of_gravity,
                       layout.Point(0.5, 1, 1.5))
Пример #6
0
 def test_center_of_gravity(self):
     """
     tests the calculation of the center of gravity
     """
     arrangement = layout.Arrangement("arrangement1", *self.mass_list)
     self.assertEqual(arrangement.center_of_gravity,
                      layout.Point(0.5, 1, 1.5))
Пример #7
0
    def test_create_mass_string(self):
        """
        test the create mass string method works with a shifted mass
        """
        mass_object = layout.MassObject(self.geometry, 1, "name")
        mass_object.location = layout.Point(1,1,1) # apply shift

        expected_string = "6   1.5   2.0   2.5    6.5   5.0   2.5"
        self.assertEqual(mass_object.avl_mass_string, expected_string)
Пример #8
0
    def test_clone_reflect_y(self):
        self.geometry = layout.Cuboid(1,2,3)
        mass_object = layout.MassObject(self.geometry, 1, "name")
        cloned_mass = mass_object.clone(reflect_y = True)
        self.assertEqual(cloned_mass.geometry.x_size, 1)
        self.assertEqual(cloned_mass.geometry.y_size,  -2)
        self.assertEqual(cloned_mass.geometry.z_size, 3)

        self.assertEqual(cloned_mass.center_of_gravity, layout.Point(0.5, -1, 1.5))
Пример #9
0
    def test_structural_factory_foam(self):
        """
        tests that the stuctural factory produces the correct structural model
        for the foam model and returns the correct centers of gravity
        """

        for index, section in enumerate(self.structural_model.objects):
            point = layout.Point(0.5, index + 0.5, 1)
            self.assertEqual(section.center_of_gravity_global.x, point.x)
            self.assertEqual(section.center_of_gravity_global.y, point.y)
            self.assertEqual(section.center_of_gravity_global.z, point.z)
Пример #10
0
    def create(self):

        # create a surface file ------------------------------------------------
        surface = avl.Surface("main")
        surface.define_mesh(20, 30, 1.0, 1.0)

        cord1 = 0.8
        section1 = avl.Section(cord1)
        section1.aerofoil = aerofoil.Aerofoil.develop_aerofoil(
            0.2, -0.2, 0.2, 0.5, 0)

        cord2 = 0.3
        section2 = avl.Section(cord2)
        section2.translation_bias(cord1 - cord2, 0.3, 0)
        section2.twist_angle = -1
        section2.aerofoil = aerofoil.Aerofoil.develop_aerofoil(
            0.2, -0.2, 0.2, 0.5, 0)

        cord3 = 0.05
        section3 = avl.Section(cord3)
        section3.twist_angle = -1
        section3.translation_bias(cord1 - cord3, 0.85, 0)
        section3.aerofoil = aerofoil.Aerofoil.develop_aerofoil(
            0.2, -0.2, 0.2, 0.5, 0)

        control_surface = avl.ControlSurface(
            "elevator", 0.3, [0, 1, 0], avl.ControlDeflectionType.SYMMETRIC)
        surface.add_section(section1, section2, section3)
        surface.add_control_surface(control_surface, 1, 2)
        surface.reflect_surface = True
        plane = avl.Plane("UAV", surface)

        # create a mass file ---------------------------------------------------
        # create sustructure from wing
        structure_creator = layout.StructureFactory(
            layout.StructuralModelType.HOLLOWFOAM)
        structural_model = structure_creator(surface, wall_thickness=1)
        structural_clone = structural_model.clone(reflect_y=True)

        # add some more weights and arrangement
        battery = layout.MassObject(layout.Cuboid(0.1, 0.1, 0.1), 1)
        battery.location = layout.Point(0, -0.05, -0.05)

        arrangement = layout.Arrangement("plane arrangement", battery,
                                         structural_model, structural_clone)

        # create case file -----------------------------------------------------
        case = avl.TrimCase(surface.area * 2,
                            velocity=22,
                            mass=arrangement.total_mass)

        return plane, case, arrangement
Пример #11
0
    def test_all_mass_objects_nested(self):
        """
        tests obtaining all mass objects within an arrangement, with nested
        arrangements all with their own locations
        """
        sub_arrangement = layout.Arrangement("arrangement1", *self.mass_list)
        sub_arrangement.location = layout.Point(0, 0, 1)
        arrangement = layout.Arrangement("arrangement2", sub_arrangement)
        mass_list = arrangement.all_mass_objects

        self.assertEqual(len(mass_list), len(self.mass_list))
        for i in range(len(self.mass_list)):
            self.assertEqual(mass_list[i], self.mass_list[i])
Пример #12
0
    def test_reflect_y_offset(self):
        """
        tests that the y refelection method creates a new arrangement reflected
        in the y axis
        """
        arrangement = layout.Arrangement("arrangement1", *self.mass_list)

        # offset the masses within the arrangement
        for mass in self.mass_list:
            mass.location = layout.Point(0, 10, 0)

        arrangement_reflect = arrangement.clone(reflect_y = True)

        self.assertEqual(arrangement_reflect.center_of_gravity.x, 0.5)
        self.assertEqual(arrangement_reflect.center_of_gravity.y, -11)
        self.assertEqual(arrangement_reflect.center_of_gravity.z, 1.5)
Пример #13
0
    def test_reflect_y(self):
        """
        tests that the y refelection method creates a new arrangement reflected
        in the y axis
        """
        arrangement = layout.Arrangement("arrangement1", *self.mass_list)

        # create expected reflected coordinates for center of gravity
        x = arrangement.center_of_gravity.x
        y = -1 * arrangement.center_of_gravity.y
        z = arrangement.center_of_gravity.z
        reflected_cog = layout.Point(x, y, z)

        arrangement_reflect = arrangement.clone(reflect_y = True)

        self.assertEqual(arrangement_reflect.center_of_gravity.x, reflected_cog.x)
        self.assertEqual(arrangement_reflect.center_of_gravity.y, reflected_cog.y)
        self.assertEqual(arrangement_reflect.center_of_gravity.z, reflected_cog.z)
Пример #14
0
    def test_flatten_arrangement_2layer_locations(self):
        """
        test flatten applies correct locations
        """
        arrangement = layout.Arrangement("arrangement1", *self.mass_list[0:2])
        arrangement.location = layout.Point(0, 0, 1)
        arrangement2 = layout.Arrangement("arrangement2", *self.mass_list[2:])
        arrangement2.location = layout.Point(0, 0, 2)
        arrangement3 = layout.Arrangement("arrangement3", arrangement,
                                                          arrangement2,
                                                          self.mass_list[0])
        arrangement3.location = layout.Point(1, 7, 0)

        flattened_arrangement = arrangement3.flatten()
        mass_list = flattened_arrangement.all_mass_objects
        expected_mass_list = self.mass_list + [self.mass1]

        self.assertEqual(mass_list[0].location, layout.Point(1, 7 , 1))
        self.assertEqual(mass_list[1].location, layout.Point(1, 7 , 1))
        self.assertEqual(mass_list[2].location, layout.Point(1, 7 , 2))
        self.assertEqual(mass_list[3].location, layout.Point(1, 7 , 2))
        self.assertEqual(mass_list[4].location, layout.Point(1, 7 , 0))
Пример #15
0
 def test_reflect_y(self):
     self.assertEqual(self.cuboid.reflect_y().centroid,
                      geometry.Point(1, -1.5, 2))
Пример #16
0
 def test_subtract(self):
     self.assertEqual(self.point1 - self.point2, geometry.Point(0, 0, 0))
Пример #17
0
 def test_reflect_y(self):
     self.assertEqual(self.point1.reflect_y(), geometry.Point(1, -2, 3))
Пример #18
0
 def setUp(self):
     self.point1 = geometry.Point(1, 2, 3)
     self.point2 = geometry.Point(1, 2, 3)
Пример #19
0
 def test_reflect_y(self):
     self.trapezium = geometry.TrapeziumPlate(6, 4, 0, 5, 1)
     self.assertEqual(self.trapezium.reflect_y().centroid,
                      geometry.Point(38 / 15, -7 / 3, 0.5))
    def create(self, input_dict, name  = "UAV"):

        surface = avl.Surface("main_wing")
        surface.define_mesh(15, 20, 1.0, 1.0)

        main_cord1 = input_dict["cord_1"]
        section1 = avl.Section(main_cord1)
        thickness = input_dict["aerofoil_1_thickness"]
        section1.aerofoil = aerofoil.Aerofoil.develop_aerofoil(thickness,
                                                               -1 * thickness,
                                                               input_dict["aerofoil_1_thickness"],
                                                               input_dict["aerofoil_1_thickness_loc"],
                                                               input_dict["aerofoil_1_camber"])

        cord2 = input_dict["cord_2"]
        section2 = avl.Section(cord2)
        section2.twist_angle = input_dict["twist_angle_2"]
        wing_shift_1 = input_dict["wing_shift_1"]
        section2.translation_bias(main_cord1  - cord2 - wing_shift_1, input_dict["span_section_1"], 0)
        thickness = input_dict["aerofoil_2_thickness"]
        section2.aerofoil = aerofoil.Aerofoil.develop_aerofoil(thickness,
                                                               -1 * thickness,
                                                               input_dict["aerofoil_2_thickness"],
                                                               input_dict["aerofoil_2_thickness_loc"],
                                                               input_dict["aerofoil_2_camber"])

        cord3 = input_dict["cord_3"]
        section3 = avl.Section(cord3)
        section3.twist_angle = input_dict["twist_angle_3"]
        wing_shift_2 = input_dict["wing_shift_2"]
        section3.translation_bias(main_cord1 - cord3 - wing_shift_1 - wing_shift_2, input_dict["span_section_2"], 0)
        thickness = input_dict["aerofoil_3_thickness"]
        section3.aerofoil = aerofoil.Aerofoil.develop_aerofoil(thickness,
                                                               -1 * thickness,
                                                               input_dict["aerofoil_3_camber"],
                                                               input_dict["aerofoil_3_thickness_loc"],
                                                               input_dict["aerofoil_3_camber"])


        surface.add_section(section1, section2, section3)
        surface.reflect_surface = True

        # design tail
        tail_surface = avl.Surface("tail")
        tail_surface.angle_bias = input_dict["tail_twist"]
        tail_surface.define_translation_bias(input_dict["elevator_distance"], 0, 0)
        tail_surface.define_mesh(10, 15, 1.0, 1.0)
        thickness = input_dict["tail_thickness"]
        tail_aerofoil = aerofoil.Aerofoil.develop_aerofoil(0.5*thickness,
                                                       -1 * 0.5*thickness,
                                                       input_dict["tail_thickness"],
                                                       input_dict["tail_thickness_loc"],
                                                       input_dict["tail_camber"])
        cord1 = input_dict["tail_cord_1"]
        tail_section1 = avl.Section(cord1)
        tail_section1.aerofoil = tail_aerofoil

        cord2 = input_dict["tail_cord_2"]
        tail_section2 = avl.Section(cord2)
        tail_section2.translation_bias(0, input_dict["boom_width"]*0.5, 0)
        tail_section2.aerofoil = tail_aerofoil

        cord3 = input_dict["tail_cord_3"]
        tail_section3 = avl.Section(cord3)
        tail_section3.translation_bias(0, input_dict["boom_width"]*0.5 + input_dict["elevator_span"], 0)
        tail_section3.aerofoil = tail_aerofoil

        tail_surface.add_section(tail_section1, tail_section2, tail_section3)
        tail_surface.reflect_surface = True
        control_surface = avl.ControlSurface("elevator", input_dict["elevator_size"], [0, 1, 0], avl.ControlDeflectionType.SYMMETRIC)
        tail_surface.add_control_surface(control_surface, 0, 2)

        # design verticle_tail
        """
        vtail_surface = avl.Surface("verticle_tail")
        vtail_surface.define_translation_bias(input_dict["elevator_distance"], 0, 0)
        vtail_surface.define_mesh(10, 15, 1.0, 1.0)

        cord1 = input_dict["vtail_cord_1"]
        vtail_section1 = avl.Section(cord1)
        vtail_section1.translation_bias(0, input_dict["boom_width"]*0.5, 0)
        vtail_section1.aerofoil = tail_aerofoil

        cord2 = input_dict["vtail_cord_2"]
        vtail_section2 = avl.Section(cord2)
        vtail_section2.translation_bias(0, input_dict["boom_width"]*0.5, input_dict["vtail_height"])
        tail_section2.aerofoil = tail_aerofoil

        vtail_surface.add_section(vtail_section1, vtail_section2)
        vtail_surface.reflect_surface = True
        """

        # create a mass file ---------------------------------------------------
        # create sustructure from wing
        structure_creator  = layout.StructureFactory(layout.StructuralModelType.HOLLOWFOAM)
        structural_model = structure_creator(surface, wall_thickness = input_dict["wall_thickness"])
        structural_clone =  structural_model.clone(reflect_y = True)

        # create structure for tail
        tail_structural_model = structure_creator(tail_surface, wall_thickness = input_dict["tail_wall_thickness"])
        tail_structural_model.location = layout.Point(tail_surface.x, tail_surface.y, tail_surface.z)
        tail_structural_clone =  tail_structural_model.clone(reflect_y = True)

        # add some more weights and arrangement
        battery = layout.MassObject.from_mass(layout.Cuboid(0.19, 0.035, 0.07), 0.306)
        battery.location = layout.Point(input_dict['battery_loc'], -0.05, -0.05)
        battery2 = battery.clone(reflect_y = True)

        motor = layout.MassObject.from_mass(layout.Cuboid(0.092, 0.042, 0.042), 0.231)
        motor.location = layout.Point(-0.092, input_dict["span_section_2"], -0.05)
        motor2 = motor.clone(reflect_y = True)

        # motor controller
        motor_controller = layout.MassObject.from_mass(layout.Cuboid(0.08, 0.017, 0.031), 0.08)
        motor_controller.location = layout.Point(main_cord1, -0.05, -0.05)

        # add landing gear
        landing_gear = layout.MassObject.from_mass(layout.Cuboid(0.105 + 0.238, 0.05, 0.065), 0.274)
        landing_gear.location = layout.Point(0.8*main_cord1, input_dict["span_section_2"], -0.05)
        landing_gear2 = landing_gear.clone(reflect_y = True)

        # add two hollow booms
        boom1 = layout.MassObject.from_mass(layout.HollowCylinder(0.012, 0.9, 0.005), 0.02727)
        boom1.location = layout.Point(0.25*main_cord1, -0.05, -0.05)
        boom1_ref = boom1.clone(reflect_y = True)

        boom2 = layout.MassObject(layout.HollowCylinder(0.012, 0.9, 0.005), 0.02727)
        boom2.location = layout.Point(0.6*main_cord1, -0.05, -0.05)
        boom2_ref = boom2.clone(reflect_y = True)

        # add horizontal booms
        horizontal_boom1 = layout.MassObject.from_mass(layout.Cuboid( input_dict["elevator_distance"] + 0.5, 0.012, 0.012), 0.03636)
        horizontal_boom1.location = layout.Point(-0.5, 0.1, 0)
        horizontal_boom2 = horizontal_boom1.clone(reflect_y = True)

        # wing box
        box = layout.MassObject.from_mass(layout.Cuboid( 0.47, 0.1, 0.05), 0.284)
        box.location = layout.Point(0, input_dict["span_section_2"], 0)
        box2 = box.clone(reflect_y = True)

        # fuselage box top
        length = input_dict['fuselage_length']
        fuselage = layout.MassObject.from_mass(layout.Cuboid(length, 0.3, 0.09), length * 0.38727)
        fuselage.location = layout.Point(0.4 - length, -0.3*0.5, -0.09)

        fuselage_bottom = layout.MassObject.from_mass(layout.Cuboid(length, 0.3, 0.09), length * 0.54)
        fuselage_bottom.location = layout.Point(0.4 - length, -0.3*0.5, -0.3)

        from_bulk_head = layout.MassObject.from_mass(layout.Cuboid(0.06, 0.24, 0.3), 0.161)
        from_bulk_head.location = layout.Point(0.4 - length, -0.3*0.5, -0.3)

        nose_cone = layout.MassObject.from_mass(layout.Cuboid(0.3, 0.3, 0.3), 0.221)
        nose_cone.location = layout.Point(0.4 - length, -0.3*0.5, -0.3)

        # ribs
        rib_center = layout.MassObject.from_mass(layout.Cuboid(input_dict["cord_1"], 0.06, input_dict["aerofoil_2_thickness"]), 0.02)
        rib_center.location = layout.Point(0, 0, 0)

        rib_outer = layout.MassObject.from_mass(layout.Cuboid(input_dict["cord_2"], 0.03, input_dict["aerofoil_3_thickness"]), 0.01)
        rib_outer.location = layout.Point(0, input_dict["span_section_2"], 0)
        rib_outer_mirror = rib_outer.clone(reflect_y = True)

        arrangement = layout.Arrangement("plane arrangement", battery,
                                                              battery2,
                                                              motor, motor2,
                                                              landing_gear, landing_gear2,
                                                              boom1, boom1_ref,
                                                              boom2, boom2_ref,
                                                              box, box2,
                                                              fuselage, fuselage_bottom,
                                                              horizontal_boom1, horizontal_boom2,
                                                              rib_center, rib_outer, rib_outer_mirror,
                                                              from_bulk_head,
                                                              structural_model,
                                                              structural_clone,
                                                              nose_cone,
                                                              tail_structural_model,
                                                              tail_structural_clone)


        # create case file -----------------------------------------------------
        case = avl.TrimCase(surface.area, velocity = input_dict['velocity'],
                            mass = arrangement.total_mass)

        plane = avl.Plane(name, surface, tail_surface)

        return plane, case, arrangement
Пример #21
0
 def test_centroid(self):
     self.assertEqual(self.hollow_cylinder.centroid,
                      geometry.Point(3, 5, 3))
Пример #22
0
 def test_location_default(self):
     self.assertEqual(self.section.location, layout.Point(0, 0, 0))
Пример #23
0
def create(input_dict, name="uav"):

    surface = avl.Surface(name)
    surface.define_mesh(20, 30, 1.0, 1.0)

    cord1 = input_dict["cord_1"]
    section1 = avl.Section(cord1)
    thickness = input_dict["aerofoil_1_thickness"]
    section1.aerofoil = aerofoil.Aerofoil.develop_aerofoil(
        thickness, -1 * thickness, input_dict["aerofoil_1_thickness"],
        input_dict["aerofoil_1_thickness_loc"],
        input_dict["aerofoil_1_camber"])

    cord2 = input_dict["cord_2"]
    section2 = avl.Section(cord2)
    section2.twist_angle = input_dict["twist_angle_2"]
    wing_shift_1 = input_dict["wing_shift_1"]
    section2.translation_bias(cord1 - cord2 - wing_shift_1,
                              input_dict["span_section_1"], 0)
    thickness = input_dict["aerofoil_2_thickness"]
    section2.aerofoil = aerofoil.Aerofoil.develop_aerofoil(
        thickness, -1 * thickness, input_dict["aerofoil_2_thickness"],
        input_dict["aerofoil_2_thickness_loc"],
        input_dict["aerofoil_2_camber"])

    cord3 = input_dict["cord_3"]
    section3 = avl.Section(cord3)
    section3.twist_angle = input_dict["twist_angle_3"]
    wing_shift_2 = input_dict["wing_shift_2"]
    section3.translation_bias(cord1 - cord3 - wing_shift_1 - wing_shift_2,
                              input_dict["span_section_2"], 0)
    thickness = input_dict["aerofoil_3_thickness"]
    section3.aerofoil = aerofoil.Aerofoil.develop_aerofoil(
        thickness, -1 * thickness, input_dict["aerofoil_3_camber"],
        input_dict["aerofoil_3_thickness_loc"],
        input_dict["aerofoil_3_camber"])

    control_surface = avl.ControlSurface("elevator",
                                         input_dict["elevator_size"],
                                         [0, 1, 0],
                                         avl.ControlDeflectionType.SYMMETRIC)
    surface.add_section(section1, section2, section3)
    surface.add_control_surface(control_surface, 1, 2)
    surface.reflect_surface = True

    # create a mass file ---------------------------------------------------
    # create sustructure from wing
    structure_creator = layout.StructureFactory(
        layout.StructuralModelType.HOLLOWFOAM)
    structural_model = structure_creator(
        surface, wall_thickness=input_dict["wall_thickness"])
    structural_clone = structural_model.clone(reflect_y=True)

    # add some more weights and arrangement
    battery = layout.MassObject(layout.Cuboid(0.1, 0.1, 0.1), 1)
    battery.location = layout.Point(input_dict["battery_x_loc"] * cord1, -0.05,
                                    -0.05)

    motor = layout.MassObject(layout.Cuboid(0.1, 0.1, 0.1), 1)
    motor.location = layout.Point(cord1, -0.05, -0.05)

    arrangement = layout.Arrangement("plane arrangement", battery, motor,
                                     structural_model, structural_clone)

    # create case file -----------------------------------------------------
    case = avl.TrimCase(surface.area * 2,
                        velocity=22,
                        mass=arrangement.total_mass)

    return surface, arrangement, case

    case.to_file(self.run_file)
    layout.create_mass_file(self.mass_file, arrangement, case)
Пример #24
0
 def test_centroid(self):
     self.assertEqual(self.cylinder.centroid, geometry.Point(1, 5, 1))
Пример #25
0
    def create(self, input_dict, name="UAV"):

        surface = avl.Surface("main_wing")
        surface.define_mesh(20, 30, 1.0, 1.0)

        cord1 = input_dict["cord_1"]
        section1 = avl.Section(cord1)
        thickness = input_dict["aerofoil_1_thickness"]
        section1.aerofoil = aerofoil.Aerofoil.develop_aerofoil(
            thickness, -1 * thickness, input_dict["aerofoil_1_thickness"],
            input_dict["aerofoil_1_thickness_loc"],
            input_dict["aerofoil_1_camber"])

        cord2 = input_dict["cord_2"]
        section2 = avl.Section(cord2)
        section2.twist_angle = input_dict["twist_angle_2"]
        wing_shift_1 = input_dict["wing_shift_1"]
        section2.translation_bias(cord1 - cord2 - wing_shift_1,
                                  input_dict["span_section_1"], 0)
        thickness = input_dict["aerofoil_2_thickness"]
        section2.aerofoil = aerofoil.Aerofoil.develop_aerofoil(
            thickness, -1 * thickness, input_dict["aerofoil_2_thickness"],
            input_dict["aerofoil_2_thickness_loc"],
            input_dict["aerofoil_2_camber"])

        cord3 = input_dict["cord_3"]
        section3 = avl.Section(cord3)
        section3.twist_angle = input_dict["twist_angle_3"]
        wing_shift_2 = input_dict["wing_shift_2"]
        section3.translation_bias(cord1 - cord3 - wing_shift_1 - wing_shift_2,
                                  input_dict["span_section_2"], 0)
        thickness = input_dict["aerofoil_3_thickness"]
        section3.aerofoil = aerofoil.Aerofoil.develop_aerofoil(
            thickness, -1 * thickness, input_dict["aerofoil_3_camber"],
            input_dict["aerofoil_3_thickness_loc"],
            input_dict["aerofoil_3_camber"])

        control_surface = avl.ControlSurface(
            "elevator", input_dict["elevator_size"], [0, 1, 0],
            avl.ControlDeflectionType.SYMMETRIC)
        surface.add_section(section1, section2, section3)
        surface.add_control_surface(control_surface, 1, 2)
        surface.reflect_surface = True

        # create a mass file ---------------------------------------------------
        # create sustructure from wing
        """structure_creator  = layout.StructureFactory(layout.StructuralModelType.HOLLOWFOAM)
        structural_model = structure_creator(surface, wall_thickness = input_dict["wall_thickness"])
        structural_clone =  structural_model.clone(reflect_y = True)"""

        # add some more weights and arrangement
        battery = layout.MassObject.from_mass(layout.Cuboid(0.19, 0.035, 0.07),
                                              0.306)
        battery.location = layout.Point(input_dict["battery_x_loc"] * cord1,
                                        -0.035 * 0.5, -0.07 * 0.5)

        motor = layout.MassObject.from_mass(layout.Cuboid(0.092, 0.042, 0.042),
                                            0.231 * 2)
        motor.location = layout.Point(cord1, -0.042 * 0.5, -0.042 * 0.5)

        structure = layout.MassObject.from_mass(
            layout.Cuboid(0.01, 0.01, 0.01), 6)
        structure.location = layout.Point(cord1 * 0.6, -0.005, -0.005)

        arrangement = layout.Arrangement("plane arrangement", battery, motor,
                                         structure)

        # create case file -----------------------------------------------------
        print('AREA ', surface.area)
        print('mass ', arrangement.total_mass)
        case = avl.TrimCase(surface.area,
                            velocity=22,
                            mass=arrangement.total_mass)

        plane = avl.Plane(name, surface)

        return plane, case, arrangement
Пример #26
0
 def test_reflect_y(self):
     reflected = self.hollow_cylinder.reflect_y()
     self.assertEqual(reflected.centroid, geometry.Point(3, -5, 3))
     self.assertEqual(reflected.volume, pi * 80)
Пример #27
0
 def test_reflect_y(self):
     self.assertEqual(self.cylinder.reflect_y().centroid,
                      geometry.Point(1, -5, 1))
Пример #28
0
 def test_centroid(self):
     self.assertEqual(self.cuboid.centroid, geometry.Point(1, 1.5, 2))
Пример #29
0
 def test_location_set(self):
     self.section.location = layout.Point(1, 7, -3)
     self.assertEqual(self.section.location, layout.Point(1, 7, -3))
Пример #30
0
 def setUp(self):
     self.cuboid = geometry.Cuboid(2, 3, 4)
     self.location = geometry.Point(1, 2, 3)