Skip to content

Instantly share code, notes, and snippets.

@hmurraydavis
Last active August 29, 2015 13:58
Show Gist options
  • Save hmurraydavis/10338591 to your computer and use it in GitHub Desktop.
Save hmurraydavis/10338591 to your computer and use it in GitHub Desktop.
Thermo WAH 10 -- simulating a inner-vascular cooling system
%% Prepare environment
clear all; clc; clear figure;
%initialize vecctors for plotting:
Tgraph=[];
Wgraph=[];
%cycle through temperature range:
for T1=273.6:340.6
Tgraph=[Tgraph,T1];
%mdot=9.246e-4; %kg/s, leftover from modular testing!
%T1=0+273.6; %K , leftover from modular testing!
P1=.2928*1000; %kPa
fluid='R134A.fld'; %refrigerent is R134A
%% State 1:
h1=refpropm('H','T',T1,'P',P1,fluid); %J/kg % enthalphy, state 1 calculation with P1 and T1
disp(['enthalphyH1 = ',num2str(h1/1000),'kJ/kg'])
s1=refpropm('S','T',T1,'P',P1,fluid); % entropy
disp(['entropyS1 = ',num2str(s1/1000),'kJ/(kg K)'])
%% State 2:
s2=s1;
P3=.64578*1000; %kPa
P2=P3;
h2=refpropm('H','P',P2,'S',s2, fluid); %J/kg % entropy
disp(['enthalphyH2 = ',num2str(h2/1000),'kJ/kg'])
%% State 3:
T3=24+273.6; %K
h3=refpropm('H','T',T3,'Q',0,fluid); %J/kg
quality3=refpropm('Q','T',T3,'P',P2,fluid); %phase, to check that we're in the right region
disp(['enthalphyH3 = ',num2str(h3/1000),'kJ/kg'])
%%State 4:
h4=h3;
%calculations:
qd14=.153*1000; %W, taken from the 2 K/hr figure published
mdot=qd14/(h1-h4); %calculate mdot
work=mdot*(h1-h2); %(kg/s)*(J/kg), calculate compressor work
Wgraph=[Wgraph,work];
end
%% plot results:
plot(Tgraph,Wgraph, 'r-*', 'LineWidth', 2.5)
title('Evaporator Intake Temperature Effect on Work Produced by Intravascular Cooling Compressor','FontSize',20)
xlabel('Evaporator Intake Temperature (K)', 'FontSize',16)
ylabel('Compressor Work (Watts)', 'FontSize',16)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment