Commit 76a0bb2a authored by Alisson Claudino's avatar Alisson Claudino
Browse files

ADD: Temperature Calibration Access via Main Window

parent 656ca9bf
...@@ -7,11 +7,12 @@ ...@@ -7,11 +7,12 @@
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
import sys from Process import Process
from PressCalib import PressCalib from PressCalib import PressCalib
from TempCalib import TempCalib from TempCalib import TempCalib
from Process import Process
from SystemEngine import SystemEngine from SystemEngine import SystemEngine
import sys
class Ui_MainWindow(object): class Ui_MainWindow(object):
...@@ -23,7 +24,7 @@ class Ui_MainWindow(object): ...@@ -23,7 +24,7 @@ class Ui_MainWindow(object):
self.dialog.show() self.dialog.show()
self.pressButton.pressed.connect(self.startPress) self.pressButton.pressed.connect(self.startPress)
self.tempButton.pressed.connect(self.startTemp)
def startPress(self): def startPress(self):
self.dialog.close() self.dialog.close()
...@@ -34,21 +35,28 @@ class Ui_MainWindow(object): ...@@ -34,21 +35,28 @@ class Ui_MainWindow(object):
engine = SystemEngine(0,self.ui) engine = SystemEngine(0,self.ui)
def startTemp(self):
self.dialog.close()
self.ui = TempCalib()
self.ui.setupUi(self.dialog)
self.dialog.showMaximized();
engine = SystemEngine(1,self.ui)
def setupUi(self, MainWindow): def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow") MainWindow.setObjectName("MainWindow")
MainWindow.resize(800, 600) MainWindow.resize(979, 600)
MainWindow.setStyleSheet("background-color:rgb(0, 0, 0);\n" MainWindow.setStyleSheet("background-color:rgb(0, 0, 0);\n"
"color: rgb(255,255,255);") "color: rgb(255,255,255);")
self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget") self.centralwidget.setObjectName("centralwidget")
self.label = QtWidgets.QLabel(self.centralwidget) self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(30, 130, 741, 71)) self.label.setGeometry(QtCore.QRect(30, 130, 921, 71))
self.label.setStyleSheet("background-color:rgb(0,0,0);\n" self.label.setStyleSheet("background-color:rgb(0,0,0);\n"
"font: 15pt \"Noto Serif\";") "font: 15pt \"Noto Serif\";")
self.label.setObjectName("label") self.label.setObjectName("label")
self.label_2 = QtWidgets.QLabel(self.centralwidget) self.label_2 = QtWidgets.QLabel(self.centralwidget)
self.label_2.setGeometry(QtCore.QRect(310, 30, 141, 81)) self.label_2.setGeometry(QtCore.QRect(400, 20, 171, 81))
self.label_2.setStyleSheet("background-color:rgb(0,0,0);\n" self.label_2.setStyleSheet("background-color:rgb(0,0,0);\n"
"font: 22pt \"Noto Serif\";") "font: 22pt \"Noto Serif\";")
self.label_2.setObjectName("label_2") self.label_2.setObjectName("label_2")
...@@ -58,16 +66,16 @@ class Ui_MainWindow(object): ...@@ -58,16 +66,16 @@ class Ui_MainWindow(object):
"") "")
self.pressButton.setObjectName("pressButton") self.pressButton.setObjectName("pressButton")
self.tempButton = QtWidgets.QToolButton(self.centralwidget) self.tempButton = QtWidgets.QToolButton(self.centralwidget)
self.tempButton.setGeometry(QtCore.QRect(310, 300, 181, 51)) self.tempButton.setGeometry(QtCore.QRect(390, 300, 181, 51))
self.tempButton.setStyleSheet("background-color:rgb(53, 53, 53);\n" self.tempButton.setStyleSheet("background-color:rgb(53, 53, 53);\n"
"") "")
self.tempButton.setObjectName("tempButton") self.tempButton.setObjectName("tempButton")
self.procButton = QtWidgets.QToolButton(self.centralwidget) self.procButton = QtWidgets.QToolButton(self.centralwidget)
self.procButton.setGeometry(QtCore.QRect(570, 300, 181, 51)) self.procButton.setGeometry(QtCore.QRect(740, 300, 181, 51))
self.procButton.setStyleSheet("background-color:rgb(53, 53, 53);") self.procButton.setStyleSheet("background-color:rgb(53, 53, 53);")
self.procButton.setObjectName("procButton") self.procButton.setObjectName("procButton")
self.label_3 = QtWidgets.QLabel(self.centralwidget) self.label_3 = QtWidgets.QLabel(self.centralwidget)
self.label_3.setGeometry(QtCore.QRect(40, 420, 151, 141)) self.label_3.setGeometry(QtCore.QRect(60, 420, 151, 141))
self.label_3.setStyleSheet("background-color:rgb(53, 53, 53);\n" self.label_3.setStyleSheet("background-color:rgb(53, 53, 53);\n"
"font: 15pt \"Noto Serif\";") "font: 15pt \"Noto Serif\";")
self.label_3.setText("") self.label_3.setText("")
...@@ -75,7 +83,7 @@ class Ui_MainWindow(object): ...@@ -75,7 +83,7 @@ class Ui_MainWindow(object):
self.label_3.setScaledContents(True) self.label_3.setScaledContents(True)
self.label_3.setObjectName("label_3") self.label_3.setObjectName("label_3")
self.label_4 = QtWidgets.QLabel(self.centralwidget) self.label_4 = QtWidgets.QLabel(self.centralwidget)
self.label_4.setGeometry(QtCore.QRect(590, 420, 171, 141)) self.label_4.setGeometry(QtCore.QRect(730, 420, 171, 141))
self.label_4.setStyleSheet("background-color:rgb(0,0,0);\n" self.label_4.setStyleSheet("background-color:rgb(0,0,0);\n"
"font: 15pt \"Noto Serif\";") "font: 15pt \"Noto Serif\";")
self.label_4.setText("") self.label_4.setText("")
...@@ -83,7 +91,7 @@ class Ui_MainWindow(object): ...@@ -83,7 +91,7 @@ class Ui_MainWindow(object):
self.label_4.setScaledContents(True) self.label_4.setScaledContents(True)
self.label_4.setObjectName("label_4") self.label_4.setObjectName("label_4")
self.label_5 = QtWidgets.QLabel(self.centralwidget) self.label_5 = QtWidgets.QLabel(self.centralwidget)
self.label_5.setGeometry(QtCore.QRect(260, 420, 281, 151)) self.label_5.setGeometry(QtCore.QRect(310, 420, 361, 151))
self.label_5.setStyleSheet("") self.label_5.setStyleSheet("")
self.label_5.setText("") self.label_5.setText("")
self.label_5.setPixmap(QtGui.QPixmap("Resources/LogoCTA_2015_vetorial_cor.png")) self.label_5.setPixmap(QtGui.QPixmap("Resources/LogoCTA_2015_vetorial_cor.png"))
...@@ -100,8 +108,8 @@ class Ui_MainWindow(object): ...@@ -100,8 +108,8 @@ class Ui_MainWindow(object):
def retranslateUi(self, MainWindow): def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate _translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "SADAPMAP")) MainWindow.setWindowTitle(_translate("MainWindow", "SADAPMAP"))
self.label.setText(_translate("MainWindow", " Sistema de Aquisição de Dados para Análise de Materiais em Altas Pressões")) self.label.setText(_translate("MainWindow", " Sistema de Aquisição de Dados para Análise e Processamento de Materiais em Altas Pressões"))
self.label_2.setText(_translate("MainWindow", "SADAMAP")) self.label_2.setText(_translate("MainWindow", "SADAPMAP"))
self.pressButton.setText(_translate("MainWindow", "Calibração de Pressão")) self.pressButton.setText(_translate("MainWindow", "Calibração de Pressão"))
self.tempButton.setText(_translate("MainWindow", "Calibração de Temperatura")) self.tempButton.setText(_translate("MainWindow", "Calibração de Temperatura"))
self.procButton.setText(_translate("MainWindow", "Processamento")) self.procButton.setText(_translate("MainWindow", "Processamento"))
......
...@@ -27,41 +27,42 @@ from Graph import Graph ...@@ -27,41 +27,42 @@ from Graph import Graph
class SystemEngine(object): class SystemEngine(object):
def __init__(self, interType,ui): #Construtor da classe def __init__(self, interType,ui): #Construtor da classe
self.ui = ui
self.interType = interType
self.timer=QtCore.QTimer() self.timer=QtCore.QTimer()
self.ui=ui
self.ser1 = SerialManager() self.ser1 = SerialManager()
self.ser1.startPort(str(self.ser1.portList[1].device), 115200) self.ser1.startPort(str(self.ser1.portList[1].device), 115200)
self.ser1.serialListPanel(self.ui)
if self.interType==0:
self.x_scale=10
self.nCurves = 2
self.y_min=[0,0]
self.y_max=[32700,10000]
self.ser1.serialListPanel(self.ui) self.color = ['r','g']
self.name = ["Força","Tensão no Calibrante"]
self.unit = ["Tonf","mV"]
self.x_scale=10 elif self.interType==1:
self.nCurves = 2 self.x_scale = 10
self.y_min=[0,0] self.nCurves = 3
self.y_max=[32700,10000] self.y_min = [0, 0, 0]
self.y_max = [32700, 10000, 5000]
self.color = ['r', 'g','w']
self.name = ["Temperatura", "Força","Potência"]
self.unit = ["ºC","N","W"]
self.color = ['r','g']
self.name = ["Força","Tensão no Calibrante"]
self.unit = ["Tonf","mV"]
self.layout=GraphicsLayout() self.layout=GraphicsLayout()
self.updateTimer() self.updateTimer()
self.graph = Graph(self.time[0]/1000,self.x_scale,self.nCurves, self.y_min, self.y_max, 800, 500, self.color,self.name,self.unit)
self.layout.addItem(self.graph.axis[0],row=1,col=1,rowspan=1,colspan=1)
for n in range(1,self.nCurves):
self.layout.addItem(self.graph.axis[n],row=1,col=n+2,rowspan=1,colspan=1)
self.layout.addItem(self.graph,row=1,col=2,rowspan=1,colspan=1)
self.layout.addItem(self.graph.axisTime,row=2,col=2,rowspan=1,colspan=1)
self.layout.setMinimumSize(500, 600)
self.layout.setMaximumSize(500,600)
...@@ -70,7 +71,7 @@ class SystemEngine(object): ...@@ -70,7 +71,7 @@ class SystemEngine(object):
self.scene = QtGui.QGraphicsScene() self.scene = QtGui.QGraphicsScene()
self.scene.addItem(self.layout) self.scene.addItem(self.layout)
self.updateScale()
#self.layout.setMaximumSize(770,550) #self.layout.setMaximumSize(770,550)
...@@ -99,6 +100,10 @@ class SystemEngine(object): ...@@ -99,6 +100,10 @@ class SystemEngine(object):
self.ui.p_max.returnPressed.connect(self.updateScale) self.ui.p_max.returnPressed.connect(self.updateScale)
self.ui.p_min.returnPressed.connect(self.updateScale) self.ui.p_min.returnPressed.connect(self.updateScale)
if self.interType==1:
self.ui.temp_max.returnPressed.connect(self.updateScale)
self.ui.temp_min.returnPressed.connect(self.updateScale)
self.ui.samplingCBox.currentIndexChanged.connect(self.updateTimer) self.ui.samplingCBox.currentIndexChanged.connect(self.updateTimer)
self.timeant=time.time() self.timeant=time.time()
self.timer.timeout.connect(self.updateData) self.timer.timeout.connect(self.updateData)
...@@ -125,13 +130,21 @@ class SystemEngine(object): ...@@ -125,13 +130,21 @@ class SystemEngine(object):
if(self.ui.menuPlay_Pause.isChecked()==True): if(self.ui.menuPlay_Pause.isChecked()==True):
readData = self.ser1.read() # Lê o dado da serial readData = self.ser1.read() # Lê o dado da serial
readData = readData.decode('utf8') readData = readData.decode('utf8')
#print(readData)
dado = readData.split(' ', self.nCurves+1) dado = readData.split(' ', self.nCurves+1)
dado[len(dado)-1]=dado[len(dado)-1].split('\n',2)[0] dado[len(dado)-1]=dado[len(dado)-1].split('\n',2)[0]
try: try:
self.ui.forceLabel.setText(str(dado[0])+" Tonf") if self.interType==0:
self.ui.calibratorLabel.setText(str(dado[1].split()[0])+" mV") self.ui.forceLabel.setText(str(dado[0])+" Tonf")
pass self.ui.calibratorLabel.setText(str(dado[1].split()[0])+" mV")
elif self.interType==1:
self.ui.tempLabel.setText(str(dado[0])+"ºC")
self.ui.forceLabel.setText(str(dado[1].split()[0]) + " kN")
self.ui.powLabel.setText(str(dado[2].split()[0]) + " kW")
except IndexError: except IndexError:
print("Erro no Indice do Array Enviado pela Serial") print("Erro no Indice do Array Enviado pela Serial")
try: try:
...@@ -149,33 +162,56 @@ class SystemEngine(object): ...@@ -149,33 +162,56 @@ class SystemEngine(object):
def updateScale(self): def updateScale(self):
try: try:
self.x_scale = int(self.ui.t_max.text()) self.x_scale = int(self.ui.t_max.text())
self.y_min[0] = int(self.ui.f_min.text())
self.y_max[0] = int(self.ui.f_max.text()) if self.interType==0:
self.y_min[1] = int(self.ui.p_min.text()) self.y_min[0] = int(self.ui.f_min.text())
self.y_max[1] = int(self.ui.p_max.text()) self.y_max[0] = int(self.ui.f_max.text())
self.y_min[1] = int(self.ui.p_min.text())
self.y_max[1] = int(self.ui.p_max.text())
elif self.interType==1:
self.y_min[0] = int(self.ui.temp_min.text())
self.y_max[0] = int(self.ui.temp_max.text())
self.y_min[1] = int(self.ui.f_min.text())
self.y_max[1] = int(self.ui.f_max.text())
self.y_max[2] = int(self.ui.p_max.text())
self.y_min[2] = int(self.ui.p_min.text())
except ValueError: except ValueError:
self.x_scale = 100 self.x_scale = 100
self.y_min[0] = 0 self.y_min[0] = 0
self.y_max[0] = 32700 self.y_max[0] = 32700
self.y_min[0] = 0 self.y_min[1] = 0
self.y_max[0] = 10000 self.y_max[1] = 10000
if self.interType==1:
self.y_min[2] = 0
self.y_max[2] = 5000
print("Erro!: Campos de Escala Vazios") print("Erro!: Campos de Escala Vazios")
if(self.x_scale=="0"): if(self.x_scale=="0"):
self.x_scale="1" self.x_scale="1"
self.layout.clear() self.layout.clear()
self.graph = Graph(self.time[0] / 1000, self.x_scale, self.nCurves, self.y_min, self.y_max, 800, 500,self.color, self.name, self.unit) self.layout.setMinimumSize(500, 600)
self.layout.addItem(self.graph.axis[1],row=1,col=3,rowspan=1,colspan=1) self.layout.setMaximumSize(500, 600)
self.layout.addItem(self.graph.axis[0],row=1,col=1,rowspan=1,colspan=1) self.graph = Graph(self.time[0] / 1000, self.x_scale, self.nCurves, self.y_min, self.y_max, 700, 500,
self.layout.addItem(self.graph.axisTime,row=2,col=2,rowspan=1,colspan=1) self.color, self.name, self.unit)
self.layout.addItem(self.graph,row=1,col=2,rowspan=1,colspan=1)
self.layout.addItem(self.graph.axis[0], row=1, col=1, rowspan=1, colspan=1)
for n in range(1, self.nCurves):
self.layout.addItem(self.graph.axis[n], row=1, col=n + 2, rowspan=1, colspan=1)
self.layout.addItem(self.graph, row=1, col=2, rowspan=1, colspan=1)
self.layout.addItem(self.graph.axisTime, row=2, col=2, rowspan=1, colspan=1)
self.scene.focusItem() self.scene.focusItem()
def updateTimer(self): def updateTimer(self):
self.time=self.ui.samplingCBox.currentText().split(" ") self.time=self.ui.samplingCBox.currentText().split(" ")
self.time[0]=int(self.time[0]) self.time[0]=int(self.time[0])
print(self.time[0]) #print(self.time[0])
if(self.time[0]<100): if(self.time[0]<100):
self.time[0]=1000*self.time[0] self.time[0]=1000*self.time[0]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment