Question

MATLAB Code

Introduction: “Petrochemical Processing”

Diethanolamine (DEA) is extensively used in the gas processing industry for removing acid gases such as carbon dioxide and hydrogen sulfide from light hydrocarbons. DEA's popularity is based on several factors: energy savings compared with certain other solvents; high affinity for acid gases; fair resistance to degradation. Degradation is defined as the irreversible transformation of DEA into undesirable compounds. The principal degradation compounds were found to be 3-(hydroxyethyl)-2-oxazolidone (HEOD), N,N,N-tris(hydroxyethyl)ethylenediamine (THEED), and
N,N-bis(hydroxyethyl)-piperazine (BHEP).[1]

In this problem we will investigate a simplified chemical kinetic mechanism for degradation of DEA dissolved in water, using the compartment model framework introduced in our class presentation entitled, “Introduction to Modeling III: Systems of Population Equations and Compartment Models.”

Consider the following compartment model for the degradation of DEA:

Decay Chain

[1] Kennard, M.L. and Meisen, A., “Mechanisms and Kinetics of Diethanolamine Degradation”, Industrial & Engineering Chemistry Fundamentals, 1985, 24, 129-140.

Situation:

DEA dissociates (degrades) into HEOD at a rate of 1.67% per hour, as indicated by the d1 pathway in the compartment diagram. DEA also dissociates into THEED at a rate of 2.56% per hour, as indicated by the d2pathway. Finally, THEED degrades into BHEP at a rate of 6.33% per hour, as indicated by the d3 pathway.

Note #1: In Chemistry the term “mass fraction” is commonly used to refer to the fraction of a solution that is a given chemical. So saying “a 0.65 mass fraction” means that within the solution, 65% is the given chemical. A 0.0 mass fraction means that the chemical is NOT present. This term is used so that chemists do not have to worry about the volume or quantity of the whole solution.

Note #2: DEA simultaneously dissociates into two different products, and thus, it “dies twice”, so to speak.   The overall “death rate” for DEA is therefore the sum of its two, individual dissociation rates.   HOWEVER, both HEOD and THEED receive immigrants from DEA  at rates corresponding to the rate (d1 or d2) that points into their respective compartments!

Problem:  Write a SINGLE MATLAB program that solves ALL 4 of the below questions in response to the above situation. YES all 4 questions below must be answered and displayed as a SINGLE and to be able to answer the following questions:

  • Question #1: In the initial solution, DEA’s mass fraction is 0.65, and the initial solution mass fractions of HEOD, THEED and BHEP all equal 0.0. (Don’t worry about the other 0.35 mass fraction, it is not important in this problem.) Compute (and display in the Command Window) what mass fractions are of DEA, HEOD, THEED and BHEP at the end of (or after) 33 hours?
    [Hint: You may want to use the fprintf command for this so that you can fit all of the values on a single line. Here is one way that Dr. Lyver solved the issue using the following 2 lines for the display:
        c = 33+1;   % c is the time for the values that are to be displayed
    fprintf('33 hours:     DEA %6.4f HEOD %6.4f THEED %6.4f BHEP %6.4f \n', ...
          DEA(c), HEOD(c), THEED(c), BHEP(c))
  • Question #2: Compute (and display in the Command Window) the 4 individual mass fractions at the end of 100 hours?
  • Question #3: Prepare a plot of the variation over time of the individual mass fractions of DEA, HEOD, THEED and BHEP, from 1 minute (i.e., initial concentration at the end of the first minute) to 120 hours.
  • Question #4: Verify (and display) that the total mass fraction of the combination of DEA, HEOD, THEED and BHEP remains at 0.65 after 120 hours.

HINT: To put more than one line on a plot, you can use the following command. This example plots arrays A/B/C/D, you would use the array names that you build in the code. MATLAB will change the color of each line as it prepares the plot. I suggest to use the "1:length(A)" so that you don't have to count the size of the A Array:

plot(1:length(A),A, 1:length(B),B, 1:length(C),C, 1:length(D),D)

legend('A','B','C','D')


(DEA)so deside and hydegm ๗nde ถ0w.ght hyd Narbon. DEAs n several actor mgy sa e to degradation Destion is defieed ads The p


(DEA)so deside and hydegm ๗nde ถ0w.ght hyd Narbon. DEA's n several actor mgy sa e to degradation Destion is defieed ads The princigal degradation ompoun espounds were lound Pepelation Equations and Couparinces Madels Adi sia-lagrada,.ate luco a rawat.67% pa per hour as indicated bye pathway FinalyTHEED SNGLE MATLAB prog as a SINGLE and to be ablto Qurstion : la the initial slutionDEA's mass fractieen s 045, and the isiial soltion wass fractions of HBO0 ED and BHEP all oqual.0 Don wom poblem)Compune (and diplay isa the Command ED and BHEPat the end of tor afer) 33 hours e for the valars the individual us frctions at he end of ndi İlul rus tation of Dr Oustios 4: Verify (and display) thun the sotal mass n ofthe combination of DEA, HEOD, THEED and lEP remais at 065 fler 120 hours llowing connund This anple plos arrays ACD, you
0 0
Add a comment Improve this question Transcribed image text
Answer #1

CODE:

%Petrochemical Processing
% intialisation the given at t = 0hour; index starts from (1)

DEA(1) = 0.65;
HEOD(1) = 0; THEED(1) = 0; BHEP(1) = 0;

d1 = 0.0167; % 1.67%/hour DEA to HEOD
d2 = 0.0256; % 2.56%/hour DEA to THEED
d3 = 0.0633; % 6.33%/hour THEED to BHEP

for t=2:121
HEOD(t) = HEOD(t-1) + DEA(t-1)*(d1);
THEED(t) = THEED(t-1) + DEA(t-1)*(d2);
DEA(t) = DEA(t-1)*(1-d1-d2);
BHEP(t) = BHEP(t-1) + THEED(t)*(d3);
THEED(t) = THEED(t)*(1-d3);
end

%Q1
c = 33 + 1; % 33rd hour
fprintf('33 hours: DEA %6.4f HEOD %6.4f THEED %6.4f BHEP %6.4f \n',DEA(c), HEOD(c), THEED(c), BHEP(c));

%Q2
c = 100 + 1; % 100th hour
fprintf('100 hours: DEA %6.4f HEOD %6.4f THEED %6.4f BHEP %6.4f \n',DEA(c), HEOD(c), THEED(c), BHEP(c));

%Q3 plot the three graphs
t = 1:121;
figure
hold on
plot(t,DEA,t,HEOD,t,THEED,t,BHEP)
xlabel('Hours')
ylabel('Mass Fraction')
legend('DEA','HEOD','THEED','BHEP')

%Q4 toal mass fraction at 120th hour
c = 121;
fprintf('Total Mass fraction at 120th Hour: %6.4f \n',DEA(c) + HEOD(c) + THEED(c) + BHEP(c))

SCREENSHOT

petrochemicalprocessing.m X+ Petrochemical Processing % int i alisation the given at t = 。hour ; index starts from (1) DEA (12-xlabel (Hours 3ylabel (Mass Fraction 34legendDEA,HEOD, THEED,BHEP 35 36 %Q4 toal mass fraction at 120th hour c 121:PLOT AND OUTPUT

Command Window >>petrochemicalprocessing 33 hours: DEA 0.1561 HEOD 0.1950 THEED 0.0925 BHEP 0.2064 100 hours: DEA 0.0086 HEOD0.7「 -DEA HEOD THEED ВНЕР 0.6 0.5 0.4 0.3 0.2 0.1 20 40 140 60 80 100 120 0 Hours

Please go through above code and screenshots and if you have any doubts then message me.

Give me a thumbs up. Thanks.

Add a comment
Know the answer?
Add Answer to:
MATLAB Code Introduction: “Petrochemical Processing” Diethanolamine (DEA) is extensively used in the gas processing industry for removing acid gases such as carbon dioxide and hydrogen sulfide from li...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT