Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

marking schem: Function(s): 10 marks Sentinel loop: 5 marks Invalid input checks

ID: 3568323 • Letter: M

Question

marking schem:

Function(s): 10 marks

Sentinel loop: 5 marks

Invalid input checks: 5 marks

Calculation and output of required data, including calling function(s) as appropriate: 10 marks

Final Lab Test Sample

The diagram below depicts a row of blades in an air compressor.

http://sce.carleton.ca/courses/ecor-1606/f14/practicelabfinal2/samplabfinal2.pdf

Air Flow

flow entry angle (

?1)

blade entry angle (

? 1)

blade exit angle (

? 2)

flow exit angle (

?2)

Incidence (

i)

s

c

solidity (?) = c/s

The designer knows the flow entry angle (

?1), the desired flow exit angle (?2) and the

desired

incidence (i). He (or she) must select the solidity (?) of the row, the blade entry

angle (

?1), and the blade exit angle (? 2).

Important note:

Angles are in degrees throughout. All of the formulae assume degrees.

Choosing the blade entry angle is easy.

= -

i 1 1 a b

A suitable solidity value may be obtained by solving the equation below.

(0.187148 15.2599) ln(1/ ) 0.677212

(ln(1/ )) 0

33.5291 (0.469188 0.0020961 )

2

2

2 2 1

- - =

+ + - +

b s s

b b b

Write a

function, computeSolidity, that takes ?1 and ?2, and computes and returns ?.

There are a number of ways of solving the equation. You are to use a brute force

approach. No great accuracy is required (the choice of a solidity value is in any case

somewhat subjective) and the number of values that need be considered is therefore

limited. Have your function evaluate the left hand side of the equation for solidity values

ranging from 0.6 to 2.1 (in steps of 0.1) and have it select the value that comes closest to

satisfying the equation (i.e. that makes the left hand side closest to zero).

To assist you in debugging your code, the function in the sample executable prints out a

table showing the results of its calculations. Your function must do likewise. The

columns of the table must line up, solidity values must be displayed with one decimal

place, and computed values must be displayed with four decimal places.

Once the blade entry angle and the solidity have been determined, the blade exit angle

that will give the desired flow exit angle can be determined using the following equation.

0.5

2

0.5

2

2 1

2

1

500

1 0.23

1

500

0.23

??

?

??

?

??

?

??

?

- +

??

?

??

?

??

?

??

?

- +

=

s

b

s

b

b a

a

Write a

function, computeBladeExitAngle, that takes ?1, ?2, and ?, and computes and

returns

?2.

Your functions must correspond exactly to the specifications given.

Write a C++

program ("practice2.cpp") that repeatedly reads in design scenarios (flow

entry angle

?1, desired flow exit angle ?2, and desired incidence i), until -1 -1 -1 is

entered. For each set of values entered your program should either i) output an error

message (if the entered values are invalid -- see next paragraph) or ii) compute and output

values for the blade entry angle, the row solidity, and the blade exit angle.

The flow exit angle

?2 must be between -10 and 50 degrees, the incidence i must be

between -3 and 3 degrees, and the value of

1 2

2

36 0.45

b b

b

-

-

must be between 0.75 and 1.25. All of these ranges are inclusive of the specified values.

Be sure to consider the possibility that the values entered for

?1 and ?2 may be equal.

Note:

Your program must include and use the two required functions described above.

Test Run #1

Enter flow entry angle, flow exit angle, and incidence:

40 0 0

Solidity LHS Value

----------------------------

0.6 -14.4428

0.7 -11.9999

0.8 -9.9098

0.9 -8.0862

1.0 -6.4709

1.1 -5.0226

1.2 -3.7112

1.3 -2.5139

1.4 -1.4130

1.5 -0.3949

1.6 0.5517

1.7 1.4358

1.8 2.2647

1.9 3.0447

2.0 3.7811

2.1 4.4782

Leaving function. The chosen value is 1.5

Blade entry angle: 40.0

Soldidity: 1.5

Blade exit angle: -9.2

Enter flow entry angle, flow exit angle, and incidence:

10 10 0

Invalid values ignored.

Enter flow entry angle, flow exit angle, and incidence:

20 10 0

Invalid values ignored

Enter flow entry angle, flow exit angle, and incidence:

60 40 0

Solidity LHS Value

----------------------------

0.6 -8.4975

0.7 -7.2086

0.8 -6.1181

0.9 -5.1762

1.0 -4.3496

1.1 -3.6148

1.2 -2.9548

1.3 -2.3566

1.4 -1.8106

1.5 -1.3089

1.6 -0.8454

1.7 -0.4152

1.8 -0.0142

1.9 0.3611

2.0 0.7135

2.1 1.0454

Leaving function. The chosen value is 1.8

Blade entry angle: 60.0

Soldidity: 1.8

Blade exit angle: 34.0

Enter flow entry angle, flow exit angle, and incidence:

30 30 0

Invalid values ignored.

Enter flow entry angle, flow exit angle, and incidence:

-1 -1 -1

Press any key to continue . . .

Test Run #2

Enter flow entry angle, flow exit angle, and incidence:

33.1 0 0

Solidity LHS Value

----------------------------

0.6 -7.5428

0.7 -5.0999

0.8 -3.0098

0.9 -1.1862

1.0 0.4291

1.1 1.8774

1.2 3.1888

1.3 4.3861

1.4 5.4870

1.5 6.5051

1.6 7.4517

1.7 8.3358

1.8 9.1647

1.9 9.9447

2.0 10.6811

2.1 11.3782

Leaving function. The chosen value is 1.0

Blade entry angle: 33.1

Soldidity: 1.0

Blade exit angle: -9.9

Enter flow entry angle, flow exit angle, and incidence:

41.6 -9.999 1

Solidity LHS Value

----------------------------

0.6 -21.4805

0.7 -18.7492

0.8 -16.4092

0.9 -14.3652

1.0 -12.5527

1.1 -10.9261

1.2 -9.4519

1.3 -8.1047

1.4 -6.8652

1.5 -5.7180

1.6 -4.6506

1.7 -3.6531

1.8 -2.7172

1.9 -1.8360

2.0 -1.0037

2.1 -0.2153

Leaving function. The chosen value is 2.1

Blade entry angle: 40.6

Soldidity: 2.1

Blade exit angle: -18.6

Enter flow entry angle, flow exit angle, and incidence:

40 0 4

Invalid values ignored

Enter flow entry angle, flow exit angle, and incidence:

40 0 -4

Invalid values ignored

Enter flow entry angle, flow exit angle, and incidence:

41.6 -10.01 1

Invalid values ignored

Enter flow entry angle, flow exit angle, and incidence:

50 -9.999 0

Invalid values ignored

Enter flow entry angle, flow exit angle, and incidence:

46.7 -9.999 1

Invalid values ignored

Enter flow entry angle, flow exit angle, and incidence:

60 -9.999 1

Invalid values ignored

Enter flow entry angle, flow exit angle, and incidence:

31.4 10.9 2

Invalid values ignored

Enter flow entry angle, flow exit angle, and incidence:

40 0 -3.1

Invalid values ignored

Enter flow entry angle, flow exit angle, and incidence:

60 10 0

Invalid values ignored

Enter flow entry angle, flow exit angle, and incidence:

15 10 0

Invalid values ignored

Enter flow entry angle, flow exit angle, and incidence:

-1 -1 -1

Press any key to continue . . .

Lab Test Hints

The second function is very straightforward: given alpha1, beta1, and beta2, calculate alpha2 as per the

formula.

The first function involves finding a minimum. You are to use the given values of beta1 and beta2 and

find the value of the left hand side of the equation using:

1. sigma = 0.6

2. sigma = 0.7

Explanation / Answer

100% Fresh answer, guaranteed to get you best grades possible. Just check it out: http://programmingtutor3.tk/