def wipe_design(): value = {} try: database.write_aircraft_specification(value) except: pass try: database.write_datcom_stability_specification(value) except: pass try: database.write_structures_specification(value) except: pass try: database.write_aerodynamic_results(value) except: pass try: database.write_control_specifications(value) except: pass try: database.write_stability_specification(value) except: pass
def init_action(self): self.accept_inputs() self.parameters = { lifting_surface: { str(self.text): { design_type: self.design_type_, surface_type: self.surface_type_, root_le_position_x: float(self.Wing_postion_x_text.text()), root_le_position_y: float(self.Wing_postion_y_text.text()), root_le_position_z: float(self.Wing_postion_z_text.text()), span: float(self.span_text.text()), profile: str(self.wing_profile_selection), chord: float(self.chord_length_text.text()), taper_ratio: float(self.taper_ratio_text.text()), sweep: float(self.sweep_angle_text.text()), dihedral: float(self.dihedral_angle_text.text()), twist: float(self.twist_angle_text.text()), } } } try: print(self.parameters) database.update_aircraft_specifications( key=lifting_surface, value=self.parameters[lifting_surface]) except: database.write_aircraft_specification(self.parameters) return self.parameters
def set_maximum_takeoff_weight(value=0.0): data = database.read_structures_specifications() try: data[maximum_takeoff_weight] = value database.write_aircraft_specification(data) except Exception as e: logging.error(e) data.update({maximum_takeoff_weight: value}) database.write_structures_specification(data)
def set_mass_of_fuselage(value=0.0): data = database.read_structures_specifications() try: data[mass_of_fuselage] = value database.write_aircraft_specification(data) except Exception as e: logging.error(e) data.update({mass_of_fuselage: value}) database.write_structures_specification(data)
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)
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 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 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 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 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)
def init_action(self): self.parameters = { control_surface: { self.name: { root_le_position_x: float(self.vtp_position_x_text.text()), root_le_position_y: float(self.vtp_position_y_text.text()), root_le_position_z: float(self.Wing_postion_z_text.text()), parent_: self.selection_ if self.selection_ is not None else read_lifting_surface_objects()[ self.itemsComboBox.currentIndex()], span: float(self.span_text.text()), rotation_x: float(self.rotation_x_text.text()), rotation_y: float(self.rotation_y_text.text()), rotation_z: float(self.rotation_z_text.text()), chord: float(self.chord_length_text.text()), } } } try: database.update_aircraft_specifications( key=control_surface, value=self.parameters[control_surface]) except: database.write_aircraft_specification(self.parameters) write_control_surface_objects(value=self.name) write_control_surface_to_objects( surface_name=self.name, parent__=self.selection_ if self.selection_ is not None else read_lifting_surface_objects()[self.itemsComboBox.currentIndex()]) return self.parameters
def init_action(self): if self.landing_gear_type.text() == "c" or self.landing_gear_type.text( ) == "t": self.parameters = { landing_gear: { landing_gear_type: self.landing_gear_type.text(), struct_length_main_gear: float(self.struct_length_main_gear.text()), struct_length_aux: float(self.struct_length_aux.text()), tire_diameter: float(self.tire_diameter_text.text()), wheel_diameter: float(self.wheel_diameter_text.text()), aux_gear_position_x: float(self.aux_gear_position_x_text.text()), aux_gear_position_y: float(self.aux_gear_position_y_text.text()), aux_gear_position_z: float(self.aux_gear_position_z_text.text()), rol_gear_position_x: float(self.rol_gear_position_x_text.text()), rol_gear_position_y: float(self.rol_gear_position_y_text.text()), rol_gear_position_z: float(self.rol_gear_position_z_text.text()) } } try: database.update_aircraft_specifications( key=landing_gear, value=self.parameters[landing_gear]) except: database.write_aircraft_specification(self.parameters) return self.parameters else: raise AttributeError("You cannot add instance attributes to %s" % self)
def init_action(self): self.accept_inputs() self.parameters = { boom: { self._name: { design_type: self.design_type_, boom_type: self.boom_type_, boom_length: float( get_fuselage_length([ float(self.nose_length_text.text()), float(self.section_1_length_text.text()), float(self.section_2_length_text.text()), float(self.section_3_length_text.text()), float(self.tail_length_text.text()) ])), boom_diameter: float( get_diameter([ float(self.nose_width_text.text()), float(self.section_1_width_text.text()), float(self.section_2_width_text.text()), float(self.section_3_width_text.text()), float(self.tail_width_text.text()), float(self.tip_width_text.text()) ])), nose_width: float(self.nose_width_text.text()), nose_height: float(self.nose_height_text.text()), nose_profile: str(self.nose_profile_selection), nose_length: float(self.nose_length_text.text()), nose_position_z: float(self.nose_position_z_text.text()), nose_tip_position: float(self.nose_tip_position_text.text()), design_cockpit: self.cockpitCheckMark, xy_mirror: self.xy_mirror_, xz_mirror: self.xz_mirror_, yz_mirror: self.yz_mirror_, root_position_x: float(self.root_le_position_x_text.text()), root_position_y: float(self.root_le_position_y_text.text()), root_position_z: float(self.root_le_position_z_text.text()), section_1_length: float(self.section_1_length_text.text()), section_1_width: float(self.section_1_width_text.text()), section_1_height: float(self.section_1_height_text.text()), section_1_profile: str(self.section_1_profile_selection), section_1_position_z: float(self.section_1_position_z_text.text()), section_2_length: float(self.section_2_length_text.text()), section_2_width: float(self.section_2_width_text.text()), section_2_height: float(self.section_2_height_text.text()), section_2_profile: str(self.section_2_profile_selection), section_2_position_z: float(self.section_2_position_z_text.text()), section_3_length: float(self.section_3_length_text.text()), section_3_width: float(self.section_3_width_text.text()), section_3_height: float(self.section_3_height_text.text()), section_3_profile: str(self.section_3_profile_selection), section_3_position_z: float(self.section_3_position_z_text.text()), tip_width: float(self.tip_width_text.text()), tip_height: float(self.tip_height_text.text()), tail_profile: str(self.tail_profile_selection), tail_tip_position: float(self.tail_tip_position_text.text()), tail_length: float(self.tail_length_text.text()), tail_width: float(self.tail_width_text.text()), tail_height: float(self.tail_height_text.text()), tail_position_z: float(self.tail_position_z_text.text()), } } } if self.cockpitCheckMark == True: self.parameters[boom][self._name].update({ cockpit_height: float(self.cockpit_height_text.text()), cockpit_width: float(self.cockpit_width_text.text()), cockpit_length: float(self.cockpit_length_text.text()), cockpit_position_x: float(self.cockpit_position_x_text.text()), cockpit_position_y: float(self.cockpit_position_y_text.text()), cockpit_position_z: float(self.cockpit_position_z_text.text()), }) else: self.parameters[boom][self._name].update({ cockpit_height: float(0), cockpit_width: float(0), cockpit_length: float(0), cockpit_position_x: float(0), cockpit_position_y: float(0), cockpit_position_z: float(0), }) try: database.update_aircraft_specifications( key=boom, value=self.parameters[boom]) except: database.write_aircraft_specification(self.parameters) return self.parameters
def init_action(self): self.parameters = { boom: { self.text: { design_type: self.design_type_, boom_type: self.boom_type_, fuselage_length: float( get_fuselage_length([ float(self.nose_length_text.text()), float(self.section_1_length_text.text()), float(self.section_2_length_text.text()), float(self.section_3_length_text.text()), float(self.tail_length_text.text()) ])), fuselage_diameter: float( get_diameter([ float(self.nose_radius_text.text()), float(self.section_1_radius_text.text()), float(self.section_2_radius_text.text()), float(self.section_3_radius_text.text()), float(self.tail_radius_text.text()), float(self.tip_radius_text.text()) ])), nose_width: float(self.nose_radius_text.text()), nose_length: float(self.nose_length_text.text()), nose_position_z: float(self.nose_position_z_text.text()), nose_tip_position: float(self.nose_tip_position_text.text()), design_cockpit: self.cockpitCheckMark, section_1_length: float(self.section_1_length_text.text()), section_1_width: float(self.section_1_radius_text.text()), section_1_position_z: float(self.section_1_position_z_text.text()), section_2_length: float(self.section_2_length_text.text()), section_2_width: float(self.section_2_radius_text.text()), section_2_position_z: float(self.section_2_position_z_text.text()), section_3_length: float(self.section_3_length_text.text()), section_3_width: float(self.section_3_radius_text.text()), section_3_position_z: float(self.section_3_position_z_text.text()), tip_width: float(self.tip_radius_text.text()), tail_tip_position: float(self.tail_tip_position_text.text()), tail_length: float(self.tail_length_text.text()), tail_width: float(self.tail_radius_text.text()), tail_position_z: float(self.tail_position_z_text.text()), } } } if self.cockpitCheckMark == True: self.parameters[boom][self.text].update({ cockpit_height: float(self.cockpit_height_text.text()), cockpit_width: float(self.cockpit_width_text.text()), cockpit_length: float(self.cockpit_length_text.text()), cockpit_position_x: float(self.cockpit_position_x_text.text()), cockpit_position_y: float(self.cockpit_position_y_text.text()), cockpit_position_z: float(self.cockpit_position_z_text.text()), }) else: self.parameters[boom][self.text].update({ cockpit_height: float(0), cockpit_width: float(0), cockpit_length: float(0), cockpit_position_x: float(0), cockpit_position_y: float(0), cockpit_position_z: float(0), }) try: database.update_aircraft_specifications( key=boom, value=self.parameters[boom]) except: database.write_aircraft_specification(self.parameters) return self.parameters
def init_action(self): self.accept_inputs() self.parameters = { lifting_surface: { str(self._name): { design_type: self.design_type_, surface_type: self.surface_type_, root_le_position_x: float(self.root_le_position_x_text.text()), root_le_position_y: float(self.root_le_position_y_text.text()), root_le_position_z: float(self.root_le_position_z_text.text()), xy_mirror: self.xy_mirror_, xz_mirror: self.xz_mirror_, yz_mirror: self.yz_mirror_, profile: str(self.wing_profile_selection), surface_curve_type: self.surface_curve_type_, rotation_x: float(self.rotation_x_text.text()), rotation_y: float(self.rotation_y_text.text()), rotation_z: float(self.rotation_z_text.text()), section_1_x: float(self.section_1_x_text.text()), section_1_y: float(self.section_1_y_text.text()), section_1_z: float(self.section_1_z_text.text()), section_1_chord: float(self.section_1_chord_text.text()), section_1_twist_angle: float(self.section_1_twist_angle_text.text()), section_2_x: float(self.section_2_x_text.text()), section_2_y: float(self.section_2_y_text.text()), section_2_z: float(self.section_2_z_text.text()), section_2_chord: float(self.section_2_chord_text.text()), section_2_twist_angle: float(self.section_2_twist_angle_text.text()), section_3_x: float(self.section_3_x_text.text()), section_3_y: float(self.section_3_y_text.text()), section_3_z: float(self.section_3_z_text.text()), section_3_chord: float(self.section_3_chord_text.text()), section_3_twist_angle: float(self.section_3_twist_angle_text.text()), section_4_x: float(self.section_4_x_text.text()), section_4_y: float(self.section_4_y_text.text()), section_4_z: float(self.section_4_z_text.text()), section_4_chord: float(self.section_4_chord_text.text()), section_4_twist_angle: float(self.section_4_twist_angle_text.text()), section_5_x: float(self.section_5_x_text.text()), section_5_y: float(self.section_5_y_text.text()), section_5_z: float(self.section_5_z_text.text()), section_5_chord: float(self.section_5_chord_text.text()), section_5_twist_angle: float(self.section_5_twist_angle_text.text()), } } } try: database.update_aircraft_specifications( key=lifting_surface, value=self.parameters[lifting_surface]) except: database.write_aircraft_specification(self.parameters) return self.parameters