개정판 dead731d
issue #1048 : 화면/메뉴/툴바 개발
Change-Id: I062bc65b73f98bbe8f362c0123f26871e6039eb0
HYTOS/HYTOS/Commands/HydroCalculationCommand.py | ||
---|---|---|
106 | 106 |
loop.extras[loop.items[i + 2]] = cvdp_final / ( |
107 | 107 |
cvdp_final + loop.total_device_loss + loop.line_total_friction_loss) |
108 | 108 |
|
109 |
return |
|
110 |
|
|
111 |
for loop in self.loops: |
|
112 |
cvdp = [] |
|
113 |
cvdp.append(100000000) |
|
114 |
names = [] |
|
115 |
for item in loop.items: |
|
116 |
parent = item.parent |
|
117 |
if parent: |
|
118 |
name = str(item).replace('_{}'.format(str(item).split('_')[len(str(item).split('_')) - 1]), '') |
|
119 |
if name in names: |
|
120 |
continue |
|
121 |
if name[:3] == 'CV_': |
|
122 |
names.append(name) |
|
123 |
if item in loop.pressure_drops: |
|
124 |
cvdp.append(loop.pressure_drops[item]) |
|
125 |
|
|
126 |
cvdp_final = min(cvdp) |
|
127 |
|
|
128 |
names = [] |
|
129 |
for item in loop.items: |
|
130 |
parent = item.parent |
|
131 |
if parent: |
|
132 |
name = str(item).replace('_{}'.format(str(item).split('_')[len(str(item).split('_')) - 1]), '') |
|
133 |
if name[:3] == 'CV_': |
|
134 |
if name in names: |
|
135 |
loop.extras[item] = cvdp_final / ( |
|
136 |
cvdp_final + loop.total_device_loss + loop.line_total_friction_loss) |
|
137 |
continue |
|
138 |
else: |
|
139 |
names.append(name) |
|
140 |
loop.pressure_drops[item] = cvdp_final |
|
141 |
|
|
142 | 109 |
def search_pump_calc(self): |
143 | 110 |
|
144 | 111 |
pumps = [] |
... | ... | |
177 | 144 |
if pump == name: |
178 | 145 |
loop.pressure_drops[loop.items[i + 1]] = pumpdp_final |
179 | 146 |
|
180 |
for loop in self.loops: |
|
181 |
if loop.fill_end - loop.fill_start != 3: |
|
182 |
loop.suction_cal(2) |
|
183 |
loop.discharge_cal(2) |
|
184 |
|
|
185 |
return |
|
186 |
|
|
187 |
pumpdp = [] |
|
188 |
pumpdp.append(0.00000001) |
|
189 |
|
|
190 |
# (1) 펌프 헤드 결정 |
|
191 |
for loop in self.loops: |
|
192 |
for item in loop.items: |
|
193 |
name = str(item)[:3] |
|
194 |
if name == 'R_P' or name == 'L_P' or name == 'V_P' or name == 'R_K' or name == 'L_P': |
|
195 |
if item in loop.pressure_drops: |
|
196 |
pumpdp.append(loop.pressure_drops[item]) |
|
197 |
break |
|
198 |
|
|
199 |
pumpdp_final = max(pumpdp) |
|
200 |
|
|
201 |
# (2) 펌프 헤드를 각 루프에 새로 씀 |
|
202 |
for loop in self.loops: |
|
203 |
for item in loop.items: |
|
204 |
name = str(item)[:3] |
|
205 |
if name == 'R_P' or name == 'L_P' or name == 'V_P' or name == 'R_K' or name == 'L_P': |
|
206 |
loop.pressure_drops[item] = pumpdp_final |
|
207 |
break |
|
208 |
|
|
209 |
for loop in self.loops: |
|
210 |
if loop.fill_end - loop.fill_start != 3: |
|
211 |
loop.suction_cal(2) |
|
212 |
matches = [item for item in loop.items if str(item)[:3] == 'CV_'] |
|
213 |
if matches: |
|
147 |
if len(pumps) > 0: |
|
148 |
for loop in self.loops: |
|
149 |
if loop.fill_end - loop.fill_start != 3: |
|
150 |
loop.suction_cal(2) |
|
214 | 151 |
loop.discharge_cal(2) |
215 | 152 |
|
216 | 153 |
def execute_second(self, param): |
... | ... | |
321 | 258 |
def loop_comps_hy(self): |
322 | 259 |
if self.loops: |
323 | 260 |
for loop in self.loops: |
261 |
tag_nos = [] |
|
324 | 262 |
indices = [index for index in range(len(loop.items)) if |
325 | 263 |
str(loop.items[index])[:3] == 'R_K' or str(loop.items[index])[:3] == 'L_K'] |
326 | 264 |
attribute = {} |
327 | 265 |
if indices: |
328 |
if len(indices) == 2: |
|
329 |
tag_no = loop.items[indices[0]].parent.tag_no |
|
330 |
suct_p = loop.pressures[loop.items[indices[0]]] |
|
331 |
disc_p = loop.pressures[loop.items[indices[1]]] |
|
266 |
for i in range(len(indices)): |
|
267 |
tag_no = loop.items[indices[i]].parent.tag_no |
|
268 |
if tag_no in tag_nos: |
|
269 |
continue |
|
270 |
|
|
271 |
tag_nos.append(tag_no) |
|
272 |
suct_p = loop.pressures[loop.items[indices[i]]] |
|
273 |
disc_p = loop.pressures[loop.items[indices[i + 1]]] |
|
332 | 274 |
diff_p = disc_p - suct_p |
333 | 275 |
|
334 |
flowrate_mass = loop.items[indices[0] - 1].data.flowrate_mass
|
|
335 |
density = loop.density_elevations[loop.items[indices[0] - 1]]
|
|
276 |
flowrate_mass = loop.items[indices[i] - 1].data.flowrate_mass
|
|
277 |
density = loop.density_elevations[loop.items[indices[i] - 1]]
|
|
336 | 278 |
hhp = self.comp_hydp_hy(flowrate_mass, density, round(diff_p, 3)) |
337 | 279 |
|
338 | 280 |
attribute['Tag_No'] = tag_no |
... | ... | |
341 | 283 |
attribute['Diff.P'] = diff_p |
342 | 284 |
attribute['HHP'] = hhp |
343 | 285 |
|
344 |
loop.items[indices[0]].parent.attribute = attribute
|
|
286 |
loop.items[indices[i]].parent.attribute = attribute
|
|
345 | 287 |
|
346 | 288 |
def loop_cv_hy(self): |
347 | 289 |
if self.loops: |
290 |
tag_nos = [] |
|
348 | 291 |
for loop in self.loops: |
349 | 292 |
indices = [index for index in range(len(loop.items)) if str(loop.items[index])[:3] == 'CV_'] |
350 |
attribute = {} |
|
351 | 293 |
if indices: |
352 |
if len(indices) == 2: |
|
353 |
tag_no = loop.items[indices[0]].parent.tag_no |
|
354 |
suct_p = loop.pressures[loop.items[indices[0]]] |
|
355 |
disc_p = loop.pressures[loop.items[indices[1]]] |
|
356 |
diff_p = loop.pressure_drops[loop.items[indices[0]]] |
|
357 |
dp_ratio = loop.extras[loop.items[indices[1]]] if not loop.extras[ |
|
358 |
loop.items[indices[1]]] is None else 0 |
|
294 |
for i in range(len(indices)): |
|
295 |
tag_no = loop.items[indices[i]].parent.tag_no |
|
296 |
if tag_no in tag_nos: |
|
297 |
continue |
|
359 | 298 |
|
299 |
tag_nos.append(tag_no) |
|
300 |
suct_p = loop.pressures[loop.items[indices[i]]] |
|
301 |
disc_p = loop.pressures[loop.items[indices[i + 1]]] |
|
302 |
diff_p = loop.pressure_drops[loop.items[indices[i]]] |
|
303 |
dp_ratio = loop.extras[loop.items[indices[i + 1]]] if not loop.extras[ |
|
304 |
loop.items[indices[i + 1]]] is None else 0 |
|
305 |
|
|
306 |
attribute = {} |
|
360 | 307 |
attribute['Tag_No'] = tag_no |
361 | 308 |
attribute['Suct.P'] = suct_p |
362 | 309 |
attribute['Disc.P'] = disc_p |
363 | 310 |
attribute['Diff.P'] = diff_p |
364 | 311 |
attribute['dP Ratio'] = dp_ratio |
365 | 312 |
|
366 |
loop.items[indices[0]].parent.attribute = attribute
|
|
313 |
loop.items[indices[i]].parent.attribute = attribute
|
|
367 | 314 |
|
368 | 315 |
def loop_pumps_hy(self): |
369 | 316 |
if self.loops: |
317 |
tag_nos = [] |
|
370 | 318 |
for loop in self.loops: |
371 | 319 |
indices = [index for index in range(len(loop.items)) if |
372 | 320 |
str(loop.items[index])[:3] == 'R_P' or str(loop.items[index])[:3] == 'L_P' or str( |
373 | 321 |
loop.items[index])[:3] == 'V_P'] |
374 |
attribute = {} |
|
375 | 322 |
if indices: |
376 |
if len(indices) == 2: |
|
377 |
tag_no = loop.items[indices[0]].parent.tag_no |
|
378 |
suct_p = loop.pressures[loop.items[indices[0]]] |
|
379 |
disc_p = loop.pressures[loop.items[indices[1]]] |
|
323 |
for i in range(len(indices)): |
|
324 |
tag_no = loop.items[indices[i]].parent.tag_no |
|
325 |
if tag_no in tag_nos: |
|
326 |
continue |
|
327 |
|
|
328 |
tag_nos.append(tag_no) |
|
329 |
suct_p = loop.pressures[loop.items[indices[i]]] |
|
330 |
disc_p = loop.pressures[loop.items[indices[i + 1]]] |
|
380 | 331 |
diff_p = disc_p - suct_p |
381 |
vapr_p = loop.extras[loop.items[indices[0]]]
|
|
332 |
vapr_p = loop.extras[loop.items[indices[i]]]
|
|
382 | 333 |
|
383 |
flowrate_mass = loop.items[indices[0] - 1].data.flowrate_mass
|
|
384 |
density = loop.density_elevations[loop.items[indices[0] - 1]]
|
|
334 |
flowrate_mass = loop.items[indices[i] - 1].data.flowrate_mass
|
|
335 |
density = loop.density_elevations[loop.items[indices[i] - 1]]
|
|
385 | 336 |
|
386 | 337 |
npsha = self.npsha_cal_hy(suct_p, vapr_p, density) |
387 | 338 |
head = self.pump_head_cal(diff_p, density) |
388 | 339 |
hhp = self.pump_hydp_hy(flowrate_mass, density, head) |
389 | 340 |
|
390 |
if len(loop.items[indices[0]].parent.attribute) == 0: |
|
341 |
attribute = {} |
|
342 |
if len(loop.items[indices[i]].parent.attribute) == 0: |
|
391 | 343 |
attribute['Tag_No'] = tag_no |
392 | 344 |
attribute['Suct.P'] = suct_p |
393 | 345 |
attribute['Disc.P'] = disc_p |
... | ... | |
396 | 348 |
attribute['NPSHa'] = npsha |
397 | 349 |
attribute['Vap. P'] = vapr_p |
398 | 350 |
attribute['HHP'] = hhp |
399 |
loop.items[indices[0]].parent.attribute = attribute
|
|
400 |
elif tag_no != loop.items[indices[0]].parent.attribute['Tag_No']:
|
|
351 |
loop.items[indices[i]].parent.attribute = attribute
|
|
352 |
elif tag_no != loop.items[indices[i]].parent.attribute['Tag_No']:
|
|
401 | 353 |
attribute['Tag_No'] = tag_no |
402 | 354 |
attribute['Suct.P'] = suct_p |
403 | 355 |
attribute['Disc.P'] = disc_p |
... | ... | |
406 | 358 |
attribute['NPSHa'] = npsha |
407 | 359 |
attribute['Vap. P'] = vapr_p |
408 | 360 |
attribute['HHP'] = hhp |
409 |
loop.items[indices[0]].parent.attribute = attribute
|
|
361 |
loop.items[indices[i]].parent.attribute = attribute
|
|
410 | 362 |
|
411 | 363 |
def get_barometric_pressure(self): |
412 | 364 |
pressure_unit = self.units['Pressure'] |
HYTOS/HYTOS/MainWindow.py | ||
---|---|---|
1041 | 1041 |
:13] == 'Line_Splitter': |
1042 | 1042 |
pre_stream_num = loop.items[i - 3].stream_no |
1043 | 1043 |
cur_stream_num = loop.items[i].stream_no |
1044 |
if pre_stream_num == cur_stream_num: |
|
1044 |
|
|
1045 |
if strmsg.__contains__('-'): |
|
1046 |
last_stream_num = str(strmsg).rsplit('-', 1)[1] |
|
1047 |
else: |
|
1048 |
last_stream_num = '0' |
|
1049 |
|
|
1050 |
if pre_stream_num == int(last_stream_num): |
|
1045 | 1051 |
strmsg = '{}-{}'.format(strmsg, cur_stream_num) |
1046 | 1052 |
else: |
1047 | 1053 |
strmsg = '{}-{}-{}'.format(strmsg, pre_stream_num, cur_stream_num) |
1048 | 1054 |
|
1055 |
# if pre_stream_num == cur_stream_num: |
|
1056 |
# strmsg = '{}-{}'.format(strmsg, cur_stream_num) |
|
1057 |
# else: |
|
1058 |
# strmsg = '{}-{}-{}'.format(strmsg, pre_stream_num, cur_stream_num) |
|
1059 |
|
|
1049 | 1060 |
last_stream_num = loop.items[len(loop.items) - 2].stream_no |
1050 | 1061 |
strmsg = '{}-{}'.format(strmsg, last_stream_num) |
1051 | 1062 |
|
... | ... | |
1529 | 1540 |
if len(str(loop.items[i - 1])) > 13 and str(loop.items[i - 1])[:13] == 'Line_Splitter': |
1530 | 1541 |
pre_stream_num = loop.items[i - 3].stream_no |
1531 | 1542 |
cur_stream_num = loop.items[i].stream_no |
1532 |
if pre_stream_num == cur_stream_num: |
|
1543 |
|
|
1544 |
if strmsg.__contains__('-'): |
|
1545 |
last_stream_num = str(strmsg).rsplit('-', 1)[1] |
|
1546 |
else: |
|
1547 |
last_stream_num = '0' |
|
1548 |
|
|
1549 |
if pre_stream_num == int(last_stream_num): |
|
1533 | 1550 |
strmsg = '{}-{}'.format(strmsg, cur_stream_num) |
1534 | 1551 |
else: |
1535 | 1552 |
strmsg = '{}-{}-{}'.format(strmsg, pre_stream_num, cur_stream_num) |
... | ... | |
1558 | 1575 |
if name[:3] == 'R_P' or name[:3] == 'L_P' or name[:3] == 'V_P': |
1559 | 1576 |
names.append(name) |
1560 | 1577 |
attr = item.parent.attribute |
1561 |
|
|
1562 |
self.add_data(self.tableWidgetOutput, attr['Tag_No'], None, None, True, True) |
|
1563 |
self.add_data(self.tableWidgetOutput, 'Suct.P :', round(attr['Suct.P'], 3), |
|
1564 |
'{}.g'.format(units['Pressure'])) |
|
1565 |
self.add_data(self.tableWidgetOutput, 'Disc.P :', round(attr['Disc.P'], 3), |
|
1566 |
'{}.g'.format(units['Pressure'])) |
|
1567 |
self.add_data(self.tableWidgetOutput, 'Diff.P :', round(attr['Diff.P'], 3), |
|
1568 |
units['Pressure']) |
|
1569 |
self.add_data(self.tableWidgetOutput, 'Head :', round(attr['Head'], 3), units['Length']) |
|
1570 |
self.add_data(self.tableWidgetOutput, 'NPSHa :', round(attr['NPSHa'], 3), units['Length']) |
|
1571 |
self.add_data(self.tableWidgetOutput, 'Vap. P :', attr['Vap. P'], |
|
1572 |
'{}.a'.format(units['Pressure'])) |
|
1573 |
self.add_data(self.tableWidgetOutput, 'HHP :', round(attr['HHP'], 3), units['Power']) |
|
1578 |
if len(attr) > 0: |
|
1579 |
self.add_data(self.tableWidgetOutput, attr['Tag_No'], None, None, True, True)
|
|
1580 |
self.add_data(self.tableWidgetOutput, 'Suct.P :', round(attr['Suct.P'], 3),
|
|
1581 |
'{}.g'.format(units['Pressure']))
|
|
1582 |
self.add_data(self.tableWidgetOutput, 'Disc.P :', round(attr['Disc.P'], 3),
|
|
1583 |
'{}.g'.format(units['Pressure']))
|
|
1584 |
self.add_data(self.tableWidgetOutput, 'Diff.P :', round(attr['Diff.P'], 3),
|
|
1585 |
units['Pressure'])
|
|
1586 |
self.add_data(self.tableWidgetOutput, 'Head :', round(attr['Head'], 3), units['Length'])
|
|
1587 |
self.add_data(self.tableWidgetOutput, 'NPSHa :', round(attr['NPSHa'], 3), units['Length'])
|
|
1588 |
self.add_data(self.tableWidgetOutput, 'Vap. P :', attr['Vap. P'],
|
|
1589 |
'{}.a'.format(units['Pressure']))
|
|
1590 |
self.add_data(self.tableWidgetOutput, 'HHP :', round(attr['HHP'], 3), units['Power'])
|
|
1574 | 1591 |
|
1575 | 1592 |
# Compressor |
1576 | 1593 |
for loop in loops: |
... | ... | |
1584 | 1601 |
names.append(name) |
1585 | 1602 |
|
1586 | 1603 |
attr = item.parent.attribute |
1587 |
self.add_data(self.tableWidgetOutput, attr['Tag_No'], None, None, True, True) |
|
1588 |
self.add_data(self.tableWidgetOutput, 'Suct.P :', round(attr['Suct.P'], 3), |
|
1589 |
'{}.g'.format(units['Pressure'])) |
|
1590 |
self.add_data(self.tableWidgetOutput, 'Disc.P :', round(attr['Disc.P'], 3), |
|
1591 |
'{}.g'.format(units['Pressure'])) |
|
1592 |
self.add_data(self.tableWidgetOutput, 'Diff.P :', round(attr['Diff.P'], 3), |
|
1593 |
units['Pressure']) |
|
1594 |
self.add_data(self.tableWidgetOutput, 'HHP :', round(attr['HHP'], 3), units['Power']) |
|
1604 |
if len(attr) > 0: |
|
1605 |
self.add_data(self.tableWidgetOutput, attr['Tag_No'], None, None, True, True) |
|
1606 |
self.add_data(self.tableWidgetOutput, 'Suct.P :', round(attr['Suct.P'], 3), |
|
1607 |
'{}.g'.format(units['Pressure'])) |
|
1608 |
self.add_data(self.tableWidgetOutput, 'Disc.P :', round(attr['Disc.P'], 3), |
|
1609 |
'{}.g'.format(units['Pressure'])) |
|
1610 |
self.add_data(self.tableWidgetOutput, 'Diff.P :', round(attr['Diff.P'], 3), |
|
1611 |
units['Pressure']) |
|
1612 |
self.add_data(self.tableWidgetOutput, 'HHP :', round(attr['HHP'], 3), units['Power']) |
|
1595 | 1613 |
|
1596 | 1614 |
# Control Valve |
1597 | 1615 |
for loop in loops: |
... | ... | |
1605 | 1623 |
names.append(name) |
1606 | 1624 |
|
1607 | 1625 |
attr = item.parent.attribute |
1608 |
self.add_data(self.tableWidgetOutput, attr['Tag_No'], None, None, True, True) |
|
1609 |
self.add_data(self.tableWidgetOutput, 'Inlet P :', round(attr['Suct.P'], 3), |
|
1610 |
'{}.g'.format(units['Pressure'])) |
|
1611 |
self.add_data(self.tableWidgetOutput, 'Outlet P :', round(attr['Disc.P'], 3), |
|
1612 |
'{}.g'.format(units['Pressure'])) |
|
1613 |
self.add_data(self.tableWidgetOutput, 'Diff.P :', round(attr['Diff.P'], 3), |
|
1614 |
units['Pressure']) |
|
1615 |
self.add_data(self.tableWidgetOutput, 'dP Ratio :', round(attr['dP Ratio'] * 100, 2), '%') |
|
1626 |
if len(attr) > 0: |
|
1627 |
self.add_data(self.tableWidgetOutput, attr['Tag_No'], None, None, True, True) |
|
1628 |
self.add_data(self.tableWidgetOutput, 'Inlet P :', round(attr['Suct.P'], 3), |
|
1629 |
'{}.g'.format(units['Pressure'])) |
|
1630 |
self.add_data(self.tableWidgetOutput, 'Outlet P :', round(attr['Disc.P'], 3), |
|
1631 |
'{}.g'.format(units['Pressure'])) |
|
1632 |
self.add_data(self.tableWidgetOutput, 'Diff.P :', round(attr['Diff.P'], 3), |
|
1633 |
units['Pressure']) |
|
1634 |
self.add_data(self.tableWidgetOutput, 'dP Ratio :', round(attr['dP Ratio'] * 100, 2), '%') |
|
1616 | 1635 |
|
1617 | 1636 |
except Exception as ex: |
1618 | 1637 |
message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename, |
HYTOS/HYTOS/Shapes/EngineeringLoopItem.py | ||
---|---|---|
649 | 649 |
|
650 | 650 |
self.fill_end = 3 |
651 | 651 |
else: |
652 |
for i in range(len(self.items) - 2, 1, -3): # backward
|
|
652 |
for i in range(len(self.items) - 2, 0, -3): # backward
|
|
653 | 653 |
self.discharge_den(i) # (1) density 입력 |
654 | 654 |
self.discharge_static_cal(i) # (2) static P를 계산 |
655 | 655 |
|
내보내기 Unified diff