By increasing the amount of production, transfer and consumption of natural gas, the importance of producing gas without any impurities has increased. Considering that Iran is the second largest natural gas pillar in the world, it is very important to address this issue. Natural gas extracted from underground wells has a lot of impurities; thus, to prepare it for consumption, various processes, such as using slug catcher, sweetening, dehydration and Hydrocarbon dew point adjustment is required. In this thesis, simulation of water, methane, carbon dioxide and C5 hydrocarbons adsorption from natural gas using silica gel adsorbent type Ws and H in the temperature swing adsorption unit of Parsian gas refinery in MATLAB environment is presented. The effect of the superficial gas velocity, contact time, bed porosity, temperature of the regeneration gas stream and the total mass transfer coefficient on the adsorption and desorption curves of the components have been investigated. To evaluate the performance of Unit 104 of Parsian Gas Refinery, the dew point adjustment unit for water and hydrocarbons, modeling and simulation of a double-layer adsorption substrate containing Ws silica gel for adsorbing water vapor and type H for adsorbing Hydrocarbon C5 is taken. To carry out modeling, mass balance equations, energy, momentum and Langmuir isotherm parameters have been drived. The equations are discreteid in terms of z_direction and time using the quadrate difference method and the finite difference method respectively. Assumptions such as non-ideal gas, plug flow, negligible pressure drop and adiabatic bed are considered.After ensuring stability of the responses in the suitable number of time and lenght nodes, validation of the model was performed using exprimental data, and the average absolute error was about 6% AAD. The sensibility analysis of the measured parameters indicates that decrease of the bed porosity and gas inlet temperature and increasing the pressure and redu