개정판 59bbfb9b
issue #1202: update pressure_drop_static and pressure_pipe_end_point of stream line
Change-Id: I1205ad5fab0d41a5fb69255584e76edd7ccd7e73
HYTOS/HYTOS/Commands/HydroCalculationCommand.py | ||
---|---|---|
25 | 25 |
|
26 | 26 |
def execute(self, param): |
27 | 27 |
""" execute hydro calculation """ |
28 |
from EngineeringOriginItem import QEngineeringOriginItem |
|
29 |
from EngineeringGuidelineItem import QEngineeringGuidelineItem |
|
28 |
from AppDocData import AppDocData |
|
30 | 29 |
from SymbolSvgItem import SymbolSvgItem |
31 | 30 |
from EngineeringLoopItem import QEngineeringLoopItem |
32 | 31 |
|
... | ... | |
44 | 43 |
|
45 | 44 |
for loop in self.loops: |
46 | 45 |
loop.calculate() |
46 |
|
|
47 |
""" update pressure drop and pressure of stream data """ |
|
48 |
app_doc_data = AppDocData.instance() |
|
49 |
for hmb in app_doc_data.activeDrawing.hmbTable._hmbs: |
|
50 |
matches = [loop for loop in self.loops if [item for item in loop.items if str(item.uid) == str(hmb.components_uid)]] |
|
51 |
if matches: |
|
52 |
indices = [index for index in range(len(matches[0].items)) if str(matches[0].items[index].uid) == str(hmb.components_uid)] |
|
53 |
if indices: |
|
54 |
hmb.pressure_drop_static = matches[0].pressure_drops[matches[0].items[indices[0] - 1]] |
|
55 |
hmb.pressure_pipe_end_point = matches[0].pressures[matches[0].items[indices[0] + 1]] |
|
56 |
|
|
47 | 57 |
except Exception as ex: |
48 | 58 |
from App import App |
49 | 59 |
from AppDocData import MessageType |
50 | 60 |
|
51 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
|
|
61 |
message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
|
|
52 | 62 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
53 | 63 |
|
54 | 64 |
def make_loop(self, loop): |
... | ... | |
83 | 93 |
from App import App |
84 | 94 |
from AppDocData import MessageType |
85 | 95 |
|
86 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
96 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)
|
|
87 | 97 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
88 | 98 |
finally: |
89 | 99 |
loop.name = 'Loop{}'.format(len(self.loops) + 1) |
내보내기 Unified diff