C++ Project: Wind Power

The United Nations (UN) has set forth 17 goals for sustainable development. Goal 7 is designed to “Ensure access to affordable, reliable, sustainable and modern energy for all”. Access to energy resources is necessary for quality of life, including jobs, agriculture, and climate-related issues. Energy resources includes electricity as well as access to clean, renewable fuels and the technologies for harnessing and distributing energy.

There are a number of renewable, clean energy sources available. In this project, we will consider wind power as a renewable energy source.

What is a Wind Turbine?

Harnessing the power of wind to produce electricity is a growing phenomenon, though the basic technology has been around for years. An inexhaustible resource, wind power can used to provide inexpensive electrical capacity for remote areas and clean, renewable energy for other areas. Wind turbines represent the mechanism by which the power of the wind can be transformed into electricity. Check out the brief video below for more details on how wind power works:

Wind turbines operate in the reverse of a simple house fan: wind blows, and in doing so it turns the “blades” (propellers) of a wind turbine around a central part called a rotor. The rotor in turn spins a generator, which creates electricity that can then be stored and accessed.

In the United States, it has been estimated that the installed wind power capacity is 89 GW (gigawatts) as of 2018, and is expected to grow to over 400 GW by 2050 (according to the Department of Energy). This capacity is the result of over 54,000 wind turbines installed in 41 states and U.S. territories. The electricity generated by wind sources accounts for about 6.3% of total U.S. electricity generation, as of 2017, though this percentage continues to grow.

Calculating the Energy Produced by a Wind Turbine

Suppose you wanted to harness to power of wind to generate electricity. One question you might want to ask is: what is the amount of power my wind turbine can produce? To answer this question, you will need at least the following information:

  • The average wind speed (in m/s)
  • The operating efficiency of your wind turbine (in %)
  • The radius of the blades on your wind turbine (in meters)

To compute the maximum power output for your wind turbine, you would need the following math formulas:

  • A= πr2, which represents the cross-sectional area of a circle (π = 3.14159265).
  • Pmax = 0.5ρAv3, which calculates the maximum available power given the wind speed in m/s (ν), cross-sectional area of the blades in m2 (A), and the density of the air (ρ = 1.2 kg/m3).

Once you have the maximum available power, computing the actual amount of power (not the maximum) produced by the wind turbine is a matter of determining the amount of power based on the operating efficiency.

C++ Project: Computing Wind Turbine Power Output

This project will provide you with an introduction to the fundamentals of problem-solving in C++. The focus of this project is on how to solve simple problems using C++ data types, variables, and arithmetic operations. At the end of this project, you will…

  • Develop code to read data from the standard input and produce data to the standard output.
  • Translate a given mathematical expression into equivalent syntactically correct programming statements.
  • Write code that conforms to a set of commonly accepted style guidelines.

Before you begin, it is recommend that you explore the content found in the Introduction to C++ electronic resource. This resource includes code examples, exercises, video discussions of basic C++ concepts, and a vocabulary list.

As you write your code, be sure to properly document your code. Consult the C++ Coding Guidelines document (provided by the instructor) for style expectations. Well-written code is easier to debug, easier to maintain over time, and easier to extend as new requirements arise.

Exercise #1: Create a program file called WindPower1.cpp in your C++ development environment. This program will ultimately compute the amount of power produced by a wind turbine, but we will be building the program in stages. In this exercise, we will take care of the user input. Your program should take three double inputs:

  • The average wind speed (in m/s)
  • The operating efficiency of your wind turbine (in %)
  • The radius of the blades on your wind turbine (in meters)

Your program should create three variables to store these values, followed by appropriate user prompts and input statements (three pairs of cout/cin statements). Once the input is complete, your program should  end. Here are few sample tests you can run to check if your program is working correctly; your prompts should appear exactly as shown here, and you can type in the listed input values when prompted:

Test Case #1

Enter the Average Wind Speed (in m/s): 5.0
Enter the Operating Efficiency [0...1]: 0.98
Enter the Blade Radius (in meters): 2.0

Test Case #2

Enter the Average Wind Speed (in m/s): 12.29
Enter the Operating Efficiency [0...1]: 0.10
Enter the Blade Radius (in meters): 3.0

Exercise #2: Now that you have the input statements complete, you will add code to echo-print the input values to the user along with descriptive messages and units. This will simply involve adding three cout statements to your code. All numeric amounts should be precise to two decimal places: remember this involves using the setf and precision methods of the cout object, as shown below:

cout.setf( ios::fixed ); /* Use fixed-point notation */
cout.precision(2);       /* Show two digits on the right of the decimal */

Here are few sample tests you can run to check if your program is working correctly:

Test Case #3

Enter the Average Wind Speed (in m/s): 5.0
Enter the Operating Efficiency [0...1]: 0.98
Enter the Blade Radius (in meters): 2.0

You entered an Average Wind Speed of 5.00 m/s.
You entered an Operating Efficiency of 0.98 (98.00%).
You entered a Blade Radius of 2.00 meters.

Test Case #4

Enter the Average Wind Speed (in m/s): 12.29
Enter the Operating Efficiency [0...1]: 0.10
Enter the Blade Radius (in meters): 3.0

You entered an Average Wind Speed of 12.29 m/s.
You entered an Operating Efficiency of 0.10 (10.00%).
You entered a Blade Radius of 3.00 meters.

Exercise #3: Now you are ready to perform the calculations. Add two double variable declarations to your code (one for maximum power, one for actual power) and use the aforementioned formulas to compute the wind turbine maximum power value. Remember that the actual power is the product of the maximum power and the operating efficiency. Store the results in your two variables. and add a cout statement to your code to display the contents of those variables. Here are few sample tests you can run to check if your program is working correctly:

Test Case #5

Enter the Average Wind Speed (in m/s): 5.0
Enter the Operating Efficiency [0...1]: 0.98
Enter the Blade Radius (in meters): 2.0

You entered an Average Wind Speed of 5.00 m/s.
You entered an Operating Efficiency of 0.98 (98.00%).
You entered a Blade Radius of 2.00 meters.
The Maximum Power is 942.48 W and the Actual Power is 923.63 W.

Test Case #6

Enter the Average Wind Speed (in m/s): 12.29
Enter the Operating Efficiency [0...1]: 0.10
Enter the Blade Radius (in meters): 3.0

You entered an Average Wind Speed of 12.29 m/s.
You entered an Operating Efficiency of 0.10 (10.00%).
You entered a Blade Radius of 3.00 meters.
The Maximum Power is 31491.93 W and the Actual Power is 3149.19 W.

Your program is now complete.

Deliverables

See the instructor for submission instructions and due date(s).

Powered by WordPress. Designed by WooThemes

Skip to toolbar