Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You work for a secret government laboratory that does highly advanced research in nuclear energy for peaceful applications. The lab has a small working plutocritical

You work for a secret government laboratory that does highly advanced research in nuclear energy for peaceful applications. The lab has a small working plutocritical reactor that has been yielding very promising results. Wed like to say that you are the Chief Scientist of the Instrumentation and Control department, , but you are not. You are just a first year hire as a software engineer.

Nevertheless, you have been given a very important assignment. The reactor has been behaving unstably recently, with suddenly oscillating power levels that come on very suddenly and disappear just as suddenly, followed by long periods of normal operation. The problem has been generally traced to the polyfundus cavity of the hyperclastic chamber, deep within the bowels of the reactor. The transmogrifier unit that controls the poison rods of the reactor has been observed to violently shake on occasion by people who happened to be walking by not a normal and a rather discomforting thing.

So You have been asked to write some software to add to the transmogrifier that measures and saves the last 10 seconds prior to and the 10 seconds after a sudden positive change in the glottal pressure of the main transmogrifier intake valve. At the same time, the temperature and the flow of the liquid sodium in the reactor are to be measured and saved to better understand the causes of this new phenomenon.

Your code will gather and store the data collected. The recording event will be triggered by a positive change in glottal pressure of 100 psi or more. However, because months may pass between abnormal events, all the data collected cannot be kept in the small memory element of the transmogrifier. You just need to collect the critical 21 seconds worth of data, which are collected once per second.

You will need to store four pieces of data:

a) The time in seconds (int t).

b) The transmogrifier inlet valve pressure (float tp).

c) The transmogrifier liquid sodium flow (float tf).

d) The transmogrifier liquid sodium temperature in degrees C (float tt).

You will need to create a structure (struct) that when instantiated, its instance variables will hold the three values read at a particular time t. There will be one struct instance for every measurement taken (once per second). The 21 struct instances will be put into a circular array of size 21. Then, the results will be printed in a table displayed in the transmogrifier computer screen. The output should look as follows (without the lines in the table): Note: This table is an example! Your program need not replicate these same values!!!!

Time (secs)

tp

(psi)

tf

(gpm)

tt

(Deg C)

10

500

15

172

9

527

10

153

8

595

11

102

7

610

10

190

6

530

12

183

5

601

10

126

4

621

12

144

3

581

11

108

2

574

13

115

1

542

15

112

0

659

12

181

1

527

16

123

2

675

17

165

3

591

20

175

4

579

10

184

5

608

12

179

6

633

11

155

7

650

17

193

8

540

14

138

9

575

12

113

10

621

16

146

The event will be recognized whenever a positive change in pressure of at least 100 psi is computed between one tp measurement and the next. At that point, the next 10 measurements will be saved (regardless of their value), the process will stop and the table will be printed to screen.

However, you do not yet have access to the measuring devices to test your code. So, you will simulate the measurements through a random number generator. Never mind that the numbers will be meaningless for now. You merely want to test out operation of the circular array, the struct instances and the printout functions. The ranges of each variable are as follows:

tp: 500 to 700 psi.

tf: 10 to 20 gpm

tt: 100 to 200 deg C

You must use at least two userdefined functions: one to generate the random number and set the values of the variables in main() by reference, and another one to which you will pass the entire populated array for printing to screen.

Musts: You must use the following elements in the program:

1. A struct structure

2. An array of size 21.

3. A random number generator rand()

4. At least two userdefined functions: one to generate the random numbers and another to do the printing.

5. The typedef data specifier for the structure.

Lastly (and obviously!), your program must be written in C and must compile and execute correctly in Code::Blocks with the gcc compiler.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

3 Use a spreadsheet to solve Problem 5 of Section 18.4.

Answered: 1 week ago