Borrar filtros
Borrar filtros

can someone assist I am struggling to convert the DHI DNI and GHI from W/m^2 to kWh/m^2

10 visualizaciones (últimos 30 días)
% solar irradiation on a HORIZONTAL SURFACE
Cn = 0.7; % Clearance index
I0 = 1353; % Solar constant
latitude = -34.005133; % Latitude of the location
days =1; % Number of days in the month
hours = 24; % Number of hours in a day
% Initialize matrices to store results
dec_deg = zeros(days, 1); % Declination angles in degrees
DNI = zeros(days, hours); % Direct Normal Irradiation
DHI = zeros(days, hours); % Diffuse Horizontal Irradiance
GHI = zeros(days, hours); % Global Horizontal Irradiance
for n = 1:days
% Calculate declination angle for the day (in degrees)
dec_deg(n) = 23.45 * sind((360/365) * (n + 284));
% Convert declination angle from degrees to radians
dec_rad = deg2rad(dec_deg(n));
for time = 1:hours
% Calculate hour angle
h = (12 - time) * 15; % Hour angle in degrees
h_rad = deg2rad(h); % Hour angle in radians
% Calculate diffuse factor (Cs)
Cs = 0.095 + 0.04 * sin(deg2rad(360/365) * (n - 100));
% Calculate extraterrestrial solar irradiation (I)
I = I0 * (1 + 0.034 * cos(deg2rad(360 * n / 365.25)));
% Calculate atmospheric optical depth (k)
k = 0.174 + 0.035 * sin(deg2rad((360/365) * (n - 100)));
% Calculate solar altitude angle (alt)
Lat = deg2rad(latitude); % Latitude angle in radians
alt = asin(cos(Lat) * cos(dec_rad) * cos(h_rad) + (sin(Lat) * sin(dec_rad)));
alt_deg = rad2deg(alt); % Daily Solar Altitude Angle
% Ensure the solar altitude angle is non-negative
if alt_deg < 0
alt_deg = 0;
end
% Calculate air mass (AM)
AM = 1 / sin(deg2rad(alt_deg)); % Air Mass
% Calculate Direct Normal Irradiation (DNI) for the current hour
DNI(n, time) = Cn * I * exp(-k * AM);
% Calculate Diffuse Horizontal Irradiance (DHI) for the current hour
DHI(n, time) = Cs * DNI(n, time);
% Calculate Global Horizontal Irradiance (GHI) for the current hour
GHI(n, time) = (DNI(n, time) + DHI(n, time)) ; % Convert to W/m^2
end
end
% Display matrices
disp("Direct Normal Irradiation (DNI) for 1 day (24 hours each): ");
disp(DNI)
disp("Diffuse Horizontal Irradiance (DHI) for 1 day (24 hours each): ");
disp(DHI)
disp("Global Horizontal Irradiance (GHI) for 1 day (24 hours each): ");
disp(GHI)
% Sum up the values in DNI and DHI matrices (which are 1x1 matrices)
sum_DNI = sum(DNI(:))
sum_DHI = sum(DHI(:))
GHI_per_year = (sum_DNI + sum_DHI)

Respuestas (1)

VBBV
VBBV el 14 de Mzo. de 2024
% solar irradiation on a HORIZONTAL SURFACE
Cn = 0.7; % Clearance index
I0 = 1353; % Solar constant
latitude = -34.005133; % Latitude of the location
days =1; % Number of days in the month
hours = 24; % Number of hours in a day
% Initialize matrices to store results
dec_deg = zeros(days, 1); % Declination angles in degrees
DNI = zeros(days, hours); % Direct Normal Irradiation
DHI = zeros(days, hours); % Diffuse Horizontal Irradiance
GHI = zeros(days, hours); % Global Horizontal Irradiance
for n = 1:days
% Calculate declination angle for the day (in degrees)
dec_deg(n) = 23.45 * sind((360/365) * (n + 284));
% Convert declination angle from degrees to radians
dec_rad = deg2rad(dec_deg(n));
for time = 1:hours
% Calculate hour angle
h = (12 - time) * 15; % Hour angle in degrees
h_rad = deg2rad(h); % Hour angle in radians
% Calculate diffuse factor (Cs)
Cs = 0.095 + 0.04 * sin(deg2rad(360/365) * (n - 100));
% Calculate extraterrestrial solar irradiation (I)
I = I0 * (1 + 0.034 * cos(deg2rad(360 * n / 365.25)));
% Calculate atmospheric optical depth (k)
k = 0.174 + 0.035 * sin(deg2rad((360/365) * (n - 100)));
% Calculate solar altitude angle (alt)
Lat = deg2rad(latitude); % Latitude angle in radians
alt = asin(cos(Lat) * cos(dec_rad) * cos(h_rad) + (sin(Lat) * sin(dec_rad)));
alt_deg = rad2deg(alt); % Daily Solar Altitude Angle
% Ensure the solar altitude angle is non-negative
if alt_deg < 0
alt_deg = 0;
end
% Calculate air mass (AM)
AM = 1 / sin(deg2rad(alt_deg)); % Air Mass
% Calculate Direct Normal Irradiation (DNI) for the current hour
DNI(n, time) = Cn * I * exp(-k * AM);
% Calculate Diffuse Horizontal Irradiance (DHI) for the current hour
DHI(n, time) = Cs * DNI(n, time);
% Calculate Global Horizontal Irradiance (GHI) for the current hour
GHI(n, time) = (DNI(n, time) + DHI(n, time)) ; % Convert to W/m^2
end
end
% Display matrices
disp("Direct Normal Irradiation (DNI) for 1 day (24 hours each): ");
Direct Normal Irradiation (DNI) for 1 day (24 hours each):
disp(DNI)
Columns 1 through 18 0 0 0 0 1.3470 517.8201 700.6739 776.4273 814.9176 835.8280 846.4561 849.7305 846.4561 835.8280 814.9176 776.4273 700.6739 517.8201 Columns 19 through 24 1.3470 0 0 0 0 0
disp("Diffuse Horizontal Irradiance (DHI) for 1 day (24 hours each): ");
Diffuse Horizontal Irradiance (DHI) for 1 day (24 hours each):
disp(DHI)
Columns 1 through 18 0 0 0 0 0.0746 28.6642 38.7861 42.9795 45.1101 46.2676 46.8559 47.0372 46.8559 46.2676 45.1101 42.9795 38.7861 28.6642 Columns 19 through 24 0.0746 0 0 0 0 0
disp("Global Horizontal Irradiance (GHI) for 1 day (24 hours each): ");
Global Horizontal Irradiance (GHI) for 1 day (24 hours each):
disp(GHI)
Columns 1 through 18 0 0 0 0 1.4216 546.4842 739.4600 819.4068 860.0277 882.0956 893.3120 896.7677 893.3120 882.0956 860.0277 819.4068 739.4600 546.4842 Columns 19 through 24 1.4216 0 0 0 0 0
% Sum up the values in DNI and DHI matrices (which are 1x1 matrices)
sum_DNI = sum(DNI(:))/(24*1000) % in kWh/m^2
sum_DNI = 0.4099
sum_DHI = sum(DHI(:))/(24*1000) % in kWh/m^2
sum_DHI = 0.0227
GHI_per_year = (sum_DNI + sum_DHI)% in kWh/m^2
GHI_per_year = 0.4325

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by