def thrustpowerReq_compute(self): try: thrReq = acalculate() cd = acalculate() k = acalculate() k = k.kFactor(wingspan=float(wingspan.text()), wingarea=float(wingarea.text()), oef=float(oef_db.value())) cl = acalculate() cl = cl.liftcoefficient_C(v=float(thrustpowerReq_vel.text()), weight=float(weight.text()), wingarea=float(wingarea.text()), rho=float(rho.text())) cd = cd.dragcoefficient(cd0=float(cd0.text()), k=k, cl= cl) thrReq = thrReq.thrustReq_C(v=float(thrustpowerReq_vel.text()), wingarea=float(wingarea.text()), rho=float(rho.text()), cd=cd) thrustReq_edit.setText(""" <html> <head/> <body> <p><span style=" font-size:14pt; color:#3465a4;">{0:.1f} N</span></p> </body> </html>""".format(thrReq)) powReq = acalculate() powReq = powReq.powerReq_C(v=float(thrustpowerReq_vel.text()), wingarea=float(wingarea.text()), rho=float(rho.text()), cd=cd) powerReq_edit.setText(""" <html> <head/> <body> <p><span style=" font-size:14pt; color:#3465a4;">{0:.1f} W</span></p> </body> </html>""".format(powReq)) except (ValueError, ZeroDivisionError) as error: if len(error.args) > 0 and error.args[0] == 'could not convert string to float: ': self.showValueError() else: self.showZeroDivisionError()
def toandLandingData_compute(self): try: todistance = acalculate() todistance = todistance.takeoffDistance(weight=float(weight.text()), wingspan=float(wingspan.text()), wingarea=float(wingarea.text()), rho=float(rho.text()), cd0=float(cd0.text()), rfriction_coef=float(rfc.text()), availthrust=float(avthr.text()), max_cl=float(maxcl_db.value()), oef=float(oef_db.value())) toDist_edit.setText(""" <html> <head/> <body> <p><span style=" font-size:14pt; color:#3465a4;">{0:.1f} m</span></p> </body> </html>""".format(todistance)) tospeed = acalculate() tospeed = tospeed.takeoffSpeed(weight=float(weight.text()), wingarea=float(wingarea.text()), rho=float(rho.text()), max_cl=float(maxcl_db.value())) toSpeed_edit.setText(""" <html> <head/> <body> <p><span style=" font-size:14pt; color:#3465a4;">{0:.1f} m/s</span></p> </body> </html>""".format(tospeed)) landingdistance = acalculate() landingdistance = landingdistance.landingDistance(weight=float(weight.text()), wingspan=float(wingspan.text()), wingarea=float(wingarea.text()), rho=float(rho.text()), cd0=float(cd0.text()), rfriction_coef=float(rfc.text()), max_cl=float(maxcl_db.value())) landingDist_edit.setText(""" <html> <head/> <body> <p><span style=" font-size:14pt; color:#3465a4;">{0:.1f} m</span></p> </body> </html>""".format(landingdistance)) landingspeed = acalculate() landingspeed = landingspeed.landingSpeed(weight=float(weight.text()), wingarea=float(wingarea.text()), rho=float(rho.text()), max_cl=float(maxcl_db.value())) landingSpeed_edit.setText(""" <html> <head/> <body> <p><span style=" font-size:14pt; color:#3465a4;">{0:.1f} m/s</span></p> </body> </html>""".format(landingspeed)) except (ValueError, ZeroDivisionError) as error: if len(error.args) > 0 and error.args[0] == 'could not convert string to float: ': self.showValueError() else: self.showZeroDivisionError()
def apply(self): cl = acalculate() cl = cl.liftcoefficient(float(cl_minv_edit.text()), float(cl_maxv_edit.text()), self.weight, self.wingarea, self.rho) if cl_exportdata_checkbox.isChecked(): cl_export_xlsx = aeroexport() cl_export_xlsx.clvsVelocity(cl, np.arange(float(cl_minv_edit.text()), float(cl_maxv_edit.text()), 0.1)) cl_info_msg = QtWidgets.QMessageBox() cl_info_msg.setIcon(QtWidgets.QMessageBox.Information) cl_info_msg.setText("All data have been exported inside 'XLSX Workbooks' folder.") cl_info_msg.setWindowTitle("DATA HAVE BEEN EXPORTED SUCCESSFULLY") cl_info_msg.setStyleSheet("QMessageBox {font: 12pt Ubuntu}") cl_button = cl_info_msg.addButton(QtWidgets.QMessageBox.Ok) cl_button.setIcon(QtGui.QIcon("icons/check.png")) cl_button.setFixedSize(75, 35) cl_button.setStyleSheet("QPushButton {font: 10pt Ubuntu}") cl_info_msg.setDefaultButton(cl_button) cl_info_msg.exec_() else: pass plotcl_velocity = agplot() plotcl_velocity.clvsvelocity(cl, float(cl_minv_edit.text()), float(cl_maxv_edit.text()), 0.1, colors.get(cl_linecolor_combo.currentText()), int(cl_lineweight_spin.value()), True) cl_minv_edit.clear() cl_maxv_edit.clear() self.close()
def apply(self): avthr_k = acalculate() avthr_oef = acalculate() avthr_cd = acalculate() avthr_cl = acalculate() avthr_cd = avthr_cd.dragcoefficient(self.cd0, avthr_k.kFactor(self.wingspan, self.wingarea, avthr_oef.oef_estimate(self.wingspan, self.wingarea)), avthr_cl.liftcoefficient(float(avthr_minv_edit.text()), float(avthr_maxv_edit.text()), self.weight, self.wingarea, self.rho)) avthr_thrustReq = acalculate() avthr_thrustReq = avthr_thrustReq.thrustReq(float(avthr_minv_edit.text()), float(avthr_maxv_edit.text()), self.wingarea, self.rho, avthr_cd, 0.1) plotthr_vel = agplot() plotthr_vel.thrustavailablevsthrustrequired(float(avthr_availablethr_edit.text()), avthr_thrustReq, float(avthr_minv_edit.text()), float(avthr_maxv_edit.text()), 0.1, colors.get(avthr_firstlinecolor_combo.currentText()), colors.get(avthr_secondlinecolor_combo.currentText()), int(avthr_lineweight_spin.value()), True) avthr_minv_edit.clear() avthr_maxv_edit.clear() self.close()
def wingLoadingandAr(): wl = acalculate() wl = wl.wingLoading(weight=float(weight.text()), wingarea=float(wingarea.text())) wingLoading_edit.setText(""" <html> <head/> <body> <p><span style=" font-size:14pt; color:#3465a4;">{0:.1f} kg/m</span> <span style=" font-size:14pt; color:#3465a4; vertical-align:super;">2</span></p> </body> </html>""".format(wl)) ar = acalculate() ar = ar.aspectRatio(wingspan=float(wingspan.text()), wingarea=float(wingarea.text())) aspectRatio_edit.setText(""" <html> <head/> <body> <p><span style=" font-size:14pt; color:#3465a4;">{0:.1f} : 1</span></p> </body> </html>""".format(ar))
def apply(self): lift2drag_k = acalculate() lift2drag_oef = acalculate() lift2drag_cd = acalculate() lift2drag_cl = acalculate() lift2drag_cd = lift2drag_cd.dragcoefficient(self.cd0, lift2drag_k.kFactor(self.wingspan, self.wingarea, lift2drag_oef.oef_estimate(self.wingspan, self.wingarea)), lift2drag_cl.liftcoefficient(float(lift2drag_minv_edit.text()), float(lift2drag_maxv_edit.text()), self.weight, self.wingarea, self.rho)) lift2drag_cl = acalculate() lift2drag_cl = lift2drag_cl.liftcoefficient(float(lift2drag_minv_edit.text()), float(lift2drag_maxv_edit.text()), self.weight, self.wingarea, self.rho) ltod = lift2drag_cd/lift2drag_cl if lift2drag_exportdata_checkbox.isChecked(): lift2drag_export_xlsx = aeroexport() lift2drag_export_xlsx.lift2dragvsVelocity(ltod, np.arange(float(lift2drag_minv_edit.text()), float(lift2drag_maxv_edit.text()))) lift2drag_info_msg = QtWidgets.QMessageBox() lift2drag_info_msg.setIcon(QtWidgets.QMessageBox.Information) lift2drag_info_msg.setText("All data have been exported inside 'XLSX Workbooks' folder.") lift2drag_info_msg.setWindowTitle("DATA HAVE BEEN EXPORTED SUCCESSFULLY") lift2drag_info_msg.setStyleSheet("QMessageBox {font: 12pt Ubuntu}") lift2drag_button = lift2drag_info_msg.addButton(QtWidgets.QMessageBox.Ok) lift2drag_button.setIcon(QtGui.QIcon("icons/check.png")) lift2drag_button.setFixedSize(75, 35) lift2drag_button.setStyleSheet("QPushButton {font: 10pt Ubuntu}") lift2drag_info_msg.setDefaultButton(lift2drag_button) lift2drag_info_msg.exec_() else: pass plotlift2drag_vel = agplot() plotlift2drag_vel.lift2dragvsvelocity(ltod, float(lift2drag_minv_edit.text()), float(lift2drag_maxv_edit.text()), 0.1, colors.get(lift2drag_linecolor_combo.currentText()), int(lift2drag_lineweight_spin.value()), True) lift2drag_minv_edit.clear() lift2drag_maxv_edit.clear() self.close()