Example #1
0
 def calculo(self):
     ind1 = self.Comp1.currentIndex()
     ind2 = self.Comp2.currentIndex()
     if ind1 != ind2:
         zi = arange(0.025, 1., 0.025)
         id1 = self.indices[ind1]
         id2 = self.indices[ind2]
         x = [0]
         y = [0]
         for z in zi:
             try:
                 fraccion = [0.] * len(self.indices)
                 fraccion[ind1] = z
                 fraccion[ind2] = 1 - z
                 mez = Mezcla(tipo=3,
                              fraccionMolar=fraccion,
                              caudalMasico=1.)
                 tb = mez.componente[0].Tb
                 corr = Corriente(T=tb, P=101325., mezcla=mez)
                 T = corr.eos._Dew_T()
                 corr = Corriente(T=T, P=101325., mezcla=mez)
                 while corr.Liquido.fraccion[0] == corr.Gas.fraccion[
                         0] and corr.T < corr.mezcla.componente[1].Tb:
                     corr = Corriente(T=corr.T - 0.1, P=101325., mezcla=mez)
                 x.append(corr.Liquido.fraccion[0])
                 y.append(corr.Gas.fraccion[0])
             except:
                 pass
         x.append(1)
         y.append(1)
         self.rellenar(x, y)
Example #2
0
    def calculo(self):
        if self.todos_datos():

            self.rellenoSalida()

    def rellenoSalida(self):
        pass

    def todos_datos(self):
        pass

    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())



if __name__ == "__main__":
    import sys
    from lib.corriente import Corriente, Mezcla
    app = QtWidgets.QApplication(sys.argv)
    agua=Corriente(300, 1, 3600, Mezcla([62], [1]))
    dialogo = UI_equipment(agua)
    dialogo.show()
    sys.exit(app.exec_())
Example #3
0
            self.tiempo.setResaltado(False)
            self.deltaP.setReadOnly(False)
            self.deltaP.setRetornar(True)
            self.deltaP.setResaltado(True)
        else:
            self.numFiltros.setReadOnly(True)
            self.numFiltros.setRetornar(False)
            self.numFiltros.setResaltado(False)
            self.tiempo.setReadOnly(False)
            self.tiempo.setRetornar(True)
            self.tiempo.setResaltado(True)
            self.deltaP.setReadOnly(False)
            self.deltaP.setRetornar(True)
            self.deltaP.setResaltado(True)


if __name__ == "__main__":
    import sys
    from lib.corriente import Mezcla, Corriente, Solid
    app = QtWidgets.QApplication(sys.argv)
    distribucion = [[17.5, 0.02], [22.4, 0.03], [26.2, 0.05], [31.8, 0.1],
                    [37, 0.1], [42.4, 0.1], [48, 0.1], [54, 0.1], [60, 0.1],
                    [69, 0.1], [81.3, 0.1], [96.5, 0.05], [109, 0.03],
                    [127, 0.02]]

    solido = Solid([64], [138718], distribucion)
    entrada = Corriente(423.15, 3, 11784, Mezcla([475], [1]), solido)
    dialogo = UI_equipment(entrada)
    dialogo.show()
    sys.exit(app.exec_())
Example #4
0
                A2 = 0.26507
            else:
                m = 0.581981 + 0.17141 * compuesto.f_acent - 1.84441 * compuesto.f_acent**2 + 1.19047 * compuesto.f_acent**3
                A0 = 0.79355
                A1 = -0.53409
                A2 = 0.37273
        else:
            A0, A1, A2 = compuesto.Yu_Lu
        if Tr < 1:
            alfa = 10**(m * (A0 + A1 * Tr + A2 * Tr**2) * (1 - Tr))
        else:
            alfa = 10**(m * (A0 + A1 + A2) * (1 - Tr))
        b = (0.0892828 - 0.0640903 * compuesto.f_acent - 0.00518289 *
             compuesto.f_acent**2) * R_atml * compuesto.Tc / compuesto.Pc.atm
        c = b * (-1.29917 + 0.648463 * compuesto.f_acent +
                 0.895926 * compuesto.f_acent**2)
        return ac * alfa, b, c


_all = [
    van_Waals, RK, Wilson, Fuller, SRK, SRK_API, MSRK, SRK_Graboski, PR, PRSV,
    PR_Gasem, PR_Melhem, PR_Almeida
]

if __name__ == "__main__":
    from lib.corriente import Mezcla
    mezcla = Mezcla(1, ids=[98], caudalUnitarioMasico=[1.])
    for T in [125, 135, 145, 165, 185, 205]:
        eq = Virial(T, 1, mezcla)
        print eq.H_exc
Example #5
0
        return tital, titav

    def _Z(self, xi):
        return None,


_all = [Grayson_Streed]

if __name__ == "__main__":
    from lib.corriente import Mezcla
    from lib import unidades

    # Example 7.2, pag 153
    # Method pag 107
    mezcla = Mezcla(2,
                    ids=[1, 2, 40, 41],
                    caudalUnitarioMolar=[0.31767, 0.58942, 0.07147, 0.02144])
    P = unidades.Pressure(485, "psi")
    T = unidades.Temperature(100, "F")
    eq = Grayson_Streed(T, P, mezcla, flory=0)

    # mix = Mezcla(2, ids=[2, 3, 4, 6, 5, 8, 46, 49, 50, 22],
    #              caudalUnitarioMolar=[1]*10)
    # eq = Grayson_Streed(293.15, 5e6, mix, flory=0)

    # Example 4.2, pag 89
    # mezcla = Mezcla(1, ids=[4, 40], caudalUnitarioMasico=[26.92, 73.08])
    # P = unidades.Pressure(410.3, "psi")
    # T = unidades.Temperature(400, "F")
    # eq = Grayson_Streed(T, P, mezcla)
Example #6
0
        a5, b5 = 0.528629, 0.349261
        a6, b6 = 0.484011, 0.754130
        a7, b7 = 0.0705233, -0.044448
        a8, b8 = 0.504087, 1.32245
        a9, b9 = 0.0307452, 0.179433
        a10, b10 = 0.0732828, 0.463492
        a11, b11 = 0.006450, -0.022143

        Bo = (a1 + b1 * cmp.f_acent) * cmp.Vc
        Ao = (a2 + b2 * cmp.f_acent) * R_atml * cmp.Tc * cmp.Vc
        Co = (a3 + b3 * cmp.f_acent) * R_atml * cmp.Tc**3 * cmp.Vc
        gamma = (a4 + b4 * cmp.f_acent) * (cmp.Vc)**2
        b = (a5 + b5 * cmp.f_acent) * (cmp.Vc)**2
        a = (a6 + b6 * cmp.f_acent) * R_atml * cmp.Tc * (cmp.Vc)**2
        alfa = (a7 + b7 * cmp.f_acent) * (cmp.Vc)**3
        c = (a8 + b8 * cmp.f_acent) * R_atml * cmp.Tc**3 * (cmp.Vc)**2
        Do = (a9 + b9 * cmp.f_acent) * R_atml * cmp.Tc**4 * cmp.Vc
        d = (a10 + b10 * cmp.f_acent) * R_atml * cmp.Tc**2 * (cmp.Vc)**2
        Eo = (a11 + b11 * cmp.f_acent *
              exp(-3.8 * cmp.f_acent)) * R_atml * cmp.Tc**5 * cmp.Vc

        return Ao, Bo, Co, Do, Eo, a, b, c, d, alfa, gamma

_all = [BWRS]

if __name__ == "__main__":
    from lib.corriente import Mezcla
    mezcla = Mezcla(ids=[10, 38, 22, 61], fraccionMolar=[0.3, 0.5, 0.05, 0.15])
    eq = BWRS(340, 1., mezcla)
    print(eq.x)
Example #7
0
    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()


if __name__ == "__main__":
    import sys
    from lib.corriente import Mezcla, Punto_Psicrometrico, Corriente, Solid
    app = QtGui.QApplication(sys.argv)
    distribucion = [[96.5, 0.02], [105, 0.05], [110, 0.1], [118, 0.15],
                    [125, 0.25], [130, 0.2], [140, 0.15], [150, 0.05],
                    [170, 0.03]]

    solido = Solid([638], [100], distribucion)
    entradaSolido = Corriente(300, 1, 1, Mezcla([62], [1.]), solido)
    aire = Punto_Psicrometrico(caudal=1000, tdb=300, H=0)
    dialogo = UI_equipment(entradaSolido, aire)
    dialogo.show()
    sys.exit(app.exec_())
Example #8
0
    # Method pag 107
    # mezcla = Mezcla(2, ids=[1, 2, 40, 41],
    # caudalUnitarioMolar=[0.31767, 0.58942, 0.07147, 0.02144])
    # P = unidades.Pressure(485, "psi")
    # T = unidades.Temperature(100, "F")
    # eq = Grayson_Streed(T, P, mezcla, flory=0)

    # mix = Mezcla(2, ids=[2, 3, 4, 6, 5, 8, 46, 49, 50, 22],
    #              caudalUnitarioMolar=[1]*10)
    # eq = Grayson_Streed(293.15, 5e6, mix, flory=0)

    # Example 4.2, pag 89
    # mezcla = Mezcla(1, ids=[4, 40], caudalUnitarioMasico=[26.92, 73.08])
    # P = unidades.Pressure(410.3, "psi")
    # T = unidades.Temperature(400, "F")
    # eq = Grayson_Streed(T, P, mezcla)

    # Example 6.7, Wallas, pag 342, dew point calculation
    mezcla = Mezcla(2, ids=[23, 5], caudalUnitarioMolar=[0.607, 0.393])
    P = unidades.Pressure(20, "atm")
    eq = Grayson_Streed(400, P, mezcla, flory=0)
    print(eq._Dew_T(P))
    eq = Grayson_Streed(300, P, mezcla, flory=0)
    print(eq._Dew_T(P))

    # mix = Mezcla(2, ids=[2, 3, 4, 6, 5, 8, 46, 49, 50, 22],
    # caudalUnitarioMolar=[1]*10)
    # eq = Grayson_Streed(293.15, 8.769e6, mix, flory=0)

    print(eq._Bubble_T(P))
Example #9
0
    # print(eq._Dew_T())

    # mix = Mezcla(2, ids=[2, 3, 4, 6, 5, 8, 46, 49, 50, 22], caudalUnitarioMolar=[1]*10)
    # eq = PR(293.15, 8.769e6, mix)
    # print(eq._Bubble_T()-273.15)

    # mix = Mezcla(2, ids=[2, 3, 4], caudalUnitarioMolar=[0.3, 0.3, 0.4])
    # eq = PR(293.15, 2e6, mix)
    # print(eq._Dew_T()-273.15)

    # # Examples ref [2]_ eos
    x1 = [0.39842, 0.29313, 0.20006, 0.07143, 0.03696]
    x2 = [0.014, 0.943, 0.027, 0.0074, 0.0049, 0.001, 0.0027]
    x3 = [0.6436, 0.0752, 0.0474, 0.0412, 0.0297, 0.0138, 0.0303, 0.0371,
          0.0415, 0.0402]
    mix1 = Mezcla(2, ids=[3, 4, 6, 8, 10], caudalUnitarioMolar=x1)
    mix2 = Mezcla(2, ids=[46, 2, 3, 4, 6, 8, 10], caudalUnitarioMolar=x2)
    mix3 = Mezcla(2, ids=[2, 3, 4, 6, 8, 10, 11, 12, 13, 14], caudalUnitarioMolar=x3)
    # eq = PR(370, 1e6, mix3)
    # print(eq._Dew_T(5e6))

    eq = PR(270, 1e7, mix3)
    print(eq._Bubble_P(370)[0]*1e-6)
    print(eq._Dew_P(480)[0]*1e-6)

    # from lib.mezcla import Mezcla
    # from lib import unidades
    # from lib.compuestos import Componente

    # ch4 = Componente(2)
    # ch4.Tc, ch4.Pc, ch4.f_acent = 190.564, 4599200, 0.011