# Difference between revisions of "Take-home exam"

 Due date(s): 17:30 on 22 November 2010; no late hand ins. (PDF) Take home questions Other instructions Hand-in at class.

<rst> <rst-options: 'toc' = False/> <rst-options: 'reset-figures' = True/> Instructions

###### ===

The purpose of this exam is only a little different to other exams. The difference is that this exam will assess your ability to answer more realistic problems that require more time, thought, and access to a computer. You are expected to use **any appropriate tools** to solve the problems in this exam, particularly the tools learnt in this course.

The 3E4 course teaches you a collection of tools that will be useful in your engineering career. And the challenges you will face do not come neatly posed as problems of the type: "Solve this linear system using Gauss elimination" -- rather you need to reformulate your challenge and pick the appropriate tool to solve the problem, taking into account the level of complexity.

In that regard there are many correct ways to achieve a result. In this exam about 80% of the grade will be given for **how** you solve the problem, and we will pay particular attention to the **justifications** you provide along the way. You must clearly outline **why** you choose the method and **why** you did not choose alternative methods. The **accuracy of how you implement your method** is also important, but the actual solution is of little value for determining your grade.

Also, as you will find in your career as an engineer, you will have to apply tools that you learnt about long ago, tools just learnt recently, or you may have do some research and figure out how to use a tool you've never used before. This exam has those aspects as well.

Some other points are:

• Complete this exam with 1 other person, or by yourself.
• Please identify the person you work with at the top of your answer submission. **Please note: submit one solution per group**.
• Please attribute any sources of reference you used (textbooks, websites, and so on).
• The intention of the group work is that you discuss the questions and collaborate in the same way you have done in the assignments.
• But **do not share** any electronic files (e.g. Word documents, source code) outside your group; take care in the computer labs to safeguard your work.
• Like any other exam, neither the TAs nor myself are able to answer direct questions about the exam. Similarly you *should not* look for help about a *specific question* from other resources (e.g. asking for help with the question on a website, friends, other students in the class, *etc*).
• You may use the course notes and any other textbooks and resources though.
• There is no make-up for this exam.
• You will benefit from going through the software tutorials <https://learnche.org/3E4/Software_tutorial>_ on the course website.
• Your answers should preferably be typed up.
• Your answers must be structured like a report and flow together logically. Please do not submit pages and pages of computer printouts and source code in appendices - unfortunately this will be penalized.

- Hand out date: 17 November 2010, - **Due date**: - Paper hand-in: by **17:30 on 22 November 2010, in class** - Totally electronic hand in: email to dunnkg@mcmaster.ca before the above time and date. - A valid electronic hand in must be in PDF format *only* (no separate Word, MATLAB or Python files). If you are on Windows, you could use PDFCreator <http://sourceforge.net/projects/pdfcreator/>_ to make PDF's; Macs and Linux have built-in PDF capability.

.. Note:: There are a maximum of 30 grade points available in the 5 questions, plus a variable amount of bonus points.

.. raw:: latex

   \pagestyle{plain}
\vspace*{0.2cm}


\hrule \vspace*{0.2cm} %\newpage

Question 1 [7 = 2 + 2 + 2 + 1]

###### ===================

.. Green modelling book: p 316 .. Tests numerical differentiation, modelling, curve fitting and common sense.

Background: Chemical engineers have made many contributions to the medical field; similarly in this question you must use your engineering knowledge in a different context.

Consider the case of injecting a medical treatment into a person's blood system. Subsequent to the injection, the body starts to metabolize (break down, or use up) the drug. In this study a drug was injected into the patient, and samples taken over the next 10 hours. This table reports the concentration of the drug in the blood stream, :math:C:

#### ============== ==== ==== ==== ==== ==== ====

math:t [hour] 1 2 3 5 6 8 10

---- ---- ---- ---- ---- ---- ----

math:C [mg/L] 10.1 7.5 5.7 3.1 2.4 1.3 0.7

#### ============== ==== ==== ==== ==== ==== ====

Medical models often use a well-mixed reactor to approximate the time-dependent behaviour of parts of the body: e.g. kidneys, stomach, and other organs. In this question you can assume the blood system to be a well-mixed CSTR, operating in batch mode: i.e. no inlet, or outlet, and of constant volume (about 5L for a typical adult). Assume the injection immediately mixes with all the blood, and shows up as :math:C(t=0).

1. . Provide an estimate of the drug's concentration at :math:t=0 hours. Please justify your choice of method, and provide a plot to assess if your estimate is reasonable.
1. . Please provide the lowest error estimate of :math:\frac{dC}{dt} for every data point in the table (without using Richardson's extrapolation).
1. . Next assume the drug is eliminated from the patient's blood into the rest of the body using a first-order rate expression, :math:r = kC. Obviously the mechanism by which the drug is metabolized is much more complex, but we don't know the cellular pathways and their rate constants: so lump them together and assume the overall mechanism is first order. Derive the dynamic equation that would describe the concentration of the drug in the bloodstream as a function of time.
1. . Using your values from part 2, calculate the average rate constant. **Bonus mark of 0.5** if you use least squares regression instead of just calculating the average.

Question 2 [5 = 1 + 1 + 3]

###### ===============

A batch bioreactor (well-mixed tank, but no inlet or outlet) is charged with substrate at time :math:t=0 to start a reaction that will consume the substrate. The reaction mechanism is too complex to model exactly, but previous experience suggests it is roughly a first-order reaction. The apparent first-order rate expression is :math:r = kS, where :math:k = 0.58\,\,\text{hours}^{-1}, and :math:{\sf S} is the concentration of the substrate being depleted.

1. . Show that the dynamic rate of change of :math:{\sf S} is given by:

.. math::

\frac{d{\sf S}(t)}{dt} = -k {\sf S}(t)

Also state any assumptions that were made in arriving at this expression.

1. . The time required to consume the substrate from a starting level of 260 g/L to 5 g/L can be calculated by analytical integration of the above expression. What is the total time required?
1. . Had you forgotten how to integrate the expression analytically you could resort to using the trapezoidal rule or Simpson's 1/3 rule. **Without** implementing either method, calculate how many panels would be required to ensure a numerical estimate of the time to achieve the above conversion is accurate within 0.01 hours. In other words, how many panels are required to solve the left hand side integral

.. math::

\int_{260}^{5}{-\frac{1}{k\sf S}\, d{\sf S}} = \int_{0}^{t}{d{t}} = t

to that level of accuracy:

* when using the trapezoidal rule; * when using Simpson's 1/3 method.

Question 3 [7 = 3 + 1 + 3]

###### ===============

The following question is based on the flowsheet below, where the :math:m_i values are the mass flow of the species of interest, the reactant. The purpose of the flowsheet is to eliminate the incoming species at :math:m_1 = 10 kg/hour and convert it to by-products. There is some residual reactant leaving the flowsheet in stream :math:m_{12}.

.. figure:: images/take-home-reactor-network.png :scale: 40 :align: center

The following additional information is known:

• :math:m_1 = 10 kg/hour.
• :math:m_2 = 2 kg/hour.
• Unit A operates with 40% efficiency; i.e. of all the material coming in, only 40% of it is converted to other products.
• Unit B is just a mixing tank.
• Unit C is just a mixer/splitter and is operated so that the mass-flow in the outlets are all in the same proportion.
• Unit D operates with 82% efficiency, so 18% of the incoming stream is left unconverted. The two outlets are split in equal proportion as well.
• Unit E operates with 15% efficiency to convert the incoming streams to by-products.
• The split after unit E is operated such that :math:\alpha m_8 is recycled in stream 11, while :math:(1-\alpha)m_8 exits in stream :math:m_{12}.
1. . Write a system of equations in the form :math:{\bf Ax = b} that can be used to calculate the mass flow rate of every stream in the flowsheet.

The row order in a system of equations has no effect on the solution :math:{\bf x}. But to make grading this question easier, please write your system of equations using :math:{\bf x} = [m_1,\, m_2\, \ldots\,,\,m_{11},\,m_{12}] and so that matrix :math:{\bf A} has 1's on the diagonal.

1. . Solve this system of equations using computer software, at the value of :math:\alpha = 0.20.

* Show your matrix :math:{\bf A} * Report the flow of the species in every stream, and in particular, the flow in stream :math:m_{12}.

1. . The next objective is to adjust the recycle ratio, :math:\alpha, so that the mass flow of the species leaving the flowsheet is :math:m_{12} = 1.0 kg/hour.
 	*	You may use any technique you like to find :math:\alpha, but every time you solve the system of equations :math:{\bf Ax = b} for a given value of :math:\alpha it will count as one function evaluation.


* If you plan to plot the system at various values of :math:\alpha, then each point on the plot is counted as a function evaluation. * The solution in part 2, with :math:\alpha=0.20 counts as one function evaluation already, and should be your starting point for solving this part of the question. * Clearly explain your strategy. * Report the total number of function evaluations you used to achieve an :math:\alpha value that is accurate within :math:1\times 10^{-2}. There is **one bonus mark** available for getting an answer within 5 function evaluations or less.

Question 4 [6 = 2 + 4]

###### ===========

.. note:: Even though this question is typical of material learnt about in later courses, you are still able to solve this question using tools just covered in this course.

A polymer compound is being held in a small stirred tank that is externally heated. The polymer leaving the tank must have a certain viscosity so that the downstream processes can operate as required. The primary method of adjusting the viscosity is by setting the temperature of the tank. Several experiments, performed by your colleagues, have determined the system behaves in a second-order manner (you will learn how to determine this in your process control course).

.. math::

\tau^2 \frac{{\rm d}^2\mu(t)}{{\rm d}t^2} + \tau\frac{{\rm d}\mu(t)}{{\rm d}t} = K_p(T(t) - 318)

where:

• :math:\mu(t) is the viscosity measured in centipoise, cP and the target viscosity required is 30 cP
• :math:T(t) is the tank temperature, measured in Kelvin
• :math:K_p = -0.25 cP/K
• :math:\tau = 2.1 minutes

A feedback control system is implemented to keep :math:\mu at its target of 30 cP. The type of feedback controller used is a *proportional-only* controller, meaning the tank temperature, :math:T(t) is adjusted in proportion to the deviation (error) in viscosity, as given by:

.. math::

T(t) = K_c\big[30 - \mu(t)\big] + 318

where :math:K_c = -1.9 K/cP. At steady state, the tank temperature is normally set to 318 K to maintain the required viscosity of 30 cP.

1. . According to this feedback control law, what should the tank temperature be set to if the viscosity is currently at 35 cP? And for 28 cP? Comment whether or not these answers make sense.
1. . Someone has turned the tank's heating system off overnight and the viscosity of the material is currently at 40 cP. Create a plot, as a function of time, that shows how the material's viscosity is brought back to the target of 30 cP. Let :math:t=0 be the moment the heating system is turned back on. Using your plot, estimate how much time will be required to reach **stable** operation (i.e. return to a constant viscosity of 30 cP)?
• Bonus question [1 mark]**: The value :math:K_c is called the feedback controller's gain (aggressiveness). Show your plot from part 2 of the question, but superimpose the time-varying viscosity curves for two other values of :math:K_c, one higher and one lower. How would you adjust :math:K_c to achieve the target of 30 cP in a shorter amount of time? Can you suggest a better :math:K_c value than the current setting?

Question 5 [5]

###### ====

This question considers a pilot-plant CSTR, liquid reaction process, fed with reactants A, B and C. There are two reactions taking place in the system:

.. math:: :nowrap:

\begin{align*} {\sf A} + {\sf B} &\rightarrow 2{\sf D} + {\sf E} \\ 2{\sf C} + {\sf D} &\rightarrow {\sf F} + {\sf E} \end{align*}

The desired products are :math:{\sf E} and :math:{\sf F}, while species :math:{\sf D} is an intermediate. From economic considerations, it is desirable to operate the reactor to maximize the production of :math:{\sf E} and :math:{\sf F}. This is achieved by minimizing the amount of unreacted :math:{\sf D} in the outlet from the reactor.

One way this can be done is by adjusting the tank's jacket temperature, which in turn affects the reaction kinetics and alters the balance of products in the outlet. Unfortunately the first principles rate expressions for the reactions are not known, so derivation of mass and energy balances to find this jacket temperature is not possible.

You have time and resources to run the pilot-plant reactor at only 8 different jacket temperatures, between a minimum and maximum range of 278 K to 355 K. You are expected to use any of the tools from this course to find a jacket temperature that leads to the lowest possible concentration of :math:{\sf D} [mol/L]. You may use of the fact (learnt in your calculus course) that the optimum -- either a maximum or a minimum -- of a function :math:f(x) occurs at :math:\displaystyle \frac{df(x)}{dx} = 0; and that optimum is a minimum if :math:\displaystyle \frac{df^2(x)}{dx^2} > 0.

A model of the process has been simulated, and is available on the course website <https://takehome.learnche.org/>_. Nominate *one of your group members* and email their name and student number to the course instructor, together with the name of the other, optional, group member. This will activate an account for your group. Once you sign into the account you will be able to enter in various values of the jacket temperature, and the server will simulate the experiment and return the corresponding concentration of :math:{\sf D}, as if the pilot plant was operated at that jacket temperature.

Four of the grading points for this question will be marked mainly on the *description of your strategy and the systematic methodology followed* to locate a suitable jacket temperature. Make sure you explain your approach clearly and present good visualization plot(s), exactly as you would have to in a report to your manager. Your final answer (one point) must provide a recommendation to your manager for the jacket temperature.

Also note:

* There is error (noise) in the concentration measurements of :math:\pm 1.0 mol/L. * The server will return different results for each group. * Please enter your jacket temperature settings carefully - if you input incorrect values you will have to work with those results. **You will only be able to run at most 8 experiments.** * The server will also keep track of and display all your previous experiments on a results sheet.

Once you have completed the question, include the result sheet from the server in your answer. (The true jacket temperature for your team will be be available on the website after the exam is handed in). Please note, there is more than one correct method to approach the problem.

There is **1 bonus mark** if you are able to locate the jacket temperature within :math:\pm 0.25 K and additional bonus marks as follows: :math:\displaystyle \frac{\max\left\{6-N,0\right\}}{4}, where :math:N is the number of experiments you used.

.. raw:: latex

\vspace{0.5cm} \hrule \begin{center}END\end{center}

</rst>