%% estimatePanelOutput Function
%% Overview
% The estimatePanelOutput function estimates the power output from a typical solar panel installation based on location, panel size, and panel efficiency.
% The function uses this formula to calculate the solar declination:
% \alpha =\sin^{-1} \;\left(\sin \left(23\ldotp 45\right)\sin \left(\frac{360}{365}\left(d-81\right)\right)\right)
% and this formula to calculate the solar elevation:
% \alpha =\sin^{-1} \;\left(\sin \;\delta \;\sin \;\phi +\cos \;\delta \;\cos \;\phi \;\cos \;\omega \right)
% The function calls two additional MATLAB functions, solarCorrection and hourlyPanelRadiation.
%
%% Examples
%% Estimate Panel Output with Standard Efficiency
% Call the estimatePanelOutput function with the panel size, specified in m^2. Since no efficiency value is specified, calculatePanelOuput uses the default efficiency value of 25%.
% Specify the latitude, longitude, and UTC offset for the location of your panels, as well as the size of your panels in m^2.

longitude = -71.06;                              
latitude = 42.36;                                                         
UTCoffset = '-5';                                
pSize = 10;                         

% Calculate the expected electrical output of the panel.

panelOutput = estimatePanelOutput(longitude, latitude, UTCoffset, pSize);
disp(['Expected electrical output = ' num2str(panelOutput) ' kW'])