개정판 181ce52d
issue #1202: calculate press drop(50%)
Change-Id: Ia767c8753221a59fb0f5ad7bb29b8b55274fe5d2
HYTOS/HYTOS/LineSplitter.py | ||
---|---|---|
13 | 13 |
import LineSplitter_UI |
14 | 14 |
import math |
15 | 15 |
|
16 |
|
|
16 | 17 |
class QLineSplitter(QDialog): |
17 | 18 |
def __init__(self): |
18 | 19 |
QDialog.__init__(self) |
... | ... | |
31 | 32 |
|
32 | 33 |
self.set_controls(item) |
33 | 34 |
self.load_data() |
34 |
|
|
35 |
|
|
35 | 36 |
self.exec_() |
36 | 37 |
|
37 | 38 |
def initialize(self): |
... | ... | |
39 | 40 |
self.ui.label_Img_Down.setVisible(False) |
40 | 41 |
self.ui.label_Img_Left.setVisible(False) |
41 | 42 |
self.ui.label_Img_Right.setVisible(False) |
42 |
|
|
43 |
|
|
43 | 44 |
def set_controls(self, item): |
44 | 45 |
|
45 |
for connector in item.connectors:
|
|
46 |
index = connector._conn_index
|
|
46 |
for connector in item.connectors: |
|
47 |
index = connector._conn_index |
|
47 | 48 |
if connector.connectedItem: |
48 | 49 |
if index == 1: |
49 | 50 |
self.ui.label_Img_Up.setVisible(True) |
... | ... | |
59 | 60 |
from Drawing import Drawing |
60 | 61 |
|
61 | 62 |
app_doc_data = AppDocData.instance() |
62 |
drawing = app_doc_data.activeDrawing
|
|
63 |
drawing = app_doc_data.activeDrawing |
|
63 | 64 |
if drawing: |
64 | 65 |
for attr in drawing.attrs: |
65 | 66 |
if attr[0] == 'Units': |
... | ... | |
69 | 70 |
matches = [connector.data for connector in self._item.connectors if connector.data] |
70 | 71 |
if matches: |
71 | 72 |
pressure_drop = matches[0].pressure_drop |
72 |
if pressure_drop:
|
|
73 |
if pressure_drop is not None:
|
|
73 | 74 |
self.ui.lineEdit_Pressure_Drop.setText(str(pressure_drop)) |
74 | 75 |
|
75 | 76 |
elevation = matches[0].elevation |
76 |
if elevation: |
|
77 |
if elevation is not None:
|
|
77 | 78 |
self.ui.lineEdit_Elevation.setText(str(elevation)) |
78 | 79 |
|
79 |
|
|
80 | 80 |
def accept(self): |
81 | 81 |
""" set tag no and nozzle data """ |
82 | 82 |
from EngineeringConnectorItem import NozzleData |
83 | 83 |
|
84 | 84 |
for connector in self._item.connectors: |
85 |
if not connector.data:
|
|
85 |
if not connector.data: |
|
86 | 86 |
connector.data = NozzleData() |
87 | 87 |
|
88 | 88 |
pressure_drop = self.ui.lineEdit_Pressure_Drop.text() |
89 | 89 |
if pressure_drop: |
90 |
connector.data.pressure_drop = float(pressure_drop)
|
|
91 |
else:
|
|
90 |
connector.data.pressure_drop = float(pressure_drop) |
|
91 |
else: |
|
92 | 92 |
connector.data.pressure_drop = None |
93 | 93 |
|
94 | 94 |
elevation = self.ui.lineEdit_Elevation.text() |
95 | 95 |
if elevation: |
96 |
connector.data.elevation = float(elevation)
|
|
96 |
connector.data.elevation = float(elevation) |
|
97 | 97 |
else: |
98 | 98 |
connector.data.elevation = None |
99 | 99 |
|
100 | 100 |
QDialog.accept(self) |
101 | 101 |
|
102 | 102 |
def reject(self): |
103 |
QDialog.reject(self) |
|
103 |
QDialog.reject(self) |
HYTOS/HYTOS/Shapes/EngineeringConnectorItem.py | ||
---|---|---|
29 | 29 |
def parse(self, row): |
30 | 30 |
""" parse given row """ |
31 | 31 |
|
32 |
if row['Pressure']: |
|
33 |
self.pressure = float(row['Pressure']) |
|
34 |
if row['Pressure_Drop']: |
|
35 |
self.pressure_drop = float(row['Pressure_Drop']) |
|
36 |
if row['Elevation']: |
|
37 |
self.elevation = float(row['Elevation']) |
|
38 |
if row['Over_Design_CV']: |
|
39 |
self.over_design_cv = float(row['Over_Design_CV']) |
|
32 |
try: |
|
33 |
if not row['Pressure'] is None: |
|
34 |
self.pressure = float(row['Pressure']) |
|
35 |
if not row['Pressure_Drop'] is None: |
|
36 |
self.pressure_drop = float(row['Pressure_Drop']) |
|
37 |
if not row['Elevation'] is None: |
|
38 |
self.elevation = float(row['Elevation']) |
|
39 |
if not row['Over_Design_CV'] is None: |
|
40 |
self.over_design_cv = float(row['Over_Design_CV']) |
|
41 |
except Exception as ex: |
|
42 |
from App import App |
|
43 |
from AppDocData import MessageType |
|
44 |
|
|
45 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
46 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
40 | 47 |
|
41 | 48 |
""" |
42 | 49 |
A {ConnectorItem} is the graphical representation of a {Symbol.Connectors}. |
HYTOS/HYTOS/Shapes/EngineeringLoopItem.py | ||
---|---|---|
41 | 41 |
self.suction_line_friction_loss = None |
42 | 42 |
self.discharge_line_friction_loss = None |
43 | 43 |
self.line_total_friction_loss = None |
44 |
self.suction_device_loss = None |
|
45 |
self.discharge_device_loss = None |
|
46 |
self.total_suction_loss = None |
|
47 |
self.total_discharge_loss = None |
|
48 |
|
|
49 |
self.fill_start = None |
|
50 |
self.fill_end = None |
|
44 | 51 |
|
45 | 52 |
def __repr__(self): |
46 | 53 |
""" return string represent loop item """ |
... | ... | |
69 | 76 |
|
70 | 77 |
# Hole Calculation |
71 | 78 |
# cv와 pump가 다 없을때 (Hole Case) |
72 |
matches = [i for i in range(len(self.items)) if not self.items[i] in self.pressures] |
|
73 |
if matches: |
|
74 |
hole_start, hole_end = min(matches), max(matches) |
|
75 |
if hole_end - hole_start > 3: |
|
76 |
self.hole_calc(hole_start, hole_end) |
|
77 |
self.loss_input() |
|
78 |
self.cv_dp_cal() |
|
79 |
self.hole_recalc(hole_start, hole_end) |
|
80 |
|
|
81 |
name = str(self.items[hole_start+1])[:3] |
|
82 |
if name == 'CV_': |
|
83 |
self.pressure_drops[self.item[hole_start + 1]] = self.pressures[self.item[hole_start+1]] - \ |
|
84 |
self.pressures[self.item[hole_start+2]] |
|
85 |
elif name == 'R_P' or name == 'L_P' or name == 'V_P' or name == 'L_K': |
|
86 |
self.pressure_drops[self.item[hole_start + 1]] = self.pressures[self.item[hole_start + 2]] - \ |
|
87 |
self.pressures[self.item[hole_start + 1]] |
|
79 |
if self.fill_end - self.fill_start > 3: |
|
80 |
self.hole_calc(self.fill_start, self.fill_end) |
|
81 |
self.loss_input() |
|
82 |
self.cv_dp_cal() |
|
83 |
self.hole_recalc(self.fill_start, self.fill_end) |
|
84 |
|
|
85 |
name = str(self.items[self.fill_start + 1])[:3] |
|
86 |
if name == 'CV_': |
|
87 |
self.pressure_drops[self.items[self.fill_start + 1]] = self.pressures[ |
|
88 |
self.items[self.fill_start + 1]] - \ |
|
89 |
self.pressures[self.items[self.fill_start + 2]] |
|
90 |
elif name == 'R_P' or name == 'L_P' or name == 'V_P' or name == 'L_K': |
|
91 |
self.pressure_drops[self.items[self.fill_start + 1]] = self.pressures[ |
|
92 |
self.items[self.fill_start + 2]] - \ |
|
93 |
self.pressures[self.items[self.fill_start + 1]] |
|
88 | 94 |
except Exception as ex: |
89 | 95 |
from App import App |
90 | 96 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
... | ... | |
93 | 99 |
|
94 | 100 |
def hole_calc(self, hole_start, hole_end): |
95 | 101 |
try: |
96 |
self.pressures[self.items[hole_end]] = self.pressures[self.items[hole_end + 1]]
|
|
97 |
for i in range(hole_end - 1, hole_start + 3, -3):
|
|
102 |
self.pressures[self.items[hole_end - 2]] = self.pressures[self.items[hole_end - 1]]
|
|
103 |
for i in range(hole_end - 3, hole_start + 2, -3):
|
|
98 | 104 |
# (1) density 입력 |
99 | 105 |
self.discharge_den(i) |
100 | 106 |
|
... | ... | |
117 | 123 |
|
118 | 124 |
def hole_recalc(self, hole_start, hole_end): |
119 | 125 |
try: |
120 |
self.pressures[self.items[hole_end]] = self.pressures[self.items[hole_end + 1]] |
|
121 |
for i in range(hole_end - 1, hole_start + 3, -3): |
|
126 |
self.pressures[self.items[hole_end - 2]] = self.pressures[self.items[hole_end - 1]] + \ |
|
127 |
self.pressure_drops[self.items[hole_end - 2]] |
|
128 |
for i in range(hole_end - 3, hole_start + 2, -3): |
|
122 | 129 |
# (1) density 입력 |
123 | 130 |
self.discharge_den(i) |
124 | 131 |
|
... | ... | |
141 | 148 |
|
142 | 149 |
def cv_dp_cal(self): |
143 | 150 |
try: |
144 |
acv = [item for item in self.items if not (item in self.pressure_drops and self.pressure_drops[item]) and |
|
145 |
str(item)[:3] == 'CV_'] |
|
151 |
acv = 0 |
|
152 |
for i in range(2, len(self.items) - 3, 3): |
|
153 |
if not self.items[i] in self.pressure_drops and str(self.items[i])[:3] == 'CV_': |
|
154 |
acv = i |
|
155 |
break |
|
156 |
|
|
146 | 157 |
if acv: |
147 |
pf = (self.total_device_loss if self.total_device_loss else 0) + (self.line_total_friction_loss if self.line_total_friction_loss else 0) |
|
158 |
pf = (self.total_device_loss if self.total_device_loss else 0) + ( |
|
159 |
self.line_total_friction_loss if self.line_total_friction_loss else 0) |
|
148 | 160 |
method = 'bd' # TODO: |
149 | 161 |
if method == 'bd': |
150 |
self.bd_cal(pf, acv[0])
|
|
162 |
self.bd_cal(pf, acv) |
|
151 | 163 |
elif method == 'lummus': |
152 | 164 |
pass |
153 | 165 |
elif method == 'mixed': |
... | ... | |
168 | 180 |
try: |
169 | 181 |
bdcvdp = [None, None, None] |
170 | 182 |
|
171 |
bdcvdp[0] = ((1.1135 * ((self.extras[acv] if self.extras[acv] else 0) / 100 + 1)) ** 2 - 1) * pf
|
|
183 |
bdcvdp[0] = ((1.1135 * ((self.extras[self.items[acv]] if self.extras[self.items[acv]] else 0) / 100 + 1)) ** 2 - 1) * pf
|
|
172 | 184 |
bdcvdp[1] = pf / 3 |
173 | 185 |
|
174 | 186 |
app_doc_data = AppDocData.instance() |
... | ... | |
187 | 199 |
elif unit == 'MPa': |
188 | 200 |
bdcvdp[2] = 0.7 / 1.033 * 0.101325 |
189 | 201 |
|
190 |
if bdcvdp[0] > bdcvdp[1]: |
|
191 |
maxdp = bdcvdp[0] |
|
192 |
elif bdcvdp[0] < bdcvdp[1]: |
|
193 |
maxdp = bdcvdp[1] |
|
194 |
|
|
195 |
if maxdp < bdcvdp[2]: |
|
196 |
maxdp = bdcvdp[2] |
|
202 |
max_dp = max(bdcvdp[0], bdcvdp[1]) |
|
203 |
if max_dp < bdcvdp[2]: |
|
204 |
max_dp = bdcvdp[2] |
|
197 | 205 |
|
198 |
self.pressure_drops[acv] = maxdp
|
|
206 |
self.pressure_drops[self.items[acv]] = max_dp
|
|
199 | 207 |
except Exception as ex: |
200 | 208 |
from App import App |
201 | 209 |
message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename, |
... | ... | |
204 | 212 |
|
205 | 213 |
def loss_input(self): |
206 | 214 |
try: |
207 |
matches = [i for i in range(len(self.items)) if not self.items[i] in self.pressures] |
|
208 |
if matches: |
|
209 |
hole_start, hole_end = min(matches), max(matches) |
|
210 |
|
|
211 |
line_loss = 0 |
|
212 |
# 라인(suc) |
|
213 |
for i in range(1, hole_start, 3): |
|
214 |
line_loss = line_loss + self.pressure_drops[self.items[i]] |
|
215 |
self.suction_line_friction_loss = line_loss |
|
216 |
|
|
217 |
line_loss = 0 |
|
218 |
for i in range(len(self.items) - 2, hole_start, -3): |
|
219 |
if i == 3: |
|
220 |
break |
|
221 |
if self.items[i] in self.pressure_drops and self.pressure_drops[self.items[i]]: |
|
222 |
line_loss += self.pressure_drops[self.items[i]] |
|
223 |
self.discharge_line_friction_loss = line_loss |
|
224 |
|
|
225 |
line_loss = 0 |
|
226 |
self.line_total_friction_loss = self.suction_line_friction_loss + self.discharge_line_friction_loss |
|
227 |
|
|
228 |
# 기기(suc) |
|
229 |
# for a in range(2, hole_start) |
|
230 |
|
|
231 |
# 기기(dis) |
|
215 |
hole_start, hole_end = self.fill_start, self.fill_end |
|
216 |
|
|
217 |
line_loss = 0 |
|
218 |
# 라인(suc) |
|
219 |
for i in range(1, hole_start + 1, 3): |
|
220 |
line_loss = line_loss + self.pressure_drops[self.items[i]] |
|
221 |
self.suction_line_friction_loss = line_loss |
|
222 |
|
|
223 |
line_loss = 0 |
|
224 |
for i in range(len(self.items) - 2, hole_start + 2, -3): |
|
225 |
if i == 3: |
|
226 |
break |
|
227 |
if self.items[i] in self.pressure_drops and self.pressure_drops[self.items[i]]: |
|
228 |
line_loss += self.pressure_drops[self.items[i]] |
|
229 |
self.discharge_line_friction_loss = line_loss |
|
230 |
|
|
231 |
line_loss = 0 |
|
232 |
self.line_total_friction_loss = self.suction_line_friction_loss + self.discharge_line_friction_loss |
|
233 |
|
|
234 |
# 기기(suc) |
|
235 |
dev_loss = 0 |
|
236 |
for i in range(2, hole_start - 1, 3): |
|
237 |
name = str(self.items[i])[:3] |
|
238 |
if name == 'R_P' or name == 'L_P' or name == 'V_P' or name == 'R_K' or name == 'L_K' or name == 'CV_': |
|
239 |
pass |
|
240 |
else: |
|
241 |
dev_loss += self.pressure_drops[self.items[i]] |
|
242 |
self.suction_device_loss = dev_loss |
|
243 |
|
|
244 |
# 기기(dis) |
|
245 |
dev_loss = 0 |
|
246 |
for i in range(len(self.items) - 4, hole_start + 3, -3): |
|
247 |
name = str(self.items[i])[:3] |
|
248 |
if name == 'R_P' or name == 'L_P' or name == 'V_P' or name == 'R_K' or name == 'L_K' or name == 'CV_': |
|
249 |
pass |
|
250 |
else: |
|
251 |
dev_loss += self.pressure_drops[self.items[i]] if self.items[i] in self.pressure_drops else 0 |
|
252 |
self.discharge_device_loss = dev_loss |
|
253 |
|
|
254 |
self.total_device_loss = self.discharge_device_loss + self.suction_device_loss |
|
255 |
|
|
256 |
# 스태틱(suc) |
|
257 |
stat_loss = 0 |
|
258 |
for i in range(0, hole_start - 3, 3): |
|
259 |
stat_loss += self.pressure_drops[self.items[i]] |
|
260 |
self.total_suction_loss = stat_loss |
|
261 |
|
|
262 |
# 스태틱(dis) |
|
263 |
stat_loss = 0 |
|
264 |
for i in range(len(self.items) - 3, hole_start, -3): |
|
265 |
stat_loss += self.pressure_drops[self.items[i]] |
|
266 |
self.total_discharge_loss = stat_loss |
|
232 | 267 |
except Exception as ex: |
233 | 268 |
from App import App |
234 | 269 |
message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename, |
... | ... | |
251 | 286 |
break |
252 | 287 |
elif self.items[i].phase_type == 'Vapor': |
253 | 288 |
pass # TODO: |
289 |
|
|
290 |
self.fill_end = i |
|
254 | 291 |
except Exception as ex: |
255 | 292 |
from App import App |
256 | 293 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
257 |
sys.exc_info()[-1].tb_lineno) |
|
294 |
sys.exc_info()[-1].tb_lineno)
|
|
258 | 295 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
259 | 296 |
|
260 | 297 |
def suction_cal(self): |
... | ... | |
272 | 309 |
break |
273 | 310 |
elif self.items[i].data.phase_type == 'Vapor': |
274 | 311 |
pass # TODO: |
312 |
|
|
313 |
self.fill_start = i |
|
275 | 314 |
except Exception as ex: |
276 | 315 |
from App import App |
277 | 316 |
message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename, |
278 |
sys.exc_info()[-1].tb_lineno) |
|
317 |
sys.exc_info()[-1].tb_lineno)
|
|
279 | 318 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
280 | 319 |
|
281 | 320 |
def suction_find_line(self, i): |
321 |
self.extras[self.items[i]] = self.items[i].data.phase_type |
|
282 | 322 |
if self.items[i].data.phase_type == 'Liquid' or self.items[i].data.phase_type == 'Mixed': |
283 | 323 |
self.density_elevations[self.items[i]] = self.items[i].data.density |
284 | 324 |
elif self.items[i].data.phase_type == 'Vapor': |
... | ... | |
342 | 382 |
self.pressure_drops[self.items[i - 1]] = stat_dp * 0.101325 |
343 | 383 |
except Exception as ex: |
344 | 384 |
from App import App |
345 |
message = 'error occured({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
346 |
sys.exc_info()[-1].tb_lineno) |
|
385 |
message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename,
|
|
386 |
sys.exc_info()[-1].tb_lineno)
|
|
347 | 387 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
348 | 388 |
|
349 | 389 |
def p_eq_input(self): |
... | ... | |
360 | 400 |
dp_eq = str(self.items[i])[:3] |
361 | 401 |
|
362 | 402 |
# pressure drop |
363 |
if self.items[i].data.pressure_drop: |
|
403 |
if self.items[i].data.pressure_drop is not None:
|
|
364 | 404 |
self.pressure_drops[self.items[i]] = self.items[i].data.pressure_drop |
365 | 405 |
if not self.items[i].data.pressure_drop: |
366 | 406 |
pass |
... | ... | |
374 | 414 |
self.density_elevations[self.items[i + 1]] = self.items[i + 1].data.elevation |
375 | 415 |
|
376 | 416 |
if dp_eq[:3] == 'L_P' or dp_eq[:3] == 'R_P' or dp_eq[:3] == 'V_P' or dp_eq[:3] == 'R_K': |
377 |
self.extras[self.items[i]] = self.items[i].data.over_design_cv |
|
417 |
self.extras[self.items[i]] = self.items[i].data.over_design_cv \ |
|
418 |
if self.items[i].data.over_design_cv else 0 |
|
378 | 419 |
elif dp_eq[:3] == 'CV_': |
379 |
self.extras[self.items[i]] = self.items[i].data.over_design_cv |
|
420 |
self.extras[self.items[i]] = self.items[i].data.over_design_cv \ |
|
421 |
if self.items[i].data.over_design_cv else 0 |
|
380 | 422 |
self.extras[self.items[i + 1]] = None # TODO: |
381 | 423 |
except Exception as ex: |
382 | 424 |
from App import App |
383 | 425 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
384 |
sys.exc_info()[-1].tb_lineno) |
|
426 |
sys.exc_info()[-1].tb_lineno)
|
|
385 | 427 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
386 | 428 |
|
387 | 429 |
def discharge_den(self, i): |
... | ... | |
389 | 431 |
app_doc_data = AppDocData.instance() |
390 | 432 |
units = [attr[1] for attr in app_doc_data.activeDrawing.attrs if attr[0] == 'Units'][0] |
391 | 433 |
|
434 |
self.extras[self.items[i]] = self.items[i].data.phase_type |
|
392 | 435 |
# 1. density 받음 |
393 | 436 |
if self.items[i].data.phase_type == 'Liquid' or self.items[i].data.phase_type == 'Mixed': |
394 | 437 |
self.density_elevations[self.items[i]] = self.items[i].density |
... | ... | |
397 | 440 |
except Exception as ex: |
398 | 441 |
from App import App |
399 | 442 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
400 |
sys.exc_info()[-1].tb_lineno) |
|
443 |
sys.exc_info()[-1].tb_lineno)
|
|
401 | 444 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
402 | 445 |
|
403 | 446 |
def discharge_vapor_density(self, i): |
... | ... | |
460 | 503 |
except Exception as ex: |
461 | 504 |
from App import App |
462 | 505 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
463 |
sys.exc_info()[-1].tb_lineno) |
|
506 |
sys.exc_info()[-1].tb_lineno)
|
|
464 | 507 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
465 | 508 |
|
466 | 509 |
def suction_p_cal(self, i): |
... | ... | |
472 | 515 |
|
473 | 516 |
self.pressures[self.items[i]] = self.pressures[self.items[i - 1]] - self.pressure_drops[self.items[i - 1]] |
474 | 517 |
|
475 |
pressure_unit = units['Pressure'] |
|
476 |
if pressure_unit == 'kg/cm2': |
|
477 |
pabsolute = self.pressures[self.items[i]] + 1.033 |
|
478 |
elif pressure_unit == 'psi': |
|
479 |
pabsolute = self.pressures[self.items[i]] + 14.7 |
|
480 |
elif pressure_unit == 'atm': |
|
481 |
pabsolute = self.pressures[self.items[i]] + 1 |
|
482 |
elif pressure_unit == 'bar': |
|
483 |
pabsolute = self.pressures[self.items[i]] + 1.013 |
|
484 |
elif pressure_unit == 'mmHg': |
|
485 |
pabsolute = self.pressures[self.items[i]] + 760 |
|
486 |
elif pressure_unit == 'kPa': |
|
487 |
pabsolute = self.pressures[self.items[i]] + 101.325 |
|
488 |
elif pressure_unit == 'MPa': |
|
489 |
pabsolute = self.pressures[self.items[i]] + 0.101325 |
|
490 |
|
|
491 |
if pabsolute < 0: |
|
492 |
raise ValueError('The absolute pressure of {} is below 0.'.format(self.items[i])) |
|
518 |
if self.pressures[self.items[i]] < 0: |
|
519 |
pressure_unit = units['Pressure'] |
|
520 |
if pressure_unit == 'kg/cm2': |
|
521 |
pabsolute = self.pressures[self.items[i]] + 1.033 |
|
522 |
elif pressure_unit == 'psi': |
|
523 |
pabsolute = self.pressures[self.items[i]] + 14.7 |
|
524 |
elif pressure_unit == 'atm': |
|
525 |
pabsolute = self.pressures[self.items[i]] + 1 |
|
526 |
elif pressure_unit == 'bar': |
|
527 |
pabsolute = self.pressures[self.items[i]] + 1.013 |
|
528 |
elif pressure_unit == 'mmHg': |
|
529 |
pabsolute = self.pressures[self.items[i]] + 760 |
|
530 |
elif pressure_unit == 'kPa': |
|
531 |
pabsolute = self.pressures[self.items[i]] + 101.325 |
|
532 |
elif pressure_unit == 'MPa': |
|
533 |
pabsolute = self.pressures[self.items[i]] + 0.101325 |
|
534 |
|
|
535 |
if pabsolute < 0: |
|
536 |
raise ValueError('The absolute pressure of {} is below 0.'.format(self.items[i])) |
|
493 | 537 |
|
494 | 538 |
if i < len(self.items) - 2: |
495 | 539 |
self.pressures[self.items[i + 1]] = self.pressures[self.items[i]] - self.pressure_drops[self.items[i]] |
... | ... | |
525 | 569 |
except Exception as ex: |
526 | 570 |
from App import App |
527 | 571 |
message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename, |
528 |
sys.exc_info()[-1].tb_lineno) |
|
572 |
sys.exc_info()[-1].tb_lineno)
|
|
529 | 573 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
530 | 574 |
|
531 | 575 |
return res |
... | ... | |
541 | 585 |
self.pressures[self.items[i - 1]] = self.pressures[self.items[i]] + self.pressure_drops[ |
542 | 586 |
self.items[i - 1]] |
543 | 587 |
|
544 |
if self.items[i - 2] in self.pressure_drops and self.pressure_drops[self.items[i - 2]]: |
|
588 |
if self.items[i - 2] in self.pressure_drops and self.pressure_drops[self.items[i - 2]] is not None:
|
|
545 | 589 |
if index == 'L_P' or index == 'R_P' or index == 'V_P' or index == 'R_K' or index == 'L_K': |
546 | 590 |
self.pressures[self.items[i - 2]] = self.pressures[self.items[i - 1]] - \ |
547 | 591 |
self.pressure_drops[self.items[i - 2]] |
... | ... | |
554 | 598 |
except Exception as ex: |
555 | 599 |
from App import App |
556 | 600 |
message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename, |
557 |
sys.exc_info()[-1].tb_lineno) |
|
601 |
sys.exc_info()[-1].tb_lineno)
|
|
558 | 602 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
559 | 603 |
|
560 | 604 |
return res |
... | ... | |
582 | 626 |
except Exception as ex: |
583 | 627 |
from App import App |
584 | 628 |
message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename, |
585 |
sys.exc_info()[-1].tb_lineno) |
|
629 |
sys.exc_info()[-1].tb_lineno)
|
|
586 | 630 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
587 | 631 |
|
588 | 632 |
return res |
내보내기 Unified diff