Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 3.57 KB | None | 0 0
  1. % optimizing the vertical tracking angle beta at 25 degC
  2.  
  3. day_s = [172, 355]; %june and dec 21
  4. sunny_OCI = 0;
  5. lat_pec = 30.2605; %latitude of palmer events center, degrees
  6. temp_panel = 25; %degC, given parameter
  7. gamma_o = 46; %surface azimuth angle, given
  8.  
  9. t_res = 5; %resolution of time, mins
  10. mins_day = 60*24;
  11. time_of_day = 0:t_res:mins_day;
  12.  
  13. days_all = 0:1:365;
  14.  
  15. beta_res = 1; %resolution of inclination, degrees
  16. beta_all = -90:beta_res:90;
  17.  
  18. %irradiance and power vs time of day, december 21
  19.  
  20. %allocating memory to store day's values
  21. time_solar = zeros(1,size(time_of_day, 2));
  22. omega_min = time_solar; %hour angle
  23. theta_z = time_solar; %solar zenith
  24. alpha_z = time_solar; %solar altitude
  25. gamma_s = time_solar; %solar azimuth
  26. theta_i = time_solar; %angle of incidence
  27. tau_b = time_solar; %atmospheric transmittance
  28. i_beam = time_solar; %beam irradiance
  29. i_diffuse = time_solar; %diffuse irradiance
  30.  
  31. irradiance_total = zeros(size(time_of_day,2), size(beta_all,2) );
  32. power_instant = time_solar;
  33.  
  34. % irradiance_max = zeros(size(day_s,1), size(time_of_day, 2));
  35. irradiance_max = time_solar;
  36. beta_optimal = irradiance_max;
  37. power_max = irradiance_max;
  38. % total_energy_day = irradiance_max;
  39. total_energy_day = zeros(1,365);
  40.  
  41. for n = 1:365
  42. % n = day_s(2)
  43.     delta = declination(n);
  44.     for k = 1:size(time_of_day, 2)
  45.         for m = 1:size(beta_all,2)-1
  46.             time_solar(k) = solar_time(time_of_day(k), day_s(2)); %calculate solar time
  47.             omega_min(k) = hour_angle(time_of_day(k));
  48.             theta_z(k) = solar_zenith(delta, lat_pec, omega_min(k));
  49.             alpha_z(k) = asind(cosd(theta_z(k)));
  50.             gamma_s(k) = solar_azimuth(delta, omega_min(k), alpha_z(k));
  51.             theta_i(k) = incidence(alpha_z(k), beta_all(m), gamma_o, gamma_s(k));
  52.             tau_b(k) = atmospheric_transmittance(alpha_z(k));
  53.             i_beam(k) = beam_irradiance(n, theta_i(k), tau_b(k));
  54.             i_diffuse(k) = diffuse_irradiance(n, theta_z(k), tau_b(k), beta_all(m));
  55.             irradiance_total(k,m) = i_beam(k) + i_diffuse(k);
  56.             % power_instant(k) = calculate_power(irradiance_total(k), temp_panel); %power produced at 25 degC
  57.         end
  58.     end
  59.  
  60.     [irradiance_max, beta_optimal] = max(irradiance_total, [], 2);      
  61.     power_max = calculate_power(irradiance_max, temp_panel);
  62.     total_energy_day(n) = trapz(time_of_day, power_max) / (60*10000000);
  63. end
  64.  
  65. total_energy_yearly = sum(total_energy_day);
  66.  
  67. % figure(1) % n = 2
  68. % yyaxis left
  69. % plot(time_of_day/60, power_max/10000)
  70. % title('Optimized Vertical Tracking, Dec 21 @ 25 degC')
  71. % xlabel('Time of Day (hours)')
  72. % ylabel('Maximum System Power Delivery (kW)')
  73.  
  74. % yyaxis right
  75. % plot(time_of_day/60, irradiance_max)
  76. % ylabel('Maximum Irradiance (W/m^2)')
  77.  
  78. % figure(2)
  79. % yyaxis left
  80. % plot(time_of_day/60, power_max/10000)
  81. % title('Optimized Vertical Tracking, Jun 21 @ 25 degC')
  82. % xlabel('Time of Day (hours)')
  83. % ylabel('Maximum System Power Delivery (kW)')
  84.  
  85. % yyaxis right
  86. % plot(time_of_day/60, irradiance_max)
  87. % ylabel('Maximum Irradiance (W/m^2)')
  88.  
  89. % figure(3)
  90. % yyaxis left
  91. % plot(time_of_day/60, beta_optimal - 90)
  92. % title('Optimized Panel Angle with Horizontal, Jun 21')
  93. % xlabel('Time of Day (hours)')
  94. % ylabel('Tilt Angle \beta (deg)')
  95.  
  96. % yyaxis right
  97. % plot(time_of_day/60, power_max/10000)
  98. % ylabel('Maximum System Power Delivery (kW)')
  99.  
  100. % figure(4)
  101. % plot(1:365, total_energy_day)
  102. % title('Yearly Maximum Energy Production with Vertical Tracking')
  103. % xlabel('Days of the Year')
  104. % ylabel('Total Daily Energy Production (MWh)')
  105. % % ylim([0 1])
  106. % xlim([0 365])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement