-
Notifications
You must be signed in to change notification settings - Fork 5
/
HGSsingle.m
122 lines (105 loc) · 2.65 KB
/
HGSsingle.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
function [Res] = HGSsingle(species,property,T,P)
%**************************************************************************
%
% [Res] = HGSsingle(species,property,T,P)
%
%**************************************************************************
%
% HGSsingle returns the property of a species
%
%**************************************************************************
% Inputs:
%--------------------------------------------------------------------------
% species --> String or numbers of species
% property --> Property requested (see below)
% T --> [K] Temperature
% P --> [bar] Pressure
%
% Outputs:
%--------------------------------------------------------------------------
% Res --> Property result
% Mm [g/mol]
% cp [kJ/(mol*K)]
% cv [kJ/(mol*K)]
% h [kJ/mol]
% s [kJ/(mol*K)]
% g [kJ/mol]
%
%**************************************************************************
% *HGS 2.1
% *By Caleb Fuster, Manel Soria and Arnau Miró
% *ESEIAAT UPC
code = zeros(7,1);
% code: (num)- Property (need to be calculated before)
% (1) - Molar mass ()
% (2) - cp (7- Burcat)
% (3) - cv (7- Burcat & 2- Cp)
% (4) - h (7- Burcats)
% (5) - s (7- Burcats)
% (6) - g (7- Burcats & 4- H & 5- S)
% (7) - Burcat Coef ()
switch property
case 'Mm'
code(1) = 1;
case 'cp'
code(2) = 1;
code(7) = 1;
case 'cv'
code(2:3) = 1;
code(7) = 1;
case 'h'
code(4) = 1;
code(7) = 1;
case 's'
code(5) = 1;
code(7) = 1;
case 'g'
code(4:7) = 1;
otherwise
error('Unknown property %s ',property);
end
id = HGSid(species);
global HGSdata;
HGSload;
%% Burcat coefficients
if code(7)
if T < HGSdata.lim(id,1) || T > HGSdata.lim(id,3)
lim(1,1) = HGSdata.lim(id,1);
lim(1,3) = HGSdata.lim(id,3);
name = species;
error('HGSsingle: Ups... Temperature is not between the limits (%.2fK-%.2fK) for %s',lim(1,1),lim(1,3),name)
end
if T <= HGSdata.lim(id,2)
a(1,:) = HGSdata.LV(id,:);
else
a(1,:) = HGSdata.HV(id,:);
end
end
%% Molar Mass
if code(1)
Res = HGSdata.Mm(id);
end
%% Cp
if code(2)
[cp] = HGScp(a,T);
Res = cp;
end
%% Cv
if code(3)
[Res] = HGScv(cp);
end
%% H
if code(4)
[h] = HGSh(a,T);
Res = h;
end
%% S
if code(5)
[s] = HGSs(a,T,P,HGSdata.state{id});
Res = s;
end
%% G
if code(6)
[Res] = HGSg(s,h,T);
end
end