프로젝트

일반

사용자정보

개정판 db9be920

IDdb9be92075173c9db7d7fbe2195e073bc1b52d1c
상위 45254cf5
하위 fdd269a0, 6f6007ad

김연진이(가) 약 5년 전에 추가함

issue #1201 : 2 Phase 계산식

Change-Id: I8765ec316f0b1883eb2ecf2d5a48eea00111bdb2

차이점 보기:

HYTOS/HYTOS/GeometryData_MixedDialog.py
116 116

  
117 117
    def element_change_event(self, index):
118 118
        try:
119
            self.ui.comboBox_Nominal_Pipe_Size.setCurrentIndex(-1)
120
            self.ui.comboBox_Schedule_No.setCurrentIndex(-1)
121
            self.ui.lineEdit_Inside_Pipe_Size.setEnabled(True)
122
            self.ui.lineEdit_Inside_Pipe_Size.clear()
123
            self.ui.lineEdit_Roughness.clear()
119
            # self.ui.comboBox_Nominal_Pipe_Size.setCurrentIndex(-1)
120
            # self.ui.comboBox_Schedule_No.setCurrentIndex(-1)
121
            # self.ui.lineEdit_Inside_Pipe_Size.setEnabled(True)
122
            # self.ui.lineEdit_Inside_Pipe_Size.clear()
123
            # self.ui.lineEdit_Roughness.clear()
124

  
124 125
            self.ui.lineEdit_Length.setEnabled(True)
125 126
            self.ui.lineEdit_Length.clear()
126 127
            self.ui.pushButton_Angle.setEnabled(True)
HYTOS/HYTOS/Shapes/EngineeringLoopItem.py
48 48
        self.total_suction_loss = None
49 49
        self.total_discharge_loss = None
50 50

  
51
        self.fill_start = None
51
        self.fill_start = 0
52 52
        self.fill_end = None
53 53

  
54 54
    def __repr__(self):
......
98 98
                                                                               self.items[self.fill_start + 2]] - \
99 99
                                                                           self.pressures[
100 100
                                                                               self.items[self.fill_start + 1]]
101
            else:
102
                self.loss_input()
101 103
        except Exception as ex:
102 104
            from App import App
103 105
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
......
303 305

  
304 306
    def discharge_cal(self):
305 307
        try:
306
            for i in range(len(self.items) - 2, 1, -3):  # backward
307
                self.discharge_den(i)  # (1) density 입력
308
                self.discharge_static_cal(i)  # (2) static P를 계산
308
            if len(self.items) == 3:
309
                # 장치 2개와 Line 1개로 구성된 경우
310
                self.discharge_den(1)  # (1) density 입력
311
                self.discharge_static_cal(1)  # (2) static P를 계산
309 312

  
310 313
                # (3) pressure drop 계산
311 314
                # liquid 인 경우 stream 시트로부터 del.P를 입력해줌.
312 315
                # vapor인 경우 압력강하를 계산해주고 넣어주는 모듈
313
                if self.items[i].data.phase_type == 'Liquid' or self.items[i].data.phase_type == 'Mixed':
314
                    self.pressure_drops[self.items[i]] = self.items[i].data.pressure_drop_friction
315
                    asd = self.discharge_p_cal(i)
316
                    if asd == 0:
317
                        break
318
                elif self.items[i].data.phase_type == 'Vapor':
319
                    self.discharge_vapor_factor_length(i)
320
                    asd = self.discharge_p_cal(i)
321
                    if asd == 0:
322
                        break
316
                if self.items[1].data.phase_type == 'Liquid' or self.items[1].data.phase_type == 'Mixed':
317
                    self.pressure_drops[self.items[1]] = self.items[1].data.pressure_drop_friction
318
                    self.discharge_p_cal(1)
319

  
320
                elif self.items[1].data.phase_type == 'Vapor':
321
                    self.discharge_vapor_factor_length(1)
322
                    self.discharge_p_cal(1)
323 323

  
324
            self.fill_end = i
324
                self.fill_end = 3
325
            else:
326
                for i in range(len(self.items) - 2, 1, -3):  # backward
327
                    self.discharge_den(i)  # (1) density 입력
328
                    self.discharge_static_cal(i)  # (2) static P를 계산
329

  
330
                    # (3) pressure drop 계산
331
                    # liquid 인 경우 stream 시트로부터 del.P를 입력해줌.
332
                    # vapor인 경우 압력강하를 계산해주고 넣어주는 모듈
333
                    if self.items[i].data.phase_type == 'Liquid' or self.items[i].data.phase_type == 'Mixed':
334
                        self.pressure_drops[self.items[i]] = self.items[i].data.pressure_drop_friction
335
                        asd = self.discharge_p_cal(i)
336
                        if asd == 0:
337
                            break
338
                    elif self.items[i].data.phase_type == 'Vapor':
339
                        self.discharge_vapor_factor_length(i)
340
                        asd = self.discharge_p_cal(i)
341
                        if asd == 0:
342
                            break
343

  
344
                self.fill_end = i
325 345
        except Exception as ex:
326 346
            from App import App
327 347
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
......
904 924
        """ (2) static P를 계산 """
905 925

  
906 926
        try:
907
            # 1. density 받음
908 927
            if self.items[i].data.phase_type == 'Mixed':
909
                pass  # TODO:
928
                self.pressure_drops[self.items[i - 1]] = self.items[i].data.pressure_drop_static
910 929
            else:
930
                # 1. density 받음
911 931
                density_unit = self.units['Density']
912 932
                if density_unit == 'kg/m3':
913 933
                    density2 = self.density_elevations[self.items[i]]
914 934
                else:
915 935
                    density2 = self.density_elevations[self.items[i]] * 16.0185  # lb/ft3
916 936

  
917
            # 2 elevation 받음
918
            length_unit = self.units['Length']
919
            if length_unit == 'm':
920
                el1 = self.density_elevations[self.items[i - 1]]
921
                el2 = self.density_elevations[self.items[i + 1]]
922
            elif length_unit == 'in':
923
                el1 = self.density_elevations[self.items[i - 1]] * 0.0254
924
                el2 = self.density_elevations[self.items[i + 1]] * 0.0254
925
            elif length_unit == 'ft':
926
                el1 = self.density_elevations[self.items[i - 1]] * 0.3048
927
                el2 = self.density_elevations[self.items[i + 1]] * 0.3048
928
            elif length_unit == 'yd':
929
                el1 = self.density_elevations[self.items[i - 1]] * 0.9144
930
                el2 = self.density_elevations[self.items[i + 1]] * 0.9144
931
            elif length_unit == 'mm':
932
                el1 = self.density_elevations[self.items[i - 1]] * 0.001
933
                el2 = self.density_elevations[self.items[i + 1]] * 0.001
934
            else:  # mile
935
                el1 = self.density_elevations[self.items[i - 1]] * 1609.34
936
                el2 = self.density_elevations[self.items[i + 1]] * 1609.34
937
                # 2 elevation 받음
938
                length_unit = self.units['Length']
939
                if length_unit == 'm':
940
                    el1 = self.density_elevations[self.items[i - 1]]
941
                    el2 = self.density_elevations[self.items[i + 1]]
942
                elif length_unit == 'in':
943
                    el1 = self.density_elevations[self.items[i - 1]] * 0.0254
944
                    el2 = self.density_elevations[self.items[i + 1]] * 0.0254
945
                elif length_unit == 'ft':
946
                    el1 = self.density_elevations[self.items[i - 1]] * 0.3048
947
                    el2 = self.density_elevations[self.items[i + 1]] * 0.3048
948
                elif length_unit == 'yd':
949
                    el1 = self.density_elevations[self.items[i - 1]] * 0.9144
950
                    el2 = self.density_elevations[self.items[i + 1]] * 0.9144
951
                elif length_unit == 'mm':
952
                    el1 = self.density_elevations[self.items[i - 1]] * 0.001
953
                    el2 = self.density_elevations[self.items[i + 1]] * 0.001
954
                else:  # mile
955
                    el1 = self.density_elevations[self.items[i - 1]] * 1609.34
956
                    el2 = self.density_elevations[self.items[i + 1]] * 1609.34
937 957

  
938
            # 3. static head 계산
939
            stat_dp = (el2 - el1) * density2 / 1000 * 9.80665 / 101.325  # atm으로 계산된 dp
958
                # 3. static head 계산
959
                stat_dp = (el2 - el1) * density2 / 1000 * 9.80665 / 101.325  # atm으로 계산된 dp
940 960

  
941
            # 4. 압력 유닛에 맞춰 뿌리기
942
            pressure_unit = self.units['Pressure']
943
            if pressure_unit == 'kg/cm2':
944
                self.pressure_drops[self.items[i - 1]] = stat_dp * 1.033
945
            elif pressure_unit == 'psi':
946
                self.pressure_drops[self.items[i - 1]] = stat_dp * 14.7
947
            elif pressure_unit == 'atm':
948
                self.pressure_drops[self.items[i - 1]] = stat_dp
949
            elif pressure_unit == 'bar':
950
                self.pressure_drops[self.items[i - 1]] = stat_dp * 1.013
951
            elif pressure_unit == 'mmHg':
952
                self.pressure_drops[self.items[i - 1]] = stat_dp * 760
953
            elif pressure_unit == 'kPa':
954
                self.pressure_drops[self.items[i - 1]] = stat_dp * 101.325
955
            elif pressure_unit == 'MPa':
956
                self.pressure_drops[self.items[i - 1]] = stat_dp * 0.101325
961
                # 4. 압력 유닛에 맞춰 뿌리기
962
                pressure_unit = self.units['Pressure']
963
                if pressure_unit == 'kg/cm2':
964
                    self.pressure_drops[self.items[i - 1]] = stat_dp * 1.033
965
                elif pressure_unit == 'psi':
966
                    self.pressure_drops[self.items[i - 1]] = stat_dp * 14.7
967
                elif pressure_unit == 'atm':
968
                    self.pressure_drops[self.items[i - 1]] = stat_dp
969
                elif pressure_unit == 'bar':
970
                    self.pressure_drops[self.items[i - 1]] = stat_dp * 1.013
971
                elif pressure_unit == 'mmHg':
972
                    self.pressure_drops[self.items[i - 1]] = stat_dp * 760
973
                elif pressure_unit == 'kPa':
974
                    self.pressure_drops[self.items[i - 1]] = stat_dp * 101.325
975
                elif pressure_unit == 'MPa':
976
                    self.pressure_drops[self.items[i - 1]] = stat_dp * 0.101325
957 977
        except Exception as ex:
958 978
            from App import App
959 979
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
HYTOS/HYTOS/StreamDataDialog.py
461 461

  
462 462
            table.setRowCount(row_count + 1)
463 463

  
464
            table.setItem(row_count, 0, set_table_widget_item_properties(row[0], Qt.AlignHCenter | Qt.AlignVCenter))
465
            table.setItem(row_count, 1, set_table_widget_item_properties(row[1], Qt.AlignLeft | Qt.AlignVCenter))
466
            table.setItem(row_count, 2, set_table_widget_item_properties(row[2], Qt.AlignRight | Qt.AlignVCenter))
467
            table.setItem(row_count, 3, set_table_widget_item_properties(row[3], Qt.AlignRight | Qt.AlignVCenter))
468
            table.setItem(row_count, 4, set_table_widget_item_properties(row[4], Qt.AlignRight | Qt.AlignVCenter))
469
            table.setItem(row_count, 5, set_table_widget_item_properties(row[5], Qt.AlignRight | Qt.AlignVCenter))
470
            table.setItem(row_count, 6, set_table_widget_item_properties(row[6], Qt.AlignRight | Qt.AlignVCenter))
471
            table.setItem(row_count, 7, set_table_widget_item_properties(row[7], Qt.AlignRight | Qt.AlignVCenter))
472
            table.setItem(row_count, 8, set_table_widget_item_properties(row[8], Qt.AlignRight | Qt.AlignVCenter))
473
            table.setItem(row_count, 9, set_table_widget_item_properties(row[9], Qt.AlignRight | Qt.AlignVCenter))
474
            table.setItem(row_count, 10, set_table_widget_item_properties(row[10], Qt.AlignRight | Qt.AlignVCenter))
475
            table.setItem(row_count, 11, set_table_widget_item_properties(row[11], Qt.AlignRight | Qt.AlignVCenter))
476
            table.setItem(row_count, 12, set_table_widget_item_properties(row[12], Qt.AlignRight | Qt.AlignVCenter))
477
            table.setItem(row_count, 13, set_table_widget_item_properties(row[13], Qt.AlignRight | Qt.AlignVCenter))
478
            table.setItem(row_count, 14, set_table_widget_item_properties(row[14], Qt.AlignRight | Qt.AlignVCenter))
479
            table.setItem(row_count, 15, set_table_widget_item_properties(row[15], Qt.AlignRight | Qt.AlignVCenter))
480
            table.setItem(row_count, 16, set_table_widget_item_properties(row[16], Qt.AlignLeft | Qt.AlignVCenter))
481
            table.setItem(row_count, 17, set_table_widget_item_properties(row[17], Qt.AlignRight | Qt.AlignVCenter))
482
            table.setItem(row_count, 18, set_table_widget_item_properties(row[18], Qt.AlignRight | Qt.AlignVCenter))
483
            table.setItem(row_count, 19, set_table_widget_item_properties(row[19], Qt.AlignRight | Qt.AlignVCenter))
484
            table.setItem(row_count, 20, set_table_widget_item_properties(row[20], Qt.AlignRight | Qt.AlignVCenter))
464
            table.setItem(row_count, 0, set_table_widget_item_properties(row[0], Qt.AlignHCenter | Qt.AlignVCenter)) # No
465
            table.setItem(row_count, 1, set_table_widget_item_properties(row[1], Qt.AlignLeft | Qt.AlignVCenter))   # Element
466
            table.setItem(row_count, 2, set_table_widget_item_properties(row[2], Qt.AlignRight | Qt.AlignVCenter))  # Inside Diameter
467
            table.setItem(row_count, 3, set_table_widget_item_properties(row[3], Qt.AlignRight | Qt.AlignVCenter))  # Length
468
            table.setItem(row_count, 4, set_table_widget_item_properties(row[4], Qt.AlignRight | Qt.AlignVCenter))  # Angle
469
            table.setItem(row_count, 5, set_table_widget_item_properties(row[5], Qt.AlignRight | Qt.AlignVCenter))  # K
470
            table.setItem(row_count, 6, set_table_widget_item_properties(row[6], Qt.AlignRight | Qt.AlignVCenter))  # Pressure
471
            table.setItem(row_count, 7, set_table_widget_item_properties(row[7], Qt.AlignRight | Qt.AlignVCenter))  # Void
472
            table.setItem(row_count, 8, set_table_widget_item_properties(row[8], Qt.AlignRight | Qt.AlignVCenter))  # Quality
473
            table.setItem(row_count, 9, set_table_widget_item_properties(row[9], Qt.AlignRight | Qt.AlignVCenter))  # Density
474
            table.setItem(row_count, 10, set_table_widget_item_properties(row[10], Qt.AlignRight | Qt.AlignVCenter))    # V.Den
475
            table.setItem(row_count, 11, set_table_widget_item_properties(row[11], Qt.AlignRight | Qt.AlignVCenter))    # Mean Vel
476
            table.setItem(row_count, 12, set_table_widget_item_properties(row[12], Qt.AlignRight | Qt.AlignVCenter))    # Max Vel
477
            table.setItem(row_count, 13, set_table_widget_item_properties(row[13], Qt.AlignRight | Qt.AlignVCenter))    # Ero Vel
478
            table.setItem(row_count, 14, set_table_widget_item_properties(row[14], Qt.AlignRight | Qt.AlignVCenter))    # X
479
            table.setItem(row_count, 15, set_table_widget_item_properties(row[15], Qt.AlignRight | Qt.AlignVCenter))    # Y
480
            table.setItem(row_count, 16, set_table_widget_item_properties(row[16], Qt.AlignLeft | Qt.AlignVCenter)) # Regime
481
            table.setItem(row_count, 17, set_table_widget_item_properties(row[17], Qt.AlignRight | Qt.AlignVCenter))    #Friction
482
            table.setItem(row_count, 18, set_table_widget_item_properties(row[18], Qt.AlignRight | Qt.AlignVCenter))    # Gravity
483
            table.setItem(row_count, 19, set_table_widget_item_properties(row[19], Qt.AlignRight | Qt.AlignVCenter))    # Momentum
484
            table.setItem(row_count, 20, set_table_widget_item_properties(row[20], Qt.AlignRight | Qt.AlignVCenter))    # Total
485 485

  
486 486
        table.resizeColumnsToContents()
487 487
        table.resizeRowsToContents()
......
539 539

  
540 540
        try:
541 541
            row_count = self.ui.tableWidget_GeometryData_Mixed.rowCount()
542

  
543
            data = self.get_data(row_count - 1) if row_count > 0 else None
544

  
542 545
            dialog = QGeometryData_MixedDialog()
543 546
            (
544 547
                isAccepted, element, nominal_pipe_size, schedule_no, inside_pipe_size, roughness, length, angle, rpd,
545 548
                d1_d2,
546
                k) = dialog.show_dialog(row_count)
549
                k) = dialog.show_dialog(row_count, data)
547 550

  
548 551
            if isAccepted:
549 552
                self.ui.tableWidget_GeometryData_Mixed.setRowCount(row_count + 1)

내보내기 Unified diff

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