Ejemplo n.º 1
0
    def parse_xml_tree(self, root):
        # parse node
        if root.tag == "render_file":
            self.render_filename = root.attrib["filename"]

        if root.tag == "mass_property":
            self.mass = float(root.attrib["mass"])
            self.inertia_tensor = self.convert_str_to_matrix(
                root.attrib["inertia_tensor"], 3, 3)

        if root.tag == "rotor":
            pos = self.convert_str_to_vector(root.attrib["position"], 3)
            dir = self.convert_str_to_vector(root.attrib["direction"], 3)
            clockwise = (root.attrib["clockwise"] == "1")
            torque_coef = float(root.attrib["torque_coef"])
            rotor = Rotor(position_body=pos,
                          direction_body=dir,
                          clockwise=clockwise,
                          torque_coef=torque_coef)
            self.rotors.append(rotor)

        if root.tag == "wing":
            area = float(root.attrib["area"])
            dir = self.convert_str_to_vector(root.attrib["direction"], 3)
            angle0 = math.radians(float(root.attrib["angle0"]))
            wing = Wing(area=area, direction=dir, angle0=angle0)
            self.wing = wing

        # search sub-tree
        for child in root:
            self.parse_xml_tree(child)
Ejemplo n.º 2
0
    def setup(self):

        self.wing = Wing()
        self.engine = Engine()
        self.fuselage = Fuselage()

        self.components = [self.wing, self.engine, self.fuselage]

        Wpay = Variable("W_{pay}", 700, "lbf", "payload")
        Wzfw = Variable("W_{zfw}", "lbf", "zero fuel weight")

        constraints = [Wzfw >= sum(summing_vars(self.components, "W")) + Wpay]

        return self.components, constraints
Ejemplo n.º 3
0
 def OnWing(self, e):
     o = Wing()
     wings.append(o)
     cad.AddUndoably(o, None, None)