0% found this document useful (0 votes)
63 views3 pages

A. Solver: Computer Lab # 2

This document contains a computer lab assignment involving the use of Solver and solving systems of ordinary differential equations (ODEs) in Excel. For question A, students are asked to use Solver to determine the most profitable load of two products that can be transported by a truck under capacity constraints, allowing and not allowing fractional units. For question B, students are given a system of two chemical reactions and asked to write VBA code to model the reaction system in Excel and solve using the Euler method. They are asked to determine concentrations of species and temperature at various times, and find maximum values. A graph of results is also required.

Uploaded by

moon star angel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views3 pages

A. Solver: Computer Lab # 2

This document contains a computer lab assignment involving the use of Solver and solving systems of ordinary differential equations (ODEs) in Excel. For question A, students are asked to use Solver to determine the most profitable load of two products that can be transported by a truck under capacity constraints, allowing and not allowing fractional units. For question B, students are given a system of two chemical reactions and asked to write VBA code to model the reaction system in Excel and solve using the Euler method. They are asked to determine concentrations of species and temperature at various times, and find maximum values. A graph of results is also required.

Uploaded by

moon star angel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

CHEN2004 2020

Name: Click here to enter text. Student ID: Click here to enter text.

Date: Click here to enter text. Time: Click here to enter text.

Computer lab # 2

 Save it as IC-2-yourstudentID.xlsm
 Enter your answers into separate spreadsheet according the spreadsheet name.
 Use your homework to answer question B1.
 You need to submit both your paper and Excel file for marking

A. Solver
A truck is to be used to transport two products to your customers. As the truck has limitations on
both weight and volume, you need to determine how much of each product to load. The volume of
the truck is 10,000 L, and the maximum weight that can be carried is 20 t.
• Product A occupies 50 L and weighs 200 kg
• Product B occupies 80 L and weights 100 kg
• The profit margins are $5 per unit of Product A and $7 per unit of Product B.

Question A1. Use Solver to determine the most profitable load that can be carried, assuming that
fractional units are allowed. (0.5 mark)
Answers: Product A = Click here to enter text. Product B = Click here to enter text.
Profit = Click here to enter text.

Question A2. Use Solver to determine the most profitable load that can be carried (no fractional
units allowed) (0.5 mark)
Answers: Product A = Click here to enter text. Product B = Click here to enter text.
Profit = Click here to enter text.

13/08/2020
CHEN2004 2020

B. ODEs
Consider a system of 2 chemical (1st order) reactions:

A k1 B heat of reaction H1 = 2 kJ /mol, rate of reaction k 1=5 s−1



B k2 C heat of reaction H2 = - 0.5 kJ /mol, rate of reaction k 2=2 s−1

Initial concentrations are

CA0 10 mol/L
CB0 0
CC0 0

Question B1. From your homework, what is the concentration of B at 1s? (1 mark)
Click here to enter text.
1. Write a VBA code to do the homework and return the results into Excel spreadsheet. You
may use the structure below. The output is a matrix. To return the matrix: (i) select the cell
range, (ii) enter the formula and (iii) use Ctrl+Shift+Enter.

Function dabcdt(A0, B0,C0, k1, k2, dt, tmax)


Dim matrix(1000, 4), i, n, dadt, dbdt
n = tmax / dt
matrix(0, 0) = 0: matrix(0, 1) = A0: matrix(0, 2) = B0 ‘1st column is time, 2nd is A conc,
3rd is B conc
For i = 1 To n
matrix(i, 0) = matrix(i - 1, 0) + dt
dadt = ………………………………’
…….
Next i
dabdt = matrix

End Function

2. Calculate the chemical concentrations as function of time for 1 s, using Euler method with
step-size 0.01 s. Plot the results in Excel.

Question B2. What is the concentration of B at 1s ? Discuss any difference with your answer in B1.
(1 mark)
Click here to enter text.

Question B3. What is the highest concentration of B and the corresponding time? (0.5 mark)
CBmax = Click here to enter text. mol/L at t = Click here to enter text. s.

13/08/2020
CHEN2004 2020

3. Assume the solution has a constant heat capacity of 4.1813 kJ/g oC and initial temperature of
25oC. You can use the following formula for energy balance:
dT ∑ r i ΔH i
=
dt Cp

Where rates of two reactions (mol/s) are given as r1=k1CA and r2=k2CB

Question B4. What is the highest temperature of solution and the corresponding time?
(0.5 mark)
Temperaturemax = Click here to enter text. oC at t = Click here to enter text. s.

Question B5. Plot the graph showing concentration of A, B, C and T as function of time. T is in
secondary vertical axis. Include maximum temperature. Insert the graph into the box below
(1 mark)

Question B6. (optional not for marking)


- Rewrite your ODEs code in Question 2 so that the function output is CB at tmax (a single output).
- Write a VBA code for binary method (similar to In-class 1) and combine the new code to solve
find CBmax in Question 3.

13/08/2020

You might also like