Ejemplo n.º 1
0
    def browse_airfoils(self):
        """ Allows the user to easily choose amongst available airfoils with a GUI File-Browser.

        :return: Sets the inputs `airfoil_type` and `airfoil_choice` above to the value chosen in the GUI Browser
        """
        root = Tk()
        root.withdraw()
        path = tkFileDialog.askopenfilename(initialdir=DIRS['AIRFOIL_DIR'],
                                            title="Select Airfoil",
                                            filetypes=(("Airfoil Data Files",
                                                        "*.dat"), ("All Files",
                                                                   "*.*")))
        root.destroy()

        valid_dir = DIRS['AIRFOIL_DIR'].replace('\\', '/')
        if path.find(valid_dir) is -1:
            error_window(
                "Custom airfoils must be placed in the pre-allocated directory"
            )
            return 'Airfoil selection failed, please invalidate and run-again'
        else:
            if len(path) > 0:
                self.set_slot_value('airfoil_choice',
                                    str(path.split('.')[-2].split('/')[-1]))
                self.set_slot_value('airfoil_type',
                                    str(path.split('.')[-2].split('/')[-2]))
            return 'Airfoil has been successfully chosen, invalidate to run-again'
Ejemplo n.º 2
0
 def lift_coef_validator(self):
     """ Validator for the compartment_type """
     if isinstance(self.aspect_ratio_range, list):
             for _coef in self.maximum_lift_coefficient:
                 if _coef < 1 and self.handlaunch:
                     error_window('C_L=%d is too low and will result in either too large of a wing surface, or too'
                                  'high of a launch speed to hand launch. Consider increasing' % _coef)
                 elif _coef > 1.7:
                     error_window('C_L=%d This lift coefficient is very difficult to produce without high lift '
                                  'devices at Low Reynolds numbers decreasing' % _coef)
     else:
         raise TypeError('The provided input into :param:`maximum_lift_coefficient` is not valid')
Ejemplo n.º 3
0
 def aspect_validator(self):
     """ Validator for the compartment_type """
     if isinstance(self.aspect_ratio_range, list):
             for _ratio in self.aspect_ratio_range:
                 if _ratio < 10:
                     error_window('AR=%d will result in too of an low aspect ratio and thus high induced drag, '
                                  'consider increasing' % _ratio)
                 elif _ratio > 20:
                     error_window('AR=%d will result in too high of anaspect ratio and thus high structural loads '
                                  'due to increased wing bending moments, consider decreasing' % _ratio)
     else:
         raise TypeError('The provided input into :param:`aspect_ratio` is not valid')
Ejemplo n.º 4
0
 def weight_checker(self):
     """ Validates the user-input weight to make sure it is within the bounds of the project and the region with
     the highest confidence interval for Class I """
     if self.weight_target is 'payload':
         if self.target_value > 5.0:
             error_window(
                 'The provided payload target exceeds the scope of this project (only light UAVs < 20 '
                 '[kg] represent the design space')
     else:
         if self.target_value < 1.0 or self.target_value > 20.0:
             error_window(
                 'The provided MTOW exceeds the scope of this project (only light UAVs < 20 [kg] '
                 'represent the design space')
     return None