PyQt5编写可视化程序GB/T 34986-2017 产品加速试验方法(B 5.5 湿度试验)

news2024/10/5 22:40:38

GB/T 34986-2017 产品加速试验方法(B 5.5 湿度试验)
阿伦纽斯模型-温度(Arrhenius Mode)
温度公式 AF = exp{(Ea/K)×[(1/Tu)-(1-Tt)]}
举例 AF = exp{[0.68/(8.617385×10e-5)]×[[1/(273+25)]-[1/(273+105)]]} ≈271.9518
AF 为加速因子
RHs 施加应力相对湿度值
RHu 为正常使用条件下的相对湿度值
n 湿度加速率常数介于2~3,推荐选择3
Ea 是析出故障的耗费能量,又称激活能。不同产品的激活能是不一样的。Ea一般来说,激活能的值在0.3ev~1.2ev之间;
K 是玻尔兹曼常数,其值为8.617385e-5
Tu Tu是使用条件下(非加速状态下)的温度值。此处的温度值是绝对温度值,以K(开尔文)作单位。开尔文以273计算
Tt 是测试条件下(加速状态下)的温度值。此处的温度值是绝对温度值,以K(开尔文)作单位。开尔文以273计算

一、UI

使用QT Designer软件设计出UI界面
然后使用pyuic转换成xml代码(不明白的搜一下pycharm设置pyuic,这里不赘述)
在这里插入图片描述
最终转换出的xml代码

# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'untitled.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again.  Do not edit this file unless you know what you are doing.


from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(490, 528)
        MainWindow.setMinimumSize(QtCore.QSize(490, 528))
        MainWindow.setMaximumSize(QtCore.QSize(490, 528))
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setStyleSheet("#centralwidget{background-color: qlineargradient(spread:pad, x1:0.5, y1:0.0453636, x2:0.5, y2:1, stop:0 rgba(37, 143, 152, 255), stop:1 rgba(255, 255, 255, 255));}\n"
"\n"
"")
        self.centralwidget.setObjectName("centralwidget")
        self.pushButton_5 = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_5.setGeometry(QtCore.QRect(288, 436, 121, 48))
        font = QtGui.QFont()
        font.setFamily("楷体")
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        self.pushButton_5.setFont(font)
        self.pushButton_5.setStyleSheet("QPushButton{\n"
"    max-height: 48px;\n"
"    border-top-right-radius: 20px; /*右上角圆角*/\n"
"    border-bottom-left-radius: 20px; /*左下角圆角*/\n"
"    background-color: rgba(0,110,255,150)\n"
"}\n"
"QPushButton:hover {\n"
"    background-color:qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.0005, stop:0.536723 rgba(186, 239, 250, 255), stop:1 rgba(24, 176, 182, 255));\n"
"}\n"
"QPushButton:pressed {\n"
"    border-top-right-radius: 20px; /*右上角圆角*/\n"
"    border-bottom-right-radius: 20px; /*右上角圆角*/\n"
"    border-bottom-left-radius: 20px; /*左下角圆角*/\n"
"    border-top-left-radius: 20px; /*左下角圆角*/\n"
"    background-color: #ffffff;\n"
"    font-size:15pt\n"
"}\n"
"")
        self.pushButton_5.setObjectName("pushButton_5")
        self.pushButton_6 = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_6.setGeometry(QtCore.QRect(98, 436, 121, 48))
        font = QtGui.QFont()
        font.setFamily("楷体")
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        self.pushButton_6.setFont(font)
        self.pushButton_6.setStyleSheet("QPushButton{\n"
"    max-height: 48px;\n"
"    border-top-right-radius: 20px; /*右上角圆角*/\n"
"    border-bottom-left-radius: 20px; /*左下角圆角*/\n"
"    background-color: rgba(0,110,255,150)\n"
"}\n"
"QPushButton:hover {\n"
"    background-color:qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.0005, stop:0.536723 rgba(186, 239, 250, 255), stop:1 rgba(24, 176, 182, 255));\n"
"    \n"
"}\n"
"QPushButton:pressed {\n"
"    border-top-right-radius: 20px; /*右上角圆角*/\n"
"    border-bottom-right-radius: 20px; /*右上角圆角*/\n"
"    border-bottom-left-radius: 20px; /*左下角圆角*/\n"
"    border-top-left-radius: 20px; /*左下角圆角*/\n"
"    background-color: #ffffff;\n"
"    font-size:15pt\n"
"}")
        self.pushButton_6.setAutoRepeatDelay(300)
        self.pushButton_6.setAutoDefault(False)
        self.pushButton_6.setDefault(False)
        self.pushButton_6.setObjectName("pushButton_6")
        self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit.setGeometry(QtCore.QRect(67, 62, 140, 25))
        self.lineEdit.setStyleSheet("#lineEdit{\n"
"    border-top-right-radius: 11px; /*右上角圆角*/\n"
"    border-bottom-right-radius: 11px; /*右下角圆角*/\n"
"    border-top-left-radius:11px; /*左上角圆角*/\n"
"    border-bottom-left-radius: 11px; /*左下角圆角*/\n"
"    background-color: #ebebeb;\n"
"    border:3px solid rgb(0, 0, 0);\n"
"}\n"
"/*QLineEdit:focus{\n"
"    border: 3px solid  rgb(0, 110, 255);\n"
"}*/\n"
"#lineEdit:focus{\n"
"    border: 3px solid  rgb(0, 110, 255);\n"
"}")
        self.lineEdit.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit.setCursorMoveStyle(QtCore.Qt.LogicalMoveStyle)
        self.lineEdit.setObjectName("lineEdit")
        self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_2.setGeometry(QtCore.QRect(66, 100, 140, 25))
        self.lineEdit_2.setStyleSheet("#lineEdit_2{\n"
"    border-top-right-radius: 11px; /*右上角圆角*/\n"
"    border-bottom-right-radius: 11px; /*右下角圆角*/\n"
"    border-top-left-radius:11px; /*左上角圆角*/\n"
"    border-bottom-left-radius: 11px; /*左下角圆角*/\n"
"    background-color: #ebebeb;\n"
"    border: 3px solid  rgb(0, 0, 0);\n"
"}\n"
"#lineEdit_2:focus{\n"
"    border: 3px solid  rgb(0, 110, 255);\n"
"}")
        self.lineEdit_2.setText("")
        self.lineEdit_2.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_2.setReadOnly(False)
        self.lineEdit_2.setObjectName("lineEdit_2")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(30, 60, 31, 20))
        font = QtGui.QFont()
        font.setFamily("宋体")
        font.setPointSize(-1)
        font.setBold(True)
        font.setUnderline(False)
        font.setWeight(75)
        self.label.setFont(font)
        self.label.setStyleSheet("QLabel{\n"
"    color: rgb(85, 0, 255);\n"
"    font-size: 15px;\n"
"}")
        self.label.setTextFormat(QtCore.Qt.AutoText)
        self.label.setIndent(-1)
        self.label.setObjectName("label")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setGeometry(QtCore.QRect(30, 100, 31, 16))
        font = QtGui.QFont()
        font.setFamily("宋体")
        font.setPointSize(-1)
        font.setBold(True)
        font.setWeight(75)
        self.label_2.setFont(font)
        self.label_2.setStyleSheet("QLabel{\n"
"    color: rgb(85, 0, 255);\n"
"    font-size: 15px;\n"
"}")
        self.label_2.setObjectName("label_2")
        self.label_3 = QtWidgets.QLabel(self.centralwidget)
        self.label_3.setGeometry(QtCore.QRect(214, 63, 31, 21))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(10)
        font.setBold(False)
        font.setWeight(50)
        self.label_3.setFont(font)
        self.label_3.setObjectName("label_3")
        self.label_4 = QtWidgets.QLabel(self.centralwidget)
        self.label_4.setGeometry(QtCore.QRect(214, 103, 21, 21))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(10)
        font.setBold(False)
        font.setWeight(50)
        self.label_4.setFont(font)
        self.label_4.setObjectName("label_4")
        self.lineEdit_3 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_3.setGeometry(QtCore.QRect(65, 136, 140, 25))
        self.lineEdit_3.setStyleSheet("#lineEdit_3{\n"
"    border-top-right-radius: 10px; /*右上角圆角*/\n"
"    border-bottom-right-radius: 10px; /*右下角圆角*/\n"
"    border-top-left-radius:10px; /*左上角圆角*/\n"
"    border-bottom-left-radius: 10px; /*左下角圆角*/\n"
"    background-color: #ebebeb;\n"
"    border: 3px solid  rgb(0, 0, 0);\n"
"}\n"
"#lineEdit_3:focus{\n"
"    border: 3px solid  rgb(0, 110, 255);\n"
"}")
        self.lineEdit_3.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_3.setObjectName("lineEdit_3")
        self.lineEdit_4 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_4.setGeometry(QtCore.QRect(65, 173, 140, 25))
        self.lineEdit_4.setStyleSheet("#lineEdit_4{\n"
"    border-top-right-radius: 11px; /*右上角圆角*/\n"
"    border-bottom-right-radius: 11px; /*右下角圆角*/\n"
"    border-top-left-radius:11px; /*左上角圆角*/\n"
"    border-bottom-left-radius: 11px; /*左下角圆角*/\n"
"    background-color: #ebebeb;\n"
"    border: 3px solid  rgb(0, 0, 0);\n"
"}\n"
"#lineEdit_4:focus{\n"
"    border: 3px solid  rgb(0, 110, 255);\n"
"}")
        self.lineEdit_4.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_4.setObjectName("lineEdit_4")
        self.lineEdit_5 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_5.setEnabled(False)
        self.lineEdit_5.setGeometry(QtCore.QRect(65, 210, 140, 25))
        self.lineEdit_5.setStyleSheet("#lineEdit_5{\n"
"\n"
"    border-top-right-radius: 11px; /*右上角圆角*/\n"
"    border-bottom-right-radius: 11px; /*右下角圆角*/\n"
"    border-top-left-radius:11px; /*左上角圆角*/\n"
"    border-bottom-left-radius: 11px; /*左下角圆角*/\n"
"    background-color: #bfbfbf;\n"
"    border: 3px solid  rgb(0, 0, 0);\n"
"}\n"
"#lineEdit_5:focus{\n"
"    border: 3px solid  rgb(0, 110, 255);\n"
"}")
        self.lineEdit_5.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_5.setObjectName("lineEdit_5")
        self.lineEdit_6 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_6.setGeometry(QtCore.QRect(65, 247, 140, 25))
        self.lineEdit_6.setStyleSheet("#lineEdit_6{\n"
"    border-top-right-radius: 11px; /*右上角圆角*/\n"
"    border-bottom-right-radius: 11px; /*右下角圆角*/\n"
"    border-top-left-radius:11px; /*左上角圆角*/\n"
"    border-bottom-left-radius: 11px; /*左下角圆角*/\n"
"    background-color: #ebebeb;\n"
"    border: 3px solid  rgb(0, 0, 0);\n"
"}\n"
"#lineEdit_6:focus{\n"
"    border: 3px solid  rgb(0, 110, 255);\n"
"}")
        self.lineEdit_6.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_6.setObjectName("lineEdit_6")
        self.lineEdit_7 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_7.setGeometry(QtCore.QRect(65, 284, 140, 25))
        self.lineEdit_7.setStyleSheet("#lineEdit_7{\n"
"    border-top-right-radius: 11px; /*右上角圆角*/\n"
"    border-bottom-right-radius: 11px; /*右下角圆角*/\n"
"    border-top-left-radius:11px; /*左上角圆角*/\n"
"    border-bottom-left-radius: 11px; /*左下角圆角*/\n"
"    background-color: #ebebeb;\n"
"    border: 3px solid  rgb(0, 0, 0);\n"
"}\n"
"#lineEdit_7:focus{\n"
"    border: 3px solid  rgb(0, 110, 255);\n"
"}")
        self.lineEdit_7.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_7.setObjectName("lineEdit_7")
        self.label_5 = QtWidgets.QLabel(self.centralwidget)
        self.label_5.setGeometry(QtCore.QRect(39, 136, 16, 16))
        font = QtGui.QFont()
        font.setFamily("宋体")
        font.setPointSize(-1)
        font.setBold(True)
        font.setWeight(75)
        self.label_5.setFont(font)
        self.label_5.setStyleSheet("QLabel{\n"
"    color: rgb(85, 0, 255);\n"
"    font-size: 15px;\n"
"}")
        self.label_5.setObjectName("label_5")
        self.label_6 = QtWidgets.QLabel(self.centralwidget)
        self.label_6.setGeometry(QtCore.QRect(33, 178, 16, 16))
        font = QtGui.QFont()
        font.setFamily("宋体")
        font.setPointSize(-1)
        font.setBold(True)
        font.setWeight(75)
        self.label_6.setFont(font)
        self.label_6.setStyleSheet("QLabel{\n"
"    color: rgb(85, 0, 255);\n"
"    font-size: 15px;\n"
"}")
        self.label_6.setObjectName("label_6")
        self.label_7 = QtWidgets.QLabel(self.centralwidget)
        self.label_7.setGeometry(QtCore.QRect(37, 214, 16, 16))
        font = QtGui.QFont()
        font.setFamily("宋体")
        font.setPointSize(-1)
        font.setBold(True)
        font.setWeight(75)
        self.label_7.setFont(font)
        self.label_7.setStyleSheet("QLabel{\n"
"    color: rgb(85, 0, 255);\n"
"    font-size: 15px;\n"
"}")
        self.label_7.setObjectName("label_7")
        self.label_8 = QtWidgets.QLabel(self.centralwidget)
        self.label_8.setGeometry(QtCore.QRect(32, 249, 31, 20))
        font = QtGui.QFont()
        font.setFamily("宋体")
        font.setPointSize(-1)
        font.setBold(True)
        font.setWeight(75)
        self.label_8.setFont(font)
        self.label_8.setStyleSheet("QLabel{\n"
"    color: rgb(85, 0, 255);\n"
"    font-size: 15px;\n"
"}")
        self.label_8.setObjectName("label_8")
        self.label_9 = QtWidgets.QLabel(self.centralwidget)
        self.label_9.setGeometry(QtCore.QRect(32, 287, 31, 21))
        font = QtGui.QFont()
        font.setFamily("宋体")
        font.setPointSize(-1)
        font.setBold(True)
        font.setWeight(75)
        self.label_9.setFont(font)
        self.label_9.setStyleSheet("QLabel{\n"
"    color: rgb(85, 0, 255);\n"
"    font-size: 15px;\n"
"}")
        self.label_9.setObjectName("label_9")
        self.label_10 = QtWidgets.QLabel(self.centralwidget)
        self.label_10.setGeometry(QtCore.QRect(211, 250, 31, 21))
        self.label_10.setObjectName("label_10")
        self.label_11 = QtWidgets.QLabel(self.centralwidget)
        self.label_11.setGeometry(QtCore.QRect(211, 290, 41, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.label_11.setFont(font)
        self.label_11.setObjectName("label_11")
        self.label_12 = QtWidgets.QLabel(self.centralwidget)
        self.label_12.setGeometry(QtCore.QRect(240, 250, 231, 141))
        self.label_12.setStyleSheet("#label_12{border: 3px solid  rgb(0, 0, 0);\n"
"    border-top-right-radius: 11px; /*右上角圆角*/\n"
"    border-bottom-right-radius: 11px; /*右下角圆角*/\n"
"    border-top-left-radius:11px; /*左上角圆角*/\n"
"    border-bottom-left-radius: 11px; /*左下角圆角*/\n"
"    font-size:30pt;\n"
"}")
        self.label_12.setAlignment(QtCore.Qt.AlignCenter)
        self.label_12.setObjectName("label_12")
        self.label_13 = QtWidgets.QLabel(self.centralwidget)
        self.label_13.setGeometry(QtCore.QRect(80, 0, 331, 31))
        font = QtGui.QFont()
        font.setPointSize(14)
        font.setBold(True)
        font.setWeight(75)
        self.label_13.setFont(font)
        self.label_13.setStyleSheet("color: rgb(255, 255, 255);")
        self.label_13.setObjectName("label_13")
        self.label_14 = QtWidgets.QLabel(self.centralwidget)
        self.label_14.setGeometry(QtCore.QRect(27, 323, 31, 21))
        font = QtGui.QFont()
        font.setFamily("宋体")
        font.setPointSize(-1)
        font.setBold(True)
        font.setWeight(75)
        self.label_14.setFont(font)
        self.label_14.setStyleSheet("QLabel{\n"
"    color: rgb(85, 0, 255);\n"
"    font-size: 15px;\n"
"}")
        self.label_14.setObjectName("label_14")
        self.lineEdit_8 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_8.setGeometry(QtCore.QRect(64, 322, 140, 25))
        self.lineEdit_8.setStyleSheet("#lineEdit_8{\n"
"    border-top-right-radius: 11px; /*右上角圆角*/\n"
"    border-bottom-right-radius: 11px; /*右下角圆角*/\n"
"    border-top-left-radius:11px; /*左上角圆角*/\n"
"    border-bottom-left-radius: 11px; /*左下角圆角*/\n"
"    background-color: #ebebeb;\n"
"    border: 3px solid  rgb(0, 0, 0);\n"
"}\n"
"#lineEdit_8:focus{\n"
"    border: 3px solid  rgb(0, 110, 255);\n"
"}")
        self.lineEdit_8.setAlignment(QtCore.Qt.AlignCenter)
        self.lineEdit_8.setObjectName("lineEdit_8")
        self.label_15 = QtWidgets.QLabel(self.centralwidget)
        self.label_15.setGeometry(QtCore.QRect(212, 325, 41, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.label_15.setFont(font)
        self.label_15.setObjectName("label_15")
        self.pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton.setGeometry(QtCore.QRect(450, 0, 41, 41))
        self.pushButton.setStyleSheet("#pushButton{\n"
"    max-height: 48px;\n"
"    border-top-right-radius: 20px; /*右上角圆角*/\n"
"    border-bottom-right-radius: 20px; /*右上角圆角*/\n"
"    border-bottom-left-radius: 20px; /*左下角圆角*/\n"
"    border-top-left-radius: 20px; /*左下角圆角*/\n"
"\n"
"}\n"
"")
        self.pushButton.setText("")
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("../Downloads/下载.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.pushButton.setIcon(icon)
        self.pushButton.setIconSize(QtCore.QSize(50, 50))
        self.pushButton.setDefault(False)
        self.pushButton.setFlat(True)
        self.pushButton.setObjectName("pushButton")
        self.label_16 = QtWidgets.QLabel(self.centralwidget)
        self.label_16.setGeometry(QtCore.QRect(240, 50, 231, 191))
        font = QtGui.QFont()
        font.setPointSize(9)
        font.setBold(False)
        font.setWeight(50)
        self.label_16.setFont(font)
        self.label_16.setStyleSheet("#label_16{\n"
"    color: rgb(255, 255, 255);\n"
"    border: 1px solid  rgb(255,255, 255);\n"
"    border-top-right-radius: 11px; /*右上角圆角*/\n"
"    border-bottom-right-radius: 11px; /*右下角圆角*/\n"
"    border-top-left-radius:11px; /*左上角圆角*/\n"
"    border-bottom-left-radius: 11px; /*左下角圆角*/\n"
"}")
        self.label_16.setObjectName("label_16")
        self.checkBox = QtWidgets.QCheckBox(self.centralwidget)
        self.checkBox.setGeometry(QtCore.QRect(60, 370, 71, 16))
        self.checkBox.setObjectName("checkBox")
        self.checkBox_2 = QtWidgets.QCheckBox(self.centralwidget)
        self.checkBox_2.setGeometry(QtCore.QRect(150, 370, 71, 16))
        self.checkBox_2.setObjectName("checkBox_2")
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "GB/T34986-2017 B5.5温度试验计算"))
        self.pushButton_5.setText(_translate("MainWindow", "清空"))
        self.pushButton_6.setText(_translate("MainWindow", "结果"))
        self.lineEdit.setPlaceholderText(_translate("MainWindow", "测试湿度"))
        self.lineEdit_2.setPlaceholderText(_translate("MainWindow", "使用湿度"))
        self.label.setText(_translate("MainWindow", "RHs"))
        self.label_2.setText(_translate("MainWindow", "RHu"))
        self.label_3.setText(_translate("MainWindow", "%"))
        self.label_4.setText(_translate("MainWindow", "%"))
        self.lineEdit_3.setPlaceholderText(_translate("MainWindow", "湿度加速率(2~3)"))
        self.lineEdit_4.setPlaceholderText(_translate("MainWindow", "激活能(0.3~1.2eV)"))
        self.lineEdit_5.setPlaceholderText(_translate("MainWindow", "玻尔兹曼常数"))
        self.lineEdit_6.setPlaceholderText(_translate("MainWindow", "使用温度"))
        self.lineEdit_7.setPlaceholderText(_translate("MainWindow", "测试温度"))
        self.label_5.setText(_translate("MainWindow", "n"))
        self.label_6.setText(_translate("MainWindow", "Ea"))
        self.label_7.setText(_translate("MainWindow", "K"))
        self.label_8.setText(_translate("MainWindow", "Tu"))
        self.label_9.setText(_translate("MainWindow", "Tt"))
        self.label_10.setText(_translate("MainWindow", "℃"))
        self.label_11.setText(_translate("MainWindow", "℃"))
        self.label_12.setText(_translate("MainWindow", "结果"))
        self.label_13.setText(_translate("MainWindow", "GB/T34986-2017 B5.5温度试验计算"))
        self.label_14.setText(_translate("MainWindow", "Day"))
        self.lineEdit_8.setPlaceholderText(_translate("MainWindow", "正常使用期限"))
        self.label_15.setText(_translate("MainWindow", "天"))
        self.label_16.setText(_translate("MainWindow", "RHs 施加应力相对湿度值\n"
"-------------------------------------\n"
"RHu 正常使用时的湿度值\n"
"-------------------------------------\n"
"n   湿度加速率常数介于2~3,推荐选择3\n"
"-------------------------------------\n"
"Ea  激活能,其值在0.3ev~1.2ev之间\n"
"-------------------------------------\n"
"K   玻尔兹曼常数,为8.617385e-5\n"
"-------------------------------------\n"
"Tu  正常使用的温度值。\n"
"-------------------------------------\n"
"Tt  测试的温度值。"))
        self.checkBox.setText(_translate("MainWindow", "K值输入"))
        self.checkBox_2.setText(_translate("MainWindow", "保守计算"))

二、编写python调用界面并计算的代码

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Time : 2023/8/10 10:54
# Author : kevin
# User : VINNO-Van
# Software: PyCharm
# File : 加速老化试验.py

# class Arrhenius_Mode():
#     # GB/T 34986-2017 产品加速试验方法(B 5.5 湿度试验)
#     # 阿伦纽斯模型-温度(Arrhenius Mode)
#     # 温度公式 AF = exp{(Ea/K)×[(1/Tu)-(1-Tt)]}
#     # 举例 AF = exp{[0.68/(8.617385×10e-5)]×[[1/(273+25)]-[1/(273+105)]]} ≈271.9518
#     # AF 为加速因子
#     # RHs 施加应力相对湿度值
#     # RHu 为正常使用条件下的相对湿度值
#     # n 湿度加速率常数介于2~3,推荐选择3
#     # Ea 是析出故障的耗费能量,又称激活能。不同产品的激活能是不一样的。Ea一般来说,激活能的值在0.3ev~1.2ev之间;
#     # K 是玻尔兹曼常数,其值为8.617385e-5
#     # Tu Tu是使用条件下(非加速状态下)的温度值。此处的温度值是绝对温度值,以K(开尔文)作单位。开尔文以273计算
#     # Tt 是测试条件下(加速状态下)的温度值。此处的温度值是绝对温度值,以K(开尔文)作单位。开尔文以273计算
#     # AF, Ea, K, Tu, Tt = None, None, None, None, None
#     def Arrhenius(self, RHs, RHu, n, Ea, K, Tu, Tt):
#         # print('%.100f' % K)
#         global AF
#         Tu, Tt = Tu+273, Tt+273
#         AF = ((RHs/RHu) ** n) * math.exp((Ea/float(format(K, '.10f')))*((1/Tu)-(1/Tt)))
#         print('加速老化倍率为:%s 倍' % AF)
#         return AF
#     def Arrhenius_h(self):
#         hour = AF * 24
#         print('加速老化时间为:%s 小时' % hour)
#
#
#
# # Ea, K, Tu, Tt  = 0.68, 8.617385e-5, 25+273, 105+273  # '%.10f'
# a = Arrhenius_Mode()
# a.Arrhenius(95, 70, 3, 0.6, 8.617385e-5, 25, 50)
# a.Arrhenius_h()

import math
import sys, os
from PyQt5.QtGui import (QIcon)
from PyQt5.QtWidgets import *
from PyQt5.QtWidgets import QMessageBox
from PyQt5.QtGui import QDoubleValidator
from untitled import Ui_MainWindow
os.environ["QT_FONT_DPI"] = "96"  # FIX Problem for High DPI and Scale above 100% 修复高DPI和比例超过100%的问题

class Arrhenius_Mode():
    def Arrhenius(self, RHs, RHu, n, Ea, K, Tu, Tt):
        # print('%.100f' % K)
        global AF
        Tu, Tt = Tu+273, Tt+273
        AF = ((RHs/RHu) ** n) * math.exp((Ea/float(format(K, '.10f')))*((1/Tu)-(1/Tt)))
        print('加速老化倍率为:%s 倍' % AF)
        return AF
    def Arrhenius_h(self, Day):
        global test_Day
        test_Day = Day/AF
        hour = test_Day*24
        print('加速老化时间为:%s 小时' % hour)
        return test_Day



class MainWindow(QMainWindow, Arrhenius_Mode):
    def __init__(self):
        QMainWindow.__init__(self)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.ui.retranslateUi(self)
        self.data_judge()  # 数值输入限制
        self.ui.pushButton_6.clicked.connect(lambda: self.input_value())  # 结果按钮
        self.ui.pushButton_5.clicked.connect(lambda: self.end_value())  # 清除按钮
        self.ui.checkBox.clicked.connect(lambda: self.checkbox_enable())
        self.ui.checkBox_2.clicked.connect(lambda: self.checkbox_2enable())

    def checkbox_enable(self):
        global K
        # 当K值输入被勾选时
        if self.ui.checkBox.isChecked() == True:
            self.ui.lineEdit_5.setStyleSheet("#lineEdit_5{\n"
                                            "\n"
                                            "    border-top-right-radius: 11px; /*右上角圆角*/\n"
                                            "    border-bottom-right-radius: 11px; /*右下角圆角*/\n"
                                            "    border-top-left-radius:11px; /*左上角圆角*/\n"
                                            "    border-bottom-left-radius: 11px; /*左下角圆角*/\n"
                                            "    background-color: #ebebeb;\n"
                                            "    border: 3px solid  rgb(0, 0, 0);\n"
                                            "}\n"
                                            "#lineEdit_5:focus{\n"
                                            "    border: 3px solid  rgb(0, 110, 255);\n"
                                            "}")
            self.ui.lineEdit_5.setEnabled(True)
            K = self.ui.lineEdit_5.text()
            return K
        else:  # 当K值输入未被勾选时

            self.ui.lineEdit_5.setStyleSheet("#lineEdit_5{\n"
                                            "\n"
                                            "    border-top-right-radius: 11px; /*右上角圆角*/\n"
                                            "    border-bottom-right-radius: 11px; /*右下角圆角*/\n"
                                            "    border-top-left-radius:11px; /*左上角圆角*/\n"
                                            "    border-bottom-left-radius: 11px; /*左下角圆角*/\n"
                                            "    background-color: #bfbfbf;\n"
                                            "    border: 3px solid  rgb(0, 0, 0);\n"
                                            "}\n"
                                            "#lineEdit_5:focus{\n"
                                            "    border: 3px solid  rgb(0, 110, 255);\n"
                                            "}")
            self.ui.lineEdit_5.clear()
            self.ui.lineEdit_5.setEnabled(False)
            K = "8.617385e-5"
            return K

    def checkbox_2enable(self):
        if self.ui.checkBox_2.isChecked() == True:
            global n, Ea
            self.ui.lineEdit_3.setText('2')
            n = '2'
            self.ui.lineEdit_4.setText('0.3')
            Ea = '0.3'

        else:
            self.ui.lineEdit_3.clear()
            self.ui.lineEdit_4.clear()

    # 数值输入限制,防止输入错误
    def data_judge(self):
		# 这里应该写个函数进行调用,为了直观就复写了几次
        # 浮点输入限制(RHs,RHu)
        doubleValidator = QDoubleValidator()
        doubleValidator.setRange(0, 100)
        doubleValidator.setNotation(QDoubleValidator.StandardNotation)
        doubleValidator.setDecimals(5)  # 设置浮点精度为10位

        # 浮点输入限制(n)
        doubleValidator1 = QDoubleValidator()
        doubleValidator1.setRange(2, 3)
        doubleValidator1.setNotation(QDoubleValidator.StandardNotation)
        doubleValidator1.setDecimals(5)  # 设置浮点精度为10位

        # 浮点输入限制(Ea)
        doubleValidator2 = QDoubleValidator()
        doubleValidator2.setRange(0, 2)
        doubleValidator2.setNotation(QDoubleValidator.StandardNotation)
        doubleValidator2.setDecimals(5)  # 设置浮点精度为10位

        # 浮点输入限制(K)
        doubleValidator3 = QDoubleValidator()
        doubleValidator3.setRange(0, 1.2)
        doubleValidator3.setNotation(QDoubleValidator.StandardNotation)
        doubleValidator3.setDecimals(30)  # 设置浮点精度为10位

        # 浮点输入限制(Tu,Tt, Day)
        doubleValidator4 = QDoubleValidator()
        doubleValidator4.setRange(0, 36500)
        doubleValidator4.setNotation(QDoubleValidator.StandardNotation)
        doubleValidator4.setDecimals(5)  # 设置浮点精度为10位

        self.ui.lineEdit.setValidator(doubleValidator)
        self.ui.lineEdit_2.setValidator(doubleValidator)
        self.ui.lineEdit_3.setValidator(doubleValidator1)
        self.ui.lineEdit_4.setValidator(doubleValidator2)
        self.ui.lineEdit_5.setValidator(doubleValidator3)
        self.ui.lineEdit_6.setValidator(doubleValidator4)
        self.ui.lineEdit_7.setValidator(doubleValidator4)
        self.ui.lineEdit_8.setValidator(doubleValidator4)


    def input_value(self):
        global K
        RHs = self.ui.lineEdit.text()
        RHu = self.ui.lineEdit_2.text()
        n = self.ui.lineEdit_3.text()
        Ea = self.ui.lineEdit_4.text()
        Tu = self.ui.lineEdit_6.text()
        Tt = self.ui.lineEdit_7.text()
        Day = self.ui.lineEdit_8.text()
        K = self.checkbox_enable()
        # 判断非空输入
        if RHs != '' and RHu != '' and n != '' and Ea != '' and K != '' and Tu != '' and Tt != '' and Day != '':
            RHs = float(self.ui.lineEdit.text())
            RHu = float(self.ui.lineEdit_2.text())
            n = float(self.ui.lineEdit_3.text())
            Ea = float(self.ui.lineEdit_4.text())
            print(self.ui.lineEdit_5.text(), type(self.ui.lineEdit_5.text()))
            K = float(self.checkbox_enable())
            Tu = float(self.ui.lineEdit_6.text())
            Tt = float(self.ui.lineEdit_7.text())
            Day = float(self.ui.lineEdit_8.text())
            # self.Arrhenius(95, 70, 3, 0.6, 8.617385e-5, 25, 50)
            self.result_AF, self.result_test_day = self.Arrhenius(RHs, RHu, n, Ea, K, Tu, Tt), self.Arrhenius_h(Day)
            # 结果label字体设置
            self.ui.label_12.setStyleSheet("#label_12{border: 3px solid  rgb(0, 0, 0);\n"
                                        "    border-top-right-radius: 11px; /*右上角圆角*/\n"
                                        "    border-bottom-right-radius: 11px; /*右下角圆角*/\n"
                                        "    border-top-left-radius:11px; /*左上角圆角*/\n"
                                        "    border-bottom-left-radius: 11px; /*左下角圆角*/\n"
                                        "    font-size:10pt;\n"
                                        "    color:rgba(0, 80, 255);\n"
                                        "}")
            # 结果label显示
            self.ui.label_12.setText(str('加速老化倍率为:\n%s\n'
                                         '--------------------------\n'
                                         '试验天数为:\n%s 天\n'
                                         '--------------------------\n'
                                         '试验小时数为:\n%s 小时'
                                         % (self.result_AF, self.result_test_day, self.result_test_day*24)))
        else:
            # 弹窗提示数值错误
            QMessageBox.information(self, "提示", "输入值存在错误,请检查", QMessageBox.Ok)

    # 清除按钮操作
    def end_value(self):
        self.ui.lineEdit.clear()
        self.ui.lineEdit_2.clear()
        self.ui.lineEdit_3.clear()
        self.ui.lineEdit_4.clear()
        self.ui.lineEdit_5.clear()
        self.ui.lineEdit_6.clear()
        self.ui.lineEdit_7.clear()
        self.ui.lineEdit_8.clear()
        self.ui.label_12.setText("结果")
        self.ui.label_12.setStyleSheet("#label_12{border: 3px solid  rgb(0, 0, 0);\n"
                                    "    border-top-right-radius: 11px; /*右上角圆角*/\n"
                                    "    border-bottom-right-radius: 11px; /*右下角圆角*/\n"
                                    "    border-top-left-radius:11px; /*左上角圆角*/\n"
                                    "    border-bottom-left-radius: 11px; /*左下角圆角*/\n"
                                    "    font-size:30pt;\n"
                                    "}")


if __name__ == "__main__":
    app = QApplication(sys.argv)
    app.setWindowIcon(QIcon("icon.ico"))
    window = MainWindow()
    window.show()
    sys.exit(app.exec_())

三、打包python程序

找到python程序所在文件夹
鼠标右键点击后选择,“在终端打开”
在这里插入图片描述
在命令窗口输入
pyinstaller -D -w Arrhenius.py 然后回车
等待软件打包完成
打包完成提示Building COLLECT COLLECT-00.toc completed successfully.,如下图
在这里插入图片描述
此时文件夹中会多两个文件夹
打开dist,找到Arrhenius.exe文件,双击运行看是否能够正常运行
在这里插入图片描述
在这里插入图片描述

四、打包成绿色版

使用Greenone程序对Arrhenius.exe文件进行打包
打包完成后,会有个图标单文件可执行程序,双击即可单文件进行运行。(其实是所有运行依赖文件被Greenone打包成压缩包变成了可执行压缩程序,运行时系统会先解压在运行,但是用户无感知)
在这里插入图片描述
最终运行界面
在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/887223.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

CentOS系统环境搭建(十五)——CentOS安装Kibana

centos系统环境搭建专栏🔗点击跳转 关于Elasticsearch的安装请看CentOS系统环境搭建(十二)——CentOS7安装Elasticsearch。 CentOS安装Kibana 1.下载 🔗https://www.elastic.co/downloads/past-releases/kibana-7-17-12 若你是…

【Rust】Rust学习 第十四章进一步认识 Cargo 和 Crates.io

本章会讨论 Cargo 其他一些更为高级的功能,我们将展示如何: 使用发布配置来自定义构建将库发布到 crates.io使用工作空间来组织更大的项目从 crates.io 安装二进制文件使用自定义的命令来扩展 Cargo Cargo 的功能不止本章所介绍的,关于其全…

音视频学习-音视频基础

文章目录 一、 音视频录制原理二、音视频播放原理三、图像基础概念1.像素2.分辨率3.位深4.帧率5.码率6.Stride跨距 四、RGB、YUV1.RGB2.YUV1. 4:4:4格式2. 4:2:2格式3. 4:2:0格式4. 4:2:0数据格式对比 3.RGB和YUV的转换4.YUV Stride对齐问题 五、视频的主要概念1.基本概念2.I P…

python控制obs实现无缝切换场景!obs-websocket-py

前言 最近一直在研究孪生数字人wav2lip。目前成果可直接输入高清嘴型,2070显卡1分钟音频2.6分钟输出。在直播逻辑上可以做到1比1.3这样,所以现在开始研究直播。在逻辑上涉及到了无缝切换,看到csdn上有一篇文章还要vip解锁。。。那自己研究吧…

C# API 文档注释规范

C# API 文档注释规范 1. 命名空间注释(namespace)2. summary3. remarks and para4. param5. returns6. example and code7. exception8. typeparam 最近在开发工作中需要实现 API 帮助文档,如果根据所写的代码直接重写 API 帮助文档将会是意见非常大的工作量&#x…

Linux:shell函数

目录 一、基本格式 二、查看函数 三、删除函数 四、函数的返回值 五、函数的传参数 六、函数的作用范围 ​七、函数的递归 在编写脚本时,有些脚本可以反复使用,可以调用函数来解决 语句块定义成函数约等于别名 函数使用方法: 定义函…

ZooKeeper的应用场景(集群管理、Master选举)

5 集群管理 随着分布式系统规模的日益扩大,集群中的机器规模也随之变大,因此,如何更好地进行集群管理也显得越来越重要了。 所谓集群管理,包括集群监控与集群控制两大块,前者侧重对集群运行时状态的收集,后…

LabVIEW开发商用罗非鱼池水质控制系统设计

LabVIEW开发商用罗非鱼池水质控制系统设计 养鱼是一种水产养殖形式,其中鱼类在围栏内养殖,作为食物出售。这些围栏栖息地用于养殖全球大约一半的鱼类消费。罗非鱼是一种适合食品生产和经营的鱼类,因为它们能够快速繁殖。然而,为了…

【苹果Imessage推信软件】在服务器端,您可以保存设备令牌,并将其用于向特定设备发送推送通知

推荐内容IMESSGAE相关 作者✈️IMEAE推荐内容iMessage苹果推软件 *** 点击即可查看作者要求内容信息作者✈️IMEAE推荐内容1.家庭推内容 *** 点击即可查看作者要求内容信息作者✈️IMEAE推荐内容2.相册推 *** 点击即可查看作者要求内容信息作者✈️IMEAE推荐内容3.日历推 *** …

Linux -- 进阶 Autofs自动挂载服务 实验详解

服务端创建共享目录, 客户端实现自动挂载 第一步 : 客户端,服务端 均关闭安全软件 [rootserver ~]# setenforce 0 [rootserver ~]# systemctl stop firewalld [rootnode1 ~]# setenforce 0 [rootnode1 ~]# systemctl stop firewalld 第二…

windows安装go,以及配置工作区,配置vscode开发环境

下载安装go 我安装在D:\go路径下配置环境变量 添加GOROOT value为D:\go修改path 添加%GOROOT%\bin添加GOPATH value为%USERPROFILE%\go 其中GOPATH 是我们自己开发的工作区,其中包含三个folder bin,pkg,以及src,其中src为我们编写代码的位置 配置vscod…

算法通关村第4关【青铜】| 栈基础

1. 栈基础 栈的特征&#xff1a; 存取受限的线性表后进先出 栈的操作&#xff1a; push()pop()peek()empty() 2.数组实现栈 限制数组的存取规则&#xff0c;实现后进先出。注意数组边界的处理 public class Stack1<T> {private Object[] stack;private int top;//…

RPA机器人《国网电力》电力行业实施案例-基层减负 提质增效

背景&#xff1a;随着国网战略目标加速落地&#xff0c;数字化转型和精益化管理深化推进&#xff0c;各供电公司亟待突破精细化管控不深入、执行标准不够统一、系统数据不够融通等制约工作质效提升的能力瓶颈&#xff0c;针对这些问题&#xff0c;决定引入诸如RPA、OCR等技术&a…

深入Redis线程模型

目录 1.前言 2.Redis为什么快&#xff1f; 3.Redis 为何选择单线程&#xff1f; 3.1可维护性 3.2并发处理 3.3性能瓶颈 4.Reactor设计模式 5.Redis4.0前 单线程模型 - Event Loop 6.Redis4.0后 多线程异步任务 7.Redis6.0后 多线程网络模型 1.前言 这篇文章我们主要围绕…

快速搭建图书商城小程序的简易流程与优势

很多人喜欢阅读电子书&#xff0c;又有很多人依旧喜欢实体书&#xff0c;而实体书店拥有一个图书商城小程序便成为了满足用户需求的理想选择。如果您也想进入这一充满潜力的领域&#xff0c;但担心开发难度和复杂流程&#xff0c;别担心&#xff01;您能做到快速搭建一个专业、…

机器学习知识点总结:什么是GBDT(梯度提升树)

什么是GBDT(梯度提升树) 虽然GBDT同样由许多决策树组成&#xff0c;但它与随机森林由许多不同。 其中之一是GBDT中的树都是回归树&#xff0c;树有分类有回归&#xff0c;区分它们的方法很简单。将苹果单纯分为好与坏的是分类树&#xff0c;如果能为苹果的好坏程度打个分&…

Azure使用CLI创建VM

使用CLI创建VM之前&#xff0c;确保资源中的IP资源已经释放掉了&#xff0c;避免创建的过程中没有可以利用的公共IP地址打开 cloudshell ,并输入创建CLI的命令如下&#xff0c;-n指定名称&#xff0c;-g指定资源组&#xff0c;image指定镜像&#xff0c;admin-usernam指定用户名…

强化学习-深度确定性策略梯度(第5章)

来源书籍&#xff1a; TENSORFLOW REINFORCEMENT LEARNING QUICK START GUIDE 《TensorFlow强化学习快速入门指南-使用Python动手搭建自学习的智能体》 著者&#xff1a;[美]考希克巴拉克里希南&#xff08;Kaushik Balakrishnan&#xff09; 译者&#xff1a;赵卫东 出版…

Prompt、RAG、微调还是重新训练?如何选择正确的生成式AI的使用方法

生成式人工智能正在快速发展&#xff0c;许多人正在尝试使用这项技术来解决他们的业务问题。一般情况下有4种常见的使用方法&#xff1a; Prompt EngineeringRetrieval Augmented Generation (RAG 检索增强生成)微调从头开始训练基础模型(FM) 本文将试图根据一些常见的可量化…

爬虫逆向实战(十八)--某得科技登录

一、数据接口分析 主页地址&#xff1a;某得科技 1、抓包 通过抓包可以发现数据接口是AjaxLogin 2、判断是否有加密参数 请求参数是否加密&#xff1f; 查看“载荷”模块可以发现有一个password加密参数和一个__RequestVerificationToken 请求头是否加密&#xff1f; 无…