Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Objective The objective is to explore the use of data and the development of temperature conversion and linear interpolation algorithms for calculating psi from a
Objective
The objective is to explore the use of data and the development of temperature conversion and linear interpolation algorithms for calculating psi from a given temperature.
Introduction
Your program will calculate the resultant saturated pressure of our mythical vessel of special fluid and air to a global variable vesselPressPsi, from a temperature (degrees Fahrenheit, global variable vesselTempFahr). This temperature represents an electrical sensor input that was converted to engineering units. The linear interpolation algorithm is based on degrees Celsius.
Requirements
Design, Code, Test a C program which will loop forever calculating the resultant saturated pressure of our mythical vessel of special fluid and air to a global variable; vesselPressPsi, from a temperature (degrees Fahrenheit, global variable vesselTempFahr). Temperature will be provided by using a random number generator. Use the modulus operator to place your random number closer to the range vesselTempFahr (100-1800F). This temperature represents an electrical sensor input that was converted to engineering units. The linear interpolation algorithm and corresponding data tables are based on degrees Celsius (local variable vesselTempCelsius). The program will use the data tables in Appendix A, which provide corresponding pressure for a given Celsius temperature. One data pair is the upper and lower degree Celsius and the other pair is the upper and lower relative saturated pressure for the corresponding temperature. Compute the saturated pressure from the temperature input.
Since temperature in this assignment represents an electrical sensor input, we need to understand some basic constraints with sensors. Sometimes sensors are saturated or at their limits of operations, the sensor may respond (signal) with unknown values outside its working range. This could cause erratic or catastrophic conditions for control systems. This is solved by placing limiter testing at saturation points of sensors. Saturation testing imposes upper and lower bounds on a signal. When the input signal is within the range specified by lower limit and upper limit parameters, the input signal passes through unchanged. When the input signal is outside these bounds, the signal is clipped to the upper or lower bound values.
Algorithm
Not every Temperature input will have a direct corresponding pressure. For example if vesselTempCelsius = 65, which is neither of the known Celsius limits in Appendix A. Linear interpolation is a way to fill in the holes'' in tables. Linear Interpolation is a method of constructing new data points within the range of a discrete set of known data points. Linear interpolation is quick and easy, but at times not very precise, to increase precision is to increase the number of data points with in the know set of data points.
In this assignment, you only have two data points, which represent the upper and lower data range.
Interpolation example with Appendix A:
vesselTempFahr = 147.0
Result of hand test is psi= 0.2978 psi
Design considerations:
1. IFF, your Hw5 was buggered, you may use the Hw5 solution as a baseline for Hw6.
2. Notice, not much seems to have changed from Hw5
a. Make sure you can see the comments in this document for change notifications
b. Tables, aka arrays saturation/bounds are based on the first and last index values
i. You will need to calculate them for your If statements and loops
c. for-loops are better than while-loops to scan through the array to find a data pair for your algorithm
3. Setup your testing to make sure all requirements are still met.
4. Notice the tables arrays requirements do not include identifier naming, types, and whether the data is to be local or global.
a. Since they are tables and never to change, try defining them as constants
b. There are reasons why we do this, but that is for another class/course.
5. When scanning though the data table, place break statements to exit loops once data and calculations are completed.
a. Lookup reserved word break to understand use-case.
6. There will be changes to the design which should show-up in your traceability form.
7. The code must perform Saturation testing. Provide your test plan for verifying Saturation testing in your header comment.
8. The data used to validate your hand calculations become your known data inputs to your code. That is a step in validating your code algorithm.
Deliverables 40pts
1. Fill out the Simple Requirements tractability form.
a. This is an engineering process of design and test (V&V)
b. To identify requirements, a conceptual design and how to verify/validate the design meets the requirement
c. Submit as Hw5a document (PDF, Word, or Excel compatibility)
2. You are to follow the Programming Standards for this class.
Appendix A
Temperature
- t -
(oc)
Pressure
- pv -
(psia, lb/in2)
10
0.1317
30
0.1881
60
0.2563
70
0.3631
80
0.5069
90
0.6979
110
0.9493
130
1.692
140
2.888
160
4.736
190
7.507
220
11.52
240
14.69
250
17.19
260
24.97
270
35.43
280
49.20
350
67.01
400
134.60
450
247.26
500
422.55
575
680.86
650
1045.43
700
1543.20
800
2308.40
950
3194.30
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started