Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write C++, Thanks Background: Shown on page 3 is a series RLC circuit, consisting of a sinusoidal voltage source, a resistor, an inductor, and a

Write C++, Thanks

Background:

Shown on page 3 is a "series RLC" circuit, consisting of a sinusoidal voltage source, a resistor, an inductor, and a capacitor. The current I in this circuit changes as the frequency of the sinusoidal voltage changes.

R = Resistance in Ohms () L = Inductance in Henries (H) C = Capacitance in Farads (F) I = Current in Amperes (A) E = Sinusoidal voltage in Volts (V), at some frequency, f f = Frequency in Hertz (Hz)

The current, I, can be calculated in the circuit using the following relationships: XL = inductive reactance = 2 f L in ohms ()

XC = capacitive reactance = in ohms ()

Z=total circuitimpedance= inohms() I = current = in Amperes (A)

Program Requirements:

The user should be prompted to input the values for E, R, L, C, finitial and ffinal.

The value for R should be entered in ohms (for example, the user enters 5000.)

The value of E should be entered in volts

The value of C should be entered in mF, uF, or nF (then convert it to F). For example, the user enters 10

mF.

The value of L should be entered in mH or uH (then convert it to H).

The value of finitial and ffinal should be entered in Hz, kHz, or MHz (then convert it to Hz).

Create a table containing values of f, XL, XC, Z, and I for a range of values of f.

Use a loop vary f from finitial to the first value of f greater than or equal to ffinal where f doubles each

time through the loop. For example, if finitial = 100 and ffinal = 1E6, then f = 100, 200, 400, 800, .....

1638400 (this spacing is common as graphs often place frequency on a log scale).

During each pass though the loop call separate functions to calculate XL, XC, and Z.

Use at least two additional user-defined functions.

The results should be displayed in a neat, formatted table with headings, units, etc. The value of the

current, I, should be printed in mA rather than Amperes. An example of what this table might look like

is shown below. The lines in the table are not required, but could be included for extra credit.

Your loop should also determine the maximum value of the current in the table and the corresponding

frequency.

Page 2

The output should the table described above, as well as a title or brief explanation of the program, the values of the inputs, and the maximum value of the current and the frequency where I is maximum (include units with all input and output values).

The results should display f as an integer; XC, XL, and Z using one digit after the decimal point; and I with 3 digits after the decimal point (as shown below). The numbers should not be printed in scientific notation.

Include a loop that will give the user the option of re-running the program.

Include loops to allow the user to correct bad inputs. Test for the following:

Values entered for R, L, C, and E must be positive.

Proper units and prefixes must be used with inputs as described above.

finitial > 1 Hz, ffinal < 1E9 Hz, and ffinal > 2*finitial.

Example Output Table: (for R = 5000 , L = 20 mH, C = 0.02 F, E = 15V, finitial = 100 Hz, and ffinal = 1 MHz). Note: You might be able to print the ohm () symbol using the ASCII extended character set (cout << 10M\352; - to print 10 M).

. . . .. . . . .. . . . ..

Program Testing: Print your results and include them with your report for the following two cases: 1) The example shown above. 2) The values shown corresponding to your name in the table on the following page.

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

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

I What do you want most from an organization/ career?

Answered: 1 week ago