프로젝트

일반

사용자정보

개정판 aeefc2a9

IDaeefc2a9dee77a8439082f0143d3e87d5fb7d67f
상위 4ba1fc9b
하위 e626c8ea

백흠경이(가) 약 5년 전에 추가함

issue #1198: Pressurized Item에서 멈추도록 Loop 생성 수정

Change-Id: I98440230dd5d82d6d2d0e997ca9ac9caac5c77d7

차이점 보기:

HYTOS/HYTOS/Commands/HydroCalculationCommand.py
22 22
        self.name = 'HydroCalculation' 
23 23

  
24 24
        self.loops = []
25
    
25

  
26
    def is_loop_end_item(self, item):
27
        """check given item is possible of end of loop"""
28

  
29
        return item.category == 'Equipment - [ Pressurized ]' or (item.name == 'R_Comp' or item.name == 'L_Comp')
30

  
26 31
    def execute(self, param):
27 32
        """ execute hydro calculation """
28 33
        from AppDocData import AppDocData
......
31 36

  
32 37
        queue = []
33 38
        try:
34
            pressurized = [item for item in self.imageViewer.scene.items() if type(item) is SymbolSvgItem and item.category == 'Equipment - [ Pressurized ]']
39
            pressurized = [item for item in self.imageViewer.scene.items() if type(item) is SymbolSvgItem and
40
                           self.is_loop_end_item(item)]
35 41
            for item in pressurized:
36 42
                matches = [conn for conn in item.connectors if conn.connectedItem and int(conn.connectedItem._conn_index) == 1]
37 43
                for match in matches:
......
43 49

  
44 50
            for loop in self.loops:
45 51
                loop.calculate()
52
                # update pressure and pressure drop
53
                for item in loop.items:
54
                    if item in loop.pressures:
55
                        item.pressure = loop.pressures[item]
56
                    if item in loop.pressure_drops:
57
                        item.pressure_drop = loop.pressure_drops[item]
46 58

  
47 59
            """ update pressure drop and pressure of stream data """
48 60
            app_doc_data = AppDocData.instance()
......
72 84

  
73 85
        try:
74 86
            while 1:
75
                if type(loop.items[-1]) is QEngineeringConnectorItem and type(loop.items[-1].parentItem()) is SymbolSvgItem:
76
                    if loop.items[-1].connectedItem and int(loop.items[-1].connectedItem._conn_index) == 1: # start at connector
87
                if type(loop.items[-1]) is QEngineeringConnectorItem and \
88
                        (type(loop.items[-1].parentItem()) is SymbolSvgItem):
89
                    # start at connector
90
                    if loop.items[-1].connectedItem and int(loop.items[-1].connectedItem._conn_index) == 1:
77 91
                        loop.items.append(loop.items[-1].connectedItem.parentItem())    # it should be streamline
78 92
                        if type(loop.items[-1]) is QEngineeringStreamlineItem:
79 93
                            matches = [conn.connectedItem for conn in loop.items[-1].connectors if int(conn._conn_index) == 2 and conn.connectedItem]
80 94
                            if matches:
81 95
                                loop.items.append(matches[0])
96
                                if self.is_loop_end_item(matches[0].parentItem()):
97
                                    break
82 98
                            else:
83
                                break 
84
                    elif loop.items[-1].connectedItem and int(loop.items[-1].connectedItem._conn_index) == 2:   # end at connector
99
                                break
100
                    # end at connector
101
                    elif loop.items[-1].connectedItem and int(loop.items[-1].connectedItem._conn_index) == 2:
85 102
                        matches = [conn for conn in loop.items[-1].parentItem().connectors if (not conn in loop.items) and conn.connectedItem and int(conn.connectedItem._conn_index) == 1]
86 103
                        if matches:
87 104
                            for match in matches[1:]:

내보내기 Unified diff

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