Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function [therm_eff, net_power, bwr, Wt, Wc, Q_in, Q_out, pr1, pr2, pr3, pr4, h1, h2, h3, h4] = function_1(pr_in, t_in)
- pkg load io;
- data = xlsread('Air properties.xlsx');
- temp = data(:,1);
- h = data(:,2);
- pr = data(:,3);
- u = data(:,4);
- vr = data(:,5);
- s = data(:,6);
- % given data:
- p_ratio1 = 10;
- p_ratio2 = 0.1;
- t3 = 1400;
- flowrate = 5;
- % finding h1
- h1 = interp1(temp, h, t_in);
- % finding h2
- pr1 = interp1(temp, pr, t_in);
- pr2 = pr1 * p_ratio1;
- h2 = interp1(pr, h, pr2);
- % finding h3
- index2 = find(temp == t3);
- h3 = h(index2);
- % finding h4
- pr3 = pr(index2);
- pr4 = pr3 * p_ratio2;
- h4 = interp1(pr, h, pr4);
- % finding the thermal efficiency
- therm_eff = 0;
- for jj = 1:numel(h1)
- therm_eff(jj) = ((h3 - h4) - (h2(jj) - h1(jj)))/(h3 - h2(jj));
- end
- % back work ratio
- bwr = (h2 - h1)/(h3 - h4);
- % Net power in KW
- m_dot = 0;
- for jj = 1:numel(pr_in)
- m_dot(jj) = ((flowrate * (pr_in(jj)) * (10^3))/((8.314/28.97) * t_in(jj))) * (1/10^3);
- net_power(jj) = m_dot(jj) * ((h3 - h4) - (h2(jj) - h1(jj)));
- end
- Wt = m_dot * (h3 - h4);
- for jj = 1:numel(h1)
- Wc(jj) = m_dot(jj) * (h2(jj) - h1(jj));
- Q_in(jj) = m_dot(jj) * (h3 - h2(jj));
- Q_out(jj) = m_dot(jj) * (h4 - h1(jj));
- endfor
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement