-
Notifications
You must be signed in to change notification settings - Fork 0
/
mysteamclass.cpp
228 lines (163 loc) · 6.46 KB
/
mysteamclass.cpp
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
#include "mysteamclass.h"
#include <QQmlComponent>
#include <QQmlProperty>
MySteamClass::MySteamClass(QObject *parent) : QObject(parent)
{
}
void MySteamClass::setState_PressureTemperature(double pres, double temp){
pressure = pres ; temperature = temp;
state = freesteam_set_pT(pres, temp);
specificEnthalpy = freesteam_h(state); //set the properties
specificInternalEnergy = freesteam_u(state);
specificVolume = freesteam_v(state);
specificEntropy = freesteam_s(state);
density= freesteam_rho(state);
heatCapacity_Cp=freesteam_cp(state);
heatCapacity_Cv= freesteam_cv(state);
quality= freesteam_x(state);
thermalConductivity= freesteam_k(state);
viscosity= freesteam_mu(state);
}
void MySteamClass::setState_PressureSpecificInternalEnergy(double pres, double intEn){
pressure = pres; specificInternalEnergy = intEn;
state =freesteam_set_ps(pres,intEn);
specificEnthalpy = freesteam_h(state); //set the properties
temperature = freesteam_T(state);
specificEntropy = freesteam_s(state);
specificVolume = freesteam_v(state);
density= freesteam_rho(state);
heatCapacity_Cp=freesteam_cp(state);
heatCapacity_Cv= freesteam_cv(state);
quality= freesteam_x(state);
thermalConductivity= freesteam_k(state);
viscosity= freesteam_mu(state);
}
void MySteamClass::setState_PressureSpecificEntropy(double pres, double entrop){
pressure = pres; specificEntropy = entrop;
state = freesteam_set_ps(pressure, specificEntropy);
specificInternalEnergy = freesteam_u(state);
specificEnthalpy = freesteam_h(state);
temperature = freesteam_T(state);
specificVolume = freesteam_v(state);
density= freesteam_rho(state);
heatCapacity_Cp=freesteam_cp(state);
heatCapacity_Cv= freesteam_cv(state);
quality= freesteam_x(state);
thermalConductivity= freesteam_k(state);
viscosity= freesteam_mu(state);
}
void MySteamClass::setState_PressureSpecificEnthalpy(double pres, double enthalp){
pressure = pres; specificEnthalpy = enthalp;
state = freesteam_set_ph(pres, enthalp);
temperature = freesteam_T(state);
specificInternalEnergy = freesteam_u(state);
specificVolume = freesteam_v(state);
specificEntropy = freesteam_s(state);
density= freesteam_rho(state);
heatCapacity_Cp=freesteam_cp(state);
heatCapacity_Cv= freesteam_cv(state);
quality= freesteam_x(state);
thermalConductivity= freesteam_k(state);
viscosity= freesteam_mu(state);
}
void MySteamClass::setState_PressureSpecificVolume(double pres, double vol){
pressure = pres; specificVolume = vol;
state = freesteam_set_pv(pressure,specificVolume);
specificEnthalpy = freesteam_h(state); //set the properties
specificInternalEnergy = freesteam_u(state);
temperature = freesteam_T(state);
specificEntropy = freesteam_s(state);
density= freesteam_rho(state);
heatCapacity_Cp=freesteam_cp(state);
heatCapacity_Cv= freesteam_cv(state);
quality= freesteam_x(state);
thermalConductivity= freesteam_k(state);
viscosity= freesteam_mu(state);
}
void MySteamClass::setState_TemperatureSpecificEntropy(double temp, double entrop){
temperature = temp; specificEntropy = entrop;
state = freesteam_set_Ts(temperature, specificEntropy);
pressure = freesteam_p(state);
specificEnthalpy = freesteam_h(state); //set the properties
specificInternalEnergy = freesteam_u(state);
specificVolume = freesteam_v(state);
density= freesteam_rho(state);
heatCapacity_Cp=freesteam_cp(state);
heatCapacity_Cv= freesteam_cv(state);
quality= freesteam_x(state);
thermalConductivity= freesteam_k(state);
viscosity= freesteam_mu(state);
}
void MySteamClass::setState_TemperatureQuality(double temp, double qual){
temperature = temp; quality = qual;
state = freesteam_set_Tx(temp, qual);
pressure = freesteam_p(state);
specificEnthalpy = freesteam_h(state); //set the properties
specificInternalEnergy = freesteam_u(state);
specificVolume = freesteam_v(state);
density= freesteam_rho(state);
heatCapacity_Cp=freesteam_cp(state);
heatCapacity_Cv= freesteam_cv(state);
thermalConductivity= freesteam_k(state);
specificEntropy = freesteam_s(state);
viscosity= freesteam_mu(state);
}
void MySteamClass::setState_PressureQuality(double pres, double qual){
pressure = pres; quality = qual;
pres = freesteam_region4_Tsat_p (pres);
state = freesteam_set_Tx(pres, qual);
specificEnthalpy = freesteam_h(state); //set the properties
specificInternalEnergy = freesteam_u(state);
specificVolume = freesteam_v(state);
density= freesteam_rho(state);
heatCapacity_Cp=freesteam_cp(state);
heatCapacity_Cv= freesteam_cv(state);
thermalConductivity= freesteam_k(state);
specificEntropy = freesteam_s(state);
viscosity= freesteam_mu(state);
temperature = freesteam_T(state);
}
//-----------GETTERS----------\\
double MySteamClass::getSpecificEnthalpy(bool addKilo){
if(addKilo == true){return specificEnthalpy/1000; }
else { return specificEnthalpy; }
}
double MySteamClass::getSpecificEntropy(bool addKilo){
if(addKilo == true){ return specificEntropy/1000; }
else { return specificEntropy; }
}
double MySteamClass::getInternalEnergy(bool addKilo){
if(addKilo == true){ return specificInternalEnergy/1000;}
else {return specificInternalEnergy; }
}
double MySteamClass::getSpecificVolume( /*bool addKilo*/){
// if(addKilo == true){ return specificVolume/1000; }
return specificVolume;
}
double MySteamClass::getHeatCapacity_Cp(bool addKilo){
if(addKilo == true){ return heatCapacity_Cp/1000; }
else {return heatCapacity_Cp; }
}
double MySteamClass::getHeatCapacity_Cv(bool addKilo){
if(addKilo == true){ return heatCapacity_Cv/1000; }
else {return heatCapacity_Cv; }
}
double MySteamClass::getQuality(){
return quality;
}
double MySteamClass::getThermalConductivity(){
return thermalConductivity;
}
double MySteamClass::getViscosity(){
return viscosity;
}
double MySteamClass::getDensity(){
return density;
}
double MySteamClass::getTemperature(){
return temperature;
}
double MySteamClass::getPressure(bool addKilo){
if(addKilo == true){ return pressure/1000; }
else {return pressure; }
}