프로젝트

일반

사용자정보

개정판 eeb25a23

IDeeb25a239f89a15127422a844ce1411dfeeb6fcc
상위 c2a462bc
하위 9661a533, dead731d

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

issue #1049 : 옵션 창 및 기능 : Control Valve Equation 적용

Change-Id: Iae284395cd82390c244ec354b4e0ad06b3b40bb9

차이점 보기:

HYTOS/HYTOS/AppDocData.py
1460 1460
        with conn:
1461 1461
            conn.row_factory = sqlite3.Row
1462 1462
            cursor = conn.cursor()
1463
            sql = 'select Pressure, Pressure_Drop, Elevation, Over_Design_CV from Nozzles where Points_UID=?'
1463
            sql = 'select Pressure, Pressure_Drop, Elevation, Over_Design_CV, CV_Type from Nozzles where Points_UID=?'
1464 1464
            param = (uid,)
1465 1465
            cursor.execute(sql, param)
1466 1466
            rows = cursor.fetchall()
HYTOS/HYTOS/Calculation.py
572 572
            items = [item for item in self.graphicsView.scene.items() if type(item) is SymbolSvgItem]
573 573
            for item in items:
574 574
                for connector in item.connectors:
575
                    if connector.data.pressure:
576
                        connector.data.pressure = self.convert_pressure(connector.data.pressure)
577
                    if connector.data.pressure_drop:
578
                        connector.data.pressure_drop = self.convert_pressure(connector.data.pressure_drop)
579
                    if connector.data.elevation:
580
                        connector.data.elevation = self.convert_length(connector.data.elevation)
575
                    if connector.data:
576
                        if connector.data.pressure:
577
                            connector.data.pressure = self.convert_pressure(connector.data.pressure)
578
                        if connector.data.pressure_drop:
579
                            connector.data.pressure_drop = self.convert_pressure(connector.data.pressure_drop)
580
                        if connector.data.elevation:
581
                            connector.data.elevation = self.convert_length(connector.data.elevation)
582

  
581 583
        except Exception as ex:
582 584
            from App import App
583 585
            from AppDocData import MessageType
HYTOS/HYTOS/ConfigurationDialog.py
58 58

  
59 59
    def select_equation(self):
60 60
        if self.sender() == self.ui.radioButton_BD:
61
            self.ui.groupBox_DB.setVisible(True)
61
            self.ui.groupBox_BD.setVisible(True)
62 62
            self.ui.groupBox_Lummus.setVisible(False)
63 63
            self.ui.groupBox_Mixed.setVisible(False)
64 64
            self.ui.groupBox_Aramco.setVisible(False)
65
            self.ui.groupBox_User.setVisible(False)
65 66
        elif self.sender() == self.ui.radioButton_Lummus:
66
            self.ui.groupBox_DB.setVisible(False)
67
            self.ui.groupBox_BD.setVisible(False)
67 68
            self.ui.groupBox_Lummus.setVisible(True)
68 69
            self.ui.groupBox_Mixed.setVisible(False)
69 70
            self.ui.groupBox_Aramco.setVisible(False)
71
            self.ui.groupBox_User.setVisible(False)
70 72
        elif self.sender() == self.ui.radioButton_Mixed:
71
            self.ui.groupBox_DB.setVisible(False)
73
            self.ui.groupBox_BD.setVisible(False)
72 74
            self.ui.groupBox_Lummus.setVisible(False)
73 75
            self.ui.groupBox_Mixed.setVisible(True)
74 76
            self.ui.groupBox_Aramco.setVisible(False)
77
            self.ui.groupBox_User.setVisible(False)
75 78
        elif self.sender() == self.ui.radioButton_Aramco:
76
            self.ui.groupBox_DB.setVisible(False)
79
            self.ui.groupBox_BD.setVisible(False)
77 80
            self.ui.groupBox_Lummus.setVisible(False)
78 81
            self.ui.groupBox_Mixed.setVisible(False)
79 82
            self.ui.groupBox_Aramco.setVisible(True)
83
            self.ui.groupBox_User.setVisible(False)
80 84
        elif self.sender() == self.ui.radioButton_User:
81
            pass
85
            self.ui.groupBox_BD.setVisible(False)
86
            self.ui.groupBox_Lummus.setVisible(False)
87
            self.ui.groupBox_Mixed.setVisible(False)
88
            self.ui.groupBox_Aramco.setVisible(False)
89
            self.ui.groupBox_User.setVisible(True)
82 90

  
83
    def showDialog(self):
91
    def show_dialog(self):
84 92
        self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint)
85 93

  
86 94
        self.load_data()
......
181 189

  
182 190
            self.ui.comboBox_Decimal.setCurrentIndex(9)
183 191

  
192
            # Font Color
193
            self.ui.label_Suction_Dynamic_Loss.setStyleSheet('QLabel {color: blue;}')
194
            self.ui.label_Suction_Fixed_Loss.setStyleSheet('QLabel {color: blue;}')
195
            self.ui.label_Discharge_Dynamic_Loss.setStyleSheet('QLabel {color: blue;}')
196
            self.ui.label_Discharge_Fixed_Loss.setStyleSheet('QLabel {color: blue;}')
197
            self.ui.label_Start_Equipment_Pressure.setStyleSheet('QLabel {color: blue;}')
198
            self.ui.label_Destination_Equipment_Pressure.setStyleSheet('QLabel {color: blue;}')
199
            self.ui.label_Over_Design_Ratio.setStyleSheet('QLabel {color: blue;}')
200

  
201
            self.ui.label_A_Desc.setStyleSheet('QLabel {color: green;}')
202
            self.ui.label_B_Desc.setStyleSheet('QLabel {color: green;}')
203
            self.ui.label_C_Desc.setStyleSheet('QLabel {color: green;}')
204
            self.ui.label_D_Desc.setStyleSheet('QLabel {color: green;}')
205
            self.ui.label_G_Desc.setStyleSheet('QLabel {color: green;}')
206

  
207
            # Default Equation
208
            self.ui.lineEdit_1st_Equation.setText('((1.05*G)**2-1)*(A+C)')
209
            self.ui.lineEdit_2nd_Equation.setText('0.33*(A+C)')
210
            self.ui.lineEdit_3rd_Equation.setText('0.7')
211

  
184 212
        except Exception as ex:
185 213
            from App import App
186 214
            from AppDocData import MessageType
......
245 273
                if len(equation) == 1:
246 274
                    if equation[0].value == 'bd':
247 275
                        self.ui.radioButton_BD.setChecked(True)
248
                        self.ui.groupBox_DB.setVisible(True)
276
                        self.ui.groupBox_BD.setVisible(True)
249 277
                        self.ui.groupBox_Lummus.setVisible(False)
250 278
                        self.ui.groupBox_Mixed.setVisible(False)
251 279
                        self.ui.groupBox_Aramco.setVisible(False)
280
                        self.ui.groupBox_User.setVisible(False)
252 281
                    elif equation[0].value == 'lummus':
253 282
                        self.ui.radioButton_Lummus.setChecked(True)
254
                        self.ui.groupBox_DB.setVisible(False)
283
                        self.ui.groupBox_BD.setVisible(False)
255 284
                        self.ui.groupBox_Lummus.setVisible(True)
256 285
                        self.ui.groupBox_Mixed.setVisible(False)
257 286
                        self.ui.groupBox_Aramco.setVisible(False)
287
                        self.ui.groupBox_User.setVisible(False)
258 288
                    elif equation[0].value == 'mixed':
259 289
                        self.ui.radioButton_Mixed.setChecked(True)
260
                        self.ui.groupBox_DB.setVisible(False)
290
                        self.ui.groupBox_BD.setVisible(False)
261 291
                        self.ui.groupBox_Lummus.setVisible(False)
262 292
                        self.ui.groupBox_Mixed.setVisible(True)
263 293
                        self.ui.groupBox_Aramco.setVisible(False)
294
                        self.ui.groupBox_User.setVisible(False)
264 295
                    elif equation[0].value == 'aramco':
265 296
                        self.ui.radioButton_Aramco.setChecked(True)
266
                        self.ui.radioButton_Mixed.setChecked(True)
267
                        self.ui.groupBox_DB.setVisible(False)
297
                        self.ui.groupBox_BD.setVisible(False)
268 298
                        self.ui.groupBox_Lummus.setVisible(False)
269 299
                        self.ui.groupBox_Mixed.setVisible(False)
270 300
                        self.ui.groupBox_Aramco.setVisible(True)
301
                        self.ui.groupBox_User.setVisible(False)
271 302
                    elif equation[0].value == 'user':
272 303
                        self.ui.radioButton_User.setChecked(True)
304
                        self.ui.groupBox_BD.setVisible(False)
305
                        self.ui.groupBox_Lummus.setVisible(False)
306
                        self.ui.groupBox_Mixed.setVisible(False)
307
                        self.ui.groupBox_Aramco.setVisible(False)
308
                        self.ui.groupBox_User.setVisible(True)
309

  
310
                # User Equation
311
                user_equation = app_doc_data.getConfigs('User Equation')
312
                if len(user_equation) > 0:
313
                    for i in range(len(user_equation)):
314
                        key = user_equation[i].key
315
                        val = user_equation[i].value
316

  
317
                        if key == '1st':
318
                            self.ui.lineEdit_1st_Equation.setText(val)
319
                        elif key == '2nd':
320
                            self.ui.lineEdit_2nd_Equation.setText(val)
321
                        elif key == '3rd':
322
                            self.ui.lineEdit_3rd_Equation.setText(val)
323
                        elif key == '4th':
324
                            self.ui.lineEdit_4th_Equation.setText(val)
325
                        elif key == '5th':
326
                            self.ui.lineEdit_5th_Equation.setText(val)
273 327

  
274 328
                # Line Calculation Basis
275 329
                liquid_dp_method = app_doc_data.getConfigs('Calculation', 'Liquid_Drop_Method')
......
405 459
                configs.append(Config('Control Valve', 'Equation', 'mixed'))
406 460
            elif self.ui.radioButton_Aramco.isChecked():
407 461
                configs.append(Config('Control Valve', 'Equation', 'aramco'))
462
            elif self.ui.radioButton_User.isChecked():
463
                configs.append(Config('Control Valve', 'Equation', 'user'))
464

  
465
                configs.append(Config('User Equation', '1st', self.ui.lineEdit_1st_Equation.text()))
466
                configs.append(Config('User Equation', '2nd', self.ui.lineEdit_2nd_Equation.text()))
467
                configs.append(Config('User Equation', '3rd', self.ui.lineEdit_3rd_Equation.text()))
468
                configs.append(Config('User Equation', '4th', self.ui.lineEdit_4th_Equation.text()))
469
                configs.append(Config('User Equation', '5th', self.ui.lineEdit_5th_Equation.text()))
408 470

  
409 471
            app_doc_data.saveConfigs(configs)
410 472

  
HYTOS/HYTOS/Configuration_UI.py
593 593
        self.tabWidget.addTab(self.Unit, "")
594 594
        self.tab_2 = QtWidgets.QWidget()
595 595
        self.tab_2.setObjectName("tab_2")
596
        self.groupBox_DB = QtWidgets.QGroupBox(self.tab_2)
597
        self.groupBox_DB.setGeometry(QtCore.QRect(244, 9, 277, 437))
596
        self.groupBox_BD = QtWidgets.QGroupBox(self.tab_2)
597
        self.groupBox_BD.setGeometry(QtCore.QRect(244, 9, 309, 437))
598 598
        font = QtGui.QFont()
599 599
        font.setBold(True)
600 600
        font.setWeight(75)
601
        self.groupBox_DB.setFont(font)
602
        self.groupBox_DB.setObjectName("groupBox_DB")
603
        self.label_26 = QtWidgets.QLabel(self.groupBox_DB)
601
        self.groupBox_BD.setFont(font)
602
        self.groupBox_BD.setObjectName("groupBox_BD")
603
        self.label_26 = QtWidgets.QLabel(self.groupBox_BD)
604 604
        self.label_26.setGeometry(QtCore.QRect(12, 24, 85, 16))
605 605
        font = QtGui.QFont()
606 606
        font.setBold(False)
......
610 610
        font.setStrikeOut(False)
611 611
        self.label_26.setFont(font)
612 612
        self.label_26.setObjectName("label_26")
613
        self.label_24 = QtWidgets.QLabel(self.groupBox_DB)
613
        self.label_24 = QtWidgets.QLabel(self.groupBox_BD)
614 614
        self.label_24.setGeometry(QtCore.QRect(8, 40, 261, 81))
615 615
        font = QtGui.QFont()
616 616
        font.setBold(False)
617 617
        font.setWeight(50)
618 618
        self.label_24.setFont(font)
619 619
        self.label_24.setObjectName("label_24")
620
        self.label_25 = QtWidgets.QLabel(self.groupBox_DB)
620
        self.label_25 = QtWidgets.QLabel(self.groupBox_BD)
621 621
        self.label_25.setGeometry(QtCore.QRect(12, 124, 73, 16))
622 622
        font = QtGui.QFont()
623 623
        font.setBold(False)
......
625 625
        font.setWeight(50)
626 626
        self.label_25.setFont(font)
627 627
        self.label_25.setObjectName("label_25")
628
        self.label_27 = QtWidgets.QLabel(self.groupBox_DB)
628
        self.label_27 = QtWidgets.QLabel(self.groupBox_BD)
629 629
        self.label_27.setGeometry(QtCore.QRect(8, 140, 149, 49))
630 630
        self.label_27.setObjectName("label_27")
631
        self.label_28 = QtWidgets.QLabel(self.groupBox_DB)
631
        self.label_28 = QtWidgets.QLabel(self.groupBox_BD)
632 632
        self.label_28.setGeometry(QtCore.QRect(12, 196, 121, 16))
633 633
        font = QtGui.QFont()
634 634
        font.setBold(False)
......
636 636
        font.setWeight(50)
637 637
        self.label_28.setFont(font)
638 638
        self.label_28.setObjectName("label_28")
639
        self.label_29 = QtWidgets.QLabel(self.groupBox_DB)
639
        self.label_29 = QtWidgets.QLabel(self.groupBox_BD)
640 640
        self.label_29.setGeometry(QtCore.QRect(20, 224, 121, 16))
641 641
        font = QtGui.QFont()
642 642
        font.setBold(False)
......
644 644
        font.setWeight(50)
645 645
        self.label_29.setFont(font)
646 646
        self.label_29.setObjectName("label_29")
647
        self.label_30 = QtWidgets.QLabel(self.groupBox_DB)
647
        self.label_30 = QtWidgets.QLabel(self.groupBox_BD)
648 648
        self.label_30.setGeometry(QtCore.QRect(20, 244, 121, 16))
649 649
        font = QtGui.QFont()
650 650
        font.setBold(False)
......
652 652
        font.setWeight(50)
653 653
        self.label_30.setFont(font)
654 654
        self.label_30.setObjectName("label_30")
655
        self.label_31 = QtWidgets.QLabel(self.groupBox_DB)
655
        self.label_31 = QtWidgets.QLabel(self.groupBox_BD)
656 656
        self.label_31.setGeometry(QtCore.QRect(20, 264, 121, 16))
657 657
        font = QtGui.QFont()
658 658
        font.setBold(False)
......
660 660
        font.setWeight(50)
661 661
        self.label_31.setFont(font)
662 662
        self.label_31.setObjectName("label_31")
663
        self.label_32 = QtWidgets.QLabel(self.groupBox_DB)
663
        self.label_32 = QtWidgets.QLabel(self.groupBox_BD)
664 664
        self.label_32.setGeometry(QtCore.QRect(20, 284, 121, 16))
665 665
        font = QtGui.QFont()
666 666
        font.setBold(False)
......
668 668
        font.setWeight(50)
669 669
        self.label_32.setFont(font)
670 670
        self.label_32.setObjectName("label_32")
671
        self.label_33 = QtWidgets.QLabel(self.groupBox_DB)
671
        self.label_33 = QtWidgets.QLabel(self.groupBox_BD)
672 672
        self.label_33.setGeometry(QtCore.QRect(20, 304, 121, 16))
673 673
        font = QtGui.QFont()
674 674
        font.setBold(False)
......
676 676
        font.setWeight(50)
677 677
        self.label_33.setFont(font)
678 678
        self.label_33.setObjectName("label_33")
679
        self.label_34 = QtWidgets.QLabel(self.groupBox_DB)
679
        self.label_34 = QtWidgets.QLabel(self.groupBox_BD)
680 680
        self.label_34.setGeometry(QtCore.QRect(20, 324, 121, 16))
681 681
        font = QtGui.QFont()
682 682
        font.setBold(False)
......
692 692
        self.groupBox_7.setFont(font)
693 693
        self.groupBox_7.setObjectName("groupBox_7")
694 694
        self.radioButton_User = QtWidgets.QRadioButton(self.groupBox_7)
695
        self.radioButton_User.setEnabled(False)
696
        self.radioButton_User.setGeometry(QtCore.QRect(12, 135, 105, 19))
695
        self.radioButton_User.setEnabled(True)
696
        self.radioButton_User.setGeometry(QtCore.QRect(12, 135, 193, 19))
697 697
        font = QtGui.QFont()
698 698
        font.setBold(False)
699 699
        font.setWeight(50)
700 700
        self.radioButton_User.setFont(font)
701 701
        self.radioButton_User.setObjectName("radioButton_User")
702 702
        self.radioButton_Aramco = QtWidgets.QRadioButton(self.groupBox_7)
703
        self.radioButton_Aramco.setEnabled(False)
704
        self.radioButton_Aramco.setGeometry(QtCore.QRect(12, 108, 135, 19))
703
        self.radioButton_Aramco.setEnabled(True)
704
        self.radioButton_Aramco.setGeometry(QtCore.QRect(12, 108, 185, 19))
705 705
        font = QtGui.QFont()
706 706
        font.setBold(False)
707 707
        font.setWeight(50)
708 708
        self.radioButton_Aramco.setFont(font)
709 709
        self.radioButton_Aramco.setObjectName("radioButton_Aramco")
710 710
        self.radioButton_Mixed = QtWidgets.QRadioButton(self.groupBox_7)
711
        self.radioButton_Mixed.setEnabled(False)
711
        self.radioButton_Mixed.setEnabled(True)
712 712
        self.radioButton_Mixed.setGeometry(QtCore.QRect(12, 81, 209, 19))
713 713
        font = QtGui.QFont()
714 714
        font.setBold(False)
......
716 716
        self.radioButton_Mixed.setFont(font)
717 717
        self.radioButton_Mixed.setObjectName("radioButton_Mixed")
718 718
        self.radioButton_Lummus = QtWidgets.QRadioButton(self.groupBox_7)
719
        self.radioButton_Lummus.setEnabled(False)
720
        self.radioButton_Lummus.setGeometry(QtCore.QRect(12, 54, 121, 19))
719
        self.radioButton_Lummus.setEnabled(True)
720
        self.radioButton_Lummus.setGeometry(QtCore.QRect(12, 54, 193, 19))
721 721
        font = QtGui.QFont()
722 722
        font.setBold(False)
723 723
        font.setWeight(50)
724 724
        self.radioButton_Lummus.setFont(font)
725 725
        self.radioButton_Lummus.setObjectName("radioButton_Lummus")
726 726
        self.radioButton_BD = QtWidgets.QRadioButton(self.groupBox_7)
727
        self.radioButton_BD.setGeometry(QtCore.QRect(12, 27, 134, 19))
727
        self.radioButton_BD.setGeometry(QtCore.QRect(12, 27, 197, 19))
728 728
        font = QtGui.QFont()
729 729
        font.setBold(False)
730 730
        font.setWeight(50)
731 731
        self.radioButton_BD.setFont(font)
732 732
        self.radioButton_BD.setObjectName("radioButton_BD")
733 733
        self.groupBox_Lummus = QtWidgets.QGroupBox(self.tab_2)
734
        self.groupBox_Lummus.setGeometry(QtCore.QRect(244, 9, 277, 437))
734
        self.groupBox_Lummus.setGeometry(QtCore.QRect(244, 9, 309, 437))
735 735
        font = QtGui.QFont()
736 736
        font.setBold(True)
737 737
        font.setWeight(75)
......
841 841
        self.label_45.setFont(font)
842 842
        self.label_45.setObjectName("label_45")
843 843
        self.groupBox_Aramco = QtWidgets.QGroupBox(self.tab_2)
844
        self.groupBox_Aramco.setGeometry(QtCore.QRect(244, 9, 277, 437))
844
        self.groupBox_Aramco.setGeometry(QtCore.QRect(244, 9, 309, 437))
845 845
        font = QtGui.QFont()
846 846
        font.setBold(True)
847 847
        font.setWeight(75)
......
956 956
        self.label_75.setFont(font)
957 957
        self.label_75.setObjectName("label_75")
958 958
        self.groupBox_Mixed = QtWidgets.QGroupBox(self.tab_2)
959
        self.groupBox_Mixed.setGeometry(QtCore.QRect(244, 9, 277, 437))
959
        self.groupBox_Mixed.setGeometry(QtCore.QRect(244, 9, 309, 437))
960 960
        font = QtGui.QFont()
961 961
        font.setBold(True)
962 962
        font.setWeight(75)
......
1093 1093
        font.setWeight(50)
1094 1094
        self.label_60.setFont(font)
1095 1095
        self.label_60.setObjectName("label_60")
1096
        self.groupBox_User = QtWidgets.QGroupBox(self.tab_2)
1097
        self.groupBox_User.setGeometry(QtCore.QRect(244, 9, 309, 437))
1098
        font = QtGui.QFont()
1099
        font.setBold(True)
1100
        font.setWeight(75)
1101
        self.groupBox_User.setFont(font)
1102
        self.groupBox_User.setObjectName("groupBox_User")
1103
        self.groupBox_8 = QtWidgets.QGroupBox(self.groupBox_User)
1104
        self.groupBox_8.setGeometry(QtCore.QRect(12, 20, 285, 249))
1105
        self.groupBox_8.setObjectName("groupBox_8")
1106
        self.label_78 = QtWidgets.QLabel(self.groupBox_8)
1107
        self.label_78.setGeometry(QtCore.QRect(16, 24, 25, 16))
1108
        font = QtGui.QFont()
1109
        font.setBold(False)
1110
        font.setWeight(50)
1111
        self.label_78.setFont(font)
1112
        self.label_78.setObjectName("label_78")
1113
        self.label_Suction_Dynamic_Loss = QtWidgets.QLabel(self.groupBox_8)
1114
        self.label_Suction_Dynamic_Loss.setGeometry(QtCore.QRect(44, 24, 185, 16))
1115
        font = QtGui.QFont()
1116
        font.setBold(False)
1117
        font.setWeight(50)
1118
        self.label_Suction_Dynamic_Loss.setFont(font)
1119
        self.label_Suction_Dynamic_Loss.setObjectName("label_Suction_Dynamic_Loss")
1120
        self.label_A_Desc = QtWidgets.QLabel(self.groupBox_8)
1121
        self.label_A_Desc.setGeometry(QtCore.QRect(44, 40, 213, 16))
1122
        font = QtGui.QFont()
1123
        font.setBold(False)
1124
        font.setWeight(50)
1125
        self.label_A_Desc.setFont(font)
1126
        self.label_A_Desc.setObjectName("label_A_Desc")
1127
        self.label_B_Desc = QtWidgets.QLabel(self.groupBox_8)
1128
        self.label_B_Desc.setGeometry(QtCore.QRect(44, 76, 161, 16))
1129
        font = QtGui.QFont()
1130
        font.setBold(False)
1131
        font.setWeight(50)
1132
        self.label_B_Desc.setFont(font)
1133
        self.label_B_Desc.setObjectName("label_B_Desc")
1134
        self.label_Suction_Fixed_Loss = QtWidgets.QLabel(self.groupBox_8)
1135
        self.label_Suction_Fixed_Loss.setGeometry(QtCore.QRect(44, 60, 173, 16))
1136
        font = QtGui.QFont()
1137
        font.setBold(False)
1138
        font.setWeight(50)
1139
        self.label_Suction_Fixed_Loss.setFont(font)
1140
        self.label_Suction_Fixed_Loss.setObjectName("label_Suction_Fixed_Loss")
1141
        self.label_83 = QtWidgets.QLabel(self.groupBox_8)
1142
        self.label_83.setGeometry(QtCore.QRect(16, 60, 25, 16))
1143
        font = QtGui.QFont()
1144
        font.setBold(False)
1145
        font.setWeight(50)
1146
        self.label_83.setFont(font)
1147
        self.label_83.setObjectName("label_83")
1148
        self.label_C_Desc = QtWidgets.QLabel(self.groupBox_8)
1149
        self.label_C_Desc.setGeometry(QtCore.QRect(44, 112, 177, 16))
1150
        font = QtGui.QFont()
1151
        font.setBold(False)
1152
        font.setWeight(50)
1153
        self.label_C_Desc.setFont(font)
1154
        self.label_C_Desc.setObjectName("label_C_Desc")
1155
        self.label_85 = QtWidgets.QLabel(self.groupBox_8)
1156
        self.label_85.setGeometry(QtCore.QRect(16, 96, 25, 16))
1157
        font = QtGui.QFont()
1158
        font.setBold(False)
1159
        font.setWeight(50)
1160
        self.label_85.setFont(font)
1161
        self.label_85.setObjectName("label_85")
1162
        self.label_Discharge_Dynamic_Loss = QtWidgets.QLabel(self.groupBox_8)
1163
        self.label_Discharge_Dynamic_Loss.setGeometry(QtCore.QRect(44, 96, 169, 16))
1164
        font = QtGui.QFont()
1165
        font.setBold(False)
1166
        font.setWeight(50)
1167
        self.label_Discharge_Dynamic_Loss.setFont(font)
1168
        self.label_Discharge_Dynamic_Loss.setObjectName("label_Discharge_Dynamic_Loss")
1169
        self.label_D_Desc = QtWidgets.QLabel(self.groupBox_8)
1170
        self.label_D_Desc.setGeometry(QtCore.QRect(44, 148, 161, 16))
1171
        font = QtGui.QFont()
1172
        font.setBold(False)
1173
        font.setWeight(50)
1174
        self.label_D_Desc.setFont(font)
1175
        self.label_D_Desc.setObjectName("label_D_Desc")
1176
        self.label_Discharge_Fixed_Loss = QtWidgets.QLabel(self.groupBox_8)
1177
        self.label_Discharge_Fixed_Loss.setGeometry(QtCore.QRect(44, 132, 169, 16))
1178
        font = QtGui.QFont()
1179
        font.setBold(False)
1180
        font.setWeight(50)
1181
        self.label_Discharge_Fixed_Loss.setFont(font)
1182
        self.label_Discharge_Fixed_Loss.setObjectName("label_Discharge_Fixed_Loss")
1183
        self.label_89 = QtWidgets.QLabel(self.groupBox_8)
1184
        self.label_89.setGeometry(QtCore.QRect(16, 132, 25, 16))
1185
        font = QtGui.QFont()
1186
        font.setBold(False)
1187
        font.setWeight(50)
1188
        self.label_89.setFont(font)
1189
        self.label_89.setObjectName("label_89")
1190
        self.label_Start_Equipment_Pressure = QtWidgets.QLabel(self.groupBox_8)
1191
        self.label_Start_Equipment_Pressure.setGeometry(QtCore.QRect(44, 168, 169, 16))
1192
        font = QtGui.QFont()
1193
        font.setBold(False)
1194
        font.setWeight(50)
1195
        self.label_Start_Equipment_Pressure.setFont(font)
1196
        self.label_Start_Equipment_Pressure.setObjectName("label_Start_Equipment_Pressure")
1197
        self.label_91 = QtWidgets.QLabel(self.groupBox_8)
1198
        self.label_91.setGeometry(QtCore.QRect(16, 168, 25, 16))
1199
        font = QtGui.QFont()
1200
        font.setBold(False)
1201
        font.setWeight(50)
1202
        self.label_91.setFont(font)
1203
        self.label_91.setObjectName("label_91")
1204
        self.label_Destination_Equipment_Pressure = QtWidgets.QLabel(self.groupBox_8)
1205
        self.label_Destination_Equipment_Pressure.setGeometry(QtCore.QRect(44, 188, 213, 16))
1206
        font = QtGui.QFont()
1207
        font.setBold(False)
1208
        font.setWeight(50)
1209
        self.label_Destination_Equipment_Pressure.setFont(font)
1210
        self.label_Destination_Equipment_Pressure.setObjectName("label_Destination_Equipment_Pressure")
1211
        self.label_93 = QtWidgets.QLabel(self.groupBox_8)
1212
        self.label_93.setGeometry(QtCore.QRect(16, 188, 25, 16))
1213
        font = QtGui.QFont()
1214
        font.setBold(False)
1215
        font.setWeight(50)
1216
        self.label_93.setFont(font)
1217
        self.label_93.setObjectName("label_93")
1218
        self.label_G_Desc = QtWidgets.QLabel(self.groupBox_8)
1219
        self.label_G_Desc.setGeometry(QtCore.QRect(44, 224, 197, 16))
1220
        font = QtGui.QFont()
1221
        font.setBold(False)
1222
        font.setWeight(50)
1223
        self.label_G_Desc.setFont(font)
1224
        self.label_G_Desc.setObjectName("label_G_Desc")
1225
        self.label_Over_Design_Ratio = QtWidgets.QLabel(self.groupBox_8)
1226
        self.label_Over_Design_Ratio.setGeometry(QtCore.QRect(44, 208, 169, 16))
1227
        font = QtGui.QFont()
1228
        font.setBold(False)
1229
        font.setWeight(50)
1230
        self.label_Over_Design_Ratio.setFont(font)
1231
        self.label_Over_Design_Ratio.setObjectName("label_Over_Design_Ratio")
1232
        self.label_96 = QtWidgets.QLabel(self.groupBox_8)
1233
        self.label_96.setGeometry(QtCore.QRect(16, 208, 25, 16))
1234
        font = QtGui.QFont()
1235
        font.setBold(False)
1236
        font.setWeight(50)
1237
        self.label_96.setFont(font)
1238
        self.label_96.setObjectName("label_96")
1239
        self.groupBox_9 = QtWidgets.QGroupBox(self.groupBox_User)
1240
        self.groupBox_9.setGeometry(QtCore.QRect(12, 276, 285, 153))
1241
        self.groupBox_9.setObjectName("groupBox_9")
1242
        self.label_97 = QtWidgets.QLabel(self.groupBox_9)
1243
        self.label_97.setGeometry(QtCore.QRect(12, 24, 35, 16))
1244
        self.label_97.setMinimumSize(QtCore.QSize(35, 0))
1245
        self.label_97.setMaximumSize(QtCore.QSize(35, 16777215))
1246
        font = QtGui.QFont()
1247
        font.setBold(False)
1248
        font.setWeight(50)
1249
        self.label_97.setFont(font)
1250
        self.label_97.setObjectName("label_97")
1251
        self.lineEdit_1st_Equation = QtWidgets.QLineEdit(self.groupBox_9)
1252
        self.lineEdit_1st_Equation.setGeometry(QtCore.QRect(53, 24, 220, 21))
1253
        font = QtGui.QFont()
1254
        font.setBold(False)
1255
        font.setWeight(50)
1256
        self.lineEdit_1st_Equation.setFont(font)
1257
        self.lineEdit_1st_Equation.setObjectName("lineEdit_1st_Equation")
1258
        self.label_98 = QtWidgets.QLabel(self.groupBox_9)
1259
        self.label_98.setGeometry(QtCore.QRect(12, 48, 35, 16))
1260
        self.label_98.setMinimumSize(QtCore.QSize(35, 0))
1261
        self.label_98.setMaximumSize(QtCore.QSize(35, 16777215))
1262
        font = QtGui.QFont()
1263
        font.setBold(False)
1264
        font.setWeight(50)
1265
        self.label_98.setFont(font)
1266
        self.label_98.setObjectName("label_98")
1267
        self.lineEdit_2nd_Equation = QtWidgets.QLineEdit(self.groupBox_9)
1268
        self.lineEdit_2nd_Equation.setGeometry(QtCore.QRect(53, 48, 220, 21))
1269
        self.lineEdit_2nd_Equation.setObjectName("lineEdit_2nd_Equation")
1270
        self.lineEdit_3rd_Equation = QtWidgets.QLineEdit(self.groupBox_9)
1271
        self.lineEdit_3rd_Equation.setGeometry(QtCore.QRect(53, 72, 220, 21))
1272
        self.lineEdit_3rd_Equation.setObjectName("lineEdit_3rd_Equation")
1273
        self.label_99 = QtWidgets.QLabel(self.groupBox_9)
1274
        self.label_99.setGeometry(QtCore.QRect(12, 72, 35, 16))
1275
        self.label_99.setMinimumSize(QtCore.QSize(35, 0))
1276
        self.label_99.setMaximumSize(QtCore.QSize(35, 16777215))
1277
        font = QtGui.QFont()
1278
        font.setBold(False)
1279
        font.setWeight(50)
1280
        self.label_99.setFont(font)
1281
        self.label_99.setObjectName("label_99")
1282
        self.lineEdit_4th_Equation = QtWidgets.QLineEdit(self.groupBox_9)
1283
        self.lineEdit_4th_Equation.setGeometry(QtCore.QRect(53, 96, 220, 21))
1284
        self.lineEdit_4th_Equation.setObjectName("lineEdit_4th_Equation")
1285
        self.label_100 = QtWidgets.QLabel(self.groupBox_9)
1286
        self.label_100.setGeometry(QtCore.QRect(12, 96, 35, 16))
1287
        self.label_100.setMinimumSize(QtCore.QSize(35, 0))
1288
        self.label_100.setMaximumSize(QtCore.QSize(35, 16777215))
1289
        font = QtGui.QFont()
1290
        font.setBold(False)
1291
        font.setWeight(50)
1292
        self.label_100.setFont(font)
1293
        self.label_100.setObjectName("label_100")
1294
        self.label_101 = QtWidgets.QLabel(self.groupBox_9)
1295
        self.label_101.setGeometry(QtCore.QRect(12, 120, 35, 16))
1296
        self.label_101.setMinimumSize(QtCore.QSize(35, 0))
1297
        self.label_101.setMaximumSize(QtCore.QSize(35, 16777215))
1298
        font = QtGui.QFont()
1299
        font.setBold(False)
1300
        font.setWeight(50)
1301
        self.label_101.setFont(font)
1302
        self.label_101.setObjectName("label_101")
1303
        self.lineEdit_5th_Equation = QtWidgets.QLineEdit(self.groupBox_9)
1304
        self.lineEdit_5th_Equation.setGeometry(QtCore.QRect(53, 120, 220, 21))
1305
        self.lineEdit_5th_Equation.setObjectName("lineEdit_5th_Equation")
1096 1306
        self.tabWidget.addTab(self.tab_2, "")
1097 1307
        self.tab = QtWidgets.QWidget()
1098 1308
        self.tab.setObjectName("tab")
......
1238 1448
        self.label_17.setText(_translate("ConfigurationDialog", "Decimal point after conversion :"))
1239 1449
        self.label_Decimal_Expression.setText(_translate("ConfigurationDialog", "(From current Value to 0.XXXXXXXXX)"))
1240 1450
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.Unit), _translate("ConfigurationDialog", "Units"))
1241
        self.groupBox_DB.setTitle(_translate("ConfigurationDialog", "DB Manual Equation"))
1451
        self.groupBox_BD.setTitle(_translate("ConfigurationDialog", "DB Manual Equation"))
1242 1452
        self.label_26.setText(_translate("ConfigurationDialog", "Equation 1"))
1243 1453
        self.label_24.setText(_translate("ConfigurationDialog", "<html><head/><body><p><img src=\":/images/BD_Equation_1.png\"/></p></body></html>"))
1244 1454
        self.label_25.setText(_translate("ConfigurationDialog", "Equation 2"))
......
1302 1512
        self.label_58.setText(_translate("ConfigurationDialog", "Equation 5 (Common Min.)"))
1303 1513
        self.label_59.setText(_translate("ConfigurationDialog", "Equation 4 (Lummus Equation)"))
1304 1514
        self.label_60.setText(_translate("ConfigurationDialog", "- 68.662 kPa"))
1515
        self.groupBox_User.setTitle(_translate("ConfigurationDialog", "Define User\'s Equations"))
1516
        self.groupBox_8.setTitle(_translate("ConfigurationDialog", "Variables"))
1517
        self.label_78.setText(_translate("ConfigurationDialog", "A = "))
1518
        self.label_Suction_Dynamic_Loss.setText(_translate("ConfigurationDialog", "Suction Dynamic Loss"))
1519
        self.label_A_Desc.setText(_translate("ConfigurationDialog", "(Line Friction, Device Loss)"))
1520
        self.label_B_Desc.setText(_translate("ConfigurationDialog", "(Static Loss)"))
1521
        self.label_Suction_Fixed_Loss.setText(_translate("ConfigurationDialog", "Suction Fixed Loss"))
1522
        self.label_83.setText(_translate("ConfigurationDialog", "B = "))
1523
        self.label_C_Desc.setText(_translate("ConfigurationDialog", "(Line Friction, Device Loss)"))
1524
        self.label_85.setText(_translate("ConfigurationDialog", "C = "))
1525
        self.label_Discharge_Dynamic_Loss.setText(_translate("ConfigurationDialog", "Discharge Dynamic Loss"))
1526
        self.label_D_Desc.setText(_translate("ConfigurationDialog", "(Static Head)"))
1527
        self.label_Discharge_Fixed_Loss.setText(_translate("ConfigurationDialog", "Discharge Fixed Loss"))
1528
        self.label_89.setText(_translate("ConfigurationDialog", "D = "))
1529
        self.label_Start_Equipment_Pressure.setText(_translate("ConfigurationDialog", "Start Equipment Pressure"))
1530
        self.label_91.setText(_translate("ConfigurationDialog", "E = "))
1531
        self.label_Destination_Equipment_Pressure.setText(_translate("ConfigurationDialog", "Destination Equipment Pressure"))
1532
        self.label_93.setText(_translate("ConfigurationDialog", "F = "))
1533
        self.label_G_Desc.setText(_translate("ConfigurationDialog", "(Max. Flowrate / Nor. Flowrate)"))
1534
        self.label_Over_Design_Ratio.setText(_translate("ConfigurationDialog", "Over Design Ratio"))
1535
        self.label_96.setText(_translate("ConfigurationDialog", "G = "))
1536
        self.groupBox_9.setTitle(_translate("ConfigurationDialog", "Equations"))
1537
        self.label_97.setText(_translate("ConfigurationDialog", "1st = "))
1538
        self.label_98.setText(_translate("ConfigurationDialog", "2nd = "))
1539
        self.label_99.setText(_translate("ConfigurationDialog", "3rd = "))
1540
        self.label_100.setText(_translate("ConfigurationDialog", "4th = "))
1541
        self.label_101.setText(_translate("ConfigurationDialog", "5th = "))
1305 1542
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("ConfigurationDialog", "Control Valve"))
1306 1543
        self.groupBox_4.setTitle(_translate("ConfigurationDialog", "Liquid Pressure Drop"))
1307 1544
        self.label_10.setText(_translate("ConfigurationDialog", "- Select the friction loss equation."))
HYTOS/HYTOS/MainWindow.py
1460 1460

  
1461 1461
                                        row_no += 1
1462 1462

  
1463
                                    '''
1464
                                    data = lines[0].pressure_variation
1465
                                    if data:
1466
                                        for no in range(data.no):
1467
                                            col_no = 12
1468
                                            ws.cell(row_no, col_no, str(data.element[no]))  # Element
1469
                                            col_no += 1
1470
                                            ws.cell(row_no, col_no, data.inside_diameter[
1471
                                                no] if no in data.inside_diameter else None)
1472
                                            col_no += 1
1473
                                            ws.cell(row_no, col_no, data.length[no] if no in data.length else None)
1474
                                            col_no += 1
1475
                                            ws.cell(row_no, col_no, data.angle[no] if no in data.angle else None)
1476
                                            col_no += 1
1477
                                            ws.cell(row_no, col_no, data.k[no] if no in data.k else None)
1478
                                            col_no += 1
1479
                                            ws.cell(row_no, col_no,
1480
                                                    data.pressure[no] if no in data.pressure else None)
1481
                                            col_no += 1
1482
                                            ws.cell(row_no, col_no, data.void[no] if no in data.void else None)
1483
                                            col_no += 1
1484
                                            ws.cell(row_no, col_no,
1485
                                                    data.quality[no] if no in data.quality else None)
1486
                                            col_no += 1
1487
                                            ws.cell(row_no, col_no,
1488
                                                    data.mean_den[no] if no in data.mean_den else None)
1489
                                            col_no += 1
1490
                                            ws.cell(row_no, col_no,
1491
                                                    data.v_density[no] if no in data.v_density else None)
1492
                                            col_no += 1
1493
                                            ws.cell(row_no, col_no,
1494
                                                    data.homo_vel[no] if no in data.homo_vel else None)
1495
                                            col_no += 1
1496
                                            ws.cell(row_no, col_no,
1497
                                                    data.max_vel[no] if no in data.max_vel else None)
1498
                                            col_no += 1
1499
                                            ws.cell(row_no, col_no,
1500
                                                    data.ero_vel[no] if no in data.ero_vel else None)
1501
                                            col_no += 1
1502
                                            ws.cell(row_no, col_no, data.x[no] if no in data.x else None)
1503
                                            col_no += 1
1504
                                            ws.cell(row_no, col_no, data.y[no] if no in data.y else None)
1505
                                            col_no += 1
1506
                                            ws.cell(row_no, col_no,
1507
                                                    str(data.regime[no]) if no in data.regime else None)
1508
                                            col_no += 1
1509
                                            ws.cell(row_no, col_no,
1510
                                                    data.dp_fric[no] if no in data.dp_fric else None)
1511
                                            col_no += 1
1512
                                            ws.cell(row_no, col_no,
1513
                                                    data.dp_stat[no] if no in data.dp_stat else None)
1514
                                            col_no += 1
1515
                                            ws.cell(row_no, col_no,
1516
                                                    data.dp_momen[no] if no in data.dp_momen else None)
1517
                                            col_no += 1
1518
                                            ws.cell(row_no, col_no,
1519
                                                    data.total_length[no] if no in data.total_length else None)
1520

  
1521
                                            row_no += 1
1522
                                    '''
1523 1463
                    wb.get_sheet_by_name('Page').sheet_state = 'hidden'
1524 1464
                    wb.get_sheet_by_name('Two_phase').sheet_state = 'hidden'
1525 1465

  
......
1749 1689
                return
1750 1690

  
1751 1691
            dlg = QConfigurationDialog(self)
1752
            (isAccepted, isDataConversion, decimal) = dlg.showDialog()
1692
            (isAccepted, isDataConversion, decimal) = dlg.show_dialog()
1753 1693
            if isAccepted == True:
1754 1694
                if isDataConversion == True:
1755 1695
                    self.data_conversion(decimal)
HYTOS/HYTOS/Shapes/EngineeringConnectorItem.py
27 27
        self.pressure_drop = None
28 28
        self.elevation = None
29 29
        self.over_design_cv = None
30
        self.cv_type = None
30 31

  
31 32
    def parse(self, row):
32 33
        """ parse given row """
......
40 41
                self.elevation = float(row['Elevation'])
41 42
            if not row['Over_Design_CV'] is None:
42 43
                self.over_design_cv = float(row['Over_Design_CV'])
44
            if not row['CV_Type'] is None:
45
                self.cv_type = row['CV_Type']
43 46
        except Exception as ex:
44 47
            from App import App
45 48
            from AppDocData import MessageType
......
552 555
            sql = 'insert or replace into Points({}) values({})'.format(','.join(cols), ','.join(values))
553 556
            res.append((sql, tuple(param)))
554 557

  
555
            cols = ['Points_UID', 'Pressure', 'Pressure_Drop', 'Elevation', 'Over_Design_CV']
556
            values = ['?', '?', '?', '?', '?']
558
            cols = ['Points_UID', 'Pressure', 'Pressure_Drop', 'Elevation', 'Over_Design_CV', 'CV_Type']
559
            values = ['?', '?', '?', '?', '?', '?']
557 560
            if self.data:
558 561

  
559 562
                pressure = self.data.pressure
......
580 583
                else:
581 584
                    over_design_cv = float(over_design_cv)
582 585

  
583
                param = [str(self.uid), pressure, pressure_drop, elevation, over_design_cv]
586
                cv_type = self.data.cv_type
587
                if cv_type is None:
588
                    cv_type = None
589
                else:
590
                    cv_type = str(cv_type)
591

  
592
                param = [str(self.uid), pressure, pressure_drop, elevation, over_design_cv, cv_type]
584 593
                sql = 'insert or replace into Nozzles({}) values({})'.format(','.join(cols), ','.join(values))
585 594
                res.append((sql, tuple(param)))
586 595

  
HYTOS/HYTOS/Shapes/EngineeringLoopItem.py
20 20
from AppDocData import *
21 21

  
22 22

  
23
def is_not_blank(s):
24
    return bool(s and s.strip())
25

  
26

  
23 27
class QEngineeringLoopItem(QEngineeringAbstractItem):
24 28
    """ This is QEngineeringLoopItem class """
25 29

  
......
196 200
                if method == 'bd':
197 201
                    self.bd_cal(pf, acv)
198 202
                elif method == 'lummus':
199
                    pass
203
                    ap_lummus = 0
204
                    for i in range(2, len(self.items) - 3, 3):
205
                        name = str(self.items[i])[:3]
206
                        if name == 'R_P' or name == 'L_P' or name == 'V_P' or name == 'R_K' or name == 'L_K':
207
                            ap_lummus = i
208
                            break
209
                    self.lummus_cal(pf, acv, ap_lummus)
200 210
                elif method == 'mixed':
201
                    pass
211
                    ap_lummus = 0
212
                    for i in range(2, len(self.items) - 3, 3):
213
                        name = str(self.items[i])[:3]
214
                        if name == 'R_P' or name == 'L_P' or name == 'V_P' or name == 'R_K' or name == 'L_K':
215
                            ap_lummus = i
216
                            break
217
                    self.mixed_cal(pf, acv, ap_lummus)
202 218
                elif method == 'aramco':
203
                    pass
204
                else:
205
                    pass
219
                    self.aramco_cal(pf, acv)
220
                elif method == 'user':
221
                    self.user_cal(acv)
222
        except Exception as ex:
223
            from App import App
224
            message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename,
225
                                                           sys.exc_info()[-1].tb_lineno)
226
            App.mainWnd().addMessage.emit(MessageType.Error, message)
227

  
228
    def mixed_cal(self, pf, acv, ap_lummus):
229
        try:
230
            mixedcvdp = [None, None, None, None, None]
231

  
232
            pressure_unit = self.units['Pressure']
233
            if pressure_unit == 'kg/cm2':
234
                mixedcvdp[0] = 0.7
235
            elif pressure_unit == 'psi':
236
                mixedcvdp[0] = 0.7 / 1.033 * 14.7
237
            elif pressure_unit == 'bar':
238
                mixedcvdp[0] = 0.7 / 1.033 * 1.013
239
            elif pressure_unit == 'mmHg':
240
                mixedcvdp[0] = 0.7 / 1.033 * 760
241
            elif pressure_unit == 'kPa':
242
                mixedcvdp[0] = 0.7 / 1.033 * 101.325
243
            elif pressure_unit == 'MPa':
244
                mixedcvdp[0] = 0.7 / 1.033 * 0.101325
245

  
246
            mixedcvdp[1] = pf / 3
247
            mixedcvdp[2] = ((1.1135 * (
248
                    (self.extras[self.items[acv]] if self.extras[self.items[acv]] else 0) / 100 + 1)) ** 2 - 1) * pf
249
            mixedcvdp[3] = self.pressures[self.items[ap_lummus + 1]] * 0.08  # 펌프 디스차지의 0.08구현
250

  
251
            # mixedcvdp (4)
252
            total_loss = 0  # (self.total_discharge_loss if self.total_discharge_loss else 0) + (self.total_suction_loss if self.total_suction_loss else 0)
253

  
254
            dpt = total_loss + pf
255
            dpf = pf / dpt
256
            od = self.extras[self.items[acv]]
257

  
258
            if od > 0.5:
259
                dpv = 0.06
260
            else:
261
                if dpf > 1:
262
                    dpf = 1
263
                    conv_od = 0.08 * dpf + 0.07
264

  
265
                    if conv_od >= od:
266
                        slope = (11 - 46 * dpf) / (7 + 8 * dpf)
267
                        dpv = slope * od + 0.5 * dpf
268
                    else:
269
                        slope = (4 * dpf + 5) / (8 * dpf - 43)
270
                        dpv = slope * od + 0.06 - slope * 0.5
271
                elif 0.75 < dpf and dpf <= 1:
272
                    conv_od = 0.08 * dpf + 0.07
273

  
274
                    if conv_od >= od:
275
                        slope = (11 - 46 * dpf) / (7 + 8 * dpf)
276
                        dpv = slope * od + 0.5 * dpf
277
                    else:
278
                        slope = (4 * dpf + 5) / (8 * dpf - 43)
279
                        dpv = slope * od + 0.06 - slope * 0.5
280
                elif 0.5 < dpf and dpf <= 0.75:
281
                    conv_od = 0.12 * dpf + 0.04
282

  
283
                    if conv_od >= od:
284
                        slope = (12.5 - 48 * dpf) / (4 + 12 * dpf)
285
                        dpv = slope * od + 0.5 * dpf
286
                    else:
287
                        slope = (2 * dpf + 6.5) / (12 * dpf - 46)
288
                        dpv = slope * od + 0.06 - slope * 0.5
289
                elif 0.4 < dpf and dpf <= 0.5:
290
                    conv_od = 0.2 * dpf
291

  
292
                    if conv_od >= od:
293
                        slope = (0.425 / dpf - 2)
294
                        dpv = slope * od + 0.5 * dpf
295
                    else:
296
                        slope = (10 * dpf + 2.5) / (20 * dpf - 50)
297
                        dpv = slope * od + 0.06 - slope * 0.5
298
                elif 0.25 <= dpf and dpf <= 0.4:
299
                    conv_od = 0.2333 * dpf - 0.0133
300

  
301
                    if conv_od >= od:
302
                        slope = (19 / 600 - 8 / 30 * dpf) / (7 / 30 * dpf - 1 / 75)
303
                        dpv = slope * od + dpf / 3 + 2 / 30
304
                    else:
305
                        slope = (dpf / 15 + 23 / 600) / (7 / 30 * dpf - 38.5 / 75)
306
                        dpv = slope * od + 0.06 - slope * 0.5
307
                elif 0.25 > dpf:
308
                    conv_od = 0.03
309

  
310
                    if conv_od >= od:
311
                        slope = -0.5
312
                        dpv = slope * od + 0.125
313
                    else:
314
                        slope = -5 / 47
315
                        dpv = slope * od + 0.06 - slope * 0.5
316

  
317
            mixedcvdp[4] = dpv * dpt
318

  
319
            maxdps = [None, None]
320
            # max dp 판별
321
            maxdps[0] = max(mixedcvdp[1], mixedcvdp[4])
322
            maxdps[1] = max(mixedcvdp[2], mixedcvdp[3])
323
            maxdp = max(maxdps[0], maxdps[1])
324

  
325
            if maxdp > mixedcvdp[0]:
326
                maxdp = maxdp
327
            elif maxdp < mixedcvdp[0]:
328
                maxdp = mixedcvdp[0]
329

  
330
            # 공통이 될 부분
331
            self.pressure_drops[self.items[acv]] = maxdp
332

  
333
        except Exception as ex:
334
            from App import App
335
            message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename,
336
                                                           sys.exc_info()[-1].tb_lineno)
337
            App.mainWnd().addMessage.emit(MessageType.Error, message)
338

  
339
    def lummus_cal(self, pf, acv, ap_lummus):
340
        try:
341
            lumcvdp = [None, None, None]
342

  
343
            lumcvdp[0] = self.pressures[self.items[ap_lummus + 1]] * 0.08  # 펌프 디스차지의 0.08구현
344

  
345
            pressure_unit = self.units['Pressure']
346
            if pressure_unit == 'kg/cm2':
347
                lumcvdp[2] = 0.7
348
            elif pressure_unit == 'psi':
349
                lumcvdp[2] = 0.7 / 1.033 * 14.7
350
            elif pressure_unit == 'bar':
351
                lumcvdp[2] = 0.7 / 1.033 * 1.013
352
            elif pressure_unit == 'mmHg':
353
                lumcvdp[2] = 0.7 / 1.033 * 760
354
            elif pressure_unit == 'kPa':
355
                lumcvdp[2] = 0.7 / 1.033 * 101.325
356
            elif pressure_unit == 'MPa':
357
                lumcvdp[2] = 0.7 / 1.033 * 0.101325
358

  
359
            # lumcvdp (1) (Chart) 결정
360
            total_loss = 0  # (self.total_discharge_loss if self.total_discharge_loss else 0) + (self.total_suction_loss if self.total_suction_loss else 0)
361

  
362
            dpt = total_loss + pf
363
            dpf = pf / dpt
364
            od = self.extras[self.items[acv]]
365

  
366
            if od > 0.5:
367
                dpv = 0.06
368
            else:
369
                if dpf > 1:
370
                    dpf = 1
371
                    conv_od = 0.08 * dpf + 0.07
372

  
373
                    if conv_od >= od:
374
                        slope = (11 - 46 * dpf) / (7 + 8 * dpf)
375
                        dpv = slope * od + 0.5 * dpf
376
                    else:
377
                        slope = (4 * dpf + 5) / (8 * dpf - 43)
378
                        dpv = slope * od + 0.06 - slope * 0.5
379
                elif 0.75 < dpf and dpf <= 1:
380
                    conv_od = 0.08 * dpf + 0.07
381

  
382
                    if conv_od >= od:
383
                        slope = (11 - 46 * dpf) / (7 + 8 * dpf)
384
                        dpv = slope * od + 0.5 * dpf
385
                    else:
386
                        slope = (4 * dpf + 5) / (8 * dpf - 43)
387
                        dpv = slope * od + 0.06 - slope * 0.5
388
                elif 0.5 < dpf and dpf <= 0.75:
389
                    conv_od = 0.12 * dpf + 0.04
390

  
391
                    if conv_od >= od:
392
                        slope = (12.5 - 48 * dpf) / (4 + 12 * dpf)
393
                        dpv = slope * od + 0.5 * dpf
394
                    else:
395
                        slope = (2 * dpf + 6.5) / (12 * dpf - 46)
396
                        dpv = slope * od + 0.06 - slope * 0.5
397
                elif 0.4 < dpf and dpf <= 0.5:
398
                    conv_od = 0.2 * dpf
399

  
400
                    if conv_od >= od:
401
                        slope = (0.425 / dpf - 2)
402
                        dpv = slope * od + 0.5 * dpf
403
                    else:
404
                        slope = (10 * dpf + 2.5) / (20 * dpf - 50)
405
                        dpv = slope * od + 0.06 - slope * 0.5
406
                elif 0.25 <= dpf and dpf <= 0.4:
407
                    conv_od = 0.2333 * dpf - 0.0133
408

  
409
                    if conv_od >= od:
410
                        slope = (19 / 600 - 8 / 30 * dpf) / (7 / 30 * dpf - 1 / 75)
411
                        dpv = slope * od + dpf / 3 + 2 / 30
412
                    else:
413
                        slope = (dpf / 15 + 23 / 600) / (7 / 30 * dpf - 38.5 / 75)
414
                        dpv = slope * od + 0.06 - slope * 0.5
415
                elif 0.25 > dpf:
416
                    conv_od = 0.03
417

  
418
                    if conv_od >= od:
419
                        slope = -0.5
420
                        dpv = slope * od + 0.125
421
                    else:
422
                        slope = -5 / 47
423
                        dpv = slope * od + 0.06 - slope * 0.5
424

  
425
            lumcvdp[1] = dpv * dpt
426

  
427
            maxdp = max(lumcvdp[0], lumcvdp[1])
428
            maxdp = max(maxdp, lumcvdp[2])
429

  
430
            # 공통이 될 부분
431
            self.pressure_drops[self.items[acv]] = maxdp
432

  
433
        except Exception as ex:
434
            from App import App
435
            message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename,
436
                                                           sys.exc_info()[-1].tb_lineno)
437
            App.mainWnd().addMessage.emit(MessageType.Error, message)
438

  
439
    def user_cal(self, acv):
440
        try:
441
            eq1 = 0
442
            eq2 = 0
443
            eq3 = 0
444
            eq4 = 0
445
            eq5 = 0
446

  
447
            A = (self.suction_device_loss if self.suction_device_loss else 0) + (
448
                self.suction_line_friction_loss if self.suction_line_friction_loss else 0)
449
            B = self.total_suction_loss if self.total_suction_loss else 0
450
            C = (self.discharge_device_loss if self.discharge_device_loss else 0) + (
451
                self.discharge_line_friction_loss if self.discharge_line_friction_loss else 0)
452
            D = self.total_discharge_loss if self.total_discharge_loss else 0
453
            E = self.pressures[self.items[0]]
454
            F = self.pressures[self.items[-1]]
455
            G = (self.extras[self.items[acv]] if self.extras[self.items[acv]] else 0) + 1
456

  
457
            app_doc_data = AppDocData.instance()
458
            user_equation = app_doc_data.getConfigs('User Equation')
459
            if len(user_equation) > 0:
460
                for i in range(len(user_equation)):
461
                    key = user_equation[i].key
462
                    val = user_equation[i].value
463

  
464
                    if key == '1st':
465
                        eq1 = eval(val)
466
                    elif key == '2nd':
467
                        eq2 = eval(val)
468
                    elif key == '3rd':
469
                        eq3 = eval(val)
470
                    elif key == '4th':
471
                        if is_not_blank(val):
472
                            eq4 = eval(val)
473
                    elif key == '5th':
474
                        if is_not_blank(val):
475
                            eq5 = eval(val)
476

  
477
            userdp1 = max(eq1, eq2)
478
            userdp2 = max(eq3, eq4)
479
            userdp2 = max(userdp2, eq5)
480

  
481
            userdp = max(userdp1, userdp2)
482

  
483
            self.pressure_drops[self.items[acv]] = userdp
484
        except Exception as ex:
485
            from App import App
486
            message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename,
487
                                                           sys.exc_info()[-1].tb_lineno)
488
            App.mainWnd().addMessage.emit(MessageType.Error, message)
489

  
490
    def aramco_cal(self, pf, acv):
491
        try:
492
            aramcob = 0
493
            cv_type = self.items[acv].data.cv_type
494
            if cv_type == 'Single Plug':
495
                aramcob = 11
496
            elif cv_type == 'Double Plug':
497
                aramcob = 7
498
            elif cv_type == 'Cave(unbalanced)':
499
                aramcob = 4
500
            elif cv_type == 'Cave(balanced)':
501
                aramcob = 4
502
            elif cv_type == 'Butterfly':
503
                aramcob = 0
504
            elif cv_type == 'V-Ball':
505
                aramcob = 1
506

  
507
            pressure_unit = self.units['Pressure']
508
            if pressure_unit == 'kg/cm2':
509
                aramcob = aramcob / 14.7 * 1.033
510
            elif pressure_unit == 'psi':
511
                aramcob = aramcob
512
            elif pressure_unit == 'atm':
513
                aramcob = aramcob / 14.7
514
            elif pressure_unit == 'bar':
515
                aramcob = aramcob / 14.7 * 1.013
516
            elif pressure_unit == 'mmHg':
517
                aramcob = aramcob / 14.7 * 760
518
            elif pressure_unit == 'kPa':
519
                aramcob = aramcob / 14.7 * 101.325
520
            elif pressure_unit == 'MPa':
521
                aramcob = aramcob / 14.7 * 0.101325
522

  
523
            aramcodp = 0.05 * self.pressures[self.items[0]] + (1.1 * ((self.extras[self.items[acv]] if self.extras[
524
                self.items[acv]] else 0 / 100 + 1) ** 2 - 1) * pf) + aramcob
525

  
526
            # 공통이 될 부분
527
            self.pressure_drops[self.items[acv]] = aramcodp
206 528
        except Exception as ex:
207 529
            from App import App
208 530
            message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename,
......
518 840
            else:
519 841
                # '끊어서 계산하는 모듈이 들어가야함
520 842
                # 'length 여유 없음. 압력 재계산->밀도 재계산->re, f 재계산->압력 재계산 체계로 가야함
521
                self.discharge_vap_dp_cal2(i, press2, g, mw, temp, f, z, ida, estlength, mass, density1est, equivalent_length)
843
                self.discharge_vap_dp_cal2(i, press2, g, mw, temp, f, z, ida, estlength, mass, density1est,
844
                                           equivalent_length)
522 845

  
523 846
        except Exception as ex:
524 847
            from App import App
......
596 919

  
597 920
            for j in range(1, 100):
598 921
                press1est = press2 / 0.95
599
                estlength = (((press1est ** 2 - press2 ** 2) * mw / g ** 2 / 0.08206 / 1.033 ** 2 / temp / z * 101325) - (
600
                            2 * math.log(density1est / density2))) * ida / f
922
                estlength = (((
923
                                      press1est ** 2 - press2 ** 2) * mw / g ** 2 / 0.08206 / 1.033 ** 2 / temp / z * 101325) - (
924
                                     2 * math.log(density1est / density2))) * ida / f
601 925

  
602 926
                trial_length.append(trial_length[j - 1] + estlength)
603 927

  
......
1392 1716

  
1393 1717
            index = str(self.items[i - 2])[:3]
1394 1718
            if i > 0:
1395
                self.pressures[self.items[i - 1]] = self.pressures[self.items[i]] + self.pressure_drops[self.items[i - 1]]
1719
                self.pressures[self.items[i - 1]] = self.pressures[self.items[i]] + self.pressure_drops[
1720
                    self.items[i - 1]]
1396 1721

  
1397 1722
                if self.items[i - 2] in self.pressure_drops and self.pressure_drops[self.items[i - 2]] is not None:
1398 1723
                    if index == 'L_P' or index == 'R_P' or index == 'V_P' or index == 'R_K' or index == 'L_K':
HYTOS/HYTOS/Shapes/EngineeringStreamlineItem.py
148 148
        """validate stream line data"""
149 149

  
150 150
        # TODO: need to implement this function
151
        return [[self, 'check the data of mixed type']] if self.data.phase_type == 'Mixed' else None
151
        return [[self, 'check the data of mixed type']] if self.data and self.data.phase_type == 'Mixed' else None
152 152

  
153 153
    def build_connectors(self, connected, pointsUids=None):
154 154
        """ build connectors for stream line
HYTOS/HYTOS/UI/Configuration.ui
1170 1170
      <attribute name="title">
1171 1171
       <string>Control Valve</string>
1172 1172
      </attribute>
1173
      <widget class="QGroupBox" name="groupBox_DB">
1173
      <widget class="QGroupBox" name="groupBox_BD">
1174 1174
       <property name="geometry">
1175 1175
        <rect>
1176 1176
         <x>244</x>
1177 1177
         <y>9</y>
1178
         <width>277</width>
1178
         <width>309</width>
1179 1179
         <height>437</height>
1180 1180
        </rect>
1181 1181
       </property>
......
1423 1423
       </property>
1424 1424
       <widget class="QRadioButton" name="radioButton_User">
1425 1425
        <property name="enabled">
1426
         <bool>false</bool>
1426
         <bool>true</bool>
1427 1427
        </property>
1428 1428
        <property name="geometry">
1429 1429
         <rect>
1430 1430
          <x>12</x>
1431 1431
          <y>135</y>
1432
          <width>105</width>
1432
          <width>193</width>
1433 1433
          <height>19</height>
1434 1434
         </rect>
1435 1435
        </property>
......
1445 1445
       </widget>
1446 1446
       <widget class="QRadioButton" name="radioButton_Aramco">
1447 1447
        <property name="enabled">
1448
         <bool>false</bool>
1448
         <bool>true</bool>
1449 1449
        </property>
1450 1450
        <property name="geometry">
1451 1451
         <rect>
1452 1452
          <x>12</x>
1453 1453
          <y>108</y>
1454
          <width>135</width>
1454
          <width>185</width>
1455 1455
          <height>19</height>
1456 1456
         </rect>
1457 1457
        </property>
......
1467 1467
       </widget>
1468 1468
       <widget class="QRadioButton" name="radioButton_Mixed">
1469 1469
        <property name="enabled">
1470
         <bool>false</bool>
1470
         <bool>true</bool>
1471 1471
        </property>
1472 1472
        <property name="geometry">
1473 1473
         <rect>
......
1489 1489
       </widget>
1490 1490
       <widget class="QRadioButton" name="radioButton_Lummus">
1491 1491
        <property name="enabled">
1492
         <bool>false</bool>
1492
         <bool>true</bool>
1493 1493
        </property>
1494 1494
        <property name="geometry">
1495 1495
         <rect>
1496 1496
          <x>12</x>
1497 1497
          <y>54</y>
1498
          <width>121</width>
1498
          <width>193</width>
1499 1499
          <height>19</height>
1500 1500
         </rect>
1501 1501
        </property>
......
1514 1514
         <rect>
1515 1515
          <x>12</x>
1516 1516
          <y>27</y>
1517
          <width>134</width>
1517
          <width>197</width>
1518 1518
          <height>19</height>
1519 1519
         </rect>
1520 1520
        </property>
......
1534 1534
        <rect>
1535 1535
         <x>244</x>
1536 1536
         <y>9</y>
1537
         <width>277</width>
1537
         <width>309</width>
1538 1538
         <height>437</height>
1539 1539
        </rect>
1540 1540
       </property>
......
1800 1800
        <rect>
1801 1801
         <x>244</x>
1802 1802
         <y>9</y>
1803
         <width>277</width>
1803
         <width>309</width>
1804 1804
         <height>437</height>
1805 1805
        </rect>
1806 1806
       </property>
......
2107 2107
        <rect>
2108 2108
         <x>244</x>
2109 2109
         <y>9</y>
2110
         <width>277</width>
2110
         <width>309</width>
2111 2111
         <height>437</height>
2112 2112
        </rect>
2113 2113
       </property>
......
2442 2442
        </property>
2443 2443
       </widget>
2444 2444
      </widget>
2445
      <widget class="QGroupBox" name="groupBox_User">
2446
       <property name="geometry">
2447
        <rect>
2448
         <x>244</x>
2449
         <y>9</y>
2450
         <width>309</width>
2451
         <height>437</height>
2452
        </rect>
2453
       </property>
2454
       <property name="font">
2455
        <font>
2456
         <weight>75</weight>
2457
         <bold>true</bold>
2458
        </font>
2459
       </property>
2460
       <property name="title">
2461
        <string>Define User's Equations</string>
2462
       </property>
2463
       <widget class="QGroupBox" name="groupBox_8">
2464
        <property name="geometry">
2465
         <rect>
2466
          <x>12</x>
2467
          <y>20</y>
2468
          <width>285</width>
2469
          <height>249</height>
2470
         </rect>
2471
        </property>
2472
        <property name="title">
2473
         <string>Variables</string>
2474
        </property>
2475
        <widget class="QLabel" name="label_78">
2476
         <property name="geometry">
2477
          <rect>
2478
           <x>16</x>
2479
           <y>24</y>
2480
           <width>25</width>
2481
           <height>16</height>
2482
          </rect>
2483
         </property>
2484
         <property name="font">
2485
          <font>
2486
           <weight>50</weight>
2487
           <bold>false</bold>
2488
          </font>
2489
         </property>
2490
         <property name="text">
2491
          <string>A = </string>
2492
         </property>
2493
        </widget>
2494
        <widget class="QLabel" name="label_Suction_Dynamic_Loss">
2495
         <property name="geometry">
2496
          <rect>
2497
           <x>44</x>
2498
           <y>24</y>
2499
           <width>185</width>
2500
           <height>16</height>
2501
          </rect>
2502
         </property>
2503
         <property name="font">
2504
          <font>
2505
           <weight>50</weight>
2506
           <bold>false</bold>
2507
          </font>
2508
         </property>
2509
         <property name="text">
2510
          <string>Suction Dynamic Loss</string>
2511
         </property>
2512
        </widget>
2513
        <widget class="QLabel" name="label_A_Desc">
2514
         <property name="geometry">
2515
          <rect>
2516
           <x>44</x>
2517
           <y>40</y>
2518
           <width>213</width>
2519
           <height>16</height>
2520
          </rect>
2521
         </property>
2522
         <property name="font">
2523
          <font>
2524
           <weight>50</weight>
2525
           <bold>false</bold>
2526
          </font>
2527
         </property>
2528
         <property name="text">
2529
          <string>(Line Friction, Device Loss)</string>
2530
         </property>
2531
        </widget>
2532
        <widget class="QLabel" name="label_B_Desc">
2533
         <property name="geometry">
2534
          <rect>
2535
           <x>44</x>
2536
           <y>76</y>
2537
           <width>161</width>
2538
           <height>16</height>
2539
          </rect>
2540
         </property>
2541
         <property name="font">
2542
          <font>
2543
           <weight>50</weight>
2544
           <bold>false</bold>
2545
          </font>
2546
         </property>
2547
         <property name="text">
2548
          <string>(Static Loss)</string>
2549
         </property>
2550
        </widget>
2551
        <widget class="QLabel" name="label_Suction_Fixed_Loss">
2552
         <property name="geometry">
2553
          <rect>
2554
           <x>44</x>
2555
           <y>60</y>
2556
           <width>173</width>
2557
           <height>16</height>
2558
          </rect>
2559
         </property>
2560
         <property name="font">
2561
          <font>
2562
           <weight>50</weight>
2563
           <bold>false</bold>
2564
          </font>
2565
         </property>
2566
         <property name="text">
2567
          <string>Suction Fixed Loss</string>
2568
         </property>
2569
        </widget>
2570
        <widget class="QLabel" name="label_83">
2571
         <property name="geometry">
2572
          <rect>
2573
           <x>16</x>
2574
           <y>60</y>
2575
           <width>25</width>
2576
           <height>16</height>
2577
          </rect>
2578
         </property>
2579
         <property name="font">
2580
          <font>
2581
           <weight>50</weight>
2582
           <bold>false</bold>
2583
          </font>
2584
         </property>
2585
         <property name="text">
2586
          <string>B = </string>
2587
         </property>
2588
        </widget>
2589
        <widget class="QLabel" name="label_C_Desc">
2590
         <property name="geometry">
2591
          <rect>
2592
           <x>44</x>
2593
           <y>112</y>
2594
           <width>177</width>
2595
           <height>16</height>
2596
          </rect>
2597
         </property>
2598
         <property name="font">
2599
          <font>
2600
           <weight>50</weight>
2601
           <bold>false</bold>
2602
          </font>
2603
         </property>
2604
         <property name="text">
2605
          <string>(Line Friction, Device Loss)</string>
2606
         </property>
2607
        </widget>
2608
        <widget class="QLabel" name="label_85">
2609
         <property name="geometry">
2610
          <rect>
2611
           <x>16</x>
2612
           <y>96</y>
2613
           <width>25</width>
2614
           <height>16</height>
2615
          </rect>
2616
         </property>
2617
         <property name="font">
2618
          <font>
2619
           <weight>50</weight>
2620
           <bold>false</bold>
2621
          </font>
2622
         </property>
2623
         <property name="text">
2624
          <string>C = </string>
2625
         </property>
2626
        </widget>
2627
        <widget class="QLabel" name="label_Discharge_Dynamic_Loss">
2628
         <property name="geometry">
2629
          <rect>
2630
           <x>44</x>
2631
           <y>96</y>
2632
           <width>169</width>
2633
           <height>16</height>
2634
          </rect>
2635
         </property>
2636
         <property name="font">
2637
          <font>
2638
           <weight>50</weight>
2639
           <bold>false</bold>
2640
          </font>
2641
         </property>
2642
         <property name="text">
2643
          <string>Discharge Dynamic Loss</string>
2644
         </property>
2645
        </widget>
2646
        <widget class="QLabel" name="label_D_Desc">
2647
         <property name="geometry">
2648
          <rect>
2649
           <x>44</x>
2650
           <y>148</y>
2651
           <width>161</width>
2652
           <height>16</height>
2653
          </rect>
2654
         </property>
2655
         <property name="font">
2656
          <font>
2657
           <weight>50</weight>
2658
           <bold>false</bold>
2659
          </font>
2660
         </property>
2661
         <property name="text">
2662
          <string>(Static Head)</string>
2663
         </property>
2664
        </widget>
... 이 차이점은 표시할 수 있는 최대 줄수를 초과해서 이 차이점은 잘렸습니다.

내보내기 Unified diff

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