Use octave-online to create a script to answer (code) the following questions.
On March 16th, 2021, CNBC reported that the Solar Energy Industries Association and Wood Mackenzie found that the solar industry added a record 19.2 gigawatts of new capacity during 2020, a 43% jump from 2019. This drastic increase in the use of solar panel technology is creating ample opportunities for engineers to evaluate cost and efficiency of residential and commercial solar power systems.
For this project, develop and analyze the energy profile for a typical residential home in Southern California.
The goal of this project is to estimate the daily energy production over a week of a typical residential solar panel, compare it to the energy usage of a home and determine how many solar panels are required to fulfill the energy needs of the residence.
Use octave-online to create a script to answer (code) the following questions. Also, comment on each line of code
Write a function named compute energy that takes in as input the number of panels and computes the amount of energy produced in a typical day. The amount of energy produced by a panel depends on the time of day and can be modeled by the mathematical formula below, where t is an array of values from 1 to 24 hours.
After your computeEnergy function calculates how much energy is produced per day, it should call another user-defined function named weatherVariance. The weatherVariance function should create a 24×7 dimension matrix of random numbers between .8 and 1. This represents 24 hours of varying weather conditions that affect the solar production of the panel for seven days. Using matrix multiplication with the appropriate dimensions, (you will need to create another 24×7 matrix containing a week’s worth of daily energy production), multiply the energy production by the weather variance matrix element-wise to simulate weather.
The data for the weekly energy usage by the home is provided in the zip file below ( unzip it to use it). (we will use this see if we produce enough energy). In your main function, define a variable to store the number of solar panels. Keep track of the total energy produced by the solar panel(s) in a week, starting with one panel. After the week, if the generated solar energy is less than the energy usage of the home, then increase the number of panels by one, run the compute energy function again, compare with the energy used and decide if more panels need to be added. This should be done in a while loop. The usage data is formatted in a 24×7 dimension matrix, corresponding to seven days worth of 24 hours of hourly energy use in kilo-Watt-hours.
Produce a 4×2 subplot of solar energy produced and used per day for the week. The eighth plot should be the daily difference between the energy produced and energy used for the week. Label all plots appropriately.
Report to the user how many panels are required to fulfill the energy needs for the home.
comment on each code (what does each line do).
Sample Solution