import biosteam as bst bst.main_flowsheet.set_flowsheet('Chemical_scrubbing_biogas') chemicals = bst.Chemicals( ['Water', 'CO2', 'CH4', 'H2S', 'N2', 'O2','Monoethanolamine'] ) bst.settings.set_thermo(chemicals) bst.settings.mixture.include_excess_energies = True # More rigorous results considering high-pressures raw_biogas=bst.Stream( 'raw_biogas', CH4=214.84, CO2=382.8, H2S=0.228, N2=3.12, O2=3.57, T=298.15, P=101325, total_flow=500, units='kg/hr', phase='g' ) amine=bst.Stream('amine',Monoethanolamine=200, units='kmol/hr',phase='l') gas_rec=bst.Stream('gas_rec', ) air_in=bst.Stream('air_in', N2=987.91, O2=299.96, units='kg/hr', phase='g' ) sol_fl = bst.Stream('sol_fl') rich_solution = bst.Stream('rich_solution', CO2=614.26, CH4=11.29, H2S=0.27, N2=0.073, O2=0.16, H2O=84365, units='kg/hr', phase='l', P=1e6 ) gas_out=bst.Stream('gas_out') gas_exit=bst.Stream('gas_exit') cooledbg=bst.Stream('cooledbg') gasrec=bst.Stream('gasrec') makeup=bst.Stream('makeup') fresh_water=bst.Stream('fresh_water', water=2000, units='kg/hr') process_water=bst.Stream('process_water') water_rec=bst.Stream('water_rec', water=82370,units='kg/hr') water=bst.Stream('water') liquid=bst.Stream('liquid') with bst.System() as sys: U101 = bst.IsentropicCompressor('U101',raw_biogas, outs='raw_biogas_0',P=350000, eta=0.75) hx1=bst.HXutility('HX1', ins=U101-0, outs='raw_biogas_1', T=308.15) U103=bst.IsentropicCompressor('U103',hx1-0,outs='comrb',P=1050000,eta=0.75) P1=bst.Pump('P1',ins=makeup,P=1e6) hx2=bst.HXutility('HX2',ins=U103-0, outs=cooledbg,T=308.15) U104 = bst.Absorber( 'U104', T=308.15, N_stages=9, ins=[P1-0, cooledbg], solute="CO2", outs=('biomethane_outlet','rich_amine'), P=150000 ) raw_biogas.set_feed_priority(0) # Make simulations start here. fresh_water.empty() V1=bst.Valve('V1',U104-1) hx3=bst.HXutility('HX3',ins=[V1-0],T=368.15) U105=bst.Stripper('U105',T=375.15,N_stages=9, solute="CO2",ins=hx3-0,outs=('gas',liquid),P=300000) M1=bst.Mixer('M1',ins=[amine, water,liquid]) @M1.add_specification(run=True, args=[0.30]) def adjust_MEA_content(MEA_fraction): MEA_in_amine=amine.imass['Monoethanolamine'] MEA_in_liquid=liquid.imass['Monoethanolamine'] total_MEA = MEA_in_amine + MEA_in_liquid total_in_mass = sum(stream.F_mass for stream in M1.ins) required_MEA_mass= MEA_fraction * total_in_mass additional_MEA_needed = required_MEA_mass - total_MEA hx4=bst.HXutility('HX4',ins=M1-0,outs=makeup,T=318.15) sys.simulate() sys.diagram(number=True, kind='cluster')