SOFTWARE DEVELOPMENT PLAN
---'Save As' this file using the .txt name in the assignment instructions.
---Type you information.
---Submit the completed development plan via Blackboard with you other file(s).
Name: J Hundley
Assignment: Lab02
Date: Feb 3, 2011
PROBLEM SOLVING IN ENGINEERING AND SCIENCE
Always use a systematic problem-solving strategy.
1. STATE THE PROBLEM:
---Describe the problem to be solved for the assignment.
In 1873, Johannes Diderik van der Waals proposed a version of the
ideal gas law that models the behavior of real gases over a wide
range of temperature and pressure than previous equations. The
ideal gas law describes the relationships between pressure (p),
temperature (T), volume (V) and the number of moles of gas (n).
The additional symbol, R, represents the ideal-gas constant.
8VH9DQGHU:DDOV¶LGHDOJDVODZHTXDWLRQWRFDOFXODWH
the temperature of water vapor (steam), given the following data.
2. DESCRIBE THE INPUT AND OUTPUT REQUIREMENTS:
---List and describe the following to solve the problem, as needed.
---Include units where needed.
CONSTANTS (known values that don't change):
R 0.08314472
INPUT (values need to find the output):
pressure, p 220 bar
moles, n 2 mol
volume, V 1 L
a 5.536 L2bar/mol2
b 0.03049 L/mol
ideal gas constant, R 0.08314472 L bar/K mol
OUTPUT (unknowns):
temperature of water vapor (steam)
Relevant formulas:
part1 = a * moles ^ 2 / volume ^ 2;;
part2 = volume - moles * b;;
temperature = (pressure + part1)* part2 / (moles * R);;
3. DEVELOP AN ALGORITHM:
---Solve the problem with a hand example.
------This is not type here.
---Refer to your hand example to
------List of steps used to solve the problem. (This is an algorithm.)
------Show input and output values.
These value will be used to test your solution in #5.
Hand example for values given above: temperature = 1367.36 K
Algorithm
COMP1200M ± Spring 2011 ± Lab 02_sol ± p. 1 of 4
Get know values from problem statement
calculate the temperature of water vapor
Display the temperature
4. SOLVE THE PROBLEM:
---This is not a step that you will include in your development plan.
---This step represents your writing a computer program to solve the problem.
---NOTE: Do not type your program here. Submit it as a computer program file.
---Use steps in your algorithm as comments in your program.
This will guide the development of you program.
5. TEST THE SOLUTION:
---Use the values from #3 to check for correctness of your program .
---If there is an error, correct your program code.
6. MAINTENANCE AND MODIFICATION STEP:
---This is not a step that you will include in your development plan.
---You will experience this step while correcting and modifing your program
---for future assignments.
% J Hundley
% Lab02.m
% Feb 3, 2011
%{
In 1873, Johannes Diderik van der Waals proposed a version of the
ideal gas law that models the behavior of real gases over a wide
range of temperature and pressure than previous equations. The
ideal gas law describes the relationships between pressure (p),
temperature (T), volume (V) and the number of moles of gas (n).
The additional symbol, R, represents the ideal-gas constant.
UsH9DQGHU:DDOV¶LGHDOJDVODZHTXDWLRQWRFDOFXODWH
the temperature of water vapor (steam), given the following data.
%}
clc
clear all
format bank
%*****CONSTANT*****
R = 0.08314472;;
%*****INPUT*****
pressure = 220;; % bar
moles = 2;; % mol
volume = 1;; % L
a = 5.536;; % L2bar/mol2
b = 0.03049;; % L/mol
%*****COMPUTATION*****
8VH9DQGHU:DDOV¶LGHDOJDVODZHTXDWLRQWRFDOFXODWH
% the temperature of water vapor (steam), given the following data.
part1 = a * moles ^ 2 / volume ^ 2;;
part2 = volume - moles * b;;
temperature = (pressure + part1)* part2 / (moles * R);;
%*****OUTPUT*****
disp('The temperature (K) of water vapor using Van der Waals equation:' );;
disp( temperature );;
COMP1200M ± Spring 2011 ± Lab 02_sol ± p. 2 of 4
COMP1200- MATLAB - Lab 02
Due 11:59 pm ± Thursday ± Feb. 3
Submit devPlan02.txt and Lab02.m via Blackboard
In this equation the additional variables a and b represent values characteristic of individual gases.
Use 9DQGHU:DDOV¶ideal gas law equation to calculate the temperature of water vapor (steam), given the
following data.
Problem Constants :
R 0.08314472 % ideal gas constant in L bar/K mol
Problem Inputs :
pressure % bar
moles % mol
volume % L New commands:
a % L2bar/mol2 disp()
b % L/mol
Problem Outputs:
temperature % Kelvin
Other variables:
None
Instructions:
Insert comments at the top and throughout each file
o Include the follow comments at the beginning of this (and ALL) files.
% your name
% assignment number
% date you completed the assignment -5 points for absence of any
% a short narrative about what the file does of these required comments at the top
o Use your algorithm as comments in your program. at the top of each file
Use clc and clear all to cear the Command Window and memory
Variables
o Use ALL CAPS for constants variable names.
o Start other variables with lower case.
o Use descriptive variable names.
o Use DVVLJQPHQWVWDWHPHQWVWRDVVLJQYDOXHVWR³3UREOHP,QSXWV´YDULDEOHVIRUWKHFRPSXWDWLRQV
Format the output with two decimal places.
Label output using the disp()function.
Sample Output:
The temperature (K) of water vapor is:
__
(__ represents the temperature results from your calculations.)