Saya memiliki skrip matlab yang menghitung beban termal per jam dari trailer transportasi berpendingin selama sehari. Suhu ambien yang digunakan adalah larik data suhu per jam untuk tahun tertentu, dengan demikian 8760x1 elemen. Saya ingin membuat for loop atau semacam iterasi yang mengambil setiap data 24 jam dari array temp ambient, jadi 1:24, 25:48, dll; melakukan perhitungan dan menyimpannya dalam matriks. Jadi akhirnya akan menghasilkan 24x365.

clc; clear; close all;
%%
load('Heerlen_TMY');  
T_out = T2m(1:24);
T_in = zeros(length(T_out),1);
% T_in(:,1) = -18;
T_in(:,1) = 3;
% T_out(:,1) = 33;
RH = RH(1:24);

dT = (T_out - T_in);
%% Parameters
l_i = 13.36; w_i = 2.50; h_i = 2.50; % Trailer internal parameters
l_e = 13.54; w_e = 2.60; h_e = 2.75; % Trailer external parameters

m = zeros(length(T_out),1);    %Initializing cargo mass
m_c = 20.0*1e3;         % Total cargo mass[kg]
m_c = [m_c 0.87*m_c 0.75*m_c 0.62*m_c 0.5*m_c 0.37*m_c 0.25*m_c 0.12*m_c];
Delivery = [6 8 10 12 14 16 18 20]; % Delivery time during 24-hr period
On_road = [7 9 11 13 15 17 19 21];  % Driving times in a 24-hr period
m(Delivery)= m_c;   % For product load during delivery
m(On_road) = m_c;   % For calculating product load on road

%% Transmission load
K = 0.6; %0.4; %Overall heat transfer coefficient
S_i = ((l_i*w_i)+(l_i*h_i)+(w_i*h_i))*2; % Inner surface area;
S_e = ((l_e*w_e)+(l_e*h_e)+(w_e*h_e))*2; % Outer surface area;
S = sqrt(S_i*S_e);
deltaT = zeros(length(T_out),1);
deltaT(5) = dT(5);
deltaT(Delivery)= dT(Delivery);   % For product load during delivery
deltaT(On_road) = dT(On_road);
Q_tr = K*S*deltaT.*1e-3;
Q_tr = abs(Q_tr)*1.23;

figure(1)
plot(Q_tr)
%% Precooling
V_a = l_i*w_i*h_i;    % Volume payload [m^3]
rho_a = 1.27;         % Density of air at 0 degrees [kg/m^3]
c_a = 1.005;          % specific heat of air [kJ/kg/K]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Assuming initial temperature inside trailer = ambient temperature
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PreC = zeros(length(T_out),1); % Initializing precooling load
P = 3600;   % Precooling duration
PreC(5) = P;
% Q_pre = (c_pt*V_pt*rho_pt + V_a*rho_a*c_a)*dT.*PreC./(3600*24);
Q_pre = (V_a*rho_a*c_a)*dT.*PreC./(3600);
figure(2); plot(Q_pre)
%% Product load
T1 = zeros(length(T_out),1); 
T1(:,1) = 5;        % Initial loading temperature of product
dT_pro = T1 - T_in;
h_r = 14.67;        % heat of respiration [mW/kg]
c_l = 3.81;         % Specific heat of dry drugs [kJ/kgK]
Q_pull = m.*c_l.*dT_pro; % loaded products to be cooled to setpoint temp
Q_resp = (h_r*m)./(1e6); % Load caused by chilled perishable products
Q_pro = Q_resp + (abs(Q_pull)./(3600*(length(Delivery)+length(On_road)+1)));

%% Infiltration load
W_d = 2.50;       % Door width
H_d = 2.69;       % Door height
D = [300 180];   % Loading and delivery duration
Theta_o = zeros(24,1);
Theta_o(Delivery) = D(2);
Theta_o(Delivery(1)) = D(1);
Theta_d = [1 0.25 0.5];
E = 0;              % Effectiveness of doorway protective device
D_t = Theta_o/(3600* Theta_d(1));
%%%----------------------------------------------------
% Calculate sensible heat ratio Rs
%%%----------------------------------------------------
h = zeros(length(T_out),2);
y = h;
for k=1:numel(RH)
    y(k,1) = Psychrometricsnew('phi',RH(k),'Tdb',T_out(k));
    y(k,2) = Psychrometricsnew('phi',90,'Tdb',T_in(k));
end

%% Infiltration load - Method 1
D_f = zeros(length(T_in),1);
for n = 1:length(T_in)
    if dT(n) >= 11
        D_f1 = 0.5;
    else
        D_f1 = 0.8;
    end
D_f(n)= D_f1;
%     disp(D_f1)
end
%%%----------------------------------------------------
% Estimate sensible heat load of infiltration Qs/Ad
%%%----------------------------------------------------
Q_s = 4.5; 
R_s = c_a*dT./((y(:,1) - y(:,2)).*1e-3);
q = 0.577*W_d*H_d^(1.5)*Q_s*(1./R_s);
% 
Q_inf = q.*D_t.*D_f.*(1-E);

%% Method 2
rho_o = 1.205; rho_i = 1.275;
g = 9.81;
Enth = ((y(:,1) - y(:,2))./1e3);
Fm = (2/(1+(rho_i/rho_o)^(1/3)))^(1.5);
Q_inf_ = 0.221*W_d*H_d*rho_i*sqrt(1-(rho_o/rho_i))*...
    sqrt(g*H_d)*Fm*(1-E);
Q_inf_1 = Q_inf_.*Enth.*D_f.*D_t;

%% Total load
% Q_pro = 0; %Q_inf = 0;
% Safety factor of 20% to account for 
Q_tot = (Q_tr + Q_pre*1e-3 + Q_pro + Q_inf)*1.2;
Q_tot_1 = (Q_tr + Q_pre*1e-3 + Q_pro + Q_inf_1)*1.2;
% Q_tot = Q_tot*0.9;
figure()
plot(Q_tot)
hold on
plot(Q_tot_1)
-1
Joe 4 April 2021, 07:30

1 menjawab

Jawaban Terbaik

Seperti yang disarankan mimocha di komentar, Anda hanya ingin membentuk kembali matriks 8760x1 suhu per jam Anda menjadi matriks 24x365, di mana setiap kolom berisi data untuk satu hari dan setiap baris berisi data untuk setiap jam dalam hari itu.

Ini dilakukan oleh

A = reshape(input, [24, 465]);

Di mana input adalah matriks 8760x1 Anda dan A adalah array yang dibentuk ulang dengan ukuran 24x365.

0
Brosch 5 April 2021, 10:28