- Details
- Parent Category: Engineering Assignments' Solutions

# We Helped With This Engineering Homework: Have A Similar One?

Category | Engineering |
---|---|

Subject | Other |

Difficulty | College |

Status | Solved |

More Info | Engineering Homework Help |

## Short Assignment Requirements

## Assignment Description

The equations resulting from the mass balances, component balances, and thermodynamic relations (respectively) on an ideal flash tank separator are:

In general, this is a set of 20 equations in 25 unknowns. You would pick F and all four z variables, so they are parameters, but you lose one equation that way (the z variables sum to 1.) Also, the component balances aren’t independent of the overall balance, so that gets rid of one more equation. That means you need to pick two variable values to solve the system exactly (2 DoF). You will test your code on a mixture consisting of 4 of the following species: ethane, propylene, vinyl chloride monomer, isobutane, 1-butene, normal butane, and cis-2-butene. The species assigned(A,C,D,F) can be found in a separate pdf called “VaporPressure”.

A. For your set of four species, write a function / subroutine in Matlab
called “flash3.m” which finds the properties of the outlet streams of your
flash using the feed component molar flow rates zF = F*[z1 z2 z3 z4]T, the
temperature in the flash T, and the pressure in the flash P. The syntax for
using it should be “[x y V L] = flash3(zF, T, P)”. Write it such that it uses **the
RachfordRice equation** to find V, L, x, and y. Your code should call your
“Psat#.m” scripts from above. The x, y, and zF should be 4-element COLUMN
vectors. The code should give error messages (NOT MATLAB ERRORS) if the inputs
are invalid. It only needs to work between the bubble point
temperature/pressure and the dew point temperature/pressure of your mixture;
see equations (4-12) through (4-15) on p. 149 of Seader and Henley (3rd
edition) to find equations to calculate those temperatures/pressures. If the
input temperature is too low (no vapor because you’re below the bubble point)
or too high (no liquid because you’re above the dew point), your code should
give an appropriate error message as text output. Same for pressure; the
program should give an error if there can’t be two phases at those conditions. **Your
code should include comments for each step. **

B. For your set of four species, write a function / subroutine in Matlab
called “flash4.m” which finds the properties of the outlet streams using the
feed component molar flow rates zF, the temperature in the flash T, and the
desired flow rate of liquid L. The syntax for using it should be “[x y V P] =
flash4(zF, T, L)”. Write it such that it uses **Newton’s method** for
solving systems of non-linear equations to solve the problem. You can reduce
the number of equations in any manner you like, but solving fewer equations may
not make the algorithm converge faster. Again, it only needs to work between
the bubble point and the dew point of your mixture and you should give proper
errors if the inputs are invalid.

C. For your set of four species, write a function / subroutine in Matlab
called “flash5.m” which finds the properties of the outlet streams using the
feed component molar flow rates zF, the temperature in the flash T, and the
desired mole fraction in the vapor of species 1, y1 (the lowest boiling one,
called the “light key”). The syntax for using it should be “[x y2 y3 y4 V L P]
= flash5(zF, T, y1)” where all the yi are scalars for any i = 1,2,3,4. Your
algorithm should use the **method of steepest descent**. You can use another
method for 1-3 iterations to find a “good” starting point for steepest descent,
if you wish.

D. (5 points) Write a script called “XXXflash.m” (where XXX are your initials) which incorporates flash3, flash4, and flash5 together so that the user can enter in zF, T, and any of {P, V, y1} and the algorithm will either solve the problem or give an appropriate error message. The syntax for using it should be “[x y V L P] = XXXflash(zF, T, P, L, y1)”. The code should first check if the zF and T are valid; if they are, it should then check if P is between the bubble and dew points for the input zF and T. If P is valid, it should use flash3 to find the outputs; if P is invalid, it should then check if L is in (0,F]. It should use L and flash4 if it is, ignoring P and y1. If both L and P are invalid, it should use y1 and flash5. It should give an error message if all the inputs are invalid, i.e. L is not in (0,F), P is invalid, and y1 is not in (0,1).

Helpful resources:

## Assignment Description

Your assignment is to write a “flash tank” unit operation (or just a “flash”) algorithm. A flash is a chemical process unit which separates a feed mixture of chemicals (which is at its boiling point after it is pushed through a valve) into a vapor stream and a liquid stream of different compositions. A picture of one looks like this:

You collected the vapor pressure data below (in bar) from the literature (Perry’s Handbook):

For your set of four
species (A, C, D, F), fit the vapor
pressure data above using a method of your choice. __You must derive and
give explicitly an expression for the vapor pressures as__ __a function of
temperature T for each component.__** All these expressions should be
given somewhere in the comments of your code. **You should write
four *.m scripts called “Psat1.m”, “Psat2.m”, etc. The syntax for using them as
functions should be “[VaporPressure] = Psat#(T)” with T in K. The output should
give the vapor pressure in bars. Each of your scripts only need to work between
170 K and the highest critical temperature of your four species; outside that
range the mixture is either all liquid or all vapor. It should produce a value
of NaN if the input is not in the valid range (NaN is a Matlab number type, not
a string, which means “Not a Number”.) Your scripts should be

**EVALUATING**your method/expression at the input temperature,

**not CONSTRUCTING**it; this may mean you have to write a script to create your method/expression, and then use that script’s results to create the Psat scripts.