개정판 08955797
issue #1048 : 화면/네뉴/툴바 개발
Change-Id: I1b89f30441c774d71581ea4125ce639240e419b6
HYTOS/HYTOS/AirFinCooler.py | ||
---|---|---|
14 | 14 |
import math |
15 | 15 |
|
16 | 16 |
|
17 |
def is_float(s): |
|
18 |
try: |
|
19 |
if s: |
|
20 |
float(s) |
|
21 |
return True |
|
22 |
else: |
|
23 |
return False |
|
24 |
except ValueError: |
|
25 |
return False |
|
26 |
|
|
27 |
|
|
28 |
def is_blank(s): |
|
29 |
return not (s and s.strip()) |
|
30 |
|
|
31 |
|
|
17 | 32 |
def is_not_blank(s): |
18 | 33 |
return bool(s and s.strip()) |
19 | 34 |
|
20 | 35 |
|
36 |
def convert_to_fixed_point(value): |
|
37 |
if is_float(str(value)): |
|
38 |
tokens = f"{float(value):.10f}".split('.') |
|
39 |
if len(tokens) == 2: |
|
40 |
# 소수점 아래가 있을 경우 소수점 아래의 trailing zero를 제거한다. |
|
41 |
if is_blank(tokens[1].rstrip('0')): |
|
42 |
return tokens[0] |
|
43 |
else: |
|
44 |
tokens[1] = tokens[1].rstrip('0') |
|
45 |
return '.'.join(tokens) |
|
46 |
else: |
|
47 |
return tokens[0] |
|
48 |
else: |
|
49 |
return value |
|
50 |
|
|
51 |
|
|
21 | 52 |
class QAirFinCooler(QDialog): |
22 | 53 |
def __init__(self): |
23 | 54 |
QDialog.__init__(self) |
... | ... | |
62 | 93 |
matches = [connector.data for connector in self._item.connectors if connector.data] |
63 | 94 |
if matches: |
64 | 95 |
pressure_drop = matches[0].pressure_drop |
65 |
if pressure_drop: |
|
66 |
self.ui.lineEdit_Pressure_Drop.setText(str(pressure_drop))
|
|
96 |
if pressure_drop is not None:
|
|
97 |
self.ui.lineEdit_Pressure_Drop.setText(str(convert_to_fixed_point(pressure_drop)))
|
|
67 | 98 |
|
68 | 99 |
elevation = matches[0].elevation |
69 |
if elevation: |
|
70 |
self.ui.lineEdit_Elevation.setText(str(elevation))
|
|
100 |
if elevation is not None:
|
|
101 |
self.ui.lineEdit_Elevation.setText(str(convert_to_fixed_point(elevation)))
|
|
71 | 102 |
|
72 | 103 |
def accept(self): |
73 | 104 |
""" set tag no and nozzle data """ |
... | ... | |
75 | 106 |
tag_no = self.ui.lineEdit_TagNo.text() |
76 | 107 |
|
77 | 108 |
if is_not_blank(tag_no): |
109 |
self._item.tag_no = tag_no |
|
78 | 110 |
for connector in self._item.connectors: |
79 | 111 |
if not connector.data: |
80 | 112 |
connector.data = NozzleData() |
... | ... | |
83 | 115 |
if pressure_drop: |
84 | 116 |
connector.data.pressure_drop = float(pressure_drop) |
85 | 117 |
else: |
86 |
connector.data.pressure_drop = None
|
|
118 |
connector.data.pressure_drop = 0
|
|
87 | 119 |
|
88 | 120 |
elevation = self.ui.lineEdit_Elevation.text() |
89 | 121 |
if elevation: |
90 | 122 |
connector.data.elevation = float(elevation) |
91 | 123 |
else: |
92 |
connector.data.elevation = None
|
|
124 |
connector.data.elevation = 0
|
|
93 | 125 |
|
94 | 126 |
QDialog.accept(self) |
95 | 127 |
else: |
96 |
QMessageBox.warning(self, self.tr('Notice'), self.tr('Please Input [Tag No.]'))
|
|
128 |
QMessageBox.information(self, self.tr('Information'), self.tr('Please Input [Tag No.]'))
|
|
97 | 129 |
|
98 | 130 |
def reject(self): |
99 | 131 |
QDialog.reject(self) |
HYTOS/HYTOS/AirFinCooler_UI.py | ||
---|---|---|
19 | 19 |
sizePolicy.setVerticalStretch(0) |
20 | 20 |
sizePolicy.setHeightForWidth(AirFinCoolerDialog.sizePolicy().hasHeightForWidth()) |
21 | 21 |
AirFinCoolerDialog.setSizePolicy(sizePolicy) |
22 |
AirFinCoolerDialog.setMinimumSize(QtCore.QSize(0, 0))
|
|
23 |
AirFinCoolerDialog.setMaximumSize(QtCore.QSize(503, 177))
|
|
22 |
AirFinCoolerDialog.setMinimumSize(QtCore.QSize(468, 177))
|
|
23 |
AirFinCoolerDialog.setMaximumSize(QtCore.QSize(468, 177))
|
|
24 | 24 |
font = QtGui.QFont() |
25 | 25 |
font.setFamily("맑은 고딕") |
26 | 26 |
AirFinCoolerDialog.setFont(font) |
... | ... | |
139 | 139 |
|
140 | 140 |
def retranslateUi(self, AirFinCoolerDialog): |
141 | 141 |
_translate = QtCore.QCoreApplication.translate |
142 |
AirFinCoolerDialog.setWindowTitle(_translate("AirFinCoolerDialog", "HYTOS Equipment Data - Air Fin Cooler"))
|
|
142 |
AirFinCoolerDialog.setWindowTitle(_translate("AirFinCoolerDialog", "Equipment Data - Air Fin Cooler")) |
|
143 | 143 |
self.groupBox.setTitle(_translate("AirFinCoolerDialog", "Equipment Figure")) |
144 | 144 |
self.label_Img.setText(_translate("AirFinCoolerDialog", "<html><head/><body><p><img src=\":/images/AirFinCooler.png\"/></p></body></html>")) |
145 | 145 |
self.label.setText(_translate("AirFinCoolerDialog", "Tag No.")) |
HYTOS/HYTOS/Ball.py | ||
---|---|---|
14 | 14 |
import math |
15 | 15 |
|
16 | 16 |
|
17 |
def is_float(s): |
|
18 |
try: |
|
19 |
if s: |
|
20 |
float(s) |
|
21 |
return True |
|
22 |
else: |
|
23 |
return False |
|
24 |
except ValueError: |
|
25 |
return False |
|
26 |
|
|
27 |
|
|
28 |
def is_blank(s): |
|
29 |
return not (s and s.strip()) |
|
30 |
|
|
31 |
|
|
17 | 32 |
def is_not_blank(s): |
18 | 33 |
return bool(s and s.strip()) |
19 | 34 |
|
20 | 35 |
|
36 |
def convert_to_fixed_point(value): |
|
37 |
if is_float(str(value)): |
|
38 |
tokens = f"{float(value):.10f}".split('.') |
|
39 |
if len(tokens) == 2: |
|
40 |
# 소수점 아래가 있을 경우 소수점 아래의 trailing zero를 제거한다. |
|
41 |
if is_blank(tokens[1].rstrip('0')): |
|
42 |
return tokens[0] |
|
43 |
else: |
|
44 |
tokens[1] = tokens[1].rstrip('0') |
|
45 |
return '.'.join(tokens) |
|
46 |
else: |
|
47 |
return tokens[0] |
|
48 |
else: |
|
49 |
return value |
|
50 |
|
|
51 |
|
|
21 | 52 |
class QBall(QDialog): |
22 | 53 |
def __init__(self): |
23 | 54 |
QDialog.__init__(self) |
... | ... | |
162 | 193 |
index = connector._conn_index |
163 | 194 |
if connector.data: |
164 | 195 |
pressure = connector.data.pressure |
165 |
if pressure: |
|
196 |
if pressure is not None:
|
|
166 | 197 |
if index == 1: |
167 |
self.ui.lineEdit_N1_Pressure.setText(str(pressure))
|
|
198 |
self.ui.lineEdit_N1_Pressure.setText(str(convert_to_fixed_point(pressure)))
|
|
168 | 199 |
elif index == 2: |
169 |
self.ui.lineEdit_N2_Pressure.setText(str(pressure))
|
|
200 |
self.ui.lineEdit_N2_Pressure.setText(str(convert_to_fixed_point(pressure)))
|
|
170 | 201 |
elif index == 3: |
171 |
self.ui.lineEdit_N3_Pressure.setText(str(pressure))
|
|
202 |
self.ui.lineEdit_N3_Pressure.setText(str(convert_to_fixed_point(pressure)))
|
|
172 | 203 |
elif index == 4: |
173 |
self.ui.lineEdit_N4_Pressure.setText(str(pressure))
|
|
204 |
self.ui.lineEdit_N4_Pressure.setText(str(convert_to_fixed_point(pressure)))
|
|
174 | 205 |
elif index == 5: |
175 |
self.ui.lineEdit_N5_Pressure.setText(str(pressure))
|
|
206 |
self.ui.lineEdit_N5_Pressure.setText(str(convert_to_fixed_point(pressure)))
|
|
176 | 207 |
elif index == 6: |
177 |
self.ui.lineEdit_N6_Pressure.setText(str(pressure))
|
|
208 |
self.ui.lineEdit_N6_Pressure.setText(str(convert_to_fixed_point(pressure)))
|
|
178 | 209 |
elif index == 7: |
179 |
self.ui.lineEdit_N7_Pressure.setText(str(pressure))
|
|
210 |
self.ui.lineEdit_N7_Pressure.setText(str(convert_to_fixed_point(pressure)))
|
|
180 | 211 |
elif index == 8: |
181 |
self.ui.lineEdit_N8_Pressure.setText(str(pressure))
|
|
212 |
self.ui.lineEdit_N8_Pressure.setText(str(convert_to_fixed_point(pressure)))
|
|
182 | 213 |
|
183 | 214 |
elevation = connector.data.elevation |
184 |
if elevation: |
|
215 |
if elevation is not None:
|
|
185 | 216 |
if index == 1: |
186 |
self.ui.lineEdit_N1_Elevation.setText(str(elevation))
|
|
217 |
self.ui.lineEdit_N1_Elevation.setText(str(convert_to_fixed_point(elevation)))
|
|
187 | 218 |
elif index == 2: |
188 |
self.ui.lineEdit_N2_Elevation.setText(str(elevation))
|
|
219 |
self.ui.lineEdit_N2_Elevation.setText(str(convert_to_fixed_point(elevation)))
|
|
189 | 220 |
elif index == 3: |
190 |
self.ui.lineEdit_N3_Elevation.setText(str(elevation))
|
|
221 |
self.ui.lineEdit_N3_Elevation.setText(str(convert_to_fixed_point(elevation)))
|
|
191 | 222 |
elif index == 4: |
192 |
self.ui.lineEdit_N4_Elevation.setText(str(elevation))
|
|
223 |
self.ui.lineEdit_N4_Elevation.setText(str(convert_to_fixed_point(elevation)))
|
|
193 | 224 |
elif index == 5: |
194 |
self.ui.lineEdit_N5_Elevation.setText(str(elevation))
|
|
225 |
self.ui.lineEdit_N5_Elevation.setText(str(convert_to_fixed_point(elevation)))
|
|
195 | 226 |
elif index == 6: |
196 |
self.ui.lineEdit_N6_Elevation.setText(str(elevation))
|
|
227 |
self.ui.lineEdit_N6_Elevation.setText(str(convert_to_fixed_point(elevation)))
|
|
197 | 228 |
elif index == 7: |
198 |
self.ui.lineEdit_N7_Elevation.setText(str(elevation))
|
|
229 |
self.ui.lineEdit_N7_Elevation.setText(str(convert_to_fixed_point(elevation)))
|
|
199 | 230 |
elif index == 8: |
200 |
self.ui.lineEdit_N8_Elevation.setText(str(elevation))
|
|
231 |
self.ui.lineEdit_N8_Elevation.setText(str(convert_to_fixed_point(elevation)))
|
|
201 | 232 |
|
202 | 233 |
def accept(self): |
203 | 234 |
""" set tag no and nozzle data """ |
... | ... | |
212 | 243 |
connector.data = NozzleData() |
213 | 244 |
|
214 | 245 |
if index == 1: |
215 |
pressure = self.ui.lineEdit_N1_Pressure.text() |
|
216 |
if pressure: |
|
217 |
connector.data.pressure = float(pressure) |
|
218 |
else: |
|
219 |
connector.data.pressure = None |
|
220 |
|
|
221 |
elevation = self.ui.lineEdit_N1_Elevation.text() |
|
222 |
if elevation: |
|
223 |
connector.data.elevation = float(elevation) |
|
224 |
else: |
|
225 |
connector.data.elevation = None |
|
246 |
if self.ui.lineEdit_N1_Pressure.isEnabled(): |
|
247 |
pressure = self.ui.lineEdit_N1_Pressure.text() |
|
248 |
if pressure: |
|
249 |
connector.data.pressure = float(pressure) |
|
250 |
else: |
|
251 |
connector.data.pressure = 0 |
|
252 |
|
|
253 |
if self.ui.lineEdit_N1_Elevation.isEnabled(): |
|
254 |
elevation = self.ui.lineEdit_N1_Elevation.text() |
|
255 |
if elevation: |
|
256 |
connector.data.elevation = float(elevation) |
|
257 |
else: |
|
258 |
connector.data.elevation = 0 |
|
226 | 259 |
elif index == 2: |
227 |
pressure = self.ui.lineEdit_N2_Pressure.text() |
|
228 |
if pressure: |
|
229 |
connector.data.pressure = float(pressure) |
|
230 |
else: |
|
231 |
connector.data.pressure = None |
|
232 |
|
|
233 |
elevation = self.ui.lineEdit_N2_Elevation.text() |
|
234 |
if elevation: |
|
235 |
connector.data.elevation = float(elevation) |
|
236 |
else: |
|
237 |
connector.data.elevation = None |
|
260 |
if self.ui.lineEdit_N2_Pressure.isEnabled(): |
|
261 |
pressure = self.ui.lineEdit_N2_Pressure.text() |
|
262 |
if pressure: |
|
263 |
connector.data.pressure = float(pressure) |
|
264 |
else: |
|
265 |
connector.data.pressure = 0 |
|
266 |
|
|
267 |
if self.ui.lineEdit_N2_Elevation.isEnabled(): |
|
268 |
elevation = self.ui.lineEdit_N2_Elevation.text() |
|
269 |
if elevation: |
|
270 |
connector.data.elevation = float(elevation) |
|
271 |
else: |
|
272 |
connector.data.elevation = 0 |
|
238 | 273 |
elif index == 3: |
239 |
pressure = self.ui.lineEdit_N3_Pressure.text() |
|
240 |
if pressure: |
|
241 |
connector.data.pressure = float(pressure) |
|
242 |
else: |
|
243 |
connector.data.pressure = None |
|
244 |
|
|
245 |
elevation = self.ui.lineEdit_N3_Elevation.text() |
|
246 |
if elevation: |
|
247 |
connector.data.elevation = float(elevation) |
|
248 |
else: |
|
249 |
connector.data.elevation = None |
|
274 |
if self.ui.lineEdit_N3_Pressure.isEnabled(): |
|
275 |
pressure = self.ui.lineEdit_N3_Pressure.text() |
|
276 |
if pressure: |
|
277 |
connector.data.pressure = float(pressure) |
|
278 |
else: |
|
279 |
connector.data.pressure = 0 |
|
280 |
|
|
281 |
if self.ui.lineEdit_N3_Elevation.isEnabled(): |
|
282 |
elevation = self.ui.lineEdit_N3_Elevation.text() |
|
283 |
if elevation: |
|
284 |
connector.data.elevation = float(elevation) |
|
285 |
else: |
|
286 |
connector.data.elevation = 0 |
|
250 | 287 |
elif index == 4: |
251 |
pressure = self.ui.lineEdit_N4_Pressure.text() |
|
252 |
if pressure: |
|
253 |
connector.data.pressure = float(pressure) |
|
254 |
else: |
|
255 |
connector.data.pressure = None |
|
256 |
|
|
257 |
elevation = self.ui.lineEdit_N4_Elevation.text() |
|
258 |
if elevation: |
|
259 |
connector.data.elevation = float(elevation) |
|
260 |
else: |
|
261 |
connector.data.elevation = None |
|
288 |
if self.ui.lineEdit_N4_Pressure.isEnabled(): |
|
289 |
pressure = self.ui.lineEdit_N4_Pressure.text() |
|
290 |
if pressure: |
|
291 |
connector.data.pressure = float(pressure) |
|
292 |
else: |
|
293 |
connector.data.pressure = 0 |
|
294 |
|
|
295 |
if self.ui.lineEdit_N4_Elevation.isEnabled(): |
|
296 |
elevation = self.ui.lineEdit_N4_Elevation.text() |
|
297 |
if elevation: |
|
298 |
connector.data.elevation = float(elevation) |
|
299 |
else: |
|
300 |
connector.data.elevation = 0 |
|
262 | 301 |
elif index == 5: |
263 |
pressure = self.ui.lineEdit_N5_Pressure.text() |
|
264 |
if pressure: |
|
265 |
connector.data.pressure = float(pressure) |
|
266 |
else: |
|
267 |
connector.data.pressure = None |
|
268 |
|
|
269 |
elevation = self.ui.lineEdit_N5_Elevation.text() |
|
270 |
if elevation: |
|
271 |
connector.data.elevation = float(elevation) |
|
272 |
else: |
|
273 |
connector.data.elevation = None |
|
302 |
if self.ui.lineEdit_N5_Pressure.isEnabled(): |
|
303 |
pressure = self.ui.lineEdit_N5_Pressure.text() |
|
304 |
if pressure: |
|
305 |
connector.data.pressure = float(pressure) |
|
306 |
else: |
|
307 |
connector.data.pressure = 0 |
|
308 |
|
|
309 |
if self.ui.lineEdit_N5_Elevation.isEnabled(): |
|
310 |
elevation = self.ui.lineEdit_N5_Elevation.text() |
|
311 |
if elevation: |
|
312 |
connector.data.elevation = float(elevation) |
|
313 |
else: |
|
314 |
connector.data.elevation = 0 |
|
274 | 315 |
elif index == 6: |
275 |
pressure = self.ui.lineEdit_N6_Pressure.text() |
|
276 |
if pressure: |
|
277 |
connector.data.pressure = float(pressure) |
|
278 |
else: |
|
279 |
connector.data.pressure = None |
|
280 |
|
|
281 |
elevation = self.ui.lineEdit_N6_Elevation.text() |
|
282 |
if elevation: |
|
283 |
connector.data.elevation = float(elevation) |
|
284 |
else: |
|
285 |
connector.data.elevation = None |
|
316 |
if self.ui.lineEdit_N6_Pressure.isEnabled(): |
|
317 |
pressure = self.ui.lineEdit_N6_Pressure.text() |
|
318 |
if pressure: |
|
319 |
connector.data.pressure = float(pressure) |
|
320 |
else: |
|
321 |
connector.data.pressure = 0 |
|
322 |
|
|
323 |
if self.ui.lineEdit_N6_Elevation.isEnabled(): |
|
324 |
elevation = self.ui.lineEdit_N6_Elevation.text() |
|
325 |
if elevation: |
|
326 |
connector.data.elevation = float(elevation) |
|
327 |
else: |
|
328 |
connector.data.elevation = 0 |
|
286 | 329 |
elif index == 7: |
287 |
pressure = self.ui.lineEdit_N7_Pressure.text() |
|
288 |
if pressure: |
|
289 |
connector.data.pressure = float(pressure) |
|
290 |
else: |
|
291 |
connector.data.pressure = None |
|
292 |
|
|
293 |
elevation = self.ui.lineEdit_N7_Elevation.text() |
|
294 |
if elevation: |
|
295 |
connector.data.elevation = float(elevation) |
|
296 |
else: |
|
297 |
connector.data.elevation = None |
|
330 |
if self.ui.lineEdit_N7_Pressure.isEnabled(): |
|
331 |
pressure = self.ui.lineEdit_N7_Pressure.text() |
|
332 |
if pressure: |
|
333 |
connector.data.pressure = float(pressure) |
|
334 |
else: |
|
335 |
connector.data.pressure = 0 |
|
336 |
|
|
337 |
if self.ui.lineEdit_N7_Elevation.isEnabled(): |
|
338 |
elevation = self.ui.lineEdit_N7_Elevation.text() |
|
339 |
if elevation: |
|
340 |
connector.data.elevation = float(elevation) |
|
341 |
else: |
|
342 |
connector.data.elevation = 0 |
|
298 | 343 |
elif index == 8: |
299 |
pressure = self.ui.lineEdit_N8_Pressure.text() |
|
300 |
if pressure: |
|
301 |
connector.data.pressure = float(pressure) |
|
302 |
else: |
|
303 |
connector.data.pressure = None |
|
304 |
|
|
305 |
elevation = self.ui.lineEdit_N8_Elevation.text() |
|
306 |
if elevation: |
|
307 |
connector.data.elevation = float(elevation) |
|
308 |
else: |
|
309 |
connector.data.elevation = None |
|
344 |
if self.ui.lineEdit_N8_Pressure.isEnabled(): |
|
345 |
pressure = self.ui.lineEdit_N8_Pressure.text() |
|
346 |
if pressure: |
|
347 |
connector.data.pressure = float(pressure) |
|
348 |
else: |
|
349 |
connector.data.pressure = 0 |
|
350 |
|
|
351 |
if self.ui.lineEdit_N8_Elevation.isEnabled(): |
|
352 |
elevation = self.ui.lineEdit_N8_Elevation.text() |
|
353 |
if elevation: |
|
354 |
connector.data.elevation = float(elevation) |
|
355 |
else: |
|
356 |
connector.data.elevation = 0 |
|
310 | 357 |
|
311 | 358 |
QDialog.accept(self) |
312 | 359 |
else: |
313 |
QMessageBox.warning(self, self.tr('Notice'), self.tr('Please Input [Tag No.]'))
|
|
360 |
QMessageBox.information(self, self.tr('Information'), self.tr('Please Input [Tag No.]'))
|
|
314 | 361 |
|
315 | 362 |
def reject(self): |
316 | 363 |
QDialog.reject(self) |
HYTOS/HYTOS/Ball_UI.py | ||
---|---|---|
14 | 14 |
def setupUi(self, BallDialog): |
15 | 15 |
BallDialog.setObjectName("BallDialog") |
16 | 16 |
BallDialog.resize(487, 328) |
17 |
BallDialog.setMinimumSize(QtCore.QSize(487, 328)) |
|
18 |
BallDialog.setMaximumSize(QtCore.QSize(487, 328)) |
|
17 | 19 |
font = QtGui.QFont() |
18 | 20 |
font.setFamily("맑은 고딕") |
19 | 21 |
BallDialog.setFont(font) |
... | ... | |
241 | 243 |
|
242 | 244 |
def retranslateUi(self, BallDialog): |
243 | 245 |
_translate = QtCore.QCoreApplication.translate |
244 |
BallDialog.setWindowTitle(_translate("BallDialog", "HYTOS Equipment Data - Ball Tank"))
|
|
246 |
BallDialog.setWindowTitle(_translate("BallDialog", "Equipment Data - Ball Tank")) |
|
245 | 247 |
self.groupBox_2.setTitle(_translate("BallDialog", "Equipment Figure")) |
246 | 248 |
self.label_2.setText(_translate("BallDialog", "<html><head/><body><p><img src=\":/images/Ball.png\"/></p></body></html>")) |
247 | 249 |
self.label.setText(_translate("BallDialog", "Tag No.")) |
HYTOS/HYTOS/BatteryLimit.py | ||
---|---|---|
14 | 14 |
import math |
15 | 15 |
|
16 | 16 |
|
17 |
def is_float(s): |
|
18 |
try: |
|
19 |
if s: |
|
20 |
float(s) |
|
21 |
return True |
|
22 |
else: |
|
23 |
return False |
|
24 |
except ValueError: |
|
25 |
return False |
|
26 |
|
|
27 |
|
|
28 |
def is_blank(s): |
|
29 |
return not (s and s.strip()) |
|
30 |
|
|
31 |
|
|
17 | 32 |
def is_not_blank(s): |
18 | 33 |
return bool(s and s.strip()) |
19 | 34 |
|
20 | 35 |
|
36 |
def convert_to_fixed_point(value): |
|
37 |
if is_float(str(value)): |
|
38 |
tokens = f"{float(value):.10f}".split('.') |
|
39 |
if len(tokens) == 2: |
|
40 |
# 소수점 아래가 있을 경우 소수점 아래의 trailing zero를 제거한다. |
|
41 |
if is_blank(tokens[1].rstrip('0')): |
|
42 |
return tokens[0] |
|
43 |
else: |
|
44 |
tokens[1] = tokens[1].rstrip('0') |
|
45 |
return '.'.join(tokens) |
|
46 |
else: |
|
47 |
return tokens[0] |
|
48 |
else: |
|
49 |
return value |
|
50 |
|
|
51 |
|
|
21 | 52 |
class QBatteryLimit(QDialog): |
22 | 53 |
def __init__(self): |
23 | 54 |
QDialog.__init__(self) |
... | ... | |
75 | 106 |
matches = [connector.data for connector in self._item.connectors if connector.data] |
76 | 107 |
if matches: |
77 | 108 |
pressure = matches[0].pressure |
78 |
if pressure: |
|
79 |
self.ui.lineEdit_Pressure.setText(str(pressure))
|
|
109 |
if pressure is not None:
|
|
110 |
self.ui.lineEdit_Pressure.setText(str(convert_to_fixed_point(pressure)))
|
|
80 | 111 |
|
81 | 112 |
elevation = matches[0].elevation |
82 |
if elevation: |
|
83 |
self.ui.lineEdit_Elevation.setText(str(elevation))
|
|
113 |
if elevation is not None:
|
|
114 |
self.ui.lineEdit_Elevation.setText(str(convert_to_fixed_point(elevation)))
|
|
84 | 115 |
|
85 | 116 |
def accept(self): |
86 | 117 |
""" set tag no and nozzle data """ |
... | ... | |
97 | 128 |
if pressure: |
98 | 129 |
connector.data.pressure = float(pressure) |
99 | 130 |
else: |
100 |
connector.data.pressure = None
|
|
131 |
connector.data.pressure = 0
|
|
101 | 132 |
|
102 | 133 |
elevation = self.ui.lineEdit_Elevation.text() |
103 | 134 |
if elevation: |
104 | 135 |
connector.data.elevation = float(elevation) |
105 | 136 |
else: |
106 |
connector.data.elevation = None
|
|
137 |
connector.data.elevation = 0
|
|
107 | 138 |
|
108 | 139 |
QDialog.accept(self) |
109 | 140 |
else: |
110 |
QMessageBox.warning(self, self.tr('Notice'), self.tr('Please Input [Tag No.]'))
|
|
141 |
QMessageBox.information(self, self.tr('Information'), self.tr('Please Input [Tag No.]'))
|
|
111 | 142 |
|
112 | 143 |
def reject(self): |
113 | 144 |
QDialog.reject(self) |
HYTOS/HYTOS/BatteryLimit_UI.py | ||
---|---|---|
14 | 14 |
def setupUi(self, BatteryLimitDialog): |
15 | 15 |
BatteryLimitDialog.setObjectName("BatteryLimitDialog") |
16 | 16 |
BatteryLimitDialog.resize(367, 175) |
17 |
BatteryLimitDialog.setMinimumSize(QtCore.QSize(367, 175)) |
|
18 |
BatteryLimitDialog.setMaximumSize(QtCore.QSize(367, 175)) |
|
17 | 19 |
font = QtGui.QFont() |
18 | 20 |
font.setFamily("맑은 고딕") |
19 | 21 |
BatteryLimitDialog.setFont(font) |
... | ... | |
123 | 125 |
|
124 | 126 |
def retranslateUi(self, BatteryLimitDialog): |
125 | 127 |
_translate = QtCore.QCoreApplication.translate |
126 |
BatteryLimitDialog.setWindowTitle(_translate("BatteryLimitDialog", "HYTOS Equipment Data - Battery Limit"))
|
|
128 |
BatteryLimitDialog.setWindowTitle(_translate("BatteryLimitDialog", "Equipment Data - Battery Limit")) |
|
127 | 129 |
self.groupBox.setTitle(_translate("BatteryLimitDialog", "Equipment Figure")) |
128 | 130 |
self.label_Img_Down.setText(_translate("BatteryLimitDialog", "<html><head/><body><p><img src=\":/images/Battery_Limit_Down.png\"/></p></body></html>")) |
129 | 131 |
self.label_Img_Up.setText(_translate("BatteryLimitDialog", "<html><head/><body><p><img src=\":/images/Battery_Limit_Up.png\"/></p></body></html>")) |
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()) |
내보내기 Unified diff