프로젝트

일반

사용자정보

개정판 d35a1a7e

IDd35a1a7e95608568d18c43bb7d73690db6d70b1f
상위 6a71c54a
하위 97b7dc5c

백흠경이(가) 4년 이상 전에 추가함

issue #1054: Mixed Type의 스트림 데이타 로딩 오류 수정(None이 'None' 으로 표기되어 오류 발생)

Change-Id: I6df411184cfd58536e8cda7200e56bd6e100481c

차이점 보기:

HYTOS/HYTOS/AppDocData.py
1061 1061

  
1062 1062
    def get_mixed_pressure_variation(self, uid):
1063 1063
        res = []
1064
        try:
1065
            # Creates or opens a file called mydb with a SQLite3 DB
1066
            dbPath = os.path.join(self.activeDrawing.path)
1067
            conn = sqlite3.connect(dbPath)
1068
            conn.execute('PRAGMA foreign_keys = ON')
1069
            conn.row_factory = sqlite3.Row
1070
            # Get a cursor object
1071
            cursor = conn.cursor()
1072 1064

  
1073
            sql = """select Element
1074
                          , Inside_Pipe_Size
1075
                          , Length
1076
                          , Angle
1077
                          , K
1078
                          , Pressure
1079
                          , Void
1080
                          , Quality
1081
                          , Density
1082
                          , Homo_Den
1083
                          , V_Den                          
1084
                          , Mean_Vel
1085
                          , Homo_Vel
1086
                          , Max_Vel
1087
                          , Ero_Vel
1088
                          , Pattern_X
1089
                          , Pattern_Y
1090
                          , Regime
1091
                          , Friction
1092
                          , Gravity
1093
                          , Momentum
1094
                          , Total
1095
                       from PressureVariation
1096
                      where Components_UID = ?
1097
                      order by rowid"""
1065
        # Creates or opens a file called mydb with a SQLite3 DB
1066
        db_path = os.path.join(self.activeDrawing.path)
1067
        with sqlite3.connect(db_path) as conn:
1068
            try:
1069
                conn.execute('PRAGMA foreign_keys = ON')
1070
                conn.row_factory = sqlite3.Row
1071
                # Get a cursor object
1072
                cursor = conn.cursor()
1098 1073

  
1099
            param = (uid,)
1100
            cursor.execute(sql, param)
1101
            rows = cursor.fetchall()
1102
            for row in rows:
1103
                res.append((row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10],
1104
                            row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20],
1105
                            row[21]))
1106
        # Catch the exception
1107
        except Exception as ex:
1108
            from App import App
1074
                sql = """select Element
1075
                              , Inside_Pipe_Size
1076
                              , Length
1077
                              , Angle
1078
                              , K
1079
                              , Pressure
1080
                              , Void
1081
                              , Quality
1082
                              , Density
1083
                              , Homo_Den
1084
                              , V_Den                          
1085
                              , Mean_Vel
1086
                              , Homo_Vel
1087
                              , Max_Vel
1088
                              , Ero_Vel
1089
                              , Pattern_X
1090
                              , Pattern_Y
1091
                              , Regime
1092
                              , Friction
1093
                              , Gravity
1094
                              , Momentum
1095
                              , Total
1096
                           from PressureVariation
1097
                          where Components_UID = ?
1098
                          order by rowid"""
1109 1099

  
1110
            # Roll back any change if something goes wrong
1111
            conn.rollback()
1100
                param = (uid,)
1101
                cursor.execute(sql, param)
1102
                rows = cursor.fetchall()
1103
                for row in rows:
1104
                    res.append((row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10],
1105
                                row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19], row[20],
1106
                                row[21]))
1107
            # Catch the exception
1108
            except Exception as ex:
1109
                from App import App
1112 1110

  
1113
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
1114
                                                           sys.exc_info()[-1].tb_lineno)
1115
            App.mainWnd().addMessage.emit(MessageType.Error, message)
1111
                # Roll back any change if something goes wrong
1112
                conn.rollback()
1116 1113

  
1117
        finally:
1118
            # Close the db connection
1119
            conn.close()
1114
                message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
1115
                          f"{sys.exc_info()[-1].tb_lineno}"
1116
                App.mainWnd().addMessage.emit(MessageType.Error, message)
1120 1117

  
1121 1118
        return res
1122 1119

  
1123 1120
    def get_geometry_input(self, uid):
1124 1121
        res = []
1125
        try:
1126
            # Creates or opens a file called mydb with a SQLite3 DB
1127
            dbPath = os.path.join(self.activeDrawing.path)
1128
            conn = sqlite3.connect(dbPath)
1129
            conn.execute('PRAGMA foreign_keys = ON')
1130
            conn.row_factory = sqlite3.Row
1131
            # Get a cursor object
1132
            cursor = conn.cursor()
1133 1122

  
1134
            sql = """select Element
1135
                          , Nominal_Pipe_Size
1136
                          , Schedule_No
1137
                          , Inside_Pipe_Size
1138
                          , Roughness
1139
                          , Length
1140
                          , Angle
1141
                          , RPD
1142
                          , D1_D2
1143
                          , K
1144
                       from Geometry_Input
1145
                      where Components_UID = ?
1146
                      order by rowid"""
1123
        # Creates or opens a file called mydb with a SQLite3 DB
1124
        db_path = os.path.join(self.activeDrawing.path)
1125
        with sqlite3.connect(db_path) as conn:
1126
            try:
1127
                conn.execute('PRAGMA foreign_keys = ON')
1128
                conn.row_factory = sqlite3.Row
1129
                # Get a cursor object
1130
                cursor = conn.cursor()
1147 1131

  
1148
            param = (uid,)
1149
            cursor.execute(sql, param)
1150
            rows = cursor.fetchall()
1151
            for row in rows:
1152
                res.append((row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9]))
1153
        # Catch the exception
1154
        except Exception as ex:
1155
            from App import App
1132
                sql = """select Element
1133
                              , Nominal_Pipe_Size
1134
                              , Schedule_No
1135
                              , Inside_Pipe_Size
1136
                              , Roughness
1137
                              , Length
1138
                              , Angle
1139
                              , RPD
1140
                              , D1_D2
1141
                              , K
1142
                           from Geometry_Input
1143
                          where Components_UID = ?
1144
                          order by rowid"""
1156 1145

  
1157
            # Roll back any change if something goes wrong
1158
            conn.rollback()
1146
                param = (uid,)
1147
                cursor.execute(sql, param)
1148
                rows = cursor.fetchall()
1149
                for row in rows:
1150
                    res.append((row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9]))
1151
            # Catch the exception
1152
            except Exception as ex:
1153
                from App import App
1159 1154

  
1160
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
1161
                                                           sys.exc_info()[-1].tb_lineno)
1162
            App.mainWnd().addMessage.emit(MessageType.Error, message)
1155
                # Roll back any change if something goes wrong
1156
                conn.rollback()
1163 1157

  
1164
        finally:
1165
            # Close the db connection
1166
            conn.close()
1158
                message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
1159
                          f"{sys.exc_info()[-1].tb_lineno}"
1160
                App.mainWnd().addMessage.emit(MessageType.Error, message)
1167 1161

  
1168 1162
        return res
1169 1163

  
HYTOS/HYTOS/Calculation.py
2669 2669

  
2670 2670
            # '100m 당 압력강하를 상당길이에 맞춰서 전체 압력강하로 넣어줌 ..
2671 2671
            self._hmb.pressure_drop_friction = round(self._hmb.pressure_drop / 100 * self._hmb.equivalent_length, 3)
2672

  
2673 2672
        except Exception as ex:
2674

  
2675
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
2676
                                                           sys.exc_info()[-1].tb_lineno)
2673
            message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \
2674
                      f"{sys.exc_info()[-1].tb_lineno}"
2677 2675
            App.mainWnd().addMessage.emit(MessageType.Error, message)
2678 2676

  
2679 2677
    def liquid_calc_hagen(self):
HYTOS/HYTOS/GeometryData_MixedDialog.py
295 295
    def on_current_index_changed(self, index):
296 296
        """angle combobox's index is changed"""
297 297

  
298
        angle = self.ui.comboBoxAngle.model().item(index, 1).text()
299
        self.ui.lineEdit_Angle.setText(angle)
298
        if index >= 0:
299
            angle = self.ui.comboBoxAngle.model().item(index, 1).text()
300
            self.ui.lineEdit_Angle.setText(angle)
300 301

  
301 302
    def show_help_dialog(self):
302 303

  
HYTOS/HYTOS/StreamDataDialog.py
24 24

  
25 25

  
26 26
def set_item_properties(name, alignment, color=None):
27
    item = QTableWidgetItem(str(name))
27
    """create a tablewidget item"""
28

  
29
    item = QTableWidgetItem(str(name) if name is not None else None)
28 30
    item.setTextAlignment(alignment)
29 31
    if color:
30 32
        item.setBackground(color)
......
1266 1268
            else:
1267 1269
                self.ui.comboBox_Nominal_Pipe_Size.addItem(str(convert_to_fixed_point(nominalDiameter[2])),
1268 1270
                                                           nominalDiameter[0])
1269
        self.ui.comboBox_Nominal_Pipe_Size.setCurrentIndex(-1)
1271
        self.ui.comboBox_Nominal_Pipe_Size.setCurrentIndex(0)
1270 1272

  
1271 1273
    def init_schedule(self):
1272 1274
        from AppDocData import AppDocData
......
1304 1306
                    row_count = self.ui.tableWidget_GeometryData_Mixed.rowCount()
1305 1307

  
1306 1308
                    self.ui.tableWidget_GeometryData_Mixed.setRowCount(row_count + 1)
1307

  
1308 1309
                    self.ui.tableWidget_GeometryData_Mixed.setItem(row_count, 0,
1309 1310
                                                                   set_item_properties(row[0],
1310 1311
                                                                                       Qt.AlignLeft | Qt.AlignVCenter))
HYTOS/HYTOS/StreamData_UI.py
2 2

  
3 3
# Form implementation generated from reading ui file '.\UI\StreamData.ui'
4 4
#
5
# Created by: PyQt5 UI code generator 5.13.1
5
# Created by: PyQt5 UI code generator 5.15.0
6 6
#
7
# WARNING! All changes made in this file will be lost!
7
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
8
# run again.  Do not edit this file unless you know what you are doing.
8 9

  
9 10

  
10 11
from PyQt5 import QtCore, QtGui, QtWidgets
......
1259 1260
        self.label_Roughness_Unit.setText(_translate("Dialog", "-"))
1260 1261
        self.label_27.setText(_translate("Dialog", "Straight Length :"))
1261 1262
        self.label_Straight_Lengh_Unit.setText(_translate("Dialog", "-"))
1262
        self.label_7.setText(_translate("Dialog", "Equiv. Lenght (Input) :"))
1263
        self.label_7.setText(_translate("Dialog", "Equiv. Length (Input) :"))
1263 1264
        self.label_Equivalent_Lenght_Input_Unit.setText(_translate("Dialog", "-"))
1264 1265
        self.pushButton_1_2.setText(_translate("Dialog", "x 1.2"))
1265 1266
        self.pushButton_1_5.setText(_translate("Dialog", "x 1.5"))
HYTOS/HYTOS/UI/StreamData.ui
454 454
         </font>
455 455
        </property>
456 456
        <property name="text">
457
         <string>Equiv. Lenght (Input) :</string>
457
         <string>Equiv. Length (Input) :</string>
458 458
        </property>
459 459
        <property name="alignment">
460 460
         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
readme.html
37 37
			<td style="padding-left: 5px; font-weight: bold;" colspan="2"><font color="white" size="3">CHANGES</font></td>
38 38
		</tr>
39 39

  
40
		<tr><td style="tr-title" colspan="2" bgcolor=lightgray><B>3.0.8.0 [2020.09.10]</B></td></tr>
41
		<tr><td class="filesChanged">1.</td><td>Mixed Type의 스트림 데이타 로딩 오류 수정</td></tr>	
42
		
43
		<tr><td style="tr-title" colspan="2" bgcolor=lightgray><B>3.0.7.0 [2020.09.02]</B></td></tr>
44
		<tr><td class="filesChanged">1.</td><td>펌프 헤드가 입력이 안되어있는 경우에만 CV의 DP값을 보정</td></tr>	
45
		
40 46
		<tr><td style="tr-title" colspan="2" bgcolor=lightgray><B>3.0.6.0 [2020.08.20]</B></td></tr>
41 47
		<tr><td class="filesChanged">1.</td><td>계산 결과 Output 데이타를 저장하도록 수정</td></tr>
42 48
		<tr><td class="filesChanged">2.</td><td>readme.html 포함</td></tr>
......
45 51
		<tr><td class="filesChanged">1.</td><td>Control Valve DP 계산 수정</td></tr>
46 52
		<tr><td class="filesChanged">2.</td><td>계산 오류시 X 표시는 하지 않도록 수정</td></tr>
47 53
		<tr><td class="filesChanged">3.</td><td>Control Valve 데이터가 없을 시 발생 오류 수정</td></tr>
48
		<tr><td class="filesChanged">4.</td><td>열교환기 오류(Loop 생성 시 열교환기를 Line Splitter처럼 처리) 수정</td></tr>    
49
		
50
		<tr><td style="tr-title" colspan="2" bgcolor=lightgray><B>3.0.7.0 [2020.09.02]</B></td></tr>
51
		<tr><td class="filesChanged">1.</td><td>펌프 헤드가 입력이 안되어있는 경우에만 CV의 DP값을 보정</td></tr>		
54
		<tr><td class="filesChanged">4.</td><td>열교환기 오류(Loop 생성 시 열교환기를 Line Splitter처럼 처리) 수정</td></tr>    		
52 55
	</table>
53 56
</BODY>
54 57
</html>

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)