Matlab Code For Pressure Swing Adsorption Unit

Posted Under: Chemical Engineering

Ask A Question
Viewed 26
I need someone to write me MATLAB Code for Pressure Swing Adsorption Unit for purifying hydrogen gas. The models for such a system can be seen in the attached paper.

This order does not have tags, yet.

Congresso de Métodos Numéricos em Engenharia 2015 Lisboa, 29 de Junho a 2 de Julho 2015 c©APMTAC, Portugal 2015 SIMULATION OF A PRESSURE SWING ADSORPTION SYSTEM: MODELING A MODULAR ADSORPTION UNIT Márcio R. V. Neto1∗, Rafael V. Ferreira2 and Marcelo Cardoso2 1: Department of Chemical Engineering School of Engineering Federal University of Minas Gerais Address: 6627 Antônio Carlos Avenue, Pampulha, Zip Code 31.270-901, Belo Horizonte/MG, Brazil. e-mail: 2: Department of Chemical Engineering School of Engineering Federal University of Minas Gerais Address: 6627 Antônio Carlos Avenue, Pampulha, Zip Code 31.270-901, Belo Horizonte/MG, Brazil. e-mail: 3: Department of Chemical Engineering School of Engineering Federal University of Minas Gerais Address: 6627 Antônio Carlos Avenue, Pampulha, Zip Code 31.270-901, Belo Horizonte/MG, Brazil. e-mail: Keywords: Pressure Swing Adsorption, Dynamic Simulation, Numerical Solution Abstract. Hydrogen High Purity Grade is an important compound in oil refineries due to its capability of withdrawing sulfur impurities in gasoline and diesel. This valuable feedstock is commonly produced in large scale by a Steam Methane Reforming process and is purified in batteries of adsorption columns. This work deals with numerically solving the model of a pressure-swing adsorption (PSA) column used for hydrogen purification. Five different numerical techniques were employed: Finite Differences, Method of Lines with Finite Differences, Method of Lines with Orthogonal Collocation, Fourier Transform and Method of Characteristics. The goal of this study was to develop a quick and robust application to simulate a single bed PSA unit and be incorporated in dynamic simulators. This model had been previously validated by comparison with data available in literature. The Method of Lines was considered to be the best numerical technique to solve a typical PSA column. 1 Márcio R. V. Neto, Rafael V. Ferreira and Marcelo Cardoso 1 INTRODUCTION 1.1 Pressure swing adsorption Hydrogen gas plays a fundamental role in sulfur impurities removal processes in oil derivate products, such as gasoline and diesel. Steam reforming of natural gas, or steam methane reforming (SMR), is the most common method of hydrogen production on a large scale in oil refineries [7]. In this process, a mixture of steam and natural gas [9], (or in certain situations, nafta which substitutes methane [5]), reacts at a high temperature in the presence of a catalyst to form a mixture of carbon dioxide and hydrogen, according to the following equations [4]: CH4(g) +H2O(g) CO(g) + 3H2(g) (1) CH4(g) + 2H2O(g) CO2(g) + 4H2(g) (2) CO(g) +H2O(g) CO2(g) +H2(g) (3) Before the hydrogen produced by this reforming process is delivered to the consumers, it must be sent to a purification unit that removes any unconverted methane and steam along with carbon monoxide and carbon dioxide [4], [3]. Pressure swing adsorption (PSA) is widely used for hydrogen purification. The impurities are desorbed by charging a column containing the adsorbent with the gas mixture and then pressurizing the column to a pressure sufficient to cause the adsorption of the gases. Hydrogen is not adsorbed when the impurities are pulled from the gas stream. When the column pressure is reduced to about atmospheric pressure, the column is evacuated in a countercurrent direction to withdrawthe impurities from the column. The present operation is particularly advantageous to achieve a very high level of purified hydrogen [5], [13]. 1.2 Operation and modelling of a PSA column The PSA adsorption process is based on internal pressure modulation in the vessel where greater or lesser pressure during an operation cycle determines the degree of gases re- tained by the adsorption bed inside the column as well the level of impurities inside the column. In general, a single PSA vessel passes through five elementary steps along an- operation cycle: adsorption; concurrent depressurization; countercurrent depressurization or blowdown; light-product purge and repressurization. On average, a single adsorption operation takes 10 to 20 minutes per PSA.These steps and the streams are shown in the Figure 1, adapted from [5]. Being a batch process, the regeneration step of the adsorption bed after its saturation is always essential.In order to ensure that the processes of hydrogen purification occurs 2 Márcio R. V. Neto, Rafael V. Ferreira and Marcelo Cardoso Figure 1: Elementary steps of a PSA cycle operation. continuously, a set of at least four columns are needed.The vessels in a PSA unit operate simultaneously under different pressures and other conditions depending on which step each column is at the moment [5]. The dynamic mathematical models of a single adsorbent bed are required to simulate an H2-PSA unit. The simulation may be used to train operators by embedding it in Oper- ator Training Simulator (OTS) systems, as well as to optimize the hydrogen purification process. Different models for a single adsorbent bed have been studied and proposed in literature. This paper deals with numerical issues involved in the Partial Differen- tial Equation (PDE) solution of a single bed model of a H2-PSA unit [15], [12]. For these simulations, five different numerical techniques were employed: Finite Differences (FD), Method of Lines with Finite Differences (MOL-FD), Fast Fourier Transform (FFT), Method of Lines with Orthogonal Collocation (MOL-OC), and Method of Characteristics (MOC). This study aims at developing a dynamical model for a PSA column that can be embedded into existing simulators. It is not required that the model be extremely precise, as it is intended to assist in operators training. It is, however, necessary that its running time be low, in order to prevent communication delays between the simulator and the model. Too high a running time would compromise the concept of real-time dynamic simulation which is central to any operators training software. 1.3 Mathematical modelling The dynamic behavior of PSA columns results from the interaction of fluid dynamics, adsorption equilibrium and mass transfer. For that reason, the mathematical modeling of such systems requires that appropriate models for each of these components be selected. 3 Márcio R. V. Neto, Rafael V. Ferreira and Marcelo Cardoso The mass transfer model chosen was the linear driving-force model, also known as LDF. It assumes that the rate of mass transfer is directly proportional to the mass transfer driving-force, namely the difference between the actual concentration of adsorbed gas in the solid phase and the theoretical concentration that would exist under equilibrium conditions [16], [2] [3], [6], [15]. ∂qi ∂t = ki (q ∗ i − qi) (4) When in contact with a gas mixture for enough time, an adsorbent material will adsorb a certain amount of each component of the mixture and reach equilibrium [8]. The relation between the amount adsorbed of a given compound and the total pressure at a fixed temperature is called an adsorption isotherm. There are many isotherm models, one of the most common being the Langmuir single-site model [15], which is the model chosen for this paper: q∗i = qsati biPi 1 + ∑ j bjPj (5) qsati = a1,i + a2,i T (6) bi = b0,i exp ( b1,i T ) (7) The mass balance for the one-dimensional flow of PSA systems can be written as follows [1]: � ∂Ci ∂t + (1− �) ρs ∂qi ∂t + ∂vC ∂x = DL ∂2Ci ∂t2 (8) If we were to omit the axial dispersion term (which is a reasonable assumption that greatly simplifies the model), the resulting mass balance would be reduced to [1]: � ∂Ci ∂t + (1− �) ρs ∂qi ∂t + ∂vC ∂x = 0 (9) We will assume throughout this paper that the PSA column operates under isothermal conditions. For that reason, no explicit energy balance equations are required. This assumption was made due to the fact that by dropping PDEs, the model becomes less 4 Márcio R. V. Neto, Rafael V. Ferreira and Marcelo Cardoso complex an, therefore, gains speed. As in any viscous flow though porous media, there occurs pressure drops due to the viscous energy losses and to the drop of kinetic energy. A fairly common equation used to model these effects is the Ergun equation [1]: −dP dz = 150µ (1− �2) d2p� 3 v + 1.75 dp 1− � �3 (∑ i Mw,iCi ) v|v| (10) 1.4 Numerical methods Five techniques were employed for solving the model. A brief description of each of them follows. 1. Finite Differences (FD) - from explicit algebraic approximations of the derivatives in a rectangular grid, a linear system is obtained, from which the PDEs are solved. 2. Method of Lines with Finite Differences (MOL-FD) - the domain is spatially dis- cretized and the PDEs are thus transformed into a system of ODEs. The so obtained system is solved by any time-stepping scheme such as the explicit Euler’s method, as was the case with our system. 3. Fast Fourier Transform (FFT) - upon taking the Fourier transform of the original set of PDEs, a new set of differential equations is obtained. The dependent vari- ables of these new equations are the Fourier transforms of the original variables. A time-stepping scheme (Euler) is then used to calculate the time evolution of the transformed PDEs. After each iteration, the inverse Fourier transform is applied to the transformed values, thus recovering the meaningful values. On the next itera- tion, Fourier transform is applied again, Euler’s method evaluates the new values for the transformed variables and, again, the inverse transform is applied, recovering the original variables. The process is repeated for as man times as necessary. The main advantages of the Fourier Transform is its spectral accuracy and its relatively low running times - O (n log n). It does, however, impose tight restrictions on the types of functions on which it may be applied, namely, the functions must be peri- odic. The PSA differential equations do not yield, in general, periodic results. This problem may be circumvented, however, by using their periodic extensions. 4. Method of Lines with Orthogonal collocation (MOL-OC) - much like the MOL-FD, the original set of PDEs is thought of as a system of ODEs. However, instead of replacing the space derivatives for finite difference approximations, the derivatives are calculated by fitting a Lagrange polynomial to the function at each iteration. It is a very widespread technique for solving adsorption-related problems. 5. Method of Characteristics (MOC) - It is very popular in fluid mechanics related fields. In order to solve the PDE, the Method of Characteristics analytically seeks 5 Márcio R. V. Neto, Rafael V. Ferreira and Marcelo Cardoso the characteristic curves of the PDE (a reparametrization which allows for direct integration) and solve it over these characteristics. The finite difference approximations used were of the form: [ ∂f ∂x ] i = fi−1 − fi ∆x (11) A more comprehensive discussion on FD, MOL-FD and MOL-OC can be found in [11]. As for the MOC, a good description can be found in [14] 2 METHODOLOGY 2.1 Hardware and software The model applied to simulate the single unit evaluated in this study was developed using the software MATLABr version R2013a, and installed on a machine withthe following hardware configurations: Item Configuration Processor Intel r CoreTM i7, 2.00 GHz Memory (RAM) 6,00 GB System type 64 bits Operational system Windows 8 Table 1: System hardware and operating system characteristics. As previously mentioned, five numerical methods for solving the set of partial differential equations were evaluated (FD, MOL-FD, FFT, MOL-OC, and MOC).In order to compare the performance of each one, the number of points used and the time spent to perform the calculations and data processing were the main variables investigated. The method that is to be used as the default in the PSA unit simulations is be one that yields the best relationship between accuracy and running time. The dynamic model was developed to operate with several commercial dynamic process simulators. At the moment, the model is being embedded in an ExcelTM spreadsheet which can be used to exchenge data with our current simulator. We restricted ourselves to only simulating the adsorption stage, as it is the most significative step in the overall operation. 2.2 Case of study In this workthe adsorption of hydrogen impurities through a pressure swing operation was simulated. The adsorption column studied is equipped with three different adjacent zeolite layers, whose heights are ∆Z1, ∆Z2 and ∆Z3 respectively. The specifications for this column are displayed in Figure 2 and in Table 2. 6 Márcio R. V. Neto, Rafael V. Ferreira and Marcelo Cardoso Symbol Meaning Value ∆Zc Total column height 4800 mm Dc Inner diameter 2000 mm ∆P Total pressure drop 0.5 kgf/cm2 ∆Z1 Height of Zeolite H-1 layer 1600 mm ∆Z2 Height of Zeolite H-1-4 layer 1600 mm ∆Z3 Height of Zeolite H-2-10 layer 1600 mm Table 2: Specifications of the PSA column to be simulated. Figure 2: Schematic diagram of the PSA column to be simulated. The thermodynamic parameters used are displayed in Table 3. The composition of the gas mixture fed to the PSA column is shown in Table 4 and it was taken from historical data. 3 RESULTS AND DISCUSSION The results are presented as follows: a comparison of each numerical method with all the others with respect to its accuracy and its computational time is presented and, afterwards, the concentration profiles of each component (CO, H2, CO2, N2 and CH4) along the reactor length is shown as calculated through the numerical method considered best. An error measure was defined as follows: 7 Márcio R. V. Neto, Rafael V. Ferreira and Marcelo Cardoso Layer Component ai,1 x 10 3 (mol/g) ai,2 (K) bi,0 (mmHg) k (s−1) � (-) dp (m) H-1 H2 1.24 0.36 2.2 1 CO -0.58 0.84 2.53 0.3 N2 -0.23 1.015 6.38 0.15 0.4 0.027 CO2 2.09 0.63 0.67 0.1 CH4 -0.29 1.04 6.44 0.4 H-1-4 H2 1.23 0.357 2.19 1 CO -0.56 0.81 2.57 0.15 N2 -0.198 1.017 6.37 0.2 0.4 0.027 CO2 2.075 0.624 0.659 0.05 CH4 -0.28 1.036 6.53 0.4 H-2-10 H2 4.32 0.0 6.72 1 CO 0.92 0.52 7.86 0.147 N2 -1.75 1.95 25.9 0.19 0.4 0.027 CO2 -14.2 6.63 33.03 0.046 CH4 -1.78 1.98 26.6 0.42 Table 3: Mass transfer and porous flow data for the model [?]. Component Molar fraction H2 0.0400 CO 0.0243 N2 0.3000 CO2 0.1709 CH4 0.4648 Total 1.000 Table 4: PSA feed composition. e = tmax∫ 0 L∫ 0 |yMOLCO2 (z, t)− yCO2(z, t)|dzdt (12) In this equation yMOLCO2 (z, t) denotes the CO2 concentration profile over time calculated through the MOL-FD using a 400-point discretization over the z-axis and a 10000-point discretization over the t-axis. This MOL-FD solution was considered to be sufficiently close to the real solution, so that it could be used as a reference. The yCO2(z, t) term denotes the concentration profile of CO2 over time obtained through the method being considered. The simulation was for all methods for tmax = 55 s. Figure 3 shows a graph comparing the accuracy (the error measure) of different methods versus the number of 8 Márcio R. V. Neto, Rafael V. Ferreira and Marcelo Cardoso Method Number of x-points yielding log(e) = 0.724 MOL-FD 13 MOL-OC 22 FFT 64 FD 13 MOC 137 Table 5: Number of spatial discretization points for each method necessary to achieve log(e) = 0.724. discretization points on the z-axis. It is clear that the error diminishes as the number of points increases, as it would be expected. The curve corresponding to orthogonal col- location stops at about 35 points due to numerical instability. It can be seen that the most precise methods overall were MOL-FD and FD. Following these two methods were MOL-OC (for less than 35 points) and FFT. The MOC was the least accurate method. In order to compare the running time of each method, a benchmark error was chosen and each algorithm was run with a number of points which would yield that same error. The choice was carefully made in such a way that the number of points corresponding to it was a power of 2. This is necessary for the FFT algorithm to function correctly. The chosen value was such that log(e) = 0.724 (represented by the black horizontal line in Figure 3). Table 5 shows the number of points that each method requires to achieve such precision. By running each of the methods 30 times with the number of points shown in Table 5, it is possible to calculate the mean running time of each one of them and its corresponding standard deviances. The values so obtained are shown both in Table 6 and in Figure 4. By ensuring that the errors associated to each method are roughly the same, it is now possible to make a fair comparison of their running times. For the chosen accuracy, the fastest methods were MOL-FD and MOL-OC. Despite being a fast algorithm, the extra work required to fit the problem to the requirements of the FFT greatly increased its running time. FD ran slower than both MOL and OC, but still faster than the FFT. The greatest running time is that of the MOC. Despite being realatively simple, many points are required for the MOC to yield a satisfactory accuracy. Figure 5 shows the concentration profiles of methane and nitrogen along the PSA bed during the adsorption stage at three different times. The profiles were obtained through a 22-point OC. The profiles do exhibit the expected behavior. One important observation is that the choice of the fastest algorithm is heavily dependant on the implementation of the methods. For instance, MATLABr solves linear systems through a heavily optimized routine for quickly handling matrices. If another routine is 9 Márcio R. V. Neto, Rafael V. Ferreira and Marcelo Cardoso Figure 3: Error versus number of spatial discretization points for each method. Figure 4: Comparison of the running times of each method. 10 Márcio R. V. Neto, Rafael V. Ferreira and Marcelo Cardoso Figure 5: Concentration profiles of methane and nitrogen along the column during the adsorption phase at different times. Graphs obtained through a 22-point MOL-OC method. used, the running time might change considerably. 4 CONCLUSIONS The method considered best for the given PSA problem is the MOL-FD, since it demands a relatively low computational time to run, is easy to implement, is accurate and handles well varying boundary conditions. Despite the fact that the MOL-OC method required a comparable computational time, it was also less precise. The FD method displayed the third lowest running time. However, it also demands a considerable amount of computer memory, which may be a problem. Even though the FFT is a very fast algorithm, the amount of extra work required to fit the problem into its requirements made the overall running time greatly surpass that of the algorithm itself. Moreover, the FFT is highly sensitive to changing boundary conditions, which occur frequently in acommon PSA unit. 11 Márcio R. V. Neto, Rafael V. Ferreira and Marcelo Cardoso Method Mean running time (s) Standard deviation (s) MOL-FD 0.28 0.03 MOL-OC 0.28 0.02 FFT 0.69 0.07 FD 0.51 0.04 MOC 1.7 0.1 Table 6: Mean simulation time per method and standard deviances. For those reasons, the FFT is not recommended. The MOC displays a relatively high run- ning time and is not as accurate as any of the other methods. Once again, it is important to state that these results are highly dependent on how each method is implemented. 5 SYMBOLS TABLE Symbol Meaning b Langmuir equation parameter C Molar concentration dp Particle diameter Dc Column inner diameter ki Mass transfer coefficient of the i-th component Pi Partial pressure of the i-th component ρs Solid medium density qi Adsorbed amount of the i-th component q∗i Adsorbed amount of the i-th component at equilibrium t Time tmax Simulation time T Absolute temperature v Intersticial velocity z Axial position in an adsorption column y Molar fraction ∆Zc Total column height ∆Z1 Height of the H-1 Zeolite layer ∆Z2 Height of the H-1-4 Zeolite layer ∆Z3 Height of the H-2-10 Zeolite layer µ Viscosity Table 7: Symbols table. 12 Márcio R. V. Neto, Rafael V. Ferreira and Marcelo Cardoso REFERENCES [1] A. Agarwal, Advanced strategies for optimal design and operation of pressure swing adsorption processes. (2010). 216f. Thesis (Doctor of Philosophy in Chemical Engi- neering) - Carnegie Mellon University, Pittsburgh. [2] M. Ashkan and M. Masoud, Simulation of a Single Bed Pressure Swing Adsorp- tion for Producing Nitrogen. (2011) In: INTERNATIONAL CONFERENCE ON CHEMICAL, BIOLOGICAL AND ENVIRONMENT SCIENCES (ICCEBS’2011), Bangkok. [3] P. Biswas, S. Agarwal and S. Sinha, Modeling and Simulation for Pressure Swing Adsorption System for Hydrogen Purification. (2010) Chemical & Biochemical Engi- neering Quarterly, v. 24, n.4, p. 409-414. [4] F.E. Cruz, Produção de hidrogênio em refinarias de petróleo: avaliação exergética e custo de produção. (2010). 164p. Dissertation (Masters in Chemical Engineering) ? Polytechnic School, São Paulo University, São Paulo. [5] M.A. Fahim, T.A. Al-Shaaf and A. Elkilani, Fundamentals of Petroleum Refining. (2010), 1.ed. Oxford: Elsevier B.V. 516p. [6] Q. Huang et al., Optimization of PSA process for producing enriched hydrogen from plasma reactor gas. (2008). Separation and Purification Technology, v.62, p.22?31. [7] R. A. Meyers, Handbook of Petroleum Refining Processes (2003) , 3.ed. McGraw-Hill Book Company, New York. [8] A.P. Scheer, Desenvolvimento de um sistema para simulação e otimização do processo de adsorção para avaliação da separação de misturas ĺıquidas. (2002), [s.n.]. Thesis (Doctor of Philosophy in Chemical Engineering) - Faculty of Chemical Engineering, State University of Campinas, São Paulo. [9] J.G. Speight, Hidrogen Production. (2006) In: . The Chemistry and Technology of Petroleum. 4.ed. Taylor & Francis Group, LLC: New York. chap. 22. [10] M. R. Rahimpour, et al., The Enhancement of hydrogen recovery in PSA unit of domestic petro-chemical plant. (2013) Chemical Engineering Journal, Volume 226, 15 June 2013, Pages 444-45. [11] R. G. Rice, D. D. Do, Applied Mathematics and Modeling for Chemical Engineers. (2012) 2.ed. New Jersey: Wiley, 400 p. [12] D.M. Ruthven, S. Farooq, K.S. Knaebel, Pressure swing adsorption. (1994). New York: UCH, 352p. 13 Márcio R. V. Neto, Rafael V. Ferreira and Marcelo Cardoso [13] G. Towler, R.K. Sinnott, Chemical Engineering Design: Principles, Practice and Economics of Plant and Process Design. (2012), 2.ed. Burlington: Butterworth- Heinemann; Elsevier. 1320 p. [14] E. B. Wylie, V. L. Streeter, Fluid Transients (1983). FEB Press, 384 p. [15] J. Yang, C. H. Lee, J. W. Chang, Separation of Hydrogen Mixtures by a Two-Bed Pressure Swing Adsorption Process Using Zeolite 5A. (1997) Sunkyong Engineering Ind. Eng. Chem. Res., v. 36, n. 7, p. 2789-2798. [16] Y. W. You et al., H2 PSA purifier for CO removal from hydrogen mixtures. (2012) International Journal of Hydrogen Energy, v. 37, p. 18175-18186. 14
Explanations and Answers 0

No answers posted

Post your Answer - free or at a fee

Login to your tutor account to post an answer

Posting a free answer earns you +20 points.


NB: Post a homework question for free and get answers - free or paid homework help.

Get answers to: Matlab Code For Pressure Swing Adsorption Unit or similar questions only at Tutlance.

Related Questions