You are on page 1of 2

CHEN 1310 Introduction to Engineering Computing Fall 2022

Homework #6

Due by 11:59 p.m. MST on Friday, October 14th on Canvas.

Please name your file Firstname_Lastname_Homework_06.xlsm (NOTE the .xlsm extension!)

IMPORTANT: Remember that I encourage you to work in groups, but each student must submit his/her
own homework spreadsheet. Every student’s homework assignment should look significantly different from
all other students (i.e., each student’s work should be a representation of their own work).

You are responsible for keeping copies of all work you submit for grading. Also, please plan to submit your
homework in advance – there will be no exceptions in case your computer and/or internet connection are
not working. Please plan to submit assignments at least a few hours early so that any connectivity or
computer problems can be fixed or another computer/facility can be used.

Solve the following problems using Excel/VBA. Please place each problem on a new worksheet in your
single workbook. Label areas of the spreadsheet to make it clear where each part of the problem is worked.
You may consider separating various parts of problems by a border.

1. (12 pts) An old windmill is being converted to a restaurant and the owner needs to place a cylindrical
water storage tank in the conical roof of the windmill. It is desired to maximize the volume of the storage
tank.

For a given set of conical roof dimensions (H and D), the height of the cylinder (h) will be constrained
by the radius (r).

a. (6 pts) Create a VBA user defined function watertank(H,D,r) with arguments for height of conical
roof (H), diameter of the base of the conical roof (D), and radius of the cylindrical tank (r) that will
calculate the volume of the cylindrical tank. As a check, when H = 1.5 m, D = 2.0 m, and r = 0.5
m, the volume is 0.589 cubic meters.

HINT: You may want to create an intermediate variable h in your VBA function that uses H, D, and
r (possibly by noting similar triangles). Then you can use h and r in a simple volume calculation.

b. (3 pts) For H = 1.5 m, D = 2.0 m, plot the volume of the cylindrical tank as a function of radius
(suggestion: use a one-way data table!). The range of radius should only be the feasible (physically
possible) values for radius. Make the line red and dotted and add axis labels and a grid.

c. (3 pts) For H = 1.5 m, D = 2.0 m, use the Solver tool to find the radius of the tank that maximizes
the volume of the cylindrical tank. What is the corresponding maximum tank volume?
CHEN 1310 Homework #6 Page 2

2. (12 pts) For each of the following parts, create separate VBA subroutines that will do the following
tasks. Name the subroutines “Problem2a”, “Problem2b”, … , “Problem2f”. Make sure you are testing
all of the following scenarios/subs. All of these subs can be in the same module (e.g. “Module1”).

a. Take the value in cell C3, square it, and output it in cell C4.
b. Take the value in cell C3, square it, and output it in a message box.
c. Ask the user for a number, square it, and output it in cell E3.
d. Ask the user for a number, square it, and output it in a message box.
e. Take the value in the active cell, square it, and output it in the cell that is two columns to the right
and 2 rows down from the current active cell.
f. Ask the user for a number, square it, and output it in a cell that is two columns to the right and 2
rows down from the current active cell.

3. (6 pts) The van der Waals equation is useful for relating pressure (𝑃 in atm) to molar volume (𝑉̂
L/mol) of a non-ideal gas at a certain temperature (𝑇 in Kelvins):

𝑅𝑇 𝑎
𝑃= −
𝑉̂ − 𝑏 𝑉̂ 2

In this equation, 𝑎 and 𝑏 are van der Waals constants that are available in various reference sources
and 𝑅 is the ideal gas constant [=0.08206 L-atm/K-mol].

Create a VBA user-defined function called vanderwaals(a,b,T,V) that outputs the pressure (in atm)
for a given gas with van der Waals constants 𝑎 and 𝑏 at temperature T (in K) with molar volume V.
For nitrogen (𝑎 = 1.408 and 𝑏 = 0.03913) at T = 500 K when 𝑉̂ = 0.5 L/mol, use your vanderwaals
function to determine the exerted pressure (P).

You might also like