개정판 d6c9d55b
issue #1202: Press Drop 계산 시작...
Change-Id: I5199ca8b8b0ff0343a88b91167e0a699badb220c
HYTOS/HYTOS/Commands/HydroCalculationCommand.py | ||
---|---|---|
41 | 41 |
while queue: |
42 | 42 |
loop = queue.pop() |
43 | 43 |
queue.extend(self.make_loop(loop)) |
44 |
|
|
45 |
for loop in self.loops: |
|
46 |
loop.calculate() |
|
44 | 47 |
except Exception as ex: |
45 | 48 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
46 | 49 |
print('{}'.format(message)) |
HYTOS/HYTOS/MainWindow.py | ||
---|---|---|
689 | 689 |
|
690 | 690 |
if loops: |
691 | 691 |
self.tableWidgetLoop.clear() |
692 |
self.tableWidgetLoop.setColumnCount(len(loops)) |
|
692 |
self.tableWidgetLoop.setColumnCount(len(loops)*4) |
|
693 |
|
|
694 |
_col_names = [[loop.name,'pressure','dP','density\nelevation'] for loop in loops] |
|
695 |
col_names = [] |
|
696 |
for col_name in _col_names: col_names.extend(col_name) |
|
697 |
self.tableWidgetLoop.setHorizontalHeaderLabels(col_names) |
|
693 | 698 |
|
694 | 699 |
max_rows = 0 |
695 | 700 |
for col in range(len(loops)): |
696 | 701 |
rows = len(loops[col].items) |
697 | 702 |
max_rows = max(max_rows, rows) |
698 |
self.tableWidgetLoop.setRowCount(max_rows + 1)
|
|
703 |
self.tableWidgetLoop.setRowCount(max_rows) |
|
699 | 704 |
|
700 |
item = QTableWidgetItem(loops[col].name) |
|
701 |
item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter) |
|
702 |
self.tableWidgetLoop.setItem(0, col, item) |
|
703 | 705 |
for row in range(len(loops[col].items)): |
704 | 706 |
item = QTableWidgetItem(str(loops[col].items[row])) |
705 | 707 |
item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter) |
706 |
self.tableWidgetLoop.setItem(row + 1, col, item) |
|
708 |
self.tableWidgetLoop.setItem(row, col*4, item) |
|
709 |
|
|
710 |
for row in range(len(loops[col].items)): |
|
711 |
if loops[col].items[row] in loops[col].press_drops: |
|
712 |
item = QTableWidgetItem(str(loops[col].press_drops[loops[col].items[row]])) |
|
713 |
self.tableWidgetLoop.setItem(row, col*4 + 1, item) |
|
707 | 714 |
|
708 | 715 |
''' |
709 | 716 |
@brief configuration |
HYTOS/HYTOS/MainWindow_UI.py | ||
---|---|---|
13 | 13 |
class Ui_MainWindow(object): |
14 | 14 |
def setupUi(self, MainWindow): |
15 | 15 |
MainWindow.setObjectName("MainWindow") |
16 |
MainWindow.resize(905, 557)
|
|
16 |
MainWindow.resize(905, 574)
|
|
17 | 17 |
font = QtGui.QFont() |
18 | 18 |
font.setFamily("맑은 고딕") |
19 | 19 |
font.setBold(False) |
... | ... | |
108 | 108 |
self.gridLayout_6.setObjectName("gridLayout_6") |
109 | 109 |
self.tableWidgetLoop = QtWidgets.QTableWidget(self.tabLoop) |
110 | 110 |
self.tableWidgetLoop.setFrameShape(QtWidgets.QFrame.StyledPanel) |
111 |
self.tableWidgetLoop.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustIgnored) |
|
111 | 112 |
self.tableWidgetLoop.setObjectName("tableWidgetLoop") |
112 | 113 |
self.tableWidgetLoop.setColumnCount(0) |
113 | 114 |
self.tableWidgetLoop.setRowCount(0) |
114 |
self.tableWidgetLoop.horizontalHeader().setVisible(False) |
|
115 |
self.tableWidgetLoop.verticalHeader().setVisible(False) |
|
116 | 115 |
self.gridLayout_6.addWidget(self.tableWidgetLoop, 0, 0, 1, 1) |
117 | 116 |
self.tabWidget.addTab(self.tabLoop, "") |
118 | 117 |
self.gridLayout_3.addWidget(self.tabWidget, 0, 0, 1, 1) |
... | ... | |
457 | 456 |
self.dockWidgetSymbolExplorer.setWindowTitle(_translate("MainWindow", "Symbol Explorer")) |
458 | 457 |
self.dockWidgetDrawingExplorer.setWindowTitle(_translate("MainWindow", "Drawing Explorer")) |
459 | 458 |
self.treeWidgetDrawingList.setSortingEnabled(True) |
460 |
self.dockWidgetHMBList.setWindowTitle(_translate("MainWindow", "HMB List"))
|
|
459 |
self.dockWidgetHMBList.setWindowTitle(_translate("MainWindow", "Calculation"))
|
|
461 | 460 |
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabStreamData), _translate("MainWindow", "Stream Data")) |
462 | 461 |
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabLoop), _translate("MainWindow", "Loop")) |
463 | 462 |
self.toolBar.setWindowTitle(_translate("MainWindow", "Main Toolbar")) |
HYTOS/HYTOS/Shapes/EngineeringConnectorItem.py | ||
---|---|---|
56 | 56 |
self.buildItem() |
57 | 57 |
self._direction = 'AUTO' |
58 | 58 |
self._symbol_idx = '0' |
59 |
self._spec_break = None |
|
60 | 59 |
self._connectedItem = None |
61 | 60 |
self._connected_at = QEngineeringAbstractItem.CONNECTED_AT_PT # default value is connected at pt |
62 | 61 |
self.connectPoint = None |
... | ... | |
104 | 103 |
self._nozzle_data = value |
105 | 104 |
|
106 | 105 |
@property |
106 |
def elevation(self): |
|
107 |
""" return elevation """ |
|
108 |
return self._nozzle_data.elevation |
|
109 |
|
|
110 |
@property |
|
111 |
def press_drop(self): |
|
112 |
return None |
|
113 |
|
|
114 |
@property |
|
107 | 115 |
def connectedItem(self): |
108 | 116 |
""" getter of connectedItem """ |
109 | 117 |
import uuid |
HYTOS/HYTOS/Shapes/EngineeringLoopItem.py | ||
---|---|---|
28 | 28 |
self._UID = None |
29 | 29 |
self._name = None |
30 | 30 |
self.items = _items |
31 |
self.press_drops = {} |
|
31 | 32 |
|
32 | 33 |
def __repr__(self): |
33 | 34 |
""" return string represent loop item """ |
... | ... | |
41 | 42 |
def name(self, value): |
42 | 43 |
self._name = value |
43 | 44 |
|
45 |
def calculate(self): |
|
46 |
""" calculate Pressure Drop (Static), Pressure @ Pipe end point of stream line """ |
|
47 |
|
|
48 |
try: |
|
49 |
for i in range(len(self.items) - 2, 0, -3): |
|
50 |
density2 = self.items[i].density |
|
51 |
el1 = self.items[i - 1].elevation |
|
52 |
el2 = self.items[i + 1].elevation |
|
53 |
stat_dp = (el2 - el1) * density2 / 1000 * 9.80665 / 101.325 #atm으로 계산된 dp |
|
54 |
self.press_drops[self.items[i - 1]] = stat_dp * 1.033 |
|
55 |
|
|
56 |
self.press_drops[self.items[i]] = self.items[i].press_drop |
|
57 |
except Exception as ex: |
|
58 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno) |
|
59 |
print('{}'.format(message)) |
|
60 |
|
|
44 | 61 |
class Transfer(QObject): |
45 | 62 |
onRemoved = pyqtSignal(QGraphicsItem) |
46 | 63 |
|
HYTOS/HYTOS/Shapes/EngineeringStreamlineItem.py | ||
---|---|---|
60 | 60 |
""" return string represents stream line item """ |
61 | 61 |
return 'Line_{}'.format(self._stream_no.toPlainText()) |
62 | 62 |
|
63 |
@property |
|
64 |
def density(self): |
|
65 |
""" return density """ |
|
66 |
return 1 |
|
67 |
|
|
68 |
@property |
|
69 |
def press_drop(self): |
|
70 |
""" return press drop """ |
|
71 |
return 0 |
|
72 |
|
|
63 | 73 |
def build_connectors(self, connected, pointsUids=None): |
64 | 74 |
""" build connectors for stream line |
65 | 75 |
connected is target connector |
HYTOS/HYTOS/UI/MainWindow.ui | ||
---|---|---|
7 | 7 |
<x>0</x> |
8 | 8 |
<y>0</y> |
9 | 9 |
<width>905</width> |
10 |
<height>557</height>
|
|
10 |
<height>574</height>
|
|
11 | 11 |
</rect> |
12 | 12 |
</property> |
13 | 13 |
<property name="font"> |
... | ... | |
167 | 167 |
<set>Qt::AllDockWidgetAreas</set> |
168 | 168 |
</property> |
169 | 169 |
<property name="windowTitle"> |
170 |
<string>HMB List</string>
|
|
170 |
<string>Calculation</string>
|
|
171 | 171 |
</property> |
172 | 172 |
<attribute name="dockWidgetArea"> |
173 | 173 |
<number>8</number> |
... | ... | |
205 | 205 |
<property name="frameShape"> |
206 | 206 |
<enum>QFrame::StyledPanel</enum> |
207 | 207 |
</property> |
208 |
<property name="sizeAdjustPolicy"> |
|
209 |
<enum>QAbstractScrollArea::AdjustIgnored</enum> |
|
210 |
</property> |
|
208 | 211 |
<attribute name="horizontalHeaderVisible"> |
209 | 212 |
<bool>false</bool> |
210 | 213 |
</attribute> |
내보내기 Unified diff