예제 #1
0
    def Separar(self, etas):
        """Split solid with efficiency array input
        return two array with solids filtered and no filtered"""
        rendimiento_global = 0
        for i, fraccion in enumerate(self.fracciones):
            rendimiento_global += etas[i] * fraccion

        G_skip = MassFlow(self.caudal * (1 - rendimiento_global))
        G_sep = MassFlow(self.caudal * rendimiento_global)
        if rendimiento_global == 1:
            return None, self
        elif rendimiento_global == 0:
            return self, None
        else:
            f_gas = []
            f_solid = []
            for i in range(len(self.diametros)):
                f_gas.append(self.caudal * self.fracciones[i] * (1 - etas[i]) /
                             G_skip)
                f_solid.append(self.caudal * self.fracciones[i] * etas[i] /
                               G_sep)
            S_skip = Solid(caudalSolido=[G_skip],
                           distribucion_diametro=self.diametros,
                           distribucion_fraccion=f_gas)
            S_sep = Solid(caudalSolido=[G_sep],
                          distribucion_diametro=self.diametros,
                          distribucion_fraccion=f_solid)
            return S_skip, S_sep
예제 #2
0
 def criterio_Changed(self, int):
     if int:
         item = QtWidgets.QTableWidgetItem(QtWidgets.QApplication.translate(
             "pychemqt", "Flow")+", "+MassFlow.text())
         self.fracciones.setHorizontalHeaderItem(0, item)
         self.fracciones.item(self.fracciones.rowCount()-1, 0).setFlags(
             QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsEnabled |
             QtCore.Qt.ItemIsSelectable)
     else:
         item = QtWidgets.QTableWidgetItem(QtWidgets.QApplication.translate(
             "pychemqt", "Flow")+", "+MassFlow.text())
         self.fracciones.setHorizontalHeaderItem(0, item)
         self.fracciones.item(self.fracciones.rowCount()-1, 0).setFlags(
             QtCore.Qt.NoItemFlags)
     self.changeParams("criterio", int)
예제 #3
0
 def criterio_Changed(self, int):
     if int:
         item = QtWidgets.QTableWidgetItem(QtWidgets.QApplication.translate(
             "pychemqt", "Flow")+", "+MassFlow.text())
         self.fracciones.setHorizontalHeaderItem(0, item)
         self.fracciones.item(self.fracciones.rowCount()-1, 0).setFlags(
             QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsEnabled |
             QtCore.Qt.ItemIsSelectable)
     else:
         item = QtWidgets.QTableWidgetItem(QtWidgets.QApplication.translate(
             "pychemqt", "Flow")+", "+MassFlow.text())
         self.fracciones.setHorizontalHeaderItem(0, item)
         self.fracciones.item(self.fracciones.rowCount()-1, 0).setFlags(
             QtCore.Qt.NoItemFlags)
     self.changeParams("criterio", int)
예제 #4
0
    def calculo(self):
        self.entrada = self.kwargs["entrada"]
        metodo = self.kwargs["metodo"]
        self.Pout = Pressure(self.kwargs["Pout"])
        razon = self.kwargs["razon"]
        self.rendimientoCalculado = Dimensionless(self.kwargs["rendimiento"])
        if self.kwargs["etapas"]:
            self.etapas = self.kwargs["etapas"]
        else:
            self.etapas = 1.
        self.power = Power(self.kwargs["trabajo"])

        def f(Pout, rendimiento):
            W_ideal = self.__Wideal(Pout)
            power = W_ideal * self.entrada.caudalmasico.gs / rendimiento
            return power

        if metodo in [0, 3] or (metodo == 5 and self.Pout):
            if self.etapas == 1:
                razon = self.Pout.atm / self.entrada.P.atm
            else:
                razon = (self.Pout.atm / self.entrada.P.atm)**(1. /
                                                               self.etapas)
        elif metodo in [1, 4] or (metodo == 5 and razon):
            if self.etapas == 1:
                self.Pout = Pressure(self.entrada.P * razon)
            else:
                self.Pout = Pressure(razon**self.etapas * self.entrada.P)

        if metodo in [0, 1]:
            Wideal = self.__Wideal(self.Pout.atm)
            power = Wideal * self.entrada.caudalmasico.gs / self.rendimientoCalculado
            self.power = Power(power * self.etapas)
        elif metodo == 2:
            funcion = lambda P: f(P, self.rendimientoCalculado) - self.power
            self.Pout = Pressure(fsolve(funcion, self.entrada.P + 1))
            if self.etapas == 1:
                razon = self.Pout / self.entrada.P
            else:
                razon = (self.Pout / self.entrada.P)**(1. / self.etapas)
        elif metodo in [3, 4]:
            funcion = lambda rendimiento: f(self.Pout.atm, rendimiento
                                            ) - self.power
            self.rendimientoCalculado = Dimensionless(fsolve(funcion, 0.5))
        elif metodo == 5:
            Wideal = self.__Wideal(self.Pout.atm)
            caudalmasico = MassFlow(
                self.power * self.rendimientoCalculado / Wideal, "gs")
            self.Tout = self.__Tout(Wideal)
            self.entrada = self.entrada.clone(caudalMasico=caudalmasico)

        Wideal = self.__Wideal(self.Pout.atm)
        self.Tout = Temperature(self.__Tout(Wideal))
        self.salida = [self.entrada.clone(T=self.Tout, P=self.Pout)]
        self.razonCalculada = Dimensionless(self.Pout / self.entrada.P)
        self.deltaT = DeltaT(self.salida[0].T - self.entrada.T)
        self.deltaP = DeltaP(self.salida[0].P - self.entrada.P)
        self.cp_cv = self.entrada.Gas.cp_cv
        self.Pin = self.entrada.P
        self.Tin = self.entrada.T
예제 #5
0
파일: solids.py 프로젝트: puttak/CheProcess
 def readStatefromJSON(self, solid):
     if solid:
         self._bool = True
         self.status = solid["status"]
         self.ids = solid["ids"]
         self.componente = [Componente(int(i)) for i in self.ids]
         self.caudalUnitario = [MassFlow(q) for q in solid["unitFlow"]]
         self.caudal = MassFlow(solid["caudal"])
         self.diametros = [Length(d, "m", "ParticleDiameter") for d in solid["diametros"]]
         self.fracciones = solid["fracciones"]
         self.fracciones_acumuladas = solid["fracciones_acumuladas"]
         self.diametro_medio = Length(solid["diametro_medio"])
         self.rho = Density(solid["rho"])
         self.T = Temperature(solid["T"])
     else:
         self._bool = False
         self.status = False
예제 #6
0
    def calculo(self):
        if self.kwargs["solids"] is not None:
            self.ids = self.kwargs["solids"]
        else:
            Config = getMainWindowConfig()
            txt = Config.get("Components", "Solids")
            if isinstance(txt, str):
                self.ids = eval(txt)
            else:
                self.ids = txt
        self.componente = [Componente(int(i)) for i in self.ids]

        caudal = self.kwargs.get("caudalSolido", [])
        diametro_medio = self.kwargs.get("diametroMedio", 0.0)
        fraccion = self.kwargs.get("distribucion_fraccion", [])
        diametros = self.kwargs.get("distribucion_diametro", [])

        if self.status == 0:
            self._bool = False
            return
        else:
            self._bool = True

        self.caudalUnitario = [MassFlow(i) for i in caudal]
        self.caudal = MassFlow(sum(self.caudalUnitario))
        self.diametros = diametros
        self.fracciones = fraccion
        if self.status == 2:
            self.diametros = [
                Length(i, "m", magnitud="ParticleDiameter") for i in diametros
            ]
            self.fracciones = fraccion
            diametro_medio = 0
            self.fracciones_acumuladas = [0]
            for di, xi in zip(diametros, fraccion):
                diametro_medio += di * xi
                self.fracciones_acumuladas.append(
                    xi + self.fracciones_acumuladas[-1])
            del self.fracciones_acumuladas[0]
        self.diametro_medio = Length(diametro_medio,
                                     magnitud="ParticleDiameter")
        self.RhoS(self.kwargs.get("T", 300))
예제 #7
0
    def calculo(self):
        self.entrada = self.kwargs["entrada"]
        self.Pout = Pressure(self.kwargs["Pout"])
        self.razon = Dimensionless(self.kwargs["razon"])
        self.rendimientoCalculado = Dimensionless(self.kwargs["rendimiento"])
        self.power = Power(-abs(self.kwargs["trabajo"]))

        def f(Pout, rendimiento):
            W_ideal = self.__Wideal(Pout)
            power = W_ideal * self.entrada.caudalmasico.gs * rendimiento
            return power

        self.cp_cv = self.entrada.Gas.cp_cv

        if self.kwargs["metodo"] in [0, 3] or \
                (self.kwargs["metodo"] == 5 and self.Pout):
            self.razon = Dimensionless(self.Pout / self.entrada.P)
        elif self.kwargs["metodo"] in [1, 4] or \
                (self.kwargs["metodo"] == 5 and self.razon):
            self.Pout = Pressure(self.entrada.P * self.razon)

        if self.kwargs["metodo"] in [0, 1]:
            Wideal = self.__Wideal(self.Pout)
            G = self.entrada.caudalmasico.gs
            self.power = Power(Wideal * G * self.rendimientoCalculado)
        elif self.kwargs["metodo"] == 2:

            def function(P):
                return f(P, self.rendimientoCalculado) - self.power

            self.Pout = Pressure(fsolve(function, self.entrada.P.atm + 1),
                                 "atm")
            self.razon = Dimensionless(self.Pout / self.entrada.P)
        elif self.kwargs["metodo"] in [3, 4]:

            def function(rendimiento):
                return f(self.Pout.atm, rendimiento) - self.power

            self.rendimientoCalculado = Dimensionless(fsolve(function, 0.5))
        elif self.kwargs["metodo"] == 5:
            Wideal = self.__Wideal(self.Pout)
            G = MassFlow(self.power / self.rendimientoCalculado / Wideal, "gs")
            self.Tout = self.__Tout(Wideal)
            self.entrada = self.entrada.clone(caudalMasico=G)

        Wideal = self.__Wideal(self.Pout)
        self.Tout = Temperature(self.__Tout(Wideal))
        self.razonCalculada = Dimensionless(self.Pout / self.entrada.P)
        self.salida = [self.entrada.clone(T=self.Tout, P=self.Pout)]
        self.deltaT = DeltaT(self.salida[0].T - self.entrada.T)
        self.deltaP = DeltaP(self.salida[0].P - self.entrada.P)
        self.Pin = self.entrada.P
        self.Tin = self.entrada.T