コード例 #1
0
def delta_G(entries):
    temperature = float(entries['Temperature_1'].get())
    temperature2 = float(entries['Temperature_2'].get())
    pressure = float(entries['Pressure_1'].get())
    pressure2 = float(entries['Pressure_2'].get())
    name = entries['Name(UpperCase)'].get()
    mw = float(entries['Molecular Weight'].get())
    tc = float(entries['Critical Temperature'].get())
    pc = float(entries['Critical Pressure'].get())
    af = float(entries['Acentric Factor'].get())
    do = float(entries['Dissociation Energy'].get())
    if entries['Is linear (True/False)'].get() == 'True':
        is_linear = True
    else:
        is_linear = False
    gas_or_liquid = entries['Phase_1 (gas/liquid)'].get()
    gas_or_liquid2 = entries['Phase_2 (gas/liquid)'].get()
    gas_chosen = Gases(name, mw, tc, pc, af, do, is_linear, gas_or_liquid)
    gas_chosen2 = Gases(name, mw, tc, pc, af, do, is_linear, gas_or_liquid2)
    PT = Properties(temperature, pressure)
    PT2 = Properties(temperature2, pressure2)
    # Departure Function
    thermodynamic_ideal1 = ThermoIdeal(gas_chosen, PT)
    thermodynamic_ideal2 = ThermoIdeal(gas_chosen2, PT2)
    prEos1 = solDepart(gas_chosen, PT)
    prEos2 = solDepart(gas_chosen2, PT2)
    deltaG = round(thermodynamic_ideal2.Gig() + prEos2.deltaG() - thermodynamic_ideal1.Gig() - prEos1.deltaG(), 5)
    entries['Delta_G'].delete(0, tk.END)
    entries['Delta_G'].insert(0, deltaG)
コード例 #2
0
def calculated_molar_volume(entries):
    # get the parameters
    temperature = float(entries['Temperature_1'].get())
    temperature2 = float(entries['Temperature_2'].get())
    pressure = float(entries['Pressure_1'].get())
    pressure2 = float(entries['Pressure_2'].get())
    name = entries['Name(UpperCase)'].get()
    mw = float(entries['Molecular Weight'].get())
    tc = float(entries['Critical Temperature'].get())
    pc = float(entries['Critical Pressure'].get())
    af = float(entries['Acentric Factor'].get())
    do = float(entries['Dissociation Energy'].get())
    if entries['Is linear (True/False)'].get() == 'True':
        is_linear = True
    else:
        is_linear = False
    gas_or_liquid = entries['Phase_1 (gas/liquid)'].get()
    gas_or_liquid2 = entries['Phase_2 (gas/liquid)'].get()
    # period rate:
    gas_chosen = Gases(name, mw, tc, pc, af, do, is_linear, gas_or_liquid)
    gas_chosen2 = Gases(name, mw, tc, pc, af, do, is_linear, gas_or_liquid2)
    PT = Properties(temperature, pressure)
    PT2 = Properties(temperature2, pressure2)
    # molar volume
    pr_eos = SolvePrEos(gas_chosen, PT)
    pr_eos2 = SolvePrEos(gas_chosen2, PT2)
    vm = pr_eos.solve()
    vm2 = pr_eos2.solve()
    # vm = ("%8.2f" % monthly).strip()
    entries['Molar Volume'].delete(0, tk.END)
    entries['Molar Volume'].insert(0, vm)
    entries['Molar Volume_2'].delete(0, tk.END)
    entries['Molar Volume_2'].insert(0, vm2)
コード例 #3
0
def ideal_thermodynamic_properties(entries):
    temperature = float(entries['Temperature_1'].get())
    temperature2 = float(entries['Temperature_2'].get())
    pressure = float(entries['Pressure_1'].get())
    pressure2 = float(entries['Pressure_2'].get())
    name = entries['Name(UpperCase)'].get()
    mw = float(entries['Molecular Weight'].get())
    tc = float(entries['Critical Temperature'].get())
    pc = float(entries['Critical Pressure'].get())
    af = float(entries['Acentric Factor'].get())
    do = float(entries['Dissociation Energy'].get())
    if entries['Is linear (True/False)'].get() == 'True':
        is_linear = True
    else:
        is_linear = False
    gas_or_liquid = entries['Phase_1 (gas/liquid)'].get()
    gas_or_liquid2 = entries['Phase_2 (gas/liquid)'].get()
    gas_chosen = Gases(name, mw, tc, pc, af, do, is_linear, gas_or_liquid)
    gas_chosen2 = Gases(name, mw, tc, pc, af, do, is_linear, gas_or_liquid2)
    PT = Properties(temperature, pressure)
    PT2 = Properties(temperature2, pressure2)
    # Departure Function
    thermodynamic_ideal = ThermoIdeal(gas_chosen, PT)
    thermodynamic_ideal2 = ThermoIdeal(gas_chosen2, PT2)
    aig = thermodynamic_ideal.Aig()
    uig = thermodynamic_ideal.Uig()
    cv = thermodynamic_ideal.Cv()
    sig = thermodynamic_ideal.Sig()
    hig = thermodynamic_ideal.Hig()
    gig = thermodynamic_ideal.Gig()
    aig2 = thermodynamic_ideal2.Aig()
    uig2 = thermodynamic_ideal2.Uig()
    cv2 = thermodynamic_ideal2.Cv()
    sig2 = thermodynamic_ideal2.Sig()
    hig2 = thermodynamic_ideal2.Hig()
    gig2 = thermodynamic_ideal2.Gig()
    entries['A_ideal gas'].delete(0, tk.END)
    entries['A_ideal gas'].insert(0, aig)
    entries['U_ideal gas'].delete(0, tk.END)
    entries['U_ideal gas'].insert(0, uig)
    entries['Cv'].delete(0, tk.END)
    entries['Cv'].insert(0, cv)
    entries['S_ideal gas'].delete(0, tk.END)
    entries['S_ideal gas'].insert(0, sig)
    entries['H_ideal gas'].delete(0, tk.END)
    entries['H_ideal gas'].insert(0, hig)
    entries['G_ideal gas'].delete(0, tk.END)
    entries['G_ideal gas'].insert(0, gig)
    entries['A_ideal gas_2'].delete(0, tk.END)
    entries['A_ideal gas_2'].insert(0, aig2)
    entries['U_ideal gas_2'].delete(0, tk.END)
    entries['U_ideal gas_2'].insert(0, uig2)
    entries['Cv_2'].delete(0, tk.END)
    entries['Cv_2'].insert(0, cv2)
    entries['S_ideal gas_2'].delete(0, tk.END)
    entries['S_ideal gas_2'].insert(0, sig2)
    entries['H_ideal gas_2'].delete(0, tk.END)
    entries['H_ideal gas_2'].insert(0, hig2)
    entries['G_ideal gas_2'].delete(0, tk.END)
    entries['G_ideal gas_2'].insert(0, gig2)
コード例 #4
0
ファイル: Iterations.py プロジェクト: yifan-deng/Absorber
 def next_stage(self, previous_stage):
     Ya = previous_stage.Mixing_gas.gas_composition()[
         1, 1] + self.iterate_for_GLI(previous_stage)[1]
     Ys = previous_stage.Mixing_gas.gas_composition()[
         2, 1] + self.iterate_for_GLI(previous_stage)[2]
     yb = 1 / (Ya + Ys + 1)
     ya = Ya / (Ya + Ys + 1)
     ys = Ys / (Ya + Ys + 1)
     C_MEA = previous_stage.Mixing_liquid.matrix()[
         0, 2] + self.iterate_for_GLI(previous_stage)[3]
     C_H2O = previous_stage.Mixing_liquid.matrix()[
         1, 2] + self.iterate_for_GLI(previous_stage)[4]
     C_MEACOO_MEAH = previous_stage.Mixing_liquid.matrix()[
         2, 2] + self.iterate_for_GLI(previous_stage)[5]
     y_MEA = C_MEA / (C_MEA + C_H2O + C_MEACOO_MEAH)
     y_H2O = C_H2O / (C_MEA + C_H2O + C_MEACOO_MEAH)
     y_MEACOO_MEAH = C_MEACOO_MEAH / (C_MEA + C_H2O + C_MEACOO_MEAH)
     TL = self.iterate_for_GLI(previous_stage)[6]
     TG = self.iterate_for_GLI(previous_stage)[7]
     properties_gas = Properties(
         TG, previous_stage.Mixing_gas.properties.pressure)
     properties_liquid = Properties(
         TL, previous_stage.Mixing_liquid.properties.pressure)
     gas1 = previous_stage.Mixing_gas.gas1
     gas2 = previous_stage.Mixing_gas.gas2
     gas3 = previous_stage.Mixing_gas.gas3
     Gb = previous_stage.Mixing_gas.Gb
     current_mixing_gas = Mixing_gas(Gb, properties_gas, gas1, yb, gas2, ya,
                                     gas3, ys,
                                     previous_stage.Mixing_gas.k12,
                                     previous_stage.Mixing_gas.k13,
                                     previous_stage.Mixing_gas.k23)
     velocity = previous_stage.Mixing_liquid.velocity
     liquid1 = previous_stage.Mixing_liquid.liquid1
     liquid2 = previous_stage.Mixing_liquid.liquid2
     liquid3 = previous_stage.Mixing_liquid.liquid3
     current_mixing_liquid = Mixing_liquid(velocity, properties_liquid,
                                           liquid1, y_MEA, C_MEA, liquid2,
                                           y_H2O, C_H2O, liquid3,
                                           y_MEACOO_MEAH, C_MEACOO_MEAH)
     current_packing = previous_stage.Mass_transfer.Packing
     current_mass_transfer = mass_transfer(current_mixing_liquid,
                                           current_mixing_gas,
                                           current_packing)
     current_stage = stage(current_mixing_gas, current_mixing_liquid,
                           current_mass_transfer)
     return current_stage
コード例 #5
0
def departure_function(entries):
    temperature = float(entries['Temperature_1'].get())
    temperature2 = float(entries['Temperature_2'].get())
    pressure = float(entries['Pressure_1'].get())
    pressure2 = float(entries['Pressure_2'].get())
    name = entries['Name(UpperCase)'].get()
    mw = float(entries['Molecular Weight'].get())
    tc = float(entries['Critical Temperature'].get())
    pc = float(entries['Critical Pressure'].get())
    af = float(entries['Acentric Factor'].get())
    do = float(entries['Dissociation Energy'].get())
    if entries['Is linear (True/False)'].get() == 'True':
        is_linear = True
    else:
        is_linear = False
    gas_or_liquid = entries['Phase_1 (gas/liquid)'].get()
    gas_or_liquid2 = entries['Phase_2 (gas/liquid)'].get()
    gas_chosen = Gases(name, mw, tc, pc, af, do, is_linear, gas_or_liquid)
    gas_chosen2 = Gases(name, mw, tc, pc, af, do, is_linear, gas_or_liquid2)
    PT = Properties(temperature, pressure)
    PT2 = Properties(temperature2, pressure2)
    # Departure Function
    sol_depart = solDepart(gas_chosen, PT)
    sol_depart2 = solDepart(gas_chosen2, PT2)
    deltaH = sol_depart.deltaH()
    deltaS = sol_depart.deltaS()
    deltaG = sol_depart.deltaG()
    deltaH2 = sol_depart2.deltaH()
    deltaS2 = sol_depart2.deltaS()
    deltaG2 = sol_depart2.deltaG()
    entries['H_real - H_ideal'].delete(0, tk.END)
    entries['H_real - H_ideal'].insert(0, deltaH)
    entries['S_real - S_ideal'].delete(0, tk.END)
    entries['S_real - S_ideal'].insert(0, deltaS)
    entries['G_real - G_ideal'].delete(0, tk.END)
    entries['G_real - G_ideal'].insert(0, deltaG)
    entries['H_real - H_ideal_2'].delete(0, tk.END)
    entries['H_real - H_ideal_2'].insert(0, deltaH2)
    entries['S_real - S_ideal_2'].delete(0, tk.END)
    entries['S_real - S_ideal_2'].insert(0, deltaS2)
    entries['G_real - G_ideal_2'].delete(0, tk.END)
    entries['G_real - G_ideal_2'].insert(0, deltaG2)
コード例 #6
0
ファイル: tkinterDemo.py プロジェクト: yifan-deng/Absorber
def calculated_molar_volume(gas_chosen, temperature, pressure):
    CH3CL = Gases('CH3Cl', 50.49, 412.6, 6680000, 0.151, 1552046.088274, False,
                  'gas')
    CH4 = Gases('CH4', 16.043, 190.6, 4610000, 0.0115, 1552046.088274, True,
                'gas')
    PT = Properties(temperature, pressure)
    if gas_chosen == 'CH3CL':
        solPrEos1 = SolvePrEos(CH3CL, PT)
        return solPrEos1.solve()
    if gas_chosen == 'CH4':
        solPrEos1 = SolvePrEos(CH4, PT)
        return solPrEos1.solve()
コード例 #7
0
from Model.Packing import Packing
from Model.Properties import Properties
from Control.SolvePrEos import SolvePrEos
from Model.binary_diffusivity import binary_diffusivity
import math

from Model.heat_transfer_coeff import heat_transfer_coefficient
from Model.stage import stage

AIR = Gases('AIR', 28.9647, 132.63, 3785800, 0.036)
CO2 = Gases('CO2', 44, 304.1, 7380000, 0.225)
H2O = Gases('H2O', 18, 647.15, 22050000, 0.344)
MEA = Liquid('MEA', 61.08)
H2O_L = Liquid('H2O_L', 18)
MEACOO = Liquid('MEACOO', 104)
PT_gas = Properties(292.15, 101325)
PT_liquid = Properties(312.47, 101325)
mixture_gas = Mixing_gas(14.8, PT_gas, AIR, 0.8050, CO2, 0.1950, H2O, 0, 0, 0,
                         0)
mixture_liquid = Mixing_liquid(0.0037, PT_liquid, MEA, 0.0023, 130, H2O,
                               0.9647, 54714, MEACOO, 0.033, 1870)
berl_saddle = Packing('berl_saddle', 1.364, 0.232, 0.65, 545, 0.0127)
column = Column(0.1, 6.55)
mass_transfer1 = mass_transfer(mixture_liquid, mixture_gas, berl_saddle)
stage1 = stage(mixture_gas, mixture_liquid, mass_transfer1)
it_test = iteration(0.01, column, berl_saddle, stage1)

print(mass_transfer1.heat_transfer_gas())
print(mixture_gas.mix_molar_heat_capacity())
print(mass_transfer1.average_kg())
print(mixture_gas.mix_density())