use xsteam for matlab
24 views (last 30 days)
Show older comments

I would like to run this code with the following input please read problem statement above
%% Input
T2 = 100; % oC Input Turbine exit temperature T2=T3
p2 = XSteam('psat_T', T2);
T1 = 400; % oC Input is Turbien inlet temperatre T1
%% Required:
% Simulate the effect of boiler pressure on Rankine Cycle
%% Solution
for i = 1:10
p1 = i*50; %bar
h1 = XSteam('h_pT',p1,T1); %kJ/kg pressure in bar, T in C, h in J/kg
s1 = XSteam('S_pT',p1,T1);
s2 = s1; %isentropic turbine
h2 = XSteam('h_ps',p2,s2); % kJ/kg Input Turbine exit is saturated vapor
x2 = XSteam('x_ps',p2,s2);
p3 = p2; % state 3 is saturated liquid)
T3 = T2;
s3 = XSteam('SL_T', T3);
h3 = XSteam('hL_T', T3); %kJ/kg
s4 = s3; % pump is assumed insentropic
p4 = p1;
h4 = XSteam('h_ps', p4, s4); %kJ/kg
wturbine = (h1-h2); %kJ/kg
wpump = (h4-h3); %kJ/kg
wnet = wturbine-wpump; %kJ/kg
qadded = (h1-h4); %kJ/kg
etathermal = wnet/qadded; % calculate efficiency [-]
formatSpec = 'P_Boiler %5.1f MPa, x2 %5.2f, wnet %7.1f[kJ/kg], qadded
%7.1f[kJ/kg], eta %5.2f\n';
fprintf(formatSpec, p1/10, x2, wnet, qadded, etathermal)
end
1 Comment
Steven Lord
on 3 Sep 2022
You have not stated what difficulty you're experiencing when running that code, nor have you asked a question about it. Please explain what type of help you're looking for with this question.
Answers (0)
See Also
Categories
Find more on Thermal Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!