개정판 ae3e5e31
issue #1201 : 2 Phase 계산식
Change-Id: I48cf971732456b4ea1170d65e82a33436554ddb8
HYTOS/HYTOS/Calculation.py | ||
---|---|---|
624 | 624 |
|
625 | 625 |
|
626 | 626 |
class Calculation_2Phase: |
627 |
def __init__(self, components_uid, process, geometry):
|
|
628 |
self.components_uid = components_uid
|
|
627 |
def __init__(self, item, process, geometry):
|
|
628 |
self.item = item
|
|
629 | 629 |
self.process = process |
630 | 630 |
self.geometry = geometry |
631 | 631 |
self.units = {} |
... | ... | |
633 | 633 |
self.calculated_variable = {} |
634 | 634 |
self.init_units() |
635 | 635 |
|
636 |
self.no = None |
|
637 |
self.element = {} |
|
638 |
self.inside_diameter = {} |
|
639 |
self.length = {} |
|
640 |
self.angle = {} |
|
641 |
self.k = {} |
|
642 |
self.pressure = {} |
|
643 |
self.void = {} |
|
644 |
self.quality = {} |
|
645 |
self.mean_den = {} |
|
646 |
self.v_density = {} |
|
647 |
self.homo_vel = {} |
|
648 |
self.max_vel = {} |
|
649 |
self.ero_vel = {} |
|
650 |
self.x = {} |
|
651 |
self.y = {} |
|
652 |
self.regime = {} |
|
653 |
self.dp_fric = {} |
|
654 |
self.dp_stat = {} |
|
655 |
self.dp_momen = {} |
|
656 |
self.total_length = {} |
|
657 |
|
|
636 | 658 |
self.tp_cal() |
637 | 659 |
|
660 |
def result(self=None): |
|
661 |
res = [] |
|
662 |
|
|
663 |
for i in range(self.no): |
|
664 |
no = i |
|
665 |
|
|
666 |
element = self.element[no] if no in self.element else None |
|
667 |
inside_diameter = self.inside_diameter[no] if no in self.inside_diameter else None |
|
668 |
length = self.length[no] if no in self.length else None |
|
669 |
angle = self.angle[no] if no in self.angle else None |
|
670 |
k = self.k[no] if no in self.k else None |
|
671 |
pressure = self.pressure[no] if no in self.pressure else None |
|
672 |
void = self.void[no] if no in self.void else None |
|
673 |
quality = self.quality[no] if no in self.quality else None |
|
674 |
mean_den = self.mean_den[no] if no in self.mean_den else None |
|
675 |
v_density = self.v_density[no] if no in self.v_density else None |
|
676 |
homo_vel = self.homo_vel[no] if no in self.homo_vel else None |
|
677 |
max_vel = self.max_vel[no] if no in self.max_vel else None |
|
678 |
ero_vel = self.ero_vel[no] if no in self.ero_vel else None |
|
679 |
x = self.x[no] if no in self.x else None |
|
680 |
y = self.y[no] if no in self.y else None |
|
681 |
regime = self.regime[no] if no in self.regime else None |
|
682 |
dp_fric = self.dp_fric[no] if no in self.dp_fric else None |
|
683 |
dp_stat = self.dp_stat[no] if no in self.dp_stat else None |
|
684 |
dp_momen = self.dp_momen[no] if no in self.dp_momen else None |
|
685 |
total_length = self.total_length[no] if no in self.total_length else None |
|
686 |
|
|
687 |
res.append((no, element, inside_diameter, length, angle, k, pressure, void, quality, mean_den, v_density, |
|
688 |
homo_vel, max_vel, ero_vel, x, y, regime, dp_fric, dp_stat, dp_momen, total_length)) |
|
689 |
|
|
690 |
return res |
|
691 |
|
|
638 | 692 |
def init_units(self): |
639 | 693 |
try: |
640 | 694 |
app_doc_data = AppDocData.instance() |
... | ... | |
848 | 902 |
|
849 | 903 |
self.calculated_variable['tp_pipe_total_drop'] = tp_pipe_total_drop |
850 | 904 |
tp_dp_momen = tp_pipe_total_drop - tp_dp_fric - tp_dp_stat |
905 |
|
|
906 |
self.calculated_variable['tp_dp_momen'] = tp_dp_momen |
|
907 |
|
|
851 | 908 |
except Exception as ex: |
852 | 909 |
from App import App |
853 | 910 |
from AppDocData import MessageType |
... | ... | |
858 | 915 |
|
859 | 916 |
def tp_dp_input(self): |
860 | 917 |
try: |
861 |
pass |
|
918 |
tp_dp_fric = self.calculated_variable['tp_dp_fric'] |
|
919 |
tp_dp_stat = self.calculated_variable['tp_dp_stat'] |
|
920 |
tp_dp_momen = self.calculated_variable['tp_dp_momen'] |
|
921 |
|
|
922 |
# 현재 kg/cm2/m |
|
923 |
pressure_unit = self.units['Pressure'] |
|
924 |
if pressure_unit == 'kg/cm2': |
|
925 |
tp_dp_fric = tp_dp_fric |
|
926 |
tp_dp_stat = tp_dp_stat |
|
927 |
tp_dp_momen = tp_dp_momen |
|
928 |
elif pressure_unit == 'psi': |
|
929 |
tp_dp_fric = tp_dp_fric / 1.033 * 14.7 |
|
930 |
tp_dp_stat = tp_dp_stat / 1.033 * 14.7 |
|
931 |
tp_dp_momen = tp_dp_momen / 1.033 * 14.7 |
|
932 |
elif pressure_unit == 'atm': |
|
933 |
tp_dp_fric = tp_dp_fric / 1.033 |
|
934 |
tp_dp_stat = tp_dp_stat / 1.033 |
|
935 |
tp_dp_momen = tp_dp_momen / 1.033 |
|
936 |
elif pressure_unit == 'bar': |
|
937 |
tp_dp_fric = tp_dp_fric / 1.033 * 1.033 |
|
938 |
tp_dp_stat = tp_dp_stat / 1.033 * 1.033 |
|
939 |
tp_dp_momen = tp_dp_momen / 1.033 * 1.033 |
|
940 |
elif pressure_unit == 'mmHg': |
|
941 |
tp_dp_fric = tp_dp_fric / 1.033 * 760 |
|
942 |
tp_dp_stat = tp_dp_stat / 1.033 * 760 |
|
943 |
tp_dp_momen = tp_dp_momen / 1.033 * 760 |
|
944 |
elif pressure_unit == 'kPa': |
|
945 |
tp_dp_fric = tp_dp_fric / 1.033 * 101.325 |
|
946 |
tp_dp_stat = tp_dp_stat / 1.033 * 101.325 |
|
947 |
tp_dp_momen = tp_dp_momen / 1.033 * 101.325 |
|
948 |
elif pressure_unit == 'MPa': |
|
949 |
tp_dp_fric = tp_dp_fric / 1.033 * 0.101325 |
|
950 |
tp_dp_stat = tp_dp_stat / 1.033 * 0.101325 |
|
951 |
tp_dp_momen = tp_dp_momen / 1.033 * 0.101325 |
|
952 |
|
|
953 |
length_unit = self.units['Length'] |
|
954 |
if length_unit == 'm': |
|
955 |
tp_dp_fric = tp_dp_fric |
|
956 |
tp_dp_stat = tp_dp_stat |
|
957 |
tp_dp_momen = tp_dp_momen |
|
958 |
elif length_unit == 'in': |
|
959 |
tp_dp_fric = tp_dp_fric / 39.3701 |
|
960 |
tp_dp_stat = tp_dp_stat / 39.3701 |
|
961 |
tp_dp_momen = tp_dp_momen / 39.3701 |
|
962 |
elif length_unit == 'ft': |
|
963 |
tp_dp_fric = tp_dp_fric / 3.28084 |
|
964 |
tp_dp_stat = tp_dp_stat / 3.28084 |
|
965 |
tp_dp_momen = tp_dp_momen / 3.28084 |
|
966 |
elif length_unit == 'yd': |
|
967 |
tp_dp_fric = tp_dp_fric / 1.09361 |
|
968 |
tp_dp_stat = tp_dp_stat / 1.09361 |
|
969 |
tp_dp_momen = tp_dp_momen / 1.09361 |
|
970 |
elif length_unit == 'mile': |
|
971 |
tp_dp_fric = tp_dp_fric / 0.000621371 |
|
972 |
tp_dp_stat = tp_dp_stat / 0.000621371 |
|
973 |
tp_dp_momen = tp_dp_momen / 0.000621371 |
|
974 |
elif length_unit == 'mm': |
|
975 |
tp_dp_fric = tp_dp_fric / 1000 |
|
976 |
tp_dp_stat = tp_dp_stat / 1000 |
|
977 |
tp_dp_momen = tp_dp_momen / 1000 |
|
978 |
|
|
979 |
f = tp_dp_fric |
|
980 |
g = tp_dp_stat |
|
981 |
m = tp_dp_momen |
|
982 |
|
|
983 |
self.dp_fric[self.no] = f |
|
984 |
self.dp_stat[self.no] = g |
|
985 |
self.dp_momen[self.no] = m |
|
986 |
|
|
987 |
self.calculated_variable['tp_dp_fric'] = tp_dp_fric |
|
988 |
self.calculated_variable['tp_dp_stat'] = tp_dp_stat |
|
989 |
self.calculated_variable['tp_dp_momen'] = tp_dp_momen |
|
862 | 990 |
|
863 | 991 |
# ToDo |
864 | 992 |
# 2_DB 시트에 값 입력 |
... | ... | |
878 | 1006 |
if is_not_blank(self.process['v_density']): |
879 | 1007 |
density_unit = self.units['Density'] |
880 | 1008 |
if density_unit == 'kg/m3': |
881 |
v_density = float(self.process['v_density']) * tp_pressure_ratio |
|
1009 |
v_density = self.calculated_variable['v_density'] * tp_pressure_ratio # float(self.process['v_density']) * tp_pressure_ratio
|
|
882 | 1010 |
elif density_unit == 'lb/ft3': |
883 |
v_density = float(self.process['v_density']) * 16.0185 * tp_pressure_ratio |
|
1011 |
v_density = self.calculated_variable['v_density'] * 16.0185 * tp_pressure_ratio # float(self.process['v_density']) * 16.0185 * tp_pressure_ratio
|
|
884 | 1012 |
else: |
885 | 1013 |
temperature_unit = self.units['Temperature'] |
886 | 1014 |
if temperature_unit == '℃': |
... | ... | |
906 | 1034 |
sys.exc_info()[-1].tb_lineno) |
907 | 1035 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
908 | 1036 |
|
909 |
def regime_input(self): |
|
1037 |
def regime_input(self, xx, yy, regime):
|
|
910 | 1038 |
try: |
911 |
pass
|
|
912 |
# ToDo
|
|
913 |
# 2_DB 시트에 값 입력
|
|
1039 |
self.x[self.no] = xx
|
|
1040 |
self.y[self.no] = yy
|
|
1041 |
self.regime[self.no] = regime
|
|
914 | 1042 |
except Exception as ex: |
915 | 1043 |
from App import App |
916 | 1044 |
from AppDocData import MessageType |
... | ... | |
969 | 1097 |
|
970 | 1098 |
xx = hoX |
971 | 1099 |
|
972 |
self.regime_input() |
|
1100 |
self.regime_input(xx, YY, regime)
|
|
973 | 1101 |
|
974 | 1102 |
except Exception as ex: |
975 | 1103 |
from App import App |
... | ... | |
998 | 1126 |
XX = l_vel |
999 | 1127 |
YY = v_vel |
1000 | 1128 |
|
1001 |
self.regime_input() |
|
1129 |
self.regime_input(XX, YY, regime)
|
|
1002 | 1130 |
except Exception as ex: |
1003 | 1131 |
from App import App |
1004 | 1132 |
from AppDocData import MessageType |
... | ... | |
1023 | 1151 |
# bubble |
1024 | 1152 |
if YY < 3.2 and xx > xbub: |
1025 | 1153 |
regime = 'Bubble' |
1026 |
self.regime_input() |
|
1154 |
self.regime_input(xx, YY, regime)
|
|
1027 | 1155 |
return |
1028 | 1156 |
|
1029 | 1157 |
if 10 > YY > 3.2 and xx > ybub: |
1030 | 1158 |
regime = 'Bubble' |
1031 |
self.regime_input() |
|
1159 |
self.regime_input(xx, YY, regime)
|
|
1032 | 1160 |
return |
1033 | 1161 |
|
1034 | 1162 |
if 10 < YY < 100 and xx > 5200: |
1035 | 1163 |
regime = 'Bubble' |
1036 |
self.regime_input() |
|
1164 |
self.regime_input(xx, YY, regime)
|
|
1037 | 1165 |
return |
1038 | 1166 |
|
1039 | 1167 |
# churn |
... | ... | |
1045 | 1173 |
|
1046 | 1174 |
if YY > 100 and xx < 10 and xx < churn5: |
1047 | 1175 |
regime = 'Churn' |
1048 |
self.regime_input() |
|
1176 |
self.regime_input(xx, YY, regime)
|
|
1049 | 1177 |
return |
1050 | 1178 |
|
1051 | 1179 |
if YY < 1 and xx < churn1: |
1052 | 1180 |
regime = 'Churn' |
1053 |
self.regime_input() |
|
1181 |
self.regime_input(xx, YY, regime)
|
|
1054 | 1182 |
return |
1055 | 1183 |
|
1056 | 1184 |
if YY < 10 and xx < churn2: |
1057 | 1185 |
regime = 'Churn' |
1058 |
self.regime_input() |
|
1186 |
self.regime_input(xx, YY, regime)
|
|
1059 | 1187 |
return |
1060 | 1188 |
|
1061 | 1189 |
if YY < 32 and xx < churn3: |
1062 | 1190 |
regime = 'Churn' |
1063 |
self.regime_input() |
|
1191 |
self.regime_input(xx, YY, regime)
|
|
1064 | 1192 |
return |
1065 | 1193 |
|
1066 | 1194 |
if YY < 57 and xx < churn4: |
1067 | 1195 |
regime = 'Churn' |
1068 |
self.regime_input() |
|
1196 |
self.regime_input(xx, YY, regime)
|
|
1069 | 1197 |
return |
1070 | 1198 |
|
1071 | 1199 |
if YY < 100 and xx < 5200 and xx < churn4: |
1072 | 1200 |
regime = 'Churn' |
1073 |
self.regime_input() |
|
1201 |
self.regime_input(xx, YY, regime)
|
|
1074 | 1202 |
return |
1075 | 1203 |
|
1076 | 1204 |
# Wispy Annular |
... | ... | |
1079 | 1207 |
|
1080 | 1208 |
if 100 < YY < 1000 and xx > 1150: |
1081 | 1209 |
regime = 'Wispy Annular' |
1082 |
self.regime_input() |
|
1210 |
self.regime_input(xx, YY, regime)
|
|
1083 | 1211 |
return |
1084 | 1212 |
|
1085 | 1213 |
if 10000 < YY < 3200 and xx > wisa1: |
1086 | 1214 |
regime = 'Wispy Annular' |
1087 |
self.regime_input() |
|
1215 |
self.regime_input(xx, YY, regime)
|
|
1088 | 1216 |
return |
1089 | 1217 |
|
1090 | 1218 |
if YY > 3200 and xx > wisa2: |
1091 | 1219 |
regime = 'Wispy Annular' |
1092 |
self.regime_input() |
|
1220 |
self.regime_input(xx, YY, regime)
|
|
1093 | 1221 |
return |
1094 | 1222 |
|
1095 | 1223 |
# Annular |
... | ... | |
1099 | 1227 |
|
1100 | 1228 |
if 100 < YY < 1000 and 10 < xx < 1150: |
1101 | 1229 |
regime = 'Annular' |
1102 |
self.regime_input() |
|
1230 |
self.regime_input(xx, YY, regime)
|
|
1103 | 1231 |
return |
1104 | 1232 |
|
1105 | 1233 |
if 1000 < YY < 3200 and xx < ann1: |
1106 | 1234 |
regime = 'Annular' |
1107 |
self.regime_input() |
|
1235 |
self.regime_input(xx, YY, regime)
|
|
1108 | 1236 |
return |
1109 | 1237 |
|
1110 | 1238 |
if YY > 3200 and xx < ann2: |
1111 | 1239 |
regime = 'Annular' |
1112 |
self.regime_input() |
|
1240 |
self.regime_input(xx, YY, regime)
|
|
1113 | 1241 |
return |
1114 | 1242 |
|
1115 | 1243 |
if 10 > xx > ann3 and YY > 100: |
1116 | 1244 |
regime = 'Annular' |
1117 |
self.regime_input() |
|
1245 |
self.regime_input(xx, YY, regime)
|
|
1118 | 1246 |
return |
1119 | 1247 |
|
1120 | 1248 |
# Bubbly Plug |
... | ... | |
1130 | 1258 |
regime = 'Bubbly Plug' |
1131 | 1259 |
elif xx < 1000: |
1132 | 1260 |
regime = 'Plug' |
1133 |
self.regime_input() |
|
1261 |
self.regime_input(xx, YY, regime)
|
|
1134 | 1262 |
return |
1135 | 1263 |
|
1136 | 1264 |
if YY < 3.2 and bslug1 < xx < bslug5: |
... | ... | |
1138 | 1266 |
regime = 'Bubbly Plug' |
1139 | 1267 |
elif xx < 1000: |
1140 | 1268 |
regime = 'Plug' |
1141 |
self.regime_input() |
|
1269 |
self.regime_input(xx, YY, regime)
|
|
1142 | 1270 |
return |
1143 | 1271 |
|
1144 | 1272 |
if YY < 10 and bslug2 < xx < bslug6: |
... | ... | |
1146 | 1274 |
regime = 'Bubbly Plug' |
1147 | 1275 |
elif xx < 1000: |
1148 | 1276 |
regime = 'Plug' |
1149 |
self.regime_input() |
|
1277 |
self.regime_input(xx, YY, regime)
|
|
1150 | 1278 |
return |
1151 | 1279 |
|
1152 | 1280 |
if YY < 32 and bslug3 < xx < 5200: |
... | ... | |
1154 | 1282 |
regime = 'Bubbly Plug' |
1155 | 1283 |
elif xx < 1000: |
1156 | 1284 |
regime = 'Plug' |
1157 |
self.regime_input() |
|
1285 |
self.regime_input(xx, YY, regime)
|
|
1158 | 1286 |
return |
1159 | 1287 |
|
1160 | 1288 |
if YY < 57 and bslug4 < xx < 5200: |
... | ... | |
1162 | 1290 |
regime = 'Bubbly Plug' |
1163 | 1291 |
elif xx < 1000: |
1164 | 1292 |
regime = 'Plug' |
1165 |
self.regime_input() |
|
1293 |
self.regime_input(xx, YY, regime)
|
|
1166 | 1294 |
return |
1167 | 1295 |
|
1168 | 1296 |
except Exception as ex: |
... | ... | |
1173 | 1301 |
sys.exc_info()[-1].tb_lineno) |
1174 | 1302 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
1175 | 1303 |
|
1176 |
def tp_regime(self): |
|
1304 |
def tp_regime(self, row):
|
|
1177 | 1305 |
try: |
1178 |
tp_angle = self.calculated_variable['tp_angle'] |
|
1306 |
tp_angle = self.geometry.item(row, 6).text() |
|
1307 |
if is_not_blank(tp_angle): |
|
1308 |
tp_angle = float(tp_angle) |
|
1309 |
else: |
|
1310 |
tp_angle = 0 |
|
1311 |
|
|
1312 |
self.calculated_variable['tp_angle'] = tp_angle |
|
1179 | 1313 |
|
1180 | 1314 |
if tp_angle == 0: |
1181 | 1315 |
self.tp_ho_regime() |
... | ... | |
1205 | 1339 |
|
1206 | 1340 |
tp_pressure_ratio = (tp_pressure - tp_length * tp_pipe_total_drop) / tp_pressure |
1207 | 1341 |
tp_pressure = tp_pressure - tp_length * tp_pipe_total_drop |
1342 |
|
|
1343 |
# 현재 length = m |
|
1344 |
length_unit = self.units['Length'] |
|
1345 |
if length_unit == 'm': |
|
1346 |
t = tp_length |
|
1347 |
elif length_unit == 'in': |
|
1348 |
t = tp_length * 39.3701 |
|
1349 |
elif length_unit == 'ft': |
|
1350 |
t = tp_length * 3.28084 |
|
1351 |
elif length_unit == 'yd': |
|
1352 |
t = tp_length * 1.09361 |
|
1353 |
elif length_unit == 'mile': |
|
1354 |
t = tp_length * 0.000621371 |
|
1355 |
elif length_unit == 'mm': |
|
1356 |
t = tp_length * 1000 |
|
1357 |
|
|
1358 |
# 현재 kg/cm2/m |
|
1359 |
pressure_unit = self.units['Pressure'] |
|
1360 |
if pressure_unit == 'kg/cm2': |
|
1361 |
t = t * tp_pipe_total_drop |
|
1362 |
elif pressure_unit == 'psi': |
|
1363 |
t = t * tp_pipe_total_drop / 1.033 * 14.7 |
|
1364 |
elif pressure_unit == 'atm': |
|
1365 |
t = t * tp_pipe_total_drop / 1.033 |
|
1366 |
elif pressure_unit == 'bar': |
|
1367 |
t = t * tp_pipe_total_drop / 1.033 * 1.033 |
|
1368 |
elif pressure_unit == 'mmHg': |
|
1369 |
t = t * tp_pipe_total_drop / 1.033 * 760 |
|
1370 |
elif pressure_unit == 'kPa': |
|
1371 |
t = t * tp_pipe_total_drop / 1.033 * 101.325 |
|
1372 |
elif pressure_unit == 'MPa': |
|
1373 |
t = t * tp_pipe_total_drop / 1.033 * 0.101325 |
|
1374 |
|
|
1375 |
if length_unit == 'm': |
|
1376 |
t = t |
|
1377 |
elif length_unit == 'in': |
|
1378 |
t = t / 39.3701 |
|
1379 |
elif length_unit == 'ft': |
|
1380 |
t = t / 3.28084 |
|
1381 |
elif length_unit == 'yd': |
|
1382 |
t = t / 1.09361 |
|
1383 |
elif length_unit == 'mile': |
|
1384 |
t = t / 0.000621371 |
|
1385 |
elif length_unit == 'mm': |
|
1386 |
t = t / 1000 |
|
1208 | 1387 |
else: |
1209 | 1388 |
tp_pressure = self.calculated_variable['tp_pressure'] |
1210 | 1389 |
tp_element_dp = self.calculated_variable['tp_element_dp'] |
... | ... | |
1212 | 1391 |
tp_pressure_ratio = (tp_pressure - tp_element_dp) / tp_pressure |
1213 | 1392 |
tp_pressure = tp_pressure - tp_element_dp |
1214 | 1393 |
|
1394 |
# 현재 kg/cm2/m |
|
1395 |
pressure_unit = self.units['Pressure'] |
|
1396 |
if pressure_unit == 'kg/cm2': |
|
1397 |
t = tp_element_dp |
|
1398 |
elif pressure_unit == 'psi': |
|
1399 |
t = tp_element_dp / 1.033 * 14.7 |
|
1400 |
elif pressure_unit == 'atm': |
|
1401 |
t = tp_element_dp / 1.033 |
|
1402 |
elif pressure_unit == 'bar': |
|
1403 |
t = tp_element_dp / 1.033 * 1.033 |
|
1404 |
elif pressure_unit == 'mmHg': |
|
1405 |
t = tp_element_dp / 1.033 * 760 |
|
1406 |
elif pressure_unit == 'kPa': |
|
1407 |
t = tp_element_dp / 1.033 * 101.325 |
|
1408 |
elif pressure_unit == 'MPa': |
|
1409 |
t = tp_element_dp / 1.033 * 0.101325 |
|
1410 |
|
|
1411 |
self.total_length[self.no] = t |
|
1412 |
|
|
1215 | 1413 |
self.calculated_variable['tp_pressure'] = tp_pressure |
1216 | 1414 |
self.calculated_variable['tp_pressure_ratio'] = tp_pressure_ratio |
1217 | 1415 |
|
1218 | 1416 |
self.tp_v_density_cal() |
1219 |
self.void_frac() |
|
1220 |
self.tp_property_input() |
|
1417 |
self.void_frac(row)
|
|
1418 |
self.tp_property_input(row)
|
|
1221 | 1419 |
if element == 'Pipe': |
1222 |
self.tp_regime() |
|
1420 |
self.tp_regime(row)
|
|
1223 | 1421 |
|
1224 | 1422 |
except Exception as ex: |
1225 | 1423 |
from App import App |
... | ... | |
1251 | 1449 |
# '5% 분기점 |
1252 | 1450 |
tp_pressure = self.calculated_variable['tp_pressure'] |
1253 | 1451 |
calc_factor = 0.95 |
1452 |
|
|
1254 | 1453 |
tp_pressure_est = tp_pressure * calc_factor |
1255 | 1454 |
tp_pipe_total_drop = self.calculated_variable['tp_pipe_total_drop'] |
1256 | 1455 |
|
1257 | 1456 |
if (tp_pressure - tp_pressure_est) > (tp_length * tp_pipe_total_drop): |
1258 | 1457 |
self.tp_calc_end(row) |
1259 | 1458 |
elif (tp_pressure - tp_pressure_est) < (tp_length * tp_pipe_total_drop): |
1260 |
pass |
|
1261 |
|
|
1262 |
|
|
1459 |
# 이 안에다 for 문들 다시 만들어야 함 모자란 길이 반복 계산 |
|
1460 |
tp_remain_length = tp_length - (tp_pressure - tp_pressure_est) / tp_pipe_total_drop |
|
1461 |
tp_length = (tp_pressure - tp_pressure_est) / tp_pipe_total_drop |
|
1462 |
self.calculated_variable['tp_length'] = tp_length |
|
1463 |
tp_total_length = tp_remain_length + tp_length |
|
1263 | 1464 |
|
1465 |
# 무조건 처음에 한번은 해야할것 (tp_calc_end와 동일) |
|
1466 |
self.tp_calc_end(row) |
|
1264 | 1467 |
|
1468 |
self.no += 1 |
|
1469 |
|
|
1470 |
tp_trial_length = 0 |
|
1471 |
for tp_trial in range(1, 100): |
|
1472 |
tp_trial_length += tp_length |
|
1473 |
self.tp_fric(row) |
|
1474 |
self.tp_stat(row) |
|
1475 |
self.momen() |
|
1476 |
|
|
1477 |
tp_pressure = self.calculated_variable['tp_pressure'] |
|
1478 |
tp_pipe_total_drop = self.calculated_variable['tp_pipe_total_drop'] |
|
1479 |
tp_pressure_est = tp_pressure * calc_factor |
|
1480 |
tp_remain_length = tp_total_length - tp_trial_length - (tp_pressure - tp_pressure_est) / tp_pipe_total_drop |
|
1481 |
|
|
1482 |
# tp_length 재정의 |
|
1483 |
if tp_remain_length < 0: |
|
1484 |
# 계산이 끝나는 시점 |
|
1485 |
tp_length = tp_total_length - tp_trial_length |
|
1486 |
self.calculated_variable['tp_length'] = tp_length |
|
1487 |
self.tp_dp_input() |
|
1488 |
self.tp_calc_end(row) |
|
1489 |
break |
|
1490 |
elif tp_remain_length > 0: |
|
1491 |
tp_length = (tp_pressure - tp_pressure_est) / tp_pipe_total_drop |
|
1492 |
self.calculated_variable['tp_length'] = tp_length |
|
1493 |
self.tp_dp_input() |
|
1494 |
self.tp_calc_end(row) |
|
1495 |
self.no += 1 |
|
1265 | 1496 |
except Exception as ex: |
1266 | 1497 |
from App import App |
1267 | 1498 |
from AppDocData import MessageType |
... | ... | |
1313 | 1544 |
|
1314 | 1545 |
self.calculated_variable['tp_id'] = tp_id |
1315 | 1546 |
|
1316 |
tp_angle = self.geometry(row, 6).text()
|
|
1547 |
tp_angle = float(self.geometry.item(row, 6).text())
|
|
1317 | 1548 |
tp_rea_rough = tp_rough / tp_id |
1318 | 1549 |
|
1319 | 1550 |
tp_angle = 3.141593 * tp_angle / 180 |
... | ... | |
1353 | 1584 |
l_density = self.calculated_variable['l_density'] |
1354 | 1585 |
v_density = self.calculated_variable['v_density'] |
1355 | 1586 |
tp_quality = self.calculated_variable['tp_quality'] |
1587 |
tp_massflux = self.calculated_variable['tp_massflux'] |
|
1356 | 1588 |
|
1357 | 1589 |
pilo = 1 + (l_density / v_density - 1) * (bpara * tp_quality * (1 - tp_quality) + tp_quality ** 2) |
1358 | 1590 |
|
1359 | 1591 |
tp_bend_dp = kval * (tp_massflux ** 2 / 2 / l_density) * pilo / 101325 * 1.033 |
1360 | 1592 |
|
1361 | 1593 |
kval = round(kval, 2) |
1594 |
self.calculated_variable['kval'] = kval |
|
1362 | 1595 |
|
1363 | 1596 |
tp_element_dp = tp_bend_dp |
1364 | 1597 |
self.calculated_variable['tp_element_dp'] = tp_element_dp |
... | ... | |
1385 | 1618 |
elif element == 'Nozzle Out': |
1386 | 1619 |
kval = 0.5 |
1387 | 1620 |
|
1621 |
self.calculated_variable['kval'] = kval |
|
1388 | 1622 |
l_density = self.calculated_variable['l_density'] |
1389 | 1623 |
v_density = self.calculated_variable['v_density'] |
1390 | 1624 |
tp_quality = self.calculated_variable['tp_quality'] |
... | ... | |
1417 | 1651 |
def tp_expander_cal(self, row): |
1418 | 1652 |
try: |
1419 | 1653 |
rod = float(self.geometry.item(row, 8).text()) |
1420 |
rod = 1 / rod # '이부분, d1/d2 정책으로 인하여 변경되었음 |
|
1654 |
rod = 1 / rod # '이부분, d1/d2 정책으로 인하여 변경되었음
|
|
1421 | 1655 |
|
1422 | 1656 |
kval = self.geometry.item(row, 9).text() |
1423 | 1657 |
if is_not_blank(kval): |
1424 | 1658 |
kval = float(kval) |
1425 | 1659 |
else: |
1426 |
angle = float(self.geometry.item(row, 5).text())
|
|
1660 |
angle = float(self.geometry.item(row, 6).text())
|
|
1427 | 1661 |
if angle <= 22.5: |
1428 | 1662 |
kval = 2.6 * (1 - rod ** 2) ** 2 / rod ** 4 * math.sin(3.141593 / 180) |
1429 | 1663 |
else: |
1430 | 1664 |
kval = (1 - rod ** 2) ** 2 / rod ** 4 |
1431 | 1665 |
|
1666 |
self.calculated_variable['kval'] = kval |
|
1667 |
|
|
1432 | 1668 |
sigma = rod ** 2 |
1433 | 1669 |
|
1434 | 1670 |
tp_quality = self.calculated_variable['tp_quality'] |
... | ... | |
1440 | 1676 |
flsq = (1 - tp_quality) ** 2 |
1441 | 1677 |
pilo = (tp_quality ** 2 / tp_void) * (l_density / v_density) + flsq / (1 - tp_void) |
1442 | 1678 |
|
1443 |
tp_expander_total_dp = ((kval - 1 + 1 / sigma ** 2) * tp_massflux ** 2 / 2 / l_density) * pilo / 10 ** 5 / 1.013 * 1.033 |
|
1679 |
tp_expander_total_dp = (( |
|
1680 |
kval - 1 + 1 / sigma ** 2) * tp_massflux ** 2 / 2 / l_density) * pilo / 10 ** 5 / 1.013 * 1.033 |
|
1444 | 1681 |
|
1445 | 1682 |
tp_element_dp = tp_expander_total_dp |
1446 | 1683 |
self.calculated_variable['tp_element_dp'] = tp_element_dp |
... | ... | |
1488 | 1725 |
if is_not_blank(self.geometry.item(row, 9).text()): |
1489 | 1726 |
kval = float(self.geometry.item(row, 9).text()) |
1490 | 1727 |
|
1728 |
self.calculated_variable['kval'] = kval |
|
1729 |
|
|
1491 | 1730 |
# fric 구하기 |
1492 | 1731 |
tp_massflux = self.calculated_variable['tp_massflux'] |
1493 | 1732 |
tp_quality = self.calculated_variable['tp_quality'] |
... | ... | |
1547 | 1786 |
tpfm = phisq * flsq |
1548 | 1787 |
|
1549 | 1788 |
# kg/cm2 |
1550 |
tp_reducer_total_dp = ((kval + 1 - sigma ** 2) * dmvel ** 2 / 2 / l_density) * tpfm / 10 ** 5 / 1.013 * 1.033 |
|
1789 |
tp_reducer_total_dp = (( |
|
1790 |
kval + 1 - sigma ** 2) * dmvel ** 2 / 2 / l_density) * tpfm / 10 ** 5 / 1.013 * 1.033 |
|
1551 | 1791 |
tp_element_dp = tp_reducer_total_dp |
1552 | 1792 |
self.calculated_variable['tp_element_dp'] = tp_element_dp |
1553 | 1793 |
|
... | ... | |
1586 | 1826 |
else: |
1587 | 1827 |
kval = 0.25 |
1588 | 1828 |
|
1829 |
self.calculated_variable['kval'] = kval |
|
1830 |
|
|
1589 | 1831 |
l_density = self.calculated_variable['l_density'] |
1590 | 1832 |
v_density = self.calculated_variable['v_density'] |
1591 | 1833 |
tp_quality = self.calculated_variable['tp_quality'] |
... | ... | |
1600 | 1842 |
|
1601 | 1843 |
# kg/cm2의 단위로 되어있음 |
1602 | 1844 |
tp_massflux = self.calculated_variable['tp_massflux'] |
1603 |
tp_valve_total_dp = (kval * tp_massflux ^ 2 / 2 / l_density) * pilo / 101325 * 1.033
|
|
1845 |
tp_valve_total_dp = (kval * tp_massflux ** 2 / 2 / l_density) * pilo / 101325 * 1.033
|
|
1604 | 1846 |
|
1605 | 1847 |
tp_element_dp = tp_valve_total_dp |
1606 | 1848 |
self.calculated_variable['tp_element_dp'] = tp_element_dp |
... | ... | |
1614 | 1856 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
1615 | 1857 |
sys.exc_info()[-1].tb_lineno) |
1616 | 1858 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
1859 |
|
|
1617 | 1860 |
def get_equivalent_length(self): |
1618 | 1861 |
equivalent_length = 0 |
1619 | 1862 |
|
1620 | 1863 |
for row in range(self.geometry.rowCount()): |
1621 |
length = float(self.geometry.item(row, 5).text()) |
|
1622 |
if length: |
|
1623 |
equivalent_length += float(length) |
|
1864 |
if is_not_blank(self.geometry.item(row, 5).text()): |
|
1865 |
length = float(self.geometry.item(row, 5).text()) |
|
1866 |
if length: |
|
1867 |
equivalent_length += length |
|
1624 | 1868 |
|
1625 | 1869 |
return equivalent_length |
1626 | 1870 |
|
... | ... | |
1631 | 1875 |
if drawing: |
1632 | 1876 |
values = {} |
1633 | 1877 |
values['Phase_Type'] = 'Mixed' |
1878 |
values['Vapor_Flowrate_Mass'] = self.process['v_flowrate'] |
|
1879 |
values['Vapor_Density'] = self.process['v_density'] |
|
1880 |
values['Vapor_Viscosity'] = self.process['v_viscosity'] |
|
1881 |
values['Vapor_Pressure'] = self.process['tp_pressure'] |
|
1882 |
values['Vapor_Temperature'] = self.process['v_temp'] |
|
1883 |
values['Vapor_Molecular_Weight'] = self.process['v_mw'] |
|
1884 |
values['Vapor_Compress_Factor'] = self.process['v_z'] |
|
1885 |
values['Liquid_Flowrate_Mass'] = self.process['l_flowrate'] |
|
1886 |
values['Liquid_Density'] = self.process['l_density'] |
|
1887 |
values['Liquid_Viscosity'] = self.process['l_viscosity'] |
|
1634 | 1888 |
values['Flowrate_Mass'] = float(self.process['v_flowrate']) + float(self.process['l_flowrate']) |
1635 | 1889 |
values['Viscosity'] = 'Mixed' |
1636 | 1890 |
values['Temperature'] = self.process['v_temp'] |
... | ... | |
1642 | 1896 |
values['Reynolds'] = 'Mixed' |
1643 | 1897 |
values['Friction_Factor'] = 'Mixed' |
1644 | 1898 |
values['Pressure_Drop'] = 'Mixed' |
1645 |
|
|
1646 | 1899 |
values['Nominal_Pipe_Size'] = self.geometry.item(0, 1).text() |
1647 | 1900 |
values['Schedule_No'] = self.geometry.item(0, 2).text() |
1648 | 1901 |
values['Inside_Pipe_Size'] = self.geometry.item(0, 3).text() |
1649 |
|
|
1650 | 1902 |
values['Straight_Length'] = 'Mixed' |
1651 | 1903 |
equivalent_length = self.get_equivalent_length() |
1652 | 1904 |
values['Equivalent_Length'] = equivalent_length |
1653 | 1905 |
values['Equivalent_Length_Cal'] = equivalent_length |
1654 | 1906 |
values['Roughness'] = self.geometry.item(0, 4).text() |
1655 | 1907 |
|
1656 |
# values['Pressure_Drop_Friction'] = round(fric_result, 3) |
|
1657 |
# values['Pressure_Drop_Static'] = round(stat_result, 3) |
|
1658 |
# values['Velocity'] = round(Val(HY_2_sht.Cells(3 + tp_roww, tp_y + 11)), 3) |
|
1659 |
# values['Density'] = HY_2_sht.Cells(2 + tp_roww, tp_y + 9) |
|
1908 |
# 이하는 계산 결과 값 |
|
1660 | 1909 |
|
1661 |
# 부피유량 계산 |
|
1910 |
stat_result = 0 |
|
1911 |
fric_result = 0 |
|
1912 |
|
|
1913 |
# gravity |
|
1914 |
for no in range(self.no): |
|
1915 |
if no in self.total_length: |
|
1916 |
dp_stat = self.dp_stat[no] if no in self.dp_stat else 0 |
|
1917 |
length = self.length[no] if no in self.length else 0 |
|
1918 |
stat_result = stat_result + dp_stat * length |
|
1919 |
|
|
1920 |
# stat_result = stat_result + self.dp_stat[no] * self.length[no] |
|
1921 |
|
|
1922 |
# friction |
|
1923 |
for no in range(self.no): |
|
1924 |
if no in self.total_length: |
|
1925 |
if no in self.length: |
|
1926 |
total_length = self.total_length[no] if no in self.total_length else 0 |
|
1927 |
dp_stat = self.dp_stat[no] if no in self.dp_stat else 0 |
|
1928 |
length = self.length[no] if no in self.length else 0 |
|
1929 |
fric_result = fric_result + total_length - dp_stat * length |
|
1662 | 1930 |
|
1931 |
#fric_result = fric_result + self.total_length[no] - self.dp_stat[no] * self.length[no] |
|
1932 |
else: |
|
1933 |
total_length = self.total_length[no] if no in self.total_length else 0 |
|
1934 |
fric_result = fric_result + total_length |
|
1935 |
|
|
1936 |
#fric_result = fric_result + self.total_length[no] |
|
1937 |
|
|
1938 |
values['Pressure_Drop_Friction'] = round(fric_result, 3) |
|
1939 |
values['Pressure_Drop_Static'] = round(stat_result, 3) |
|
1940 |
values['Velocity'] = self.homo_vel[1] |
|
1941 |
values['Density'] = self.mean_den[0] |
|
1942 |
|
|
1943 |
# 부피유량 계산 |
|
1663 | 1944 |
tp_flow = self.calculated_variable['tp_flow'] |
1664 | 1945 |
tp_mean_den = self.calculated_variable['tp_mean_den'] |
1665 | 1946 |
|
... | ... | |
1679 | 1960 |
|
1680 | 1961 |
values['Flowrate_Volume'] = tp_volume |
1681 | 1962 |
|
1682 |
drawing.hmbTable.updateByUID(self.components_uid, values)
|
|
1963 |
drawing.hmbTable.updateByUID(self.item.uid, values)
|
|
1683 | 1964 |
except Exception as ex: |
1684 | 1965 |
from App import App |
1685 | 1966 |
from AppDocData import MessageType |
... | ... | |
1690 | 1971 |
|
1691 | 1972 |
def tp_cal(self): |
1692 | 1973 |
try: |
1974 |
self.no = 0 |
|
1975 |
|
|
1693 | 1976 |
Ref_baro = self.get_barometric_pressure() |
1694 | 1977 |
calc_factor = 0.95 |
1695 | 1978 |
|
... | ... | |
1765 | 2048 |
|
1766 | 2049 |
self.calculated_variable['tp_pressure'] = tp_pressure |
1767 | 2050 |
|
1768 |
self.tp_property() |
|
2051 |
self.tp_property(0)
|
|
1769 | 2052 |
self.tp_property_input() |
1770 | 2053 |
|
2054 |
self.no += 1 |
|
2055 |
|
|
1771 | 2056 |
row_count = self.geometry.rowCount() |
1772 | 2057 |
for row in range(row_count): |
1773 | 2058 |
if self.tp_geo_check(row): |
... | ... | |
1777 | 2062 |
if element == 'Pipe': |
1778 | 2063 |
self.tp_pipe_cal(row) |
1779 | 2064 |
elif element == 'Bend': |
1780 |
self.tp_bend_cal() |
|
2065 |
self.tp_bend_cal(row)
|
|
1781 | 2066 |
elif element == 'Nozzle In': |
1782 | 2067 |
self.tp_nozzl_cal(row) |
1783 | 2068 |
elif element == 'Nozzle Out': |
... | ... | |
1797 | 2082 |
elif element == 'Expander': |
1798 | 2083 |
self.tp_expander_cal(row) |
1799 | 2084 |
|
2085 |
self.no += 1 |
|
2086 |
|
|
1800 | 2087 |
self.tp_result_input() |
1801 | 2088 |
except Exception as ex: |
1802 | 2089 |
from App import App |
... | ... | |
1806 | 2093 |
sys.exc_info()[-1].tb_lineno) |
1807 | 2094 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
1808 | 2095 |
|
1809 |
def tp_property_input(self): |
|
2096 |
def tp_property_input(self, row=None):
|
|
1810 | 2097 |
try: |
1811 |
pass |
|
2098 |
baro_P = self.get_barometric_pressure() |
|
2099 |
|
|
2100 |
# 처음 이면 |
|
2101 |
if row is not None: |
|
2102 |
element = 'Element.{}_{}'.format(str(row), self.geometry.item(row, 0).text()) |
|
2103 |
else: |
|
2104 |
element = 'Start Point' |
|
2105 |
|
|
2106 |
self.element[self.no] = element |
|
2107 |
|
|
2108 |
# pressure (현재 kga) |
|
2109 |
tp_pressure = self.calculated_variable['tp_pressure'] |
|
2110 |
pressure_unit = self.units['Pressure'] |
|
2111 |
if pressure_unit == 'kg/cm2': |
|
2112 |
p = tp_pressure - baro_P |
|
2113 |
elif pressure_unit == 'psi': |
|
2114 |
p = tp_pressure / 1.033 * 14.7 - baro_P |
|
2115 |
elif pressure_unit == 'atm': |
|
2116 |
p = tp_pressure / 1.033 |
|
2117 |
elif pressure_unit == 'bar': |
|
2118 |
p = tp_pressure / 1.033 * 1.033 - baro_P |
|
2119 |
elif pressure_unit == 'mmHg': |
|
2120 |
p = tp_pressure / 1.033 * 760 - baro_P |
|
2121 |
elif pressure_unit == 'kPa': |
|
2122 |
p = tp_pressure / 1.033 * 101.325 - baro_P |
|
2123 |
elif pressure_unit == 'MPa': |
|
2124 |
p = tp_pressure / 1.033 * 0.101325 - baro_P |
|
2125 |
|
|
2126 |
self.pressure[self.no] = p |
|
2127 |
|
|
2128 |
# density (현재 kg/m3) |
|
2129 |
density_unit = self.units['Density'] |
|
2130 |
if density_unit == 'kg/m3': |
|
2131 |
d = self.calculated_variable['tp_mean_den'] |
|
2132 |
vd = self.calculated_variable['v_density'] |
|
2133 |
else: |
|
2134 |
d = self.calculated_variable['tp_mean_den'] * 0.062428 |
|
2135 |
vd = self.calculated_variable['v_density'] * 0.062428 |
|
2136 |
|
|
2137 |
self.mean_den[self.no] = d |
|
2138 |
self.v_density[self.no] = vd |
|
2139 |
|
|
2140 |
# velocity (m/s) |
|
2141 |
velocity_unit = self.units['Velocity'] |
|
2142 |
if velocity_unit == 'm/s': |
|
2143 |
av = self.calculated_variable['tp_homo_vel'] |
|
2144 |
mv = self.calculated_variable['tp_max_vel'] |
|
2145 |
ev = self.calculated_variable['tp_ero_vel'] |
|
2146 |
elif velocity_unit == 'ft/s': |
|
2147 |
av = self.calculated_variable['tp_homo_vel'] * 3.28084 |
|
2148 |
mv = self.calculated_variable['tp_max_vel'] * 3.28084 |
|
2149 |
ev = self.calculated_variable['tp_ero_vel'] * 3.28084 |
|
2150 |
|
|
2151 |
self.homo_vel[self.no] = av |
|
2152 |
self.max_vel[self.no] = mv |
|
2153 |
self.ero_vel[self.no] = ev |
|
2154 |
|
|
2155 |
# dimensionless |
|
2156 |
v = self.calculated_variable['tp_void'] |
|
2157 |
q = self.calculated_variable['tp_quality'] |
|
2158 |
|
|
2159 |
self.void[self.no] = v |
|
2160 |
self.quality[self.no] = q |
|
2161 |
|
|
2162 |
if element != 'Start Point': |
|
2163 |
# dia (현재 m) |
|
2164 |
pipe_diameter_unit = self.units['Pipe_Diameter'] |
|
2165 |
if pipe_diameter_unit == 'in': |
|
2166 |
id = self.calculated_variable['tp_id'] / 0.0254 |
|
2167 |
elif pipe_diameter_unit == 'mm': |
|
2168 |
id = self.calculated_variable['tp_id'] * 1000 |
|
2169 |
|
|
2170 |
self.inside_diameter[self.no] = id |
|
2171 |
|
|
2172 |
if element.find('Pipe') == -1: |
|
2173 |
self.angle[self.no] = None |
|
2174 |
else: |
|
2175 |
# Element가 Pipe인 경우만 l가 있음 |
|
2176 |
length_unit = self.units['Length'] |
|
2177 |
if length_unit == 'm': |
|
2178 |
l = self.calculated_variable['tp_length'] |
|
2179 |
elif length_unit == 'in': |
|
2180 |
l = self.calculated_variable['tp_length'] * 39.3701 |
|
2181 |
elif length_unit == 'ft': |
|
2182 |
l = self.calculated_variable['tp_length'] * 3.28084 |
|
2183 |
elif length_unit == 'yd': |
|
2184 |
l = self.calculated_variable['tp_length'] * 1.09361 |
|
2185 |
elif length_unit == 'mile': |
|
2186 |
l = self.calculated_variable['tp_length'] * 0.000621371 |
|
2187 |
elif length_unit == 'mm': |
|
2188 |
l = self.calculated_variable['tp_length'] * 1000 |
|
2189 |
|
|
2190 |
self.length[self.no] = l |
|
2191 |
|
|
2192 |
if element.find('Valve') > -1: |
|
2193 |
self.angle[self.no] = None |
|
2194 |
else: |
|
2195 |
# Element가 Valve가 아닌경우에만 있음 |
|
2196 |
a = self.calculated_variable['tp_angle'] |
|
2197 |
self.angle[self.no] = a |
|
2198 |
|
|
2199 |
if element.find('Pipe') == -1: |
|
2200 |
# Element가 Pipe가 아닌경우에는 k가 있음 |
|
2201 |
k = self.calculated_variable['kval'] |
|
2202 |
self.k[self.no] = k |
|
1812 | 2203 |
|
1813 | 2204 |
# ToDo |
1814 | 2205 |
# 2_DB 시트에 값 입력 |
... | ... | |
1820 | 2211 |
sys.exc_info()[-1].tb_lineno) |
1821 | 2212 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
1822 | 2213 |
|
1823 |
def tp_property(self): |
|
2214 |
def tp_property(self, row):
|
|
1824 | 2215 |
try: |
1825 | 2216 |
# (0) density calculation |
1826 | 2217 |
|
1827 | 2218 |
# vapor |
1828 | 2219 |
self.tp_v_density_cal_initial() |
1829 |
self.void_frac() |
|
2220 |
self.void_frac(row)
|
|
1830 | 2221 |
|
1831 | 2222 |
except Exception as ex: |
1832 | 2223 |
from App import App |
... | ... | |
1836 | 2227 |
sys.exc_info()[-1].tb_lineno) |
1837 | 2228 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
1838 | 2229 |
|
1839 |
def void_frac(self): |
|
2230 |
def void_frac(self, row):
|
|
1840 | 2231 |
try: |
1841 |
tp_id = self.geometry.item(0, 3).text()
|
|
2232 |
tp_id = self.geometry.item(row, 3).text()
|
|
1842 | 2233 |
if is_not_blank(tp_id): |
1843 | 2234 |
# diameter를 m로 맞춘다 |
1844 | 2235 |
pipe_diameter_unit = self.units['Pipe_Diameter'] |
... | ... | |
1854 | 2245 |
|
1855 | 2246 |
self.calculated_variable['tp_massflux'] = tp_massflux |
1856 | 2247 |
|
1857 |
tp_angle = self.geometry.item(0, 6).text()
|
|
2248 |
tp_angle = self.geometry.item(row, 6).text()
|
|
1858 | 2249 |
if is_not_blank(tp_angle): |
1859 | 2250 |
tp_angle = float(tp_angle) |
1860 | 2251 |
else: |
... | ... | |
1917 | 2308 |
|
1918 | 2309 |
# homogeneous vel (m/s) |
1919 | 2310 |
tp_homo_vel = tp_massflux * tp_quality / v_density + tp_massflux * (1 - tp_quality) / l_density |
2311 |
self.calculated_variable['tp_homo_vel'] = tp_homo_vel |
|
1920 | 2312 |
|
1921 | 2313 |
# max velocity (m/s) |
1922 | 2314 |
tp_max_vel = 122 / (tp_homo_den ** 0.5) |
2315 |
self.calculated_variable['tp_max_vel'] = tp_max_vel |
|
1923 | 2316 |
|
1924 | 2317 |
# erosion velocity (m/s) |
1925 | 2318 |
tp_ero_vel = 195 / (tp_homo_den ** 0.5) |
2319 |
self.calculated_variable['tp_ero_vel'] = tp_ero_vel |
|
1926 | 2320 |
else: |
1927 | 2321 |
return |
1928 | 2322 |
except Exception as ex: |
내보내기 Unified diff