-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvcc_input.py
283 lines (223 loc) · 12.5 KB
/
vcc_input.py
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
__author__ = 'Peter Eriksson @ KTH 2015'
import openpyxl
import xlrd
import numpy
import os
# Description:
# This file handles the inputs as well as hard coded parameters
# Constants
k = 273.15
def refrigerant(name):
# Refrigerant data
refrigerant_data = numpy.zeros(5, dtype=numpy.object)
# Defined since predefined mixtures did not want to run under Mac...
if name.find('R404A') > -1:
refrigerant_data[0] = 'R404A'
refrigerant_data[1] = 'REFPROP'
refrigerant_data[2] = 'R125&R134A&R143A'
refrigerant_data[3] = (0.357816784026318, 0.0382639950410712, 0.603919220932611)
refrigerant_data[4] = 'REFPROP::R125[0.357816784026318]&R134A[0.0382639950410712]&R143A[0.603919220932611]'
elif name.find('R448A') > -1:
refrigerant_data[0] = 'R448A'
refrigerant_data[1] = 'REFPROP'
refrigerant_data[2] = 'R32&R125&R1234YF&R134A&R1234ZE'
refrigerant_data[3] = (0.431218201988559, 0.186914131481992, 0.151319256485899, 0.177586673617217, 0.0529617364263329)
refrigerant_data[4] = 'REFPROP::R32[0.431218201988559]&R125[0.186914131481992]&R1234YF[0.151319256485899]&R134A[0.177586673617217]&R1234ZE[0.0529617364263329]'
elif name.find('R449A') > -1:
refrigerant_data[0] = 'R449A'
refrigerant_data[1] = 'REFPROP'
refrigerant_data[2] = 'R32&R125&R1234YF&R134A'
refrigerant_data[3] = (0.407364566995509, 0.179481207732065, 0.193480840388364, 0.219673384884062)
refrigerant_data[4] = 'REFPROP::R32[0.407364566995509]&R125[0.179481207732065]&R1234YF[0.193480840388364]&R134A[0.219673384884062]'
elif name.find('R407F') > -1:
refrigerant_data[0] = 'R407F'
refrigerant_data[1] = 'REFPROP'
refrigerant_data[2] = 'R32&R125&R134A'
refrigerant_data[3] = (0.473194694453358, 0.205109095413331, 0.321696210133311)
refrigerant_data[4] = 'REFPROP::R32[0.473194694453358]&R125[0.205109095413331]&R134A[0.321696210133311]'
else:
refrigerant_data[0] = name
refrigerant_data[1] = 'REFPROP'
refrigerant_data[2] = name
refrigerant_data[3] = [1.0]
refrigerant_data[4] = 'REFPROP::' + name
return refrigerant_data
# Sandbox input data
def manual():
input_data = {}
# Evaporator
input_data["ev_temperature"] = -40 + k # [C] Evaporator temperature
input_data["ev_super_heat"] = 7 # [K] Evaporator outlet super heating
#input_data["ev_super_heat"] = 8.8 # [K] Evaporator outlet super heating
input_data["ev_pressure_drop"] = 0e3 # [Pa] Evaporator pressure drop
# Suction line
input_data["sl_temperature_change"] = 0 # [K] Superheat (Suction line)
input_data["sl_pressure_drop"] = 0e3 # [Pa] Suction Line
# Compressor
input_data["capacity_volumetric"] = 1
input_data["efficiency_isentropic"] = 0 # [-] Isentropic Efficiency 0=Bitzer data
input_data["efficiency_volymetric"] = 1 # [-] Volymetric Efficiency
# Discharge line
input_data["dl_temperature_change"] = 0 # [K] Superheat (Suction line)
input_data["dl_pressure_drop"] = 0e3 # [K] Superheat (Suction line)
# Condenser
input_data["co_temperature"] = 35 + k # [C] Temperature
input_data["co_sub_cooling"] = 2 # [K] Outlet super cooling
#input_data["co_sub_cooling"] = 15.6 # [K] Outlet super cooling
input_data["co_pressure_drop"] = 0e3 # [Pa] Pressure drop
# Liquid line
input_data["ll_temperature_change"] = 0 # [K] Superheat (Suction line)
input_data["ll_pressure_drop"] = 0e3 # [K] Superheat (Suction line)
return input_data
# Data from real system
def real_system():
input_data = {}
# Evaporator
input_data["ev_temperature"] = -15.4+ k # [C] Evaporator temperature
input_data["ev_super_heat"] = 2.1 # [K] Evaporator outlet super heating
input_data["ev_pressure_drop"] = 0e3 # [Pa] Evaporator pressure drop
# Suction line
input_data["sl_temperature_change"] = 0 # [K] Superheat (Suction line)
input_data["sl_pressure_drop"] = 0e3 # [Pa] Suction Line
# Compressor
input_data["capacity_volumetric"] = 1
input_data["efficiency_isentropic"] = 0.502 # [-] Isentropic Efficiency 0=Bitzer data
input_data["efficiency_volymetric"] = 1 # [-] Volymetric Efficiency
# Discharge line
input_data["dl_temperature_change"] = 4 # [K] Superheat (Suction line)
input_data["dl_pressure_drop"] = 0e3 # [K] Superheat (Suction line)
# Condenser
input_data["co_temperature"] = 41.8 + k # [C] Temperature
input_data["co_sub_cooling"] = 8.8 # [K] Outlet super cooling
input_data["co_pressure_drop"] = 0e3 # [Pa] Pressure drop
# Liquid line
input_data["ll_temperature_change"] = 0 # [K] Superheat (Suction line)
input_data["ll_pressure_drop"] = 0e3 # [K] Superheat (Suction line)
return input_data
# Data from real system
def real_system2():
input_data = {}
# Evaporator
input_data["ev_temperature"] = -37.4+ k # [C] Evaporator temperature
input_data["ev_super_heat"] = 8.8 # [K] Evaporator outlet super heating
input_data["ev_pressure_drop"] = 0e3 # [Pa] Evaporator pressure drop
# Suction line
input_data["sl_temperature_change"] = 0.3 # [K] Superheat (Suction line)
input_data["sl_pressure_drop"] = 0e3 # [Pa] Suction Line
# Compressor
input_data["capacity_volumetric"] = 1
input_data["efficiency_isentropic"] = 0.555 # [-] Isentropic Efficiency 0=Bitzer data
input_data["efficiency_volymetric"] = 1 # [-] Volymetric Efficiency
# Discharge line
input_data["dl_temperature_change"] = 4.7 # [K] Superheat (Suction line)
input_data["dl_pressure_drop"] = 0e3 # [K] Superheat (Suction line)
# Condenser
input_data["co_temperature"] = 30 + k # [C] Temperature
input_data["co_sub_cooling"] = 15.6 # [K] Outlet super cooling
input_data["co_pressure_drop"] = 0e3 # [Pa] Pressure drop
# Liquid line
input_data["ll_temperature_change"] = 0 # [K] Superheat (Suction line)
input_data["ll_pressure_drop"] = 0e3 # [K] Superheat (Suction line)
return input_data
# Load function for xls files from Genetron
def load(filename):
input_data = {}
if os.path.isfile(os.path.join(os.getcwd(), 'input', filename)):
if filename.split(".")[-1] == 'xls':
workbook = xlrd.open_workbook(os.path.join(os.getcwd(), 'input', filename))
elif filename.split(".")[-1] == 'xlsx':
workbook = openpyxl.open_workbook(os.path.join(os.getcwd(), 'input', filename))
else:
print('Extension of file not allowed')
pass
else:
print('File does not exist')
pass
worksheet = workbook.sheet_by_index(0)
# Refrigerant
input_data["refrigerant"] = worksheet.cell_value(22,3)
# Evaporator
input_data["ev_temperature"] = worksheet.cell_value(5,3) + k # [C] Evaporator temperature
input_data["ev_super_heat"] = worksheet.cell_value(6,3) # [K] Evaporator outlet super heating
input_data["ev_pressure_drop"] = worksheet.cell_value(7,3)*1e3 # [Pa] Evaporator pressure drop
# Suction line
input_data["sl_temperature_change"] = worksheet.cell_value(8,3) # [K] Superheat (Suction line)
input_data["sl_pressure_drop"] = worksheet.cell_value(9,3)*1e3 # [Pa] Suction Line
# Compressor
input_data["capacity_volumetric"] = worksheet.cell_value(10,3) # [-] Isentropic Efficiency
input_data["efficiency_isentropic"] = worksheet.cell_value(11,3) # [-] Isentropic Efficiency
input_data["efficiency_volymetric"] = worksheet.cell_value(12,3) # [-] Volymetric Efficiency
# Discharge line
input_data["dl_temperature_change"] = worksheet.cell_value(13,3) # [K] Superheat (Suction line)
input_data["dl_pressure_drop"] = worksheet.cell_value(14,3)*1e3 # [K] Superheat (Suction line)
# Condenser
input_data["co_temperature"] = worksheet.cell_value(15,3) + k # [C] Temperature
input_data["co_sub_cooling"] = worksheet.cell_value(16,3) # [K] Outlet sub cooling
input_data["co_pressure_drop"] = worksheet.cell_value(17,3)*1e3 # [Pa] Pressure drop
# Liquid line
input_data["ll_temperature_change"] = worksheet.cell_value(18,3) # [K] Superheat (Suction line)
input_data["ll_pressure_drop"] = worksheet.cell_value(19,3)*1e3 # [K] Superheat (Suction line)
return input_data
# Function to import results from Genetron xls export for fast validation of the model coding
def reference(filename):
reference_data = numpy.zeros((10,6), dtype=numpy.float) # Temperature
# Differenft functions depending of version of Excel
if filename.split(".")[-1] == 'xls':
workbook = xlrd.open_workbook(os.path.join(os.getcwd(), 'input', filename))
elif filename.split(".")[-1] == 'xlsx':
workbook = openpyxl.open_workbook(os.path.join(os.getcwd(), 'input', filename))
else:
print('Extension of file not allowed')
pass
# Set working sheet
worksheet = workbook.sheet_by_index(0)
# After suction line/ Before compressor
reference_data[0, 0] = worksheet.cell_value(108,3)+k # Temperature
reference_data[0, 1] = worksheet.cell_value(109,3)*1e3 # Pressure
reference_data[0, 2] = worksheet.cell_value(110,3)*1e3 # Enthalpy
reference_data[0, 3] = worksheet.cell_value(111,3)*1e3 # Entropy
reference_data[0, 4] = worksheet.cell_value(112,3) # Density
# After compressor / Before discharge line
reference_data[1, 0] = worksheet.cell_value(108,4)+k # Temperature
reference_data[1, 1] = worksheet.cell_value(109,4)*1e3 # Pressure
reference_data[1, 2] = worksheet.cell_value(110,4)*1e3 # Enthalpy
reference_data[1, 3] = worksheet.cell_value(111,4)*1e3 # Entropy
reference_data[1, 4] = worksheet.cell_value(112,4) # Density
# After discharge line / Condenser inlet
reference_data[2, 0] = worksheet.cell_value(124,3)+k # Temperature
reference_data[2, 1] = worksheet.cell_value(125,3)*1e3 # Pressure
reference_data[2, 2] = worksheet.cell_value(126,3)*1e3 # Enthalpy
reference_data[2, 3] = worksheet.cell_value(127,3)*1e3 # Entropy
reference_data[2, 4] = worksheet.cell_value(128,3) # Density
# Condenser dew point
reference_data[3, 0] = worksheet.cell_value(130,3)+k # Temperature
# Condenser bubble point
reference_data[4, 0] = worksheet.cell_value(130,4)+k # Temperature
# Condenser outlet / Before liquid line
reference_data[5, 0] = worksheet.cell_value(124,4)+k # Temperature
reference_data[5, 1] = worksheet.cell_value(125,4)*1e3 # Pressure
reference_data[5, 2] = worksheet.cell_value(126,4)*1e3 # Enthalpy
reference_data[5, 3] = worksheet.cell_value(127,4)*1e3 # Entropy
reference_data[5, 4] = worksheet.cell_value(128,4) # Density
# After liquid line / Before expansion valve
reference_data[6, 0] = worksheet.cell_value(141,3)+k # Temperature
reference_data[6, 1] = worksheet.cell_value(142,3)*1e3 # Pressure
reference_data[6, 2] = worksheet.cell_value(143,3)*1e3 # Enthalpy
reference_data[6, 3] = worksheet.cell_value(144,3)*1e3 # Entropy
reference_data[6, 4] = worksheet.cell_value(145,3) # Density
# After expansion valve / Evaporator inlet
reference_data[7, 0] = worksheet.cell_value(47,3)+k # Temperature
reference_data[7, 1] = worksheet.cell_value(48,3)*1e3 # Pressure
reference_data[7, 2] = worksheet.cell_value(49,3)*1e3 # Enthalpy
reference_data[7, 3] = worksheet.cell_value(50,3)*1e3 # Entropy
reference_data[7, 4] = worksheet.cell_value(51,3) # Density
reference_data[7, 5] = worksheet.cell_value(52,3) # Vapor mass quality
# Evaporator dew point
reference_data[8, 0] = worksheet.cell_value(53,4)+k # Temperature
# Evaporator outlet / Before suction line
reference_data[9, 0] = worksheet.cell_value(47,4)+k # Temperature
reference_data[9, 1] = worksheet.cell_value(48,4)*1e3 # Pressure
reference_data[9, 2] = worksheet.cell_value(49,4)*1e3 # Enthalpy
reference_data[9, 3] = worksheet.cell_value(50,4)*1e3 # Entropy
reference_data[9, 4] = worksheet.cell_value(51,4) # Density
return reference_data