개정판 60523553
issue #1060: 입력 데이터 오류가 발생할때 여러 오류 메세지를 하나의 창에 표시한다
Change-Id: I34efbfe17f788771dcab45f147059cfad7d4ac1c
HYTOS/HYTOS/Calculation.py | ||
---|---|---|
2519 | 2519 |
if is_blank(str(inside_pipe_size)): |
2520 | 2520 |
dlg = QCalculationValidation() |
2521 | 2521 |
detail = 'You have to input the ID of stream <{}>'.format(self._hmb.stream_no) |
2522 |
dlg.show_dialog('Calculation will be terminated!', detail)
|
|
2522 |
dlg.show_dialog('Calculation will be terminated!', [detail])
|
|
2523 | 2523 |
return |
2524 | 2524 |
|
2525 | 2525 |
if pipe_diameter_unit == 'in': |
... | ... | |
2751 | 2751 |
if is_blank(str(inside_pipe_size)): |
2752 | 2752 |
dlg = QCalculationValidation() |
2753 | 2753 |
detail = 'You have to input the ID of stream <{}>'.format(self._hmb.stream_no) |
2754 |
dlg.show_dialog('Calculation will be terminated!', detail)
|
|
2754 |
dlg.show_dialog('Calculation will be terminated!', [detail])
|
|
2755 | 2755 |
return |
2756 | 2756 |
|
2757 | 2757 |
if pipe_diameter_unit == 'in': |
HYTOS/HYTOS/CalculationValidation.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
|
3 |
# Form implementation generated from reading ui file 'ProjectDialog.ui' |
|
4 |
# |
|
5 |
# Created by: PyQt5 UI code generator 5.6 |
|
6 |
# |
|
7 |
# WARNING! All changes made in this file will be lost! |
|
8 |
|
|
9 | 3 |
from PyQt5 import QtCore, QtGui, QtWidgets |
10 | 4 |
from PyQt5.QtWidgets import * |
11 | 5 |
import os |
... | ... | |
25 | 19 |
self.ui.setupUi(self) |
26 | 20 |
HydroCalculationCommand.ERRORS += 1 |
27 | 21 |
|
28 |
def show_dialog(self, cause, detail): |
|
22 |
def show_dialog(self, cause, details):
|
|
29 | 23 |
self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint) |
30 | 24 |
|
31 | 25 |
self.ui.lineEdit_Cause.setText(cause) |
32 |
self.ui.listWidget_Detail.insertItem(0, QListWidgetItem(detail)) |
|
26 |
|
|
27 |
model = QtGui.QStandardItemModel(self) |
|
28 |
model.setHorizontalHeaderLabels(['Message']) |
|
29 |
self.ui.tableViewDetail.setModel(model) |
|
30 |
self.ui.tableViewDetail.setEditTriggers(QAbstractItemView.NoEditTriggers) # 셀 내용을 수정 불가하도록 |
|
31 |
|
|
32 |
rows = [] |
|
33 |
for idx, detail in enumerate(details): |
|
34 |
model.appendRow(QtGui.QStandardItem(detail)) |
|
35 |
|
|
36 |
self.ui.tableViewDetail.resizeColumnsToContents() |
|
37 |
self.ui.tableViewDetail.resizeRowsToContents() |
|
33 | 38 |
|
34 | 39 |
return self.exec_() |
35 | 40 |
|
HYTOS/HYTOS/CalculationValidation_UI.py | ||
---|---|---|
2 | 2 |
|
3 | 3 |
# Form implementation generated from reading ui file '.\UI\CalculationValidation.ui' |
4 | 4 |
# |
5 |
# Created by: PyQt5 UI code generator 5.13.0
|
|
5 |
# Created by: PyQt5 UI code generator 5.13.1
|
|
6 | 6 |
# |
7 | 7 |
# WARNING! All changes made in this file will be lost! |
8 | 8 |
|
... | ... | |
13 | 13 |
class Ui_Dialog(object): |
14 | 14 |
def setupUi(self, Dialog): |
15 | 15 |
Dialog.setObjectName("Dialog") |
16 |
Dialog.resize(400, 300)
|
|
16 |
Dialog.resize(465, 344)
|
|
17 | 17 |
font = QtGui.QFont() |
18 | 18 |
font.setFamily("맑은 고딕") |
19 | 19 |
Dialog.setFont(font) |
... | ... | |
24 | 24 |
self.gridLayout_2.setObjectName("gridLayout_2") |
25 | 25 |
self.gridLayout = QtWidgets.QGridLayout() |
26 | 26 |
self.gridLayout.setObjectName("gridLayout") |
27 |
self.verticalLayout = QtWidgets.QVBoxLayout() |
|
28 |
self.verticalLayout.setObjectName("verticalLayout") |
|
29 |
self.horizontalLayout = QtWidgets.QHBoxLayout() |
|
30 |
self.horizontalLayout.setObjectName("horizontalLayout") |
|
27 |
self.label_2 = QtWidgets.QLabel(Dialog) |
|
28 |
self.label_2.setMinimumSize(QtCore.QSize(50, 0)) |
|
29 |
self.label_2.setMaximumSize(QtCore.QSize(50, 16777215)) |
|
30 |
font = QtGui.QFont() |
|
31 |
font.setBold(True) |
|
32 |
font.setWeight(75) |
|
33 |
self.label_2.setFont(font) |
|
34 |
self.label_2.setAlignment(QtCore.Qt.AlignCenter) |
|
35 |
self.label_2.setObjectName("label_2") |
|
36 |
self.gridLayout.addWidget(self.label_2, 1, 1, 1, 1) |
|
31 | 37 |
self.label = QtWidgets.QLabel(Dialog) |
32 | 38 |
self.label.setMinimumSize(QtCore.QSize(50, 0)) |
33 | 39 |
self.label.setMaximumSize(QtCore.QSize(50, 16777215)) |
... | ... | |
37 | 43 |
self.label.setFont(font) |
38 | 44 |
self.label.setAlignment(QtCore.Qt.AlignCenter) |
39 | 45 |
self.label.setObjectName("label") |
40 |
self.horizontalLayout.addWidget(self.label)
|
|
46 |
self.gridLayout.addWidget(self.label, 0, 1, 1, 1)
|
|
41 | 47 |
self.lineEdit_Cause = QtWidgets.QLineEdit(Dialog) |
42 | 48 |
self.lineEdit_Cause.setReadOnly(True) |
43 | 49 |
self.lineEdit_Cause.setObjectName("lineEdit_Cause") |
44 |
self.horizontalLayout.addWidget(self.lineEdit_Cause) |
|
45 |
self.verticalLayout.addLayout(self.horizontalLayout) |
|
46 |
self.horizontalLayout_2 = QtWidgets.QHBoxLayout() |
|
47 |
self.horizontalLayout_2.setObjectName("horizontalLayout_2") |
|
48 |
self.label_2 = QtWidgets.QLabel(Dialog) |
|
49 |
self.label_2.setMinimumSize(QtCore.QSize(50, 0)) |
|
50 |
self.label_2.setMaximumSize(QtCore.QSize(50, 16777215)) |
|
51 |
font = QtGui.QFont() |
|
52 |
font.setBold(True) |
|
53 |
font.setWeight(75) |
|
54 |
self.label_2.setFont(font) |
|
55 |
self.label_2.setAlignment(QtCore.Qt.AlignHCenter|QtCore.Qt.AlignTop) |
|
56 |
self.label_2.setObjectName("label_2") |
|
57 |
self.horizontalLayout_2.addWidget(self.label_2) |
|
58 |
self.listWidget_Detail = QtWidgets.QListWidget(Dialog) |
|
59 |
self.listWidget_Detail.setObjectName("listWidget_Detail") |
|
60 |
self.horizontalLayout_2.addWidget(self.listWidget_Detail) |
|
61 |
self.verticalLayout.addLayout(self.horizontalLayout_2) |
|
62 |
self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1) |
|
63 |
self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1) |
|
50 |
self.gridLayout.addWidget(self.lineEdit_Cause, 0, 2, 1, 1) |
|
51 |
self.tableViewDetail = QtWidgets.QTableView(Dialog) |
|
52 |
self.tableViewDetail.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) |
|
53 |
self.tableViewDetail.setObjectName("tableViewDetail") |
|
54 |
self.tableViewDetail.horizontalHeader().setStretchLastSection(True) |
|
55 |
self.tableViewDetail.verticalHeader().setStretchLastSection(False) |
|
56 |
self.gridLayout.addWidget(self.tableViewDetail, 1, 2, 1, 1) |
|
57 |
self.gridLayout_2.addLayout(self.gridLayout, 1, 0, 1, 1) |
|
64 | 58 |
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) |
65 | 59 |
self.buttonBox.setOrientation(QtCore.Qt.Horizontal) |
66 | 60 |
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) |
67 | 61 |
self.buttonBox.setObjectName("buttonBox") |
68 |
self.gridLayout_2.addWidget(self.buttonBox, 1, 0, 1, 1)
|
|
62 |
self.gridLayout_2.addWidget(self.buttonBox, 2, 0, 1, 1)
|
|
69 | 63 |
|
70 | 64 |
self.retranslateUi(Dialog) |
71 | 65 |
self.buttonBox.accepted.connect(Dialog.accept) |
... | ... | |
75 | 69 |
def retranslateUi(self, Dialog): |
76 | 70 |
_translate = QtCore.QCoreApplication.translate |
77 | 71 |
Dialog.setWindowTitle(_translate("Dialog", "Calculation Error")) |
78 |
self.label.setText(_translate("Dialog", "Cause")) |
|
79 | 72 |
self.label_2.setText(_translate("Dialog", "Detail")) |
73 |
self.label.setText(_translate("Dialog", "Cause")) |
|
80 | 74 |
import Resource_rc |
HYTOS/HYTOS/Commands/HydroCalculationCommand.py | ||
---|---|---|
194 | 194 |
f"{sys.exc_info()[-1].tb_lineno}" |
195 | 195 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
196 | 196 |
|
197 |
def execute(self, param): |
|
197 |
def execute(self, param) -> list:
|
|
198 | 198 |
""" execute hydro calculation """ |
199 | 199 |
|
200 | 200 |
from SymbolSvgItem import SymbolSvgItem |
201 | 201 |
from EngineeringLoopItem import QEngineeringLoopItem |
202 |
from CalculationValidation import QCalculationValidation |
|
202 | 203 |
|
203 |
queue = []
|
|
204 |
queue, messages = [], []
|
|
204 | 205 |
try: |
205 | 206 |
pressurized = [item for item in self.imageViewer.scene.items() if type(item) is SymbolSvgItem and |
206 | 207 |
self.is_loop_end_item(item)] |
... | ... | |
216 | 217 |
queue.extend(self.make_loop(loop)) |
217 | 218 |
|
218 | 219 |
for loop in self.loops: |
219 |
loop.calculate() |
|
220 |
_messages = loop.calculate() |
|
221 |
if _messages: |
|
222 |
messages.extend(_messages) |
|
223 |
|
|
220 | 224 |
# update pressure and pressure drop |
221 | 225 |
for item in loop.items: |
222 | 226 |
if item in loop.pressures: |
223 | 227 |
item.pressure = loop.pressures[item] |
224 | 228 |
if item in loop.pressure_drops: |
225 | 229 |
item.pressure_drop = loop.pressure_drops[item] |
226 |
|
|
227 |
# self.init_units() |
|
228 |
# self.loop_result() |
|
229 |
|
|
230 | 230 |
except Exception as ex: |
231 | 231 |
from App import App |
232 | 232 |
from AppDocData import MessageType |
233 | 233 |
|
234 |
message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename,
|
|
235 |
sys.exc_info()[-1].tb_lineno)
|
|
234 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
|
|
235 |
f"{sys.exc_info()[-1].tb_lineno}"
|
|
236 | 236 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
237 | 237 |
|
238 |
return messages |
|
239 |
|
|
238 | 240 |
def loop_result(self): |
239 | 241 |
self.loop_streams_hy() |
240 | 242 |
self.loop_pumps_hy() |
HYTOS/HYTOS/MainWindow.py | ||
---|---|---|
1109 | 1109 |
from AppDocData import AppDocData |
1110 | 1110 |
from Calculation import Calculation |
1111 | 1111 |
from HydroCalculationCommand import HydroCalculationCommand |
1112 |
from CalculationValidation import QCalculationValidation |
|
1112 | 1113 |
from ValidationDialog import QValidationDialog |
1113 | 1114 |
|
1114 | 1115 |
try: |
... | ... | |
1155 | 1156 |
|
1156 | 1157 |
QApplication.processEvents() |
1157 | 1158 |
|
1159 |
messages = None |
|
1158 | 1160 |
""" generate loop """ |
1159 | 1161 |
cmd = HydroCalculationCommand(self.graphicsView) |
1160 |
cmd.execute(None) |
|
1162 |
messages = cmd.execute(None)
|
|
1161 | 1163 |
cmd.execute_second(None) |
1162 | 1164 |
|
1163 | 1165 |
app_doc_data.activeDrawing.loops = cmd.loops |
... | ... | |
1167 | 1169 |
|
1168 | 1170 |
self.load_HMB() |
1169 | 1171 |
|
1172 |
"""pop up error message dialog if there are some errors""" |
|
1173 |
if messages: |
|
1174 |
dlg = QCalculationValidation() |
|
1175 |
dlg.show_dialog('Calculation will be terminated!', messages) |
|
1176 |
|
|
1170 | 1177 |
if saving: |
1171 | 1178 |
app_doc_data.save_sheet_history('Calculation') |
1172 | 1179 |
finally: |
HYTOS/HYTOS/Shapes/EngineeringLoopItem.py | ||
---|---|---|
72 | 72 |
def name(self, value): |
73 | 73 |
self._name = value |
74 | 74 |
|
75 |
def calculate(self): |
|
76 |
""" calculate Pressure Drop (Static), Pressure @ Pipe end point of stream line """ |
|
75 |
def calculate(self) -> list: |
|
76 |
"""calculate Pressure Drop (Static), Pressure @ Pipe end point of stream line return |
|
77 |
error messages |
|
78 |
""" |
|
77 | 79 |
from AppDocData import AppDocData |
78 |
from CalculationValidation import QCalculationValidation |
|
79 | 80 |
|
81 |
messages = [] |
|
80 | 82 |
try: |
81 | 83 |
# (0) Units |
82 | 84 |
self.init_units() |
... | ... | |
86 | 88 |
|
87 | 89 |
# (3) 계산 시작 |
88 | 90 |
self.discharge_cal() |
91 |
|
|
89 | 92 |
if not self.items[1] in self.pressures or not self.pressures[self.items[1]]: |
90 |
self.suction_cal() |
|
93 |
messages = self.suction_cal()
|
|
91 | 94 |
|
92 | 95 |
# Hole Calculation |
93 | 96 |
# cv와 pump가 다 없을때 (Hole Case) |
... | ... | |
107 | 110 |
self.items[self.fill_start + 2]] |
108 | 111 |
|
109 | 112 |
if self.pressure_drops[self.items[self.fill_start + 1]] < 0: |
110 |
dlg = QCalculationValidation() |
|
111 |
dlg.show_dialog('Calculation will be terminated!', 'Control valve pressure drop is below zero.') |
|
113 |
messages.append('Control valve pressure drop is below zero.') |
|
112 | 114 |
|
113 | 115 |
elif name == 'R_P' or name == 'L_P' or name == 'V_P' or name == 'R_K' or name == 'L_K': |
114 | 116 |
self.pressure_drops[self.items[self.fill_start + 1]] = self.pressures[ |
115 | 117 |
self.items[self.fill_start + 2]] - \ |
116 | 118 |
self.pressures[ |
117 | 119 |
self.items[self.fill_start + 1]] |
120 |
|
|
118 | 121 |
except Exception as ex: |
119 | 122 |
from App import App |
120 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
|
|
121 |
sys.exc_info()[-1].tb_lineno)
|
|
123 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
|
|
124 |
f"{sys.exc_info()[-1].tb_lineno}"
|
|
122 | 125 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
123 | 126 |
|
127 |
return messages |
|
128 |
|
|
124 | 129 |
def init_units(self): |
125 | 130 |
try: |
126 | 131 |
app_doc_data = AppDocData.instance() |
... | ... | |
1191 | 1196 |
sys.exc_info()[-1].tb_lineno) |
1192 | 1197 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
1193 | 1198 |
|
1194 |
def suction_cal(self, calc_cnt=1): |
|
1199 |
def suction_cal(self, calc_cnt=1) -> list: |
|
1200 |
messages = [] |
|
1195 | 1201 |
try: |
1196 | 1202 |
for i in range(1, len(self.items) - 1, 3): |
1197 | 1203 |
self.suction_find_line(i) |
... | ... | |
1201 | 1207 |
if self.items[i].data.phase_type == 'Liquid' or self.items[i].data.phase_type == 'Mixed': |
1202 | 1208 |
# liquid 인 경우 stream 데이타로부터 del.P를 입력해줌. |
1203 | 1209 |
self.pressure_drops[self.items[i]] = self.items[i].data.pressure_drop_friction |
1204 |
res = self.suction_p_cal(i, calc_cnt) |
|
1210 |
res, message = self.suction_p_cal(i, calc_cnt) |
|
1211 |
if message: |
|
1212 |
messages.append(message) |
|
1213 |
|
|
1205 | 1214 |
if res == 0: |
1206 | 1215 |
break |
1207 | 1216 |
elif self.items[i].data.phase_type == 'Vapor': |
1208 | 1217 |
# vapor인 경우 압력강하를 계산해주고 넣어주는 모듈 |
1209 |
self.suction_vapor_factor_length(i) |
|
1210 |
res = self.suction_p_cal(i, calc_cnt) |
|
1218 |
message = self.suction_vapor_factor_length(i) |
|
1219 |
if message: |
|
1220 |
messages.append(message) |
|
1221 |
|
|
1222 |
res, message = self.suction_p_cal(i, calc_cnt) |
|
1223 |
if message: |
|
1224 |
messages.append(message) |
|
1225 |
|
|
1211 | 1226 |
if res == 0: |
1212 | 1227 |
break |
1213 | 1228 |
|
... | ... | |
1218 | 1233 |
sys.exc_info()[-1].tb_lineno) |
1219 | 1234 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
1220 | 1235 |
|
1236 |
return messages |
|
1237 |
|
|
1221 | 1238 |
def suction_find_line(self, i): |
1222 | 1239 |
self.extras[self.items[i]] = self.items[i].data.phase_type |
1223 | 1240 |
if self.items[i].data.phase_type == 'Liquid' or self.items[i].data.phase_type == 'Mixed': |
... | ... | |
1550 | 1567 |
sys.exc_info()[-1].tb_lineno) |
1551 | 1568 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
1552 | 1569 |
|
1553 |
def suction_vapor_factor_length(self, i): |
|
1570 |
def suction_vapor_factor_length(self, i) -> str:
|
|
1554 | 1571 |
from CalculationValidation import QCalculationValidation |
1555 | 1572 |
|
1573 |
message = '' |
|
1556 | 1574 |
try: |
1557 | 1575 |
# '입력된 vapor의 압력과 밀도를 가지고 끊어서 계산하는 factor를 적용했을때 length가 얼마나 나오는지 판별하는 것. |
1558 | 1576 |
|
1559 | 1577 |
# pipe dia 가져오기 |
1560 | 1578 |
ida = self.items[i].data.inside_pipe_size |
1561 | 1579 |
if is_blank(str(ida)): |
1562 |
dlg = QCalculationValidation() |
|
1563 |
detail = 'You have to input the ID of stream <{}>'.format(self.items[i].data.stream_no) |
|
1564 |
dlg.show_dialog('Calculation will be terminated!', detail) |
|
1565 |
return |
|
1580 |
message = 'You have to input the ID of stream <{}>'.format(self.items[i].data.stream_no) |
|
1581 |
return message |
|
1566 | 1582 |
|
1567 | 1583 |
pipe_diameter_unit = self.units['Pipe_Diameter'] |
1568 | 1584 |
if pipe_diameter_unit == 'in': |
... | ... | |
1725 | 1741 |
else: |
1726 | 1742 |
# '끊어서 계산하는 모듈이 들어가야함 |
1727 | 1743 |
# 'length 여유 없음. 압력 재계산->밀도 재계산->re, f 재계산->압력 재계산 체계로 가야함 |
1728 |
self.suction_vap_dp_cal2(i, press2, g, mw, temp, f, z, ida, estlength, mass, density1est, |
|
1729 |
equivalent_length) |
|
1744 |
message = self.suction_vap_dp_cal2(i, press2, g, mw, temp, f, z, ida, estlength, mass, density1est,
|
|
1745 |
equivalent_length)
|
|
1730 | 1746 |
|
1731 | 1747 |
except Exception as ex: |
1732 | 1748 |
from App import App |
1733 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
1749 |
_message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
|
|
1734 | 1750 |
sys.exc_info()[-1].tb_lineno) |
1735 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
1751 |
App.mainWnd().addMessage.emit(MessageType.Error, _message) |
|
1752 |
|
|
1753 |
return message |
|
1736 | 1754 |
|
1737 |
def suction_vap_dp_cal2(self, i, press2, g, mw, temp, f, z, ida, estlength, mass, density1est, equivalent_length): |
|
1755 |
def suction_vap_dp_cal2(self, i, press2, g, mw, temp, f, z, ida, estlength, mass, density1est, equivalent_length) -> str:
|
|
1738 | 1756 |
from CalculationValidation import QCalculationValidation |
1739 | 1757 |
|
1758 |
message = '' |
|
1740 | 1759 |
try: |
1741 | 1760 |
# 끊은 결과 length 여유가 없음, 고로 물성치 (밀도) 를 재계산해주어야 함 |
1742 | 1761 |
|
... | ... | |
1785 | 1804 |
press1est = press2 * 0.95 |
1786 | 1805 |
|
1787 | 1806 |
if press2 < 0: |
1788 |
dlg = QCalculationValidation() |
|
1789 |
detail = 'Line {}\n\nCalculation is terminated\n\nGet Pipe length shorter or Pipe Dia. bigger'.format(self.items[i]) |
|
1790 |
dlg.show_dialog('Absolute Pressure < 0', detail) |
|
1791 |
#raise ValueError('{} : Calculation is terminated'.format(self.items[i])) |
|
1807 |
message = 'Line {}\r\nCalculation is terminated\r\nGet Pipe length shorter or Pipe Dia. bigger'.format(self.items[i]) |
|
1792 | 1808 |
|
1793 | 1809 |
estlength = abs(((( |
1794 | 1810 |
press1est ** 2 - press2 ** 2) * mw / g ** 2 / 0.08206 / 1.033 ** 2 / temp / z * 101325) - ( |
... | ... | |
1819 | 1835 |
sys.exc_info()[-1].tb_lineno) |
1820 | 1836 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
1821 | 1837 |
|
1838 |
return message |
|
1839 |
|
|
1822 | 1840 |
def suction_vap_dp_cal1(self, i, press2, g, mw, temp, f, z, ida): |
1823 | 1841 |
try: |
1824 | 1842 |
# 끊은 결과 length가 여유가 있음. 그래서 단순 계산하는 모듈 |
... | ... | |
1974 | 1992 |
|
1975 | 1993 |
def suction_p_cal(self, i, calc_cnt=1): |
1976 | 1994 |
from CalculationValidation import QCalculationValidation |
1977 |
res = 1
|
|
1995 |
res, message = 1, None
|
|
1978 | 1996 |
|
1979 | 1997 |
try: |
1980 | 1998 |
self.pressures[self.items[i]] = self.pressures[self.items[i - 1]] - self.pressure_drops[self.items[i - 1]] |
... | ... | |
1997 | 2015 |
pabsolute = self.pressures[self.items[i]] + 0.101325 |
1998 | 2016 |
|
1999 | 2017 |
if pabsolute < 0: |
2000 |
dlg = QCalculationValidation() |
|
2001 |
detail = 'The absolute pressure of {} is below 0.'.format(self.items[i]) |
|
2002 |
dlg.show_dialog('Calculation will be terminated!', detail) |
|
2003 |
|
|
2004 |
# raise ValueError('The absolute pressure of {} is below 0.'.format(self.items[i])) |
|
2018 |
message = f"The absolute pressure of {self.items[i]} is below 0." |
|
2005 | 2019 |
|
2006 | 2020 |
if i < len(self.items) - 2: |
2007 | 2021 |
self.pressures[self.items[i + 1]] = self.pressures[self.items[i]] - self.pressure_drops[self.items[i]] |
... | ... | |
2023 | 2037 |
pabsolute = self.pressures[self.items[i + 1]] + 0.101325 |
2024 | 2038 |
|
2025 | 2039 |
if pabsolute < 0: |
2026 |
dlg = QCalculationValidation() |
|
2027 |
detail = 'The absolute pressure of {} is below 0.'.format(self.items[i])
|
|
2028 |
dlg.show_dialog('Calculation will be terminated!', detail) |
|
2040 |
# dlg = QCalculationValidation()
|
|
2041 |
message = f"The absolute pressure of {self.items[i]} is below 0."
|
|
2042 |
# dlg.show_dialog('Calculation will be terminated!', detail)
|
|
2029 | 2043 |
|
2030 | 2044 |
# raise ValueError('The absolute pressure of {} is below 0.'.format(self.items[i + 1])) |
2031 | 2045 |
|
... | ... | |
2058 | 2072 |
res = 0 |
2059 | 2073 |
except Exception as ex: |
2060 | 2074 |
from App import App |
2061 |
message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
2075 |
_message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename,
|
|
2062 | 2076 |
sys.exc_info()[-1].tb_lineno) |
2063 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
2077 |
App.mainWnd().addMessage.emit(MessageType.Error, _message)
|
|
2064 | 2078 |
|
2065 |
return res |
|
2079 |
return res, message
|
|
2066 | 2080 |
|
2067 | 2081 |
def hole_p_cal(self, i): |
2068 | 2082 |
res = 1 |
HYTOS/HYTOS/UI/CalculationValidation.ui | ||
---|---|---|
6 | 6 |
<rect> |
7 | 7 |
<x>0</x> |
8 | 8 |
<y>0</y> |
9 |
<width>400</width>
|
|
10 |
<height>300</height>
|
|
9 |
<width>465</width>
|
|
10 |
<height>344</height>
|
|
11 | 11 |
</rect> |
12 | 12 |
</property> |
13 | 13 |
<property name="font"> |
... | ... | |
23 | 23 |
<normaloff>:/images/HYTOS.png</normaloff>:/images/HYTOS.png</iconset> |
24 | 24 |
</property> |
25 | 25 |
<layout class="QGridLayout" name="gridLayout_2"> |
26 |
<item row="0" column="0">
|
|
26 |
<item row="1" column="0">
|
|
27 | 27 |
<layout class="QGridLayout" name="gridLayout"> |
28 |
<item row="0" column="0"> |
|
29 |
<layout class="QVBoxLayout" name="verticalLayout"> |
|
30 |
<item> |
|
31 |
<layout class="QHBoxLayout" name="horizontalLayout"> |
|
32 |
<item> |
|
33 |
<widget class="QLabel" name="label"> |
|
34 |
<property name="minimumSize"> |
|
35 |
<size> |
|
36 |
<width>50</width> |
|
37 |
<height>0</height> |
|
38 |
</size> |
|
39 |
</property> |
|
40 |
<property name="maximumSize"> |
|
41 |
<size> |
|
42 |
<width>50</width> |
|
43 |
<height>16777215</height> |
|
44 |
</size> |
|
45 |
</property> |
|
46 |
<property name="font"> |
|
47 |
<font> |
|
48 |
<weight>75</weight> |
|
49 |
<bold>true</bold> |
|
50 |
</font> |
|
51 |
</property> |
|
52 |
<property name="text"> |
|
53 |
<string>Cause</string> |
|
54 |
</property> |
|
55 |
<property name="alignment"> |
|
56 |
<set>Qt::AlignCenter</set> |
|
57 |
</property> |
|
58 |
</widget> |
|
59 |
</item> |
|
60 |
<item> |
|
61 |
<widget class="QLineEdit" name="lineEdit_Cause"> |
|
62 |
<property name="readOnly"> |
|
63 |
<bool>true</bool> |
|
64 |
</property> |
|
65 |
</widget> |
|
66 |
</item> |
|
67 |
</layout> |
|
68 |
</item> |
|
69 |
<item> |
|
70 |
<layout class="QHBoxLayout" name="horizontalLayout_2"> |
|
71 |
<item> |
|
72 |
<widget class="QLabel" name="label_2"> |
|
73 |
<property name="minimumSize"> |
|
74 |
<size> |
|
75 |
<width>50</width> |
|
76 |
<height>0</height> |
|
77 |
</size> |
|
78 |
</property> |
|
79 |
<property name="maximumSize"> |
|
80 |
<size> |
|
81 |
<width>50</width> |
|
82 |
<height>16777215</height> |
|
83 |
</size> |
|
84 |
</property> |
|
85 |
<property name="font"> |
|
86 |
<font> |
|
87 |
<weight>75</weight> |
|
88 |
<bold>true</bold> |
|
89 |
</font> |
|
90 |
</property> |
|
91 |
<property name="text"> |
|
92 |
<string>Detail</string> |
|
93 |
</property> |
|
94 |
<property name="alignment"> |
|
95 |
<set>Qt::AlignHCenter|Qt::AlignTop</set> |
|
96 |
</property> |
|
97 |
</widget> |
|
98 |
</item> |
|
99 |
<item> |
|
100 |
<widget class="QListWidget" name="listWidget_Detail"/> |
|
101 |
</item> |
|
102 |
</layout> |
|
103 |
</item> |
|
104 |
</layout> |
|
28 |
<item row="1" column="1"> |
|
29 |
<widget class="QLabel" name="label_2"> |
|
30 |
<property name="minimumSize"> |
|
31 |
<size> |
|
32 |
<width>50</width> |
|
33 |
<height>0</height> |
|
34 |
</size> |
|
35 |
</property> |
|
36 |
<property name="maximumSize"> |
|
37 |
<size> |
|
38 |
<width>50</width> |
|
39 |
<height>16777215</height> |
|
40 |
</size> |
|
41 |
</property> |
|
42 |
<property name="font"> |
|
43 |
<font> |
|
44 |
<weight>75</weight> |
|
45 |
<bold>true</bold> |
|
46 |
</font> |
|
47 |
</property> |
|
48 |
<property name="text"> |
|
49 |
<string>Detail</string> |
|
50 |
</property> |
|
51 |
<property name="alignment"> |
|
52 |
<set>Qt::AlignCenter</set> |
|
53 |
</property> |
|
54 |
</widget> |
|
55 |
</item> |
|
56 |
<item row="0" column="1"> |
|
57 |
<widget class="QLabel" name="label"> |
|
58 |
<property name="minimumSize"> |
|
59 |
<size> |
|
60 |
<width>50</width> |
|
61 |
<height>0</height> |
|
62 |
</size> |
|
63 |
</property> |
|
64 |
<property name="maximumSize"> |
|
65 |
<size> |
|
66 |
<width>50</width> |
|
67 |
<height>16777215</height> |
|
68 |
</size> |
|
69 |
</property> |
|
70 |
<property name="font"> |
|
71 |
<font> |
|
72 |
<weight>75</weight> |
|
73 |
<bold>true</bold> |
|
74 |
</font> |
|
75 |
</property> |
|
76 |
<property name="text"> |
|
77 |
<string>Cause</string> |
|
78 |
</property> |
|
79 |
<property name="alignment"> |
|
80 |
<set>Qt::AlignCenter</set> |
|
81 |
</property> |
|
82 |
</widget> |
|
83 |
</item> |
|
84 |
<item row="0" column="2"> |
|
85 |
<widget class="QLineEdit" name="lineEdit_Cause"> |
|
86 |
<property name="readOnly"> |
|
87 |
<bool>true</bool> |
|
88 |
</property> |
|
89 |
</widget> |
|
90 |
</item> |
|
91 |
<item row="1" column="2"> |
|
92 |
<widget class="QTableView" name="tableViewDetail"> |
|
93 |
<property name="editTriggers"> |
|
94 |
<set>QAbstractItemView::NoEditTriggers</set> |
|
95 |
</property> |
|
96 |
<attribute name="horizontalHeaderStretchLastSection"> |
|
97 |
<bool>true</bool> |
|
98 |
</attribute> |
|
99 |
<attribute name="verticalHeaderStretchLastSection"> |
|
100 |
<bool>false</bool> |
|
101 |
</attribute> |
|
102 |
</widget> |
|
105 | 103 |
</item> |
106 | 104 |
</layout> |
107 | 105 |
</item> |
108 |
<item row="1" column="0">
|
|
106 |
<item row="2" column="0">
|
|
109 | 107 |
<widget class="QDialogButtonBox" name="buttonBox"> |
110 | 108 |
<property name="orientation"> |
111 | 109 |
<enum>Qt::Horizontal</enum> |
내보내기 Unified diff