Beispiel #1
0
    def __init__(self, parent=None):
        super(Standing_Katz, self).__init__(parent)
        self.setWindowTitle(self.title)
        layout=QtGui.QGridLayout(self)
        layout.addWidget(QtGui.QLabel(QtGui.QApplication.translate("pychemqt", "Method:")),1,1)
        self.metodos=QtGui.QComboBox()
        self.metodos.addItem("Hall Yarborough")
        self.metodos.addItem("Dranchuk Abu-Kassem")
        self.metodos.addItem("Dranchuk Purvis Robinson")
        self.metodos.addItem("Beggs Brill")
        self.metodos.addItem("Sarem")
        self.metodos.addItem("Gopal")
        self.metodos.addItem("Papay")
        self.metodos.currentIndexChanged.connect(self.plot_Z)
        layout.addWidget(self.metodos,1,2)
        layout.addItem(QtGui.QSpacerItem(10,10,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Fixed),1, 3)
        layout.addWidget(QtGui.QLabel(QtGui.QApplication.translate("pychemqt", "Pr<sub>min</sub>")),1,4)
        self.Prmin=Entrada_con_unidades(float, spinbox=True, value=0.0, width=60, decimales=1, step=0.1)
        layout.addWidget(self.Prmin,1,5)
        layout.addWidget(QtGui.QLabel(QtGui.QApplication.translate("pychemqt", "Pr<sub>max</sub>")),1,6)
        self.Prmax=Entrada_con_unidades(float, spinbox=True, value=8.0, width=60, decimales=1, step=0.1)
        layout.addWidget(self.Prmax,1,7)
        layout.addWidget(QtGui.QLabel(QtGui.QApplication.translate("pychemqt", "Tr")),1, 8)
        self.Tr=QtGui.QLineEdit(", ".join(str(i) for i in [1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.6, 1.7, 1.8, 1.9, 2., 2.2, 2.4, 2.6, 2.8, 3.]))
        self.Tr.setMinimumWidth(400)
        layout.addWidget(self.Tr,1, 9)
        self.diagrama = mpl(self, dpi=90)
        layout.addWidget(self.diagrama,2,1,1,9)
        
        self.buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Close)
        self.buttonBox.rejected.connect(self.reject)
        layout.addWidget(self.buttonBox, 5, 1, 1, 6)

        self.plot_Z(0)
Beispiel #2
0
    def __init__(self, parent=None):
        super(AutoDialog, self).__init__(parent)
        layout = QtGui.QGridLayout(self)
        layout.addWidget(
            QtGui.QLabel(
                QtGui.QApplication.translate("pychemqt", "T<sub>min</sub>")),
            1, 1)
        self.Tmin = Entrada_con_unidades(Temperature)
        layout.addWidget(self.Tmin, 1, 2)
        layout.addWidget(
            QtGui.QLabel(
                QtGui.QApplication.translate("pychemqt", "T<sub>max</sub>")),
            2, 1)
        self.Tmax = Entrada_con_unidades(Temperature)
        layout.addWidget(self.Tmax, 2, 2)
        layout.addWidget(
            QtGui.QLabel(
                QtGui.QApplication.translate("pychemqt", "P<sub>min</sub>")),
            3, 1)
        self.Pmin = Entrada_con_unidades(Pressure)
        layout.addWidget(self.Pmin, 3, 2)
        layout.addWidget(
            QtGui.QLabel(
                QtGui.QApplication.translate("pychemqt", "P<sub>max</sub>")),
            4, 1)
        self.Pmax = Entrada_con_unidades(Pressure)
        layout.addWidget(self.Pmax, 4, 2)

        self.buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Cancel
                                                | QtGui.QDialogButtonBox.Ok)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
        layout.addWidget(self.buttonBox, 5, 1, 1, 2)
Beispiel #3
0
class UI_equipment(UI_equip):
    """Mixer equipment edition dialog"""
    Equipment = Mixer()

    def __init__(self, equipment=None, entradas=1, parent=None):
        """
        equipment: Initial equipment instance to model
        entradas: Stream Input number to equipment
        """
        super().__init__(Mixer, salida=False, parent=parent)

        # Input tab
        for i in range(entradas):
            entrada = UI_corriente.Ui_corriente()
            entrada.Changed.connect(partial(self.cambiarEntrada, i))
            self.Entrada.addTab(entrada, str(i+1))

        # Calculate tab
        lyt_Calc = QtWidgets.QGridLayout(self.tabCalculo)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Output Pressure Method")), 1, 1)
        self.criterio = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_METODO:
            self.criterio.addItem(txt)
        self.criterio.currentIndexChanged.connect(self.criterio_Changed)
        lyt_Calc.addWidget(self.criterio, 1, 2)

        lyt_Calc.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            2, 1, 1, 3)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Output Pressure")), 3, 1)
        self.Pout = Entrada_con_unidades(Pressure)
        self.Pout.valueChanged.connect(partial(self.changeParams, "Pout"))
        lyt_Calc.addWidget(self.Pout, 3, 2)
        lyt_Calc.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 4, 1, 1, 3)

        self.criterio_Changed(0)

        if equipment:
            self.setEquipment(equipment)
        else:
            self.Equipment = Mixer(entradas=entradas)

    def criterio_Changed(self, int):
        self.Pout.setEnabled(int == 2)
        self.changeParams("criterio", int)

    def cambiarEntrada(self, ind, corriente):
        self.Equipment(id_entrada=ind, entrada=corriente)

    def rellenarInput(self):
        UI_equip.rellenarInput(self)
        for i, entrada in enumerate(self.Equipment.kwargs["entrada"]):
            if entrada:
                self.Entrada.widget(i).setCorriente(entrada)
Beispiel #4
0
    def __init__(self, entrada=None, parent=None):
        """entrada: Parametro opcional de clase corriente que indica la corriente de entrada en kla tubería"""
        super(UI_equipment, self).__init__(Grinder, entrada=False, salida=False, parent=parent)
        self.entrada=entrada

        #Pestaña entrada
        self.Entrada= UI_corriente.Ui_corriente(entrada)
        self.Entrada.Changed.connect(self.cambiar_entrada)
        self.tabWidget.insertTab(0, self.Entrada, QtWidgets.QApplication.translate("equipment", "Entrada", None))

        #Pestaña calculo
        gridLayout_Calculo = QtWidgets.QGridLayout(self.tabCalculo)
        gridLayout_Calculo.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Índice de trabajo de bond:", None)), 1, 0, 1, 1)
        self.Material=QtWidgets.QComboBox()
        self.Material.addItem(QtWidgets.QApplication.translate("equipment", "Definido por el usuario", None))
        for key in sorted(BondIndex.keys()):
            self.Material.addItem(key)
        self.Material.currentIndexChanged[str].connect(self.cambiarBondWordIndex)
        gridLayout_Calculo.addWidget(self.Material, 1, 1, 1, 1)
        self.BondWorkIndex=Entrada_con_unidades(float)
        gridLayout_Calculo.addWidget(self.BondWorkIndex, 1, 2, 1, 1)
        gridLayout_Calculo.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),10,0,1,5)

        #Pestaña costos
        gridLayout_Costos = QtWidgets.QGridLayout(self.tabCostos)
        gridLayout_Costos.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Tipo:", None)), 1, 1, 1, 1)
        self.tipo=QtWidgets.QComboBox()
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "De cono", None))
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "Giratorio", None))
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "Dentado", None))
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "De martillo", None))
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "De bolas", None))
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "Pulverizador", None))
        self.tipo.currentIndexChanged.connect(self.calcularCostos)
        gridLayout_Costos.addWidget(self.tipo, 1, 2, 1, 1)
        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Fixed),2,1,1,2)

        self.Costos=costIndex.CostData(1.3, 2)
        self.Costos.valueChanged.connect(self.calcularCostos)
        gridLayout_Costos.addWidget(self.Costos,4,1,2,5)

        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),6,1,1,6)
        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),10,1,1,6)
        self.groupBox_Costos = QtWidgets.QGroupBox(QtWidgets.QApplication.translate("equipment", "Costos calculados", None))
        gridLayout_Costos.addWidget(self.groupBox_Costos,7,1,1,6)
        gridLayout_5 = QtWidgets.QGridLayout(self.groupBox_Costos)
        gridLayout_5.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Coste Adquisición:", None)),0,1,1,1)
        self.C_adq=Entrada_con_unidades(unidades.Currency, retornar=False, readOnly=True)
        gridLayout_5.addWidget(self.C_adq,0,2,1,1)
        gridLayout_5.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Coste Instalación:", None)),1,1,1,1)
        self.C_inst=Entrada_con_unidades(unidades.Currency, retornar=False, readOnly=True)
        gridLayout_5.addWidget(self.C_inst,1,2,1,1)

        #Pestaña salida
        self.Salida= UI_corriente.Ui_corriente(readOnly=True)
        self.tabWidget.insertTab(3, self.Salida,QtWidgets.QApplication.translate("equipment", "Salida", None))

        self.tabWidget.setCurrentIndex(0)
Beispiel #5
0
class CalculateDialog(QtWidgets.QDialog):
    """Dialog to calculate a specified point"""
    def __init__(self, parent=None):
        super(CalculateDialog, self).__init__(parent)
        title = QtWidgets.QApplication.translate("pychemqt",
                                                 "Calculate friction factor")
        self.setWindowTitle(title)
        layout = QtWidgets.QGridLayout(self)
        label = QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Method:"))
        layout.addWidget(label, 1, 0)
        self.metodos = QtWidgets.QComboBox()
        for f in f_list:
            line = f.__doc__.split("\n")[0]
            year = line.split(" ")[-1]
            name = line.split(" ")[-3]
            doc = name + " " + year
            self.metodos.addItem(doc)
        self.metodos.currentIndexChanged.connect(self.calculate)
        layout.addWidget(self.metodos, 1, 1, 1, 2)
        self.fanning = QtWidgets.QCheckBox(
            QtWidgets.QApplication.translate(
                "pychemqt", "Calculate fanning friction factor"))
        self.fanning.toggled.connect(self.calculate)
        layout.addWidget(self.fanning, 2, 0, 1, 3)

        layout.addWidget(QtWidgets.QLabel("Re"), 3, 1)
        self.Re = Entrada_con_unidades(float, tolerancia=4)
        self.Re.valueChanged.connect(self.calculate)
        layout.addWidget(self.Re, 3, 2)
        layout.addWidget(QtWidgets.QLabel("e/D"), 4, 1)
        self.eD = Entrada_con_unidades(float)
        self.eD.valueChanged.connect(self.calculate)
        layout.addWidget(self.eD, 4, 2)
        layout.addWidget(QtWidgets.QLabel("f"), 5, 1)
        self.f = Entrada_con_unidades(float, readOnly=True, decimales=8)
        layout.addWidget(self.f, 5, 2)

        self.buttonBox = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Close)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
        layout.addWidget(self.buttonBox, 10, 1, 1, 2)

    def calculate(self, value):
        index = self.metodos.currentIndex()
        F = f_list[index]
        Re = self.Re.value
        eD = self.eD.value
        if Re and eD is not None:
            f = F(Re, eD)
            if self.fanning.isChecked():
                f /= 4
            self.f.setValue(f)
Beispiel #6
0
class CalculateDialog(QtWidgets.QDialog):
    """Dialog to calculate a specified point"""
    def __init__(self, parent=None):
        super(CalculateDialog, self).__init__(parent)
        title = QtWidgets.QApplication.translate(
            "pychemqt", "Calculate friction factor")
        self.setWindowTitle(title)
        layout = QtWidgets.QGridLayout(self)
        label = QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Method:"))
        layout.addWidget(label, 1, 0)
        self.metodos = QtWidgets.QComboBox()
        for f in f_list:
            line = f.__doc__.split("\n")[1]
            year = line.split(" ")[-1]
            name = line.split(" ")[-3]
            doc = name + " " + year
            self.metodos.addItem(doc)
        self.metodos.currentIndexChanged.connect(self.calculate)
        layout.addWidget(self.metodos, 1, 1, 1, 2)
        self.fanning = QtWidgets.QCheckBox(QtWidgets.QApplication.translate(
            "pychemqt", "Calculate fanning friction factor"))
        self.fanning.toggled.connect(self.calculate)
        layout.addWidget(self.fanning, 2, 0, 1, 3)

        layout.addWidget(QtWidgets.QLabel("Re"), 3, 1)
        self.Re = Entrada_con_unidades(float, tolerancia=4)
        self.Re.valueChanged.connect(self.calculate)
        layout.addWidget(self.Re, 3, 2)
        layout.addWidget(QtWidgets.QLabel("e/D"), 4, 1)
        self.eD = Entrada_con_unidades(float)
        self.eD.valueChanged.connect(self.calculate)
        layout.addWidget(self.eD, 4, 2)
        layout.addWidget(QtWidgets.QLabel("f"), 5, 1)
        self.f = Entrada_con_unidades(float, readOnly=True, decimales=8)
        layout.addWidget(self.f, 5, 2)

        self.buttonBox = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Close)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
        layout.addWidget(self.buttonBox, 10, 1, 1, 2)

    def calculate(self, value):
        index = self.metodos.currentIndex()
        F = f_list[index]
        Re = self.Re.value
        eD = self.eD.value
        if Re and eD is not None:
            f = F(Re, eD)
            if self.fanning.isChecked():
                f /= 4
            self.f.setValue(f)
Beispiel #7
0
    def __init__(self, config=None, parent=None):
        self.standards = [(600, 400), (640, 480), (720, 400), (800, 600),
                          (832, 624), (1024, 768), (1152, 864), (1280, 1024),
                          (1700, 1250), (1900, 1425), (2400, 1800),
                          (4000, 3000)]
        super(UI_confResolution_widget, self).__init__(parent)
        layout = QtWidgets.QGridLayout(self)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Use default resolution:")),
            0, 0)
        self.standard = QtWidgets.QComboBox()
        self.standard.addItem("")
        for resolucion in self.standards:
            self.standard.addItem("%ix%i" % resolucion)
        self.standard.currentIndexChanged.connect(self.changeResolution)
        layout.addWidget(self.standard, 0, 1)

        self.checkCustom = QtWidgets.QCheckBox(
            QtWidgets.QApplication.translate("pychemqt",
                                             "Use Custom resolution"))
        layout.addWidget(self.checkCustom, 1, 0, 1, 2)
        label = QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Width:"))
        label.setIndent(50)
        layout.addWidget(label, 2, 0)
        self.x = Entrada_con_unidades(int, width=60, spinbox=True, step=1)
        layout.addWidget(self.x, 2, 1)
        label = QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Height:"))
        label.setIndent(50)
        layout.addWidget(label, 3, 0)
        self.y = Entrada_con_unidades(int, width=60, spinbox=True, step=1)
        layout.addWidget(self.y, 3, 1)

        self.checkCustom.toggled.connect(self.x.setEnabled)
        self.checkCustom.toggled.connect(self.y.setEnabled)

        if config and config.has_section("PFD"):
            x = config.getint("PFD", "x")
            y = config.getint("PFD", "y")
            self.x.setValue(x)
            self.y.setValue(y)
            if (x, y) in self.standards:
                self.standard.setCurrentIndex(self.standards.index((x, y)) + 1)
                self.checkCustom.setChecked(False)
                self.x.setEnabled(False)
                self.y.setEnabled(False)
            else:
                self.standard.setCurrentIndex(0)
                self.checkCustom.setChecked(True)
Beispiel #8
0
 def actualizarUI(self, indice):
     self.vary.clear()
     propiedades = self.propiedades[:]
     if indice <= 1:
         propiedades.append(
             QtWidgets.QApplication.translate("pychemqt", "Quality"))
     del propiedades[indice]
     for propiedad in propiedades:
         self.vary.addItem(propiedad)
     self.labelFix.setText(self.propiedades[indice])
     self.variableFix.deleteLater()
     self.variableFix = Entrada_con_unidades(self.unidades[indice])
     self.layout().addWidget(self.variableFix, 4, 2)
Beispiel #9
0
    def __init__(self, entrada=None, parent=None):
        """entrada: Parametro opcional de clase corriente que indica la corriente de entrada en kla tubería"""
        super(UI_equipment, self).__init__(Filter, entrada=False, parent=parent)
        self.entrada=entrada

        #Pestaña entrada
        self.Entrada= UI_corriente.Ui_corriente(entrada)
        self.Entrada.Changed.connect(self.cambiar_entrada)
        self.tabWidget.insertTab(0, self.Entrada, QtWidgets.QApplication.translate("equipment", "Entrada", None))

        #Pestaña calculo
        gridLayout_Calculo = QtWidgets.QGridLayout(self.tabCalculo)

        #Pestaña costos
        gridLayout_Costos = QtWidgets.QGridLayout(self.tabCostos)
        gridLayout_Costos.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Tipo:", None)), 1, 0, 1, 1)
        self.tipo=QtWidgets.QComboBox()
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "Rotary vacuum belt discharge", None))
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "Rotary vacuum drum scraper discharge", None))
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "Rotary vacuum disk", None))
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "Horizontal vacuum belt", None))
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "Pressure leaf", None))
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "Plate and frame", None))
        self.tipo.currentIndexChanged.connect(self.calcularCostos)
        gridLayout_Costos.addWidget(self.tipo, 1, 1, 1, 3)
        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Fixed),2,0,1,2)

        self.Costos=costIndex.CostData(1.3, 2)
        self.Costos.valueChanged.connect(self.calcularCostos)
        gridLayout_Costos.addWidget(self.Costos,4,0,2,5)

        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),6,0,1,6)
        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),10,0,1,6)
        self.groupBox_Costos = QtWidgets.QGroupBox(QtWidgets.QApplication.translate("equipment", "Costos calculados", None))
        gridLayout_Costos.addWidget(self.groupBox_Costos,7,0,1,4)
        gridLayout_5 = QtWidgets.QGridLayout(self.groupBox_Costos)
        gridLayout_5.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Coste Adquisición:", None)),1,1)
        self.C_adq=Entrada_con_unidades(unidades.Currency, retornar=False, readOnly=True)
        gridLayout_5.addWidget(self.C_adq,1,2)
        gridLayout_5.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Coste Instalación:", None)),2,1)
        self.C_inst=Entrada_con_unidades(unidades.Currency, retornar=False, readOnly=True)
        gridLayout_5.addWidget(self.C_inst,2,2)


        #Pestaña salida
        self.SalidaGas= UI_corriente.Ui_corriente(readOnly=True)
        self.SalidaSolido= UI_corriente.Ui_corriente(readOnly=True)
        self.Salida.addTab(self.SalidaGas,QtWidgets.QApplication.translate("equipment", "Gas filtrado", None))
        self.Salida.addTab(self.SalidaSolido,QtWidgets.QApplication.translate("equipment", "Sólidos recogidos", None))

        self.tabWidget.setCurrentIndex(0)
Beispiel #10
0
    def __init__(self, entrada=None, parent=None):
        """entrada: Parametro opcional de clase corriente que indica la corriente de entrada en kla tubería"""
        super(UI_equipment, self).__init__(Filter, entrada=False, parent=parent)
        self.entrada=entrada

        #Pestaña entrada
        self.Entrada= UI_corriente.Ui_corriente(entrada)
        self.Entrada.Changed.connect(self.cambiar_entrada)
        self.tabWidget.insertTab(0, self.Entrada, QtWidgets.QApplication.translate("equipment", "Entrada", None))

        #Pestaña calculo
        gridLayout_Calculo = QtWidgets.QGridLayout(self.tabCalculo)

        #Pestaña costos
        gridLayout_Costos = QtWidgets.QGridLayout(self.tabCostos)
        gridLayout_Costos.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Tipo:", None)), 1, 0, 1, 1)
        self.tipo=QtWidgets.QComboBox()
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "Rotary vacuum belt discharge", None))
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "Rotary vacuum drum scraper discharge", None))
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "Rotary vacuum disk", None))
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "Horizontal vacuum belt", None))
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "Pressure leaf", None))
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "Plate and frame", None))
        self.tipo.currentIndexChanged.connect(self.calcularCostos)
        gridLayout_Costos.addWidget(self.tipo, 1, 1, 1, 3)
        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Fixed),2,0,1,2)

        self.Costos=costIndex.CostData(1.3, 2)
        self.Costos.valueChanged.connect(self.calcularCostos)
        gridLayout_Costos.addWidget(self.Costos,4,0,2,5)

        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),6,0,1,6)
        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),10,0,1,6)
        self.groupBox_Costos = QtWidgets.QGroupBox(QtWidgets.QApplication.translate("equipment", "Costos calculados", None))
        gridLayout_Costos.addWidget(self.groupBox_Costos,7,0,1,4)
        gridLayout_5 = QtWidgets.QGridLayout(self.groupBox_Costos)
        gridLayout_5.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Coste Adquisición:", None)),1,1)
        self.C_adq=Entrada_con_unidades(unidades.Currency, retornar=False, readOnly=True)
        gridLayout_5.addWidget(self.C_adq,1,2)
        gridLayout_5.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Coste Instalación:", None)),2,1)
        self.C_inst=Entrada_con_unidades(unidades.Currency, retornar=False, readOnly=True)
        gridLayout_5.addWidget(self.C_inst,2,2)


        #Pestaña salida
        self.SalidaGas= UI_corriente.Ui_corriente(readOnly=True)
        self.SalidaSolido= UI_corriente.Ui_corriente(readOnly=True)
        self.Salida.addTab(self.SalidaGas,QtWidgets.QApplication.translate("equipment", "Gas filtrado", None))
        self.Salida.addTab(self.SalidaSolido,QtWidgets.QApplication.translate("equipment", "Sólidos recogidos", None))

        self.tabWidget.setCurrentIndex(0)
Beispiel #11
0
    def __init__(self, config=None, parent=None):
        super(Widget, self).__init__(parent)
        layout = QtWidgets.QGridLayout(self)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Method:")), 1, 1)
        self.method = QtWidgets.QComboBox()
        for Z in Z_list:
            name = Z.__name__[2:].replace("_", "-")
            year = re.search("((\d+))", Z.__doc__).group(0)
            doc = "%s (%s)" % (name, year)
            self.method.addItem(doc)
        layout.addWidget(self.method, 1, 2)

        layout.addWidget(QtWidgets.QLabel("Pr min:"), 2, 1)
        self.Prmin = Entrada_con_unidades(float, width=60, decimales=1)
        layout.addWidget(self.Prmin, 2, 2)
        layout.addWidget(QtWidgets.QLabel("Pr max:"), 3, 1)
        self.Prmax = Entrada_con_unidades(float, width=60, decimales=1)
        layout.addWidget(self.Prmax, 3, 2)

        layout.addWidget(QtWidgets.QLabel("Tr:"), 4, 1)
        self.Tr = QtWidgets.QLineEdit()
        layout.addWidget(self.Tr, 4, 2)
        self.lineconfig = LineConfig(
            "line",
            QtWidgets.QApplication.translate("pychemqt",
                                             "Reduced temperature style line"))
        layout.addWidget(self.lineconfig, 5, 1, 1, 2)

        self.cruxconfig = LineConfig(
            "crux",
            QtWidgets.QApplication.translate("pychemqt", "Crux style line"))
        layout.addWidget(self.cruxconfig, 6, 1, 1, 2)

        layout.addItem(
            QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 10, 1, 1,
            3)

        if config and config.has_section("Standing_Katz"):
            self.method.setCurrentIndex(
                config.getint("Standing_Katz", "method"))
            self.Prmin.setValue(config.getfloat("Standing_Katz", "Prmin"))
            self.Prmax.setValue(config.getfloat("Standing_Katz", "Prmax"))
            self.Tr.setText(config.get("Standing_Katz", "Tr"))
            self.lineconfig.setConfig(config, "Standing_Katz")
            self.cruxconfig.setConfig(config, "Standing_Katz")
Beispiel #12
0
    def __init__(self, parent=None):
        super(FoulingWidget, self).__init__(parent)
        layout = QtWidgets.QHBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        self.list = QtWidgets.QComboBox()
        self.list.addItem("")
        layout.addWidget(self.list)
        self.value = Entrada_con_unidades(Fouling, decimales=6)
        self.value.valueChanged.connect(self.valueChanged.emit)
        layout.addWidget(self.value)

        for tipo in sorted(self.Fouling_Factor):
            self.list.insertSeparator(self.list.count()+1)
            for componente in sorted(self.Fouling_Factor[tipo]):
                self.list.addItem(" - ".join([tipo, componente]))
        self.list.currentIndexChanged["QString"].connect(self.rellenar)
Beispiel #13
0
class UI_equipment (UI_equip):
    """Valve equipment edition dialog"""
    Equipment = Valve()

    def __init__(self, equipment=None, parent=None):
        """
        equipment: Initial equipment instance to model
        """
        super(UI_equipment, self).__init__(Valve, entrada=False,
                                           salida=False, parent=parent)

        # Calculate tab
        lyt_Calc = QtGui.QGridLayout(self.tabCalculo)
        lyt_Calc.addWidget(QtGui.QLabel(QtGui.QApplication.translate(
            "pychemqt", "Valve operation")), 1, 1)
        self.off = QtGui.QComboBox()
        for txt in self.Equipment.TEXT_WORKING:
            self.off.addItem(txt)
        self.off.currentIndexChanged.connect(self.criterio_Changed)
        lyt_Calc.addWidget(self.off, 1, 2)
        lyt_Calc.addItem(QtGui.QSpacerItem(
            20, 20, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed),
            2, 1, 1, 6)
        lyt_Calc.addWidget(QtGui.QLabel(QtGui.QApplication.translate(
            "pychemqt", "Pout")), 3, 1)
        self.Pout = Entrada_con_unidades(Pressure)
        self.Pout.valueChanged.connect(partial(self.changeParams, "Pout"))
        lyt_Calc.addWidget(self.Pout, 3, 2)
        lyt_Calc.addWidget(QtGui.QLabel(QtGui.QApplication.translate(
            "pychemqt", "DeltaP")), 4, 1)
        self.DeltaP = Entrada_con_unidades(Pressure)
        self.DeltaP.valueChanged.connect(partial(self.changeParams, "DeltaP"))
        lyt_Calc.addWidget(self.DeltaP, 4, 2)
        lyt_Calc.addWidget(QtGui.QLabel(QtGui.QApplication.translate(
            "pychemqt", "T dew point")), 5, 1)
        self.Dew = Entrada_con_unidades(Temperature)
        self.Dew.valueChanged.connect(partial(self.changeParams, "Dew"))
        lyt_Calc.addWidget(self.Dew, 5, 2)
        lyt_Calc.addWidget(QtGui.QLabel(QtGui.QApplication.translate(
            "pychemqt", "T bubble point")), 6, 1)
        self.Bubble = Entrada_con_unidades(Temperature)
        self.Bubble.valueChanged.connect(partial(self.changeParams, "Bubble"))
        lyt_Calc.addWidget(self.Bubble, 6, 2)
        lyt_Calc.addItem(QtGui.QSpacerItem(
            20, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding),
            10, 1, 1, 6)

        self.criterio_Changed(0)
        if equipment:
            self.setEquipment(equipment)

    def criterio_Changed(self, int):
        self.Pout.setEnabled(int == 1)
        self.DeltaP.setEnabled(int == 1)
        self.Dew.setEnabled(int == 1)
        self.Bubble.setEnabled(int == 1)
        self.calculo(off=int)
Beispiel #14
0
class CalculateDialog(QtWidgets.QDialog):
    """Dialog to calculate a specified point"""
    def __init__(self, parent=None):
        super(CalculateDialog, self).__init__(parent)
        title = QtWidgets.QApplication.translate(
            "pychemqt", "Calculate compressibility factor of natural gas")
        self.setWindowTitle(title)
        layout = QtWidgets.QGridLayout(self)
        label = QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Method:"))
        layout.addWidget(label, 1, 0)
        self.method = QtWidgets.QComboBox()
        for Z in Z_list:
            name = Z.__name__[2:].replace("_", "-")
            year = re.search("((\d+))", Z.__doc__).group(0)
            doc = "%s (%s)" % (name, year)
            self.method.addItem(doc)

        self.method.currentIndexChanged.connect(self.calculate)
        layout.addWidget(self.method, 1, 1, 1, 2)

        layout.addWidget(QtWidgets.QLabel("Tr"), 2, 1)
        self.Tr = Entrada_con_unidades(float, tolerancia=4)
        self.Tr.valueChanged.connect(self.calculate)
        layout.addWidget(self.Tr, 2, 2)
        layout.addWidget(QtWidgets.QLabel("Pr"), 3, 1)
        self.Pr = Entrada_con_unidades(float)
        self.Pr.valueChanged.connect(self.calculate)
        layout.addWidget(self.Pr, 3, 2)
        layout.addWidget(QtWidgets.QLabel("Z"), 4, 1)
        self.Z = Entrada_con_unidades(float, readOnly=True, decimales=8)
        layout.addWidget(self.Z, 4, 2)

        self.buttonBox = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Close)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
        layout.addWidget(self.buttonBox, 10, 1, 1, 2)

    def calculate(self, value):
        index = self.method.currentIndex()
        Z = Z_list[index]
        Tr = self.Tr.value
        Pr = self.Pr.value
        if Pr and Tr is not None:
            z = Z(Tr, Pr)
            self.Z.setValue(z)
Beispiel #15
0
class CalculateDialog(QtWidgets.QDialog):
    """Dialog to calculate a specified point"""
    def __init__(self, parent=None):
        super(CalculateDialog, self).__init__(parent)
        title = QtWidgets.QApplication.translate(
            "pychemqt", "Calculate compressibility factor of natural gas")
        self.setWindowTitle(title)
        layout = QtWidgets.QGridLayout(self)
        label = QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Method:"))
        layout.addWidget(label, 1, 0)
        self.method = QtWidgets.QComboBox()
        for Z in Z_list:
            name = Z.__name__[2:].replace("_", "-")
            year = re.search("((\d+))", Z.__doc__).group(0)
            doc = "%s (%s)" % (name, year)
            self.method.addItem(doc)

        self.method.currentIndexChanged.connect(self.calculate)
        layout.addWidget(self.method, 1, 1, 1, 2)

        layout.addWidget(QtWidgets.QLabel("Tr"), 2, 1)
        self.Tr = Entrada_con_unidades(float, tolerancia=4)
        self.Tr.valueChanged.connect(self.calculate)
        layout.addWidget(self.Tr, 2, 2)
        layout.addWidget(QtWidgets.QLabel("Pr"), 3, 1)
        self.Pr = Entrada_con_unidades(float)
        self.Pr.valueChanged.connect(self.calculate)
        layout.addWidget(self.Pr, 3, 2)
        layout.addWidget(QtWidgets.QLabel("Z"), 4, 1)
        self.Z = Entrada_con_unidades(float, readOnly=True, decimales=8)
        layout.addWidget(self.Z, 4, 2)

        self.buttonBox = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Close)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
        layout.addWidget(self.buttonBox, 10, 1, 1, 2)

    def calculate(self, value):
        index = self.method.currentIndex()
        Z = Z_list[index]
        Tr = self.Tr.value
        Pr = self.Pr.value
        if Pr and Tr is not None:
            z = Z(Tr, Pr)
            self.Z.setValue(z)
Beispiel #16
0
class UI_equipment (UI_equip):
    """Valve equipment edition dialog"""
    Equipment = Valve()

    def __init__(self, equipment=None, parent=None):
        """
        equipment: Initial equipment instance to model
        """
        super().__init__(Valve, entrada=False, salida=False, parent=parent)

        # Calculate tab
        lyt_Calc = QtWidgets.QGridLayout(self.tabCalculo)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Valve operation")), 1, 1)
        self.off = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_WORKING:
            self.off.addItem(txt)
        self.off.currentIndexChanged.connect(self.criterio_Changed)
        lyt_Calc.addWidget(self.off, 1, 2)
        lyt_Calc.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            2, 1, 1, 6)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Pout")), 3, 1)
        self.Pout = Entrada_con_unidades(Pressure)
        self.Pout.valueChanged.connect(partial(self.changeParams, "Pout"))
        lyt_Calc.addWidget(self.Pout, 3, 2)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "DeltaP")), 4, 1)
        self.DeltaP = Entrada_con_unidades(Pressure)
        self.DeltaP.valueChanged.connect(partial(self.changeParams, "DeltaP"))
        lyt_Calc.addWidget(self.DeltaP, 4, 2)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "T dew point")), 5, 1)
        self.Dew = Entrada_con_unidades(Temperature)
        self.Dew.valueChanged.connect(partial(self.changeParams, "Dew"))
        lyt_Calc.addWidget(self.Dew, 5, 2)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "T bubble point")), 6, 1)
        self.Bubble = Entrada_con_unidades(Temperature)
        self.Bubble.valueChanged.connect(partial(self.changeParams, "Bubble"))
        lyt_Calc.addWidget(self.Bubble, 6, 2)
        lyt_Calc.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 10, 1, 1, 6)

        self.criterio_Changed(0)
        if equipment:
            self.setEquipment(equipment)

    def criterio_Changed(self, int):
        self.Pout.setEnabled(int == 1)
        self.DeltaP.setEnabled(int == 1)
        self.Dew.setEnabled(int == 1)
        self.Bubble.setEnabled(int == 1)
        self.calculo(off=int)
Beispiel #17
0
 def actualizarVariable(self, indice):
     self.Inicial.deleteLater()
     self.Final.deleteLater()
     self.Incremento.deleteLater()
     if indice >= self.fix.currentIndex():
         indice += 1
     self.Inicial = Entrada_con_unidades(self.unidades[indice])
     self.Final = Entrada_con_unidades(self.unidades[indice])
     if self.unidades[indice] == unidades.Temperature:
         self.Incremento = Entrada_con_unidades(unidades.DeltaT)
     elif self.unidades[indice] == unidades.Pressure:
         self.Incremento = Entrada_con_unidades(unidades.DeltaP)
     else:
         self.Incremento = Entrada_con_unidades(self.unidades[indice])
     self.layout().addWidget(self.Inicial, 5, 2)
     self.layout().addWidget(self.Final, 6, 2)
     self.layout().addWidget(self.Incremento, 7, 2)
Beispiel #18
0
    def __init__(self, equipment=None, entradas=1, parent=None):
        """
        equipment: Initial equipment instance to model
        entradas: Stream Input number to equipment
        """
        super(UI_equipment, self).__init__(Mixer, salida=False, parent=parent)

        # Input tab
        for i in range(entradas):
            entrada = UI_corriente.Ui_corriente()
            entrada.Changed.connect(partial(self.cambiarEntrada, i))
            self.entrada.addTab(entrada, str(i + 1))

        # Calculate tab
        lyt_Calc = QtGui.QGridLayout(self.tabCalculo)
        lyt_Calc.addWidget(
            QtGui.QLabel(
                QtGui.QApplication.translate("pychemqt",
                                             "Output Pressure Method")), 1, 1)
        self.criterio = QtGui.QComboBox()
        for txt in self.Equipment.TEXT_METODO:
            self.criterio.addItem(txt)
        self.criterio.currentIndexChanged.connect(self.criterio_Changed)
        lyt_Calc.addWidget(self.criterio, 1, 2)

        lyt_Calc.addItem(
            QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Fixed,
                              QtGui.QSizePolicy.Fixed), 2, 1, 1, 3)
        lyt_Calc.addWidget(
            QtGui.QLabel(
                QtGui.QApplication.translate("pychemqt", "Output Pressure")),
            3, 1)
        self.Pout = Entrada_con_unidades(Pressure)
        self.Pout.valueChanged.connect(partial(self.changeParams, "Pout"))
        lyt_Calc.addWidget(self.Pout, 3, 2)
        lyt_Calc.addItem(
            QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Expanding,
                              QtGui.QSizePolicy.Expanding), 4, 1, 1, 3)

        self.criterio_Changed(0)

        if equipment:
            self.setEquipment(equipment)
        else:
            self.Equipment = Mixer(entradas=entradas)
Beispiel #19
0
    def __init__(self, equipment=None, parent=None):
        """
        equipment: instancia de equipo inicial
        """
        super(UI_equipment, self).__init__(Screen, entrada=False, parent=parent)

        #Pestaña entrada
#        self.Entrada= UI_corriente.Ui_corriente(entrada)
#        self.Entrada.Changed.connect(self.cambiar_entrada)
#        self.tabWidget.insertTab(0, self.Entrada, QtGui.QApplication.translate("equipment", "Entrada", None, QtGui.QApplication.UnicodeUTF8))

        #Pestaña calculo
        gridLayout_Calculo = QtGui.QGridLayout(self.tabCalculo)

        #Pestaña costos
        gridLayout_Costos = QtGui.QGridLayout(self.tabCostos)
        gridLayout_Costos.addWidget(QtGui.QLabel(QtGui.QApplication.translate("equipment", "Area:", None, QtGui.QApplication.UnicodeUTF8)), 1, 1, 1, 1)
        self.Area=Entrada_con_unidades(unidades.Area)
        self.Area.valueChanged.connect(self.calcularCostos)
        gridLayout_Costos.addWidget(self.Area, 1, 2, 1, 1)
        gridLayout_Costos.addItem(QtGui.QSpacerItem(20,20,QtGui.QSizePolicy.Fixed,QtGui.QSizePolicy.Fixed),2,0,1,2)

        self.Costos=CostData(self.Equipment)
        self.Costos.valueChanged.connect(self.changeParamsCoste)
        gridLayout_Costos.addWidget(self.Costos,4,1,2,5)

        gridLayout_Costos.addItem(QtGui.QSpacerItem(20,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding),6,0,1,6)
        gridLayout_Costos.addItem(QtGui.QSpacerItem(20,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding),10,0,1,6)
        self.groupBox_Costos = QtGui.QGroupBox(QtGui.QApplication.translate("equipment", "Costos calculados", None, QtGui.QApplication.UnicodeUTF8))
        gridLayout_Costos.addWidget(self.groupBox_Costos,7,0,1,6)
        gridLayout_5 = QtGui.QGridLayout(self.groupBox_Costos)
        gridLayout_5.addWidget(QtGui.QLabel(QtGui.QApplication.translate("equipment", "Coste Adquisición:", None, QtGui.QApplication.UnicodeUTF8)),0,1,1,1)
        self.C_adq=Entrada_con_unidades(unidades.Currency, retornar=False, readOnly=True)
        gridLayout_5.addWidget(self.C_adq,0,2,1,1)
        gridLayout_5.addWidget(QtGui.QLabel(QtGui.QApplication.translate("equipment", "Coste Instalación:", None, QtGui.QApplication.UnicodeUTF8)),1,1,1,1)
        self.C_inst=Entrada_con_unidades(unidades.Currency, retornar=False, readOnly=True)
        gridLayout_5.addWidget(self.C_inst,1,2,1,1)

        #Pestaña salida
        self.SalidaGas= UI_corriente.Ui_corriente(readOnly=True)
        self.SalidaSolido= UI_corriente.Ui_corriente(readOnly=True)
        self.Salida.addTab(self.SalidaGas,QtGui.QApplication.translate("equipment", "Gas filtrado", None, QtGui.QApplication.UnicodeUTF8))
        self.Salida.addTab(self.SalidaSolido,QtGui.QApplication.translate("equipment", "Sólidos recogidos", None, QtGui.QApplication.UnicodeUTF8))

        self.tabWidget.setCurrentIndex(0)
Beispiel #20
0
    def __init__(self, equipment=None, parent=None):
        """
        equipment: instancia de equipo inicial
        """
        super(UI_equipment, self).__init__(Screen, entrada=False, parent=parent)

        #Pestaña entrada
#        self.Entrada= UI_corriente.Ui_corriente(entrada)
#        self.Entrada.Changed.connect(self.cambiar_entrada)
#        self.tabWidget.insertTab(0, self.Entrada, QtGui.QApplication.translate("equipment", "Entrada", None, QtGui.QApplication.UnicodeUTF8))

        #Pestaña calculo
        gridLayout_Calculo = QtWidgets.QGridLayout(self.tabCalculo)

        #Pestaña costos
        gridLayout_Costos = QtWidgets.QGridLayout(self.tabCostos)
        gridLayout_Costos.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Area:", None)), 1, 1, 1, 1)
        self.Area=Entrada_con_unidades(unidades.Area)
        self.Area.valueChanged.connect(self.calcularCostos)
        gridLayout_Costos.addWidget(self.Area, 1, 2, 1, 1)
        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Fixed),2,0,1,2)

        self.Costos=CostData(self.Equipment)
        self.Costos.valueChanged.connect(self.changeParamsCoste)
        gridLayout_Costos.addWidget(self.Costos,4,1,2,5)

        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),6,0,1,6)
        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),10,0,1,6)
        self.groupBox_Costos = QtWidgets.QGroupBox(QtWidgets.QApplication.translate("equipment", "Costos calculados", None))
        gridLayout_Costos.addWidget(self.groupBox_Costos,7,0,1,6)
        gridLayout_5 = QtWidgets.QGridLayout(self.groupBox_Costos)
        gridLayout_5.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Coste Adquisición:", None)),0,1,1,1)
        self.C_adq=Entrada_con_unidades(unidades.Currency, retornar=False, readOnly=True)
        gridLayout_5.addWidget(self.C_adq,0,2,1,1)
        gridLayout_5.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Coste Instalación:", None)),1,1,1,1)
        self.C_inst=Entrada_con_unidades(unidades.Currency, retornar=False, readOnly=True)
        gridLayout_5.addWidget(self.C_inst,1,2,1,1)

        #Pestaña salida
        self.SalidaGas= UI_corriente.Ui_corriente(readOnly=True)
        self.SalidaSolido= UI_corriente.Ui_corriente(readOnly=True)
        self.Salida.addTab(self.SalidaGas,QtWidgets.QApplication.translate("equipment", "Gas filtrado", None))
        self.Salida.addTab(self.SalidaSolido,QtWidgets.QApplication.translate("equipment", "Sólidos recogidos", None))

        self.tabWidget.setCurrentIndex(0)
Beispiel #21
0
    def __init__(self, config=None, parent=None):
        self.standards = [(600, 400), (640, 480), (720, 400), (800, 600),
                          (832, 624), (1024, 768), (1152, 864), (1280, 1024),
                          (1700, 1250), (1900, 1425), (2400, 1800), (4000, 3000)]
        super(UI_confResolution_widget, self).__init__(parent)
        layout = QtWidgets.QGridLayout(self)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Use default resolution:")), 0, 0)
        self.standard = QtWidgets.QComboBox()
        self.standard.addItem("")
        for resolucion in self.standards:
            self.standard.addItem("%ix%i" % resolucion)
        self.standard.currentIndexChanged.connect(self.changeResolution)
        layout.addWidget(self.standard, 0, 1)

        self.checkCustom = QtWidgets.QCheckBox(QtWidgets.QApplication.translate(
            "pychemqt", "Use Custom resolution"))
        layout.addWidget(self.checkCustom, 1, 0, 1, 2)
        label = QtWidgets.QLabel(QtWidgets.QApplication.translate("pychemqt", "Width:"))
        label.setIndent(50)
        layout.addWidget(label, 2, 0)
        self.x = Entrada_con_unidades(int, width=60, spinbox=True, step=1)
        layout.addWidget(self.x, 2, 1)
        label = QtWidgets.QLabel(QtWidgets.QApplication.translate("pychemqt", "Height:"))
        label.setIndent(50)
        layout.addWidget(label, 3, 0)
        self.y = Entrada_con_unidades(int, width=60, spinbox=True, step=1)
        layout.addWidget(self.y, 3, 1)

        self.checkCustom.toggled.connect(self.x.setEnabled)
        self.checkCustom.toggled.connect(self.y.setEnabled)

        if config and config.has_section("PFD"):
            x = config.getint("PFD", "x")
            y = config.getint("PFD", "y")
            self.x.setValue(x)
            self.y.setValue(y)
            if (x, y) in self.standards:
                self.standard.setCurrentIndex(self.standards.index((x, y))+1)
                self.checkCustom.setChecked(False)
                self.x.setEnabled(False)
                self.y.setEnabled(False)
            else:
                self.standard.setCurrentIndex(0)
                self.checkCustom.setChecked(True)
Beispiel #22
0
    def __init__(self, parent=None):
        super(Ui_Isoproperty, self).__init__(parent)
        self.setWindowTitle(
            QtWidgets.QApplication.translate("pychemqt",
                                             "Specify Isoproperty Table"))
        layout = QtWidgets.QGridLayout(self)

        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Hold constant")),
            1, 1)
        self.fix = QtWidgets.QComboBox()
        for propiedad in self.propiedades:
            self.fix.addItem(propiedad)
        self.fix.currentIndexChanged.connect(self.actualizarUI)
        layout.addWidget(self.fix, 1, 2)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Vary")), 2, 1)
        self.vary = QtWidgets.QComboBox()
        self.vary.currentIndexChanged.connect(self.actualizarVariable)
        layout.addWidget(self.vary, 2, 2)

        line = QtWidgets.QFrame()
        line.setFrameShape(QtWidgets.QFrame.HLine)
        line.setFrameShadow(QtWidgets.QFrame.Sunken)
        layout.addWidget(line, 3, 1, 1, 2)

        self.labelFix = QtWidgets.QLabel()
        layout.addWidget(self.labelFix, 4, 1)
        self.variableFix = Entrada_con_unidades(float)
        layout.addWidget(self.variableFix, 4, 2)
        self.labelinicial = QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Initial"))
        layout.addWidget(self.labelinicial, 5, 1)
        self.Inicial = Entrada_con_unidades(float)
        layout.addWidget(self.Inicial, 5, 2)
        self.labelfinal = QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Final"))
        layout.addWidget(self.labelfinal, 6, 1)
        self.Final = Entrada_con_unidades(float)
        layout.addWidget(self.Final, 6, 2)
        self.labelincremento = QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Increment"))
        layout.addWidget(self.labelincremento, 7, 1)
        self.Incremento = Entrada_con_unidades(float)
        layout.addWidget(self.Incremento, 7, 2)

        buttonBox = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)
        layout.addWidget(buttonBox, 10, 1, 1, 2)

        self.actualizarUI(0)
Beispiel #23
0
    def __init__(self, equipment=None, salidas=0, parent=None):
        """
        equipment: Initial equipment instance to model
        salidas: Stream Output number to equipment
        """
        super(UI_equipment, self).__init__(Divider,
                                           entrada=False,
                                           parent=parent)

        # Calculate tab
        lyt_Calc = QtGui.QGridLayout(self.tabCalculo)
        lyt_Calc.addWidget(
            QtGui.QLabel(QtGui.QApplication.translate("pychemqt",
                                                      "Separation")), 1, 1, 1,
            1)
        self.criterio = QtGui.QComboBox()
        for txt in self.Equipment.TEXT_CRITERIO:
            self.criterio.addItem(txt)
        self.criterio.currentIndexChanged.connect(self.criterio_Changed)
        lyt_Calc.addWidget(self.criterio, 1, 2, 1, 1)

        self.fracciones = Tabla(1, horizontalHeader=[True], stretch=False)
        self.fracciones.setItemDelegateForColumn(0, CellEditor(self))
        lyt_Calc.addWidget(self.fracciones, 2, 1, 1, 2)

        lyt_Calc.addWidget(
            QtGui.QLabel(
                QtGui.QApplication.translate("pychemqt", "Pressure lost")), 3,
            1, 1, 1)
        self.deltaP = Entrada_con_unidades(Pressure, value=0)
        self.deltaP.valueChanged.connect(partial(self.changeParams, "deltaP"))
        lyt_Calc.addWidget(self.deltaP, 3, 2, 1, 1)

        if equipment and salidas:
            equipment(salidas=salidas)
        elif equipment:
            salidas = equipment.kwargs["salidas"]
        else:
            self.Equipment = Divider(salidas=salidas)

        self.fracciones.setRowCount(salidas)
        for i in range(salidas):
            self.fracciones.setItem(0, i, QtGui.QTableWidgetItem(""))
            self.fracciones.item(0,
                                 i).setTextAlignment(QtCore.Qt.AlignRight
                                                     | QtCore.Qt.AlignVCenter)
            self.fracciones.setRowHeight(i, 20)
            widget = UI_corriente.Ui_corriente(readOnly=True)
            self.Salida.addTab(widget, str(i + 1))

        self.criterio_Changed(0)
        self.fracciones.editingFinished.connect(
            partial(self.changeParams, "split"))
        self.setEquipment(equipment)
Beispiel #24
0
 def drawData(self, unit, data, unidad="", txt=""):
     """Return a widget with the data inprint
         unit: unidad subclass
         data: value to set
         unidad: unit of value to show
         txt: opcional txt to show for unit"""
     if data and unidad:
         value = unit(data, unidad)
         widget = Entrada_con_unidades(unit,
                                       readOnly=True,
                                       value=value,
                                       textounidad=txt)
     elif data:
         widget = Entrada_con_unidades(unit,
                                       readOnly=True,
                                       value=data,
                                       textounidad=txt)
     else:
         widget = QtWidgets.QLabel(str(data))
     return widget
Beispiel #25
0
 def __init__(self, equipment, parent=None):
     """constructor
     equipment: equipment class where the widget have to be put, define
     indiceCostos as a index in costIndex"""
     super(CostData, self).__init__(parent)
     self.indice = equipment.indiceCostos
     factor = equipment.kwargs["f_install"]
     gridLayout = QtWidgets.QGridLayout(self)
     gridLayout.addItem(QtWidgets.QSpacerItem(
         20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding),
         1, 0, 1, 7)
     gridLayout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
         "pychemqt", "Instalation factor:")), 2, 0, 1, 1)
     self.factorInstalacion = Entrada_con_unidades(
         float, spinbox=True, decimales=1, step=0.1, width=50, value=factor)
     self.factorInstalacion.valueChanged.connect(partial(
         self.valueChanged.emit, "f_install"))
     gridLayout.addWidget(self.factorInstalacion, 2, 1, 1, 1)
     gridLayout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
         "pychemqt", "Base index:")), 2, 4, 1, 1)
     self.indiceBase = Entrada_con_unidades(
         float, readOnly=True, value=indiceBase[self.indice], decimales=1)
     gridLayout.addWidget(self.indiceBase, 2, 5, 1, 1)
     gridLayout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
         "pychemqt", "Current index:")), 3, 4, 1, 1)
     self.indiceActual = Entrada_con_unidades(
         float, readOnly=True, colorReadOnly="white",
         value=indiceActual[self.indice], decimales=1)
     gridLayout.addWidget(self.indiceActual, 3, 5, 1, 1)
     self.costIndex = QtWidgets.QToolButton()
     self.costIndex.setFixedSize(QtCore.QSize(24, 24))
     self.costIndex.clicked.connect(self.on_costIndex_clicked)
     self.costIndex.setText("...")
     self.costIndex.setVisible(False)
     gridLayout.addWidget(self.costIndex, 3, 5, 1, 1)
     gridLayout.addItem(QtWidgets.QSpacerItem(
         20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding),
         4, 0, 1, 7)
Beispiel #26
0
 def __init__(self, equipment, parent=None):
     """constructor
     equipment: equipment class where the widget have to be put, define
     indiceCostos as a index in costIndex"""
     super(CostData, self).__init__(parent)
     self.indice = equipment.indiceCostos
     factor = equipment.kwargs["f_install"]
     gridLayout = QtWidgets.QGridLayout(self)
     gridLayout.addItem(
         QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                               QtWidgets.QSizePolicy.Expanding), 1, 0, 1, 7)
     gridLayout.addWidget(
         QtWidgets.QLabel(
             QtWidgets.QApplication.translate("CheProcess",
                                              "Instalation factor:")), 2, 0,
         1, 1)
     self.factorInstalacion = Entrada_con_unidades(float,
                                                   spinbox=True,
                                                   decimales=1,
                                                   step=0.1,
                                                   width=50,
                                                   value=factor)
     self.factorInstalacion.valueChanged.connect(
         partial(self.valueChanged.emit, "f_install"))
     gridLayout.addWidget(self.factorInstalacion, 2, 1, 1, 1)
     gridLayout.addWidget(
         QtWidgets.QLabel(
             QtWidgets.QApplication.translate("CheProcess", "Base index:")),
         2, 4, 1, 1)
     self.indiceBase = Entrada_con_unidades(float,
                                            readOnly=True,
                                            value=indiceBase[self.indice],
                                            decimales=1)
     gridLayout.addWidget(self.indiceBase, 2, 5, 1, 1)
     gridLayout.addWidget(
         QtWidgets.QLabel(
             QtWidgets.QApplication.translate("CheProcess",
                                              "Current index:")), 3, 4, 1,
         1)
     self.indiceActual = Entrada_con_unidades(
         float,
         readOnly=True,
         colorReadOnly="white",
         value=indiceActual[self.indice],
         decimales=1)
     gridLayout.addWidget(self.indiceActual, 3, 5, 1, 1)
     self.costIndex = QtWidgets.QToolButton()
     self.costIndex.setFixedSize(QtCore.QSize(24, 24))
     self.costIndex.clicked.connect(self.on_costIndex_clicked)
     self.costIndex.setText("...")
     self.costIndex.setVisible(False)
     gridLayout.addWidget(self.costIndex, 3, 5, 1, 1)
     gridLayout.addItem(
         QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                               QtWidgets.QSizePolicy.Expanding), 4, 0, 1, 7)
Beispiel #27
0
    def __init__(self, parent=None):
        super(FoulingWidget, self).__init__(parent)
        layout = QtGui.QHBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        self.list = QtGui.QComboBox()
        self.list.addItem("")
        layout.addWidget(self.list)
        self.value = Entrada_con_unidades(Fouling, decimales=6)
        self.value.valueChanged.connect(self.valueChanged.emit)
        layout.addWidget(self.value)

        for tipo in sorted(self.Fouling_Factor):
            self.list.insertSeparator(self.list.count()+1)
            for componente in sorted(self.Fouling_Factor[tipo]):
                self.list.addItem(" - ".join([tipo, componente]))
        self.list.currentIndexChanged["QString"].connect(self.rellenar)
Beispiel #28
0
    def __init__(self, fluid, melting=False, parent=None):
        """
        fluid: initial fluid instance
        melting: boolean to add melting line calculation
        """
        super(AddPoint, self).__init__(parent)
        self.setWindowTitle(
            QtWidgets.QApplication.translate("pychemqt", "Add Point to line"))
        layout = QtWidgets.QGridLayout(self)
        self.fluid = fluid

        self.Inputs = []
        for i, (title, key, unit) in enumerate(meos.inputData):
            layout.addWidget(QtWidgets.QLabel(title), i, 1)
            if unit is unidades.Dimensionless:
                entrada = Entrada_con_unidades(float)
            else:
                entrada = Entrada_con_unidades(unit)
            entrada.valueChanged.connect(partial(self.update, key))
            self.Inputs.append(entrada)
            layout.addWidget(entrada, i, 2)

        self.status = Status(self.fluid.status, self.fluid.msg)
        layout.addWidget(self.status, i + 1, 1, 1, 2)

        if isinstance(fluid, meos.MEoS) and fluid._melting:
            self.checkMelting = QtWidgets.QRadioButton(
                QtWidgets.QApplication.translate("pychemqt", "Melting Point"))
            self.checkMelting.setChecked(melting)
            layout.addWidget(self.checkMelting, i + 2, 1, 1, 2)
            i += 1
        layout.addWidget(
            QtWidgets.QLabel(QtWidgets.QApplication.translate(
                "pychemqt", "To")), i + 2, 1)
        self.To = Entrada_con_unidades(unidades.Temperature)
        self.To.valueChanged.connect(partial(self.update, "To"))
        layout.addWidget(self.To, i + 2, 2)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "rhoo")), i + 3,
            1)
        self.rhoo = Entrada_con_unidades(unidades.Density)
        self.rhoo.valueChanged.connect(partial(self.update, "rhoo"))
        layout.addWidget(self.rhoo, i + 3, 2)

        self.checkBelow = QtWidgets.QCheckBox(
            QtWidgets.QApplication.translate("pychemqt",
                                             "Add below selected point"))
        layout.addWidget(self.checkBelow, i + 4, 1, 1, 2)

        self.buttonBox = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Reset | QtWidgets.QDialogButtonBox.Ok
            | QtWidgets.QDialogButtonBox.Cancel)
        self.buttonBox.clicked.connect(self.click)
        layout.addWidget(self.buttonBox, i + 5, 1, 1, 2)
Beispiel #29
0
    def __init__(self, equipment=None, entradas=1, parent=None):
        """
        equipment: Initial equipment instance to model
        entradas: Stream Input number to equipment
        """
        super(UI_equipment, self).__init__(Mixer, salida=False, parent=parent)

        # Input tab
        for i in range(entradas):
            entrada = UI_corriente.Ui_corriente()
            entrada.Changed.connect(partial(self.cambiarEntrada, i))
            self.entrada.addTab(entrada, str(i+1))

        # Calculate tab
        lyt_Calc = QtGui.QGridLayout(self.tabCalculo)
        lyt_Calc.addWidget(QtGui.QLabel(QtGui.QApplication.translate(
            "pychemqt", "Output Pressure Method")), 1, 1)
        self.criterio = QtGui.QComboBox()
        for txt in self.Equipment.TEXT_METODO:
            self.criterio.addItem(txt)
        self.criterio.currentIndexChanged.connect(self.criterio_Changed)
        lyt_Calc.addWidget(self.criterio, 1, 2)

        lyt_Calc.addItem(QtGui.QSpacerItem(
            20, 20, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed),
            2, 1, 1, 3)
        lyt_Calc.addWidget(QtGui.QLabel(QtGui.QApplication.translate(
            "pychemqt", "Output Pressure")), 3, 1)
        self.Pout = Entrada_con_unidades(Pressure)
        self.Pout.valueChanged.connect(partial(self.changeParams, "Pout"))
        lyt_Calc.addWidget(self.Pout, 3, 2)
        lyt_Calc.addItem(QtGui.QSpacerItem(
            20, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding),
            4, 1, 1, 3)

        self.criterio_Changed(0)

        if equipment:
            self.setEquipment(equipment)
        else:
            self.Equipment = Mixer(entradas=entradas)
Beispiel #30
0
    def __init__(self, state=None, readOnly=False, parent=None):
        """
        constructor
        optional state parameter to assign initial psychrometric state
        """
        super(PsychroInput, self).__init__(parent)

        self.state = PsychroState(P=101325)

        layout = QtWidgets.QGridLayout(self)
        self.checkPresion = QtWidgets.QRadioButton(
            QtWidgets.QApplication.translate("pychemqt", "Pressure"))
        layout.addWidget(self.checkPresion, 1, 1, 1, 1)
        self.P = Entrada_con_unidades(Pressure, value=101325)
        self.P.valueChanged.connect(self.changePressure)
        layout.addWidget(self.P, 1, 2, 1, 1)
        self.checkAltitud = QtWidgets.QRadioButton(
            QtWidgets.QApplication.translate("pychemqt", "Altitude"))
        layout.addWidget(self.checkAltitud, 2, 1, 1, 1)
        self.z = Entrada_con_unidades(Length, value=0)
        self.checkPresion.toggled.connect(self.P.setEnabled)
        self.checkAltitud.toggled.connect(self.z.setEnabled)
        self.z.valueChanged.connect(self.changeAltitude)
        self.checkPresion.setChecked(True)
        self.z.setEnabled(False)
        layout.addWidget(self.z, 2, 2, 1, 1)
        layout.addItem(QtWidgets.QSpacerItem(
            10, 10, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            3, 1, 1, 2)

        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Select point")), 4, 1, 1, 2)
        self.variables = QtWidgets.QComboBox()
        for txt in PsyState.TEXT_MODE:
            self.variables.addItem(txt)
        self.variables.currentIndexChanged.connect(self.updateInputs)
        layout.addWidget(self.variables, 5, 1, 1, 2)

        layout.addWidget(QtWidgets.QLabel("Tdb:"), 6, 1, 1, 1)
        self.tdb = Entrada_con_unidades(Temperature)
        self.tdb.valueChanged.connect(partial(self.updateKwargs, "tdb"))
        layout.addWidget(self.tdb, 6, 2, 1, 1)
        layout.addWidget(QtWidgets.QLabel("Twb:"), 7, 1, 1, 1)
        self.twb = Entrada_con_unidades(Temperature)
        self.twb.valueChanged.connect(partial(self.updateKwargs, "twb"))
        layout.addWidget(self.twb, 7, 2, 1, 1)
        layout.addWidget(QtWidgets.QLabel("Tdp:"), 8, 1, 1, 1)
        self.tdp = Entrada_con_unidades(Temperature)
        self.tdp.valueChanged.connect(partial(self.updateKwargs, "tdp"))
        layout.addWidget(self.tdp, 8, 2, 1, 1)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Humidity Ratio:")), 9, 1, 1, 1)
        self.w = Entrada_con_unidades(float, textounidad="kgw/kgda")
        self.w.valueChanged.connect(partial(self.updateKwargs, "w"))
        layout.addWidget(self.w, 9, 2, 1, 1)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Relative humidity:")), 10, 1, 1, 1)
        self.HR = Entrada_con_unidades(float, textounidad="%")
        self.HR.valueChanged.connect(partial(self.updateKwargs, "HR"))
        layout.addWidget(self.HR, 10, 2, 1, 1)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Volume")), 11, 1, 1, 1)
        self.v = Entrada_con_unidades(SpecificVolume)
        self.v.valueChanged.connect(partial(self.updateKwargs, "v"))
        layout.addWidget(self.v, 11, 2, 1, 1)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Enthalpy")), 12, 1, 1, 1)
        self.h = Entrada_con_unidades(Enthalpy)
        self.h.valueChanged.connect(partial(self.updateKwargs, "h"))
        layout.addWidget(self.h, 12, 2, 1, 1)
        layout.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            13, 1, 1, 2)

        self.setReadOnly(readOnly)
        self.updateInputs(0)
        if state:
            self.setState(state)
Beispiel #31
0
    def __init__(self, equipment=None, parent=None):
        """entrada: Parametro opcional de clase corriente que indica la corriente de entrada en el reactor"""
        super(UI_equipment, self).__init__(Reactor, entrada=False, salida=False, parent=parent)

        #Pestaña reacciones
        self.Reacciones= widgetReacciones()
        self.Reacciones.changed.connect(self.calculo)
        self.tabWidget.insertTab(1, self.Reacciones, QtWidgets.QApplication.translate("pychemqt", "Reactions"))

        #Pestaña calculo
        gridLayout_Calculo = QtWidgets.QGridLayout(self.tabCalculo)
        gridLayout_Calculo.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("pychemqt", "Pressure")),2,0,1,1)
        self.P=Entrada_con_unidades(unidades.Pressure)
        self.P.valueChanged.connect(self.calculo)
        gridLayout_Calculo.addWidget(self.P,2,1,1,1)
        gridLayout_Calculo.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("pychemqt", "Pressure drop")),3,0,1,1)
        self.DeltaP=Entrada_con_unidades(unidades.Pressure)
        self.DeltaP.valueChanged.connect(self.calculo)
        gridLayout_Calculo.addWidget(self.DeltaP,3,1,1,1)
        gridLayout_Calculo.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Fixed),4,0,1,5)
        lyt=QtWidgets.QHBoxLayout()
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("pychemqt", "Type")))
        self.tipo=QtWidgets.QComboBox()
        self.tipo.addItem(QtWidgets.QApplication.translate("pychemqt", "CSTR, continuous stirred-tank"))
        self.tipo.addItem(QtWidgets.QApplication.translate("pychemqt", "PFR, plug flow"))
        self.tipo.currentIndexChanged.connect(self.tipoCambiado)
        lyt.addWidget(self.tipo)
        lyt.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Fixed))
        gridLayout_Calculo.addLayout(lyt,5,0,1,5)
        gridLayout_Calculo.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Fixed),6,0,1,5)

        groupbox=QtWidgets.QGroupBox(QtWidgets.QApplication.translate("pychemqt", "Thermal mode"))
        layout=QtWidgets.QGridLayout(groupbox)
        self.checkAdiabatico=QtWidgets.QRadioButton(QtWidgets.QApplication.translate("pychemqt", "Adiabatic"))
        self.checkAdiabatico.toggled.connect(self.heatChanged)
        layout.addWidget(self.checkAdiabatico, 1, 1, 1, 1)
        self.checkIsotermico=QtWidgets.QRadioButton(QtWidgets.QApplication.translate("pychemqt", "Isothermal"))
        self.checkIsotermico.toggled.connect(self.heatChanged)
        layout.addWidget(self.checkIsotermico, 2, 1, 1, 1)
        self.checkFlux=QtWidgets.QRadioButton(QtWidgets.QApplication.translate("pychemqt", "Heat duty"))
        self.checkFlux.toggled.connect(self.heatChanged)
        layout.addWidget(self.checkFlux, 3, 1, 1, 1)
        self.checkIntercambio=QtWidgets.QRadioButton(QtWidgets.QApplication.translate("pychemqt", "Heat transfer"))
        self.checkIntercambio.toggled.connect(self.heatChanged)
        layout.addWidget(self.checkIntercambio, 4, 1, 1, 1)
        self.checkPerfil=QtWidgets.QRadioButton(QtWidgets.QApplication.translate("pychemqt", "PFR temperature profile"))
        self.checkPerfil.toggled.connect(self.heatChanged)
        layout.addWidget(self.checkPerfil, 5, 1, 1, 1)
        self.T=Entrada_con_unidades(unidades.Temperature)
        self.T.valueChanged.connect(self.calculo)
        layout.addWidget(self.T, 2, 2, 1, 2)
        self.Q=Entrada_con_unidades(unidades.Power)
        self.Q.valueChanged.connect(self.calculo)
        layout.addWidget(self.Q, 3, 2, 1, 2)
        self.T_ext=Entrada_con_unidades(unidades.Temperature)
        self.T_ext.valueChanged.connect(self.calculo)
        layout.addWidget(self.T_ext,4,2,1,2)
        self.U=Entrada_con_unidades(unidades.HeatTransfCoef)
        self.U.valueChanged.connect(self.calculo)
        layout.addWidget(self.U,4,4)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("pychemqt", "Flow")),4,5)
        self.direccion=QtWidgets.QComboBox()
        self.direccion.addItem(QtWidgets.QApplication.translate("pychemqt", "Countercurrent"))
        self.direccion.addItem(QtWidgets.QApplication.translate("pychemqt", "Cocurrent"))
        layout.addWidget(self.direccion,4,6)
        self.botonPerfil=QtWidgets.QPushButton(QtGui.QIcon(QtGui.QPixmap(os.environ["pychemqt"]+"/images/button/table.png")), QtWidgets.QApplication.translate("pychemqt", "Add Profile"))
        self.botonPerfil.clicked.connect(self.editorPerfil)
        layout.addWidget(self.botonPerfil,5,2,1,1)
        gridLayout_Calculo.addWidget(groupbox, 7, 0, 1, 5)

        self.groupBox_Diseno= QtWidgets.QGroupBox(QtWidgets.QApplication.translate("pychemqt", "Design"))
        gridLayout_Calculo.addWidget(self.groupBox_Diseno,8,0,1,5)
        lyt = QtWidgets.QGridLayout(self.groupBox_Diseno)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("pychemqt", "Mode")),1,1)
        self.modo=QtWidgets.QComboBox()
        self.modo.addItem(QtWidgets.QApplication.translate("pychemqt", "Rating: calculate conversión"))
        self.modo.addItem(QtWidgets.QApplication.translate("pychemqt", "Design, calculate volumen"))
        self.modo.currentIndexChanged.connect(self.calculo)
        lyt.addWidget(self.modo,1,2,1,3)
        lyt.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Fixed),1,5)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("pychemqt", "Reactor Volume")),2,1)
        self.V=Entrada_con_unidades(unidades.Volume, "VolLiq")
        lyt.addWidget(self.V,2,2)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("pychemqt", "Key Component")),3,1)
        self.key=QtWidgets.QComboBox()
#        for i, nombre in enumerate(self.nombres):
#            self.key.addItem("%i - %s" %(i+1, nombre))
        lyt.addWidget(self.key,3,2)
        lyt.addItem(QtWidgets.QSpacerItem(20,10,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Fixed),3,3)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("pychemqt", "Conversion")),3,4)
        self.conversion=Entrada_con_unidades(float, max=1)
        lyt.addWidget(self.conversion,3,5)

        gridLayout_Calculo.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),10,0,1,5)

        groupBox_Calculo = QtWidgets.QGroupBox(QtWidgets.QApplication.translate("pychemqt", "Results"))
        gridLayout_Calculo.addWidget(groupBox_Calculo,11,0,1,5)
        gridLayout_1 = QtWidgets.QGridLayout(groupBox_Calculo)
        gridLayout_1.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("pychemqt", "T output")),0,1,1,1)
        self.TCalc=Entrada_con_unidades(unidades.Temperature, retornar=False, readOnly=True)
        gridLayout_1.addWidget(self.TCalc,0,2,1,1)
        gridLayout_1.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("pychemqt", "Heat")),1,1,1,1)
        self.HeatCalc=Entrada_con_unidades(unidades.Power, retornar=False, readOnly=True)
        gridLayout_1.addWidget(self.HeatCalc,1,2,1,1)

        gridLayout_1.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("pychemqt", "Conversion")),0,4)
        self.conversionCalc=Entrada_con_unidades(float, readOnly=True)
        gridLayout_1.addWidget(self.conversionCalc,0,5)
        gridLayout_1.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("pychemqt", "Reactor Volume")),1,4)
        self.VCalc=Entrada_con_unidades(unidades.Volume, "VolLiq", readOnly=True)
        gridLayout_1.addWidget(self.VCalc,1,5)

        self.checkAdiabatico.setChecked(True)
        self.tipoCambiado(0)
Beispiel #32
0
class UI_equipment(parents.UI_equip):
    """Diálogo de definición de molinos trituradores de sólidos"""

    def __init__(self, entrada=None, parent=None):
        """entrada: Parametro opcional de clase corriente que indica la corriente de entrada en kla tubería"""
        super(UI_equipment, self).__init__(Grinder, entrada=False, salida=False, parent=parent)
        self.entrada=entrada

        #Pestaña entrada
        self.Entrada= UI_corriente.Ui_corriente(entrada)
        self.Entrada.Changed.connect(self.cambiar_entrada)
        self.tabWidget.insertTab(0, self.Entrada, QtWidgets.QApplication.translate("equipment", "Entrada", None))

        #Pestaña calculo
        gridLayout_Calculo = QtWidgets.QGridLayout(self.tabCalculo)
        gridLayout_Calculo.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Índice de trabajo de bond:", None)), 1, 0, 1, 1)
        self.Material=QtWidgets.QComboBox()
        self.Material.addItem(QtWidgets.QApplication.translate("equipment", "Definido por el usuario", None))
        for key in sorted(BondIndex.keys()):
            self.Material.addItem(key)
        self.Material.currentIndexChanged[str].connect(self.cambiarBondWordIndex)
        gridLayout_Calculo.addWidget(self.Material, 1, 1, 1, 1)
        self.BondWorkIndex=Entrada_con_unidades(float)
        gridLayout_Calculo.addWidget(self.BondWorkIndex, 1, 2, 1, 1)
        gridLayout_Calculo.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),10,0,1,5)

        #Pestaña costos
        gridLayout_Costos = QtWidgets.QGridLayout(self.tabCostos)
        gridLayout_Costos.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Tipo:", None)), 1, 1, 1, 1)
        self.tipo=QtWidgets.QComboBox()
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "De cono", None))
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "Giratorio", None))
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "Dentado", None))
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "De martillo", None))
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "De bolas", None))
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "Pulverizador", None))
        self.tipo.currentIndexChanged.connect(self.calcularCostos)
        gridLayout_Costos.addWidget(self.tipo, 1, 2, 1, 1)
        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Fixed),2,1,1,2)

        self.Costos=costIndex.CostData(1.3, 2)
        self.Costos.valueChanged.connect(self.calcularCostos)
        gridLayout_Costos.addWidget(self.Costos,4,1,2,5)

        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),6,1,1,6)
        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),10,1,1,6)
        self.groupBox_Costos = QtWidgets.QGroupBox(QtWidgets.QApplication.translate("equipment", "Costos calculados", None))
        gridLayout_Costos.addWidget(self.groupBox_Costos,7,1,1,6)
        gridLayout_5 = QtWidgets.QGridLayout(self.groupBox_Costos)
        gridLayout_5.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Coste Adquisición:", None)),0,1,1,1)
        self.C_adq=Entrada_con_unidades(unidades.Currency, retornar=False, readOnly=True)
        gridLayout_5.addWidget(self.C_adq,0,2,1,1)
        gridLayout_5.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Coste Instalación:", None)),1,1,1,1)
        self.C_inst=Entrada_con_unidades(unidades.Currency, retornar=False, readOnly=True)
        gridLayout_5.addWidget(self.C_inst,1,2,1,1)

        #Pestaña salida
        self.Salida= UI_corriente.Ui_corriente(readOnly=True)
        self.tabWidget.insertTab(3, self.Salida,QtWidgets.QApplication.translate("equipment", "Salida", None))

        self.tabWidget.setCurrentIndex(0)


    def cambiarBondWordIndex(self, txt):
        try:
            value=BondIndex[str(txt)]
        except KeyError:
            self.BondWorkIndex.setReadOnly(False)
            self.BondWorkIndex.clear()
        else:
            self.BondWorkIndex.setValue(value)
            self.BondWorkIndex.setReadOnly(True)

    def cambiar_entrada(self, corriente):
        selfentrada=corriente
        self.calculo()

    def calculo(self):
        if self.todos_datos():

            self.rellenoSalida()

    def rellenoSalida(self):
        pass

    def todos_datos(self):
        pass

    def calcularCostos(self, factor=None, indiceBase=None, indiceActual=None):
        if self.todos_datos():
            if not factor: factor=self.Costos.factor
            if not indiceBase: indiceBase=self.Costos.Base
            if not indiceActual: indiceActual=self.Costos.Actual
            if self.tipo.currentIndex()==0:
                self.FireHeater.Coste(factor, indiceBase, indiceActual, 0, self.tipobox.currentIndex(), self.material.currentIndex())
            else:
                self.FireHeater.Coste(factor, indiceBase, indiceActual, 1, self.tipocilindrico.currentIndex(), self.material.currentIndex())
            self.C_adq.setValue(self.FireHeater.C_adq.config())
            self.C_inst.setValue(self.FireHeater.C_inst.config())
Beispiel #33
0
class PsychroInput(QtWidgets.QWidget):
    """Widget with parameter for psychrometric state"""
    parameters = ["tdb", "twb", "tdp", "w", "HR", "v", "h"]
    stateChanged = QtCore.pyqtSignal(PsyState)
    pressureChanged = QtCore.pyqtSignal()

    def __init__(self, state=None, readOnly=False, parent=None):
        """
        constructor
        optional state parameter to assign initial psychrometric state
        """
        super(PsychroInput, self).__init__(parent)

        self.state = PsychroState(P=101325)

        layout = QtWidgets.QGridLayout(self)
        self.checkPresion = QtWidgets.QRadioButton(
            QtWidgets.QApplication.translate("pychemqt", "Pressure"))
        layout.addWidget(self.checkPresion, 1, 1, 1, 1)
        self.P = Entrada_con_unidades(Pressure, value=101325)
        self.P.valueChanged.connect(self.changePressure)
        layout.addWidget(self.P, 1, 2, 1, 1)
        self.checkAltitud = QtWidgets.QRadioButton(
            QtWidgets.QApplication.translate("pychemqt", "Altitude"))
        layout.addWidget(self.checkAltitud, 2, 1, 1, 1)
        self.z = Entrada_con_unidades(Length, value=0)
        self.checkPresion.toggled.connect(self.P.setEnabled)
        self.checkAltitud.toggled.connect(self.z.setEnabled)
        self.z.valueChanged.connect(self.changeAltitude)
        self.checkPresion.setChecked(True)
        self.z.setEnabled(False)
        layout.addWidget(self.z, 2, 2, 1, 1)
        layout.addItem(QtWidgets.QSpacerItem(
            10, 10, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            3, 1, 1, 2)

        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Select point")), 4, 1, 1, 2)
        self.variables = QtWidgets.QComboBox()
        for txt in PsyState.TEXT_MODE:
            self.variables.addItem(txt)
        self.variables.currentIndexChanged.connect(self.updateInputs)
        layout.addWidget(self.variables, 5, 1, 1, 2)

        layout.addWidget(QtWidgets.QLabel("Tdb:"), 6, 1, 1, 1)
        self.tdb = Entrada_con_unidades(Temperature)
        self.tdb.valueChanged.connect(partial(self.updateKwargs, "tdb"))
        layout.addWidget(self.tdb, 6, 2, 1, 1)
        layout.addWidget(QtWidgets.QLabel("Twb:"), 7, 1, 1, 1)
        self.twb = Entrada_con_unidades(Temperature)
        self.twb.valueChanged.connect(partial(self.updateKwargs, "twb"))
        layout.addWidget(self.twb, 7, 2, 1, 1)
        layout.addWidget(QtWidgets.QLabel("Tdp:"), 8, 1, 1, 1)
        self.tdp = Entrada_con_unidades(Temperature)
        self.tdp.valueChanged.connect(partial(self.updateKwargs, "tdp"))
        layout.addWidget(self.tdp, 8, 2, 1, 1)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Humidity Ratio:")), 9, 1, 1, 1)
        self.w = Entrada_con_unidades(float, textounidad="kgw/kgda")
        self.w.valueChanged.connect(partial(self.updateKwargs, "w"))
        layout.addWidget(self.w, 9, 2, 1, 1)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Relative humidity:")), 10, 1, 1, 1)
        self.HR = Entrada_con_unidades(float, textounidad="%")
        self.HR.valueChanged.connect(partial(self.updateKwargs, "HR"))
        layout.addWidget(self.HR, 10, 2, 1, 1)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Volume")), 11, 1, 1, 1)
        self.v = Entrada_con_unidades(SpecificVolume)
        self.v.valueChanged.connect(partial(self.updateKwargs, "v"))
        layout.addWidget(self.v, 11, 2, 1, 1)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Enthalpy")), 12, 1, 1, 1)
        self.h = Entrada_con_unidades(Enthalpy)
        self.h.valueChanged.connect(partial(self.updateKwargs, "h"))
        layout.addWidget(self.h, 12, 2, 1, 1)
        layout.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            13, 1, 1, 2)

        self.setReadOnly(readOnly)
        self.updateInputs(0)
        if state:
            self.setState(state)

    def updateInputs(self, index):
        """Update inputs appearance to highlight active"""
        for par in self.parameters:
            self.__getattribute__(par).setReadOnly(True)
            self.__getattribute__(par).setResaltado(False)
        for par in PsyState.VAR_NAME[index]:
            self.__getattribute__(par).setReadOnly(False)
            self.__getattribute__(par).setResaltado(True)

        index = self.variables.currentIndex()
        kwargs = {"P": self.P.value}
        for par in PsyState.VAR_NAME[index]:
            if self.__getattribute__(par).value:
                kwargs[par] = self.state.__getattribute__(par)
        self.state = PsychroState(**kwargs)

    def setReadOnly(self, readOnly):
        self.checkPresion.setEnabled(not readOnly)
        self.checkAltitud.setEnabled(not readOnly)
        self.P.setReadOnly(readOnly)
        self.z.setReadOnly(readOnly)
        self.variables.setEnabled(not readOnly)
        for par in self.parameters:
            self.__getattribute__(par).setReadOnly(True)
            self.__getattribute__(par).setResaltado(False)

    def updateKwargs(self, key, value):
        """Update kwargs of state instance, if its correctly defined show it"""
        kwargs = {key: value}
        self.state(**kwargs)
        if self.state.status:
            self.setState(self.state)
            self.stateChanged.emit(self.state)

    def setState(self, state):
        """Fill data input with state properties"""
        self.state = state
        if state.w < state.ws:
            for p in self.parameters:
                self.__getattribute__(p).setValue(state.__getattribute__(p))

    def changePressure(self, value):
        """Change pressure to global plot and for states"""
        self.z.setValue(_height(value))
        self.state = PsychroState(P=value)
        self.pressureChanged.emit()

    def changeAltitude(self, value):
        """Change pressure through altitude and ICAO equation"""
        presion = _Pbar(value)
        self.P.setValue(presion)
        self.state = PsychroState(P=value)
        self.pressureChanged.emit()
Beispiel #34
0
    def __init__(self, equipment=None, parent=None):
        """
        equipment: Initial equipment instance to model
        """
        super().__init__(Fired_Heater, entrada=False, salida=False,
                         parent=parent)

        # Calculate tab
        layout = QtWidgets.QGridLayout(self.tabCalculo)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Output Temperature")), 1, 1)
        self.Tout = Entrada_con_unidades(Temperature, resaltado=True)
        self.Tout.valueChanged.connect(partial(self.changeParams, "Tout"))
        layout.addWidget(self.Tout, 1, 2)
        layout.addItem(QtWidgets.QSpacerItem(
            10, 10, QtWidgets.QSizePolicy. Fixed, QtWidgets.QSizePolicy.Fixed),
            2, 0, 1, 6)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Pressure drop")), 3, 1)
        self.deltaP = Entrada_con_unidades(Pressure)
        self.deltaP.valueChanged.connect(partial(self.changeParams, "deltaP"))
        layout.addWidget(self.deltaP, 3, 2)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Maximum heat flux")), 4, 1)
        self.Hmax = Entrada_con_unidades(Power)
        self.Hmax.valueChanged.connect(partial(self.changeParams, "Hmax"))
        layout.addWidget(self.Hmax, 4, 2)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Fuel calorific value")), 5, 1)
        self.poderCalorifico = Entrada_con_unidades(float)
        self.poderCalorifico.valueChanged.connect(
            partial(self.changeParams, "poderCalorifico"))
        layout.addWidget(self.poderCalorifico, 5, 2)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Efficiency")), 6, 1)
        self.eficiencia = Entrada_con_unidades(float, spinbox=True)
        self.eficiencia.valueChanged.connect(
            partial(self.changeParams, "eficiencia"))
        layout.addWidget(self.eficiencia, 6, 2)
        layout.addItem(QtWidgets.QSpacerItem(
            10, 10, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 7, 0, 1, 6)

        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Results"))
        layout.addWidget(group, 8, 1, 1, 5)
        lyt = QtWidgets.QGridLayout(group)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Heat")), 0, 1)
        self.Heat = Entrada_con_unidades(Power, retornar=False, readOnly=True)
        lyt.addWidget(self.Heat, 0, 2)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Fuel")), 1, 1)
        self.CombustibleRequerido = Entrada_con_unidades(
            VolFlow, "QLiq", retornar=False, readOnly=True)
        lyt.addWidget(self.CombustibleRequerido, 1, 2)
        layout.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Fixed,
            QtWidgets.QSizePolicy.Fixed), 9, 0, 1, 6)

        # Cost tab
        lyt_Cost = QtWidgets.QGridLayout(self.tabCostos)
        lyt_Cost.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Type")), 1, 1)
        self.tipo = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_TIPO:
            self.tipo.addItem(txt)
        self.tipo.currentIndexChanged.connect(self.mostrarSubclasificacion)
        lyt_Cost.addWidget(self.tipo, 1, 2)
        self.label = QtWidgets.QLabel()
        lyt_Cost.addWidget(self.label, 2, 1)
        self.subtipoBox = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_SUBTIPOBOX:
            self.subtipoBox.addItem(txt)
        self.subtipoBox.currentIndexChanged.connect(
            partial(self.changeParamsCoste, "subtipoBox"))
        lyt_Cost.addWidget(self.subtipoBox, 2, 2)
        self.subtipoCylindrical = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_SUBTIPOCYLINDRICAL:
            self.subtipoCylindrical.addItem(txt)
        self.subtipoCylindrical.currentIndexChanged.connect(
            partial(self.changeParamsCoste, "subtipoCylindrical"))
        lyt_Cost.addWidget(self.subtipoCylindrical, 2, 2)
        lyt_Cost.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Material")), 3, 1)
        self.material = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_MATERIAL:
            self.material.addItem(txt)
        self.material.currentIndexChanged.connect(
            partial(self.changeParamsCoste, "material"))
        lyt_Cost.addWidget(self.material, 3, 2)
        lyt_Cost.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Design pressure")), 4, 1)
        self.P_dis = Entrada_con_unidades(Pressure)
        self.P_dis.valueChanged.connect(
            partial(self.changeParamsCoste, "P_dis"))
        lyt_Cost.addWidget(self.P_dis, 4, 2)
        lyt_Cost.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 5, 1, 1, 6)

        self.Costos = CostData(self.Equipment)
        self.Costos.valueChanged.connect(self.changeParamsCoste)
        lyt_Cost.addWidget(self.Costos, 6, 1, 2, 5)

        lyt_Cost.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 8, 1, 1, 6)
        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Stimated Costs"))
        lyt_Cost.addWidget(group, 9, 1, 1, 6)
        layout = QtWidgets.QGridLayout(group)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Purchase costs")), 0, 1)
        self.C_adq = Entrada_con_unidades(Currency, retornar=False)
        self.C_adq.setReadOnly(True)
        layout.addWidget(self.C_adq, 0, 2)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Installed costs")), 1, 1)
        self.C_inst = Entrada_con_unidades(Currency, retornar=False)
        self.C_inst.setReadOnly(True)
        layout.addWidget(self.C_inst, 1, 2)
        lyt_Cost.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Fixed,
            QtWidgets.QSizePolicy.Fixed), 10, 1, 1, 6)

        self.mostrarSubclasificacion(0)
        if equipment:
            self.setEquipment(equipment)
Beispiel #35
0
class UI_reacciones(QtWidgets.QDialog):
    reaction=reaction.Reaction()
    def __init__(self, reaccion=None, parent=None):
        super(UI_reacciones, self).__init__(parent)
        self.evaluate=Evaluate()
        self.evaluate.finished.connect(self.rellenar)
        self.indices, self.nombres, M=getComponents()
        gridLayout = QtWidgets.QGridLayout(self)

        lyt=QtWidgets.QHBoxLayout()
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("pychemqt", "Key component")))
        self.key=QtWidgets.QComboBox()
        for i, nombre in enumerate(self.nombres):
            self.key.addItem("%i - %s" %(i+1, nombre))
        self.key.currentIndexChanged.connect(partial(self.changeParams, "key"))
        lyt.addWidget(self.key)
        lyt.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Fixed))
        gridLayout.addLayout(lyt,1,1,1,5)

        lyt=QtWidgets.QHBoxLayout()
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("pychemqt", "Phase")))
        self.fase=QtWidgets.QComboBox()
        for txt in reaction.Reaction.TEXT_PHASE:
            self.fase.addItem(txt)
        self.fase.currentIndexChanged.connect(partial(self.changeParams, "fase"))
        lyt.addWidget(self.fase)
        self.Formula=QtWidgets.QLabel()
        self.Formula.setAlignment(QtCore.Qt.AlignCenter)
        self.Formula.setSizePolicy(QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Fixed)
        lyt.addWidget(self.Formula)
        gridLayout.addLayout(lyt,2,1,1,5)

        lyt=QtWidgets.QVBoxLayout()
        title=self.nombres[:]
        title.append("")
        self.Estequiometria=Tabla(1, verticalHeaderLabels=title, horizontalHeader=[QtWidgets.QApplication.translate("pychemqt", "Coefficients")], filas=len(self.indices))
        self.Estequiometria.setFixedHeight(22*len(self.indices)+22+4+22)
        lyt.addWidget(self.Estequiometria)
        self.Estequiometria.addRow()
        brush=QtGui.QBrush(QtGui.QColor("#eaeaea"))
        self.Estequiometria.item(len(self.indices), 0).setBackground(brush)
        self.Estequiometria.item(len(self.indices), 0).setFlags(QtCore.Qt.NoItemFlags)
        self.Estequiometria.cellChanged.connect(self.reaccionCambiada)
        lyt.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Expanding))
        gridLayout.addLayout(lyt,3,1,1,2)

        lyt=QtWidgets.QGridLayout()
        lyt.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Fixed),1,1)
        self.formula=QtWidgets.QCheckBox(QtWidgets.QApplication.translate("pychemqt", "Use name in formula"))
        self.formula.toggled.connect(partial(self.changeParams, "formula"))
        lyt.addWidget(self.formula,1,2,1,2)
        self.customHr=QtWidgets.QCheckBox("ΔHr "+QtWidgets.QApplication.translate("pychemqt", "user specified"))
        self.customHr.toggled.connect(self.changeHr)
        lyt.addWidget(self.customHr,2,2,1,2)
        lyt.addWidget(QtWidgets.QLabel("ΔHr<sup>o</sup>"),3,2)
        self.Hr=Entrada_con_unidades(unidades.MolarEnthalpy, readOnly=True)
        self.Hr.valueChanged.connect(partial(self.changeParams, "Hr"))
        lyt.addWidget(self.Hr,3,3)
        lyt.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Expanding))
        gridLayout.addLayout(lyt,3,3,1,2)

        gridLayout.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Fixed),4,2)

        lyt=QtWidgets.QHBoxLayout()
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("pychemqt", "Type")))
        self.tipo=QtWidgets.QComboBox()
        for txt in reaction.Reaction.TEXT_TYPE:
            self.tipo.addItem(txt)
        self.tipo.currentIndexChanged.connect(partial(self.changeParams, "tipo"))
        lyt.addWidget(self.tipo)
        lyt.addItem(QtWidgets.QSpacerItem(20,10,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Fixed))
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("pychemqt", "Concentration")))
        self.base=QtWidgets.QComboBox()
        for txt in reaction.Reaction.TEXT_BASE:
            self.base.addItem(txt)
        self.base.currentIndexChanged.connect(partial(self.changeParams, "base"))
        lyt.addWidget(self.base)
        lyt.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Fixed))
        gridLayout.addLayout(lyt,5,1,1,5)

        self.stacked = QtWidgets.QStackedWidget()
        self.tipo.currentIndexChanged.connect(self.stacked.setCurrentIndex)
        gridLayout.addWidget(self.stacked,6,1,1,5)
        gridLayout.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),7,1,1,5)

        widget=QtWidgets.QWidget()
        self.stacked.addWidget(widget)
        lyt=QtWidgets.QGridLayout(widget)
        lyt.addWidget(QtWidgets.QLabel("<h3>"+QtWidgets.QApplication.translate("pychemqt", "Estequiometric reaction")+"</h3>"),1,1,1,4)
        self.Conversion=Tabla(1, verticalHeaderModel="C", filas=3)
        self.Conversion.setConnected()
        self.Conversion.setFixedWidth(100)
        lyt.addWidget(self.Conversion,2,1,3,1)
        label=QtWidgets.QLabel()
        label.setPixmap(QtGui.QPixmap(os.environ["pychemqt"]+"/images/equation/reaction_conversion.png"))
        lyt.addWidget(label,2,2,1,3)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("pychemqt", "Temperature unit")),3,2)
        self.unidadesTemperatura=QtWidgets.QComboBox()
        for i in unidades.Temperature.__text__:
            self.unidadesTemperatura.addItem(i)
        lyt.addWidget(self.unidadesTemperatura,3,3)
        lyt.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),4,4)
        lyt.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),5,1,1,5)


        widget=QtWidgets.QWidget()
        self.stacked.addWidget(widget)
        lyt=QtWidgets.QGridLayout(widget)
        self.check_KFijo=QtWidgets.QRadioButton(QtWidgets.QApplication.translate("pychemqt", "Fixed"))
        self.check_KFijo.toggled.connect(self.KeqChanged)
        lyt.addWidget(self.check_KFijo,1,1,1,2)
        lyt.addWidget(QtWidgets.QLabel("K<sub>eq</sub>"),1,3)
        self.Keq=Entrada_con_unidades(float)
        lyt.addWidget(self.Keq,1,4)
        label=QtWidgets.QLabel()
        label.setPixmap(QtGui.QPixmap(os.environ["pychemqt"]+"/images/equation/reaction_equilibrium.png"))
        lyt.addWidget(label,1,5,1,4)

        self.check_KEq=QtWidgets.QRadioButton(QtWidgets.QApplication.translate("pychemqt", "Equation"))
        self.check_KEq.toggled.connect(self.KeqChanged)
        lyt.addWidget(self.check_KEq,2,1,1,2)
        self.check_KTabla=QtWidgets.QRadioButton(QtWidgets.QApplication.translate("pychemqt", "Table"))
        self.check_KTabla.toggled.connect(self.KeqChanged)
        lyt.addWidget(self.check_KTabla,2,5,1,2)
        self.KEq_Dat=Tabla(1, verticalHeaderLabels=["A", "B", "C", "D", "E", "F", "G", "H"], filas=8)
        self.KEq_Dat.setFixedHeight(22*8+4)
        self.KEq_Dat.setFixedWidth(120)
        lyt.addWidget(self.KEq_Dat,3,3,1,2)
        self.KEq_Tab=Tabla(4, horizontalHeader=["T, K", "Keq", "Kcalc", "%Error"], verticalHeader=False, columnReadOnly=[False, False, True, True])
        self.KEq_Tab.setSizePolicy(QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding)
        self.KEq_Tab.setFixedWidth(400)
        self.KEq_Tab.setConnected()
        self.KEq_Tab.rowFinished.connect(self.Regresion)
        self.KEq_Tab.setAlternatingRowColors(False)
        lyt.addWidget(self.KEq_Tab,3,5,1,4)
        lyt.addWidget(QtWidgets.QLabel("r²"),4,5)
        self.r2=Entrada_con_unidades(float, readOnly=True)
        lyt.addWidget(self.r2,4,6)
        self.botonTablaPlot=QtWidgets.QPushButton(QtGui.QIcon(QtGui.QPixmap(os.environ["pychemqt"]+"/images/button/plot.png")), QtWidgets.QApplication.translate("pychemqt", "Plot"))
        self.botonTablaPlot.clicked.connect(self.Plot)
        lyt.addWidget(self.botonTablaPlot,4,7)
        self.botonTablaClear=QtWidgets.QPushButton(QtGui.QIcon(QtGui.QPixmap(os.environ["pychemqt"]+"/images/button/clear.png")), QtWidgets.QApplication.translate("pychemqt", "Clear"))
        self.botonTablaClear.clicked.connect(self.KEq_Tab.clear)
        lyt.addWidget(self.botonTablaClear,4,8)
        label=QtWidgets.QLabel()
        label.setPixmap(QtGui.QPixmap(os.environ["pychemqt"]+"/images/equation/reaction_equilibrium2.png"))
        label.setAlignment(QtCore.Qt.AlignCenter)
        lyt.addWidget(label,5,1,1,8)


        self.checkGibbs=QtWidgets.QRadioButton(QtWidgets.QApplication.translate("pychemqt", "From Gibbs free energy minimization"))
        lyt.addWidget(self.checkGibbs,6,1,1,4)

        self.check_KFijo.setChecked(True)


        widget=QtWidgets.QWidget()
        self.stacked.addWidget(widget)
        lyt=QtWidgets.QGridLayout(widget)

        widget=QtWidgets.QWidget()
        self.stacked.addWidget(widget)
        lyt=QtWidgets.QGridLayout(widget)

        self.status=Status()
        gridLayout.addWidget(self.status, 10,1)
        self.buttonBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
        gridLayout.addWidget(self.buttonBox,10,2,1,4)

        if reaccion:
            self.setReaction(reaccion)

    def changeParams(self, parametro, valor):
        self.calculo(**{parametro: valor})

    def calculo(self, **kwargs):
        self.status.setState(4)
        self.evaluate.start(self.reaction, kwargs)

    def changeHr(self, bool):
        self.Hr.setReadOnly(not bool)
        self.changeParams("customHr", bool)

    def reaccionCambiada(self):
        kwargs={"componentes": self.indices,
                    "coeficientes": self.Estequiometria.getColumn(0)[:-1]}
        self.calculo(**kwargs)

    def setReaction(self, reaction):
        self.reaction=reaction
        self.rellenar()

#        if self.Estequiometria.getValue(0, self.Base.currentIndex()):
#            reaccion=reaction.Reaction(self.indices, self.Estequiometria.getColumn(0), base=self.Base.currentIndex(), estequiometria=[0, 0, 0.5], formulas=self.checkFormula.isChecked(), calor=self.checkCalorEspecificado.isChecked(), Hr=self.Hr.value, tipo=self.tipo.currentIndex(), conversion=self.Conversion.getColumn(0)[-1::-1])
#            self.Balance.setValue(reaccion.error)
#            if reaccion.state:
#                self.Formula.setText(reaccion._txt(self.checkFormula.isChecked()))
#                self.Hr.setValue(reaccion.Hr)
#            else:
#                self.Formula.clear()
#                self.Hr.clear()
#            self.botonAdd.setEnabled(reaccion.state and not self.botonEdit.isChecked())
#            self.reaccion=reaccion

    def rellenar(self):
        self.blockSignals(True)
        for variable in self.reaction.kwargsValue:
            self.__getattribute__(variable).setValue(self.reaction.kwargs[variable])
        for combo in self.reaction.kwargsList:
            self.__getattribute__(combo).setCurrentIndex(self.reaction.kwargs[combo])
        for check in self.reaction.kwargsCheck:
            self.__getattribute__(check).setChecked(self.reaction.kwargs[check])

        self.Estequiometria.setColumn(0, self.reaction.kwargs["coeficientes"])
#        self.Conversion.setColumn(0, self.reaction.estequiometria[-1::-1])
        self.blockSignals(False)

        self.status.setState(self.reaction.status, self.reaction.msg)
        self.Estequiometria.item(len(self.indices), 0).setText(str(self.reaction.error))
        if self.reaction.status:
            self.Formula.setText(self.reaction._txt())
            self.Hr.setValue(self.reaction.Hr)

    def KeqChanged(self):
        self.Keq.setReadOnly(not self.check_KFijo.isChecked())
        self.KEq_Dat.setEnabled(self.check_KEq.isChecked())
        self.KEq_Tab.setEnabled(self.check_KTabla.isChecked())
        self.botonTablaClear.setEnabled(self.check_KTabla.isChecked())
        self.botonTablaPlot.setEnabled(self.check_KTabla.isChecked())

    def Regresion(self):
        t=array(self.KEq_Tab.getColumn(0)[:-1])
        k=array(self.KEq_Tab.getColumn(1)[:-1])
        if len(t)>=4:
            if 4<=len(t)<8:
                inicio=r_[0, 0, 0, 0]
                f=lambda par, T: exp(par[0]+par[1]/T+par[2]*log(T)+par[3]*T)
                resto=lambda par, T, k: k-f(par, T)
            else:
                inicio=r_[0, 0, 0, 0, 0, 0, 0, 0]
                f=lambda par, T: exp(par[0]+par[1]/T+par[2]*log(T)+par[3]*T+par[4]*T**2+par[5]*T**3+par[6]*T**4+par[7]*T**5)
                resto=lambda par, T, k: k-f(par, T)

            ajuste=leastsq(resto,inicio,args=(t, k))
            kcalc=f(ajuste[0], t)
            error=(k-kcalc)/k*100
            self.KEq_Dat.setColumn(0, ajuste[0])
            self.KEq_Tab.setColumn(2, kcalc)
            self.KEq_Tab.setColumn(3, error)

            if ajuste[1] in [1, 2, 3, 4]:
                self.ajuste=ajuste[0]

    def Plot(self):
        if self.ajuste!=None:
            t=array(self.KEq_Tab.getColumn(0)[:-1])
            k=array(self.KEq_Tab.getColumn(1)[:-1])
            if 4<=len(t)<8:
                f=lambda par, T: exp(par[0]+par[1]/T+par[2]*log(T)+par[3]*T)
            else:
                f=lambda par, T: exp(par[0]+par[1]/T+par[2]*log(T)+par[3]*T+par[4]*T**2+par[5]*T**3+par[6]*T**4+par[7]*T**5)

            grafico=plot.Plot()
            grafico.data(t, k, 'ro', t, f(self.ajuste, t))
            grafico.exec_()
Beispiel #36
0
    def __init__(self, equipment=None, parent=None):
        """
        equipment: Initial equipment instance to model
        """
        super(UI_equipment, self).__init__(Flash, entrada=False, parent=parent)

        # Calculate tab
        lyt_Calc = QtWidgets.QGridLayout(self.tabCalculo)
        lyt_Calc.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Method")), 0, 1)
        self.flash = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_FLASH:
            self.flash.addItem(txt)
        self.flash.currentIndexChanged.connect(
            partial(self.changeParams, "metodo"))
        lyt_Calc.addWidget(self.flash, 0, 2)
        lyt_Calc.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 1, 1, 1, 6)

        # Cost tab
        lyt_Cost = QtWidgets.QGridLayout(self.tabCostos)
        lyt_Cost.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Orientation")),
            0, 1)
        self.orientacion = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_ORIENTATION:
            self.orientacion.addItem(txt)
        self.orientacion.currentIndexChanged.connect(
            partial(self.changeParamsCoste, "orientacion"))
        lyt_Cost.addWidget(self.orientacion, 0, 2)
        lyt_Cost.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Material")), 1,
            1)
        self.material = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_MATERIAL:
            self.material.addItem(txt)
        self.material.currentIndexChanged.connect(
            partial(self.changeParamsCoste, "material"))
        lyt_Cost.addWidget(self.material, 1, 2, 1, 4)
        lyt_Cost.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Density")), 2, 4)
        self.Densidad = Entrada_con_unidades(Density, "DenLiq")
        self.Densidad.valueChanged.connect(
            partial(self.changeParamsCoste, "densidad"))
        lyt_Cost.addWidget(self.Densidad, 2, 5)
        lyt_Cost.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Diameter")), 2,
            1)
        self.diametro = Entrada_con_unidades(Length)
        self.diametro.valueChanged.connect(
            partial(self.changeParamsCoste, "diametro"))
        lyt_Cost.addWidget(self.diametro, 2, 2)
        lyt_Cost.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Length")), 3, 1)
        self.longitud = Entrada_con_unidades(Length)
        self.longitud.valueChanged.connect(
            partial(self.changeParamsCoste, "longitud"))
        lyt_Cost.addWidget(self.longitud, 3, 2)
        lyt_Cost.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Thickness")), 4,
            1)
        self.espesor = Entrada_con_unidades(Length, "Thickness")
        self.espesor.valueChanged.connect(
            partial(self.changeParamsCoste, "espesor"))
        lyt_Cost.addWidget(self.espesor, 4, 2)
        lyt_Cost.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Head type")), 5,
            1)
        self.cabeza = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_HEAD:
            self.cabeza.addItem(txt)
        self.cabeza.currentIndexChanged.connect(
            partial(self.changeParamsCoste, "cabeza"))
        lyt_Cost.addWidget(self.cabeza, 5, 2)
        lyt_Cost.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Head Thickness")), 6, 1)
        self.espesor_cabeza = Entrada_con_unidades(Length, "Thickness")
        self.espesor_cabeza.valueChanged.connect(
            partial(self.changeParamsCoste, "espesor_cabeza"))
        lyt_Cost.addWidget(self.espesor_cabeza, 6, 2)
        lyt_Cost.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Straight flange length")), 7,
            1)
        self.reborde = Entrada_con_unidades(Length)
        self.reborde.valueChanged.connect(
            partial(self.changeParamsCoste, "reborde"))
        lyt_Cost.addWidget(self.reborde, 7, 2)
        lyt_Cost.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Volume")), 6, 4)
        self.Volumen = Entrada_con_unidades(Volume, "VolLiq", retornar=False)
        self.Volumen.setReadOnly(True)
        lyt_Cost.addWidget(self.Volumen, 6, 5)
        lyt_Cost.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Weight")), 7, 4)
        self.Peso = Entrada_con_unidades(Mass, readOnly=True)
        lyt_Cost.addWidget(self.Peso, 7, 5)
        lyt_Cost.addItem(
            QtWidgets.QSpacerItem(10, 10, QtWidgets.QSizePolicy.Fixed,
                                  QtWidgets.QSizePolicy.Fixed), 2, 3, 6, 1)
        lyt_Cost.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 8, 0, 1, 6)

        self.Costos = CostData(self.Equipment)
        self.Costos.valueChanged.connect(self.changeParamsCoste)
        lyt_Cost.addWidget(self.Costos, 9, 1, 2, 5)

        lyt_Cost.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 11, 0, 1,
            6)
        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Stimated Costs"))
        lyt_Cost.addWidget(group, 12, 1, 1, 5)
        layout = QtWidgets.QGridLayout(group)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Purchase costs")), 0, 1)
        self.C_adq = Entrada_con_unidades(Currency,
                                          retornar=False,
                                          tolerancia=8,
                                          decimales=2)
        self.C_adq.setReadOnly(True)
        layout.addWidget(self.C_adq, 0, 2)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Installed costs")), 1, 1)
        self.C_inst = Entrada_con_unidades(Currency,
                                           retornar=False,
                                           tolerancia=8,
                                           decimales=2)
        self.C_inst.setReadOnly(True)
        layout.addWidget(self.C_inst, 1, 2)
        lyt_Cost.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 13, 0, 1,
            6)

        # Output tab
        self.addSalida(
            QtWidgets.QApplication.translate("pychemqt", "Destilate"))
        self.addSalida(QtWidgets.QApplication.translate("pychemqt", "Residue"))

        if equipment:
            self.setEquipment(equipment)
Beispiel #37
0
class UI_equipment(UI_equip):
    """Diálogo de definición de tamices de sólidos"""
    Equipment=Screen()
    def __init__(self, equipment=None, parent=None):
        """
        equipment: instancia de equipo inicial
        """
        super(UI_equipment, self).__init__(Screen, entrada=False, parent=parent)

        #Pestaña entrada
#        self.Entrada= UI_corriente.Ui_corriente(entrada)
#        self.Entrada.Changed.connect(self.cambiar_entrada)
#        self.tabWidget.insertTab(0, self.Entrada, QtGui.QApplication.translate("equipment", "Entrada", None, QtGui.QApplication.UnicodeUTF8))

        #Pestaña calculo
        gridLayout_Calculo = QtWidgets.QGridLayout(self.tabCalculo)

        #Pestaña costos
        gridLayout_Costos = QtWidgets.QGridLayout(self.tabCostos)
        gridLayout_Costos.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Area:", None)), 1, 1, 1, 1)
        self.Area=Entrada_con_unidades(unidades.Area)
        self.Area.valueChanged.connect(self.calcularCostos)
        gridLayout_Costos.addWidget(self.Area, 1, 2, 1, 1)
        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Fixed),2,0,1,2)

        self.Costos=CostData(self.Equipment)
        self.Costos.valueChanged.connect(self.changeParamsCoste)
        gridLayout_Costos.addWidget(self.Costos,4,1,2,5)

        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),6,0,1,6)
        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),10,0,1,6)
        self.groupBox_Costos = QtWidgets.QGroupBox(QtWidgets.QApplication.translate("equipment", "Costos calculados", None))
        gridLayout_Costos.addWidget(self.groupBox_Costos,7,0,1,6)
        gridLayout_5 = QtWidgets.QGridLayout(self.groupBox_Costos)
        gridLayout_5.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Coste Adquisición:", None)),0,1,1,1)
        self.C_adq=Entrada_con_unidades(unidades.Currency, retornar=False, readOnly=True)
        gridLayout_5.addWidget(self.C_adq,0,2,1,1)
        gridLayout_5.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Coste Instalación:", None)),1,1,1,1)
        self.C_inst=Entrada_con_unidades(unidades.Currency, retornar=False, readOnly=True)
        gridLayout_5.addWidget(self.C_inst,1,2,1,1)

        #Pestaña salida
        self.SalidaGas= UI_corriente.Ui_corriente(readOnly=True)
        self.SalidaSolido= UI_corriente.Ui_corriente(readOnly=True)
        self.Salida.addTab(self.SalidaGas,QtWidgets.QApplication.translate("equipment", "Gas filtrado", None))
        self.Salida.addTab(self.SalidaSolido,QtWidgets.QApplication.translate("equipment", "Sólidos recogidos", None))

        self.tabWidget.setCurrentIndex(0)


    def cambiar_entrada(self, corriente):
        selfentrada=corriente
        self.calculo()

    def calculo(self):
        if self.todos_datos():

            self.rellenoSalida()

    def calcularCostos(self):
        if self.todos_datos():
            if self.tipo.currentIndex()==0:
                self.FireHeater.Coste(self.factorInstalacion.value(), 0, self.tipobox.currentIndex(), self.material.currentIndex())
            else:
                self.FireHeater.Coste(self.factorInstalacion.value(), 1, self.tipocilindrico.currentIndex(), self.material.currentIndex())
            self.C_adq.setValue(self.FireHeater.C_adq.config())
            self.C_inst.setValue(self.FireHeater.C_inst.config())
Beispiel #38
0
    def __init__(self, equipment=None, parent=None):
        """
        equipment: Initial equipment instance to model
        """
        super().__init__(Baghouse, entrada=False, parent=parent)

        # Efficiency tab
        title = [QtWidgets.QApplication.translate("pychemqt", "Diameter") +
                 ", " + Length.text("ParticleDiameter"),
                 QtWidgets.QApplication.translate("pychemqt", "Efficiency")]
        self.efic = Tabla(2, horizontalHeader=title, filas=1, stretch=False)
        self.efic.setColumnReadOnly(0, True)
        self.efic.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
        self.efic.editingFinished.connect(self.cambiarRendimientos)
        self.tabWidget.insertTab(
            1, self.efic,
            QtWidgets.QApplication.translate("pychemqt", "Efficiencies"))

        # Calculate tab
        lyt_Calc = QtWidgets.QGridLayout(self.tabCalculo)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Mode")), 1, 1)
        self.metodo = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_TIPO:
            self.metodo.addItem(txt)
        self.metodo.currentIndexChanged.connect(self.tipoCalculoCambiado)
        lyt_Calc.addWidget(self.metodo, 1, 2, 1, 3)
        lyt_Calc.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            2, 1, 1, 6)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "No cells")), 3, 1)
        self.num_filtros = Entrada_con_unidades(
            int, spinbox=True, step=1, min=1, width=50, resaltado=True,
            start=1)
        self.num_filtros.valueChanged.connect(
            partial(self.changeParams, "num_filtros"))
        lyt_Calc.addWidget(self.num_filtros, 3, 2)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Time")), 4, 1)
        self.tiempo = Entrada_con_unidades(Time, resaltado=True)
        self.tiempo.valueChanged.connect(partial(self.changeParams, "tiempo"))
        lyt_Calc.addWidget(self.tiempo, 4, 2)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Pressure drop")), 5, 1)
        self.deltaP = Entrada_con_unidades(Pressure, retornar=False)
        self.deltaP.setReadOnly(True)
        self.deltaP.valueChanged.connect(partial(self.changeParams, "deltaP"))
        lyt_Calc.addWidget(self.deltaP, 5, 2)
        lyt_Calc.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            6, 1, 1, 6)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Bags per cell")), 7, 1)
        self.membranasFiltro = Entrada_con_unidades(int, spinbox=True, step=1,
                                                    min=1)
        self.membranasFiltro.valueChanged.connect(
            partial(self.changeParams, "membranasFiltro"))
        lyt_Calc.addWidget(self.membranasFiltro, 7, 2)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Bag diameter")), 8, 1)
        self.diametroMembrana = Entrada_con_unidades(Length)
        self.diametroMembrana.valueChanged.connect(
            partial(self.changeParams, "diametroMembrana"))
        lyt_Calc.addWidget(self.diametroMembrana, 8, 2)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Area per bag")), 9, 1)
        self.areaMembrana = Entrada_con_unidades(Area)
        self.areaMembrana.valueChanged.connect(
            partial(self.changeParams, "areaMembrana"))
        lyt_Calc.addWidget(self.areaMembrana, 9, 2)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Cloth resistence")), 7, 4)
        self.resistenciaFiltro = Entrada_con_unidades(float)
        self.resistenciaFiltro.valueChanged.connect(
            partial(self.changeParams, "resistenciaFiltro"))
        lyt_Calc.addWidget(self.resistenciaFiltro, 7, 5)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Cake resistence")), 8, 4)
        self.resistenciaTorta = Entrada_con_unidades(float)
        self.resistenciaTorta.valueChanged.connect(
            partial(self.changeParams, "resistenciaTorta"))
        lyt_Calc.addWidget(self.resistenciaTorta, 8, 5)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Cells cleaned")), 9, 4)
        self.limpieza = Entrada_con_unidades(int, spinbox=True, step=1, min=0)
        self.limpieza.valueChanged.connect(
            partial(self.changeParams, "limpieza"))
        lyt_Calc.addWidget(self.limpieza, 9, 5)
        lyt_Calc.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 10, 1, 1, 6)

        groupbox = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Results"))
        lyt_Calc.addWidget(groupbox, 11, 1, 1, 5)
        lyt = QtWidgets.QGridLayout(groupbox)

        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "No cells")), 1, 1)
        self.num_filtrosCalc = Entrada_con_unidades(int, readOnly=True)
        lyt.addWidget(self.num_filtrosCalc, 1, 2)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Time")), 2, 1)
        self.tiempoCalc = Entrada_con_unidades(Time, readOnly=True)
        lyt.addWidget(self.tiempoCalc, 2, 2)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Pressure drop")), 3, 1)
        self.deltaPCalc = Entrada_con_unidades(Pressure, readOnly=True)
        lyt.addWidget(self.deltaPCalc, 3, 2)

        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Gas velocity")), 1, 4)
        self.Vgas = Entrada_con_unidades(Speed, retornar=False, readOnly=True)
        lyt.addWidget(self.Vgas, 1, 5)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Efficiency")), 2, 4)
        self.rendimiento = Entrada_con_unidades(float, readOnly=True)
        lyt.addWidget(self.rendimiento, 2, 5)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Area")), 3, 4)
        self.floorArea = Entrada_con_unidades(Area, readOnly=True)
        lyt.addWidget(self.floorArea, 3, 5)
        lyt_Calc.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 12, 1, 1, 6)

        # Output tab
        self.addSalida(
            QtWidgets.QApplication.translate("pychemqt", "Filtered gas"))
        self.addSalida(
            QtWidgets.QApplication.translate("pychemqt", "Collected solids"))

        if equipment:
            self.setEquipment(equipment)
Beispiel #39
0
    def __init__(self, equipment=None, parent=None):
        """
        equipment: Initial equipment instance to model
        """
        super().__init__(Fired_Heater,
                         entrada=False,
                         salida=False,
                         parent=parent)

        # Calculate tab
        layout = QtWidgets.QGridLayout(self.tabCalculo)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Output Temperature")), 1, 1)
        self.Tout = Entrada_con_unidades(Temperature, resaltado=True)
        self.Tout.valueChanged.connect(partial(self.changeParams, "Tout"))
        layout.addWidget(self.Tout, 1, 2)
        layout.addItem(
            QtWidgets.QSpacerItem(10, 10, QtWidgets.QSizePolicy.Fixed,
                                  QtWidgets.QSizePolicy.Fixed), 2, 0, 1, 6)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Pressure drop")),
            3, 1)
        self.deltaP = Entrada_con_unidades(Pressure)
        self.deltaP.valueChanged.connect(partial(self.changeParams, "deltaP"))
        layout.addWidget(self.deltaP, 3, 2)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Maximum heat flux")), 4, 1)
        self.Hmax = Entrada_con_unidades(Power)
        self.Hmax.valueChanged.connect(partial(self.changeParams, "Hmax"))
        layout.addWidget(self.Hmax, 4, 2)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Fuel calorific value")), 5,
            1)
        self.poderCalorifico = Entrada_con_unidades(float)
        self.poderCalorifico.valueChanged.connect(
            partial(self.changeParams, "poderCalorifico"))
        layout.addWidget(self.poderCalorifico, 5, 2)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Efficiency")), 6,
            1)
        self.eficiencia = Entrada_con_unidades(float, spinbox=True)
        self.eficiencia.valueChanged.connect(
            partial(self.changeParams, "eficiencia"))
        layout.addWidget(self.eficiencia, 6, 2)
        layout.addItem(
            QtWidgets.QSpacerItem(10, 10, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 7, 0, 1, 6)

        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Results"))
        layout.addWidget(group, 8, 1, 1, 5)
        lyt = QtWidgets.QGridLayout(group)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Heat")), 0, 1)
        self.Heat = Entrada_con_unidades(Power, retornar=False, readOnly=True)
        lyt.addWidget(self.Heat, 0, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Fuel")), 1, 1)
        self.CombustibleRequerido = Entrada_con_unidades(VolFlow,
                                                         "QLiq",
                                                         retornar=False,
                                                         readOnly=True)
        lyt.addWidget(self.CombustibleRequerido, 1, 2)
        layout.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed,
                                  QtWidgets.QSizePolicy.Fixed), 9, 0, 1, 6)

        # Cost tab
        lyt_Cost = QtWidgets.QGridLayout(self.tabCostos)
        lyt_Cost.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Type")), 1, 1)
        self.tipo = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_TIPO:
            self.tipo.addItem(txt)
        self.tipo.currentIndexChanged.connect(self.mostrarSubclasificacion)
        lyt_Cost.addWidget(self.tipo, 1, 2)
        self.label = QtWidgets.QLabel()
        lyt_Cost.addWidget(self.label, 2, 1)
        self.subtipoBox = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_SUBTIPOBOX:
            self.subtipoBox.addItem(txt)
        self.subtipoBox.currentIndexChanged.connect(
            partial(self.changeParamsCoste, "subtipoBox"))
        lyt_Cost.addWidget(self.subtipoBox, 2, 2)
        self.subtipoCylindrical = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_SUBTIPOCYLINDRICAL:
            self.subtipoCylindrical.addItem(txt)
        self.subtipoCylindrical.currentIndexChanged.connect(
            partial(self.changeParamsCoste, "subtipoCylindrical"))
        lyt_Cost.addWidget(self.subtipoCylindrical, 2, 2)
        lyt_Cost.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Material")), 3,
            1)
        self.material = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_MATERIAL:
            self.material.addItem(txt)
        self.material.currentIndexChanged.connect(
            partial(self.changeParamsCoste, "material"))
        lyt_Cost.addWidget(self.material, 3, 2)
        lyt_Cost.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Design pressure")), 4, 1)
        self.P_dis = Entrada_con_unidades(Pressure)
        self.P_dis.valueChanged.connect(
            partial(self.changeParamsCoste, "P_dis"))
        lyt_Cost.addWidget(self.P_dis, 4, 2)
        lyt_Cost.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 5, 1, 1, 6)

        self.Costos = CostData(self.Equipment)
        self.Costos.valueChanged.connect(self.changeParamsCoste)
        lyt_Cost.addWidget(self.Costos, 6, 1, 2, 5)

        lyt_Cost.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 8, 1, 1, 6)
        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Stimated Costs"))
        lyt_Cost.addWidget(group, 9, 1, 1, 6)
        layout = QtWidgets.QGridLayout(group)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Purchase costs")), 0, 1)
        self.C_adq = Entrada_con_unidades(Currency, retornar=False)
        self.C_adq.setReadOnly(True)
        layout.addWidget(self.C_adq, 0, 2)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Installed costs")), 1, 1)
        self.C_inst = Entrada_con_unidades(Currency, retornar=False)
        self.C_inst.setReadOnly(True)
        layout.addWidget(self.C_inst, 1, 2)
        lyt_Cost.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed,
                                  QtWidgets.QSizePolicy.Fixed), 10, 1, 1, 6)

        self.mostrarSubclasificacion(0)
        if equipment:
            self.setEquipment(equipment)
Beispiel #40
0
    def __init__(self, equipment=None, parent=None):
        """
        equipment: Initial equipment instance to model
        """
        super(UI_equipment, self).__init__(Shell_Tube, parent=parent)

        # Input tab
        self.addEntrada(QtWidgets.QApplication.translate("pychemqt", "Tubes"),
                        "entradaTubo")
        self.addEntrada(QtWidgets.QApplication.translate("pychemqt", "Shell"),
                        "entradaCarcasa")

        # Model tab
        tab = QtWidgets.QWidget()
        self.tabWidget.insertTab(
            1, tab, QtWidgets.QApplication.translate("pychemqt", "Model"))
        lyt = QtWidgets.QGridLayout(tab)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Class")), 2, 1)
        self.class_ = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_CLASS:
            self.class_.addItem(txt)
        self.class_.currentIndexChanged.connect(
            partial(self.changeParams, "class_"))
        lyt.addWidget(self.class_, 2, 2)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Front end head")), 3, 1)
        self.frontHead = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_FRONTHEAD:
            self.frontHead.addItem(txt)
        self.frontHead.currentIndexChanged.connect(
            partial(self.changeParams, "frontHead"))
        lyt.addWidget(self.frontHead, 3, 2, 1, 3)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Shell type")), 4, 1)
        self.shell = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_SHELL:
            self.shell.addItem(txt)
        self.shell.currentIndexChanged.connect(
            partial(self.changeParams, "shell"))
        lyt.addWidget(self.shell, 4, 2)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Rear end head")), 5, 1)
        self.rearHead = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_REARHEAD:
            self.rearHead.addItem(txt)

        self.rearHead.currentIndexChanged.connect(
            partial(self.changeParams, "rearHead"))
        lyt.addWidget(self.rearHead, 5, 2, 1, 2)
        lyt.addItem(QtWidgets.QSpacerItem(
            10, 10, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            6, 1, 1, 6)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Orientation")), 7, 1)
        self.orientacion = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_ORIENTATION:
            self.orientacion.addItem(txt)
        self.orientacion.currentIndexChanged.connect(
            partial(self.changeParams, "orientation"))
        lyt.addWidget(self.orientacion, 7, 2)

        botonMetodos = QtWidgets.QPushButton(
            QtWidgets.QApplication.translate("pychemqt", "Calculation methods"))
        botonMetodos.clicked.connect(self.selectMethods)
        lyt.addWidget(botonMetodos, 9, 1)
        lyt.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding),
            10, 1, 1, 6)

        # Tubes tab
        tab = QtWidgets.QWidget()
        self.tabWidget.insertTab(
            2, tab, QtWidgets.QApplication.translate("pychemqt", "Tubes"))
        lyt = QtWidgets.QGridLayout(tab)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Number of tubes")), 1, 1)
        self.NTubes = Entrada_con_unidades(int, width=60, spinbox=True, step=1)
        self.NTubes.valueChanged.connect(partial(self.changeParams, "NTube"))
        lyt.addWidget(self.NTubes, 1, 2)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Number of tube passes")), 2, 1)
        self.NPases = Entrada_con_unidades(int, width=60, spinbox=True, step=1)
        self.NPases.valueChanged.connect(partial(self.changeParams, "NPases"))
        lyt.addWidget(self.NPases, 2, 2)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Tube length")), 3, 1)
        self.LTube = Entrada_con_unidades(Length)
        self.LTube.valueChanged.connect(partial(self.changeParams, "LTube"))
        lyt.addWidget(self.LTube, 3, 2)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Tube external diameter")), 4, 1)
        self.DeTube = Entrada_con_unidades(Length, "pipeDiameter")
        self.DeTube.valueChanged.connect(partial(self.changeParams, "DeTube"))
        lyt.addWidget(self.DeTube, 4, 2)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Tube thickness")), 5, 1)
        self.wTube = Entrada_con_unidades(Length, "Thickness")
        self.wTube.valueChanged.connect(partial(self.changeParams, "wTube"))
        lyt.addWidget(self.wTube, 5, 2)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Tube roughness")), 6, 1)
        self.rTube = Entrada_con_unidades(Length, "Thickness")
        self.rTube.valueChanged.connect(partial(self.changeParams, "rTube"))
        lyt.addWidget(self.rTube, 6, 2)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Thermal conductivity")), 7, 1)
        self.kTube = Entrada_con_unidades(ThermalConductivity)
        self.kTube.valueChanged.connect(partial(self.changeParams, "kTube"))
        lyt.addWidget(self.kTube, 7, 2)
        self.buttonPipe = QtWidgets.QPushButton(
            QtWidgets.QApplication.translate("pychemqt", "Pipe Database"))
        self.buttonPipe.clicked.connect(self.showMaterial)
        lyt.addWidget(self.buttonPipe, 4, 4, 4, 1)
        lyt.addItem(QtWidgets.QSpacerItem(
            10, 10, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            8, 1, 1, 6)

        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Tube pattern")), 9, 1)
        self.distribucionTube = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_DISTRIBUTION_TUBE:
            self.distribucionTube.addItem(txt)
        self.distribucionTube.currentIndexChanged.connect(
            partial(self.changeParams, "distribucionTube"))
        lyt.addWidget(self.distribucionTube, 9, 2)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Tube pitch")), 10, 1)
        self.pitch = Entrada_con_unidades(Length)
        self.pitch.valueChanged.connect(partial(self.changeParams, "pitch"))
        lyt.addWidget(self.pitch, 10, 2)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Fin Tube")), 11, 1)
        self.buttonFin = QtWidgets.QPushButton(
            QtWidgets.QApplication.translate("pychemqt", "Finned Pipe Database"))
        self.buttonFin.setEnabled(False)
        self.buttonFin.clicked.connect(self.showFinTube)
        lyt.addWidget(self.buttonFin, 11, 4, 1, 1)
        self.finned = QtWidgets.QComboBox()
        self.finned.addItem(QtWidgets.QApplication.translate("pychemqt", "Bared tube"))
        self.finned.addItem(QtWidgets.QApplication.translate("pychemqt", "Finned tube"))
        self.finned.currentIndexChanged.connect(self.finnedChanged)
        lyt.addWidget(self.finned, 11, 2)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Fouling")), 12, 1)
        self.tubeFouling = FoulingWidget()
        self.tubeFouling.valueChanged.connect(
            partial(self.changeParams, "tubeFouling"))
        lyt.addWidget(self.tubeFouling, 12, 2, 1, 3)
        lyt.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding),
            15, 1, 1, 6)

        # Shell tab
        tab = QtWidgets.QWidget()
        self.tabWidget.insertTab(
            3, tab, QtWidgets.QApplication.translate("pychemqt", "Shell"))
        lyt = QtWidgets.QGridLayout(tab)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Exchangers in paralell")), 1, 1)
        self.paralelo = Entrada_con_unidades(int, width=60)
        self.paralelo.valueChanged.connect(
            partial(self.changeParams, "parallel"))
        lyt.addWidget(self.paralelo, 1, 2)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Exchangers in serie")), 2, 1)
        self.serie = Entrada_con_unidades(int, width=60)
        self.serie.valueChanged.connect(partial(self.changeParams, "serie"))
        lyt.addWidget(self.serie, 2, 2)
        lyt.addItem(QtWidgets.QSpacerItem(
            10, 10, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            3, 1, 1, 6)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Shell Diameter")), 4, 1)
        self.DShell = Entrada_con_unidades(Length)
        self.DShell.valueChanged.connect(partial(self.changeParams, "DShell"))
        lyt.addWidget(self.DShell, 4, 2)
        lyt.addItem(QtWidgets.QSpacerItem(
            10, 10, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            5, 1, 1, 6)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Shell Material")), 6, 1)
        self.materialShell = QtWidgets.QComboBox()
        lyt.addWidget(self.materialShell, 6, 2)
        lyt.addItem(QtWidgets.QSpacerItem(
            10, 10, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            7, 1, 1, 6)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Fouling")), 8, 1)
        self.shellFouling = FoulingWidget()
        self.shellFouling.valueChanged.connect(
            partial(self.changeParams, "shellFouling"))
        lyt.addWidget(self.shellFouling, 8, 2, 1, 2)
        lyt.addItem(QtWidgets.QSpacerItem(
            10, 10, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            9, 1, 1, 6)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Sealing Strips")), 10, 1)
        self.sealingStrips = Entrada_con_unidades(float)
        self.sealingStrips.valueChanged.connect(
            partial(self.changeParams, "sealingStrips"))
        lyt.addWidget(self.sealingStrips, 10, 2)

        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Clearances"))
        lyt.addWidget(group, 11, 1, 1, 6)
        lyt = QtWidgets.QGridLayout(group)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Tube to baffle hole")), 1, 1)
        self.ClearanceTubeBaffle = Entrada_con_unidades(Length, "Thickness")
        self.ClearanceTubeBaffle.valueChanged.connect(
            partial(self.changeParams, "clearanceTubeBaffle"))
        lyt.addWidget(self.ClearanceTubeBaffle, 1, 2)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Shell to baffle")), 2, 1)
        self.ClearanceShellBaffle = Entrada_con_unidades(Length, "Thickness")
        self.ClearanceShellBaffle.valueChanged.connect(
            partial(self.changeParams, "clearanceShellBaffle"))
        lyt.addWidget(self.ClearanceShellBaffle, 2, 2)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Shell to bundle")), 3, 1)
        self.ClearanceShellBundle = Entrada_con_unidades(Length, "Thickness")
        self.ClearanceShellBundle.valueChanged.connect(
            partial(self.changeParams, "clearanceShellBundle"))
        lyt.addWidget(self.ClearanceShellBundle, 3, 2)
        lyt.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding),
            15, 1, 1, 6)

        # Fitting tab
        tab = QtWidgets.QWidget()
        self.tabWidget.insertTab(
            4, tab, QtWidgets.QApplication.translate("pychemqt", "Baffle"))
        lyt = QtWidgets.QGridLayout(tab)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Baffle type")), 1, 1)
        self.baffleType = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_BAFFLE_TYPE:
            self.baffleType.addItem(txt)
        self.baffleType.currentIndexChanged.connect(
            partial(self.changeParams, "baffleType"))
        lyt.addWidget(self.baffleType, 1, 2)
        lyt.addItem(QtWidgets.QSpacerItem(
            10, 10, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            2, 1, 1, 6)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Inlet spacing")), 3, 1)
        self.baffleSpacingIn = Entrada_con_unidades(Length)
        self.baffleSpacingIn.valueChanged.connect(
            partial(self.changeParams, "baffleSpacingIn"))
        lyt.addWidget(self.baffleSpacingIn, 3, 2)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Outlet spacing")), 3, 4)
        self.baffleSpacingOut = Entrada_con_unidades(Length)
        self.baffleSpacingOut.valueChanged.connect(
            partial(self.changeParams, "baffleSpacingOut"))
        lyt.addWidget(self.baffleSpacingOut, 3, 5)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Baffle spacing")), 4, 1)
        self.baffleSpacing = Entrada_con_unidades(Length)
        self.baffleSpacing.valueChanged.connect(
            partial(self.changeParams, "baffleSpacing"))
        lyt.addWidget(self.baffleSpacing, 4, 2)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Baffle thickness")), 5, 1)
        self.baffleThickness = Entrada_con_unidades(Length, "Thickness")
        self.baffleThickness.valueChanged.connect(
            partial(self.changeParams, "baffleThickness"))
        lyt.addWidget(self.baffleThickness, 5, 2)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Orientation")), 6, 1)
        self.baffleOrientation = QtWidgets.QComboBox()
        self.baffleOrientation.addItem(QtWidgets.QApplication.translate("pychemqt", "Horizontal"))
        self.baffleOrientation.addItem(QtWidgets.QApplication.translate("pychemqt", "Vertical"))
        self.baffleOrientation.currentIndexChanged.connect(
            partial(self.changeParams, "baffleOrientation"))
        lyt.addWidget(self.baffleOrientation, 6, 2)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Cut percent")), 7, 1)
        self.baffleCut = Entrada_con_unidades(float, textounidad="%")
        self.baffleCut.valueChanged.connect(
            partial(self.changeParams, "baffleCut"))
        lyt.addWidget(self.baffleCut, 7, 2)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Cut base")), 7, 4)
        self.baffleCutBase = QtWidgets.QComboBox()
        self.baffleCutBase.addItem(QtWidgets.QApplication.translate("pychemqt", "Diameter"))
        self.baffleCutBase.addItem(QtWidgets.QApplication.translate("pychemqt", "Area"))
        self.baffleCutBase.currentIndexChanged.connect(
            partial(self.changeParams, "baffleCutBase"))
        lyt.addWidget(self.baffleCutBase, 7, 5)
        lyt.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            1, 3, 6, 1)
        lyt.addItem(QtWidgets.QSpacerItem(
            10, 10, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            8, 1, 1, 6)

        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Nozzles"))
        lyt.addWidget(group, 9, 1, 1, 6)
        layout = QtWidgets.QGridLayout(group)
        layout.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Shellside")), 0, 2)
        layout.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Tubeside")), 0, 3)
        layout.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Input diameter")), 1, 1)
        self.nozzleInShellsideDiameter = Entrada_con_unidades(
            Length, "PipeDiameter")
        self.nozzleInShellsideDiameter.valueChanged.connect(
            partial(self.changeParams, "nozzleInShellsideDiameter"))
        layout.addWidget(self.nozzleInShellsideDiameter, 1, 2)
        self.nozzleInTubesideDiameter = Entrada_con_unidades(
            Length, "PipeDiameter")
        self.nozzleInTubesideDiameter.valueChanged.connect(
            partial(self.changeParams, "nozzleInTubesideDiameter"))
        layout.addWidget(self.nozzleInTubesideDiameter, 1, 3)
        layout.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Output diameter")), 2, 1)
        self.nozzleOutShellsideDiameter = Entrada_con_unidades(
            Length, "PipeDiameter")
        self.nozzleOutShellsideDiameter.valueChanged.connect(
            partial(self.changeParams, "nozzleOutShellsideDiameter"))
        layout.addWidget(self.nozzleOutShellsideDiameter, 2, 2)
        self.nozzleOutTubesideDiameter = Entrada_con_unidades(
            Length, "PipeDiameter")
        self.nozzleOutTubesideDiameter.valueChanged.connect(
            partial(self.changeParams, "nozzleOutTubesideDiameter"))
        layout.addWidget(self.nozzleOutTubesideDiameter, 2, 3)
        layout.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed),
            1, 4, 2, 1)

        lyt.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding),
            15, 1, 1, 6)

        # Calculate tab
        lyt = QtWidgets.QGridLayout(self.tabCalculo)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Calculation Mode")), 1, 1)
        self.modo = QtWidgets.QComboBox()
        self.modo.addItem(QtWidgets.QApplication.translate("pychemqt", "Rating"))
        self.modo.addItem(QtWidgets.QApplication.translate("pychemqt", "Design"))
        lyt.addWidget(self.modo, 1, 2)
        lyt.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding),
            15, 1, 1, 6)

        # Cost tab
        lyt = QtWidgets.QGridLayout(self.tabCostos)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Type")), 1, 1)
        self.tipoCoste = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_COST_TYPE:
            self.tipoCoste.addItem(txt)
        self.tipoCoste.currentIndexChanged.connect(
            partial(self.changeParamsCoste, "tipoCoste"))
        lyt.addWidget(self.tipoCoste, 1, 2)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Material")), 2, 1)
        self.materialCoste = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_COST_MATERIAL:
            self.materialCoste.addItem(txt)
        self.materialCoste.currentIndexChanged.connect(
            partial(self.changeParamsCoste, "P_dis"))
        lyt.addWidget(self.materialCoste, 2, 2)
        lyt.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding),
            3, 0, 1, 6)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Design Pressure")), 4, 1)
        self.Pdiseno = Entrada_con_unidades(Pressure)
        lyt.addWidget(self.Pdiseno, 4, 2, 1, 1)
        lyt.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding),
            5, 0, 1, 6)

        self.Costos = CostData(self.Equipment)
        self.Costos.valueChanged.connect(self.calcularCostos)
        lyt.addWidget(self.Costos, 6, 1, 2, 5)

        lyt.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding),
            8, 0, 1, 6)
        lyt.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding),
            10, 0, 1, 6)
        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Stimated Costs"))
        lyt.addWidget(group, 9, 1, 1, 5)
        layout = QtWidgets.QGridLayout(group)
        layout.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Purchase Cost")), 0, 1)
        self.C_adq = Entrada_con_unidades(
            Currency, retornar=False, readOnly=True)
        layout.addWidget(self.C_adq, 0, 2)
        layout.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Installed Cost")), 1, 1)
        self.C_inst = Entrada_con_unidades(
            Currency, retornar=False, readOnly=True)
        self.C_inst.entrada.setReadOnly(True)
        layout.addWidget(self.C_inst, 1, 2)

        # Output Tab
        self.addSalida(QtWidgets.QApplication.translate("pychemqt", "Tubes"))
        self.addSalida(QtWidgets.QApplication.translate("pychemqt", "Shell"))

        if equipment:
            self.setEquipment(equipment)
Beispiel #41
0
class UI_confResolution_widget(QtWidgets.QWidget):
    """PFD resolution widget"""
    def __init__(self, config=None, parent=None):
        self.standards = [(600, 400), (640, 480), (720, 400), (800, 600),
                          (832, 624), (1024, 768), (1152, 864), (1280, 1024),
                          (1700, 1250), (1900, 1425), (2400, 1800),
                          (4000, 3000)]
        super(UI_confResolution_widget, self).__init__(parent)
        layout = QtWidgets.QGridLayout(self)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Use default resolution:")),
            0, 0)
        self.standard = QtWidgets.QComboBox()
        self.standard.addItem("")
        for resolucion in self.standards:
            self.standard.addItem("%ix%i" % resolucion)
        self.standard.currentIndexChanged.connect(self.changeResolution)
        layout.addWidget(self.standard, 0, 1)

        self.checkCustom = QtWidgets.QCheckBox(
            QtWidgets.QApplication.translate("pychemqt",
                                             "Use Custom resolution"))
        layout.addWidget(self.checkCustom, 1, 0, 1, 2)
        label = QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Width:"))
        label.setIndent(50)
        layout.addWidget(label, 2, 0)
        self.x = Entrada_con_unidades(int, width=60, spinbox=True, step=1)
        layout.addWidget(self.x, 2, 1)
        label = QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Height:"))
        label.setIndent(50)
        layout.addWidget(label, 3, 0)
        self.y = Entrada_con_unidades(int, width=60, spinbox=True, step=1)
        layout.addWidget(self.y, 3, 1)

        self.checkCustom.toggled.connect(self.x.setEnabled)
        self.checkCustom.toggled.connect(self.y.setEnabled)

        if config and config.has_section("PFD"):
            x = config.getint("PFD", "x")
            y = config.getint("PFD", "y")
            self.x.setValue(x)
            self.y.setValue(y)
            if (x, y) in self.standards:
                self.standard.setCurrentIndex(self.standards.index((x, y)) + 1)
                self.checkCustom.setChecked(False)
                self.x.setEnabled(False)
                self.y.setEnabled(False)
            else:
                self.standard.setCurrentIndex(0)
                self.checkCustom.setChecked(True)

    def changeResolution(self):
        """Change resolution with value of current opction selected"""
        x, y = self.standard.currentText().split("x")
        self.x.setValue(int(x))
        self.y.setValue(int(y))

    def value(self, config):
        """Function result to wizard"""
        if not config.has_section("PFD"):
            config.add_section("PFD")
        config.set("PFD", "x", str(self.x.value))
        config.set("PFD", "y", str(self.y.value))
        return config

    @classmethod
    def default(cls, config):
        config.add_section("PFD")
        Preferences = ConfigParser()
        Preferences.read(conf_dir + "pychemqtrc")
        config.set("PFD", "x", Preferences.get("PFD", "x"))
        config.set("PFD", "y", Preferences.get("PFD", "y"))
        return config
Beispiel #42
0
    def __init__(self, entradaSolido=None, entradaAire=None,  parent=None):
        """entrada: Parametro opcional de clase corriente que indica la corriente de entrada"""
        super(UI_equipment, self).__init__(Dryer, parent=parent)
        self.entradaSolido=entradaSolido
        self.entradaAire=entradaAire
        self.Equipment=Dryer()

        #Pestaña entrada
        self.EntradaSolido= UI_corriente.Ui_corriente(self.entradaSolido)
        self.EntradaSolido.Changed.connect(self.cambiar_entrada)
        self.Entrada.addTab(self.EntradaSolido,QtWidgets.QApplication.translate("equipment", "Solido", None))
        self.EntradaAire= UI_corriente.Ui_psychrometry(self.entradaAire)
        self.EntradaAire.Changed.connect(self.cambiar_aire)
        self.Entrada.addTab(self.EntradaAire,QtWidgets.QApplication.translate("equipment", "Aire", None))

        #Pestaña calculo
        gridLayout_Calculo = QtWidgets.QGridLayout(self.tabCalculo)
        gridLayout_Calculo.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Tipo de cálculo:", None)), 1, 1)
        self.TipoCalculo=QtWidgets.QComboBox()
        self.TipoCalculo.addItem(QtWidgets.QApplication.translate("equipment", "Cálculo, conocido el flujo de vapor, calcular las corrientes de salida", None))
        self.TipoCalculo.addItem(QtWidgets.QApplication.translate("equipment", "Diseño, calcular el flujo de aire necesario", None))
        self.TipoCalculo.currentIndexChanged.connect(self.calculo)
        gridLayout_Calculo.addWidget(self.TipoCalculo, 1, 2, 1, 4)
        gridLayout_Calculo.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Fixed),2,1,1,6)
        gridLayout_Calculo.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Humedad relativa en el aire:", None)), 3, 1, 1, 1)
        self.HumedadAire=Entrada_con_unidades(float, max=1, spinbox=True, step=0.01)
        self.HumedadAire.valueChanged.connect(self.calculo)
        gridLayout_Calculo.addWidget(self.HumedadAire,3,2,1,1)
        gridLayout_Calculo.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Humedad residual del sólido:", None)), 4, 1, 1, 1)
        self.HumedadSolido=Entrada_con_unidades(float, max=1., spinbox=True, step=0.01, textounidad=unidades.Mass(None).text()+"/"+unidades.Mass(None).text())
        self.HumedadSolido.valueChanged.connect(self.calculo)
        gridLayout_Calculo.addWidget(self.HumedadSolido,4,2,1,1)
        gridLayout_Calculo.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Temperatura del sólido a la salida:", None)), 5, 1, 1, 1)
        self.temperatura=Entrada_con_unidades(unidades.Temperature)
        self.temperatura.valueChanged.connect(self.calculo)
        gridLayout_Calculo.addWidget(self.temperatura,5,2,1,1)
        gridLayout_Calculo.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Intercambio de calor:", None)), 6, 1, 1, 1)
        self.Heat=Entrada_con_unidades(unidades.Power)
        self.Heat.valueChanged.connect(self.calculo)
        gridLayout_Calculo.addWidget(self.Heat,6,2,1,1)
        gridLayout_Calculo.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Pérdida de presión:", None)), 7, 1, 1, 1)
        self.DeltaP=Entrada_con_unidades(unidades.Pressure)
        self.DeltaP.valueChanged.connect(self.calculo)
        gridLayout_Calculo.addWidget(self.DeltaP,7,2,1,1)

        gridLayout_Calculo.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),8,1,1,6)
        self.groupBox_Calculo = QtWidgets.QGroupBox(QtWidgets.QApplication.translate("equipment", "Datos calculados", None))
        gridLayout_Calculo.addWidget(self.groupBox_Calculo,9,1,1,5)
        gridLayout_1 = QtWidgets.QGridLayout(self.groupBox_Calculo)
        gridLayout_1.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Temperatura a la salida:", None)), 1, 1, 1, 1)
        self.temperaturaCalculada=Entrada_con_unidades(unidades.Temperature, retornar=False, readOnly=True)
        gridLayout_1.addWidget(self.temperaturaCalculada,1,2,1,1)
        gridLayout_1.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Caudal de aire:", None)),2,1)
        self.caudalVolumetrico=Entrada_con_unidades(unidades.VolFlow, "QGas", retornar=False, readOnly=True)
        gridLayout_1.addWidget(self.caudalVolumetrico,2,2,1,1)
        gridLayout_1.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Humedad del aire:", None)), 3, 1)
        self.HumedadCalculada=Entrada_con_unidades(float, readOnly=True, textounidad="%")
        gridLayout_1.addWidget(self.HumedadCalculada,3,2,1,1)

        gridLayout_Calculo.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),11,1,1,6)

        #Pestaña salida
        self.SalidaSolido= UI_corriente.Ui_corriente(readOnly=True)
        self.Salida.addTab(self.SalidaSolido,QtWidgets.QApplication.translate("equipment", "Sólido secado", None))
        self.SalidaAire= UI_corriente.Ui_psychrometry(readOnly=True)
        self.Salida.addTab(self.SalidaAire,QtWidgets.QApplication.translate("equipment", "Aire", None))
Beispiel #43
0
    def __init__(self, equipment=None, parent=None):
        """
        equipment: Initial equipment instance to model
        """
        super(UI_equipment, self).__init__(Dryer, parent=parent)

        # Input tab
        self.addEntrada(
            QtWidgets.QApplication.translate("pychemqt", "Humid Solid"),
            "entradaSolido")
        self.addEntrada(QtWidgets.QApplication.translate("pychemqt", "Air"),
                        "entradaAire",
                        psychro=True)

        # Calculate tab
        lyt = QtWidgets.QGridLayout(self.tabCalculo)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Mode")), 1, 1)
        self.mode = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_MODE:
            self.mode.addItem(txt)
        self.mode.currentIndexChanged.connect(
            partial(self.changeParams, "mode"))
        lyt.addWidget(self.mode, 1, 2, 1, 4)
        lyt.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed,
                                  QtWidgets.QSizePolicy.Fixed), 2, 1, 1, 6)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Air Relative Humidity")), 3,
            1)
        self.HumedadAire = Entrada_con_unidades(float,
                                                max=1,
                                                spinbox=True,
                                                step=0.01)
        self.HumedadAire.valueChanged.connect(partial(self.changeParams, "HR"))
        lyt.addWidget(self.HumedadAire, 3, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Product moisture fraction")),
            4, 1)
        self.HumedadSolido = Entrada_con_unidades(
            float,
            max=1.,
            spinbox=True,
            step=0.01,
            textounidad=unidades.Mass(None).text() + "/" +
            unidades.Mass(None).text())
        self.HumedadSolido.valueChanged.connect(
            partial(self.changeParams, "HumedadResidual"))
        lyt.addWidget(self.HumedadSolido, 4, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Output Solid Temperature")),
            5, 1)
        self.temperatura = Entrada_con_unidades(unidades.Temperature)
        self.temperatura.valueChanged.connect(
            partial(self.changeParams, "TemperaturaSolid"))
        lyt.addWidget(self.temperatura, 5, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Heat Duty")), 6,
            1)
        self.Heat = Entrada_con_unidades(unidades.Power)
        self.Heat.valueChanged.connect(partial(self.changeParams, "Heat"))
        lyt.addWidget(self.Heat, 6, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Pressure Drop")),
            7, 1)
        self.DeltaP = Entrada_con_unidades(unidades.Pressure)
        self.DeltaP.valueChanged.connect(partial(self.changeParams, "DeltaP"))
        lyt.addWidget(self.DeltaP, 7, 2)

        lyt.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 8, 1, 1, 6)
        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Results"))
        lyt.addWidget(group, 9, 1, 1, 5)
        layout = QtWidgets.QGridLayout(group)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Output Temperature")), 1, 1)
        self.temperaturaCalculada = Entrada_con_unidades(unidades.Temperature,
                                                         retornar=False,
                                                         readOnly=True)
        layout.addWidget(self.temperaturaCalculada, 1, 2)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Air Flow")), 2,
            1)
        self.caudalVolumetrico = Entrada_con_unidades(unidades.VolFlow,
                                                      "QGas",
                                                      retornar=False,
                                                      readOnly=True)
        layout.addWidget(self.caudalVolumetrico, 2, 2)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate(
                    "pychemqt", "Output Air Relative Humidity")), 3, 1)
        self.HumedadCalculada = Entrada_con_unidades(float,
                                                     readOnly=True,
                                                     textounidad="%")
        layout.addWidget(self.HumedadCalculada, 3, 2)

        lyt.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 11, 1, 1,
            6)

        # Output Tab
        self.addSalida(QtWidgets.QApplication.translate("pychemqt", "Air"),
                       psychro=True)
        self.addSalida(
            QtWidgets.QApplication.translate("pychemqt", "Dry solid"))

        if equipment:
            self.setEquipment(equipment)
Beispiel #44
0
    def __init__(self, equipment=None, parent=None):
        """
        equipment: Initial equipment instance to model
        """
        super().__init__(Pump, entrada=False, salida=False, parent=parent)
        self.curva = [0, 0, []]

        # Calculate tab
        lyt = QtWidgets.QGridLayout(self.tabCalculo)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Output Pressure")), 1, 1)
        self.Pout = Entrada_con_unidades(Pressure)
        self.Pout.valueChanged.connect(partial(self.cambiar_data, "Pout"))
        lyt.addWidget(self.Pout, 1, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Pressure increase")), 2, 1)
        self.deltaP = Entrada_con_unidades(Pressure)
        self.deltaP.valueChanged.connect(partial(self.cambiar_data, "deltaP"))
        lyt.addWidget(self.deltaP, 2, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Head")), 3, 1)
        self.Carga = Entrada_con_unidades(Length, "Head")
        self.Carga.valueChanged.connect(partial(self.cambiar_data, "Carga"))
        lyt.addWidget(self.Carga, 3, 2)
        lyt.addItem(
            QtWidgets.QSpacerItem(10, 10, QtWidgets.QSizePolicy.Fixed,
                                  QtWidgets.QSizePolicy.Fixed), 4, 1, 1, 2)
        self.usarCurva = QtWidgets.QCheckBox(
            QtWidgets.QApplication.translate("pychemqt", "Pump curve"))
        self.usarCurva.toggled.connect(self.usarCurvaToggled)
        lyt.addWidget(self.usarCurva, 5, 1, 2, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Efficiency")), 7,
            1)
        self.rendimiento = Entrada_con_unidades(float,
                                                min=0,
                                                max=1,
                                                spinbox=True,
                                                step=0.01)
        self.rendimiento.valueChanged.connect(
            partial(self.cambiar_data, "rendimiento"))
        lyt.addWidget(self.rendimiento, 7, 2)
        lyt.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 8, 1, 1, 6)

        self.groupBox_Curva = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Pump curve"))
        self.groupBox_Curva.setEnabled(False)
        lyt.addWidget(self.groupBox_Curva, 5, 4, 3, 1)
        layout = QtWidgets.QGridLayout(self.groupBox_Curva)

        self.bottonCurva = QtWidgets.QPushButton(
            QtWidgets.QApplication.translate("pychemqt", "Curve"))
        self.bottonCurva.clicked.connect(self.bottonCurva_clicked)
        layout.addWidget(self.bottonCurva, 1, 1, 1, 2)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Variable")), 2,
            1)
        self.incognita = QtWidgets.QComboBox(self.tabCalculo)
        self.incognita.setToolTip(
            QtWidgets.QApplication.translate(
                "pychemqt",
                "If use curve, it can calculate the head or the flowrate, in that \
case it override flow of input stream"))
        self.incognita.addItem(
            QtWidgets.QApplication.translate("pychemqt", "Output pressure"))
        self.incognita.addItem(
            QtWidgets.QApplication.translate("pychemqt", "Flowrate"))
        self.incognita.currentIndexChanged.connect(
            partial(self.cambiar_data, "incognita"))
        layout.addWidget(self.incognita, 2, 2)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Diameter")), 3,
            1)
        self.diametro = Entrada_con_unidades(float,
                                             spinbox=True,
                                             step=0.1,
                                             suffix='"')
        self.diametro.valueChanged.connect(
            partial(self.cambiar_data, "diametro"))
        layout.addWidget(self.diametro, 3, 2)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "RPM")), 4, 1)
        self.velocidad = Entrada_con_unidades(int, spinbox=True, step=1)
        self.velocidad.valueChanged.connect(
            partial(self.cambiar_data, "velocidad"))
        layout.addWidget(self.velocidad, 4, 2)

        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Results"))
        layout = QtWidgets.QGridLayout(group)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Power")), 0, 0)
        self.power = Entrada_con_unidades(Power, retornar=False, readOnly=True)
        layout.addWidget(self.power, 0, 1)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Output Pressure")), 0, 4)
        self.PoutCalculada = Entrada_con_unidades(Pressure, retornar=False)
        self.PoutCalculada.setReadOnly(True)
        layout.addWidget(self.PoutCalculada, 0, 5)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Flowrate")), 1,
            0)
        self.volflow = Entrada_con_unidades(VolFlow, "QLiq", retornar=False)
        self.volflow.setReadOnly(True)
        layout.addWidget(self.volflow, 1, 1)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Head")), 1, 4)
        self.headCalculada = Entrada_con_unidades(Length, retornar=False)
        self.headCalculada.setReadOnly(True)
        layout.addWidget(self.headCalculada, 1, 5)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Efficiency")), 2,
            0)
        self.rendimientoCalculado = Entrada_con_unidades(float, width=60)
        self.rendimientoCalculado.setReadOnly(True)
        layout.addWidget(self.rendimientoCalculado, 2, 1)
        layout.addItem(
            QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Minimum), 0, 3)
        lyt.addWidget(group, 9, 1, 1, 6)
        lyt.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 10, 1, 1,
            6)

        # Design tab
        # self.tabDiseno = QtWidgets.QWidget()
        # lyt = QtWidgets.QGridLayout(self.tabDiseno)
        # lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
        #     "pychemqt",
        #     "Not implemented\n\nRef: Gülich - Centrifugal Pumps")), 0, 0)
        # self.tabWidget.insertTab(
        #     2, self.tabDiseno,
        #     QtWidgets.QApplication.translate("pychemqt", "Design"))

        # Cost tab
        lyt = QtWidgets.QGridLayout(self.tabCostos)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Pump type")), 1,
            1)
        self.tipo_bomba = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_BOMBA:
            self.tipo_bomba.addItem(txt)
        self.tipo_bomba.currentIndexChanged.connect(
            self.bomba_currentIndexChanged)
        lyt.addWidget(self.tipo_bomba, 1, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Centrifuge type")), 2, 1)
        self.tipo_centrifuga = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_CENTRIFUGA:
            self.tipo_centrifuga.addItem(txt)
        self.tipo_centrifuga.currentIndexChanged.connect(
            partial(self.changeParamsCoste, "tipo_centrifuga"))
        lyt.addWidget(self.tipo_centrifuga, 2, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Material")), 3,
            1)
        self.material = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_MATERIAL:
            self.material.addItem(txt)
        self.material.currentIndexChanged.connect(
            partial(self.changeParamsCoste, "material"))
        lyt.addWidget(self.material, 3, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Motor type")), 4,
            1)
        self.motor = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_MOTOR:
            self.motor.addItem(txt)
        self.motor.currentIndexChanged.connect(
            partial(self.changeParamsCoste, "motor"))
        lyt.addWidget(self.motor, 4, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Motor RPM")), 5,
            1)
        self.rpm = QtWidgets.QComboBox(self.tabCostos)
        for txt in self.Equipment.TEXT_RPM:
            self.rpm.addItem(txt)
        self.rpm.currentIndexChanged.connect(
            partial(self.changeParamsCoste, "rpm"))
        lyt.addWidget(self.rpm, 5, 2)

        self.Costos = CostData(self.Equipment)
        self.Costos.valueChanged.connect(self.changeParamsCoste)
        lyt.addWidget(self.Costos, 6, 1, 2, 4)

        lyt.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 7, 1, 1, 4)
        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Stimated costs"))
        lyt.addWidget(group, 8, 1, 1, 4)
        layout = QtWidgets.QGridLayout(group)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Pump")), 0, 0)
        self.C_bomba = Entrada_con_unidades(Currency, retornar=False)
        self.C_bomba.setReadOnly(True)
        layout.addWidget(self.C_bomba, 0, 1)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Motor")), 1, 0)
        self.C_motor = Entrada_con_unidades(Currency, retornar=False)
        self.C_bomba.setReadOnly(True)
        layout.addWidget(self.C_motor, 1, 1)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Purchase cost")),
            0, 4)
        self.C_adq = Entrada_con_unidades(Currency, retornar=False)
        self.C_adq.setReadOnly(True)
        layout.addWidget(self.C_adq, 0, 5)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Installed cost")), 1, 4)
        self.C_inst = Entrada_con_unidades(Currency, retornar=False)
        self.C_inst.setReadOnly(True)
        layout.addWidget(self.C_inst, 1, 5)
        lyt.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed,
                                  QtWidgets.QSizePolicy.Fixed), 9, 1, 1, 4)

        if equipment:
            self.setEquipment(equipment)
Beispiel #45
0
    def __init__(self, equipment=None, parent=None):
        """
        equipment: Initial equipment instance to model
        """
        super().__init__(Scrubber, parent=parent)

        # Input tab
        self.entradaGas = UI_corriente.Ui_corriente(psychro=True)
        self.entradaGas.Changed.connect(
            partial(self.changeParams, "entradaGas"))
        self.Entrada.addTab(
            self.entradaGas,
            QtWidgets.QApplication.translate("equipment", "Gas"))
        self.entradaLiquido = UI_corriente.Ui_corriente()
        self.entradaLiquido.Changed.connect(
            partial(self.changeParams, "entradaLiquido"))
        self.Entrada.addTab(
            self.entradaLiquido,
            QtWidgets.QApplication.translate("pychemqt", "Liquid"))

        # Calculate tab
        gridLayout_Calculo = QtWidgets.QGridLayout(self.tabCalculo)
        gridLayout_Calculo.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Mode")), 1, 1)
        self.tipo_calculo = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_TIPO:
            self.tipo_calculo.addItem(txt)
        self.tipo_calculo.currentIndexChanged.connect(
            self.on_tipoCalculo_currentIndexChanged)
        gridLayout_Calculo.addWidget(self.tipo_calculo, 1, 2, 1, 5)
        gridLayout_Calculo.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Method")), 2, 1)
        self.modelo_rendimiento = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_MODEL:
            self.modelo_rendimiento.addItem(txt)
        self.modelo_rendimiento.currentIndexChanged.connect(
            self.on_modeloRendimiento_currentIndexChanged)
        gridLayout_Calculo.addWidget(self.modelo_rendimiento, 2, 2, 1, 5)
        gridLayout_Calculo.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "ΔP method")), 3,
            1)
        self.modelo_DeltaP = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_MODEL_DELTAP:
            self.modelo_DeltaP.addItem(txt)
        self.modelo_DeltaP.currentIndexChanged.connect(
            self.on_modeloDeltaP_currentIndexChanged)
        gridLayout_Calculo.addWidget(self.modelo_DeltaP, 3, 2, 1, 5)

        gridLayout_Calculo.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed,
                                  QtWidgets.QSizePolicy.Fixed), 4, 1, 1, 6)
        gridLayout_Calculo.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Diameter")), 5,
            1)
        self.diametro = Entrada_con_unidades(Length)
        self.diametro.valueChanged.connect(
            partial(self.changeParams, "diametro"))
        gridLayout_Calculo.addWidget(self.diametro, 5, 2)
        gridLayout_Calculo.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Efficiency")), 6,
            1)
        self.rendimientoAdmisible = Entrada_con_unidades(float, spinbox=True)
        self.rendimientoAdmisible.valueChanged.connect(
            partial(self.changeParams, "rendimientoAdmisible"))
        gridLayout_Calculo.addWidget(self.rendimientoAdmisible, 6, 2)

        self.groupJohnstone = QtWidgets.QWidget()
        gridLayout_Calculo.addWidget(self.groupJohnstone, 7, 1, 1, 2)
        JohnstoneLayout = QtWidgets.QHBoxLayout(self.groupJohnstone)
        JohnstoneLayout.setSpacing(0)
        JohnstoneLayout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Ventury Constant")))
        self.k = Entrada_con_unidades(float, spinbox=True)
        self.k.valueChanged.connect(partial(self.changeParams, "k"))
        JohnstoneLayout.addWidget(self.k)

        self.groupCalvert = QtWidgets.QWidget()
        gridLayout_Calculo.addWidget(self.groupCalvert, 7, 1, 1, 2)
        CalvertLayout = QtWidgets.QHBoxLayout(self.groupCalvert)
        CalvertLayout.setSpacing(0)
        CalvertLayout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "f parameter")))
        self.f = Entrada_con_unidades(float, spinbox=True)
        self.f.valueChanged.connect(partial(self.changeParams, "f"))
        CalvertLayout.addWidget(self.f)

        self.groupLt = QtWidgets.QWidget()
        gridLayout_Calculo.addWidget(self.groupLt, 5, 4, 1, 2)
        LtLayout = QtWidgets.QHBoxLayout(self.groupLt)
        LtLayout.setSpacing(0)
        LtLayout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Length throat")))
        self.Lt = Entrada_con_unidades(Length)
        self.Lt.valueChanged.connect(partial(self.changeParams, "Lt"))
        LtLayout.addWidget(self.Lt)

        gridLayout_Calculo.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 8, 1, 1, 6)
        self.groupBox_Calculo = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Results"))
        gridLayout_Calculo.addWidget(self.groupBox_Calculo, 9, 1, 1, 5)
        gridLayout_1 = QtWidgets.QGridLayout(self.groupBox_Calculo)
        gridLayout_1.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Efficiency")), 1,
            1)
        self.rendimiento = Entrada_con_unidades(float,
                                                retornar=False,
                                                readOnly=True)
        gridLayout_1.addWidget(self.rendimiento, 1, 2)
        gridLayout_1.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "DeltaP")), 2, 1)
        self.deltaP = Entrada_con_unidades(DeltaP,
                                           retornar=False,
                                           readOnly=True)
        gridLayout_1.addWidget(self.deltaP, 2, 2)

        gridLayout_Calculo.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 11, 1, 1,
            6)

        # Output Tab
        self.SalidaGas = UI_corriente.Ui_corriente(readOnly=True, psychro=True)
        self.Salida.addTab(
            self.SalidaGas,
            QtWidgets.QApplication.translate("pychemqt", "Clean Gas"))
        self.SalidaLiquido = UI_corriente.Ui_corriente(readOnly=True)
        self.Salida.addTab(
            self.SalidaLiquido,
            QtWidgets.QApplication.translate("pychemqt", "Liquid"))

        self.on_tipoCalculo_currentIndexChanged(0)
        self.on_modeloRendimiento_currentIndexChanged(0)
        self.on_modeloDeltaP_currentIndexChanged(0)
        if equipment:
            self.setEquipment(equipment)
Beispiel #46
0
    def __init__(self, equipment=None, parent=None):
        """
        equipment: Initial equipment instance to model
        """
        super().__init__(Hairpin, parent=parent)

        # Input tab
        self.addEntrada(QtWidgets.QApplication.translate(
            "pychemqt", "Tube"), "entradaTubo")
        self.addEntrada(QtWidgets.QApplication.translate(
            "pychemqt", "Annulli"), "entradaExterior")

        # Pipe catalog tab
        tabCatalogo = QtWidgets.QWidget()
        self.tabWidget.insertTab(
            1, tabCatalogo,
            QtWidgets.QApplication.translate("pychemqt", "Catalog"))
        lyt = QtWidgets.QGridLayout(tabCatalogo)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Tube length")), 4, 1)
        self.LTube = Entrada_con_unidades(Length)
        self.LTube.valueChanged.connect(partial(self.changeParams, "LTube"))
        lyt.addWidget(self.LTube, 4, 2)
        lyt.addItem(QtWidgets.QSpacerItem(
            10, 10, QtWidgets.QSizePolicy.Fixed,
            QtWidgets.QSizePolicy.Fixed), 5, 1)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Tube internal diameter")), 6, 1)
        self.DiTube = Entrada_con_unidades(Length, "pipeDiameter")
        self.DiTube.valueChanged.connect(partial(self.changeParams, "DiTube"))
        lyt.addWidget(self.DiTube, 6, 2)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Tube external diameter")), 7, 1)
        self.DeTube = Entrada_con_unidades(Length, "pipeDiameter")
        self.DeTube.valueChanged.connect(partial(self.changeParams, "DeTube"))
        lyt.addWidget(self.DeTube, 7, 2)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Tube thickness")), 8, 1)
        self.wTube = Entrada_con_unidades(Length, "Thickness")
        self.wTube.valueChanged.connect(partial(self.changeParams, "wTube"))
        lyt.addWidget(self.wTube, 8, 2)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Tube roughness")), 9, 1)
        self.rTube = Entrada_con_unidades(Length, "Thickness")
        self.rTube.valueChanged.connect(partial(self.changeParams, "rTube"))
        lyt.addWidget(self.rTube, 9, 2)
        lyt.addItem(QtWidgets.QSpacerItem(
            10, 10, QtWidgets.QSizePolicy.Fixed,
            QtWidgets.QSizePolicy.Fixed), 10, 1)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Annulli external diameter")), 11, 1)
        self.DeeTube = Entrada_con_unidades(Length, "pipeDiameter")
        self.DeeTube.valueChanged.connect(
            partial(self.changeParams, "DeeTube"))
        lyt.addWidget(self.DeeTube, 11, 2)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Thermal conductivity")), 12, 1)
        self.kTube = Entrada_con_unidades(ThermalConductivity)
        self.kTube.valueChanged.connect(partial(self.changeParams, "kTube"))
        lyt.addWidget(self.kTube, 12, 2)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Tube Count")), 13, 1)
        self.nTube = Entrada_con_unidades(int)
        self.nTube.valueChanged.connect(partial(self.changeParams, "nTube"))
        lyt.addWidget(self.nTube, 13, 2)

        buttonPipe = QtWidgets.QPushButton(
            QtWidgets.QApplication.translate("pychemqt", "Pipe Database"))
        buttonPipe.clicked.connect(self.showMaterial)
        lyt.addWidget(buttonPipe, 6, 3, 4, 1)
        lyt.addItem(QtWidgets.QSpacerItem(
            10, 10, QtWidgets.QSizePolicy.Fixed,
            QtWidgets.QSizePolicy.Fixed), 14, 1)
        self.tubeFinned = QtWidgets.QCheckBox(
            QtWidgets.QApplication.translate("pychemqt", "Finned Tube"))
        lyt.addWidget(self.tubeFinned, 15, 1, 1, 4)
        self.buttonFin = QtWidgets.QPushButton(
            QtWidgets.QApplication.translate(
                "pychemqt", "Finned Pipe Database"))
        self.buttonFin.setEnabled(False)
        self.buttonFin.clicked.connect(self.showFinTube)
        lyt.addWidget(self.buttonFin, 15, 3)
        self.tubeFinned.toggled.connect(
            partial(self.changeParams, "tubeFinned"))
        self.tubeFinned.toggled.connect(self.buttonFin.setEnabled)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Inside Fouling")), 16, 1)
        self.tubeFouling = FoulingWidget()
        self.tubeFouling.valueChanged.connect(
            partial(self.changeParams, "tubeFouling"))
        lyt.addWidget(self.tubeFouling, 16, 2, 1, 5)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Outside Fouling")), 17, 1)
        self.annulliFouling = FoulingWidget()
        self.annulliFouling.valueChanged.connect(
            partial(self.changeParams, "annulliFouling"))
        lyt.addWidget(self.annulliFouling, 17, 2, 1, 5)
        lyt.addItem(QtWidgets.QSpacerItem(
            10, 10, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 20, 1, 1, 6)

        # Calculate tab
        lyt = QtWidgets.QGridLayout(self.tabCalculo)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Mode")), 1, 1)
        self.modo = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_MODO:
            self.modo.addItem(txt)
        self.modo.currentIndexChanged.connect(
            partial(self.changeParams, "modo"))
        lyt.addWidget(self.modo, 1, 2)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Flujo")), 2, 1)
        self.flujo = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_FLUJO:
            self.flujo.addItem(txt)
        self.flujo.currentIndexChanged.connect(
            partial(self.changeParams, "flujo"))
        lyt.addWidget(self.flujo, 2, 2)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Layout")), 3, 1)
        self.orientacion = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_ORIENTACION:
            self.orientacion.addItem(txt)
        self.orientacion.currentIndexChanged.connect(
            partial(self.changeParams, "orientacion"))
        lyt.addWidget(self.orientacion, 3, 2)

        lyt.addItem(QtWidgets.QSpacerItem(
            10, 10, QtWidgets.QSizePolicy.Fixed,
            QtWidgets.QSizePolicy.Fixed), 4, 1)

        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Output inside temperature")), 5, 1)
        self.tubeTout = Entrada_con_unidades(Temperature)
        self.tubeTout.valueChanged.connect(
            partial(self.changeParams, "tubeTout"))
        lyt.addWidget(self.tubeTout, 5, 2)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Output annulli temperature")), 6, 1)
        self.annulliTout = Entrada_con_unidades(Temperature)
        self.annulliTout.valueChanged.connect(
            partial(self.changeParams, "annulliTout"))
        lyt.addWidget(self.annulliTout, 6, 2)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Output inside quality")), 5, 4)
        self.tubeXout = Entrada_con_unidades(float)
        self.tubeXout.valueChanged.connect(
            partial(self.changeParams, "tubeXout"))
        lyt.addWidget(self.tubeXout, 5, 5)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Output annulli quality")), 6, 4)
        self.annulliXout = Entrada_con_unidades(float)
        self.annulliXout.valueChanged.connect(
            partial(self.changeParams, "annulliXout"))
        lyt.addWidget(self.annulliXout, 6, 5)

        lyt.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 15, 1, 1, 6)

        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Results"))
        lyt.addWidget(group, 16, 1, 1, 6)
        layout = QtWidgets.QGridLayout(group)
        layout.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Heat Duty")), 0, 1)
        self.Q = Entrada_con_unidades(Power, retornar=False, readOnly=True)
        layout.addWidget(self.Q, 0, 2)
        layout.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Tout Tube")), 1, 1)
        self.ToutTube = Entrada_con_unidades(Temperature, retornar=False)
        self.ToutTube.setReadOnly(True)
        layout.addWidget(self.ToutTube, 1, 2)
        layout.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Tout Tube")), 2, 1)
        self.ToutAnnulli = Entrada_con_unidades(Temperature, retornar=False)
        self.ToutAnnulli.setReadOnly(True)
        layout.addWidget(self.ToutAnnulli, 2, 2)
        layout.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "U")), 0, 4)
        self.U = Entrada_con_unidades(HeatTransfCoef, retornar=False)
        self.U.setReadOnly(True)
        layout.addWidget(self.U, 0, 5)
        layout.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Area")), 1, 4)
        self.A = Entrada_con_unidades(Area, retornar=False, readOnly=True)
        layout.addWidget(self.A, 1, 5)
        layout.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Lenght")), 2, 4)
        self.L = Entrada_con_unidades(Length, retornar=False, readOnly=True)
        layout.addWidget(self.L, 2, 5)
        layout.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "DeltaP Tube")), 0, 7)
        self.deltaPTube = Entrada_con_unidades(DeltaP, retornar=False)
        self.deltaPTube.setReadOnly(True)
        layout.addWidget(self.deltaPTube, 0, 8)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "DeltaP Annulli")), 1, 7)
        self.deltaPAnnulli = Entrada_con_unidades(DeltaP, retornar=False)
        self.deltaPAnnulli.setReadOnly(True)
        layout.addWidget(self.deltaPAnnulli, 1, 8)
        layout.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "CF")), 2, 7)
        self.CF = Entrada_con_unidades(float, retornar=False, readOnly=True)
        layout.addWidget(self.CF, 2, 8)

        lyt.addItem(QtWidgets.QSpacerItem(
            0, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            17, 1, 1, 6)

        # Cost tab
        lyt = QtWidgets.QGridLayout(self.tabCostos)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Material")), 2, 1)
        self.material = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_MATERIAL:
            self.material.addItem(txt)
        self.material.currentIndexChanged.connect(
            partial(self.changeParamsCoste, "material"))
        lyt.addWidget(self.material, 2, 2)
        lyt.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 3, 0, 1, 6)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Design Pressure")), 4, 1)
        self.P_dis = Entrada_con_unidades(Pressure)
        self.P_dis.valueChanged.connect(
            partial(self.changeParamsCoste, "P_dis"))
        lyt.addWidget(self.P_dis, 4, 2, 1, 1)
        lyt.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 5, 0, 1, 6)

        self.Costos = CostData(self.Equipment)
        self.Costos.valueChanged.connect(self.changeParamsCoste)
        lyt.addWidget(self.Costos, 6, 1, 2, 5)

        lyt.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 8, 0, 1, 6)
        lyt.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 10, 0, 1, 6)
        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Stimated Costs"))
        lyt.addWidget(group, 9, 1, 1, 5)
        layout = QtWidgets.QGridLayout(group)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Purchase Cost")), 0, 1)
        self.C_adq = Entrada_con_unidades(Currency, retornar=False)
        self.C_adq.setReadOnly(True)
        layout.addWidget(self.C_adq, 0, 2)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Installed Cost")), 1, 1)
        self.C_inst = Entrada_con_unidades(Currency, retornar=False)
        self.C_inst.setReadOnly(True)
        self.C_inst.entrada.setReadOnly(True)
        layout.addWidget(self.C_inst, 1, 2)

        # Output Tab
        self.addSalida(QtWidgets.QApplication.translate("pychemqt", "Tube"))
        self.addSalida(QtWidgets.QApplication.translate("pychemqt", "Annulli"))

        if equipment:
            self.setEquipment(equipment)
Beispiel #47
0
    def __init__(self, reaccion=None, parent=None):
        super(UI_reacciones, self).__init__(parent)
        self.evaluate=Evaluate()
        self.evaluate.finished.connect(self.rellenar)
        self.indices, self.nombres, M=getComponents()
        gridLayout = QtWidgets.QGridLayout(self)

        lyt=QtWidgets.QHBoxLayout()
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("pychemqt", "Key component")))
        self.key=QtWidgets.QComboBox()
        for i, nombre in enumerate(self.nombres):
            self.key.addItem("%i - %s" %(i+1, nombre))
        self.key.currentIndexChanged.connect(partial(self.changeParams, "key"))
        lyt.addWidget(self.key)
        lyt.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Fixed))
        gridLayout.addLayout(lyt,1,1,1,5)

        lyt=QtWidgets.QHBoxLayout()
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("pychemqt", "Phase")))
        self.fase=QtWidgets.QComboBox()
        for txt in reaction.Reaction.TEXT_PHASE:
            self.fase.addItem(txt)
        self.fase.currentIndexChanged.connect(partial(self.changeParams, "fase"))
        lyt.addWidget(self.fase)
        self.Formula=QtWidgets.QLabel()
        self.Formula.setAlignment(QtCore.Qt.AlignCenter)
        self.Formula.setSizePolicy(QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Fixed)
        lyt.addWidget(self.Formula)
        gridLayout.addLayout(lyt,2,1,1,5)

        lyt=QtWidgets.QVBoxLayout()
        title=self.nombres[:]
        title.append("")
        self.Estequiometria=Tabla(1, verticalHeaderLabels=title, horizontalHeader=[QtWidgets.QApplication.translate("pychemqt", "Coefficients")], filas=len(self.indices))
        self.Estequiometria.setFixedHeight(22*len(self.indices)+22+4+22)
        lyt.addWidget(self.Estequiometria)
        self.Estequiometria.addRow()
        brush=QtGui.QBrush(QtGui.QColor("#eaeaea"))
        self.Estequiometria.item(len(self.indices), 0).setBackground(brush)
        self.Estequiometria.item(len(self.indices), 0).setFlags(QtCore.Qt.NoItemFlags)
        self.Estequiometria.cellChanged.connect(self.reaccionCambiada)
        lyt.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Expanding))
        gridLayout.addLayout(lyt,3,1,1,2)

        lyt=QtWidgets.QGridLayout()
        lyt.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Fixed),1,1)
        self.formula=QtWidgets.QCheckBox(QtWidgets.QApplication.translate("pychemqt", "Use name in formula"))
        self.formula.toggled.connect(partial(self.changeParams, "formula"))
        lyt.addWidget(self.formula,1,2,1,2)
        self.customHr=QtWidgets.QCheckBox("ΔHr "+QtWidgets.QApplication.translate("pychemqt", "user specified"))
        self.customHr.toggled.connect(self.changeHr)
        lyt.addWidget(self.customHr,2,2,1,2)
        lyt.addWidget(QtWidgets.QLabel("ΔHr<sup>o</sup>"),3,2)
        self.Hr=Entrada_con_unidades(unidades.MolarEnthalpy, readOnly=True)
        self.Hr.valueChanged.connect(partial(self.changeParams, "Hr"))
        lyt.addWidget(self.Hr,3,3)
        lyt.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Expanding))
        gridLayout.addLayout(lyt,3,3,1,2)

        gridLayout.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Fixed),4,2)

        lyt=QtWidgets.QHBoxLayout()
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("pychemqt", "Type")))
        self.tipo=QtWidgets.QComboBox()
        for txt in reaction.Reaction.TEXT_TYPE:
            self.tipo.addItem(txt)
        self.tipo.currentIndexChanged.connect(partial(self.changeParams, "tipo"))
        lyt.addWidget(self.tipo)
        lyt.addItem(QtWidgets.QSpacerItem(20,10,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Fixed))
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("pychemqt", "Concentration")))
        self.base=QtWidgets.QComboBox()
        for txt in reaction.Reaction.TEXT_BASE:
            self.base.addItem(txt)
        self.base.currentIndexChanged.connect(partial(self.changeParams, "base"))
        lyt.addWidget(self.base)
        lyt.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Fixed))
        gridLayout.addLayout(lyt,5,1,1,5)

        self.stacked = QtWidgets.QStackedWidget()
        self.tipo.currentIndexChanged.connect(self.stacked.setCurrentIndex)
        gridLayout.addWidget(self.stacked,6,1,1,5)
        gridLayout.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),7,1,1,5)

        widget=QtWidgets.QWidget()
        self.stacked.addWidget(widget)
        lyt=QtWidgets.QGridLayout(widget)
        lyt.addWidget(QtWidgets.QLabel("<h3>"+QtWidgets.QApplication.translate("pychemqt", "Estequiometric reaction")+"</h3>"),1,1,1,4)
        self.Conversion=Tabla(1, verticalHeaderModel="C", filas=3)
        self.Conversion.setConnected()
        self.Conversion.setFixedWidth(100)
        lyt.addWidget(self.Conversion,2,1,3,1)
        label=QtWidgets.QLabel()
        label.setPixmap(QtGui.QPixmap(os.environ["pychemqt"]+"/images/equation/reaction_conversion.png"))
        lyt.addWidget(label,2,2,1,3)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("pychemqt", "Temperature unit")),3,2)
        self.unidadesTemperatura=QtWidgets.QComboBox()
        for i in unidades.Temperature.__text__:
            self.unidadesTemperatura.addItem(i)
        lyt.addWidget(self.unidadesTemperatura,3,3)
        lyt.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),4,4)
        lyt.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),5,1,1,5)


        widget=QtWidgets.QWidget()
        self.stacked.addWidget(widget)
        lyt=QtWidgets.QGridLayout(widget)
        self.check_KFijo=QtWidgets.QRadioButton(QtWidgets.QApplication.translate("pychemqt", "Fixed"))
        self.check_KFijo.toggled.connect(self.KeqChanged)
        lyt.addWidget(self.check_KFijo,1,1,1,2)
        lyt.addWidget(QtWidgets.QLabel("K<sub>eq</sub>"),1,3)
        self.Keq=Entrada_con_unidades(float)
        lyt.addWidget(self.Keq,1,4)
        label=QtWidgets.QLabel()
        label.setPixmap(QtGui.QPixmap(os.environ["pychemqt"]+"/images/equation/reaction_equilibrium.png"))
        lyt.addWidget(label,1,5,1,4)

        self.check_KEq=QtWidgets.QRadioButton(QtWidgets.QApplication.translate("pychemqt", "Equation"))
        self.check_KEq.toggled.connect(self.KeqChanged)
        lyt.addWidget(self.check_KEq,2,1,1,2)
        self.check_KTabla=QtWidgets.QRadioButton(QtWidgets.QApplication.translate("pychemqt", "Table"))
        self.check_KTabla.toggled.connect(self.KeqChanged)
        lyt.addWidget(self.check_KTabla,2,5,1,2)
        self.KEq_Dat=Tabla(1, verticalHeaderLabels=["A", "B", "C", "D", "E", "F", "G", "H"], filas=8)
        self.KEq_Dat.setFixedHeight(22*8+4)
        self.KEq_Dat.setFixedWidth(120)
        lyt.addWidget(self.KEq_Dat,3,3,1,2)
        self.KEq_Tab=Tabla(4, horizontalHeader=["T, K", "Keq", "Kcalc", "%Error"], verticalHeader=False, columnReadOnly=[False, False, True, True])
        self.KEq_Tab.setSizePolicy(QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding)
        self.KEq_Tab.setFixedWidth(400)
        self.KEq_Tab.setConnected()
        self.KEq_Tab.rowFinished.connect(self.Regresion)
        self.KEq_Tab.setAlternatingRowColors(False)
        lyt.addWidget(self.KEq_Tab,3,5,1,4)
        lyt.addWidget(QtWidgets.QLabel("r²"),4,5)
        self.r2=Entrada_con_unidades(float, readOnly=True)
        lyt.addWidget(self.r2,4,6)
        self.botonTablaPlot=QtWidgets.QPushButton(QtGui.QIcon(QtGui.QPixmap(os.environ["pychemqt"]+"/images/button/plot.png")), QtWidgets.QApplication.translate("pychemqt", "Plot"))
        self.botonTablaPlot.clicked.connect(self.Plot)
        lyt.addWidget(self.botonTablaPlot,4,7)
        self.botonTablaClear=QtWidgets.QPushButton(QtGui.QIcon(QtGui.QPixmap(os.environ["pychemqt"]+"/images/button/clear.png")), QtWidgets.QApplication.translate("pychemqt", "Clear"))
        self.botonTablaClear.clicked.connect(self.KEq_Tab.clear)
        lyt.addWidget(self.botonTablaClear,4,8)
        label=QtWidgets.QLabel()
        label.setPixmap(QtGui.QPixmap(os.environ["pychemqt"]+"/images/equation/reaction_equilibrium2.png"))
        label.setAlignment(QtCore.Qt.AlignCenter)
        lyt.addWidget(label,5,1,1,8)


        self.checkGibbs=QtWidgets.QRadioButton(QtWidgets.QApplication.translate("pychemqt", "From Gibbs free energy minimization"))
        lyt.addWidget(self.checkGibbs,6,1,1,4)

        self.check_KFijo.setChecked(True)


        widget=QtWidgets.QWidget()
        self.stacked.addWidget(widget)
        lyt=QtWidgets.QGridLayout(widget)

        widget=QtWidgets.QWidget()
        self.stacked.addWidget(widget)
        lyt=QtWidgets.QGridLayout(widget)

        self.status=Status()
        gridLayout.addWidget(self.status, 10,1)
        self.buttonBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
        gridLayout.addWidget(self.buttonBox,10,2,1,4)

        if reaccion:
            self.setReaction(reaccion)
Beispiel #48
0
    def __init__(self, entrada=None, parent=None):
        """entrada: Parametro opcional de clase corriente que indica la corriente de entrada en kla tubería"""
        super(UI_equipment, self).__init__(Centrifuge, entrada=False, parent=parent)
        self.entrada=entrada

        #Pestaña entrada
        self.Entrada= UI_corriente.Ui_corriente(entrada)
        self.Entrada.Changed.connect(self.cambiar_entrada)
        self.tabWidget.insertTab(0, self.Entrada,QtWidgets.QApplication.translate("equipment", "Entrada", None))

        #Pestaña calculo
        gridLayout_Calculo = QtWidgets.QGridLayout(self.tabCalculo)

        #Pestaña costos
        gridLayout_Costos = QtWidgets.QGridLayout(self.tabCostos)
        gridLayout_Costos.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Tipo:", None)), 1, 1, 1, 1)
        self.tipo=QtWidgets.QComboBox()
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "Proceso inorgánico", None))
        self.tipo.addItem(QtWidgets.QApplication.translate("equipment", "Proceso orgánico", None))
        self.tipo.currentIndexChanged.connect(self.mostrarSubclasificacion)
        self.tipo.currentIndexChanged.connect(self.calcularCostos)
        gridLayout_Costos.addWidget(self.tipo, 1, 2, 1, 1)
        gridLayout_Costos.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Material:", None)), 2, 1, 1, 1)
        self.materialInorganico=QtWidgets.QComboBox()
        self.materialInorganico.addItem(QtWidgets.QApplication.translate("equipment", "Acero al carbón", None))
        self.materialInorganico.addItem(QtWidgets.QApplication.translate("equipment", "Acero inoxidable 316", None))
        self.materialInorganico.addItem(QtWidgets.QApplication.translate("equipment", "Monel", None))
        self.materialInorganico.addItem(QtWidgets.QApplication.translate("equipment", "Níquel", None))
        self.materialInorganico.currentIndexChanged.connect(self.calcularCostos)
        gridLayout_Costos.addWidget(self.materialInorganico, 2, 2, 1, 1)
        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Fixed),3,0,1,2)
        self.materialOrganico=QtWidgets.QComboBox()
        self.materialOrganico.addItem(QtWidgets.QApplication.translate("equipment", "Acero al carbón", None))
        self.materialOrganico.addItem(QtWidgets.QApplication.translate("equipment", "Acero inoxidable 316", None))
        self.materialOrganico.addItem(QtWidgets.QApplication.translate("equipment", "Monel", None))
        self.materialOrganico.addItem(QtWidgets.QApplication.translate("equipment", "Níquel", None))
        self.materialOrganico.addItem(QtWidgets.QApplication.translate("equipment", "Hastelloy", None))
        self.materialOrganico.currentIndexChanged.connect(self.calcularCostos)
        gridLayout_Costos.addWidget(self.materialOrganico, 2, 2, 1, 1)
        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Fixed),3,0,1,6)
        gridLayout_Costos.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Caudal calculado:", None)), 4, 1, 1, 1)
        self.caudalcalculado=Entrada_con_unidades(unidades.MassFlow, readOnly=True, retornar=False)
        gridLayout_Costos.addWidget(self.caudalcalculado,4,2,1,1)
        gridLayout_Costos.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Caudal de diseño:", None)), 5, 1, 1, 1)
        self.caudaldiseno=Entrada_con_unidades(unidades.MassFlow)
        gridLayout_Costos.addWidget(self.caudaldiseno,5,2,1,1)
        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Fixed),6,0,1,6)

        self.Costos=costIndex.CostData(1.3, 2)
        self.Costos.valueChanged.connect(self.calcularCostos)
        gridLayout_Costos.addWidget(self.Costos,7,1,2,2)

        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),9,0,1,6)
        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),11,0,1,6)
        self.groupBox_Costos = QtWidgets.QGroupBox(QtWidgets.QApplication.translate("equipment", "Costos calculados", None))
        gridLayout_Costos.addWidget(self.groupBox_Costos,10,0,1,6)
        gridLayout_5 = QtWidgets.QGridLayout(self.groupBox_Costos)
        gridLayout_5.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Coste Adquisición:", None)),0,1,1,1)
        self.C_adq=Entrada_con_unidades(unidades.Currency, retornar=False, readOnly=True)
        gridLayout_5.addWidget(self.C_adq,0,2,1,1)
        gridLayout_5.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Coste Instalación:", None)),1,1,1,1)
        self.C_inst=Entrada_con_unidades(unidades.Currency, retornar=False, readOnly=True)
        gridLayout_5.addWidget(self.C_inst,1,2,1,1)

        self.tabWidget.setCurrentIndex(0)
        self.mostrarSubclasificacion(0)
Beispiel #49
0
class FoulingWidget(QtGui.QWidget):
    """Widget con los parametros de fouling de tuberias"""
    valueChanged = QtCore.pyqtSignal(float)
    Fouling_Factor = {
        "Industrial": {
            "Fuel oil no.2": 0.000352,
            "Fuel oil no.6": 0.000881,
            "Transformer oil": 0.000173,
            "Engine Lube oil": 0.000173,
            "Quench oil": 0.000705,
            "Manufactured gas": 0.001761,
            "Engine exhaust gas": 0.001761,
            "Steam (nonoil bearing)": 0.000088,
            "Exhaust steam (oil bearing)": 0.0003,
            "Refrigerant vapors (Oil bearing)": 0.000352,
            "Compressed air": 0.000176,
            "Ammonia vapor": 0.000176,
            "CO2 vapor": 0.000176,
            "Chlorine vapor": 0.000352,
            "Coal flue gas": 0.001761,
            "Natural gas flue gas": 0.000881,
            "Molten heat transfer salts": 0.000088,
            "Refrigerant liquids": 0.000176,
            "Hydraulic fluid": 0.000176,
            "Industrial organic heat transfer media": 0.000352,
            "Ammonia liquid": 0.000176,
            "Ammonia liquid (oil bearing)": 0.000528,
            "Calcium chloride solutions": 0.000528,
            "Sodium chloride solutions": 0.000528,
            "CO2 liquid": 0.000176,
            "Chlorine liquid": 0.000352,
            "Methanol solutions": 0.000352,
            "Ethanol solutions": 0.000352,
            "Ethilene glycol solutions": 0.000352},
        "Chemical": {
            "Acid gases": 0.00044,
            "Solvent vapors": 0.000176,
            "Stable overhead products": 0.000176,
            "MEA and DEA solutions": 0.000352,
            "DEG and TEG solutions": 0.000352,
            "Stable side draw and bottom product": 0.00026,
            "Caustic solutions": 0.000352,
            "Vegetable oils": 0.000528},
        "Natural Gas-Gasoline": {
            "Natural gas": 0.00026,
            "Overhead products": 0.00026,
            "Lean oil": 0.000352,
            "Rich oil": 0.00026,
            "Natural gasoline": 0.00026,
            "Liquified petroleum gases": 0.00026},
        u"Water (T<50C, v<0.9)": {
            "Seawater": 0.000088,
            "Brackish water": 0.000352,
            "Cooling tower (treated)": 0.000176,
            "Cooling tower (untreaterd)": 0.000528,
            "City or well water": 0.000176,
            "River water minimum": 0.000352,
            "River water average": 0.000528,
            "Muddy or silty": 0.000528,
            "Hard (>15 grains/gal": 0.000528,
            "Engine jacket": 0.000176,
            "Distilled, condensate": 0.000088,
            "Distilled, boiler blowdown": 0.000352,
            "Distilled, treated boiler feedwater": 0.000176},
        u"Water (T<50C, v>0.9)": {
            "Seawater": 0.000088,
            "Brackish water": 0.000176,
            "Cooling tower (treated)": 0.000176,
            "Cooling tower (untreaterd)": 0.000528,
            "City or well water": 0.000176,
            "River water minimum": 0.000176,
            "River water average": 0.000352,
            "Muddy or silty": 0.000352,
            "Hard (>15 grains/gal": 0.000528,
            "Engine jacket": 0.000176,
            "Distilled, condensate": 0.000088,
            "Distilled, boiler blowdown": 0.000352,
            "Distilled, treated boiler feedwater": 0.000088},
        u"Water (T>50C, v<0.9)": {
            "Seawater": 0.000176,
            "Brackish water": 0.000528,
            "Cooling tower (treated)": 0.000352,
            "Cooling tower (untreaterd)": 0.000881,
            "City or well water": 0.000352,
            "River water minimum": 0.000528,
            "River water average": 0.000705,
            "Muddy or silty": 0.000705,
            "Hard (>15 grains/gal": 0.000881,
            "Engine jacket": 0.000176,
            "Distilled, condensate": 0.000088,
            "Distilled, boiler blowdown": 0.000352,
            "Distilled, treated boiler feedwater": 0.000176},
        u"Water (T>50C, v>0.9)": {
            "Seawater": 0.000176,
            "Brackish water": 0.000352,
            "Cooling tower (treated)": 0.000352,
            "Cooling tower (untreaterd)": 0.000705,
            "City or well water": 0.000352,
            "River water minimum": 0.000352,
            "River water average": 0.000528,
            "Muddy or silty": 0.000528,
            "Hard (>15 grains/gal": 0.000881,
            "Engine jacket": 0.000176,
            "Distilled, condensate": 0.000088,
            "Distilled, boiler blowdown": 0.000352,
            "Distilled, treated boiler feedwater": 0.000176},
        u"Refinery vapors": {
            "Atmospheric tower overhead vapors": 0.000176,
            "Light naphthas": 0.000176,
            "Vacuum overhead vapors": 0.000352},
        u"Refinery liq.": {
            "Crude oil dry T<120C, v<0.6": 0.000528,
            "Crude oil salt T<120C, v<0.6": 0.000528,
            "Crude oil dry T<120C, 0.6<v<1.2": 0.000352,
            "Crude oil salt T<120C, 0.6<v<1.2": 0.000352,
            "Crude oil dry T<120C, 1.2<v": 0.000352,
            "Crude oil salt T<120C, 1.2<v": 0.000352,
            "Crude oil dry 120C<T<175C, v<0.6": 0.000528,
            "Crude oil salt 120C<T<175C, v<0.6": 0.000881,
            "Crude oil dry 120C<T<175C, 0.6<v<1.2": 0.000352,
            "Crude oil salt 120C<T<175C, 0.6<v<1.2": 0.000705,
            "Crude oil dry 120C<T<175C, 1.2<v": 0.000352,
            "Crude oil salt 120C<T<175C, 1.2<v": 0.000705,
            "Crude oil dry 175C<T<230C, v<0.6": 0.000705,
            "Crude oil salt 175C<T<230C, v<0.6": 0.001057,
            "Crude oil dry 175C<T<230C, 0.6<v<1.2": 0.000528,
            "Crude oil salt 175C<T<230C, 0.6<v<1.2": 0.000881,
            "Crude oil dry 175C<T<230C, 1.2<v": 0.000528,
            "Crude oil salt 175C<T<230C, 1.2<v": 0.000881,
            "Crude oil dry T>230C, v<0.6": 0.000881,
            "Crude oil salt T>230C, v<0.6": 0.001233,
            "Crude oil dry T>230C, 0.6<v<1.2": 0.000705,
            "Crude oil salt T>230C, 0.6<v<1.2": 0.001057,
            "Crude oil dry T>230C, 1.2<v": 0.000705,
            "Crude oil salt T>230C, 1.2<v": 0.001057,
            "Gasoline": 0.000352,
            "Naphtha and light distillates": 0.00044,
            "Kerosene": 0.00044,
            "Light gas oil": 0.00044,
            "Heavy gas oil": 0.00067,
            "Heavy fuel oils": 0.00105},
        u"Refinery Asphalt": {
            "Vacuum tower bottoms": 0.001761,
            "Atmosphere tower bottoms": 0.001233},
        u"Refinery Cracking and caking": {
            "Overhead vapors": 0.000352,
            "Light cycle oil": 0.00044,
            "Heavy cycle oil": 0.00061,
            "Light coker gas oil": 0.00061,
            "Heavy coker gas oil": 0.00079,
            "Bottoms slurry oil": 0.000528,
            "Light liquid products": 0.000176},
        u"Refinery Reforming": {
            "Reformer charge": 0.000264,
            "Reformer effluent": 0.000264,
            "Hydrocracker charge and effluent": 0.000352,
            "Recycle gas": 0.000176,
            "Overhead vapors": 0.000176,
            "Liquid product >50 API": 0.000176,
            "Liquid product 30-50 API": 0.000352},
        u"Refinery Light Ends": {
            "Overhead vapors and gases": 0.000176,
            "Liquid products": 0.000176,
            "Absorption oils": 0.00044,
            "Alkylation trace acid streams": 0.000352,
            "Reboiler streams": 0.00044},
        u"Refinery Lube oil": {
            "Feed stock": 0.000352,
            "Solvent feed mix": 0.000352,
            "Solvent": 0.000176,
            "Extract": 0.000528,
            "Rafftnate": 0.000176,
            "Asphalt": 0.000881,
            "Wax slurries": 0.000528,
            "Refined lube oil": 0.000176},
        u"Refinery Visbreaker": {
            "Overhead vapor": 0.000528,
            "Visbreaker bottoms": 0.001761},
        u"Refinery Naphtha Hydrotreater": {
            "Feed": 0.000528,
            "Effluent": 0.000352,
            "Naphfthas": 0.000352,
            "Overhead vapors": 0.000264},
        u"Refinery Catalytic": {
            "Charge": 0.00079,
            "Effluent": 0.000352,
            "H.T. separator": 0.000352,
            "Stripper charge": 0.000528,
            "Liquid products": 0.000352},
        u"Refinery HF Alky": {
            "Alkylate, deprop. bottons, main fract": 0.000528,
            "Other": 0.000352}}

    def __init__(self, parent=None):
        super(FoulingWidget, self).__init__(parent)
        layout = QtGui.QHBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        self.list = QtGui.QComboBox()
        self.list.addItem("")
        layout.addWidget(self.list)
        self.value = Entrada_con_unidades(Fouling, decimales=6)
        self.value.valueChanged.connect(self.valueChanged.emit)
        layout.addWidget(self.value)

        for tipo in sorted(self.Fouling_Factor):
            self.list.insertSeparator(self.list.count()+1)
            for componente in sorted(self.Fouling_Factor[tipo]):
                self.list.addItem(" - ".join([tipo, componente]))
        self.list.currentIndexChanged["QString"].connect(self.rellenar)

    def setValue(self, value):
        self.value.setValue(value)

    def rellenar(self, txt):
        if txt:
            tipo, componente = txt.split(" - ")
            value = self.Fouling_Factor[str(tipo)][str(componente)]
            self.value.setReadOnly(True)
            self.value.setValue(value)
            self.valueChanged.emit(value)
        else:
            self.value.setReadOnly(False)
Beispiel #50
0
    def __init__(self, equipment=None, parent=None):
        """
        equipment: Initial equipment instance to model
        """
        super().__init__(ElectricPrecipitator, entrada=False, parent=parent)

        # Calculate tab
        lyt_Calc = QtWidgets.QGridLayout(self.tabCalculo)
        lyt_Calc.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Mode")), 1, 1)
        self.metodo = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_TIPO:
            self.metodo.addItem(txt)
        self.metodo.currentIndexChanged.connect(self.tipoCalculoCambiado)
        lyt_Calc.addWidget(self.metodo, 1, 2, 1, 4)
        lyt_Calc.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed,
                                  QtWidgets.QSizePolicy.Fixed), 2, 1, 1, 6)

        lyt_Calc.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Area")), 3, 1)
        self.area = Entrada_con_unidades(Area, resaltado=True)
        self.area.valueChanged.connect(partial(self.changeParams, "area"))
        lyt_Calc.addWidget(self.area, 3, 2)
        lyt_Calc.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Allowable efficiency")), 4,
            1)
        self.rendimientoAdmisible = Entrada_con_unidades(float, readOnly=True)
        self.rendimientoAdmisible.valueChanged.connect(
            partial(self.changeParams, "rendimientoAdmisible"))
        lyt_Calc.addWidget(self.rendimientoAdmisible, 4, 2)
        lyt_Calc.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed,
                                  QtWidgets.QSizePolicy.Fixed), 5, 1, 1, 6)

        lyt_Calc.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Dielectric constant")), 6, 1)
        self.epsilon = Entrada_con_unidades(float)
        self.epsilon.valueChanged.connect(partial(self.changeParams,
                                                  "epsilon"))
        lyt_Calc.addWidget(self.epsilon, 6, 2)
        lyt_Calc.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Charging field")), 7, 1)
        self.potencialCarga = Entrada_con_unidades(PotencialElectric)
        self.potencialCarga.valueChanged.connect(
            partial(self.changeParams, "potencialCarga"))
        lyt_Calc.addWidget(self.potencialCarga, 7, 2)
        lyt_Calc.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Collecting field")), 8, 1)
        self.potencialDescarga = Entrada_con_unidades(PotencialElectric)
        self.potencialDescarga.valueChanged.connect(
            partial(self.changeParams, "potencialDescarga"))
        lyt_Calc.addWidget(self.potencialDescarga, 8, 2)
        lyt_Calc.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Pressure drop")),
            9, 1)
        self.deltaP = Entrada_con_unidades(DeltaP)
        self.deltaP.valueChanged.connect(partial(self.changeParams, "deltaP"))
        lyt_Calc.addWidget(self.deltaP, 9, 2)
        lyt_Calc.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 10, 1, 1,
            6)

        groupbox = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Result"))
        lyt_Calc.addWidget(groupbox, 11, 1, 1, 5)
        lyt = QtWidgets.QGridLayout(groupbox)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Area")), 0, 1)
        self.areaCalculada = Entrada_con_unidades(Area, retornar=False)
        self.areaCalculada.setReadOnly(True)
        lyt.addWidget(self.areaCalculada, 0, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Efficiency")), 1,
            1)
        self.rendimiento = Entrada_con_unidades(float, readOnly=True)
        lyt.addWidget(self.rendimiento, 1, 2)
        lyt_Calc.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 12, 1, 1,
            6)

        # Output tab
        self.addSalida(
            QtWidgets.QApplication.translate("pychemqt", "Filtered gas"))
        self.addSalida(
            QtWidgets.QApplication.translate("pychemqt", "Collected solids"))

        if equipment:
            self.setEquipment(equipment)
Beispiel #51
0
    def __init__(self, kwarg=None, parent=None):
        super(Dialog_Finned, self).__init__(parent=parent)
        self.setWindowTitle(QtGui.QApplication.translate(
            "pychemqt", "Specify tube finned characteristics"))
        layout = QtGui.QGridLayout(self)
        self.listTube = QtGui.QComboBox()
        self.listTube.addItem("")
        layout.addWidget(self.listTube, 0, 1, 1, 2)

        layout.addItem(QtGui.QSpacerItem(10, 10, QtGui.QSizePolicy.Fixed,
                                         QtGui.QSizePolicy.Fixed), 1, 1, 1, 2)
        layout.addWidget(QtGui.QLabel(QtGui.QApplication.translate(
            "pychemqt", "Material")), 2, 1)
        self.listMaterial = QtGui.QComboBox()
        self.listMaterial.addItem("")
        self.listMaterial.addItem(QtGui.QApplication.translate(
            "pychemqt", "Carbon Steel"))
        layout.addWidget(self.listMaterial, 2, 2)
        layout.addWidget(QtGui.QLabel(QtGui.QApplication.translate(
            "pychemqt", "Thermal Conductivity")), 3, 1)
        self.kFin = Entrada_con_unidades(ThermalConductivity)
        layout.addWidget(self.kFin, 3, 2)
        layout.addItem(QtGui.QSpacerItem(10, 10, QtGui.QSizePolicy.Fixed,
                                         QtGui.QSizePolicy.Fixed), 4, 1, 1, 2)

        layout.addWidget(QtGui.QLabel(QtGui.QApplication.translate(
            "pychemqt", "Root diameter")), 5, 1)
        self.RootD = Entrada_con_unidades(Length, "PipeDiameter")
        layout.addWidget(self.RootD, 5, 2)
        layout.addWidget(QtGui.QLabel(QtGui.QApplication.translate(
            "pychemqt", "Fin Height")), 6, 1)
        self.hFin = Entrada_con_unidades(Length, "Thickness")
        layout.addWidget(self.hFin, 6, 2)
        layout.addWidget(QtGui.QLabel(QtGui.QApplication.translate(
            "pychemqt", "Base Fin Thickness")), 7, 1)
        self.BaseThickness = Entrada_con_unidades(Length, "Thickness")
        layout.addWidget(self.BaseThickness, 7, 2)
        layout.addWidget(QtGui.QLabel(QtGui.QApplication.translate(
            "pychemqt", "Top Fin Thickness")), 8, 1)
        self.TopThickness = Entrada_con_unidades(Length, "Thickness")
        layout.addWidget(self.TopThickness, 8, 2)
        layout.addWidget(QtGui.QLabel(QtGui.QApplication.translate(
            "pychemqt", "Number of fins")), 9, 1)
        self.Nfin = Entrada_con_unidades(float, textounidad="fins/m")
        layout.addWidget(self.Nfin, 9, 2)

        self.buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Cancel |
                                                QtGui.QDialogButtonBox.Ok)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
        layout.addWidget(self.buttonBox, 10, 1, 1, 2)

        for tuberia in finnedTube_database:
            self.listTube.addItem("%s %s" % (tuberia[0], tuberia[1]))
        self.listTube.currentIndexChanged.connect(self.rellenarData)
        self.listTube.currentIndexChanged.connect(self.setDisabled)

        if kwarg:
            self.hFin.setValue(kwarg["hFin"])
            self.BaseThickness.setValue(kwarg["thicknessBaseFin"])
            self.TopThickness.setValue(kwarg["thicknessTopFin"])
            self.kFin.setValue(kwarg["kFin"])
            self.Nfin.setValue(kwarg["nFin"])
            self.RootD.setValue(kwarg["rootDoFin"])
Beispiel #52
0
class Entrada_Datos(QtWidgets.QDialog):
    """Table data input dialog"""
    def __init__(self, data=None, t=[], property=[], horizontalHeader=[],
                 title="", help=False, helpFile="", DIPPR=False, tc=0,
                 tcValue=None, eq=1, parent=None):
        """
        title: window title
        data: mrray with original data
        t: values for x column, generally temperature
        property: values for 2...n columns
        horizontalHeader: List with column title
        help: boolean to show help button
        helpFile: Path for help file, file or url
        DIPPR: boolean to show DIPPR widget
        tc: boolean to show critical temperature (same DIPPR eq need it)
        tcValue: value for critical temperature
        eq: Value for DIPPR equation
        """
        super(Entrada_Datos, self).__init__(parent)
        self.setWindowTitle(title)
        self.columnas = len(horizontalHeader)
        self.horizontalHeader = horizontalHeader
        self.title = title
        self.helpFile = helpFile
        gridLayout = QtWidgets.QGridLayout(self)
        self.botonAbrir = QtWidgets.QPushButton(QtGui.QIcon(QtGui.QPixmap(
            os.environ["pychemqt"]+"/images/button/fileOpen.png")),
            QtWidgets.QApplication.translate("pychemqt", "Open"))
        self.botonAbrir.clicked.connect(self.Abrir)
        gridLayout.addWidget(self.botonAbrir, 1, 1)
        self.botonGuardar = QtWidgets.QPushButton(QtGui.QIcon(QtGui.QPixmap(
            os.environ["pychemqt"]+"/images/button/fileSave.png")),
            QtWidgets.QApplication.translate("pychemqt", "Save"))
        self.botonGuardar.clicked.connect(self.Guardar)
        gridLayout.addWidget(self.botonGuardar, 1, 2)
        self.botonDelete = QtWidgets.QPushButton(QtGui.QIcon(QtGui.QPixmap(
            os.environ["pychemqt"]+"/images/button/clear.png")),
            QtWidgets.QApplication.translate("pychemqt", "Clear"))
        self.botonDelete.clicked.connect(self.Borrar)
        gridLayout.addWidget(self.botonDelete, 1, 3)
        gridLayout.addItem(QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding,
                                             QtWidgets.QSizePolicy.Expanding), 1, 4)

        self.tabla = Tabla(self.columnas, horizontalHeader=horizontalHeader,
                           verticalHeader=False, stretch=False)
        self.tabla.setConnected()
        if data:
            self.tabla.setMatrix(data)
            self.tabla.addRow()
        elif t and property:
            self.tabla.setColumn(0, t)
            self.tabla.setColumn(1, property)
        gridLayout.addWidget(self.tabla, 2, 1, 1, 4)

        if DIPPR:
            self.eqDIPPR = eqDIPPR(eq)
            gridLayout.addWidget(self.eqDIPPR, 3, 1, 1, 4)
            self.eqDIPPR.eqDIPPR.valueChanged.connect(self.showTc)

        if tc:
            lyt = QtWidgets.QHBoxLayout()
            self.labelTc = QtWidgets.QLabel("Tc: ", self)
            lyt.addWidget(self.labelTc)
            self.tc = Entrada_con_unidades(Temperature, value=tcValue)
            lyt.addWidget(self.tc)
            lyt.addItem(QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding,
                                          QtWidgets.QSizePolicy.Expanding))
            gridLayout.addItem(lyt, 4, 1, 1, 4)
            self.showTc(1)

        if help:
            botones = QtWidgets.QDialogButtonBox.Help | \
                QtWidgets.QDialogButtonBox.Cancel | QtWidgets.QDialogButtonBox.Ok
        else:
            botones = QtWidgets.QDialogButtonBox.Cancel | QtWidgets.QDialogButtonBox.Ok
        self.boton = QtWidgets.QDialogButtonBox(botones)
        self.boton.accepted.connect(self.accept)
        self.boton.rejected.connect(self.reject)
        self.boton.helpRequested.connect(self.ayuda)
        gridLayout.addWidget(self.boton, 5, 1, 1, 4)

    def showTc(self, value):
        self.labelTc.setVisible(value in (7, 9))
        self.tc.setVisible(value in (7, 9))

    def Abrir(self):
        fname = str(QtWidgets.QFileDialog.getOpenFileName(
            self, QtWidgets[0].QCoreApplication.translate("pychemqt", "Open text file"), "./"))
        if fname:
            data = loadtxt(fname)
            self.tabla.setMatrix(data)
            self.tabla.addRow()

    def Guardar(self):
        fname = str(QtWidgets.QFileDialog.getSaveFileName(
            self, QtWidgets[0].QCoreApplication.translate("pychemqt", "Save data to file"), "./"))
        if fname:
            with open(fname, 'w') as file:
                file.write("#"+self.title+"\n")
                file.write("#")
                try:
                    for i in self.horizontalHeader:
                        file.write(i+"\t")
                except UnicodeEncodeError:
                    pass
                file.write("\n")
                data = self.data
                for fila in range(len(data)):
                    for columna in range(self.tabla.columnCount()):
                        file.write(str(data[fila][columna])+"\t")
                    file.write("\n")

    def Borrar(self):
        """Clear table"""
        self.tabla.setRowCount(1)
        self.tabla.clearContents()

    def ayuda(self):
        """Show help file"""
        Dialog = HelpView(self.windowTitle(), QtCore.QUrl(self.helpFile))
        Dialog.exec_()

    @property
    def data(self):
        return self.tabla.getMatrix()
Beispiel #53
0
class UI_equipment(parents.UI_equip):
    """Dialogo de definición de unidades de secado de sólidos"""
    def __init__(self, entradaSolido=None, entradaAire=None,  parent=None):
        """entrada: Parametro opcional de clase corriente que indica la corriente de entrada"""
        super(UI_equipment, self).__init__(Dryer, parent=parent)
        self.entradaSolido=entradaSolido
        self.entradaAire=entradaAire
        self.Equipment=Dryer()

        #Pestaña entrada
        self.EntradaSolido= UI_corriente.Ui_corriente(self.entradaSolido)
        self.EntradaSolido.Changed.connect(self.cambiar_entrada)
        self.Entrada.addTab(self.EntradaSolido,QtWidgets.QApplication.translate("equipment", "Solido", None))
        self.EntradaAire= UI_corriente.Ui_psychrometry(self.entradaAire)
        self.EntradaAire.Changed.connect(self.cambiar_aire)
        self.Entrada.addTab(self.EntradaAire,QtWidgets.QApplication.translate("equipment", "Aire", None))

        #Pestaña calculo
        gridLayout_Calculo = QtWidgets.QGridLayout(self.tabCalculo)
        gridLayout_Calculo.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Tipo de cálculo:", None)), 1, 1)
        self.TipoCalculo=QtWidgets.QComboBox()
        self.TipoCalculo.addItem(QtWidgets.QApplication.translate("equipment", "Cálculo, conocido el flujo de vapor, calcular las corrientes de salida", None))
        self.TipoCalculo.addItem(QtWidgets.QApplication.translate("equipment", "Diseño, calcular el flujo de aire necesario", None))
        self.TipoCalculo.currentIndexChanged.connect(self.calculo)
        gridLayout_Calculo.addWidget(self.TipoCalculo, 1, 2, 1, 4)
        gridLayout_Calculo.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Fixed),2,1,1,6)
        gridLayout_Calculo.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Humedad relativa en el aire:", None)), 3, 1, 1, 1)
        self.HumedadAire=Entrada_con_unidades(float, max=1, spinbox=True, step=0.01)
        self.HumedadAire.valueChanged.connect(self.calculo)
        gridLayout_Calculo.addWidget(self.HumedadAire,3,2,1,1)
        gridLayout_Calculo.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Humedad residual del sólido:", None)), 4, 1, 1, 1)
        self.HumedadSolido=Entrada_con_unidades(float, max=1., spinbox=True, step=0.01, textounidad=unidades.Mass(None).text()+"/"+unidades.Mass(None).text())
        self.HumedadSolido.valueChanged.connect(self.calculo)
        gridLayout_Calculo.addWidget(self.HumedadSolido,4,2,1,1)
        gridLayout_Calculo.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Temperatura del sólido a la salida:", None)), 5, 1, 1, 1)
        self.temperatura=Entrada_con_unidades(unidades.Temperature)
        self.temperatura.valueChanged.connect(self.calculo)
        gridLayout_Calculo.addWidget(self.temperatura,5,2,1,1)
        gridLayout_Calculo.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Intercambio de calor:", None)), 6, 1, 1, 1)
        self.Heat=Entrada_con_unidades(unidades.Power)
        self.Heat.valueChanged.connect(self.calculo)
        gridLayout_Calculo.addWidget(self.Heat,6,2,1,1)
        gridLayout_Calculo.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Pérdida de presión:", None)), 7, 1, 1, 1)
        self.DeltaP=Entrada_con_unidades(unidades.Pressure)
        self.DeltaP.valueChanged.connect(self.calculo)
        gridLayout_Calculo.addWidget(self.DeltaP,7,2,1,1)

        gridLayout_Calculo.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),8,1,1,6)
        self.groupBox_Calculo = QtWidgets.QGroupBox(QtWidgets.QApplication.translate("equipment", "Datos calculados", None))
        gridLayout_Calculo.addWidget(self.groupBox_Calculo,9,1,1,5)
        gridLayout_1 = QtWidgets.QGridLayout(self.groupBox_Calculo)
        gridLayout_1.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Temperatura a la salida:", None)), 1, 1, 1, 1)
        self.temperaturaCalculada=Entrada_con_unidades(unidades.Temperature, retornar=False, readOnly=True)
        gridLayout_1.addWidget(self.temperaturaCalculada,1,2,1,1)
        gridLayout_1.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Caudal de aire:", None)),2,1)
        self.caudalVolumetrico=Entrada_con_unidades(unidades.VolFlow, "QGas", retornar=False, readOnly=True)
        gridLayout_1.addWidget(self.caudalVolumetrico,2,2,1,1)
        gridLayout_1.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Humedad del aire:", None)), 3, 1)
        self.HumedadCalculada=Entrada_con_unidades(float, readOnly=True, textounidad="%")
        gridLayout_1.addWidget(self.HumedadCalculada,3,2,1,1)

        gridLayout_Calculo.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),11,1,1,6)

        #Pestaña salida
        self.SalidaSolido= UI_corriente.Ui_corriente(readOnly=True)
        self.Salida.addTab(self.SalidaSolido,QtWidgets.QApplication.translate("equipment", "Sólido secado", None))
        self.SalidaAire= UI_corriente.Ui_psychrometry(readOnly=True)
        self.Salida.addTab(self.SalidaAire,QtWidgets.QApplication.translate("equipment", "Aire", None))


    def cambiar_entrada(self, corriente):
        self.entradaSolido=corriente
        self.calculo()

    def cambiar_aire(self, punto):
        self.entradaAire=punto
        self.calculo()

    def calculo(self):
        if self.todos_datos():
            self.Equipment(entrada=self.entrada, calculo=0, modelo=self.Modelo.currentIndex(), anchura=self.anchura.value, altura=self.altura.value, longitud=self.longitud.value)
            self.rellenoSalida(1)

    def rellenoSalida(self, estado=1, texto=""):
        self.caudalVolumetrico.setValue(self.entrada.caudal_volumetrico)
        self.velocidadGasCalculada.setValue(self.Equipment.Vgas)
        self.rendimientoCalculado.setValue(self.Equipment.rendimiento)
        self.alturaCalculada.setValue(self.Equipment.H)
        self.anchuraCalculada.setValue(self.Equipment.B)
        self.longitudCalculada.setValue(self.Equipment.L)
        self.SalidaGas.rellenar(self.Equipment.SalidaAire)
        self.SalidaSolido.rellenar(self.Equipment.SalidaSolido)
        self.status.setState(estado, texto)

    def todos_datos(self):
        return self.EntradaSolido.todos_datos() and self.EntradaAire.todos_datos()
Beispiel #54
0
    def __init__(self, equipment=None, parent=None):
        """
        equipment: Initial equipment instance to model
        """
        super().__init__(Compressor, entrada=False, salida=False,
                         parent=parent)

        # Calculate tab
        lyt_Calc = QtWidgets.QGridLayout(self.tabCalculo)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Method:")), 1, 1)
        self.metodo = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_METODO:
            self.metodo.addItem(txt)
        # self.metodo.addItem(QtWidgets.QApplication.translate(
            # "pychemqt", "Especificar curva de funcionamiento"))
        self.metodo.currentIndexChanged.connect(
            self.on_tipoCalculo_currentIndexChanged)
        lyt_Calc.addWidget(self.metodo, 1, 2, 1, 2)
        lyt_Calc.addItem(QtWidgets.QSpacerItem(
            40, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            2, 0, 1, 4)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Thermodynamic:")), 3, 1)
        self.termodinamica = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_TERMODINAMICA:
            self.termodinamica.addItem(txt)
        self.termodinamica.currentIndexChanged.connect(
            partial(self.changeParams, "termodinamica"))
        lyt_Calc.addWidget(self.termodinamica, 3, 2, 1, 2)
        lyt_Calc.addItem(QtWidgets.QSpacerItem(
            40, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            4, 0, 1, 4)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Out Pressure")), 5, 1)
        self.Pout = Entrada_con_unidades(Pressure)
        self.Pout.valueChanged.connect(partial(self.changeParams, "Pout"))
        lyt_Calc.addWidget(self.Pout, 5, 2)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Pressure ratio")), 6, 1)
        self.razon = Entrada_con_unidades(float)
        self.razon.valueChanged.connect(partial(self.changeParams, "razon"))
        lyt_Calc.addWidget(self.razon, 6, 2)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Efficiency")), 7, 1)
        self.rendimiento = Entrada_con_unidades(float)
        self.rendimiento.valueChanged.connect(
            partial(self.changeParams, "rendimiento"))
        lyt_Calc.addWidget(self.rendimiento, 7, 2)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Actual Power")), 8, 1)
        self.trabajo = Entrada_con_unidades(Power)
        self.trabajo.valueChanged.connect(
            partial(self.changeParams, "trabajo"))
        lyt_Calc.addWidget(self.trabajo, 8, 2)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Stages")), 9, 1)
        self.etapas = Entrada_con_unidades(
            int, spinbox=True, min=1, value=1, step=1)
        self.etapas.valueChanged.connect(partial(self.changeParams, "etapas"))
        lyt_Calc.addWidget(self.etapas, 9, 2)
        lyt_Calc.setRowStretch(10, 1)

        group = QtWidgets.QGroupBox()
        group.setTitle(QtWidgets.QApplication.translate("pychemqt", "Results"))
        lyt_Calc.addWidget(group, 12, 1, 1, 2)
        lyt = QtWidgets.QGridLayout(group)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Power")), 1, 1)
        self.power = Entrada_con_unidades(Power, retornar=False, readOnly=True)
        lyt.addWidget(self.power, 1, 2)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Cp/Cv ratio")), 2, 1)
        self.cp_cv = Entrada_con_unidades(float, retornar=False, readOnly=True)
        lyt.addWidget(self.cp_cv, 2, 2)
        lyt.setColumnStretch(3, 1)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Pressure ratio")), 1, 4)
        self.razonCalculada = Entrada_con_unidades(float, readOnly=True)
        lyt.addWidget(self.razonCalculada, 1, 5)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Efficiency")), 2, 4)
        self.rendimientoCalculado = Entrada_con_unidades(float, readOnly=True)
        lyt.addWidget(self.rendimientoCalculado, 2, 5)

        # Cost tab
        lyt_Cost = QtWidgets.QGridLayout(self.tabCostos)
        lyt_Cost.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Compressor:")), 1, 1)
        self.compresor = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_COMPRESOR:
            self.compresor.addItem(txt)
        self.compresor.currentIndexChanged.connect(
            partial(self.changeParamsCoste, "compresor"))
        lyt_Cost.addWidget(self.compresor, 1, 2)
        lyt_Cost.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Driver:")), 2, 1)
        self.transmision = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_TRANSMISION:
            self.transmision.addItem(txt)
        self.transmision.currentIndexChanged.connect(
            partial(self.changeParamsCoste, "transmision"))
        lyt_Cost.addWidget(self.transmision, 2, 2)
        lyt_Cost.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Motor:")), 3, 1)
        self.motor = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_MOTOR:
            self.motor.addItem(txt)
        self.motor.currentIndexChanged.connect(
            partial(self.changeParamsCoste, "motor"))
        lyt_Cost.addWidget(self.motor, 3, 2)
        lyt_Cost.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "RPM:")), 4, 1)
        self.rpm = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_RPM:
            self.rpm.addItem(txt)
        self.rpm.currentIndexChanged.connect(
            partial(self.changeParamsCoste, "rpm"))
        lyt_Cost.addWidget(self.rpm, 4, 2)
        lyt_Cost.addItem(QtWidgets.QSpacerItem(
            40, 20, QtWidgets.QSizePolicy.Fixed,
            QtWidgets.QSizePolicy.Maximum), 5, 1, 1, 6)

        self.Costos = CostData(self.Equipment)
        self.Costos.valueChanged.connect(self.changeParamsCoste)
        lyt_Cost.addWidget(self.Costos, 6, 1, 1, 3)

        lyt_Cost.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 8, 1, 1, 6)
        lyt_Cost.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 10, 1, 1, 6)
        group = QtWidgets.QGroupBox()
        group.setTitle(
            QtWidgets.QApplication.translate("pychemqt", "Stimated Costs"))
        lyt_Cost.addWidget(group, 9, 1, 1, 5)
        lyt = QtWidgets.QGridLayout(group)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Compressor")), 0, 0)
        self.C_comp = Entrada_con_unidades(Currency, retornar=False)
        self.C_comp.setReadOnly(True)
        lyt.addWidget(self.C_comp, 0, 1)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Drive")), 1, 0)
        self.C_trans = Entrada_con_unidades(Currency, retornar=False)
        self.C_trans.setReadOnly(True)
        lyt.addWidget(self.C_trans, 1, 1)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Motor")), 2, 0)
        self.C_motor = Entrada_con_unidades(Currency, retornar=False)
        self.C_motor.setReadOnly(True)
        lyt.addWidget(self.C_motor, 2, 1)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Purchase cost")), 0, 4)
        self.C_adq = Entrada_con_unidades(Currency, retornar=False)
        self.C_adq.setReadOnly(True)
        lyt.addWidget(self.C_adq, 0, 5)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Installed cost")), 1, 4)
        self.C_inst = Entrada_con_unidades(Currency, retornar=False)
        self.C_inst.setReadOnly(True)
        lyt.addWidget(self.C_inst, 1, 5)

        self.on_tipoCalculo_currentIndexChanged(0)
        if equipment:
            self.setEquipment(equipment)
Beispiel #55
0
    def __init__(self, equipment=None, parent=None):
        """
        equipment: Initial equipment instance to model
        """
        super(UI_equipment, self).__init__(Shell_Tube, parent=parent)

        # Input tab
        self.addEntrada(QtWidgets.QApplication.translate("pychemqt", "Tubes"),
                        "entradaTubo")
        self.addEntrada(QtWidgets.QApplication.translate("pychemqt", "Shell"),
                        "entradaCarcasa")

        # Model tab
        tab = QtWidgets.QWidget()
        self.tabWidget.insertTab(
            1, tab, QtWidgets.QApplication.translate("pychemqt", "Model"))
        lyt = QtWidgets.QGridLayout(tab)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Class")), 2, 1)
        self.class_ = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_CLASS:
            self.class_.addItem(txt)
        self.class_.currentIndexChanged.connect(
            partial(self.changeParams, "class_"))
        lyt.addWidget(self.class_, 2, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Front end head")), 3, 1)
        self.frontHead = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_FRONTHEAD:
            self.frontHead.addItem(txt)
        self.frontHead.currentIndexChanged.connect(
            partial(self.changeParams, "frontHead"))
        lyt.addWidget(self.frontHead, 3, 2, 1, 3)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Shell type")), 4,
            1)
        self.shell = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_SHELL:
            self.shell.addItem(txt)
        self.shell.currentIndexChanged.connect(
            partial(self.changeParams, "shell"))
        lyt.addWidget(self.shell, 4, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Rear end head")),
            5, 1)
        self.rearHead = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_REARHEAD:
            self.rearHead.addItem(txt)

        self.rearHead.currentIndexChanged.connect(
            partial(self.changeParams, "rearHead"))
        lyt.addWidget(self.rearHead, 5, 2, 1, 2)
        lyt.addItem(
            QtWidgets.QSpacerItem(10, 10, QtWidgets.QSizePolicy.Fixed,
                                  QtWidgets.QSizePolicy.Fixed), 6, 1, 1, 6)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Orientation")),
            7, 1)
        self.orientacion = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_ORIENTATION:
            self.orientacion.addItem(txt)
        self.orientacion.currentIndexChanged.connect(
            partial(self.changeParams, "orientation"))
        lyt.addWidget(self.orientacion, 7, 2)

        botonMetodos = QtWidgets.QPushButton(
            QtWidgets.QApplication.translate("pychemqt",
                                             "Calculation methods"))
        botonMetodos.clicked.connect(self.selectMethods)
        lyt.addWidget(botonMetodos, 9, 1)
        lyt.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 10, 1, 1,
            6)

        # Tubes tab
        tab = QtWidgets.QWidget()
        self.tabWidget.insertTab(
            2, tab, QtWidgets.QApplication.translate("pychemqt", "Tubes"))
        lyt = QtWidgets.QGridLayout(tab)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Number of tubes")), 1, 1)
        self.NTubes = Entrada_con_unidades(int, width=60, spinbox=True, step=1)
        self.NTubes.valueChanged.connect(partial(self.changeParams, "NTube"))
        lyt.addWidget(self.NTubes, 1, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Number of tube passes")), 2,
            1)
        self.NPases = Entrada_con_unidades(int, width=60, spinbox=True, step=1)
        self.NPases.valueChanged.connect(partial(self.changeParams, "NPases"))
        lyt.addWidget(self.NPases, 2, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Tube length")),
            3, 1)
        self.LTube = Entrada_con_unidades(Length)
        self.LTube.valueChanged.connect(partial(self.changeParams, "LTube"))
        lyt.addWidget(self.LTube, 3, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Tube external diameter")), 4,
            1)
        self.DeTube = Entrada_con_unidades(Length, "pipeDiameter")
        self.DeTube.valueChanged.connect(partial(self.changeParams, "DeTube"))
        lyt.addWidget(self.DeTube, 4, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Tube thickness")), 5, 1)
        self.wTube = Entrada_con_unidades(Length, "Thickness")
        self.wTube.valueChanged.connect(partial(self.changeParams, "wTube"))
        lyt.addWidget(self.wTube, 5, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Tube roughness")), 6, 1)
        self.rTube = Entrada_con_unidades(Length, "Thickness")
        self.rTube.valueChanged.connect(partial(self.changeParams, "rTube"))
        lyt.addWidget(self.rTube, 6, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Thermal conductivity")), 7,
            1)
        self.kTube = Entrada_con_unidades(ThermalConductivity)
        self.kTube.valueChanged.connect(partial(self.changeParams, "kTube"))
        lyt.addWidget(self.kTube, 7, 2)
        self.buttonPipe = QtWidgets.QPushButton(
            QtWidgets.QApplication.translate("pychemqt", "Pipe Database"))
        self.buttonPipe.clicked.connect(self.showMaterial)
        lyt.addWidget(self.buttonPipe, 4, 4, 4, 1)
        lyt.addItem(
            QtWidgets.QSpacerItem(10, 10, QtWidgets.QSizePolicy.Fixed,
                                  QtWidgets.QSizePolicy.Fixed), 8, 1, 1, 6)

        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Tube pattern")),
            9, 1)
        self.distribucionTube = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_DISTRIBUTION_TUBE:
            self.distribucionTube.addItem(txt)
        self.distribucionTube.currentIndexChanged.connect(
            partial(self.changeParams, "distribucionTube"))
        lyt.addWidget(self.distribucionTube, 9, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Tube pitch")),
            10, 1)
        self.pitch = Entrada_con_unidades(Length)
        self.pitch.valueChanged.connect(partial(self.changeParams, "pitch"))
        lyt.addWidget(self.pitch, 10, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Fin Tube")), 11,
            1)
        self.buttonFin = QtWidgets.QPushButton(
            QtWidgets.QApplication.translate("pychemqt",
                                             "Finned Pipe Database"))
        self.buttonFin.setEnabled(False)
        self.buttonFin.clicked.connect(self.showFinTube)
        lyt.addWidget(self.buttonFin, 11, 4, 1, 1)
        self.finned = QtWidgets.QComboBox()
        self.finned.addItem(
            QtWidgets.QApplication.translate("pychemqt", "Bared tube"))
        self.finned.addItem(
            QtWidgets.QApplication.translate("pychemqt", "Finned tube"))
        self.finned.currentIndexChanged.connect(self.finnedChanged)
        lyt.addWidget(self.finned, 11, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Fouling")), 12,
            1)
        self.tubeFouling = FoulingWidget()
        self.tubeFouling.valueChanged.connect(
            partial(self.changeParams, "tubeFouling"))
        lyt.addWidget(self.tubeFouling, 12, 2, 1, 3)
        lyt.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 15, 1, 1,
            6)

        # Shell tab
        tab = QtWidgets.QWidget()
        self.tabWidget.insertTab(
            3, tab, QtWidgets.QApplication.translate("pychemqt", "Shell"))
        lyt = QtWidgets.QGridLayout(tab)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Exchangers in paralell")), 1,
            1)
        self.paralelo = Entrada_con_unidades(int, width=60)
        self.paralelo.valueChanged.connect(
            partial(self.changeParams, "parallel"))
        lyt.addWidget(self.paralelo, 1, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Exchangers in serie")), 2, 1)
        self.serie = Entrada_con_unidades(int, width=60)
        self.serie.valueChanged.connect(partial(self.changeParams, "serie"))
        lyt.addWidget(self.serie, 2, 2)
        lyt.addItem(
            QtWidgets.QSpacerItem(10, 10, QtWidgets.QSizePolicy.Fixed,
                                  QtWidgets.QSizePolicy.Fixed), 3, 1, 1, 6)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Shell Diameter")), 4, 1)
        self.DShell = Entrada_con_unidades(Length)
        self.DShell.valueChanged.connect(partial(self.changeParams, "DShell"))
        lyt.addWidget(self.DShell, 4, 2)
        lyt.addItem(
            QtWidgets.QSpacerItem(10, 10, QtWidgets.QSizePolicy.Fixed,
                                  QtWidgets.QSizePolicy.Fixed), 5, 1, 1, 6)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Shell Material")), 6, 1)
        self.materialShell = QtWidgets.QComboBox()
        lyt.addWidget(self.materialShell, 6, 2)
        lyt.addItem(
            QtWidgets.QSpacerItem(10, 10, QtWidgets.QSizePolicy.Fixed,
                                  QtWidgets.QSizePolicy.Fixed), 7, 1, 1, 6)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Fouling")), 8, 1)
        self.shellFouling = FoulingWidget()
        self.shellFouling.valueChanged.connect(
            partial(self.changeParams, "shellFouling"))
        lyt.addWidget(self.shellFouling, 8, 2, 1, 2)
        lyt.addItem(
            QtWidgets.QSpacerItem(10, 10, QtWidgets.QSizePolicy.Fixed,
                                  QtWidgets.QSizePolicy.Fixed), 9, 1, 1, 6)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Sealing Strips")), 10, 1)
        self.sealingStrips = Entrada_con_unidades(float)
        self.sealingStrips.valueChanged.connect(
            partial(self.changeParams, "sealingStrips"))
        lyt.addWidget(self.sealingStrips, 10, 2)

        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Clearances"))
        lyt.addWidget(group, 11, 1, 1, 6)
        lyt = QtWidgets.QGridLayout(group)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Tube to baffle hole")), 1, 1)
        self.ClearanceTubeBaffle = Entrada_con_unidades(Length, "Thickness")
        self.ClearanceTubeBaffle.valueChanged.connect(
            partial(self.changeParams, "clearanceTubeBaffle"))
        lyt.addWidget(self.ClearanceTubeBaffle, 1, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Shell to baffle")), 2, 1)
        self.ClearanceShellBaffle = Entrada_con_unidades(Length, "Thickness")
        self.ClearanceShellBaffle.valueChanged.connect(
            partial(self.changeParams, "clearanceShellBaffle"))
        lyt.addWidget(self.ClearanceShellBaffle, 2, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Shell to bundle")), 3, 1)
        self.ClearanceShellBundle = Entrada_con_unidades(Length, "Thickness")
        self.ClearanceShellBundle.valueChanged.connect(
            partial(self.changeParams, "clearanceShellBundle"))
        lyt.addWidget(self.ClearanceShellBundle, 3, 2)
        lyt.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 15, 1, 1,
            6)

        # Fitting tab
        tab = QtWidgets.QWidget()
        self.tabWidget.insertTab(
            4, tab, QtWidgets.QApplication.translate("pychemqt", "Baffle"))
        lyt = QtWidgets.QGridLayout(tab)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Baffle type")),
            1, 1)
        self.baffleType = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_BAFFLE_TYPE:
            self.baffleType.addItem(txt)
        self.baffleType.currentIndexChanged.connect(
            partial(self.changeParams, "baffleType"))
        lyt.addWidget(self.baffleType, 1, 2)
        lyt.addItem(
            QtWidgets.QSpacerItem(10, 10, QtWidgets.QSizePolicy.Fixed,
                                  QtWidgets.QSizePolicy.Fixed), 2, 1, 1, 6)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Inlet spacing")),
            3, 1)
        self.baffleSpacingIn = Entrada_con_unidades(Length)
        self.baffleSpacingIn.valueChanged.connect(
            partial(self.changeParams, "baffleSpacingIn"))
        lyt.addWidget(self.baffleSpacingIn, 3, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Outlet spacing")), 3, 4)
        self.baffleSpacingOut = Entrada_con_unidades(Length)
        self.baffleSpacingOut.valueChanged.connect(
            partial(self.changeParams, "baffleSpacingOut"))
        lyt.addWidget(self.baffleSpacingOut, 3, 5)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Baffle spacing")), 4, 1)
        self.baffleSpacing = Entrada_con_unidades(Length)
        self.baffleSpacing.valueChanged.connect(
            partial(self.changeParams, "baffleSpacing"))
        lyt.addWidget(self.baffleSpacing, 4, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Baffle thickness")), 5, 1)
        self.baffleThickness = Entrada_con_unidades(Length, "Thickness")
        self.baffleThickness.valueChanged.connect(
            partial(self.changeParams, "baffleThickness"))
        lyt.addWidget(self.baffleThickness, 5, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Orientation")),
            6, 1)
        self.baffleOrientation = QtWidgets.QComboBox()
        self.baffleOrientation.addItem(
            QtWidgets.QApplication.translate("pychemqt", "Horizontal"))
        self.baffleOrientation.addItem(
            QtWidgets.QApplication.translate("pychemqt", "Vertical"))
        self.baffleOrientation.currentIndexChanged.connect(
            partial(self.changeParams, "baffleOrientation"))
        lyt.addWidget(self.baffleOrientation, 6, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Cut percent")),
            7, 1)
        self.baffleCut = Entrada_con_unidades(float, textounidad="%")
        self.baffleCut.valueChanged.connect(
            partial(self.changeParams, "baffleCut"))
        lyt.addWidget(self.baffleCut, 7, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Cut base")), 7,
            4)
        self.baffleCutBase = QtWidgets.QComboBox()
        self.baffleCutBase.addItem(
            QtWidgets.QApplication.translate("pychemqt", "Diameter"))
        self.baffleCutBase.addItem(
            QtWidgets.QApplication.translate("pychemqt", "Area"))
        self.baffleCutBase.currentIndexChanged.connect(
            partial(self.changeParams, "baffleCutBase"))
        lyt.addWidget(self.baffleCutBase, 7, 5)
        lyt.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Fixed,
                                  QtWidgets.QSizePolicy.Fixed), 1, 3, 6, 1)
        lyt.addItem(
            QtWidgets.QSpacerItem(10, 10, QtWidgets.QSizePolicy.Fixed,
                                  QtWidgets.QSizePolicy.Fixed), 8, 1, 1, 6)

        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Nozzles"))
        lyt.addWidget(group, 9, 1, 1, 6)
        layout = QtWidgets.QGridLayout(group)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Shellside")), 0,
            2)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Tubeside")), 0,
            3)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Input diameter")), 1, 1)
        self.nozzleInShellsideDiameter = Entrada_con_unidades(
            Length, "PipeDiameter")
        self.nozzleInShellsideDiameter.valueChanged.connect(
            partial(self.changeParams, "nozzleInShellsideDiameter"))
        layout.addWidget(self.nozzleInShellsideDiameter, 1, 2)
        self.nozzleInTubesideDiameter = Entrada_con_unidades(
            Length, "PipeDiameter")
        self.nozzleInTubesideDiameter.valueChanged.connect(
            partial(self.changeParams, "nozzleInTubesideDiameter"))
        layout.addWidget(self.nozzleInTubesideDiameter, 1, 3)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Output diameter")), 2, 1)
        self.nozzleOutShellsideDiameter = Entrada_con_unidades(
            Length, "PipeDiameter")
        self.nozzleOutShellsideDiameter.valueChanged.connect(
            partial(self.changeParams, "nozzleOutShellsideDiameter"))
        layout.addWidget(self.nozzleOutShellsideDiameter, 2, 2)
        self.nozzleOutTubesideDiameter = Entrada_con_unidades(
            Length, "PipeDiameter")
        self.nozzleOutTubesideDiameter.valueChanged.connect(
            partial(self.changeParams, "nozzleOutTubesideDiameter"))
        layout.addWidget(self.nozzleOutTubesideDiameter, 2, 3)
        layout.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Fixed), 1, 4, 2, 1)

        lyt.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 15, 1, 1,
            6)

        # Calculate tab
        lyt = QtWidgets.QGridLayout(self.tabCalculo)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Calculation Mode")), 1, 1)
        self.modo = QtWidgets.QComboBox()
        self.modo.addItem(
            QtWidgets.QApplication.translate("pychemqt", "Rating"))
        self.modo.addItem(
            QtWidgets.QApplication.translate("pychemqt", "Design"))
        lyt.addWidget(self.modo, 1, 2)
        lyt.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 15, 1, 1,
            6)

        # Cost tab
        lyt = QtWidgets.QGridLayout(self.tabCostos)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Type")), 1, 1)
        self.tipoCoste = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_COST_TYPE:
            self.tipoCoste.addItem(txt)
        self.tipoCoste.currentIndexChanged.connect(
            partial(self.changeParamsCoste, "tipoCoste"))
        lyt.addWidget(self.tipoCoste, 1, 2)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Material")), 2,
            1)
        self.materialCoste = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_COST_MATERIAL:
            self.materialCoste.addItem(txt)
        self.materialCoste.currentIndexChanged.connect(
            partial(self.changeParamsCoste, "P_dis"))
        lyt.addWidget(self.materialCoste, 2, 2)
        lyt.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 3, 0, 1, 6)
        lyt.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Design Pressure")), 4, 1)
        self.Pdiseno = Entrada_con_unidades(Pressure)
        lyt.addWidget(self.Pdiseno, 4, 2, 1, 1)
        lyt.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 5, 0, 1, 6)

        self.Costos = CostData(self.Equipment)
        self.Costos.valueChanged.connect(self.calcularCostos)
        lyt.addWidget(self.Costos, 6, 1, 2, 5)

        lyt.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 8, 0, 1, 6)
        lyt.addItem(
            QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding), 10, 0, 1,
            6)
        group = QtWidgets.QGroupBox(
            QtWidgets.QApplication.translate("pychemqt", "Stimated Costs"))
        lyt.addWidget(group, 9, 1, 1, 5)
        layout = QtWidgets.QGridLayout(group)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt", "Purchase Cost")),
            0, 1)
        self.C_adq = Entrada_con_unidades(Currency,
                                          retornar=False,
                                          readOnly=True)
        layout.addWidget(self.C_adq, 0, 2)
        layout.addWidget(
            QtWidgets.QLabel(
                QtWidgets.QApplication.translate("pychemqt",
                                                 "Installed Cost")), 1, 1)
        self.C_inst = Entrada_con_unidades(Currency,
                                           retornar=False,
                                           readOnly=True)
        self.C_inst.entrada.setReadOnly(True)
        layout.addWidget(self.C_inst, 1, 2)

        # Output Tab
        self.addSalida(QtWidgets.QApplication.translate("pychemqt", "Tubes"))
        self.addSalida(QtWidgets.QApplication.translate("pychemqt", "Shell"))

        if equipment:
            self.setEquipment(equipment)
    def __init__(self, equipment=None, parent=None):
        """
        equipment: Initial equipment instance to model
        """
        super().__init__(ElectricPrecipitator, entrada=False, parent=parent)

        # Calculate tab
        lyt_Calc = QtWidgets.QGridLayout(self.tabCalculo)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Mode")), 1, 1)
        self.metodo = QtWidgets.QComboBox()
        for txt in self.Equipment.TEXT_TIPO:
            self.metodo.addItem(txt)
        self.metodo.currentIndexChanged.connect(self.tipoCalculoCambiado)
        lyt_Calc.addWidget(self.metodo, 1, 2, 1, 4)
        lyt_Calc.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            2, 1, 1, 6)

        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Area")), 3, 1)
        self.area = Entrada_con_unidades(Area, resaltado=True)
        self.area.valueChanged.connect(partial(self.changeParams, "area"))
        lyt_Calc.addWidget(self.area, 3, 2)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Allowable efficiency")), 4, 1)
        self.rendimientoAdmisible = Entrada_con_unidades(float,  readOnly=True)
        self.rendimientoAdmisible.valueChanged.connect(
            partial(self.changeParams, "rendimientoAdmisible"))
        lyt_Calc.addWidget(self.rendimientoAdmisible, 4, 2)
        lyt_Calc.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed),
            5, 1, 1, 6)

        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Dielectric constant")), 6, 1)
        self.epsilon = Entrada_con_unidades(float)
        self.epsilon.valueChanged.connect(
            partial(self.changeParams, "epsilon"))
        lyt_Calc.addWidget(self.epsilon, 6, 2)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Charging field")), 7, 1)
        self.potencialCarga = Entrada_con_unidades(PotencialElectric)
        self.potencialCarga.valueChanged.connect(
            partial(self.changeParams, "potencialCarga"))
        lyt_Calc.addWidget(self.potencialCarga, 7, 2)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Collecting field")), 8, 1)
        self.potencialDescarga = Entrada_con_unidades(PotencialElectric)
        self.potencialDescarga.valueChanged.connect(
            partial(self.changeParams, "potencialDescarga"))
        lyt_Calc.addWidget(self.potencialDescarga, 8, 2)
        lyt_Calc.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Pressure drop")), 9, 1)
        self.deltaP = Entrada_con_unidades(DeltaP)
        self.deltaP.valueChanged.connect(partial(self.changeParams, "deltaP"))
        lyt_Calc.addWidget(self.deltaP, 9, 2)
        lyt_Calc.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 10, 1, 1, 6)

        groupbox = QtWidgets.QGroupBox(QtWidgets.QApplication.translate(
            "pychemqt", "Result"))
        lyt_Calc.addWidget(groupbox, 11, 1, 1, 5)
        lyt = QtWidgets.QGridLayout(groupbox)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Area")), 0, 1)
        self.areaCalculada = Entrada_con_unidades(Area, retornar=False)
        self.areaCalculada.setReadOnly(True)
        lyt.addWidget(self.areaCalculada, 0, 2)
        lyt.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "Efficiency")), 1, 1)
        self.rendimiento = Entrada_con_unidades(float, readOnly=True)
        lyt.addWidget(self.rendimiento, 1, 2)
        lyt_Calc.addItem(QtWidgets.QSpacerItem(
            20, 20, QtWidgets.QSizePolicy.Expanding,
            QtWidgets.QSizePolicy.Expanding), 12, 1, 1, 6)

        # Output tab
        self.addSalida(
            QtWidgets.QApplication.translate("pychemqt", "Filtered gas"))
        self.addSalida(
            QtWidgets.QApplication.translate("pychemqt", "Collected solids"))

        if equipment:
            self.setEquipment(equipment)
Beispiel #57
0
    def __init__(self, data=None, t=[], property=[], horizontalHeader=[],
                 title="", help=False, helpFile="", DIPPR=False, tc=0,
                 tcValue=None, eq=1, parent=None):
        """
        title: window title
        data: mrray with original data
        t: values for x column, generally temperature
        property: values for 2...n columns
        horizontalHeader: List with column title
        help: boolean to show help button
        helpFile: Path for help file, file or url
        DIPPR: boolean to show DIPPR widget
        tc: boolean to show critical temperature (same DIPPR eq need it)
        tcValue: value for critical temperature
        eq: Value for DIPPR equation
        """
        super(Entrada_Datos, self).__init__(parent)
        self.setWindowTitle(title)
        self.columnas = len(horizontalHeader)
        self.horizontalHeader = horizontalHeader
        self.title = title
        self.helpFile = helpFile
        gridLayout = QtWidgets.QGridLayout(self)
        self.botonAbrir = QtWidgets.QPushButton(QtGui.QIcon(QtGui.QPixmap(
            os.environ["pychemqt"]+"/images/button/fileOpen.png")),
            QtWidgets.QApplication.translate("pychemqt", "Open"))
        self.botonAbrir.clicked.connect(self.Abrir)
        gridLayout.addWidget(self.botonAbrir, 1, 1)
        self.botonGuardar = QtWidgets.QPushButton(QtGui.QIcon(QtGui.QPixmap(
            os.environ["pychemqt"]+"/images/button/fileSave.png")),
            QtWidgets.QApplication.translate("pychemqt", "Save"))
        self.botonGuardar.clicked.connect(self.Guardar)
        gridLayout.addWidget(self.botonGuardar, 1, 2)
        self.botonDelete = QtWidgets.QPushButton(QtGui.QIcon(QtGui.QPixmap(
            os.environ["pychemqt"]+"/images/button/clear.png")),
            QtWidgets.QApplication.translate("pychemqt", "Clear"))
        self.botonDelete.clicked.connect(self.Borrar)
        gridLayout.addWidget(self.botonDelete, 1, 3)
        gridLayout.addItem(QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding,
                                             QtWidgets.QSizePolicy.Expanding), 1, 4)

        self.tabla = Tabla(self.columnas, horizontalHeader=horizontalHeader,
                           verticalHeader=False, stretch=False)
        self.tabla.setConnected()
        if data:
            self.tabla.setMatrix(data)
            self.tabla.addRow()
        elif t and property:
            self.tabla.setColumn(0, t)
            self.tabla.setColumn(1, property)
        gridLayout.addWidget(self.tabla, 2, 1, 1, 4)

        if DIPPR:
            self.eqDIPPR = eqDIPPR(eq)
            gridLayout.addWidget(self.eqDIPPR, 3, 1, 1, 4)
            self.eqDIPPR.eqDIPPR.valueChanged.connect(self.showTc)

        if tc:
            lyt = QtWidgets.QHBoxLayout()
            self.labelTc = QtWidgets.QLabel("Tc: ", self)
            lyt.addWidget(self.labelTc)
            self.tc = Entrada_con_unidades(Temperature, value=tcValue)
            lyt.addWidget(self.tc)
            lyt.addItem(QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding,
                                          QtWidgets.QSizePolicy.Expanding))
            gridLayout.addItem(lyt, 4, 1, 1, 4)
            self.showTc(1)

        if help:
            botones = QtWidgets.QDialogButtonBox.Help | \
                QtWidgets.QDialogButtonBox.Cancel | QtWidgets.QDialogButtonBox.Ok
        else:
            botones = QtWidgets.QDialogButtonBox.Cancel | QtWidgets.QDialogButtonBox.Ok
        self.boton = QtWidgets.QDialogButtonBox(botones)
        self.boton.accepted.connect(self.accept)
        self.boton.rejected.connect(self.reject)
        self.boton.helpRequested.connect(self.ayuda)
        gridLayout.addWidget(self.boton, 5, 1, 1, 4)
Beispiel #58
0
    def __init__(self, entrada=None, parent=None):
        """entrada: Parametro opcional de clase corriente que indica la corriente de entrada en kla tubería"""
        super(UI_equipment, self).__init__(Tank, entrada=False, salida=False, parent=parent)
        self.entrada=entrada

        #Pestaña entrada
        self.Entrada= UI_corriente.Ui_corriente(entrada)
        self.Entrada.Changed.connect(self.cambiar_entrada)
        self.tabWidget.insertTab(0, self.Entrada,QtWidgets.QApplication.translate("equipment", "Entrada", None))

        #Pestaña calculo
        gridLayout_Calculo = QtWidgets.QGridLayout(self.tabCalculo)


        #Pestaña costos
        gridLayout_Costos = QtWidgets.QGridLayout(self.tabCostos)
        gridLayout_Costos.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Material:", None)), 1, 1, 1, 1)
        self.material=QtWidgets.QComboBox()
        self.material.addItem(QtWidgets.QApplication.translate("equipment", "Acero al carbon", None))
        self.material.addItem(QtWidgets.QApplication.translate("equipment", "Acero inoxidable 316", None))
        self.material.addItem(QtWidgets.QApplication.translate("equipment", "Acero inoxidable 304", None))
        self.material.addItem(QtWidgets.QApplication.translate("equipment", "Acero inoxidable 347", None))
        self.material.addItem(QtWidgets.QApplication.translate("equipment", "Niquel", None))
        self.material.addItem(QtWidgets.QApplication.translate("equipment", "Monel", None))
        self.material.addItem(QtWidgets.QApplication.translate("equipment", "Inconel", None))
        self.material.addItem(QtWidgets.QApplication.translate("equipment", "Zirconio", None))
        self.material.addItem(QtWidgets.QApplication.translate("equipment", "Titanio", None))
        self.material.addItem(QtWidgets.QApplication.translate("equipment", "Ladrillo y caucho o ladrillo y acero recubierto de poliester", None))
        self.material.addItem(QtWidgets.QApplication.translate("equipment", "Caucho o acero recubierto de plomo", None))
        self.material.addItem(QtWidgets.QApplication.translate("equipment", "Poliester reforzado con fiberglass", None))
        self.material.addItem(QtWidgets.QApplication.translate("equipment", "Aluminio", None))
        self.material.addItem(QtWidgets.QApplication.translate("equipment", "Cobre", None))
        self.material.addItem(QtWidgets.QApplication.translate("equipment", "Hormigón", None))
        self.material.currentIndexChanged.connect(self.calcularCostos)
        gridLayout_Costos.addWidget(self.material, 1, 2, 1, 4)
        gridLayout_Costos.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Densidad:", None)), 2, 4, 1, 1)
        self.Densidad=Entrada_con_unidades(unidades.Density, "DenLiq")
        gridLayout_Costos.addWidget(self.Densidad,2,5,1,1)
        gridLayout_Costos.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Diametro:", None)), 2, 1, 1, 1)
        self.Diametro=Entrada_con_unidades(unidades.Length)
        gridLayout_Costos.addWidget(self.Diametro,2,2,1,1)
        gridLayout_Costos.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Longitud:", None)), 3, 1, 1, 1)
        self.Longitud=Entrada_con_unidades(unidades.Length)
        gridLayout_Costos.addWidget(self.Longitud,3,2,1,1)
        gridLayout_Costos.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Espesor:", None)), 4, 1, 1, 1)
        self.Espesor=Entrada_con_unidades(unidades.Length, "Thickness")
        gridLayout_Costos.addWidget(self.Espesor,4,2,1,1)
        gridLayout_Costos.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Cabeza:", None)), 5, 1, 1, 1)
        self.Cabeza=QtWidgets.QComboBox()
        self.Cabeza.addItem(QtWidgets.QApplication.translate("equipment", "Elipsoidal", None))
        self.Cabeza.addItem(QtWidgets.QApplication.translate("equipment", "Semiesférico", None))
        self.Cabeza.addItem(QtWidgets.QApplication.translate("equipment", "Bumped", None))
        self.Cabeza.addItem(QtWidgets.QApplication.translate("equipment", "Liso", None))
        self.Cabeza.currentIndexChanged.connect(self.calcularCostos)
        gridLayout_Costos.addWidget(self.Cabeza, 5, 2, 1, 1)
        gridLayout_Costos.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Espesor (cabeza):", None)), 6, 1, 1, 1)
        self.EspesorCabeza=Entrada_con_unidades(unidades.Length, "Thickness")
        gridLayout_Costos.addWidget(self.EspesorCabeza,6,2,1,1)
        gridLayout_Costos.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Longitud reborde recto:", None)), 7, 1, 1, 1)
        self.LongitudReborde=Entrada_con_unidades(unidades.Length)
        gridLayout_Costos.addWidget(self.LongitudReborde,7,2,1,1)
        gridLayout_Costos.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Volumen:", None)), 6, 4, 1, 1)
        self.Volumen=Entrada_con_unidades(unidades.Volume, "VolLiq", readOnly=True)
        gridLayout_Costos.addWidget(self.Volumen,6,5,1,1)
        gridLayout_Costos.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Peso:", None)), 7, 4, 1, 1)
        self.Peso=Entrada_con_unidades(unidades.Mass, readOnly=True)
        gridLayout_Costos.addWidget(self.Peso,7,5,1,1)
        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(10,10,QtWidgets.QSizePolicy.Fixed,QtWidgets.QSizePolicy.Fixed),2,3,6,1)
        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),8,0,1,6)

        self.Costos=costIndex.CostData(1.7, 3)
        self.Costos.valueChanged.connect(self.calcularCostos)
        gridLayout_Costos.addWidget(self.Costos,9,1,2,5)

        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),11,0,1,6)
        self.groupBox_Costos = QtWidgets.QGroupBox(QtWidgets.QApplication.translate("equipment", "Costos calculados", None))
        gridLayout_Costos.addWidget(self.groupBox_Costos,12,1,1,5)
        gridLayout_5 = QtWidgets.QGridLayout(self.groupBox_Costos)
        gridLayout_5.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Coste Adquisición:", None)),0,1,1,1)
        self.C_adq=Entrada_con_unidades(unidades.Currency, retornar=False, readOnly=True, tolerancia=8, decimales=2)
        gridLayout_5.addWidget(self.C_adq,0,2,1,1)
        gridLayout_5.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate("equipment", "Coste Instalación:", None)),1,1,1,1)
        self.C_inst=Entrada_con_unidades(unidades.Currency, retornar=False, readOnly=True, tolerancia=8, decimales=2)
        gridLayout_5.addWidget(self.C_inst,1,2,1,1)
        gridLayout_Costos.addItem(QtWidgets.QSpacerItem(20,20,QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding),13,0,1,6)

        #Pestaña salida
        self.Salida= UI_corriente.Ui_corriente(readOnly=True)
        self.tabWidget.insertTab(2, self.Salida,QtWidgets.QApplication.translate("equipment", "Salida", None))

        self.tabWidget.setCurrentIndex(0)