In: Physics
Optimization problems are a common engineering task. Typically, these problems involve minimizing cost or maximizing profit.
In this problem we are interested in determining the optimum amount of insulation to wrap around a steam supply pipe. The optimum amount is the one that produces the largest savings.
Wrapping insulation around the pipe saves us money by reducing the amount of heat lost through the pipe (lower fuel bills). However, insulating the pipe costs money – we must buy and install the insulation. Keep in mind also that too much insulation is just as wasteful as too little – there comes a point where the fuel savings from adding even more insulation is less than what it costs us to purchase the additional insulation!
So, this is a basic cost vs. benefit problem. For different thicknesses of insulation, we will need to calculate the cost of purchasing and installing that thickness of insulation and compare that to the fuel savings generated by insulating the pipe with that thickness.
DISCUSSION: Your program will ultimately need to determine overall savings (in dollars) for each thickness and then find the thickness that corresponds to the largest overall savings.
The overall savings is found by subtracting the cost of insulation from the fuel savings:
Overall savings = (CF – CI).
The insulation thickness that corresponds to the largest overall savings will be our answer. To find the overall savings, your program will need to calculate two quantities:
a. Insulation cost – CI
This quantity has two components: the cost of purchasing the insulation and the cost of installing the insulation. The formula for this calculation is (see below for identification of variables):
CI = (b2-a2)(L)(Cvol) + (L)(CL)
b. Fuel Savings – CF
The fuel savings is found by taking the difference in heat lost, dQ, and then multiplying this quantity by a dollar amount to get the amount of money we save using the insulation. The formula for finding the difference in heat lost (dQ) is:
dQ = Q3*[1 – {(b/a)/(1 + ((b*F)/k*ln(b/a)))}]
Q3 represents the quantity of heat lost with no insulation and is found using:
Q3 = 2*3.14*a*F*(Ta – Tair)*L
Now, once we have dQ, we can calculate the fuel savings. We’ll use a five year period (5 years=1.578 x 108 sec). The formula for fuel savings over this 5-year period is:
CF = dQ*(1.578 x 108) * (CstHeat)
What we want to do is maximize the difference of CF and CI. This difference is the overall savings (in dollars) and the thickness that corresponds to this difference is the optimum thickness!
Here are the constant variables for your program:
Pipe radius =a=0.05m
Radius of pipe + insulation =b=(a + insulation thickness)
Pipe length =L=100m
Pipe temperature =Ta=150 C
Insulation conductivity =k=0.1watt/(m C)
Convection constant =F=3.0watt/(m C)
Pipe insulation cost =Cvol=$325/m3
Insulation installation cost =CL=$1.50/m
Cost of heat =Cstheat = 1.11x 10-9 per watt-sec
The only two quantities that are not constant in our problem are the insulation thickness and the air temperature (Tair). For our program, the insulation is available in thicknesses ranging from 1 to 10 cm, in 1 cm increments (note this quantity must be changed to meters). The air temperature will range from –10 C to 10 C in increments of 10 (in other words, you must evaluate at air temperatures of –10, 0, and 10).
Your program should output a table of thicknesses, insulation costs (CI), fuel savings (CF), and overall savings (CF – CI), for each air temperature (so, you’ll have three of these tables – one for –10, one for 0, and one for 10). Your output must be in chart form, neat, and labeled. You must also output the constant values used.
For example, the title of your first table may look like this:
Temperature: -10
Thickness CF CI Savings
.01 m
NOTE: In C++, natural log is found using the command: log( ) put whatever you want to find the natural log of in the parentheses. You must have #include<cmath> in your program to use the log command. (If you’re wondering, you use the log10( ) command to find the log of a number – but you don’t need this info for this project.)
DELIVERABLES:
You must hand in:
harcopy of program
hardcopy of output
EVALUATION:
Completing the above portion of the project can earn you a maximum grade of a C. Including the following enhancements in your program can increase the grade.
To earn a maximum grade of B, allow the user to input the starting, stopping and increment values for the insulation thickness and the air temperature. Also, at the end of the program, provide an opportunity for the user to use the program again without having to re-execute the program (ie. Ask them if they want to use the program again).
To earn a maximum grade of A, include all the items for B above plus, your program must find and output the value of the optimum thickness for each air temperature (you must have the program sort through the savings column for each air temperature and find the maximum value). Additionally, you must use at least one array in your program. The array may be a one dimensional array. You may assume that we will never have more than 3 different temperatures and never more than 10 different thicknesses in order to more easily size your arrays
please help!!!
code:
#include <stdio.h>
#include<math.h>
#include<limits.h>
void main()
{
double
CF,CI,dQ,Q3,a=0.05,b,L=100,Ta=150,k=0.1,F=3.0,Cvol=325,CL=1.5,Cstheat=0.00000000111;
double overall_savings;
int insulation,temp,z=0;
double maximum[3]; //storing max saving
values
for(temp=-10;temp<=10;temp+=10){
printf("Temperature: %d\n",temp);
printf("Thickness
CF
CI
Savings\n");
double max=INT_MIN;
for(insulation=1;insulation<=10;insulation++)
{
b=a+insulation*0.01;
Q3 =
2*3.14*a*F*(Ta - temp+273)*L; //add 273 to make temp in
kelvin
dQ = Q3*(1 -
((b/a)/(1 + ((b*F)/k*log(b/a)))));
//printf("%lf",dQ);
CI =
(b*b-a*a)*L*Cvol+L*CL;
CF =
dQ*(1.578 * 108) * (Cstheat);
overall_savings =
CF-CI;
if(overall_savings>max)
{
max = overall_savings;
}
printf("%d*0.01
%lf
%lf
%lf\n",insulation,CF,CI,overall_savings);
}
maximum[z++]=max;
printf("Max savings: %lf\n",max);
}
printf("Max saving values: \n");
for(z=0;z<3;z++)
printf("%lf for case
%d\n",maximum[z],z);
}
output: