ENGN 38

Lab Programming Assignment #2

 

The airspeed of an aircraft is determined by two pressure readings taken from a pitot tube. 

They are the total pressure, PT, and the static pressure, P.

Both of these pressures are measured from the pitot tube in units of psi (pounds per square inch.) 

The formula below will compute the airspeed in ft/sec for sea level flight. 

velocity equals the square root of the quantity 2 times k divided by the quantity k minus 1 time P divided by rho times the quantity r where r is ...

where:

  • velocity is the airspeed of the aircraft
  • k = 1.4 which is the ratio of specific heats for air (Cp/Cv)
  • rho = 0.002378 slugs/ft3 which is the density of air at sea level standard conditions
  • P is static pressure in psf (pounds per square foot)
  • PT is total pressure in psf (pounds per square foot)                             

Instructions:

1.  Write a fully documented C++ program (use comments!) that will prompt the user to input the total pressure and static pressure, then compute the airspeed, then print the results to the computer monitor as shown in the output requirements below. 

                             

2.  Compile and run the program twice, using the two different sets of input data below.

                                 

3.  Print out your source code and program output making sure that the formatting is up to C++ standards and professional in appearance.  If this does not fit on one page, delete enough so that it does. (Please do not make font size less than 10 points.) What to delete? What to keep? Make sure that you at least have the header as shown in Lab#1 (your student number, your name, the class identifier, the lab number) and the output from your program. As space permits, include any other essentials as you deem appropriate. Make sure that everything is clearly labeled and easy to read and follow. Have this one page ready to turn in by the due date.

                     

Beware: The input data from the user will be in pounds per square inch (absolute), psi, but the formula here uses pounds per square foot, psf.  Your program should ask the user if they are using units of psi or psf for their pressure values. If they are using psi then your program needs to convert the psi units into psf units before using the formula. If they are using psf units then your program does not need to do this conversion.

                                 

Hints and Important Points

Modularize your program by appropriate formatting. 

Use the constant modifier (const) for k and rho.

Use the standard format for a C++ program algorithm:

1.      Declare and initialize variables, as needed.

2.      Input: Prompt the user for input data to be entered at the keyboard.

3.      Processing: Compute velocity in units of ft/s and mph.

4.  Output: Display output to the screen.

              

                                             

Input Data

Run the program twice with these two set of input data: 

                         

1)         PT  =   23   psi

            P    =   14.7 psi

 

2)         PT  =   30   psi

            P    =   14.7 psi

 

 

                             

 Output Requirements

Your output should look similar to this (including the astericks and spacing):

   

***************Output**********Results*******************************

*                                                                                                                     *

*                         Pressure Total --------------   30.0     psi                                   *

*                                                                                                                     *

*                         Pressure Static -------------   14.7      psi                                   *

*                                                                                                                     *

*                                                                                                                     *

*                         Air Speed  ----------------     1186.9   (ft/sec)                             *

*                                                                                                                     *

*                                                                  xxxx.x  (mph)                               *

*                                                                                                                     *

*******************************************************************