프로젝트

일반

사용자정보

개정판 1b00446f

ID1b00446f0e412abdf56b959fcce0b1f11353c01a
상위 7c580b99
하위 671b5aff, 374bf908

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

issue #1058 : 계산 후 결과 표시

Change-Id: Iebd51d5d5ed779aee8c945dfa614c87542731c42

차이점 보기:

HYTOS/HYTOS/Commands/HydroCalculationCommand.py
24 24
        super(HydroCalculationCommand, self).__init__(imageViewer)
25 25
        self.name = 'HydroCalculation'
26 26

  
27
        self.units = {}
27 28
        self.loops = []
28 29

  
29 30
    def is_loop_start_item(self, item):
......
36 37

  
37 38
        return False
38 39

  
40
    def init_units(self):
41
        from AppDocData import AppDocData
42
        try:
43
            app_doc_data = AppDocData.instance()
44
            self.units = [attr[1] for attr in app_doc_data.activeDrawing.attrs if attr[0] == 'Units'][0]
45
        except Exception as ex:
46
            from App import App
47
            from AppDocData import MessageType
48
            message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename,
49
                                                           sys.exc_info()[-1].tb_lineno)
50
            App.mainWnd().addMessage.emit(MessageType.Error, message)
51

  
39 52
    def is_loop_end_item(self, item):
40 53
        """check given item is possible of end of loop"""
41 54

  
......
43 56

  
44 57
    def execute(self, param):
45 58
        """ execute hydro calculation """
46
        from AppDocData import AppDocData
59

  
47 60
        from SymbolSvgItem import SymbolSvgItem
48 61
        from EngineeringLoopItem import QEngineeringLoopItem
49 62

  
......
71 84
                    if item in loop.pressure_drops:
72 85
                        item.pressure_drop = loop.pressure_drops[item]
73 86

  
87
            self.init_units()
88
            self.loop_result()
89

  
90
        except Exception as ex:
91
            from App import App
92
            from AppDocData import MessageType
93

  
94
            message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename,
95
                                                           sys.exc_info()[-1].tb_lineno)
96
            App.mainWnd().addMessage.emit(MessageType.Error, message)
97

  
98
    def loop_result(self):
99
        self.loop_streams_hy()
100
        self.loop_pumps_hy()
101
        self.loop_comps_hy()
102
        self.loop_cv_hy()
103

  
104
        self.stream_input()  # static 및 end.p 값 입력
105

  
106
    def stream_input(self):
107
        from AppDocData import AppDocData
108
        try:
74 109
            """ update pressure drop and pressure of stream data """
75 110
            app_doc_data = AppDocData.instance()
76 111
            for hmb in app_doc_data.activeDrawing.hmbTable._hmbs:
......
80 115
                    indices = [index for index in range(len(matches[0].items)) if
81 116
                               str(matches[0].items[index].uid) == str(hmb.components_uid)]
82 117
                    if indices:
118
                        hmb.pressure_drop_static = matches[0].pressure_drops[matches[0].items[indices[0] - 1]]
119
                        hmb.pressure_pipe_end_point = matches[0].pressures[matches[0].items[indices[0] + 1]]
120

  
83 121
                        if hmb.phase_type == 'Vapor':
84 122
                            hmb.pressure_drop_friction = matches[0].pressure_drops[matches[0].items[indices[0]]]
85 123
                            hmb.density = matches[0].density_elevations[matches[0].items[indices[0]]]
86
                            hmb.pressure_drop = round(
87
                                matches[0].pressure_drops[matches[0].items[indices[0]]] / hmb.equivalent_length * 100,
88
                                3)
89
                        hmb.pressure_drop_static = matches[0].pressure_drops[matches[0].items[indices[0] - 1]]
90
                        hmb.pressure_pipe_end_point = matches[0].pressures[matches[0].items[indices[0] + 1]]
124
                            hmb.pressure_drop = matches[0].pressure_drops[matches[0].items[indices[0]]] / hmb.equivalent_length * 100
91 125

  
92 126
        except Exception as ex:
93 127
            from App import App
......
97 131
                                                           sys.exc_info()[-1].tb_lineno)
98 132
            App.mainWnd().addMessage.emit(MessageType.Error, message)
99 133

  
134
    def loop_comps_hy(self):
135
        if self.loops:
136
            for loop in self.loops:
137
                indices = [index for index in range(len(loop.items)) if
138
                           str(loop.items[index])[:3] == 'R_K' or str(loop.items[index])[:3] == 'L_K']
139
                attribute = {}
140
                if indices:
141
                    if len(indices) == 2:
142
                        tag_no = loop.items[indices[0]].parent.tag_no
143
                        suct_p = loop.pressures[loop.items[indices[0]]]
144
                        disc_p = loop.pressures[loop.items[indices[1]]]
145
                        diff_p = disc_p - suct_p
146

  
147
                        flowrate_mass = loop.items[indices[0] - 1].data.flowrate_mass
148
                        density = loop.density_elevations[loop.items[indices[0] - 1]]
149
                        hhp = self.comp_hydp_hy(flowrate_mass, density, round(diff_p, 3))
150

  
151
                        attribute['Tag_No'] = tag_no
152
                        attribute['Suct.P'] = suct_p
153
                        attribute['Disc.P'] = disc_p
154
                        attribute['Diff.P'] = diff_p
155
                        attribute['HHP'] = hhp
156

  
157
                        loop.items[indices[0]].parent.attribute = attribute
158

  
159
    def loop_cv_hy(self):
160
        if self.loops:
161
            for loop in self.loops:
162
                indices = [index for index in range(len(loop.items)) if str(loop.items[index])[:3] == 'CV_']
163
                attribute = {}
164
                if indices:
165
                    if len(indices) == 2:
166
                        tag_no = loop.items[indices[0]].parent.tag_no
167
                        suct_p = loop.pressures[loop.items[indices[0]]]
168
                        disc_p = loop.pressures[loop.items[indices[1]]]
169
                        diff_p = loop.pressure_drops[loop.items[indices[0]]]
170
                        dp_ratio = loop.extras[loop.items[indices[1]]] if not loop.extras[loop.items[indices[1]]] is None else 0
171

  
172
                        attribute['Tag_No'] = tag_no
173
                        attribute['Suct.P'] = suct_p
174
                        attribute['Disc.P'] = disc_p
175
                        attribute['Diff.P'] = diff_p
176
                        attribute['dP Ratio'] = dp_ratio
177

  
178
                        loop.items[indices[0]].parent.attribute = attribute
179

  
180
    def loop_pumps_hy(self):
181
        if self.loops:
182
            for loop in self.loops:
183
                indices = [index for index in range(len(loop.items)) if
184
                           str(loop.items[index])[:3] == 'R_P' or str(loop.items[index])[:3] == 'L_P' or str(
185
                               loop.items[index])[:3] == 'V_P']
186
                attribute = {}
187
                if indices:
188
                    if len(indices) == 2:
189
                        tag_no = loop.items[indices[0]].parent.tag_no
190
                        suct_p = loop.pressures[loop.items[indices[0]]]
191
                        disc_p = loop.pressures[loop.items[indices[1]]]
192
                        diff_p = disc_p - suct_p
193
                        vapr_p = loop.extras[loop.items[indices[0]]]
194

  
195
                        flowrate_mass = loop.items[indices[0] - 1].data.flowrate_mass
196
                        density = loop.density_elevations[loop.items[indices[0] - 1]]
197

  
198
                        npsha = self.npsha_cal_hy(suct_p, vapr_p, density)
199
                        head = self.pump_head_cal(diff_p, density)
200
                        hhp = self.pump_hydp_hy(flowrate_mass, density, head)
201

  
202
                        if len(loop.items[indices[0]].parent.attribute) == 0:
203
                            attribute['Tag_No'] = tag_no
204
                            attribute['Suct.P'] = suct_p
205
                            attribute['Disc.P'] = disc_p
206
                            attribute['Diff.P'] = diff_p
207
                            attribute['Head'] = head
208
                            attribute['NPSHa'] = npsha
209
                            attribute['Vap. P'] = vapr_p
210
                            attribute['HHP'] = hhp
211
                            loop.items[indices[0]].parent.attribute = attribute
212
                        elif tag_no != loop.items[indices[0]].parent.attribute['Tag_No']:
213
                            attribute['Tag_No'] = tag_no
214
                            attribute['Suct.P'] = suct_p
215
                            attribute['Disc.P'] = disc_p
216
                            attribute['Diff.P'] = diff_p
217
                            attribute['Head'] = head
218
                            attribute['NPSHa'] = npsha
219
                            attribute['Vap. P'] = vapr_p
220
                            attribute['HHP'] = hhp
221
                            loop.items[indices[0]].parent.attribute = attribute
222

  
223
    def get_barometric_pressure(self):
224
        pressure_unit = self.units['Pressure']
225
        if pressure_unit == 'kg/cm2':
226
            barometric_pressure = 1.033
227
        elif pressure_unit == 'bar':
228
            barometric_pressure = 1.01325
229
        elif pressure_unit == 'psi':
230
            barometric_pressure = 14.7
231
        elif pressure_unit == 'mmHg':
232
            barometric_pressure = 760
233
        elif pressure_unit == 'kPa':
234
            barometric_pressure = 101.325
235
        elif pressure_unit == 'MPa':
236
            barometric_pressure = 0.101325
237

  
238
        return barometric_pressure
239

  
240
    def pump_head_cal(self, header, density):
241
        density_unit = self.units['Density']
242
        if density_unit == 'kg/m3':
243
            sg = density / 1000
244
        elif density_unit == 'lb/ft3':
245
            sg = density * 16.0185 / 1000
246

  
247
        pressure_unit = self.units['Pressure']
248
        if pressure_unit == 'kg/cm2':
249
            header = header
250
        elif pressure_unit == 'psi':
251
            header = header / 14.7 * 1.033
252
        elif pressure_unit == 'bar':
253
            header = header / 1.013 * 1.033
254
        elif pressure_unit == 'mmHg':
255
            header = header / 760 * 1.033
256
        elif pressure_unit == 'kPa':
257
            header = header / 101.325 * 1.033
258
        elif pressure_unit == 'MPa':
259
            header = header / 0.101325 * 1.033
260

  
261
        # 현재 head는 kg/cm2으로 통일되어있음
262
        header = header * 10 / sg
263

  
264
        # 현재 head는 m로 표시되어있음
265
        length_unit = self.units['Length']
266
        if length_unit == 'm':
267
            header = header
268
        elif length_unit == 'in':
269
            header = header * 39.3701
270
        elif length_unit == 'ft':
271
            header = header * 3.28084
272
        elif length_unit == 'yd':
273
            header = header * 1.09361
274
        elif length_unit == 'mile':
275
            header = header * 0.000621371
276
        elif length_unit == 'mm':
277
            header = header * 1000
278

  
279
        return header
280

  
281
    def npsha_cal_hy(self, suct_p, vapo_p, density):
282
        ref_baro = self.get_barometric_pressure()
283

  
284
        density_unit = self.units['Density']
285
        if density_unit == 'kg/m3':
286
            sg = density / 1000
287
        elif density_unit == 'lb/ft3':
288
            sg = density * 16.0185 / 1000
289

  
290
        npsha = suct_p - vapo_p
291

  
292
        pressure_unit = self.units['Pressure']
293
        if pressure_unit == 'kg/cm2':
294
            npsha = npsha
295
        elif pressure_unit == 'psi':
296
            npsha = npsha / 14.7 * 1.033
297
        elif pressure_unit == 'bar':
298
            npsha = npsha / 1.013 * 1.033
299
        elif pressure_unit == 'mmHg':
300
            npsha = npsha / 760 * 1.033
301
        elif pressure_unit == 'kPa':
302
            npsha = npsha / 101.325 * 1.033
303
        elif pressure_unit == 'MPa':
304
            npsha = npsha / 0.101325 * 1.033
305

  
306
        npsha = npsha + ref_baro
307
        # 현재 npsha는 kg/cm2으로 통일되어있음
308

  
309
        npsha = npsha * 10 / sg
310
        # 현재 npsha는 딱 m로 표시되어있음
311

  
312
        length_unit = self.units['Length']
313
        if length_unit == 'm':
314
            npsha = npsha
315
        elif length_unit == 'in':
316
            npsha = npsha * 39.3701
317
        elif length_unit == 'ft':
318
            npsha = npsha * 3.28084
319
        elif length_unit == 'yd':
320
            npsha = npsha * 1.09361
321
        elif length_unit == 'mile':
322
            npsha = npsha * 0.000621371
323
        elif length_unit == 'mm':
324
            npsha = npsha * 1000
325

  
326
        return npsha
327

  
328
    def pump_hydp_hy(self, flowrate_mass, density, head):
329
        hydp_den = density
330

  
331
        # 질량유량은 모두 kg/min으로 맞춰야 함
332
        flowrate_mass_unit = self.units['Flowrate_Mass']
333
        if flowrate_mass_unit == 'kg/h':
334
            mass_4_hydp = flowrate_mass / 60
335
        elif flowrate_mass_unit == 'g/min':
336
            mass_4_hydp = flowrate_mass / 1000
337
        elif flowrate_mass_unit == 'lb/h':
338
            mass_4_hydp = flowrate_mass / 60 * 2.20462
339
        elif flowrate_mass_unit == 't/h':
340
            mass_4_hydp = flowrate_mass / 60 * 1000
341

  
342
        density_unit = self.units['Density']
343
        if density_unit == 'kg/m3':
344
            sg = hydp_den / 1000
345
            q = mass_4_hydp / hydp_den
346
        elif density_unit == 'lb/ft3':
347
            sg = hydp_den * 16.0185 / 1000
348
            q = mass_4_hydp / hydp_den * 2.20462 / 3.28 ** 3
349

  
350
        # 현재 hydp는 kW 임
351
        hydp = 0.163 * sg * q * head
352

  
353
        # 현재는 압력의 단위로 표시되어있음
354
        power_unit = self.units['Power']
355
        if power_unit == 'kW':
356
            hydp = hydp
357
        elif power_unit == 'kcal/h':
358
            hydp = hydp * 860.421
359
        elif power_unit == 'btu/h':
360
            hydp = hydp * 3412.14
361
        elif power_unit == 'Hp':
362
            hydp = hydp * 1.34041
363
        elif power_unit == 'kg.m/sec':
364
            hydp = hydp * 737.562 / 3.28 / 2.20462
365
        elif power_unit == 'ft.lb/sec':
366
            hydp = hydp * 737.562
367

  
368
        return hydp
369

  
370
    def comp_hydp_hy(self, flowrate_mass, density, diff_p):
371
        hydp_den = density
372

  
373
        # 질량유량은 모두 kg/min으로 맞춰야 함
374
        flowrate_mass_unit = self.units['Flowrate_Mass']
375
        if flowrate_mass_unit == 'kg/h':
376
            mass_4_hydp = flowrate_mass / 60
377
        elif flowrate_mass_unit == 'g/min':
378
            mass_4_hydp = flowrate_mass / 1000
379
        elif flowrate_mass_unit == 'lb/h':
380
            mass_4_hydp = flowrate_mass / 60 * 2.20462
381
        elif flowrate_mass_unit == 't/h':
382
            mass_4_hydp = flowrate_mass / 60 * 1000
383

  
384
        density_unit = self.units['Density']
385
        if density_unit == 'kg/m3':
386
            com_q = mass_4_hydp / hydp_den
387
        elif density_unit == 'lb/ft3':
388
            com_q = mass_4_hydp / hydp_den * 2.20462 / 3.28 ** 3
389

  
390
        density_unit = self.units['Density']
391
        if density_unit == 'kg/m3':
392
            com_sg = density / 1000
393
        elif density_unit == 'lb/ft3':
394
            com_sg = density * 16.0185 / 1000
395

  
396
        com_head = diff_p
397

  
398
        # 현재는 압력의 단위로 표시되어 있음
399
        pressure_unit = self.units['Pressure']
400
        if pressure_unit == 'kg/cm2':
401
            com_head = com_head
402
        elif pressure_unit == 'psi':
403
            com_head = com_head / 14.7 * 1.033
404
        elif pressure_unit == 'bar':
405
            com_head = com_head / 1.013 * 1.033
406
        elif pressure_unit == 'mmHg':
407
            com_head = com_head / 760 * 1.033
408
        elif pressure_unit == 'kPa':
409
            com_head = com_head / 101.325 * 1.033
410
        elif pressure_unit == 'MPa':
411
            com_head = com_head / 0.101325 * 1.033
412

  
413
        # 현재 head는 kg/cm2으로 통일되어있음
414
        com_head = com_head * 10 / com_sg
415

  
416
        hydp = 0.163 * com_sg * com_q * com_head
417
        # 현재 hydp는 kW 임
418

  
419
        # 현재는 압력의 단위로 표시되어있음
420
        power_unit = self.units['Power']
421
        if power_unit == 'kW':
422
            hydp = hydp
423
        elif power_unit == 'kcal/h':
424
            hydp = hydp * 860.421
425
        elif power_unit == 'btu/h':
426
            hydp = hydp * 3412.14
427
        elif power_unit == 'Hp':
428
            hydp = hydp * 1.34041
429
        elif power_unit == 'kg.m/sec':
430
            hydp = hydp * 737.562 / 3.28 / 2.20462
431
        elif power_unit == 'ft.lb/sec':
432
            hydp = hydp * 737.562
433

  
434
        return hydp
435

  
436
    def loop_streams_hy(self):
437
        pass
438

  
100 439
    def make_loop(self, loop):
101 440
        """ make a loop """
102 441
        from EngineeringConnectorItem import QEngineeringConnectorItem
HYTOS/HYTOS/HMBTable.py
321 321

  
322 322
    @property
323 323
    def pressure_drop(self):
324
        return float(self._pressure_drop) if isfloat(self._pressure_drop) else self._pressure_drop
324
        return round(float(self._pressure_drop), 3) if isfloat(self._pressure_drop) else self._pressure_drop
325 325

  
326 326
    @pressure_drop.setter
327 327
    def pressure_drop(self, value):
HYTOS/HYTOS/MainWindow.py
122 122

  
123 123
            self.initTreeWidgetDrawingList()
124 124
            self.initTableWidgetHMB()
125
            self.load_drawing_list()
126 125

  
126
            self.load_drawing_list()
127 127
            self.load_stylesheet_file()
128 128
            self.load_language_file()
129 129

  
......
936 936
                                                           sys.exc_info()[-1].tb_lineno)
937 937
            self.addMessage.emit(MessageType.Error, message)
938 938

  
939
    def get_barometric_pressure(self, unit):
940
        try:
941
            if unit == 'kg/cm2':
942
                barometric_pressure = 1.033
943
            elif unit == 'bar':
944
                barometric_pressure = 1.01325
945
            elif unit == 'psi':
946
                barometric_pressure = 14.7
947
            elif unit == 'mmHg':
948
                barometric_pressure = 760
949
            elif unit == 'kPa':
950
                barometric_pressure = 101.325
951
            elif unit == 'MPa':
952
                barometric_pressure = 0.101325
953

  
954
            return barometric_pressure
955

  
956
        except Exception as ex:
957
            message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename,
958
                                                           sys.exc_info()[-1].tb_lineno)
959
            self.addMessage.emit(MessageType.Error, message)
960

  
961
    def comp_hydp_hy(self, flowrate_mass, density, diff_p, units):
962
        hydp_den = density
963

  
964
        # 질량유량은 모두 kg/min으로 맞춰야 함
965
        flowrate_mass_unit = units['Flowrate_Mass']
966
        if flowrate_mass_unit == 'kg/h':
967
            mass_4_hydp = flowrate_mass / 60
968
        elif flowrate_mass_unit == 'g/min':
969
            mass_4_hydp = flowrate_mass / 1000
970
        elif flowrate_mass_unit == 'lb/h':
971
            mass_4_hydp = flowrate_mass / 60 * 2.20462
972
        elif flowrate_mass_unit == 't/h':
973
            mass_4_hydp = flowrate_mass / 60 * 1000
974

  
975
        density_unit = units['Density']
976
        if density_unit == 'kg/m3':
977
            com_q = mass_4_hydp / hydp_den
978
        elif density_unit == 'lb/ft3':
979
            com_q = mass_4_hydp / hydp_den * 2.20462 / 3.28 ** 3
980

  
981
        density_unit = units['Density']
982
        if density_unit == 'kg/m3':
983
            com_sg = density / 1000
984
        elif density_unit == 'lb/ft3':
985
            com_sg = density * 16.0185 / 1000
986

  
987
        com_head = diff_p
988

  
989
        # 현재는 압력의 단위로 표시되어 있음
990
        pressure_unit = units['Pressure']
991
        if pressure_unit == 'kg/cm2':
992
            com_head = com_head
993
        elif pressure_unit == 'psi':
994
            com_head = com_head / 14.7 * 1.033
995
        elif pressure_unit == 'bar':
996
            com_head = com_head / 1.013 * 1.033
997
        elif pressure_unit == 'mmHg':
998
            com_head = com_head / 760 * 1.033
999
        elif pressure_unit == 'kPa':
1000
            com_head = com_head / 101.325 * 1.033
1001
        elif pressure_unit == 'MPa':
1002
            com_head = com_head / 0.101325 * 1.033
1003

  
1004
        # 현재 head는 kg/cm2으로 통일되어있음
1005
        com_head = com_head * 10 / com_sg
1006

  
1007
        hydp = 0.163 * com_sg * com_head
1008
        # 현재 hydp는 kW 임
1009

  
1010
        # 현재는 압력의 단위로 표시되어있음
1011
        power_unit = units['Power']
1012
        if power_unit == 'kW':
1013
            hydp = hydp
1014
        elif power_unit == 'kcal/h':
1015
            hydp = hydp * 860.421
1016
        elif power_unit == 'btu/h':
1017
            hydp = hydp * 3412.14
1018
        elif power_unit == 'Hp':
1019
            hydp = hydp * 1.34041
1020
        elif power_unit == 'kg.m/sec':
1021
            hydp = hydp * 737.562 / 3.28 / 2.20462
1022
        elif power_unit == 'ft.lb/sec':
1023
            hydp = hydp * 737.562
1024

  
1025
        return hydp
1026

  
1027
    def pump_hydp_hy(self, flowrate_mass, density, head, units):
1028
        hydp_den = density
1029

  
1030
        # 질량유량은 모두 kg/min으로 맞춰야 함
1031
        flowrate_mass_unit = units['Flowrate_Mass']
1032
        if flowrate_mass_unit == 'kg/h':
1033
            mass_4_hydp = flowrate_mass / 60
1034
        elif flowrate_mass_unit == 'g/min':
1035
            mass_4_hydp = flowrate_mass / 1000
1036
        elif flowrate_mass_unit == 'lb/h':
1037
            mass_4_hydp = flowrate_mass / 60 * 2.20462
1038
        elif flowrate_mass_unit == 't/h':
1039
            mass_4_hydp = flowrate_mass / 60 * 1000
1040

  
1041
        density_unit = units['Density']
1042
        if density_unit == 'kg/m3':
1043
            sg = hydp_den / 1000
1044
            q = mass_4_hydp / hydp_den
1045
        elif density_unit == 'lb/ft3':
1046
            sg = hydp_den * 16.0185 / 1000
1047
            q = mass_4_hydp / hydp_den * 2.20462 / 3.28 ** 3
1048

  
1049
        # 현재 hydp는 kW 임
1050
        hydp = 0.163 * sg * q * head
1051

  
1052
        # 현재는 압력의 단위로 표시되어있음
1053
        power_unit = units['Power']
1054
        if power_unit == 'kW':
1055
            hydp = hydp
1056
        elif power_unit == 'kcal/h':
1057
            hydp = hydp * 860.421
1058
        elif power_unit == 'btu/h':
1059
            hydp = hydp * 3412.14
1060
        elif power_unit == 'Hp':
1061
            hydp = hydp * 1.34041
1062
        elif power_unit == 'kg.m/sec':
1063
            hydp = hydp * 737.562 / 3.28 / 2.20462
1064
        elif power_unit == 'ft.lb/sec':
1065
            hydp = hydp * 737.562
1066

  
1067
        return hydp
1068

  
1069
    def pump_head_cal(self, header, density, units):
1070

  
1071
        density_unit = units['Density']
1072
        if density_unit == 'kg/m3':
1073
            sg = density / 1000
1074
        elif density_unit == 'lb/ft3':
1075
            sg = density * 16.0185 / 1000
1076

  
1077
        pressure_unit = units['Pressure']
1078
        if pressure_unit == 'kg/cm2':
1079
            header = header
1080
        elif pressure_unit == 'psi':
1081
            header = header / 14.7 * 1.033
1082
        elif pressure_unit == 'bar':
1083
            header = header / 1.013 * 1.033
1084
        elif pressure_unit == 'mmHg':
1085
            header = header / 760 * 1.033
1086
        elif pressure_unit == 'kPa':
1087
            header = header / 101.325 * 1.033
1088
        elif pressure_unit == 'MPa':
1089
            header = header / 0.101325 * 1.033
1090

  
1091
        # 현재 head는 kg/cm2으로 통일되어있음
1092
        header = header * 10 / sg
1093

  
1094
        # 현재 head는 m로 표시되어있음
1095
        length_unit = units['Length']
1096
        if length_unit == 'm':
1097
            header = header
1098
        elif length_unit == 'in':
1099
            header = header * 39.3701
1100
        elif length_unit == 'ft':
1101
            header = header * 3.28084
1102
        elif length_unit == 'yd':
1103
            header = header * 1.09361
1104
        elif length_unit == 'mile':
1105
            header = header * 0.000621371
1106
        elif length_unit == 'mm':
1107
            header = header * 1000
1108

  
1109
        return header
1110

  
1111
    def npsha_cal_hy(self, suct_p, vapo_p, density, units):
1112
        ref_baro = self.get_barometric_pressure(units['Pressure'])
1113

  
1114
        density_unit = units['Density']
1115
        if density_unit == 'kg/m3':
1116
            sg = density / 1000
1117
        elif density_unit == 'lb/ft3':
1118
            sg = density * 16.0185 / 1000
1119

  
1120
        npsha = suct_p - vapo_p
1121

  
1122
        pressure_unit = units['Pressure']
1123
        if pressure_unit == 'kg/cm2':
1124
            npsha = npsha
1125
        elif pressure_unit == 'psi':
1126
            npsha = npsha / 14.7 * 1.033
1127
        elif pressure_unit == 'bar':
1128
            npsha = npsha / 1.013 * 1.033
1129
        elif pressure_unit == 'mmHg':
1130
            npsha = npsha / 760 * 1.033
1131
        elif pressure_unit == 'kPa':
1132
            npsha = npsha / 101.325 * 1.033
1133
        elif pressure_unit == 'MPa':
1134
            npsha = npsha / 0.101325 * 1.033
1135

  
1136
        npsha = npsha + ref_baro
1137
        # 현재 npsha는 kg/cm2으로 통일되어있음
1138

  
1139
        npsha = npsha * 10 / sg
1140
        # 현재 npsha는 딱 m로 표시되어있음
1141

  
1142
        length_unit = units['Length']
1143
        if length_unit == 'm':
1144
            npsha = npsha
1145
        elif length_unit == 'in':
1146
            npsha = npsha * 39.3701
1147
        elif length_unit == 'ft':
1148
            npsha = npsha * 3.28084
1149
        elif length_unit == 'yd':
1150
            npsha = npsha * 1.09361
1151
        elif length_unit == 'mile':
1152
            npsha = npsha * 0.000621371
1153
        elif length_unit == 'mm':
1154
            npsha = npsha * 1000
1155

  
1156
        return npsha
1157

  
1158

  
1159 939
    def loop_streams_hy(self):
1160 940
        try:
1161 941
            pass
......
1166 946
                                                           sys.exc_info()[-1].tb_lineno)
1167 947
            self.addMessage.emit(MessageType.Error, message)
1168 948

  
1169
    def loop_cv_hy(self, loops, units):
1170
        try:
1171
            for loop in loops:
1172
                indices = [index for index in range(len(loop.items)) if str(loop.items[index])[:3] == 'CV_']
1173

  
1174
                if indices:
1175
                    if len(indices) == 2:
1176
                        name = loop.items[indices[0]].parent.tag_no
1177
                        suct_p = loop.pressures[loop.items[indices[0]]]
1178
                        disc_p = loop.pressures[loop.items[indices[1]]]
1179
                        diff_p = loop.pressure_drops[loop.items[indices[0]]]
1180
                        dp_ratio = loop.extras[loop.items[indices[1]]]
1181

  
1182
                        self.add_data(name, None, None, True)
1183
                        self.add_data('Suct.P :', round(suct_p, 3), '{}.g'.format(units['Pressure']))
1184
                        self.add_data('Disc.P :', round(disc_p, 3), '{}.g'.format(units['Pressure']))
1185
                        self.add_data('Diff.P :', round(diff_p, 3), units['Pressure'])
1186
                        self.add_data('dP Ratio :', round(dp_ratio, 3) if dp_ratio else 0, '%')
1187

  
1188
        except Exception as ex:
1189
            message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename,
1190
                                                           sys.exc_info()[-1].tb_lineno)
1191
            self.addMessage.emit(MessageType.Error, message)
1192

  
1193
    def loop_comps_hy(self, loops, units):
1194
        try:
1195
            for loop in loops:
1196
                indices = [index for index in range(len(loop.items)) if
1197
                           str(loop.items[index])[:3] == 'R_K' or str(loop.items[index])[:3] == 'L_K']
1198

  
1199
                if indices:
1200
                    if len(indices) == 2:
1201
                        name = loop.items[indices[0]].parent.tag_no
1202
                        suct_p = loop.pressures[loop.items[indices[0]]]
1203
                        disc_p = loop.pressures[loop.items[indices[1]]]
1204
                        diff_p = disc_p - suct_p
1205

  
1206
                        flowrate_mass = loop.items[indices[0] - 1].data.flowrate_mass
1207
                        density = loop.density_elevations[loop.items[indices[0] - 1]]
1208
                        hhp = self.comp_hydp_hy(flowrate_mass, density, diff_p, units)
1209

  
1210
                        self.add_data(name, None, None, True)
1211
                        self.add_data('Suct.P :', round(suct_p, 3), '{}.g'.format(units['Pressure']))
1212
                        self.add_data('Disc.P :', round(disc_p, 3), '{}.g'.format(units['Pressure']))
1213
                        self.add_data('Diff.P :', round(diff_p, 3), units['Pressure'])
1214
                        self.add_data('HHP :', round(hhp, 3), units['Power'])
1215

  
1216
        except Exception as ex:
1217
            message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename,
1218
                                                           sys.exc_info()[-1].tb_lineno)
1219
            self.addMessage.emit(MessageType.Error, message)
1220

  
1221
    def has_duplicate_pump(self, name):
949
    def has_duplicate_tag_no(self, tag_no):
1222 950
        row_count = self.tableWidgetOutput.rowCount()
1223 951
        for row in range(row_count):
1224
            if self.tableWidgetOutput.item(row, 0).text() == name:
952
            if self.tableWidgetOutput.item(row, 0).text() == tag_no:
1225 953
                return True
1226 954

  
1227 955
        return False
1228 956

  
1229
    def loop_pumps_hy(self, loops, units):
1230
        try:
1231

  
1232
            for loop in loops:
1233
                indices = [index for index in range(len(loop.items)) if
1234
                           str(loop.items[index])[:3] == 'R_P' or str(loop.items[index])[:3] == 'L_P' or str(
1235
                               loop.items[index])[:3] == 'V_P']
1236

  
1237
                if indices:
1238
                    if len(indices) == 2:
1239
                        name = loop.items[indices[0]].parent.tag_no
1240

  
1241
                        if self.has_duplicate_pump(name):
1242
                            continue
1243

  
1244
                        suct_p = loop.pressures[loop.items[indices[0]]]
1245
                        disc_p = loop.pressures[loop.items[indices[1]]]
1246
                        diff_p = loop.pressure_drops[loop.items[indices[0]]]
1247
                        vapo_p = loop.extras[loop.items[indices[0]]]
1248
                        density = loop.density_elevations[loop.items[indices[0] - 1]]
1249
                        flowrate_mass = loop.items[indices[0] - 1].data.flowrate_mass
1250
                        npsha = self.npsha_cal_hy(suct_p, vapo_p, density, units)
1251
                        head = self.pump_head_cal(diff_p, density, units)
1252
                        hhp = self.pump_hydp_hy(flowrate_mass, density, head, units)
1253

  
1254
                        self.add_data(name, None, None, True)
1255
                        self.add_data('Suct.P :', round(suct_p, 3), '{}.g'.format(units['Pressure']))
1256
                        self.add_data('Disc.P :', round(disc_p, 3), '{}.g'.format(units['Pressure']))
1257
                        self.add_data('Diff.P :', round(diff_p, 3), units['Pressure'])
1258
                        self.add_data('Head :', round(head, 3), units['Length'])
1259
                        self.add_data('NPSHa :', round(npsha, 3), units['Length'])
1260
                        self.add_data('Vap. P :', vapo_p, '{}.a'.format(units['Pressure']))
1261
                        self.add_data('HHP :', round(hhp, 3), units['Power'])
1262

  
1263
        except Exception as ex:
1264
            message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename,
1265
                                                           sys.exc_info()[-1].tb_lineno)
1266
            self.addMessage.emit(MessageType.Error, message)
1267

  
1268 957
    def display_output(self, loops):
1269 958
        try:
1270 959
            """ display output """
1271 960
            drawing = AppDocData.instance().activeDrawing
1272 961
            if drawing is None:
1273 962
                return
963
            self.clear_output()
1274 964

  
1275
            if loops:
1276
                self.tableWidgetOutput.clear()
1277
                self.tableWidgetOutput.setRowCount(0)
1278
                self.tableWidgetOutput.setColumnCount(3)
1279
                self.tableWidgetOutput.horizontalHeader().setVisible(False)
1280
                self.tableWidgetOutput.verticalHeader().setVisible(False)
1281
                self.tableWidgetOutput.setSelectionMode(QAbstractItemView.SingleSelection)
1282
                self.tableWidgetOutput.setSelectionBehavior(QAbstractItemView.SelectRows)
1283
                self.tableWidgetOutput.setEditTriggers(QAbstractItemView.NoEditTriggers)
1284
                self.tableWidgetOutput.horizontalHeader().setStretchLastSection(True)
965
            self.tableWidgetOutput.setColumnCount(3)
966
            self.tableWidgetOutput.horizontalHeader().setVisible(False)
967
            self.tableWidgetOutput.verticalHeader().setVisible(False)
968
            self.tableWidgetOutput.setSelectionMode(QAbstractItemView.SingleSelection)
969
            self.tableWidgetOutput.setSelectionBehavior(QAbstractItemView.SelectRows)
970
            self.tableWidgetOutput.setEditTriggers(QAbstractItemView.NoEditTriggers)
971
            self.tableWidgetOutput.horizontalHeader().setStretchLastSection(True)
1285 972

  
973
            if loops:
1286 974
                units = [attr[1] for attr in drawing.attrs if attr[0] == 'Units'][0]
1287
                self.loop_streams_hy()
1288
                self.loop_pumps_hy(loops, units)
1289
                self.loop_comps_hy(loops, units)
1290
                self.loop_cv_hy(loops, units)
1291

  
1292 975

  
976
                for loop in loops:
977
                    for item in loop.items:
978
                        if item.parent:
979
                            component = item.parent
980
                            if component.has_attribute():
981
                                name = str(component.name)[:3]
982
                                attr = component.attribute
983
                                tag_no = attr['Tag_No']
984
                                if self.has_duplicate_tag_no(tag_no):
985
                                    continue
986

  
987
                                if name == 'R_P' or name == 'L_P' or name == 'V_P':
988
                                    # Pump
989
                                    self.add_data(tag_no, None, None, True)
990
                                    self.add_data('Suct.P :', round(attr['Suct.P'], 3), '{}.g'.format(units['Pressure']))
991
                                    self.add_data('Disc.P :', round(attr['Disc.P'], 3), '{}.g'.format(units['Pressure']))
992
                                    self.add_data('Diff.P :', round(attr['Diff.P'], 3), units['Pressure'])
993
                                    self.add_data('Head :', round(attr['Head'], 3), units['Length'])
994
                                    self.add_data('NPSHa :', round(attr['NPSHa'], 3), units['Length'])
995
                                    self.add_data('Vap. P :', attr['Vap. P'], '{}.a'.format(units['Pressure']))
996
                                    self.add_data('HHP :', round(attr['HHP'], 3), units['Power'])
997
                                elif name == 'R_K' or name == 'L_K':
998
                                    # Compressor
999
                                    self.add_data(tag_no, None, None, True)
1000
                                    self.add_data('Suct.P :', round(attr['Suct.P'], 3), '{}.g'.format(units['Pressure']))
1001
                                    self.add_data('Disc.P :', round(attr['Disc.P'], 3), '{}.g'.format(units['Pressure']))
1002
                                    self.add_data('Diff.P :', round(attr['Diff.P'], 3), units['Pressure'])
1003
                                    self.add_data('HHP :', round(attr['HHP'], 3), units['Power'])
1004
                                elif name == 'CV_':
1005
                                    # Control Valve
1006
                                    self.add_data(tag_no, None, None, True)
1007
                                    self.add_data('Inlet P :', round(attr['Suct.P'], 3), '{}.g'.format(units['Pressure']))
1008
                                    self.add_data('Outlet P :', round(attr['Disc.P'], 3), '{}.g'.format(units['Pressure']))
1009
                                    self.add_data('Diff.P :', round(attr['Diff.P'], 3), units['Pressure'])
1010
                                    self.add_data('dP Ratio :', round(attr['dP Ratio'], 3), '%')
1293 1011

  
1294 1012
        except Exception as ex:
1295 1013
            message = 'error occurred({}) in {}:{}'.format(repr(ex), sys.exc_info()[-1].tb_frame.f_code.co_filename,
HYTOS/HYTOS/RoughnessDialog.py
69 69
    def init_roughness(self, phase_type):
70 70
        from AppDocData import AppDocData
71 71

  
72
        self.ui.tableWidget_Roughness.setColumnCount(6)
72
        self.ui.tableWidget_Roughness.setColumnCount(7)
73 73
        self.ui.tableWidget_Roughness.hideColumn(0)
74 74
        self.ui.tableWidget_Roughness.setHorizontalHeaderLabels(
75
            ['UID', 'Material', 'Roughness', 'Roughness', 'Roughness', 'Roughness'])
76
        self.ui.tableWidget_Roughness.horizontalHeaderItem(0).setSizeHint(QSize(25, 25))
75
            ['UID', 'Material', 'Roughness', 'Roughness', 'Roughness', 'Roughness', 'Unit'])
77 76
        self.ui.tableWidget_Roughness.horizontalHeader().setStretchLastSection(True)
78 77
        self.ui.tableWidget_Roughness.setEditTriggers(QAbstractItemView.NoEditTriggers)
79 78
        self.ui.tableWidget_Roughness.verticalHeader().setVisible(False)
......
118 117
                                                                                                 Qt.AlignRight | Qt.AlignVCenter))
119 118
            self.ui.tableWidget_Roughness.setItem(row_count, 5, set_table_widget_item_properties(roughness[5],
120 119
                                                                                                 Qt.AlignRight | Qt.AlignVCenter))
121

  
122
        self.ui.tableWidget_Roughness.resizeColumnToContents(1)
120
            self.ui.tableWidget_Roughness.setItem(row_count, 6, set_table_widget_item_properties(self.unit,
121
                                                                                                 Qt.AlignHCenter | Qt.AlignVCenter))
122
            self.ui.tableWidget_Roughness.resizeColumnsToContents()
123
            self.ui.tableWidget_Roughness.resizeRowsToContents()
123 124

  
124 125
    def accept(self):
125 126
        QDialog.accept(self)
HYTOS/HYTOS/Roughness_HagenDialog.py
53 53

  
54 54
        self.ui.tableWidget_Roughness.setColumnCount(2)
55 55
        self.ui.tableWidget_Roughness.setHorizontalHeaderLabels(['Material', 'Roughness'])
56
        self.ui.tableWidget_Roughness.horizontalHeaderItem(0).setSizeHint(QSize(25, 25))
57 56
        self.ui.tableWidget_Roughness.horizontalHeader().setStretchLastSection(True)
58 57
        self.ui.tableWidget_Roughness.setEditTriggers(QAbstractItemView.NoEditTriggers)
59 58
        self.ui.tableWidget_Roughness.verticalHeader().setVisible(False)
......
82 81
                                                                                                 Qt.AlignLeft | Qt.AlignVCenter))
83 82
            self.ui.tableWidget_Roughness.setItem(row_count, 1,
84 83
                                                  set_table_widget_item_properties(dic_roughness[roughness],
85
                                                                                   Qt.AlignRight | Qt.AlignVCenter))
84
                                                                                   Qt.AlignHCenter | Qt.AlignVCenter))
86 85

  
87
        self.ui.tableWidget_Roughness.resizeColumnToContents(0)
86
            self.ui.tableWidget_Roughness.resizeColumnsToContents()
87
            self.ui.tableWidget_Roughness.resizeRowsToContents()
88 88

  
89 89
    def accept(self):
90 90
        QDialog.accept(self)
HYTOS/HYTOS/Roughness_Hagen_UI.py
13 13
class Ui_RoughnessDialog(object):
14 14
    def setupUi(self, RoughnessDialog):
15 15
        RoughnessDialog.setObjectName("RoughnessDialog")
16
        RoughnessDialog.resize(317, 403)
16
        RoughnessDialog.resize(319, 280)
17 17
        font = QtGui.QFont()
18 18
        font.setFamily("맑은 고딕")
19 19
        RoughnessDialog.setFont(font)
HYTOS/HYTOS/Roughness_UI.py
13 13
class Ui_RoughnessDialog(object):
14 14
    def setupUi(self, RoughnessDialog):
15 15
        RoughnessDialog.setObjectName("RoughnessDialog")
16
        RoughnessDialog.resize(317, 277)
16
        RoughnessDialog.resize(367, 280)
17 17
        font = QtGui.QFont()
18 18
        font.setFamily("맑은 고딕")
19 19
        RoughnessDialog.setFont(font)
HYTOS/HYTOS/Shapes/SymbolSvgItem.py
58 58
        self.hasInstrumentLabel = 0
59 59
        self.flip = flip
60 60
        # attributeType uid
61
        self.attribute = ''
61
        self.attribute = {}
62 62
        self._properties = {SymbolProp(None, 'Supplied By', 'String'): None}
63 63
        self._tag_no = None
64 64
        self.setAcceptDrops(True)
......
92 92
            from AppDocData import MessageType
93 93

  
94 94
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
95
                                                          sys.exc_info()[-1].tb_lineno)
95
                                                           sys.exc_info()[-1].tb_lineno)
96 96
            App.mainWnd().addMessage.emit(MessageType.Error, message)
97 97

  
98 98
        self.setZValue(SymbolSvgItem.ZVALUE)
99 99
        self._desc_label = QEngineeringEqpDescTextItem('eqp name<br>pressure drop<br>elevation', self)
100 100

  
101
    def has_attribute(self):
102
        if len(self.attribute) > 0:
103
            return True
104
        else:
105
            return False
106

  
101 107
    def __str__(self):
102 108
        """ return string represent uuid """
103 109
        return str(self.uid)
104 110

  
105

  
106 111
    @property
107 112
    def tag_no(self):
108 113
        return self._tag_no
......
164 169
                from App import App
165 170

  
166 171
                message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
167
                                                              sys.exc_info()[-1].tb_lineno)
172
                                                               sys.exc_info()[-1].tb_lineno)
168 173
                App.mainWnd().addMessage.emit(MessageType.Error, message)
169 174

  
170 175
        return self._properties
......
249 254
            from App import App
250 255

  
251 256
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
252
                                                          sys.exc_info()[-1].tb_lineno)
257
                                                           sys.exc_info()[-1].tb_lineno)
253 258
            App.mainWnd().addMessage.emit(MessageType.Error, message)
254 259

  
255 260
        return res
......
329 334
            from App import App
330 335

  
331 336
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
332
                                                          sys.exc_info()[-1].tb_lineno)
337
                                                           sys.exc_info()[-1].tb_lineno)
333 338
            App.mainWnd().addMessage.emit(MessageType.Error, message)
334 339

  
335 340
    def build_label(self):
......
357 362
                    self.desc_label.setHtml(f"{self.tag_no}<br>{data.pressure_drop} kg/cm2<br>{data.elevation} m")
358 363
            else:
359 364
                self.desc_label.setHtml('')
360
        elif self.name in ('Ori_Flowmeter_H', 'Oth_Flowmeter_H', 'Ven_Flowmeter_H', 'Ori_Flowmeter_V', 'Oth_Flowmeter_V',
361
                           'Ven_Flowmeter_V'):
365
        elif self.name in (
366
        'Ori_Flowmeter_H', 'Oth_Flowmeter_H', 'Ven_Flowmeter_H', 'Ori_Flowmeter_V', 'Oth_Flowmeter_V',
367
        'Ven_Flowmeter_V'):
362 368
            if self.tag_no:
363 369
                data = self.connectors[0].data
364 370
                if data:
......
509 515
        except Exception as ex:
510 516
            from App import App
511 517
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
512
                                                          sys.exc_info()[-1].tb_lineno)
518
                                                           sys.exc_info()[-1].tb_lineno)
513 519
            App.mainWnd().addMessage.emit(MessageType.Error, message)
514 520

  
515 521
        return res
......
600 606
        except Exception as ex:
601 607
            from App import App
602 608
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
603
                                                          sys.exc_info()[-1].tb_lineno)
609
                                                           sys.exc_info()[-1].tb_lineno)
604 610
            App.mainWnd().addMessage.emit(MessageType.Error, message)
605 611

  
606 612
    '''
......
1027 1033
                pointsUids.append(pointsUid)
1028 1034

  
1029 1035
            app_doc_data = AppDocData.instance()
1030
            svgFilePath = os.path.join(app_doc_data.symbol_file_path, category, _type, name + '.svg')
1036
            svg_file_path = os.path.join(app_doc_data.symbol_file_path, category, _type, name + '.svg')
1037

  
1038
            item = SymbolSvgItem.createItem(_type, svg_file_path, uid, None, 0, dbUid)
1039
            item.setVisible(False)
1040
            item.buildItem(name, _type, float(angle), float(scale), pt, origin, connPts, dbUid, pointsUids, index)
1041
            item.tag_no = tag_no
1031 1042

  
1032
            if os.path.isfile(svgFilePath):
1033
                item = SymbolSvgItem.createItem(_type, svgFilePath, uid, None, 0, dbUid)
1034
                item.setVisible(False)
1035
                item.buildItem(name, _type, float(angle), float(scale), pt, origin, connPts, dbUid, pointsUids, index)
1036
                item.tag_no = tag_no
1037 1043
        except Exception as ex:
1038 1044
            from App import App
1039 1045
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
1040
                                                          sys.exc_info()[-1].tb_lineno)
1046
                                                           sys.exc_info()[-1].tb_lineno)
1041 1047
            App.mainWnd().addMessage.emit(MessageType.Error, message)
1042 1048

  
1043 1049
        return item
......
1265 1271
            from AppDocData import MessageType
1266 1272

  
1267 1273
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
1268
                                                          sys.exc_info()[-1].tb_lineno)
1274
                                                           sys.exc_info()[-1].tb_lineno)
1269 1275
            App.mainWnd().addMessage.emit(MessageType.Error, message)
1270 1276

  
1271 1277
        self.transfer.onRemoved.emit(self)
HYTOS/HYTOS/StreamDataDialog.py
25 25

  
26 26
    return item
27 27

  
28

  
28 29
def is_blank(s):
29 30
    return not (s and s.strip())
30 31

  
32

  
31 33
def is_not_blank(s):
32 34
    return bool(s and s.strip())
33 35

  
......
42 44
        self.result = False
43 45
        self.liquid_drop_method = None
44 46
        self.ui.label_current_tab_index.setVisible(False)
45
        self.ui.lineEdit_DisplayNo.setFocus()
46 47

  
47 48
        self.ui.lineEdit_Flowrate_Mass_Liquid.setValidator(
48 49
            QtGui.QDoubleValidator(self.ui.lineEdit_Flowrate_Mass_Liquid))
......
93 94
        self.ui.pushButton_Diameter_Estimation.clicked.connect(self.show_diameter_estimation_dialog)
94 95
        self.ui.pushButton_Add_GeometryData_Mixed.clicked.connect(self.show_geometry_data_dialog)
95 96
        self.ui.pushButton_Calculation.clicked.connect(self.mixed_type_calculation)
97
        self.ui.pushButton_Copy_Stream.clicked.connect(self.show_copy_stream_dialog)
96 98
        self.ui.lineEdit_Equivalent_Length_Input.textChanged.connect(self.equivalent_length_change_event)
97 99
        self.ui.lineEdit_Flowrate_Mass_Liquid.textChanged.connect(self.flowrate_change_event)
98 100
        self.ui.lineEdit_Flowrate_Volume.textChanged.connect(self.flowrate_change_event)
......
509 511
        table.resizeColumnsToContents()
510 512
        table.resizeRowsToContents()
511 513

  
514
    def show_copy_stream_dialog(self):
515
        from CopyStreamData import QCopyStreamData
516

  
517
        dlg = QCopyStreamData()
518
        (isAccepted, components_uid) = dlg.show_dialog(self.item)
519
        if isAccepted == True:
520
            self.load_hmb(components_uid)
521

  
512 522
    def mixed_type_calculation(self):
513 523
        from Calculation import Calculation_2Phase
514 524
        try:
......
536 546
                    if is_not_blank(process['tp_pressure']):
537 547
                        cal = Calculation_2Phase(self.item, process, self.ui.tableWidget_GeometryData_Mixed)
538 548
                        self.load_mixed_result(cal.result())
549
                        QMessageBox.information(self, self.tr("Notice"), self.tr("Successfully calculated !"))
539 550
                    else:
540 551
                        QMessageBox.information(self, self.tr("Notice"), self.tr("Please input the [Start pressure] !"))
541 552
                        return
......
544 555
                            process['v_mw']) and is_not_blank(process['v_z']):
545 556
                        cal = Calculation_2Phase(self.item, process, self.ui.tableWidget_GeometryData_Mixed)
546 557
                        self.load_mixed_result(cal.result())
558
                        QMessageBox.information(self, self.tr("Notice"), self.tr("Successfully calculated !"))
547 559
                    else:
548 560
                        QMessageBox.information(self, self.tr("Notice"), self.tr("Please input [Vapor property] !"))
549 561
                        return
......
1082 1094
            self.ui.groupBox_GeometryData.setVisible(True)
1083 1095
            self.ui.pushButton_Line_Sizing.setVisible(True)
1084 1096
            self.ui.pushButton_Diameter_Estimation.setVisible(True)
1097
            self.ui.pushButton_Copy_Stream.setVisible(True)
1085 1098
            self.ui.groupBox_ProcessData_Liquid.setVisible(False)
1086 1099

  
1087 1100
            self.ui.groupBox_ProcessData_Mixed.setVisible(False)
......
1095 1108
            self.ui.groupBox_GeometryData.setVisible(True)
1096 1109
            self.ui.pushButton_Line_Sizing.setVisible(True)
1097 1110
            self.ui.pushButton_Diameter_Estimation.setVisible(True)
1111
            self.ui.pushButton_Copy_Stream.setVisible(True)
1098 1112
            self.ui.groupBox_ProcessData_Vapor.setVisible(False)
1099 1113

  
1100 1114
            self.ui.groupBox_ProcessData_Mixed.setVisible(False)
......
1115 1129
            self.ui.groupBox_GeometryData.setVisible(False)
1116 1130
            self.ui.pushButton_Line_Sizing.setVisible(False)
1117 1131
            self.ui.pushButton_Diameter_Estimation.setVisible(False)
1132
            self.ui.pushButton_Copy_Stream.setVisible(False)
1118 1133

  
1119 1134
    def getInsideDiameter(self):
1120 1135
        from AppDocData import AppDocData
......
1161 1176
    def showDialog(self, item):
1162 1177
        self.item = item
1163 1178
        self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint)
1164

  
1165
        self.load_hmb()
1179
        self.ui.lineEdit_StreamNo.setText(str(item.stream_no))
1180
        self.load_hmb(item.uid)
1166 1181
        self.load_geometry()
1167 1182
        self.exec_()
1168 1183

  
......
1229 1244
                                                           sys.exc_info()[-1].tb_lineno)
1230 1245
            App.mainWnd().addMessage.emit(MessageType.Error, message)
1231 1246

  
1232
    def load_hmb(self):
1247
    def load_hmb(self, components_uid):
1233 1248
        from AppDocData import AppDocData
1234 1249
        try:
1235 1250

  
1236 1251
            drawing = AppDocData.instance().activeDrawing
1237 1252
            if drawing:
1238
                matches = [hmb for hmb in drawing.hmbTable._hmbs if hmb.components_uid == self.item.uid]
1253
                matches = [hmb for hmb in drawing.hmbTable._hmbs if hmb.components_uid == components_uid]
1239 1254
                if matches:
1240
                    self.ui.groupBox_StreamNo.setTitle('Stream No. : {}'.format(matches[0].stream_no))
1241 1255

  
1242 1256
                    if matches[0].phase_type:
1243 1257
                        index = self.ui.comboBox_PhaseType.findData(matches[0].phase_type)
HYTOS/HYTOS/StreamData_UI.py
13 13
class Ui_Dialog(object):
14 14
    def setupUi(self, Dialog):
15 15
        Dialog.setObjectName("Dialog")
16
        Dialog.resize(687, 767)
16
        Dialog.resize(685, 437)
17 17
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
18 18
        sizePolicy.setHorizontalStretch(0)
19 19
        sizePolicy.setVerticalStretch(0)
......
25 25
        icon = QtGui.QIcon()
26 26
        icon.addPixmap(QtGui.QPixmap(":/images/HYTOS.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
27 27
        Dialog.setWindowIcon(icon)
28
        self.groupBox_StreamNo = QtWidgets.QGroupBox(Dialog)
29
        self.groupBox_StreamNo.setGeometry(QtCore.QRect(8, 8, 493, 60))
30
        font = QtGui.QFont()
31
        font.setFamily("맑은 고딕")
32
        font.setBold(True)
33
        font.setWeight(75)
34
        self.groupBox_StreamNo.setFont(font)
35
        self.groupBox_StreamNo.setObjectName("groupBox_StreamNo")
36
        self.label_14 = QtWidgets.QLabel(self.groupBox_StreamNo)
37
        self.label_14.setGeometry(QtCore.QRect(236, 30, 77, 16))
38
        font = QtGui.QFont()
39
        font.setFamily("맑은 고딕")
40
        font.setBold(False)
41
        font.setWeight(50)
42
        self.label_14.setFont(font)
43
        self.label_14.setObjectName("label_14")
44
        self.comboBox_PhaseType = QtWidgets.QComboBox(self.groupBox_StreamNo)
45
        self.comboBox_PhaseType.setGeometry(QtCore.QRect(312, 28, 169, 22))
46
        self.comboBox_PhaseType.setObjectName("comboBox_PhaseType")
47
        self.label_5 = QtWidgets.QLabel(self.groupBox_StreamNo)
48
        self.label_5.setGeometry(QtCore.QRect(12, 30, 77, 16))
49
        font = QtGui.QFont()
50
        font.setFamily("맑은 고딕")
51
        font.setBold(False)
52
        font.setWeight(50)
53
        self.label_5.setFont(font)
54
        self.label_5.setObjectName("label_5")
55
        self.lineEdit_DisplayNo = QtWidgets.QLineEdit(self.groupBox_StreamNo)
56
        self.lineEdit_DisplayNo.setGeometry(QtCore.QRect(88, 28, 133, 21))
57
        self.lineEdit_DisplayNo.setMinimumSize(QtCore.QSize(0, 21))
58
        self.lineEdit_DisplayNo.setMaximumSize(QtCore.QSize(16777215, 16777215))
59
        font = QtGui.QFont()
60
        font.setFamily("맑은 고딕")
61
        font.setBold(False)
62
        font.setWeight(50)
63
        self.lineEdit_DisplayNo.setFont(font)
64
        self.lineEdit_DisplayNo.setObjectName("lineEdit_DisplayNo")
65 28
        self.groupBox_GeometryData = QtWidgets.QGroupBox(Dialog)
66
        self.groupBox_GeometryData.setGeometry(QtCore.QRect(348, 80, 328, 329))
29
        self.groupBox_GeometryData.setGeometry(QtCore.QRect(348, 56, 328, 329))
67 30
        font = QtGui.QFont()
68 31
        font.setBold(True)
69 32
        font.setWeight(75)
......
368 331
        spacerItem3 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
369 332
        self.verticalLayout_4.addItem(spacerItem3)
370 333
        self.groupBox_ProcessData_Liquid = QtWidgets.QGroupBox(Dialog)
371
        self.groupBox_ProcessData_Liquid.setGeometry(QtCore.QRect(8, 80, 328, 221))
334
        self.groupBox_ProcessData_Liquid.setGeometry(QtCore.QRect(8, 56, 328, 221))
372 335
        self.groupBox_ProcessData_Liquid.setMinimumSize(QtCore.QSize(0, 221))
373 336
        self.groupBox_ProcessData_Liquid.setMaximumSize(QtCore.QSize(16777215, 221))
374 337
        font = QtGui.QFont()
......
502 465
        spacerItem4 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
503 466
        self.verticalLayout_5.addItem(spacerItem4)
504 467
        self.groupBox_Line_Sizing_Data = QtWidgets.QGroupBox(Dialog)
505
        self.groupBox_Line_Sizing_Data.setGeometry(QtCore.QRect(8, 312, 328, 97))
468
        self.groupBox_Line_Sizing_Data.setGeometry(QtCore.QRect(8, 288, 328, 97))
506 469
        font = QtGui.QFont()
507 470
        font.setBold(True)
508 471
        font.setWeight(75)
......
573 536
        spacerItem5 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
574 537
        self.verticalLayout_3.addItem(spacerItem5)
575 538
        self.groupBox_ProcessData_Vapor = QtWidgets.QGroupBox(Dialog)
576
        self.groupBox_ProcessData_Vapor.setGeometry(QtCore.QRect(8, 80, 328, 221))
539
        self.groupBox_ProcessData_Vapor.setGeometry(QtCore.QRect(8, 56, 328, 221))
577 540
        self.groupBox_ProcessData_Vapor.setMinimumSize(QtCore.QSize(0, 221))
578 541
        self.groupBox_ProcessData_Vapor.setMaximumSize(QtCore.QSize(16777215, 221))
579 542
        font = QtGui.QFont()
......
770 733
        spacerItem6 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
771 734
        self.verticalLayout_6.addItem(spacerItem6)
772 735
        self.pushButton_Line_Sizing = QtWidgets.QPushButton(Dialog)
773
        self.pushButton_Line_Sizing.setGeometry(QtCore.QRect(8, 420, 149, 24))
736
        self.pushButton_Line_Sizing.setGeometry(QtCore.QRect(8, 400, 149, 24))
774 737
        self.pushButton_Line_Sizing.setObjectName("pushButton_Line_Sizing")
775 738
        self.groupBox_ProcessData_Mixed = QtWidgets.QGroupBox(Dialog)
776
        self.groupBox_ProcessData_Mixed.setGeometry(QtCore.QRect(8, 80, 669, 133))
739
        self.groupBox_ProcessData_Mixed.setGeometry(QtCore.QRect(8, 56, 669, 133))
777 740
        font = QtGui.QFont()
778 741
        font.setBold(True)
779 742
        font.setWeight(75)
......
1065 1028
        self.horizontalLayout_26.addWidget(self.lineEdit_8)
1066 1029
        self.gridLayout.addLayout(self.horizontalLayout_26, 2, 0, 1, 1)
1067 1030
        self.groupBox_GeometryData_Mixed = QtWidgets.QGroupBox(Dialog)
1068
        self.groupBox_GeometryData_Mixed.setGeometry(QtCore.QRect(8, 220, 669, 189))
1031
        self.groupBox_GeometryData_Mixed.setGeometry(QtCore.QRect(8, 196, 669, 189))
1069 1032
        font = QtGui.QFont()
1070 1033
        font.setBold(True)
1071 1034
        font.setWeight(75)
......
1081 1044
        self.tableWidget_GeometryData_Mixed.setRowCount(0)
1082 1045
        self.gridLayout_2.addWidget(self.tableWidget_GeometryData_Mixed, 0, 0, 1, 1)
1083 1046
        self.pushButton_Calculation = QtWidgets.QPushButton(Dialog)
1084
        self.pushButton_Calculation.setGeometry(QtCore.QRect(488, 420, 90, 24))
1047
        self.pushButton_Calculation.setGeometry(QtCore.QRect(436, 17, 81, 23))
1048
        self.pushButton_Calculation.setMinimumSize(QtCore.QSize(0, 23))
1049
        self.pushButton_Calculation.setMaximumSize(QtCore.QSize(16777215, 23))
1085 1050
        self.pushButton_Calculation.setObjectName("pushButton_Calculation")
1086 1051
        self.pushButton_Add_GeometryData_Mixed = QtWidgets.QPushButton(Dialog)
1087
        self.pushButton_Add_GeometryData_Mixed.setGeometry(QtCore.QRect(8, 420, 24, 24))
1052
        self.pushButton_Add_GeometryData_Mixed.setGeometry(QtCore.QRect(8, 400, 24, 24))
1088 1053
        self.pushButton_Add_GeometryData_Mixed.setMinimumSize(QtCore.QSize(24, 24))
1089 1054
        self.pushButton_Add_GeometryData_Mixed.setMaximumSize(QtCore.QSize(24, 24))
1090 1055
        font = QtGui.QFont()
......
1097 1062
        self.pushButton_Add_GeometryData_Mixed.setIcon(icon1)
1098 1063
        self.pushButton_Add_GeometryData_Mixed.setObjectName("pushButton_Add_GeometryData_Mixed")
1099 1064
        self.pushButton_View_Result = QtWidgets.QPushButton(Dialog)
1100
        self.pushButton_View_Result.setGeometry(QtCore.QRect(588, 420, 90, 24))
1065
        self.pushButton_View_Result.setGeometry(QtCore.QRect(588, 400, 90, 24))
1101 1066
        self.pushButton_View_Result.setObjectName("pushButton_View_Result")
1102 1067
        self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
1103
        self.buttonBox.setGeometry(QtCore.QRect(516, 16, 153, 57))
1068
        self.buttonBox.setGeometry(QtCore.QRect(524, 12, 153, 33))
1104 1069
        font = QtGui.QFont()
1105 1070
        font.setFamily("맑은 고딕")
1106 1071
        font.setBold(False)
......
1115 1080
        self.tableWidget_Mixed_DB.setColumnCount(0)
1116 1081
        self.tableWidget_Mixed_DB.setRowCount(0)
1117 1082
        self.pushButton_Diameter_Estimation = QtWidgets.QPushButton(Dialog)
1118
        self.pushButton_Diameter_Estimation.setGeometry(QtCore.QRect(168, 420, 217, 24))
1083
        self.pushButton_Diameter_Estimation.setGeometry(QtCore.QRect(168, 400, 217, 24))
1119 1084
        self.pushButton_Diameter_Estimation.setObjectName("pushButton_Diameter_Estimation")
1085
        self.pushButton_Copy_Stream = QtWidgets.QPushButton(Dialog)
1086
        self.pushButton_Copy_Stream.setGeometry(QtCore.QRect(392, 400, 121, 24))
1087
        self.pushButton_Copy_Stream.setObjectName("pushButton_Copy_Stream")
1088
        self.comboBox_PhaseType = QtWidgets.QComboBox(Dialog)
1089
        self.comboBox_PhaseType.setGeometry(QtCore.QRect(248, 18, 169, 22))
1090
        self.comboBox_PhaseType.setObjectName("comboBox_PhaseType")
1091
        self.label_14 = QtWidgets.QLabel(Dialog)
1092
        self.label_14.setGeometry(QtCore.QRect(172, 20, 77, 16))
1093
        font = QtGui.QFont()
1094
        font.setFamily("맑은 고딕")
1095
        font.setBold(True)
1096
        font.setWeight(75)
1097
        self.label_14.setFont(font)
1098
        self.label_14.setObjectName("label_14")
1099
        self.lineEdit_StreamNo = QtWidgets.QLineEdit(Dialog)
1100
        self.lineEdit_StreamNo.setGeometry(QtCore.QRect(88, 18, 73, 21))
1101
        self.lineEdit_StreamNo.setMinimumSize(QtCore.QSize(0, 21))
1102
        self.lineEdit_StreamNo.setMaximumSize(QtCore.QSize(16777215, 16777215))
1103
        font = QtGui.QFont()
1104
        font.setFamily("맑은 고딕")
1105
        font.setBold(False)
1106
        font.setWeight(50)
1107
        self.lineEdit_StreamNo.setFont(font)
1108
        self.lineEdit_StreamNo.setAlignment(QtCore.Qt.AlignCenter)
1109
        self.lineEdit_StreamNo.setReadOnly(True)
1110
        self.lineEdit_StreamNo.setObjectName("lineEdit_StreamNo")
1111
        self.label_5 = QtWidgets.QLabel(Dialog)
1112
        self.label_5.setGeometry(QtCore.QRect(12, 20, 77, 16))
1113
        font = QtGui.QFont()
1114
        font.setFamily("맑은 고딕")
1115
        font.setBold(True)
1116
        font.setWeight(75)
1117
        self.label_5.setFont(font)
1118
        self.label_5.setObjectName("label_5")
1120 1119

  
1121 1120
        self.retranslateUi(Dialog)
1122 1121
        self.buttonBox.accepted.connect(Dialog.accept)
1123 1122
        self.buttonBox.rejected.connect(Dialog.reject)
1124 1123
        QtCore.QMetaObject.connectSlotsByName(Dialog)
1125
        Dialog.setTabOrder(self.lineEdit_DisplayNo, self.comboBox_PhaseType)
1124
        Dialog.setTabOrder(self.lineEdit_StreamNo, self.comboBox_PhaseType)
1126 1125
        Dialog.setTabOrder(self.comboBox_PhaseType, self.lineEdit_Flowrate_Mass_Liquid)
1127 1126
        Dialog.setTabOrder(self.lineEdit_Flowrate_Mass_Liquid, self.lineEdit_Flowrate_Volume)
1128 1127
        Dialog.setTabOrder(self.lineEdit_Flowrate_Volume, self.lineEdit_Density)
......
1150 1149
    def retranslateUi(self, Dialog):
1151 1150
        _translate = QtCore.QCoreApplication.translate
1152 1151
        Dialog.setWindowTitle(_translate("Dialog", "Stream Data"))
1153
        self.groupBox_StreamNo.setTitle(_translate("Dialog", "Stream No : ????"))
1154
        self.label_14.setText(_translate("Dialog", "Phase Type : "))
1155
        self.label_5.setText(_translate("Dialog", "Display No. : "))
1156 1152
        self.groupBox_GeometryData.setTitle(_translate("Dialog", "Geometry Data"))
1157 1153
        self.label_8.setText(_translate("Dialog", "Nominal Diameter :"))
1158 1154
        self.label_Nominal_Pipe_Size_Unit.setText(_translate("Dialog", "-"))
......
1219 1215
        self.pushButton_Calculation.setText(_translate("Dialog", "Calculation"))
1220 1216
        self.pushButton_View_Result.setText(_translate("Dialog", "View Result"))
1221 1217
        self.pushButton_Diameter_Estimation.setText(_translate("Dialog", "Diameter Estimation (Line Sizing)"))
1218
        self.pushButton_Copy_Stream.setText(_translate("Dialog", "Copy Stream Data"))
1219
        self.label_14.setText(_translate("Dialog", "Phase Type : "))
1220
        self.label_5.setText(_translate("Dialog", "Stream No. : "))
1222 1221
import Resource_rc
HYTOS/HYTOS/UI/Roughness.ui
6 6
   <rect>
7 7
    <x>0</x>
8 8
    <y>0</y>
9
    <width>317</width>
10
    <height>277</height>
9
    <width>367</width>
10
    <height>280</height>
11 11
   </rect>
12 12
  </property>
13 13
  <property name="font">
HYTOS/HYTOS/UI/Roughness_Hagen.ui
6 6
   <rect>
7 7
    <x>0</x>
8 8
    <y>0</y>
9
    <width>317</width>
10
    <height>403</height>
9
    <width>319</width>
10
    <height>280</height>
11 11
   </rect>
12 12
  </property>
13 13
  <property name="font">
HYTOS/HYTOS/UI/StreamData.ui
6 6
   <rect>
7 7
    <x>0</x>
8 8
    <y>0</y>
9
    <width>687</width>
10
    <height>767</height>
9
    <width>685</width>
10
    <height>437</height>
11 11
   </rect>
12 12
  </property>
13 13
  <property name="sizePolicy">
......
28 28
   <iconset resource="../res/Resource.qrc">
29 29
    <normaloff>:/images/HYTOS.png</normaloff>:/images/HYTOS.png</iconset>
30 30
  </property>
31
  <widget class="QGroupBox" name="groupBox_StreamNo">
32
   <property name="geometry">
33
    <rect>
34
     <x>8</x>
35
     <y>8</y>
36
     <width>493</width>
37
     <height>60</height>
38
    </rect>
39
   </property>
40
   <property name="font">
41
    <font>
42
     <family>맑은 고딕</family>
43
     <weight>75</weight>
44
     <bold>true</bold>
45
    </font>
46
   </property>
47
   <property name="title">
48
    <string>Stream No : ????</string>
49
   </property>
50
   <widget class="QLabel" name="label_14">
51
    <property name="geometry">
52
     <rect>
53
      <x>236</x>
54
      <y>30</y>
55
      <width>77</width>
56
      <height>16</height>
57
     </rect>
58
    </property>
59
    <property name="font">
60
     <font>
61
      <family>맑은 고딕</family>
62
      <weight>50</weight>
63
      <bold>false</bold>
64
     </font>
65
    </property>
66
    <property name="text">
67
     <string>Phase Type : </string>
68
    </property>
69
   </widget>
70
   <widget class="QComboBox" name="comboBox_PhaseType">
71
    <property name="geometry">
72
     <rect>
73
      <x>312</x>
74
      <y>28</y>
75
      <width>169</width>
76
      <height>22</height>
77
     </rect>
78
    </property>
79
   </widget>
80
   <widget class="QLabel" name="label_5">
81
    <property name="geometry">
82
     <rect>
83
      <x>12</x>
84
      <y>30</y>
85
      <width>77</width>
86
      <height>16</height>
87
     </rect>
88
    </property>
89
    <property name="font">
90
     <font>
91
      <family>맑은 고딕</family>
92
      <weight>50</weight>
93
      <bold>false</bold>
94
     </font>
95
    </property>
96
    <property name="text">
97
     <string>Display No. : </string>
98
    </property>
99
   </widget>
100
   <widget class="QLineEdit" name="lineEdit_DisplayNo">
101
    <property name="geometry">
102
     <rect>
103
      <x>88</x>
104
      <y>28</y>
105
      <width>133</width>
106
      <height>21</height>
107
     </rect>
108
    </property>
109
    <property name="minimumSize">
110
     <size>
... 이 차이점은 표시할 수 있는 최대 줄수를 초과해서 이 차이점은 잘렸습니다.

내보내기 Unified diff

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