MATLAB

profileSA 11
Homework7.pdf

Homework 7

A contractor in Flavortown is renovating a room in a house. His client is interested in lowering his heating bill during the winter. The room has four walls and a roof, and one window facing the front yard of the house. The contractor, Mr. Fieri, has already effectively insulated the walls so that no heat is lost through them.

You have been asked to aid him in designing the window for the room, which is 1 meter by 0.5 meters. The contractor has three different types of glass to choose from, each with a different thermal conductivity constant. They also are all available in a wide range of thicknesses. The previous window allowed 0.5 kWh of heat to escape per hour, i.e. 500 W is the heat loss rate. The room is heated by a space heater running 24 hours a day to keep the room at a constant 25 degrees Celsius. The space heater’s thermal efficiency is 0.8, meaning that 80% of the energy consumed by the heater is turned into heat. In Flavortown, the cost of electricity is $0.10 per kilowatt-hour. Here are the specifications of each type of glass:

Type Thermal Conductivity, (k), (W/m/K) Price

Glass 1 .78 $28.70 + $12 per mm

Glass 2 .8 $30 + $11 per mm

Glass 3 .82 $30 + $8 per mm

Mr. Ramsay, the client, seems to be on the fence about the renovation. After losing a batch of his delicious lamb sauce he is in an especially bad mood and doesn’t want to spend more money on a new window. The contractor wants to show him how beneficial the renovation will be. In your code, you will need to calculate the amount of time it will take for Mr. Ramsay to see a return on his investment and his daily savings.

Your function and script will help Mr. Fieri determine the specifications of the glass, as well as display Mr. Ramsay’s cost savings in order to convince him to go through with the job. The Function: -Inputs: [Glass Type],[Outside Temperature], [Desired Heat Loss] -Outputs: [Heat Flux],[Desired Thickness],[Cost of Pane],[Time until Investment is Covered],[Cost Savings per Day]

1. Your function will have three inputs, outside temperature (T_O) in units of Celsius, glass type (Type) a scalar that can be 1, 2, or 3, and desired heat loss (DHL) in Watts.

2. Since glass type is an input to your function, you will need to include an if/else statement to determine the glass parameters. For example, if the glass type is 1, the thermal conductivity used in your calculations will have to be 0.78, etc.

3. After defining the thermal conductivity and costs of the glass based on the type, you will then initialize the rest of your constants: Previous allowed heat loss, Indoor Temperature, the Area of your window, and the Efficiency of the space heater.

4. In order to calculate the desired window pane thickness you will need to use a series of formulas. Heat Flux quantifies the heat diffusion through a certain material. The unit for Heat Flux is W/m2, the number of joules per second of thermal energy passing through one square meter of a material. The Heat Flux formula, is defined as:

Heat Flux (q) = -k*(ΔT/Δx)

Where k is the thermal conductivity, ΔT is the difference between the outdoor and indoor temperature in Celsius or Kelvin, and Δx is the thickness of the window pane in meters.

5. The next formula you will need is the formula for heat loss in Watts, in which you will use the calculated value for heat flux and the input desired heat loss. Since you already know the desired heat loss, you will be solving for the desired thickness of the glass after performing the substitution. The formula for heat loss per hour is:

ΔQ/Δt = q * A

Where q is heat flux and A is the area of your window pane in m^2.

6. Derive the final formula needed for solving for desired thickness, in meters, on a piece of paper. Next implement the formula into your function. Once you have obtained the necessary glass thickness (Δx) you can substitute this value back into the Heat Flux formula to find the heat flux of the window pane (which is another one of your outputs).

7. You will then have to calculate the cost of the window pane and output it, noting that the cost depends on the thickness in millimeters.

8. After this, you will calculate the number of days that it will take for Mr. Ramsay to recoup his investment. Given that the cost of the renovation is $500 plus the cost of the window, you must first find the difference in the amount of energy that the space heater consumes before and after the renovation. Keep in mind that the heat loss through the window per hour is equal to the amount of energy that needs to be outputted by the space heater to keep the temperature of the room constant. Find this required energy output per hour before and after the renovation, then divide both values by the thermal efficiency (.8) of the heater to determine the energy input. Using this information and the cost of energy you can calculate how many days it will take to recoup the investment and how much money will be saved per day.

The Script:

1. First you will have to initialize a vector of Outside Temperature values starting at -15 degrees Celsius to 15 degrees Celsius in increments of 0.5. Set the desired heat loss to 250 Watts.

2. Using two nested for loops, you will then run your function for each outside temperature value and each glass type, storing each output in different matrices, with each column representing a different glass type, and each row a different outside temperature. When

you call your function, instead of having a variable for the outputs Investment Recovery Time and Cost Saved per Day set these to both to “~” for now.

3. Now you must analyze the data. On one graph, plot the thicknesses of each glass type versus the Outdoor temperature vector. The line for Glass 1 should be a blue solid line. The line for Glass 2 should be a red solid line. The line for Glass 3 should be a green solid line. Comment on the nature of the relationship between required thickness and outside temperature.

4. On a new figure, plot the costs of each glass type versus the Outside Temperatures. The lines should have the same specifications as the previous graph. Does the outdoor temperature have an effect on which glass type is the most cost efficient? Which panes are the most cost efficient depending on the temperature? At approximately which point does the most efficient glass type change? If the average outdoor temperature in Flavortown in the winter is 0 degrees Celsius, which type of glass should the contractor use? Use a comment in your script to discuss the results.

5. For the second part of your script you will create a vector, DHL, of desired heat loss values ranging from 100 W to 300 W in increments of 5 W. Set your Outdoor Temperature to 0 degrees Celsius. Set your glass type to the optimal glass type at 0 degrees Celsius. Use a for loop to run your function for the values of DHL using a for loop. Set the outputs Heat Flux, Desired Thickness, and Cost of Pane to “~”. Call your remaining outputted results vectors Investment_Time and Daily_Savings.

6. Now plot your Investment_Time vector versus DHL on one graph, with a simple blue line. Then plot your Daily_Savings vector versus DHL with a red line. At about what Desired Heat Loss value is Mr. Ramsay’s investment recuperation time one year (365 days)? At this DHL, about how much money does Mr. Ramsay save per day? (If you’re having trouble reading the graph, look through the values in your DHL, Daily_Savings, and Investment_Time vectors).

DON’T FORGET TO LABEL YOUR AXES AND GIVE TITLES TO YOUR GRAPHS