Project: Solar Panels

Solar Energy

Photovoltaic (PV) systems are used to translate sunlight into energy, for residential and industrial use. Along with wind power and other sources, PV systems represent a renewable source of energy, though PV systems do require batteries to allow for a continuous supply of electricity. The use of PV systems reduces the amount of greenhouse gases produced by traditional fossil fuel energy sources, and solar is a reliable form of energy.

Check out the following short video about a microgrid in Brooklyn, NY, that allows a set of local residents to get their energy from this a local solar panel “farm”:

One thing to consider with PV systems is just how much energy can be harnessed.  Calculations of solar panel capability often assume a 90° angle between sunlight and the solar panel; in other words, maximum energy can be achieved when the solar panel and sunlight are perpendicular.  However, in reality, corrections to the panel’s incline need to be made based on geographic position, season, and even the day of the year. How do we determine the amount of solar radiation available to the panel on a given day?

We can estimate the amount of solar radiation received by an inclined PV panel using the following formula:

solar_formula1

Using the amount of solar radiation measured on a horizontal surface (Sh), the angle at which the solar panel is tilted (β), and the elevation angle θ (in degrees). The elevation angle θ (in degrees) is calculated from:

solar_formula2

and where d is the day of the year; for example, January 20 would be day 20, whereas February 4 would be day 35. The sine function (“sin”) is a trigonometric function based on the concept of a right triangle; it computes the quotient of (length of side opposite the angle / length of hypotenuse).

Java Project: Computing The Impact of Tilt

This activity will provide you with an introduction to the fundamentals of conditional repetition in Java. The focus of this project is on how to solve problems using the Java “while” or “for” statements. In this project, you will…

  • Develop code to read data from the standard input and produce data to the standard output.
  • Write code that conforms to a programming style specified by the instructor.
  • Translate given mathematical expressions into equivalent syntactically correct programming statements.
  • Select and implement the appropriate control structure(s) for this problem.

As always, be sure to properly document your code. Consult the Java Coding Guidelines document for proper coding standards. Use good design principles and design the solution before attempting to write code.

Exercise #1: Create a class (program) called SolarPanel.java.This program will allow the user to enter three inputs, as follows:

  • Sh , the amount of solar radiation measured horizontally, in kWh/m2
  • β, the angle at which the solar panel is tilted, in degrees (range is [0-180])
  • d, the day of the year (1-365)

You must validate the d and β inputs for the given range. Remember to include a descriptive error message, and follow the basic steps outlined in class. Once the program has received the input, two pieces of output should be produced:

  • An echo-print of the input values, with appropriate units
  • The amount of solar radiation received on a PV solar panel, with appropriate units

You may assume that the latitude is 40.6084, which is the latitude of Allentown, PA. All floating point values should be expressed with three digits of precision on the right of the decimal point. Note: The sin() method in Java, found in the Math class, expects to be given an angle in radians, not degrees. Use the toRadians method of the Math class to convert your angle to radians prior to using the sin() method.

Further details will be provided in class. Here is an example test case:

Please enter the amount of horizontal solar radiation (kWh/m^2): 30
You entered 30.000 kWh/m^2.

Please enter the angle of tilt, in degrees: 45
You entered 45.000 degrees.

Please enter the day (1-365): 30
You entered day 30.

Sp: 56.036 kWh/m^2.

and here is another:

Please enter the amount of horizontal solar radiation (kWh/m^2): 30
You entered 30.000 kWh/m^2.

Please enter the angle of tilt, in degrees: 42
You entered 42.000 degrees.

Please enter the day (1-365): 30
You entered day 30.

Sp: 55.247 kWh/m^2.

Exercise #2: Copy your SolarPanel.java class to a new class called SolarPanel2.java.Modify the program to eliminate the day (d) input. Your program should still input the following values:

  • Sh , the amount of solar radiation measured horizontally, in kWh/m2
  • β, the angle at which the solar panel is tilted, in degrees (range is [0-180])

Once the program has received the input, compute the total amount of solar radiation received on a PV panel, using the provided inputs, over the course of a year. A table of solar radiation received on the solar panel (Sp) over a period of 365 days should be produced.

You may assume that the latitude is 40.6084, which is the latitude of Allentown, PA. All floating point values should be expressed with three digits of precision on the right of the decimal point. Note: The sin() method in Java, found in the Math class, expects to be given an angle in radians, not degrees. Use the toRadians method of the Math class to convert your angle to radians prior to using the sin() method.

A partial example test case is shown here:

Please enter the amount of horizontal solar radiation (kWh/m^2): 30
You entered 30.000 kWh/m^2.

Please enter the angle of tilt, in degrees: 45
You entered 45.000 degrees.

     DAY    Sp
     ===  ======
      1   49.376
      2   49.293
      3   49.204
      4   49.108
      5   49.006
        ...
        ...
    360   49.729
    361   49.688
    362   49.639
    363   49.584
    364   49.521
    365   49.452

Sum: 12784.52 kWh/m^2.

Deliverables

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

Powered by WordPress. Designed by WooThemes

Skip to toolbar