프로젝트

일반

사용자정보

개정판 08955797

ID08955797c4d0044a457e5e3caa84dee05356a35c
상위 bc5020f7
하위 c8ef167e

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

issue #1048 : 화면/네뉴/툴바 개발

Change-Id: I1b89f30441c774d71581ea4125ce639240e419b6

차이점 보기:

HYTOS/HYTOS/Calculation.py
627 627
    return bool(s and s.strip())
628 628

  
629 629

  
630
class Calculation_2Phase:
630
class Calculation_Mixed:
631 631
    def __init__(self, item, process, geometry):
632 632
        self.item = item
633 633
        self.process = process
......
636 636

  
637 637
        self.pressure_variation = []
638 638

  
639
        self.calculated_variable = {}
640
        self.init_units()
639
        self.calc_factor = None
640
        self.tp_flow = None
641
        self.tp_C = None
642
        self.tp_rea_rough = None
643
        self.tp_dp_fric = None
644
        self.tp_angle = None
645
        self.tp_dp_stat = None
646
        self.tp_pipe_total_drop = None
647
        self.tp_dp_momen = None
648
        self.tp_pressure = None
649
        self.tp_pressure_ratio = None
650
        self.tp_length = None
651
        self.tp_id = None
652
        self.tp_element_dp = None
653
        self.l_vel = None
654
        self.l_dp_fric = None
655
        self.v_vel = None
656
        self.v_dp_fric = None
657
        self.v_temp = None
658
        self.v_density = None
659
        self.kval = None
660

  
661
        self.l_density = None
662
        self.l_visco = None
663
        self.v_visco = None
664
        self._lambda = None
665

  
666
        self.tp_homo_vel = None
667
        self.tp_max_vel = None
668
        self.tp_ero_vel = None
669
        self.tp_void = None
670

  
641 671

  
642 672
        self.no = None
643 673
        self.element = {}
......
649 679
        self.void = {}
650 680
        self.quality = {}
651 681
        self.mean_den = {}
652
        self.v_density = {}
682
        self.density = {}
653 683
        self.homo_vel = {}
654 684
        self.max_vel = {}
655 685
        self.ero_vel = {}
......
661 691
        self.dp_momen = {}
662 692
        self.total = {}
663 693

  
694
        self.init_units()
664 695
        self.tp_cal()
665 696

  
666 697
    def init_units(self):
......
675 706
                                                           sys.exc_info()[-1].tb_lineno)
676 707
            App.mainWnd().addMessage.emit(MessageType.Error, message)
677 708

  
709
    def get_mixed_calc_factor(self):
710
        try:
711
            app_doc_data = AppDocData.instance()
712

  
713
            mixed_calc_factor = app_doc_data.getConfigs('Calculation', 'Mixed_Calc_Factor')
714
            if len(mixed_calc_factor) == 1:
715
                return 1 - (int(mixed_calc_factor[0].value) / 100)
716
            else:
717
                return 0.95
718
        except Exception as ex:
719
            from App import App
720
            from AppDocData import MessageType
721

  
722
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
723
                                                           sys.exc_info()[-1].tb_lineno)
724
            App.mainWnd().addMessage.emit(MessageType.Error, message)
678 725
    def get_barometric_pressure(self):
679 726
        try:
680 727
            unit = self.units['Pressure']
......
732 779

  
733 780
    def tp_c_cal(self):
734 781
        try:
735
            tp_massflux = self.calculated_variable['tp_massflux']
736
            if tp_massflux >= 300:
737
                tp_massflux_c = tp_massflux
782
            if self.tp_massflux >= 300:
783
                tp_massflux_c = self.tp_massflux
738 784
            else:
739
                tp_massflux_c = 300 + ((300 - tp_massflux) ** 2 / 40)
740

  
741
            lambda1 = self.calculated_variable['lambda1']
742
            l_density = self.calculated_variable['l_density']
743
            v_density = self.calculated_variable['v_density']
744
            tp_quality = self.calculated_variable['tp_quality']
785
                tp_massflux_c = 300 + ((300 - self.tp_massflux) ** 2 / 40)
745 786

  
746
            tp_c1 = 2 + (32 * (1 - 0.16 * (2.5 + lambda1) ** 2) ** 3) / (1 + 0.005664 * tp_massflux_c ** 0.8)
747
            tp_c2 = (v_density / l_density) ** 0.5 + (l_density / v_density) ** 0.5
748
            tp_c3 = ((l_density / v_density) ** 0.125) / (
749
                    (tp_quality + (1 - tp_quality) * (v_density / l_density)) ** 0.5)
787
            tp_c1 = 2 + (32 * (1 - 0.16 * (2.5 + self._lambda) ** 2) ** 3) / (1 + 0.005664 * tp_massflux_c ** 0.8)
788
            tp_c2 = (self.v_density / self.l_density) ** 0.5 + (self.l_density / self.v_density) ** 0.5
789
            tp_c3 = ((self.l_density / self.v_density) ** 0.125) / (
790
                    (self.tp_quality + (1 - self.tp_quality) * (self.v_density / self.l_density)) ** 0.5)
750 791

  
751 792
            if tp_c1 > tp_c2:
752 793
                tp_c_prime = tp_c1
......
759 800
                elif tp_c2 > tp_c1 > tp_c3:
760 801
                    tp_c_prime = tp_c1
761 802

  
762
            tp_rea_rough = self.calculated_variable['tp_rea_rough']
763
            tp_C = tp_c_prime * ((1 + 10 ** (-200 * tp_rea_rough)) / 2)
764

  
765
            self.calculated_variable['tp_C'] = tp_C
803
            self.tp_C = tp_c_prime * ((1 + 10 ** (-200 * self.tp_rea_rough)) / 2)
766 804
        except Exception as ex:
767 805
            from App import App
768 806
            from AppDocData import MessageType
......
773 811

  
774 812
    def tp_fric(self, row):
775 813
        try:
776
            tp_massflux = self.calculated_variable['tp_massflux']
777
            tp_quality = self.calculated_variable['tp_quality']
778
            tp_id = self.calculated_variable['tp_id']
779
            l_visco = self.calculated_variable['l_viscosity']
780
            v_visco = self.calculated_variable['v_viscosity']
781

  
782
            l_rey = tp_massflux * (1 - tp_quality) * tp_id / l_visco
783
            v_rey = tp_massflux * tp_quality * tp_id / v_visco
814
            l_rey = self.tp_massflux * (1 - self.tp_quality) * self.tp_id / self.l_visco
815
            v_rey = self.tp_massflux * self.tp_quality * self.tp_id / self.v_visco
784 816

  
785 817
            roughness_unit = self.units['Roughness']
786 818
            tp_rough = float(self.geometry.item(row, 4).text())
......
793 825
            elif roughness_unit == 'mm':
794 826
                tp_rough = tp_rough * 0.001
795 827

  
796
            tp_rea_rough = tp_rough / tp_id
797
            self.calculated_variable['tp_rea_rough'] = tp_rea_rough
828
            self.tp_rea_rough = tp_rough / self.tp_id
798 829

  
799 830
            if l_rey <= 2100:
800 831
                l_f = 16 / l_rey
801 832
            else:
802
                l_f = (-4 * (math.log(tp_rough / 3.7 / tp_id - 5.02 / l_rey * (
803
                        math.log(tp_rough / tp_id / 3.7 + (6.7 / l_rey) ** 0.9) / math.log(10))) / math.log(10))) ** (
833
                l_f = (-4 * (math.log(tp_rough / 3.7 / self.tp_id - 5.02 / l_rey * (
834
                        math.log(tp_rough / self.tp_id / 3.7 + (6.7 / l_rey) ** 0.9) / math.log(10))) / math.log(10))) ** (
804 835
                          -2)
805 836

  
806 837
            if v_rey <= 2100:
807 838
                v_f = 16 / v_rey
808 839
            else:
809
                v_f = (-4 * (math.log(tp_rough / 3.7 / tp_id - 5.02 / v_rey * (
810
                        math.log(tp_rough / tp_id / 3.7 + (6.7 / v_rey) ** 0.9) / math.log(10))) / math.log(10))) ** (
840
                v_f = (-4 * (math.log(tp_rough / 3.7 / self.tp_id - 5.02 / v_rey * (
841
                        math.log(tp_rough / self.tp_id / 3.7 + (6.7 / v_rey) ** 0.9) / math.log(10))) / math.log(10))) ** (
811 842
                          -2)
812 843

  
813
            tp_flow = self.calculated_variable['tp_flow']
814
            l_density = self.calculated_variable['l_density']
815
            v_density = self.calculated_variable['v_density']
816

  
817 844
            # 이 f 값들은 현재 moody friction factor들임
818
            l_vel = tp_flow * (1 - tp_quality) / l_density / tp_id ** 2 / 3.1415 * 4
819
            v_vel = tp_flow * tp_quality / v_density / tp_id ** 2 / 3.1415 * 4
845
            self.l_vel = self.tp_flow * (1 - self.tp_quality) / self.l_density / self.tp_id ** 2 / 3.1415 * 4
846
            self.v_vel = self.tp_flow * self.tp_quality / self.v_density / self.tp_id ** 2 / 3.1415 * 4
820 847

  
821
            self.calculated_variable['l_vel'] = l_vel
822
            self.calculated_variable['v_vel'] = v_vel
823

  
824
            l_dp_fric = 2 * l_f * 1 * tp_massflux ** 2 * (1 - tp_quality) ** 2 / tp_id / l_density / 101325 * 1.033
825
            v_dp_fric = 2 * v_f * 1 * tp_massflux ** 2 * tp_quality ** 2 / tp_id / v_density / 101325 * 1.033
826
            self.calculated_variable['l_dp_fric'] = l_dp_fric
827
            self.calculated_variable['v_dp_fric'] = v_dp_fric
848
            self.l_dp_fric = 2 * l_f * 1 * self.tp_massflux ** 2 * (1 - self.tp_quality) ** 2 / self.tp_id / self.l_density / 101325 * 1.033
849
            self.v_dp_fric = 2 * v_f * 1 * self.tp_massflux ** 2 * self.tp_quality ** 2 / self.tp_id / self.v_density / 101325 * 1.033
828 850

  
829 851
            self.tp_c_cal()
830 852

  
831
            tp_C = self.calculated_variable['tp_C']
832
            tp_dp_fric = l_dp_fric + tp_C * (l_dp_fric * v_dp_fric) ** 0.5 + v_dp_fric
833

  
834
            self.calculated_variable['tp_dp_fric'] = tp_dp_fric
835

  
853
            self.tp_dp_fric = self.l_dp_fric + self.tp_C * (self.l_dp_fric * self.v_dp_fric) ** 0.5 + self.v_dp_fric
836 854
        except Exception as ex:
837 855
            from App import App
838 856
            from AppDocData import MessageType
......
843 861

  
844 862
    def tp_stat(self, row):
845 863
        try:
846
            tp_angle = self.geometry.item(row, 6).text()
847
            if is_not_blank(tp_angle):
848
                tp_angle = float(tp_angle)
864
            angle = self.geometry.item(row, 6).text()
865
            if is_not_blank(angle):
866
                self.tp_angle = float(angle)
849 867
            else:
850
                tp_angle = 0
851
            self.calculated_variable['tp_angle'] = tp_angle
852

  
853
            tp_mean_den = self.calculated_variable['tp_mean_den']
854
            tp_dp_stat = tp_mean_den * 9.81 * 1 * math.sin(tp_angle / 180 * 3.1415) / 101325 * 1.033
868
                self.tp_angle = 0
855 869

  
856
            self.calculated_variable['tp_dp_stat'] = tp_dp_stat
870
            self.tp_dp_stat = self.tp_mean_den * 9.81 * 1 * math.sin(self.tp_angle / 180 * 3.1415) / 101325 * 1.033
857 871
        except Exception as ex:
858 872
            from App import App
859 873
            from AppDocData import MessageType
......
864 878

  
865 879
    def momen(self):
866 880
        try:
867
            tp_dp_fric = self.calculated_variable['tp_dp_fric']
868
            tp_dp_stat = self.calculated_variable['tp_dp_stat']
869
            tp_massflux = self.calculated_variable['tp_massflux']
870
            tp_quality = self.calculated_variable['tp_quality']
871
            tp_pressure = self.calculated_variable['tp_pressure']
872
            v_density = self.calculated_variable['v_density']
873

  
874
            tp_pipe_total_drop = (tp_dp_fric + tp_dp_stat) / (
875
                (1 - (tp_massflux ** 2 * tp_quality / (tp_pressure / 1.033 * 101325) / v_density)))
876

  
877
            self.calculated_variable['tp_pipe_total_drop'] = tp_pipe_total_drop
878
            tp_dp_momen = tp_pipe_total_drop - tp_dp_fric - tp_dp_stat
881
            self.tp_pipe_total_drop = (self.tp_dp_fric + self.tp_dp_stat) / (
882
                (1 - (self.tp_massflux ** 2 * self.tp_quality / (self.tp_pressure / 1.033 * 101325) / self.v_density)))
879 883

  
880
            self.calculated_variable['tp_dp_momen'] = tp_dp_momen
884
            self.tp_dp_momen = self.tp_pipe_total_drop - self.tp_dp_fric - self.tp_dp_stat
881 885

  
882 886
        except Exception as ex:
883 887
            from App import App
......
889 893

  
890 894
    def tp_dp_input(self):
891 895
        try:
892
            tp_dp_fric = self.calculated_variable['tp_dp_fric']
893
            tp_dp_stat = self.calculated_variable['tp_dp_stat']
894
            tp_dp_momen = self.calculated_variable['tp_dp_momen']
895

  
896 896
            # 현재 kg/cm2/m
897 897
            pressure_unit = self.units['Pressure']
898 898
            if pressure_unit == 'kg/cm2':
899
                tp_dp_fric = tp_dp_fric
900
                tp_dp_stat = tp_dp_stat
901
                tp_dp_momen = tp_dp_momen
899
                self.tp_dp_fric = self.tp_dp_fric
900
                self.tp_dp_stat = self.tp_dp_stat
901
                self.tp_dp_momen = self.tp_dp_momen
902 902
            elif pressure_unit == 'psi':
903
                tp_dp_fric = tp_dp_fric / 1.033 * 14.7
904
                tp_dp_stat = tp_dp_stat / 1.033 * 14.7
905
                tp_dp_momen = tp_dp_momen / 1.033 * 14.7
903
                self.tp_dp_fric = self.tp_dp_fric / 1.033 * 14.7
904
                self.tp_dp_stat = self.tp_dp_stat / 1.033 * 14.7
905
                self.tp_dp_momen = self.tp_dp_momen / 1.033 * 14.7
906 906
            elif pressure_unit == 'atm':
907
                tp_dp_fric = tp_dp_fric / 1.033
908
                tp_dp_stat = tp_dp_stat / 1.033
909
                tp_dp_momen = tp_dp_momen / 1.033
907
                self.tp_dp_fric = self.tp_dp_fric / 1.033
908
                self.tp_dp_stat = self.tp_dp_stat / 1.033
909
                self.tp_dp_momen = self.tp_dp_momen / 1.033
910 910
            elif pressure_unit == 'bar':
911
                tp_dp_fric = tp_dp_fric / 1.033 * 1.033
912
                tp_dp_stat = tp_dp_stat / 1.033 * 1.033
913
                tp_dp_momen = tp_dp_momen / 1.033 * 1.033
911
                self.tp_dp_fric = self.tp_dp_fric / 1.033 * 1.033
912
                self.tp_dp_stat = self.tp_dp_stat / 1.033 * 1.033
913
                self.tp_dp_momen = self.tp_dp_momen / 1.033 * 1.033
914 914
            elif pressure_unit == 'mmHg':
915
                tp_dp_fric = tp_dp_fric / 1.033 * 760
916
                tp_dp_stat = tp_dp_stat / 1.033 * 760
917
                tp_dp_momen = tp_dp_momen / 1.033 * 760
915
                self.tp_dp_fric = self.tp_dp_fric / 1.033 * 760
916
                self.tp_dp_stat = self.tp_dp_stat / 1.033 * 760
917
                self.tp_dp_momen = self.tp_dp_momen / 1.033 * 760
918 918
            elif pressure_unit == 'kPa':
919
                tp_dp_fric = tp_dp_fric / 1.033 * 101.325
920
                tp_dp_stat = tp_dp_stat / 1.033 * 101.325
921
                tp_dp_momen = tp_dp_momen / 1.033 * 101.325
919
                self.tp_dp_fric = self.tp_dp_fric / 1.033 * 101.325
920
                self.tp_dp_stat = self.tp_dp_stat / 1.033 * 101.325
921
                self.tp_dp_momen = self.tp_dp_momen / 1.033 * 101.325
922 922
            elif pressure_unit == 'MPa':
923
                tp_dp_fric = tp_dp_fric / 1.033 * 0.101325
924
                tp_dp_stat = tp_dp_stat / 1.033 * 0.101325
925
                tp_dp_momen = tp_dp_momen / 1.033 * 0.101325
923
                self.tp_dp_fric = self.tp_dp_fric / 1.033 * 0.101325
924
                self.tp_dp_stat = self.tp_dp_stat / 1.033 * 0.101325
925
                self.tp_dp_momen = self.tp_dp_momen / 1.033 * 0.101325
926 926

  
927 927
            length_unit = self.units['Length']
928 928
            if length_unit == 'm':
929
                tp_dp_fric = tp_dp_fric
930
                tp_dp_stat = tp_dp_stat
931
                tp_dp_momen = tp_dp_momen
929
                self.tp_dp_fric = self.tp_dp_fric
930
                self.tp_dp_stat = self.tp_dp_stat
931
                self.tp_dp_momen = self.tp_dp_momen
932 932
            elif length_unit == 'in':
933
                tp_dp_fric = tp_dp_fric / 39.3701
934
                tp_dp_stat = tp_dp_stat / 39.3701
935
                tp_dp_momen = tp_dp_momen / 39.3701
933
                self.tp_dp_fric = self.tp_dp_fric / 39.3701
934
                self.tp_dp_stat = self.tp_dp_stat / 39.3701
935
                self.tp_dp_momen = self.tp_dp_momen / 39.3701
936 936
            elif length_unit == 'ft':
937
                tp_dp_fric = tp_dp_fric / 3.28084
938
                tp_dp_stat = tp_dp_stat / 3.28084
939
                tp_dp_momen = tp_dp_momen / 3.28084
937
                self.tp_dp_fric = self.tp_dp_fric / 3.28084
938
                self.tp_dp_stat = self.tp_dp_stat / 3.28084
939
                self.tp_dp_momen = self.tp_dp_momen / 3.28084
940 940
            elif length_unit == 'yd':
941
                tp_dp_fric = tp_dp_fric / 1.09361
942
                tp_dp_stat = tp_dp_stat / 1.09361
943
                tp_dp_momen = tp_dp_momen / 1.09361
941
                self.tp_dp_fric = self.tp_dp_fric / 1.09361
942
                self.tp_dp_stat = self.tp_dp_stat / 1.09361
943
                self.tp_dp_momen = self.tp_dp_momen / 1.09361
944 944
            elif length_unit == 'mile':
945
                tp_dp_fric = tp_dp_fric / 0.000621371
946
                tp_dp_stat = tp_dp_stat / 0.000621371
947
                tp_dp_momen = tp_dp_momen / 0.000621371
945
                self.tp_dp_fric = self.tp_dp_fric / 0.000621371
946
                self.tp_dp_stat = self.tp_dp_stat / 0.000621371
947
                self.tp_dp_momen = self.tp_dp_momen / 0.000621371
948 948
            elif length_unit == 'mm':
949
                tp_dp_fric = tp_dp_fric / 1000
950
                tp_dp_stat = tp_dp_stat / 1000
951
                tp_dp_momen = tp_dp_momen / 1000
952

  
953
            f = tp_dp_fric
954
            g = tp_dp_stat
955
            m = tp_dp_momen
956

  
957
            self.dp_fric[self.no] = f
958
            self.dp_stat[self.no] = g
959
            self.dp_momen[self.no] = m
949
                self.tp_dp_fric = self.tp_dp_fric / 1000
950
                self.tp_dp_stat = self.tp_dp_stat / 1000
951
                self.tp_dp_momen = self.tp_dp_momen / 1000
960 952

  
961
            self.calculated_variable['tp_dp_fric'] = tp_dp_fric
962
            self.calculated_variable['tp_dp_stat'] = tp_dp_stat
963
            self.calculated_variable['tp_dp_momen'] = tp_dp_momen
953
            self.dp_fric[self.no] = self.tp_dp_fric
954
            self.dp_stat[self.no] = self.tp_dp_stat
955
            self.dp_momen[self.no] = self.tp_dp_momen
964 956

  
965
            # ToDo
966
            # 2_DB 시트에 값 입력
967 957
        except Exception as ex:
968 958
            from App import App
969 959
            from AppDocData import MessageType
......
974 964

  
975 965
    def tp_v_density_cal(self):
976 966
        try:
977
            tp_pressure_ratio = self.calculated_variable['tp_pressure_ratio']
978

  
979 967
            # (1) vapor 를 kg/m3로 맞춤
980 968
            if is_not_blank(self.process['v_density']):
981 969
                density_unit = self.units['Density']
982 970
                if density_unit == 'kg/m3':
983
                    v_density = self.calculated_variable['v_density'] * tp_pressure_ratio  # float(self.process['v_density']) * tp_pressure_ratio
971
                    self.v_density = self.v_density * self.tp_pressure_ratio
984 972
                elif density_unit == 'lb/ft3':
985
                    v_density = self.calculated_variable['v_density'] * 16.0185 * tp_pressure_ratio # float(self.process['v_density']) * 16.0185 * tp_pressure_ratio
973
                    self.v_density = self.v_density * 16.0185 * self.tp_pressure_ratio
986 974
            else:
987 975
                temperature_unit = self.units['Temperature']
988 976
                if temperature_unit == '℃':
989
                    v_temp = float(self.process['v_temp']) + 273.15
977
                    self.v_temp = float(self.process['v_temp']) + 273.15
990 978
                elif temperature_unit == '℉':
991
                    v_temp = (float(self.process['v_temp']) - 32) / 1.8 + 273.15
992

  
993
                self.calculated_variable['v_temp'] = v_temp
979
                    self.v_temp = (float(self.process['v_temp']) - 32) / 1.8 + 273.15
994 980

  
995 981
                v_mw = float(self.process['v_mw'])
996

  
997 982
                v_z = float(self.process['v_z'])
983
                self.v_density = self.tp_pressure * v_mw / 0.08206 / self.v_temp / v_z / 1.033
998 984

  
999
                v_density = self.calculated_variable['tp_pressure'] * v_mw / 0.08206 / v_temp / v_z / 1.033
1000

  
1001
            self.calculated_variable['v_density'] = v_density
1002 985

  
1003 986
        except Exception as ex:
1004 987
            from App import App
......
1023 1006

  
1024 1007
    def tp_ho_regime(self):
1025 1008
        try:
1026
            l_dp_fric = self.calculated_variable['l_dp_fric']
1027
            v_dp_fric = self.calculated_variable['v_dp_fric']
1028

  
1029
            hoX = (l_dp_fric / v_dp_fric) ** 0.5
1009
            hoX = (self.l_dp_fric / self.v_dp_fric) ** 0.5
1030 1010

  
1031
            tp_massflux = self.calculated_variable['tp_massflux']
1032
            tp_quality = self.calculated_variable['tp_quality']
1033
            l_density = self.calculated_variable['l_density']
1034
            v_density = self.calculated_variable['v_density']
1035
            tp_id = self.calculated_variable['tp_id']
1036
            l_visco = self.calculated_variable['l_viscosity']
1037
            v_visco = self.calculated_variable['v_viscosity']
1038

  
1039
            hoFr = (tp_massflux * tp_quality / v_density) * (
1040
                    v_density / ((l_density - v_density) * tp_id * 9.81)) ** 0.5
1011
            hoFr = (self.tp_massflux * self.tp_quality / self.v_density) * (
1012
                    self.v_density / ((self.l_density - self.v_density) * self.tp_id * 9.81)) ** 0.5
1041 1013
            hoFr1 = 1 / ((hoX ** 1.76) + 2 * (hoX ** 0.5) + 0.45)
1042 1014

  
1043
            hoK = hoFr * (tp_massflux * (1 - tp_quality) * tp_id / l_visco) ** 0.5
1015
            hoK = hoFr * (self.tp_massflux * (1 - self.tp_quality) * self.tp_id / self.l_visco) ** 0.5
1044 1016
            hoK1 = (0.13 * hoX ** -0.39 + 0.21 * hoX ** 0.39) ** -1.67
1045 1017

  
1046
            hoT = ((l_dp_fric / 1.033 * 101325) / (9.81 * (l_density - v_density))) ** 0.5
1018
            hoT = ((self.l_dp_fric / 1.033 * 101325) / (9.81 * (self.l_density - self.v_density))) ** 0.5
1047 1019
            hoT1 = (0.72 + 0.05 * hoX ** 0.8) ** -0.5
1048 1020

  
1049 1021
            if hoFr1 > hoFr:
......
1083 1055

  
1084 1056
    def tp_vd_regime(self):
1085 1057
        try:
1086
            l_vel = self.calculated_variable['l_vel']
1087
            v_vel = self.calculated_variable['v_vel']
1088

  
1089
            a_o = 1.2903 * l_vel - 0.25806
1090
            o_p = 0.984375 * l_vel - 0.39375
1058
            a_o = 1.2903 * self.l_vel - 0.25806
1059
            o_p = 0.984375 * self.l_vel - 0.39375
1091 1060

  
1092
            if v_vel > o_p:
1061
            if self.v_vel > o_p:
1093 1062
                regime = 'Annular'
1094 1063
            else:
1095
                if v_vel > o_p:
1064
                if self.v_vel > o_p:
1096 1065
                    regime = 'Oscillary'
1097 1066
                else:
1098 1067
                    regime = 'Bubble'
1099 1068

  
1100
            XX = l_vel
1101
            YY = v_vel
1069
            XX = self.l_vel
1070
            YY = self.v_vel
1102 1071

  
1103 1072
            self.regime_input(XX, YY, regime)
1104 1073
        except Exception as ex:
......
1111 1080

  
1112 1081
    def tp_vu_regime(self):
1113 1082
        try:
1114
            l_density = self.calculated_variable['l_density']
1115
            v_density = self.calculated_variable['v_density']
1116
            l_vel = self.calculated_variable['l_vel']
1117
            v_vel = self.calculated_variable['v_vel']
1118

  
1119
            xx = l_density * l_vel ** 2
1120
            YY = v_density * v_vel ** 2
1083
            xx = self.l_density * self.l_vel ** 2
1084
            YY = self.v_density * self.v_vel ** 2
1121 1085

  
1122 1086
            xbub = 32000 * (YY / 1.15) ** -1.4175
1123 1087
            ybub = 7500 * (YY / 3.2) ** -0.3214
......
1277 1241

  
1278 1242
    def tp_regime(self, row):
1279 1243
        try:
1280
            tp_angle = self.geometry.item(row, 6).text()
1281
            if is_not_blank(tp_angle):
1282
                tp_angle = float(tp_angle)
1244
            angle = self.geometry.item(row, 6).text()
1245
            if is_not_blank(angle):
1246
                self.tp_angle = float(angle)
1283 1247
            else:
1284
                tp_angle = 0
1248
                self.tp_angle = 0
1285 1249

  
1286
            self.calculated_variable['tp_angle'] = tp_angle
1287

  
1288
            if tp_angle == 0:
1250
            if self.tp_angle == 0:
1289 1251
                self.tp_ho_regime()
1290
            elif tp_angle < 0:
1252
            elif self.tp_angle < 0:
1291 1253
                self.tp_vd_regime()
1292
            elif tp_angle > 0:
1254
            elif self.tp_angle > 0:
1293 1255
                self.tp_vu_regime()
1294 1256

  
1257
            self.pressure_variation[self.no][13] = self.x[self.no]
1258
            self.pressure_variation[self.no][14] = self.y[self.no]
1295 1259
            self.pressure_variation[self.no][15] = str(self.regime[self.no])
1296 1260
        except Exception as ex:
1297 1261
            from App import App
......
1303 1267

  
1304 1268
    def tp_calc_end(self, row):
1305 1269
        try:
1306
            # ToDo
1307
            # 2_DB 시트에 값 입력
1308

  
1309 1270
            element = self.geometry.item(row, 0).text()
1310 1271
            if element == 'Pipe':
1311
                tp_pressure = self.calculated_variable['tp_pressure']
1312
                tp_length = self.calculated_variable['tp_length']
1313
                tp_pipe_total_drop = self.calculated_variable['tp_pipe_total_drop']
1314

  
1315
                tp_pressure_ratio = (tp_pressure - tp_length * tp_pipe_total_drop) / tp_pressure
1316
                tp_pressure = tp_pressure - tp_length * tp_pipe_total_drop
1272
                self.tp_pressure_ratio = (self.tp_pressure - self.tp_length * self.tp_pipe_total_drop) / self.tp_pressure
1273
                self.tp_pressure = self.tp_pressure - self.tp_length * self.tp_pipe_total_drop
1317 1274

  
1318 1275
                # 현재 length = m
1319 1276
                length_unit = self.units['Length']
1320 1277
                if length_unit == 'm':
1321
                    t = tp_length
1278
                    total = self.tp_length
1322 1279
                elif length_unit == 'in':
1323
                    t = tp_length * 39.3701
1280
                    total = self.tp_length * 39.3701
1324 1281
                elif length_unit == 'ft':
1325
                    t = tp_length * 3.28084
1282
                    total = self.tp_length * 3.28084
1326 1283
                elif length_unit == 'yd':
1327
                    t = tp_length * 1.09361
1284
                    total = self.tp_length * 1.09361
1328 1285
                elif length_unit == 'mile':
1329
                    t = tp_length * 0.000621371
1286
                    total = self.tp_length * 0.000621371
1330 1287
                elif length_unit == 'mm':
1331
                    t = tp_length * 1000
1288
                    total = self.tp_length * 1000
1332 1289

  
1333 1290
                # 현재 kg/cm2/m
1334 1291
                pressure_unit = self.units['Pressure']
1335 1292
                if pressure_unit == 'kg/cm2':
1336
                    t = t * tp_pipe_total_drop
1293
                    total = total * self.tp_pipe_total_drop
1337 1294
                elif pressure_unit == 'psi':
1338
                    t = t * tp_pipe_total_drop / 1.033 * 14.7
1295
                    total = total * self.tp_pipe_total_drop / 1.033 * 14.7
1339 1296
                elif pressure_unit == 'atm':
1340
                    t = t * tp_pipe_total_drop / 1.033
1297
                    total = total * self.tp_pipe_total_drop / 1.033
1341 1298
                elif pressure_unit == 'bar':
1342
                    t = t * tp_pipe_total_drop / 1.033 * 1.033
1299
                    total = total * self.tp_pipe_total_drop / 1.033 * 1.033
1343 1300
                elif pressure_unit == 'mmHg':
1344
                    t = t * tp_pipe_total_drop / 1.033 * 760
1301
                    total = total * self.tp_pipe_total_drop / 1.033 * 760
1345 1302
                elif pressure_unit == 'kPa':
1346
                    t = t * tp_pipe_total_drop / 1.033 * 101.325
1303
                    total = total * self.tp_pipe_total_drop / 1.033 * 101.325
1347 1304
                elif pressure_unit == 'MPa':
1348
                    t = t * tp_pipe_total_drop / 1.033 * 0.101325
1305
                    total = total * self.tp_pipe_total_drop / 1.033 * 0.101325
1349 1306

  
1350 1307
                if length_unit == 'm':
1351
                    t = t
1308
                    total = total
1352 1309
                elif length_unit == 'in':
1353
                    t = t / 39.3701
1310
                    total = total / 39.3701
1354 1311
                elif length_unit == 'ft':
1355
                    t = t / 3.28084
1312
                    total = total / 3.28084
1356 1313
                elif length_unit == 'yd':
1357
                    t = t / 1.09361
1314
                    total = total / 1.09361
1358 1315
                elif length_unit == 'mile':
1359
                    t = t / 0.000621371
1316
                    total = total / 0.000621371
1360 1317
                elif length_unit == 'mm':
1361
                    t = t / 1000
1362
            else:
1363
                tp_pressure = self.calculated_variable['tp_pressure']
1364
                tp_element_dp = self.calculated_variable['tp_element_dp']
1318
                    total = total / 1000
1365 1319

  
1366
                tp_pressure_ratio = (tp_pressure - tp_element_dp) / tp_pressure
1367
                tp_pressure = tp_pressure - tp_element_dp
1320
                self.total[self.no] = total
1321
            else:
1322
                self.tp_pressure_ratio = (self.tp_pressure - self.tp_element_dp) / self.tp_pressure
1323
                self.tp_pressure = self.tp_pressure - self.tp_element_dp
1368 1324

  
1369 1325
                # 현재 kg/cm2/m
1370 1326
                pressure_unit = self.units['Pressure']
1371 1327
                if pressure_unit == 'kg/cm2':
1372
                    t = tp_element_dp
1328
                    total = self.tp_element_dp
1373 1329
                elif pressure_unit == 'psi':
1374
                    t = tp_element_dp / 1.033 * 14.7
1330
                    total = self.tp_element_dp / 1.033 * 14.7
1375 1331
                elif pressure_unit == 'atm':
1376
                    t = tp_element_dp / 1.033
1332
                    total = self.tp_element_dp / 1.033
1377 1333
                elif pressure_unit == 'bar':
1378
                    t = tp_element_dp / 1.033 * 1.033
1334
                    total = self.tp_element_dp / 1.033 * 1.033
1379 1335
                elif pressure_unit == 'mmHg':
1380
                    t = tp_element_dp / 1.033 * 760
1336
                    total = self.tp_element_dp / 1.033 * 760
1381 1337
                elif pressure_unit == 'kPa':
1382
                    t = tp_element_dp / 1.033 * 101.325
1338
                    total = self.tp_element_dp / 1.033 * 101.325
1383 1339
                elif pressure_unit == 'MPa':
1384
                    t = tp_element_dp / 1.033 * 0.101325
1340
                    total = self.tp_element_dp / 1.033 * 0.101325
1385 1341

  
1386
            self.total[self.no] = t
1387

  
1388
            self.calculated_variable['tp_pressure'] = tp_pressure
1389
            self.calculated_variable['tp_pressure_ratio'] = tp_pressure_ratio
1342
                self.total[self.no] = total
1390 1343

  
1391 1344
            self.tp_v_density_cal()
1392 1345
            self.void_frac(row)
......
1405 1358
    def decision_length(self, row):
1406 1359
        try:
1407 1360
            length_unit = self.units['Length']
1408
            tp_length = float(self.geometry.item(row, 5).text())
1361
            length = float(self.geometry.item(row, 5).text())
1409 1362
            if length_unit == 'm':
1410
                tp_length = tp_length
1363
                self.tp_length = length
1411 1364
            elif length_unit == 'in':
1412
                tp_length = tp_length * 0.0254
1365
                self.tp_length = length * 0.0254
1413 1366
            elif length_unit == 'ft':
1414
                tp_length = tp_length * 0.3048
1367
                self.tp_length = length * 0.3048
1415 1368
            elif length_unit == 'yd':
1416
                tp_length = tp_length * 0.9144
1369
                self.tp_length = length * 0.9144
1417 1370
            elif length_unit == 'mile':
1418
                tp_length = tp_length * 1609.344
1371
                self.tp_length = length * 1609.344
1419 1372
            elif length_unit == 'mm':
1420
                tp_length = tp_length * 0.001
1421

  
1422
            self.calculated_variable['tp_length'] = tp_length
1373
                self.tp_length = length * 0.001
1423 1374

  
1424 1375
            # '5% 분기점
1425
            tp_pressure = self.calculated_variable['tp_pressure']
1426
            calc_factor = 0.95
1376
            tp_pressure_est = self.tp_pressure * self.calc_factor
1427 1377

  
1428
            tp_pressure_est = tp_pressure * calc_factor
1429
            tp_pipe_total_drop = self.calculated_variable['tp_pipe_total_drop']
1430

  
1431
            if (tp_pressure - tp_pressure_est) > (tp_length * tp_pipe_total_drop):
1378
            if (self.tp_pressure - tp_pressure_est) > (self.tp_length * self.tp_pipe_total_drop):
1432 1379
                self.tp_calc_end(row)
1433
            elif (tp_pressure - tp_pressure_est) < (tp_length * tp_pipe_total_drop):
1380
            elif (self.tp_pressure - tp_pressure_est) < (self.tp_length * self.tp_pipe_total_drop):
1434 1381
                # 이 안에다 for 문들 다시 만들어야 함 모자란 길이 반복 계산
1435
                tp_remain_length = tp_length - (tp_pressure - tp_pressure_est) / tp_pipe_total_drop
1436
                tp_length = (tp_pressure - tp_pressure_est) / tp_pipe_total_drop
1437
                self.calculated_variable['tp_length'] = tp_length
1438
                tp_total_length = tp_remain_length + tp_length
1382
                tp_remain_length = self.tp_length - (self.tp_pressure - tp_pressure_est) / self.tp_pipe_total_drop
1383
                self.tp_length = (self.tp_pressure - tp_pressure_est) / self.tp_pipe_total_drop
1384

  
1385
                tp_total_length = tp_remain_length + self.tp_length
1439 1386

  
1440 1387
                # 무조건 처음에 한번은 해야할것 (tp_calc_end와 동일)
1441 1388
                self.tp_calc_end(row)
......
1444 1391

  
1445 1392
                tp_trial_length = 0
1446 1393
                for tp_trial in range(1, 100):
1447
                    tp_trial_length += tp_length
1394
                    tp_trial_length += self.tp_length
1448 1395
                    self.tp_fric(row)
1449 1396
                    self.tp_stat(row)
1450 1397
                    self.momen()
1451 1398

  
1452
                    tp_pressure = self.calculated_variable['tp_pressure']
1453
                    tp_pipe_total_drop = self.calculated_variable['tp_pipe_total_drop']
1454
                    tp_pressure_est = tp_pressure * calc_factor
1455
                    tp_remain_length = tp_total_length - tp_trial_length - (tp_pressure - tp_pressure_est) / tp_pipe_total_drop
1399
                    tp_pressure_est = self.tp_pressure * self.calc_factor
1400
                    tp_remain_length = tp_total_length - tp_trial_length - (self.tp_pressure - tp_pressure_est) / self.tp_pipe_total_drop
1456 1401

  
1457 1402
                    # tp_length 재정의
1458 1403
                    if tp_remain_length < 0:
1459 1404
                        # 계산이 끝나는 시점
1460
                        tp_length = tp_total_length - tp_trial_length
1461
                        self.calculated_variable['tp_length'] = tp_length
1405
                        self.tp_length = tp_total_length - tp_trial_length
1462 1406
                        self.tp_dp_input()
1463 1407
                        self.tp_calc_end(row)
1464 1408
                        break
1465 1409
                    elif tp_remain_length > 0:
1466
                        tp_length = (tp_pressure - tp_pressure_est) / tp_pipe_total_drop
1467
                        self.calculated_variable['tp_length'] = tp_length
1410
                        self.tp_length = (self.tp_pressure - tp_pressure_est) / self.tp_pipe_total_drop
1468 1411
                        self.tp_dp_input()
1469 1412
                        self.tp_calc_end(row)
1470 1413
                        self.no += 1
......
1495 1438
        try:
1496 1439
            tp_rperd = float(self.geometry.item(row, 7).text())
1497 1440

  
1498
            kval = self.geometry.item(row, 9).text()
1499
            if is_not_blank(kval):
1500
                kval = float(kval)
1441
            k = self.geometry.item(row, 9).text()
1442
            if is_not_blank(k):
1443
                self.kval = float(k)
1501 1444
            else:
1502 1445
                roughness_unit = self.units['Roughness']
1503 1446
                tp_rough = float(self.geometry.item(row, 4).text())
......
1511 1454
                    tp_rough = tp_rough * 0.001
1512 1455

  
1513 1456
                pipe_diameter_unit = self.units['Pipe_Diameter']
1514
                tp_id = float(self.geometry.item(row, 3).text())
1457
                id = float(self.geometry.item(row, 3).text())
1515 1458
                if pipe_diameter_unit == 'in':
1516
                    tp_id = tp_id * 0.0254
1459
                    self.tp_id = id * 0.0254
1517 1460
                elif pipe_diameter_unit == 'mm':
1518
                    tp_id = tp_id / 1000
1519

  
1520
                self.calculated_variable['tp_id'] = tp_id
1521

  
1522
                tp_angle = float(self.geometry.item(row, 6).text())
1523
                tp_rea_rough = tp_rough / tp_id
1524

  
1525
                tp_angle = 3.141593 * tp_angle / 180
1461
                    self.tp_id = id / 1000
1526 1462

  
1527
                tp_massflux = self.calculated_variable['tp_massflux']
1528
                l_visco = self.calculated_variable['l_viscosity']
1463
                angle = float(self.geometry.item(row, 6).text())
1464
                self.tp_rea_rough = tp_rough / self.tp_id
1465
                self.tp_angle = 3.141593 * angle / 180
1529 1466

  
1530
                rey = tp_massflux * tp_id / l_visco
1467
                rey = self.tp_massflux * self.tp_id / self.l_visco
1531 1468
                if rey <= 2100:
1532 1469
                    f = 16 / rey
1533 1470
                else:
1534
                    f = (-2 * (math.log(tp_rough / 3.7 / tp_id - 5.02 / rey * (
1535
                            math.log(tp_rough / tp_id / 3.7 + (6.7 / rey) ** 0.9) / math.log(10))) / math.log(10))) ** (
1471
                    f = (-2 * (math.log(tp_rough / 3.7 / self.tp_id - 5.02 / rey * (
1472
                            math.log(tp_rough / self.tp_id / 3.7 + (6.7 / rey) ** 0.9) / math.log(10))) / math.log(10))) ** (
1536 1473
                            -2)
1537 1474

  
1538
                kf = f * tp_rperd * tp_angle
1475
                kf = f * tp_rperd * self.tp_angle
1539 1476

  
1540
                if tp_rea_rough < 3 * 10 ** -5:
1477
                if self.tp_rea_rough < 3 * 10 ** -5:
1541 1478
                    fed = 0.027
1542 1479
                else:
1543
                    fed = 0.153 + (0.0121 * math.log(tp_rea_rough))
1480
                    fed = 0.153 + (0.0121 * math.log(self.tp_rea_rough))
1544 1481

  
1545 1482
                if rey < 10 ** 4:
1546 1483
                    fre = 0.8854
......
1549 1486
                else:
1550 1487
                    fre = 1.45 - 0.0613 * math.log(rey)
1551 1488

  
1552
                kb1 = 2 * tp_angle / 3.141593 * tp_rperd ** 0.5
1489
                kb1 = 2 * self.tp_angle / 3.141593 * tp_rperd ** 0.5
1553 1490
                kb = kb1 * fed + math.exp(-tp_rperd) * fre
1554 1491

  
1555
                kval = kf + kb
1556

  
1557
            bpara = 1 + 2.2 / (kval * (2 + tp_rperd))
1558

  
1559
            l_density = self.calculated_variable['l_density']
1560
            v_density = self.calculated_variable['v_density']
1561
            tp_quality = self.calculated_variable['tp_quality']
1562
            tp_massflux = self.calculated_variable['tp_massflux']
1492
                self.kval = kf + kb
1563 1493

  
1564
            pilo = 1 + (l_density / v_density - 1) * (bpara * tp_quality * (1 - tp_quality) + tp_quality ** 2)
1494
            bpara = 1 + 2.2 / (self.kval * (2 + tp_rperd))
1565 1495

  
1566
            tp_bend_dp = kval * (tp_massflux ** 2 / 2 / l_density) * pilo / 101325 * 1.033
1496
            pilo = 1 + (self.l_density / self.v_density - 1) * (bpara * self.tp_quality * (1 - self.tp_quality) + self.tp_quality ** 2)
1567 1497

  
1568
            kval = round(kval, 2)
1569
            self.calculated_variable['kval'] = kval
1498
            tp_bend_dp = self.kval * (self.tp_massflux ** 2 / 2 / self.l_density) * pilo / 101325 * 1.033
1570 1499

  
1571
            tp_element_dp = tp_bend_dp
1572
            self.calculated_variable['tp_element_dp'] = tp_element_dp
1500
            self.kval = round(self.kval, 2)
1501
            self.tp_element_dp = tp_bend_dp
1573 1502

  
1574 1503
            self.tp_calc_end(row)
1575 1504

  
......
1583 1512

  
1584 1513
    def tp_nozzl_cal(self, row):
1585 1514
        try:
1586
            kval = self.geometry.item(row, 9).text()
1587
            if is_not_blank(kval):
1588
                kval = float(kval)
1515
            k = self.geometry.item(row, 9).text()
1516
            if is_not_blank(k):
1517
                self.kval = float(k)
1589 1518
            else:
1590 1519
                element = self.geometry.item(row, 0).text()
1591 1520
                if element == 'Nozzle In':
1592
                    kval = 1
1521
                    self.kval = 1
1593 1522
                elif element == 'Nozzle Out':
1594
                    kval = 0.5
1523
                    self.kval = 0.5
1595 1524

  
1596
            self.calculated_variable['kval'] = kval
1597
            l_density = self.calculated_variable['l_density']
1598
            v_density = self.calculated_variable['v_density']
1599
            tp_quality = self.calculated_variable['tp_quality']
1600

  
1601
            rat = l_density / v_density
1602
            rho = (v_density * l_density) / (tp_quality * (l_density - v_density) + v_density)
1603
            rath = (l_density / rho) ** 0.5
1604
            braca = (tp_quality * rat) + (rath * (1 - tp_quality))
1525
            rat = self.l_density / self.v_density
1526
            rho = (self.v_density * self.l_density) / (self.tp_quality * (self.l_density - self.v_density) + self.v_density)
1527
            rath = (self.l_density / rho) ** 0.5
1528
            braca = (self.tp_quality * rat) + (rath * (1 - self.tp_quality))
1605 1529
            bracb = 1 + (rath - 1) ** 2 / (rat ** 0.5 - 1)
1606
            bracb = bracb * (1 - tp_quality) / rath + tp_quality
1530
            bracb = bracb * (1 - self.tp_quality) / rath + self.tp_quality
1607 1531
            pilo = braca * bracb
1608 1532

  
1609 1533
            # kg/cm2의 단위로 되어있음
1610
            tp_massflux = self.calculated_variable['tp_massflux']
1611
            tp_nozzl_total_dp = (kval * tp_massflux ** 2 / 2 / l_density) * pilo / 101325 * 1.033
1612

  
1613
            tp_element_dp = tp_nozzl_total_dp
1534
            tp_nozzl_total_dp = (self.kval * self.tp_massflux ** 2 / 2 / self.l_density) * pilo / 101325 * 1.033
1535
            self.tp_element_dp = tp_nozzl_total_dp
1614 1536

  
1615
            self.calculated_variable['tp_element_dp'] = tp_element_dp
1616 1537
            self.tp_calc_end(row)
1617 1538

  
1618 1539
        except Exception as ex:
......
1628 1549
            rod = float(self.geometry.item(row, 8).text())
1629 1550
            rod = 1 / rod  # '이부분, d1/d2 정책으로 인하여 변경되었음
1630 1551

  
1631
            kval = self.geometry.item(row, 9).text()
1632
            if is_not_blank(kval):
1633
                kval = float(kval)
1552
            k = self.geometry.item(row, 9).text()
1553
            if is_not_blank(k):
1554
                self.kval = float(k)
1634 1555
            else:
1635 1556
                angle = float(self.geometry.item(row, 6).text())
1636 1557
                if angle <= 22.5:
1637
                    kval = 2.6 * (1 - rod ** 2) ** 2 / rod ** 4 * math.sin(3.141593 / 180)
1558
                    self.kval = 2.6 * (1 - rod ** 2) ** 2 / rod ** 4 * math.sin(3.141593 / 180)
1638 1559
                else:
1639
                    kval = (1 - rod ** 2) ** 2 / rod ** 4
1640

  
1641
            self.calculated_variable['kval'] = kval
1560
                    self.kval = (1 - rod ** 2) ** 2 / rod ** 4
1642 1561

  
1643 1562
            sigma = rod ** 2
1644 1563

  
1645
            tp_quality = self.calculated_variable['tp_quality']
1646
            tp_void = self.calculated_variable['tp_void']
1647
            l_density = self.calculated_variable['l_density']
1648
            v_density = self.calculated_variable['v_density']
1649
            tp_massflux = self.calculated_variable['tp_massflux']
1650

  
1651
            flsq = (1 - tp_quality) ** 2
1652
            pilo = (tp_quality ** 2 / tp_void) * (l_density / v_density) + flsq / (1 - tp_void)
1653

  
1654
            tp_expander_total_dp = ((
1655
                                            kval - 1 + 1 / sigma ** 2) * tp_massflux ** 2 / 2 / l_density) * pilo / 10 ** 5 / 1.013 * 1.033
1564
            flsq = (1 - self.tp_quality) ** 2
1565
            pilo = (self.tp_quality ** 2 / self.tp_void) * (self.l_density / self.v_density) + flsq / (1 - self.tp_void)
1566
            tp_expander_total_dp = ((self.kval - 1 + 1 / sigma ** 2) * self.tp_massflux ** 2 / 2 / self.l_density) * pilo / 10 ** 5 / 1.013 * 1.033
1656 1567

  
1657
            tp_element_dp = tp_expander_total_dp
1658
            self.calculated_variable['tp_element_dp'] = tp_element_dp
1568
            self.tp_element_dp = tp_expander_total_dp
1659 1569

  
1660 1570
            self.tp_calc_end(row)
1661 1571

  
......
1671 1581
        try:
1672 1582
            ang = float(self.geometry.item(row, 6).text())
1673 1583
            rod = float(self.geometry.item(row, 8).text())
1674
            tp_id = float(self.geometry.item(row, 3).text())
1584
            id = float(self.geometry.item(row, 3).text())
1675 1585
            pipe_diameter_unit = self.units['Pipe_Diameter']
1676 1586
            if pipe_diameter_unit == 'in':
1677
                tp_id = tp_id * 0.0254
1587
                self.tp_id = id * 0.0254
1678 1588
            elif pipe_diameter_unit == 'mm':
1679
                tp_id = tp_id / 1000
1680

  
1681
            self.calculated_variable['tp_id'] = tp_id
1589
                self.tp_id = id / 1000
1682 1590

  
1683 1591
            sigma = rod ** 2
1684
            dcube = sigma + rod
1592
            dcube = sigma * rod
1685 1593
            dfive = sigma ** 2 * rod
1686 1594
            ak1 = (8.54038 * dfive) - (19.2214 * sigma ** 2)
1687 1595
            ak2 = (14.24265 * dcube) - (4.53854 * sigma)
1688 1596
            ak3 = (0.39543 * rod) + 0.57806
1689
            kval = ak1 + ak2 + ak3
1690 1597

  
1691 1598
            if ang < 90:
1692 1599
                theta = float(self.geometry.item(row, 6).text()) / 90
......
1695 1602
                c3 = 0.03614 * c2 ** 4.79082
1696 1603
                cc = (c1 + c3) ** 0.25
1697 1604

  
1698
                kval = kval * cc
1605
                self.kval = (ak1 + ak2 + ak3) * cc
1699 1606

  
1700 1607
            if is_not_blank(self.geometry.item(row, 9).text()):
1701
                kval = float(self.geometry.item(row, 9).text())
1702

  
1703
            self.calculated_variable['kval'] = kval
1608
                self.kval = float(self.geometry.item(row, 9).text())
1704 1609

  
1705 1610
            # fric 구하기
1706
            tp_massflux = self.calculated_variable['tp_massflux']
1707
            tp_quality = self.calculated_variable['tp_quality']
1708
            l_visco = self.calculated_variable['l_viscosity']
1709
            v_visco = self.calculated_variable['v_viscosity']
1710

  
1711
            l_rey = tp_massflux * (1 - tp_quality) * tp_id / l_visco
1712
            v_rey = tp_massflux * tp_quality * tp_id / v_visco
1611
            l_rey = self.tp_massflux * (1 - self.tp_quality) * self.tp_id / self.l_visco
1612
            v_rey = self.tp_massflux * self.tp_quality * self.tp_id / self.v_visco
1713 1613

  
1714 1614
            roughness_unit = self.units['Roughness']
1715 1615
            tp_rough = float(self.geometry.item(row, 4).text())
......
1722 1622
            elif roughness_unit == 'mm':
1723 1623
                tp_rough = tp_rough * 0.001
1724 1624

  
1725
            tp_rea_rough = tp_rough / tp_id
1726
            self.calculated_variable['tp_rea_rough'] = tp_rea_rough
1625
            self.tp_rea_rough = tp_rough / self.tp_id
1727 1626

  
1728 1627
            if l_rey <= 2100:
1729 1628
                l_f = 16 / l_rey
1730 1629
            else:
1731
                l_f = (-4 * (math.log(tp_rough / 3.7 / tp_id - 5.02 / l_rey * (
1732
                        math.log(tp_rough / tp_id / 3.7 + (6.7 / l_rey) ** 0.9) / math.log(10))) / math.log(10))) ** (
1630
                l_f = (-4 * (math.log(tp_rough / 3.7 / self.tp_id - 5.02 / l_rey * (
1631
                        math.log(tp_rough / self.tp_id / 3.7 + (6.7 / l_rey) ** 0.9) / math.log(10))) / math.log(10))) ** (
1733 1632
                          -2)
1734 1633

  
1735 1634
            if v_rey <= 2100:
1736 1635
                v_f = 16 / v_rey
1737 1636
            else:
1738
                v_f = (-4 * (math.log(tp_rough / 3.7 / tp_id - 5.02 / v_rey * (
1739
                        math.log(tp_rough / tp_id / 3.7 + (6.7 / v_rey) ** 0.9) / math.log(10))) / math.log(10))) ** (
1637
                v_f = (-4 * (math.log(tp_rough / 3.7 / self.tp_id - 5.02 / v_rey * (
1638
                        math.log(tp_rough / self.tp_id / 3.7 + (6.7 / v_rey) ** 0.9) / math.log(10))) / math.log(10))) ** (
1740 1639
                          -2)
1741 1640

  
1742 1641
            # dmvel 정의
1743 1642
            l_flowrate = float(self.process['l_flowrate'])
1744 1643
            v_flowrate = float(self.process['v_flowrate'])
1745 1644

  
1746
            ddia = (rod * tp_id)
1645
            ddia = (rod * self.tp_id)
1747 1646
            dmvel = (l_flowrate + v_flowrate) / 3600 / (3.141592 / 4 * ddia ** 2)
1748 1647

  
1749
            l_density = self.calculated_variable['l_density']
1750
            v_density = self.calculated_variable['v_density']
1751

  
1752
            drat = l_density / v_density
1753
            ratff = (l_f * v_density) / (v_f * l_density)
1754
            xlm = ratff ** 0.5 * (1 - tp_quality) / tp_quality
1648
            drat = self.l_density / self.v_density
1649
            ratff = (l_f * self.v_density) / (v_f * self.l_density)
1650
            xlm = ratff ** 0.5 * (1 - self.tp_quality) / self.tp_quality
1755 1651
            rxlm = 1 / xlm
1756
            flsq = (1 - tp_quality) ** 2
1652
            flsq = (1 - self.tp_quality) ** 2
1757 1653
            alm = rxlm * (l_f / v_f) ** 0.5
1758 1654
            alms = alm ** 2
1759 1655
            coff = drat ** 0.5 + (1 / drat) ** 0.5
......
1762 1658

  
1763 1659
            # kg/cm2
1764 1660
            tp_reducer_total_dp = ((
1765
                                           kval + 1 - sigma ** 2) * dmvel ** 2 / 2 / l_density) * tpfm / 10 ** 5 / 1.013 * 1.033
1766
            tp_element_dp = tp_reducer_total_dp
1767
            self.calculated_variable['tp_element_dp'] = tp_element_dp
1661
                                           self.kval + 1 - sigma ** 2) * dmvel ** 2 / 2 / self.l_density) * tpfm / 10 ** 5 / 1.013 * 1.033
1662
            self.tp_element_dp = tp_reducer_total_dp
1768 1663

  
1769 1664
            self.tp_calc_end(row)
1770 1665
        except Exception as ex:
......
1777 1672

  
1778 1673
    def tp_valve_cal(self, row):
1779 1674
        try:
1780
            kval = self.geometry.item(row, 9).text()
1781
            if is_not_blank(kval):
1782
                kval = float(kval)
1675
            k = self.geometry.item(row, 9).text()
1676
            if is_not_blank(k):
1677
                self.kval = float(k)
1783 1678
            else:
1784 1679
                element = self.geometry.item(row, 0).text()
1785 1680
                if element == 'Check Valve':
1786
                    kval = 7
1681
                    self.kval = 7
1787 1682
                elif element == 'Ball Valve':
1788
                    kval = 0.1
1683
                    self.kval = 0.1
1789 1684
                elif element == 'Gate Valve':
1790
                    kval = 0.2
1685
                    self.kval = 0.2
1791 1686
                elif element == 'Globe Valve':
1792
                    kval = 0.2
1687
                    self.kval = 0.2
1793 1688
                elif element == 'Butterfly Valve':
1794 1689
                    inside_diameter = float(self.geometry.item(row, 3).text())
1795 1690
                    if inside_diameter < 8.5:
1796
                        kval = 0.76
1691
                        self.kval = 0.76
1797 1692
                    elif 9 < inside_diameter < 15:
1798
                        kval = 0.49
1693
                        self.kval = 0.49
1799 1694
                    elif 15 < inside_diameter < 25:
1800
                        kval = 0.33
1695
                        self.kval = 0.33
1801 1696
                    else:
1802
                        kval = 0.25
1803

  
1804
            self.calculated_variable['kval'] = kval
1697
                        self.kval = 0.25
1805 1698

  
1806
            l_density = self.calculated_variable['l_density']
1807
            v_density = self.calculated_variable['v_density']
1808
            tp_quality = self.calculated_variable['tp_quality']
1809

  
1810
            rat = l_density / v_density
1811
            rho = (v_density * l_density) / (tp_quality * (l_density - v_density) + v_density)
1812
            rath = (l_density / rho) ** 0.5
1813
            braca = (tp_quality * rat) + (rath * (1 - tp_quality))
1699
            rat = self.l_density / self.v_density
1700
            rho = (self.v_density * self.l_density) / (self.tp_quality * (self.l_density - self.v_density) + self.v_density)
1701
            rath = (self.l_density / rho) ** 0.5
1702
            braca = (self.tp_quality * rat) + (rath * (1 - self.tp_quality))
1814 1703
            bracb = 1 + (rath - 1) ** 2 / (rat ** 0.5 - 1)
1815
            bracb = bracb * (1 - tp_quality) / rath + tp_quality
1704
            bracb = bracb * (1 - self.tp_quality) / rath + self.tp_quality
1816 1705
            pilo = braca * bracb
1817 1706

  
1818 1707
            # kg/cm2의 단위로 되어있음
1819
            tp_massflux = self.calculated_variable['tp_massflux']
1820
            tp_valve_total_dp = (kval * tp_massflux ** 2 / 2 / l_density) * pilo / 101325 * 1.033
1821

  
1822
            tp_element_dp = tp_valve_total_dp
1823
            self.calculated_variable['tp_element_dp'] = tp_element_dp
1708
            tp_valve_total_dp = (self.kval * self.tp_massflux ** 2 / 2 / self.l_density) * pilo / 101325 * 1.033
1709
            self.tp_element_dp = tp_valve_total_dp
1824 1710

  
1825 1711
            self.tp_calc_end(row)
1826 1712

  
......
1912 1798
                values['Density'] = self.mean_den[0]
1913 1799

  
1914 1800
                # 부피유량 계산
1915
                tp_flow = self.calculated_variable['tp_flow']
1916
                tp_mean_den = self.calculated_variable['tp_mean_den']
1917

  
1918
                tp_volume = tp_flow / tp_mean_den * 3600
1801
                tp_volume = self.tp_flow / self.tp_mean_den * 3600
1919 1802
                # 현재 tp_volume은 m3/h임.부피유량 단위에 맞춰 뿌려줌
1920 1803
                flowrate_volume_unit = self.units['Flowrate_Volume']
1921 1804
                if flowrate_volume_unit == 'm3/h':
......
1945 1828
            self.no = 0
1946 1829

  
1947 1830
            Ref_baro = self.get_barometric_pressure()
1948
            calc_factor = 0.95
1831
            self.calc_factor = self.get_mixed_calc_factor()
1949 1832

  
1950 1833
            # (1) fixed property
1951 1834
            # mass flowrate
......
1955 1838
            # mass flowrate를 kg/s로 맞춘다
1956 1839
            flowrate_mass_unit = self.units['Flowrate_Mass']
1957 1840
            if flowrate_mass_unit == 'kg/h':
1958
                tp_flow = (l_flowrate + v_flowrate) / 3600
1841
                self.tp_flow = (l_flowrate + v_flowrate) / 3600
1959 1842
            elif flowrate_mass_unit == 'g/min':
1960
                tp_flow = (l_flowrate + v_flowrate) / 60 / 1000
1843
                self.tp_flow = (l_flowrate + v_flowrate) / 60 / 1000
1961 1844
            elif flowrate_mass_unit == 'lb/h':
1962
                tp_flow = (l_flowrate + v_flowrate) * 0.000125998
1845
                self.tp_flow = (l_flowrate + v_flowrate) * 0.000125998
1963 1846
            elif flowrate_mass_unit == 't/h':
1964
                tp_flow = (l_flowrate + v_flowrate) * 0.277778
1965

  
1966
            self.calculated_variable['tp_flow'] = tp_flow
1847
                self.tp_flow = (l_flowrate + v_flowrate) * 0.277778
1967 1848

  
1968 1849
            # liquid density
1969 1850
            density_unit = self.units['Density']
1970 1851
            if density_unit == 'kg/m3':
1971
                l_density = float(self.process['l_density'])
1852
                self.l_density = float(self.process['l_density'])
1972 1853
            elif density_unit == 'lb/ft3':
1973
                l_density = float(self.process['l_density']) * 16.0185
1974

  
1975
            self.calculated_variable['l_density'] = l_density
1854
                self.l_density = float(self.process['l_density']) * 16.0185
1976 1855

  
1977 1856
            # viscosity
1978 1857
            viscosity_unit = self.units['Viscosity']
1979 1858
            if viscosity_unit == 'kg/m.sec':
1980
                l_viscosity = float(self.process['l_viscosity'])
1981
                v_viscosity = float(self.process['v_viscosity'])
1859
                self.l_visco = float(self.process['l_viscosity'])
1860
                self.v_visco = float(self.process['v_viscosity'])
1982 1861
            elif viscosity_unit == 'cP':
1983
                l_viscosity = float(self.process['l_viscosity']) * 0.001
1984
                v_viscosity = float(self.process['v_viscosity']) * 0.001
1862
                self.l_visco = float(self.process['l_viscosity']) * 0.001
1863
                self.v_visco = float(self.process['v_viscosity']) * 0.001
1985 1864
            elif viscosity_unit == 'kg/m.h':
1986
                l_viscosity = float(self.process['l_viscosity']) / 3600
1987
                v_viscosity = float(self.process['v_viscosity']) / 3600
1865
                self.l_visco = float(self.process['l_viscosity']) / 3600
1866
                self.v_visco = float(self.process['v_viscosity']) / 3600
1988 1867
            elif viscosity_unit == 'lb/ft.s':
1989
                l_viscosity = float(self.process['l_viscosity']) * 47.8803
1990
                v_viscosity = float(self.process['v_viscosity']) * 47.8803
1991

  
1992
            self.calculated_variable['l_viscosity'] = l_viscosity
1993
            self.calculated_variable['v_viscosity'] = v_viscosity
1868
                self.l_visco = float(self.process['l_viscosity']) * 47.8803
1869
                self.v_visco = float(self.process['v_viscosity']) * 47.8803
1994 1870

  
1995 1871
            # quality 구하기
1996
            tp_quality = v_flowrate / (l_flowrate + v_flowrate)
1997
            self.calculated_variable['tp_quality'] = tp_quality
1872
            self.tp_quality = v_flowrate / (l_flowrate + v_flowrate)
1998 1873

  
1999 1874
            # (2) initial pressure and property
2000 1875
            # set initial point pressure
......
2003 1878
            # pressure를 k/g.a로 맞춘다
2004 1879
            pressure_unit = self.units['Pressure']
2005 1880
            if pressure_unit == 'kg/cm2':
2006
                tp_pressure = tp_pressure + Ref_baro
1881
                self.tp_pressure = tp_pressure + Ref_baro
2007 1882
            elif pressure_unit == 'psi':
2008
                tp_pressure = tp_pressure / 14.7 * 1.033 + Ref_baro
1883
                self.tp_pressure = tp_pressure / 14.7 * 1.033 + Ref_baro
2009 1884
            elif pressure_unit == 'atm':
2010
                tp_pressure = tp_pressure * 1.033 + Ref_baro
1885
                self.tp_pressure = tp_pressure * 1.033 + Ref_baro
2011 1886
            elif pressure_unit == 'bar':
2012
                tp_pressure = tp_pressure / 1.013 * 1.033 + Ref_baro
1887
                self.tp_pressure = tp_pressure / 1.013 * 1.033 + Ref_baro
2013 1888
            elif pressure_unit == 'mmHg':
2014
                tp_pressure = tp_pressure / 760 * 1.033 + Ref_baro
1889
                self.tp_pressure = tp_pressure / 760 * 1.033 + Ref_baro
2015 1890
            elif pressure_unit == 'kPa':
2016
                tp_pressure = tp_pressure / 101.325 * 1.033 + Ref_baro
1891
                self.tp_pressure = tp_pressure / 101.325 * 1.033 + Ref_baro
2017 1892
            elif pressure_unit == 'MPa':
2018
                tp_pressure = tp_pressure / 0.101325 * 1.033 + Ref_baro
2019

  
2020
            self.calculated_variable['tp_pressure'] = tp_pressure
1893
                self.tp_pressure = tp_pressure / 0.101325 * 1.033 + Ref_baro
2021 1894

  
2022 1895
            self.tp_property(0)
2023 1896
            self.tp_property_input()
......
2077 1950
            self.element[self.no] = element
2078 1951

  
2079 1952
            # pressure (현재 kga)
2080
            tp_pressure = self.calculated_variable['tp_pressure']
2081 1953
            pressure_unit = self.units['Pressure']
2082 1954
            if pressure_unit == 'kg/cm2':
2083
                p = tp_pressure - baro_P
1955
                p = self.tp_pressure - baro_P
2084 1956
            elif pressure_unit == 'psi':
2085
                p = tp_pressure / 1.033 * 14.7 - baro_P
1957
                p = self.tp_pressure / 1.033 * 14.7 - baro_P
2086 1958
            elif pressure_unit == 'atm':
2087
                p = tp_pressure / 1.033
1959
                p = self.tp_pressure / 1.033
2088 1960
            elif pressure_unit == 'bar':
2089
                p = tp_pressure / 1.033 * 1.033 - baro_P
1961
                p = self.tp_pressure / 1.033 * 1.033 - baro_P
2090 1962
            elif pressure_unit == 'mmHg':
2091
                p = tp_pressure / 1.033 * 760 - baro_P
1963
                p = self.tp_pressure / 1.033 * 760 - baro_P
2092 1964
            elif pressure_unit == 'kPa':
2093
                p = tp_pressure / 1.033 * 101.325 - baro_P
1965
                p = self.tp_pressure / 1.033 * 101.325 - baro_P
2094 1966
            elif pressure_unit == 'MPa':
2095
                p = tp_pressure / 1.033 * 0.101325 - baro_P
1967
                p = self.tp_pressure / 1.033 * 0.101325 - baro_P
2096 1968

  
2097 1969
            self.pressure[self.no] = p
2098 1970

  
2099 1971
            # density (현재 kg/m3)
2100 1972
            density_unit = self.units['Density']
2101 1973
            if density_unit == 'kg/m3':
2102
                d = self.calculated_variable['tp_mean_den']
2103
                vd = self.calculated_variable['v_density']
1974
                d = self.tp_mean_den
1975
                vd = self.v_density
2104 1976
            else:
2105
                d = self.calculated_variable['tp_mean_den'] * 0.062428
2106
                vd = self.calculated_variable['v_density'] * 0.062428
1977
                d = self.tp_mean_den * 0.062428
1978
                vd = self.v_density * 0.062428
2107 1979

  
2108 1980
            self.mean_den[self.no] = d
2109
            self.v_density[self.no] = vd
1981
            self.density[self.no] = vd
2110 1982

  
2111 1983
            # velocity (m/s)
2112 1984
            velocity_unit = self.units['Velocity']
2113 1985
            if velocity_unit == 'm/s':
2114
                av = self.calculated_variable['tp_homo_vel']
2115
                mv = self.calculated_variable['tp_max_vel']
2116
                ev = self.calculated_variable['tp_ero_vel']
1986
                av = self.tp_homo_vel
1987
                mv = self.tp_max_vel
1988
                ev = self.tp_ero_vel
2117 1989
            elif velocity_unit == 'ft/s':
2118
                av = self.calculated_variable['tp_homo_vel'] * 3.28084
2119
                mv = self.calculated_variable['tp_max_vel'] * 3.28084
2120
                ev = self.calculated_variable['tp_ero_vel'] * 3.28084
1990
                av = self.tp_homo_vel * 3.28084
1991
                mv = self.tp_max_vel * 3.28084
1992
                ev = self.tp_ero_vel * 3.28084
2121 1993

  
2122 1994
            self.homo_vel[self.no] = av
2123 1995
            self.max_vel[self.no] = mv
2124 1996
            self.ero_vel[self.no] = ev
2125 1997

  
2126 1998
            # dimensionless
2127
            v = self.calculated_variable['tp_void']
2128
            q = self.calculated_variable['tp_quality']
2129

  
2130
            self.void[self.no] = v
2131
            self.quality[self.no] = q
1999
            self.void[self.no] = self.tp_void
2000
            self.quality[self.no] = self.tp_quality
2132 2001

  
2133 2002
            if element != 'Start Point':
2134 2003
                # dia (현재 m)
2135 2004
                pipe_diameter_unit = self.units['Pipe_Diameter']
2136 2005
                if pipe_diameter_unit == 'in':
2137
                    id = self.calculated_variable['tp_id'] / 0.0254
2006
                    id = self.tp_id / 0.0254
2138 2007
                elif pipe_diameter_unit == 'mm':
2139
                    id = self.calculated_variable['tp_id'] * 1000
2008
                    id = self.tp_id * 1000
2140 2009

  
2141 2010
                self.inside_diameter[self.no] = id
2142 2011

  
......
2146 2015
                    # Element가 Pipe인 경우만 l가 있음
2147 2016
                    length_unit = self.units['Length']
2148 2017
                    if length_unit == 'm':
2149
                        l = self.calculated_variable['tp_length']
2018
                        l = self.tp_length
2150 2019
                    elif length_unit == 'in':
2151
                        l = self.calculated_variable['tp_length'] * 39.3701
2020
                        l = self.tp_length * 39.3701
2152 2021
                    elif length_unit == 'ft':
2153
                        l = self.calculated_variable['tp_length'] * 3.28084
2022
                        l = self.tp_length * 3.28084
2154 2023
                    elif length_unit == 'yd':
2155
                        l = self.calculated_variable['tp_length'] * 1.09361
2024
                        l = self.tp_length * 1.09361
2156 2025
                    elif length_unit == 'mile':
2157
                        l = self.calculated_variable['tp_length'] * 0.000621371
2026
                        l = self.tp_length * 0.000621371
2158 2027
                    elif length_unit == 'mm':
2159
                        l = self.calculated_variable['tp_length'] * 1000
2028
                        l = self.tp_length * 1000
2160 2029

  
2161 2030
                    self.length[self.no] = l
2162 2031

  
......
2164 2033
                    self.angle[self.no] = None
2165 2034
                else:
2166 2035
                    # Element가 Valve가 아닌경우에만 있음
2167
                    a = self.calculated_variable['tp_angle']
2168
                    self.angle[self.no] = a
2036
                    self.angle[self.no] = self.tp_angle
2169 2037

  
2170 2038
                if element.find('Pipe') == -1:
2171 2039
                    # Element가 Pipe가 아닌경우에는 k가 있음
2172
                    k = self.calculated_variable['kval']
2173
                    self.k[self.no] = k
2040
                    self.k[self.no] = self.kval
2174 2041

  
2175 2042
            key = self.no
2176 2043
            inside_diameter = self.inside_diameter[key] if key in self.inside_diameter else None
......
2181 2048
            void = self.void[key] if key in self.void else None
2182 2049
            quality = self.quality[key] if key in self.quality else None
2183 2050
            mean_den = self.mean_den[key] if key in self.mean_den else None
2184
            v_density = self.v_density[key] if key in self.v_density else None
2051
            v_density = self.density[key] if key in self.density else None
2185 2052
            homo_vel = self.homo_vel[key] if key in self.homo_vel else None
2186 2053
            max_vel = self.max_vel[key] if key in self.max_vel else None
2187 2054
            ero_vel = self.ero_vel[key] if key in self.ero_vel else None
......
2197 2064
                                            quality, mean_den, v_density, homo_vel, max_vel, ero_vel,
2198 2065
                                            x, y, regime, dp_fric, dp_stat, dp_momen, total])
2199 2066

  
2200
            # ToDo
2201
            # 2_DB 시트에 값 입력
2202 2067
        except Exception as ex:
2203 2068
            from App import App
2204 2069
            from AppDocData import MessageType
......
2230 2095
                # diameter를 m로 맞춘다
2231 2096
                pipe_diameter_unit = self.units['Pipe_Diameter']
2232 2097
                if pipe_diameter_unit == 'in':
2233
                    tp_id = float(tp_id) * 0.0254
2098
                    self.tp_id = float(tp_id) * 0.0254
2234 2099
                elif pipe_diameter_unit == 'mm':
2235
                    tp_id = float(tp_id) / 1000
2100
                    self.tp_id = float(tp_id) / 1000
2236 2101

  
2237
                self.calculated_variable['tp_id'] = tp_id
2238 2102
                # massflux 구한다 (kg/m^2s) 현재 tp_flow = kg/s, tp_id = m
2239
                tp_flow = self.calculated_variable['tp_flow']
2240
                tp_massflux = tp_flow / ((3.1415 / 4) * (tp_id ** 2))
2241

  
2242
                self.calculated_variable['tp_massflux'] = tp_massflux
2103
                self.tp_massflux = self.tp_flow / ((3.1415 / 4) * (self.tp_id ** 2))
2243 2104

  
2244
                tp_angle = self.geometry.item(row, 6).text()
2245
                if is_not_blank(tp_angle):
2246
                    tp_angle = float(tp_angle)
2105
                angle = self.geometry.item(row, 6).text()
2106
                if is_not_blank(angle):
2107
                    self.tp_angle = float(angle)
2247 2108
                else:
2248
                    tp_angle = 0
2249
                self.calculated_variable['tp_angle'] = tp_angle
2109
                    self.tp_angle = 0
2250 2110

  
2251 2111
                # (2) void frac
2252
                tp_quality = self.calculated_variable['tp_quality']
2253
                l_density = self.calculated_variable['l_density']
2254
                v_density = self.calculated_variable['v_density']
2255

  
2256
                tp_vr1 = tp_quality / (1 - tp_quality) * l_density / v_density
2112
                tp_vr1 = self.tp_quality / (1 - self.tp_quality) * self.l_density / self.v_density
2257 2113
                tp_vr = math.log(tp_vr1) / math.log(10)
2258
                tp_g = math.log(tp_massflux) / math.log(10)
2114
                tp_g = math.log(self.tp_massflux) / math.log(10)
2259 2115

  
2260
                if 0 < tp_angle < 90:
2261
                    tp_a = 1.667 - 0.00206 * tp_angle + 0.247 * math.sin(2 * tp_angle * 3.1415 / 180)
2262
                elif 0 > tp_angle > -90:
2263
                    tp_a = 1.667 + 0.00652 * tp_angle + 0.772 * math.sin(2 * tp_angle * 3.1415 / 180)
2264
                elif tp_angle == 90:
2116
                if 0 < self.tp_angle < 90:
2117
                    tp_a = 1.667 - 0.00206 * self.tp_angle + 0.247 * math.sin(2 * self.tp_angle * 3.1415 / 180)
2118
                elif 0 > self.tp_angle > -90:
2119
                    tp_a = 1.667 + 0.00652 * self.tp_angle + 0.772 * math.sin(2 * self.tp_angle * 3.1415 / 180)
2120
                elif self.tp_angle == 90:
2265 2121
                    tp_a = 1.482
2266
                elif tp_angle == 0:
2122
                elif self.tp_angle == 0:
2267 2123
                    tp_a = 1.667
2268
                elif tp_angle == -90:
2124
                elif self.tp_angle == -90:
2269 2125
                    tp_a = 1.081
2270 2126

  
2271
                l_visco = self.calculated_variable['l_viscosity']
2272
                v_visco = self.calculated_variable['v_viscosity']
2273

  
2274
                baroczy = (v_density / l_density) * (l_visco / v_visco) ** 0.2
2127
                baroczy = (self.v_density / self.l_density) * (self.l_visco / self.v_visco) ** 0.2
2275 2128
                if baroczy < 0.00316:
2276 2129
                    baroczy = 0.00316
2277 2130

  
2278
                lambda1 = math.log(baroczy) / math.log(10)
2279
                self.calculated_variable['lambda1'] = lambda1
2131
                self._lambda = math.log(baroczy) / math.log(10)
2280 2132

  
2281
                tp_logK = (-tp_a * lambda1) / (tp_g + 0.7563) * (1 + 0.1292 * lambda1 * (1 - 0.3792 * tp_vr) * (
2282
                        lambda1 + 4.007) * (1 + 0.1377 * tp_g))
2133
                tp_logK = (-tp_a * self._lambda) / (tp_g + 0.7563) * (1 + 0.1292 * self._lambda * (1 - 0.3792 * tp_vr) * (
2134
                        self._lambda + 4.007) * (1 + 0.1377 * tp_g))
2283 2135

  
2284 2136
                tp_K = 10 ** tp_logK
2285 2137
                if tp_K < 1:
2286 2138
                    tp_K = 1
2287 2139

  
2288
                tp_void = 1 / (1 + tp_K / tp_vr1)
2289
                self.calculated_variable['tp_void'] = tp_void
2140
                self.tp_void = 1 / (1 + tp_K / tp_vr1)
2290 2141

  
2291 2142
                # mean density 계산 (kg/m3)
2292
                tp_mean_den = l_density * (1 - tp_void) + v_density * tp_void
2293

  
2294
                self.calculated_variable['tp_mean_den'] = tp_mean_den
2143
                self.tp_mean_den = self.l_density * (1 - self.tp_void) + self.v_density * self.tp_void
2295 2144

  
2296 2145
                # homogeneous density 계산 (kg/m3)
2297 2146
                l_flowrate = float(self.process['l_flowrate'])
2298 2147
                v_flowrate = float(self.process['v_flowrate'])
2299 2148

  
2300
                tp_homo_den = l_density * (1 - ((v_flowrate / v_density) / (
2301
                        (v_flowrate / v_density) + (l_flowrate / l_density)))) + v_density * (
2302
                                      (v_flowrate / v_density) / (
2303
                                      (v_flowrate / v_density) + (l_flowrate / l_density)))
2149
                tp_homo_den = self.l_density * (1 - ((v_flowrate / self.v_density) / (
2150
                        (v_flowrate / self.v_density) + (l_flowrate / self.l_density)))) + self.v_density * (
2151
                                      (v_flowrate / self.v_density) / (
2152
                                      (v_flowrate / self.v_density) + (l_flowrate / self.l_density)))
2304 2153

  
2305 2154
                # homogeneous vel (m/s)
2306
                tp_homo_vel = tp_massflux * tp_quality / v_density + tp_massflux * (1 - tp_quality) / l_density
2307
                self.calculated_variable['tp_homo_vel'] = tp_homo_vel
2155
                self.tp_homo_vel = self.tp_massflux * self.tp_quality / self.v_density + self.tp_massflux * (1 - self.tp_quality) / self.l_density
2308 2156

  
2309 2157
                # max velocity (m/s)
2310
                tp_max_vel = 122 / (tp_homo_den ** 0.5)
2311
                self.calculated_variable['tp_max_vel'] = tp_max_vel
2158
                self.tp_max_vel = 122 / (tp_homo_den ** 0.5)
2312 2159

  
2313 2160
                # erosion velocity (m/s)
2314
                tp_ero_vel = 195 / (tp_homo_den ** 0.5)
2315
                self.calculated_variable['tp_ero_vel'] = tp_ero_vel
2161
                self.tp_ero_vel = 195 / (tp_homo_den ** 0.5)
2316 2162
            else:
2317 2163
                return
2318 2164
        except Exception as ex:
......
2329 2175
            if is_not_blank(self.process['v_density']):
2330 2176
                density_unit = self.units['Density']
2331 2177
                if density_unit == 'kg/m3':
2332
                    v_density = float(self.process['v_density'])
2178
                    self.v_density = float(self.process['v_density'])
2333 2179
                elif density_unit == 'lb/ft3':
... 이 차이점은 표시할 수 있는 최대 줄수를 초과해서 이 차이점은 잘렸습니다.

내보내기 Unified diff

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