개정판 ae3e5e31
issue #1201 : 2 Phase 계산식
Change-Id: I48cf971732456b4ea1170d65e82a33436554ddb8
HYTOS/HYTOS/AppDocData.py | ||
---|---|---|
817 | 817 |
|
818 | 818 |
return ret |
819 | 819 |
|
820 |
def get_geometry_input(self, uid): |
|
821 |
res = [] |
|
822 |
try: |
|
823 |
# Creates or opens a file called mydb with a SQLite3 DB |
|
824 |
dbPath = os.path.join(self.activeDrawing.path) |
|
825 |
conn = sqlite3.connect(dbPath) |
|
826 |
conn.execute('PRAGMA foreign_keys = ON') |
|
827 |
conn.row_factory = sqlite3.Row |
|
828 |
# Get a cursor object |
|
829 |
cursor = conn.cursor() |
|
830 |
|
|
831 |
sql = """select Element |
|
832 |
, Nominal_Pipe_Size |
|
833 |
, Schedule_No |
|
834 |
, Inside_Pipe_Size |
|
835 |
, Roughness |
|
836 |
, Length |
|
837 |
, Angle |
|
838 |
, RPD |
|
839 |
, D1_D2 |
|
840 |
, K |
|
841 |
from Geometry_Input |
|
842 |
where Components_UID = ? |
|
843 |
order by rowid""" |
|
844 |
|
|
845 |
param = (uid,) |
|
846 |
cursor.execute(sql, param) |
|
847 |
rows = cursor.fetchall() |
|
848 |
for row in rows: |
|
849 |
res.append((row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9])) |
|
850 |
# Catch the exception |
|
851 |
except Exception as ex: |
|
852 |
from App import App |
|
853 |
|
|
854 |
# Roll back any change if something goes wrong |
|
855 |
conn.rollback() |
|
856 |
|
|
857 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
|
858 |
sys.exc_info()[-1].tb_lineno) |
|
859 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
|
860 |
|
|
861 |
finally: |
|
862 |
# Close the db connection |
|
863 |
conn.close() |
|
864 |
|
|
865 |
return res |
|
866 |
|
|
820 | 867 |
def get_fittings_input(self, uid): |
821 | 868 |
res = [] |
822 | 869 |
try: |
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: |
HYTOS/HYTOS/GeometryData_AngleDialog.py | ||
---|---|---|
27 | 27 |
self.ui.pushButton_45_Degree.clicked.connect(self.degree_event) |
28 | 28 |
self.ui.pushButton_90_Degree.clicked.connect(self.degree_event) |
29 | 29 |
self.ui.pushButton_180_Degree.clicked.connect(self.degree_event) |
30 |
self.ui.pushButton_Horizontal.clicked.connect(self.degree_event) |
|
31 |
self.ui.pushButton_Vertical_Up.clicked.connect(self.degree_event) |
|
32 |
self.ui.pushButton_Vertical_Down.clicked.connect(self.degree_event) |
|
30 | 33 |
|
31 |
def show_dialog(self): |
|
34 |
def show_dialog(self, element):
|
|
32 | 35 |
self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint) |
33 | 36 |
|
37 |
if element == 'Pipe': |
|
38 |
self.ui.groupBox_Elbow.setVisible(False) |
|
39 |
self.ui.groupBox_Pipe.setVisible(True) |
|
40 |
else: |
|
41 |
self.ui.groupBox_Elbow.setVisible(True) |
|
42 |
self.ui.groupBox_Pipe.setVisible(False) |
|
43 |
|
|
34 | 44 |
self.exec_() |
35 | 45 |
|
36 | 46 |
return self.angle |
... | ... | |
42 | 52 |
self.angle = 90 |
43 | 53 |
elif self.sender() == self.ui.pushButton_180_Degree: |
44 | 54 |
self.angle = 180 |
55 |
elif self.sender() == self.ui.pushButton_Horizontal: |
|
56 |
self.angle = 0 |
|
57 |
elif self.sender() == self.ui.pushButton_Vertical_Up: |
|
58 |
self.angle = 90 |
|
59 |
elif self.sender() == self.ui.pushButton_Vertical_Down: |
|
60 |
self.angle = -90 |
|
45 | 61 |
|
46 | 62 |
QDialog.accept(self) |
63 |
|
|
47 | 64 |
def accept(self): |
48 | 65 |
QDialog.accept(self) |
49 | 66 |
|
HYTOS/HYTOS/GeometryData_Angle_UI.py | ||
---|---|---|
13 | 13 |
class Ui_Dialog(object): |
14 | 14 |
def setupUi(self, Dialog): |
15 | 15 |
Dialog.setObjectName("Dialog") |
16 |
Dialog.resize(205, 139)
|
|
16 |
Dialog.resize(193, 168)
|
|
17 | 17 |
font = QtGui.QFont() |
18 | 18 |
font.setFamily("맑은 고딕") |
19 | 19 |
Dialog.setFont(font) |
20 | 20 |
icon = QtGui.QIcon() |
21 | 21 |
icon.addPixmap(QtGui.QPixmap(":/images/HYTOS.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
22 | 22 |
Dialog.setWindowIcon(icon) |
23 |
self.gridLayout = QtWidgets.QGridLayout(Dialog) |
|
24 |
self.gridLayout.setObjectName("gridLayout") |
|
25 |
self.groupBox = QtWidgets.QGroupBox(Dialog) |
|
26 |
self.groupBox.setObjectName("groupBox") |
|
27 |
self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox) |
|
23 |
self.groupBox_Elbow = QtWidgets.QGroupBox(Dialog) |
|
24 |
self.groupBox_Elbow.setGeometry(QtCore.QRect(16, 12, 161, 141)) |
|
25 |
self.groupBox_Elbow.setObjectName("groupBox_Elbow") |
|
26 |
self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox_Elbow) |
|
28 | 27 |
self.gridLayout_2.setObjectName("gridLayout_2") |
29 |
self.verticalLayout = QtWidgets.QVBoxLayout()
|
|
30 |
self.verticalLayout.setObjectName("verticalLayout")
|
|
31 |
self.pushButton_45_Degree = QtWidgets.QPushButton(self.groupBox) |
|
28 |
self.gridLayout = QtWidgets.QGridLayout()
|
|
29 |
self.gridLayout.setObjectName("gridLayout")
|
|
30 |
self.pushButton_45_Degree = QtWidgets.QPushButton(self.groupBox_Elbow)
|
|
32 | 31 |
icon1 = QtGui.QIcon() |
33 | 32 |
icon1.addPixmap(QtGui.QPixmap(":/images/2K_Fitting_45_Elbow.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
34 | 33 |
self.pushButton_45_Degree.setIcon(icon1) |
35 | 34 |
self.pushButton_45_Degree.setObjectName("pushButton_45_Degree") |
36 |
self.verticalLayout.addWidget(self.pushButton_45_Degree)
|
|
37 |
self.pushButton_90_Degree = QtWidgets.QPushButton(self.groupBox) |
|
35 |
self.gridLayout.addWidget(self.pushButton_45_Degree, 0, 0, 1, 1)
|
|
36 |
self.pushButton_90_Degree = QtWidgets.QPushButton(self.groupBox_Elbow)
|
|
38 | 37 |
icon2 = QtGui.QIcon() |
39 | 38 |
icon2.addPixmap(QtGui.QPixmap(":/images/2K_Fitting_90_Elbow.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
40 | 39 |
self.pushButton_90_Degree.setIcon(icon2) |
41 | 40 |
self.pushButton_90_Degree.setObjectName("pushButton_90_Degree") |
42 |
self.verticalLayout.addWidget(self.pushButton_90_Degree)
|
|
43 |
self.pushButton_180_Degree = QtWidgets.QPushButton(self.groupBox) |
|
41 |
self.gridLayout.addWidget(self.pushButton_90_Degree, 1, 0, 1, 1)
|
|
42 |
self.pushButton_180_Degree = QtWidgets.QPushButton(self.groupBox_Elbow)
|
|
44 | 43 |
icon3 = QtGui.QIcon() |
45 | 44 |
icon3.addPixmap(QtGui.QPixmap(":/images/2K_Fitting_180_Elbow.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) |
46 | 45 |
self.pushButton_180_Degree.setIcon(icon3) |
47 | 46 |
self.pushButton_180_Degree.setObjectName("pushButton_180_Degree") |
48 |
self.verticalLayout.addWidget(self.pushButton_180_Degree) |
|
49 |
self.gridLayout_2.addLayout(self.verticalLayout, 0, 0, 1, 1) |
|
50 |
self.gridLayout.addWidget(self.groupBox, 0, 0, 1, 1) |
|
47 |
self.gridLayout.addWidget(self.pushButton_180_Degree, 2, 0, 1, 1) |
|
48 |
self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1) |
|
49 |
self.groupBox_Pipe = QtWidgets.QGroupBox(Dialog) |
|
50 |
self.groupBox_Pipe.setGeometry(QtCore.QRect(16, 12, 161, 141)) |
|
51 |
self.groupBox_Pipe.setObjectName("groupBox_Pipe") |
|
52 |
self.gridLayout_4 = QtWidgets.QGridLayout(self.groupBox_Pipe) |
|
53 |
self.gridLayout_4.setObjectName("gridLayout_4") |
|
54 |
self.gridLayout_3 = QtWidgets.QGridLayout() |
|
55 |
self.gridLayout_3.setObjectName("gridLayout_3") |
|
56 |
self.pushButton_Horizontal = QtWidgets.QPushButton(self.groupBox_Pipe) |
|
57 |
self.pushButton_Horizontal.setMinimumSize(QtCore.QSize(0, 24)) |
|
58 |
self.pushButton_Horizontal.setMaximumSize(QtCore.QSize(16777215, 24)) |
|
59 |
self.pushButton_Horizontal.setObjectName("pushButton_Horizontal") |
|
60 |
self.gridLayout_3.addWidget(self.pushButton_Horizontal, 0, 0, 1, 1) |
|
61 |
self.pushButton_Vertical_Up = QtWidgets.QPushButton(self.groupBox_Pipe) |
|
62 |
self.pushButton_Vertical_Up.setMinimumSize(QtCore.QSize(0, 24)) |
|
63 |
self.pushButton_Vertical_Up.setMaximumSize(QtCore.QSize(16777215, 24)) |
|
64 |
self.pushButton_Vertical_Up.setObjectName("pushButton_Vertical_Up") |
|
65 |
self.gridLayout_3.addWidget(self.pushButton_Vertical_Up, 1, 0, 1, 1) |
|
66 |
self.pushButton_Vertical_Down = QtWidgets.QPushButton(self.groupBox_Pipe) |
|
67 |
self.pushButton_Vertical_Down.setMinimumSize(QtCore.QSize(0, 24)) |
|
68 |
self.pushButton_Vertical_Down.setMaximumSize(QtCore.QSize(16777215, 24)) |
|
69 |
self.pushButton_Vertical_Down.setObjectName("pushButton_Vertical_Down") |
|
70 |
self.gridLayout_3.addWidget(self.pushButton_Vertical_Down, 2, 0, 1, 1) |
|
71 |
self.gridLayout_4.addLayout(self.gridLayout_3, 0, 0, 1, 1) |
|
51 | 72 |
|
52 | 73 |
self.retranslateUi(Dialog) |
53 | 74 |
QtCore.QMetaObject.connectSlotsByName(Dialog) |
... | ... | |
55 | 76 |
def retranslateUi(self, Dialog): |
56 | 77 |
_translate = QtCore.QCoreApplication.translate |
57 | 78 |
Dialog.setWindowTitle(_translate("Dialog", "Select tha angle")) |
58 |
self.groupBox.setTitle(_translate("Dialog", "Select the Elbow Angle")) |
|
79 |
self.groupBox_Elbow.setTitle(_translate("Dialog", "Select the Elbow Angle"))
|
|
59 | 80 |
self.pushButton_45_Degree.setText(_translate("Dialog", "45 Degree")) |
60 | 81 |
self.pushButton_90_Degree.setText(_translate("Dialog", "90 Degree")) |
61 | 82 |
self.pushButton_180_Degree.setText(_translate("Dialog", "180 Degree")) |
83 |
self.groupBox_Pipe.setTitle(_translate("Dialog", "Select the Pipe Angle")) |
|
84 |
self.pushButton_Horizontal.setText(_translate("Dialog", "Horizontal")) |
|
85 |
self.pushButton_Vertical_Up.setText(_translate("Dialog", "Vertical Up")) |
|
86 |
self.pushButton_Vertical_Down.setText(_translate("Dialog", "Vertical Down")) |
|
62 | 87 |
import Resource_rc |
HYTOS/HYTOS/GeometryData_MixedDialog.py | ||
---|---|---|
267 | 267 |
def angle_clicked_event(self): |
268 | 268 |
from GeometryData_AngleDialog import QGeometryData_AngleDialog |
269 | 269 |
|
270 |
dialog = QGeometryData_AngleDialog() |
|
271 |
angle = dialog.show_dialog() |
|
270 |
element = self.ui.comboBox_Element.currentText() |
|
271 |
if is_blank(element): |
|
272 |
return |
|
272 | 273 |
|
273 |
self.ui.lineEdit_Angle.setText(str(angle)) |
|
274 |
dialog = QGeometryData_AngleDialog() |
|
275 |
angle = dialog.show_dialog(element) |
|
276 |
if angle is not None: |
|
277 |
self.ui.lineEdit_Angle.setText(str(angle)) |
|
274 | 278 |
|
275 | 279 |
def roughness_clicked_event(self): |
276 | 280 |
from RoughnessDialog import QRoughnessDialog |
HYTOS/HYTOS/HMBTable.py | ||
---|---|---|
55 | 55 |
self._pressure_drop_static = None |
56 | 56 |
self._pressure_pipe_end_point = None |
57 | 57 |
self._power = None |
58 |
self._vapor_flowrate_mass = None |
|
59 |
self._vapor_density = None |
|
60 |
self._vapor_viscosity = None |
|
61 |
self._vapor_pressure = None |
|
62 |
self._vapor_temperature = None |
|
63 |
self._vapor_molecular_weight = None |
|
64 |
self._vapor_compress_factor = None |
|
65 |
self._liquid_flowrate_mass = None |
|
66 |
self._liquid_density = None |
|
67 |
self._liquid_viscosity = None |
|
58 | 68 |
self.isDeleted = False |
59 | 69 |
|
60 | 70 |
''' |
... | ... | |
228 | 238 |
|
229 | 239 |
@property |
230 | 240 |
def equivalent_length_input(self): |
231 |
return float(self._equivalent_length_input) if isfloat(self._equivalent_length_input) else self._equivalent_length_input |
|
241 |
return float(self._equivalent_length_input) if isfloat( |
|
242 |
self._equivalent_length_input) else self._equivalent_length_input |
|
232 | 243 |
|
233 | 244 |
@equivalent_length_input.setter |
234 | 245 |
def equivalent_length_input(self, value): |
... | ... | |
252 | 263 |
|
253 | 264 |
@property |
254 | 265 |
def equivalent_length_cal(self): |
255 |
return float(self._equivalent_length_cal) if isfloat(self._equivalent_length_cal) else self._equivalent_length_cal |
|
266 |
return float(self._equivalent_length_cal) if isfloat( |
|
267 |
self._equivalent_length_cal) else self._equivalent_length_cal |
|
256 | 268 |
|
257 | 269 |
@equivalent_length_cal.setter |
258 | 270 |
def equivalent_length_cal(self, value): |
... | ... | |
276 | 288 |
|
277 | 289 |
@property |
278 | 290 |
def limitation_pressure_drop(self): |
279 |
return float(self._limitation_pressure_drop) if isfloat(self._limitation_pressure_drop) else self._limitation_pressure_drop |
|
291 |
return float(self._limitation_pressure_drop) if isfloat( |
|
292 |
self._limitation_pressure_drop) else self._limitation_pressure_drop |
|
280 | 293 |
|
281 | 294 |
@limitation_pressure_drop.setter |
282 | 295 |
def limitation_pressure_drop(self, value): |
... | ... | |
316 | 329 |
|
317 | 330 |
@property |
318 | 331 |
def pressure_drop_friction(self): |
319 |
return float(self._pressure_drop_friction) if isfloat(self._pressure_drop_friction) else self._pressure_drop_friction |
|
332 |
return float(self._pressure_drop_friction) if isfloat( |
|
333 |
self._pressure_drop_friction) else self._pressure_drop_friction |
|
320 | 334 |
|
321 | 335 |
@pressure_drop_friction.setter |
322 | 336 |
def pressure_drop_friction(self, value): |
... | ... | |
332 | 346 |
|
333 | 347 |
@property |
334 | 348 |
def pressure_pipe_end_point(self): |
335 |
return float(self._pressure_pipe_end_point) if isfloat(self._pressure_pipe_end_point) else self._pressure_pipe_end_point |
|
349 |
return float(self._pressure_pipe_end_point) if isfloat( |
|
350 |
self._pressure_pipe_end_point) else self._pressure_pipe_end_point |
|
336 | 351 |
|
337 | 352 |
@pressure_pipe_end_point.setter |
338 | 353 |
def pressure_pipe_end_point(self, value): |
... | ... | |
346 | 361 |
def power(self, value): |
347 | 362 |
self._power = value |
348 | 363 |
|
364 |
@property |
|
365 |
def vapor_flowrate_mass(self): |
|
366 |
return float(self._vapor_flowrate_mass) if isfloat(self._vapor_flowrate_mass) else self._vapor_flowrate_mass |
|
367 |
|
|
368 |
@vapor_flowrate_mass.setter |
|
369 |
def vapor_flowrate_mass(self, value): |
|
370 |
self._vapor_flowrate_mass = value |
|
371 |
|
|
372 |
@property |
|
373 |
def vapor_density(self): |
|
374 |
return float(self._vapor_density) if isfloat(self._vapor_density) else self._vapor_density |
|
375 |
|
|
376 |
@vapor_density.setter |
|
377 |
def vapor_density(self, value): |
|
378 |
self._vapor_density = value |
|
379 |
|
|
380 |
@property |
|
381 |
def vapor_viscosity(self): |
|
382 |
return float(self._vapor_viscosity) if isfloat(self._vapor_viscosity) else self._vapor_viscosity |
|
383 |
|
|
384 |
@vapor_viscosity.setter |
|
385 |
def vapor_viscosity(self, value): |
|
386 |
self._vapor_viscosity = value |
|
387 |
|
|
388 |
@property |
|
389 |
def vapor_pressure(self): |
|
390 |
return float(self._vapor_pressure) if isfloat(self._vapor_pressure) else self._vapor_pressure |
|
391 |
|
|
392 |
@vapor_pressure.setter |
|
393 |
def vapor_pressure(self, value): |
|
394 |
self._vapor_pressure = value |
|
395 |
|
|
396 |
@property |
|
397 |
def vapor_temperature(self): |
|
398 |
return float(self._vapor_temperature) if isfloat(self._vapor_temperature) else self._vapor_temperature |
|
399 |
|
|
400 |
@vapor_temperature.setter |
|
401 |
def vapor_temperature(self, value): |
|
402 |
self._vapor_temperature = value |
|
403 |
|
|
404 |
@property |
|
405 |
def vapor_molecular_weight(self): |
|
406 |
return float(self._vapor_molecular_weight) if isfloat( |
|
407 |
self._vapor_molecular_weight) else self._vapor_molecular_weight |
|
408 |
|
|
409 |
@vapor_molecular_weight.setter |
|
410 |
def vapor_molecular_weight(self, value): |
|
411 |
self._vapor_molecular_weight = value |
|
412 |
|
|
413 |
@property |
|
414 |
def vapor_compress_factor(self): |
|
415 |
return float(self._vapor_compress_factor) if isfloat( |
|
416 |
self._vapor_compress_factor) else self._vapor_compress_factor |
|
417 |
|
|
418 |
@vapor_compress_factor.setter |
|
419 |
def vapor_compress_factor(self, value): |
|
420 |
self._vapor_compress_factor = value |
|
421 |
|
|
422 |
@property |
|
423 |
def liquid_flowrate_mass(self): |
|
424 |
return float(self._liquid_flowrate_mass) if isfloat( |
|
425 |
self._liquid_flowrate_mass) else self._liquid_flowrate_mass |
|
426 |
|
|
427 |
@liquid_flowrate_mass.setter |
|
428 |
def liquid_flowrate_mass(self, value): |
|
429 |
self._liquid_flowrate_mass = value |
|
430 |
|
|
431 |
@property |
|
432 |
def liquid_density(self): |
|
433 |
return float(self._liquid_density) if isfloat( |
|
434 |
self._liquid_density) else self._liquid_density |
|
435 |
|
|
436 |
@liquid_density.setter |
|
437 |
def liquid_density(self, value): |
|
438 |
self._liquid_density = value |
|
439 |
|
|
440 |
@property |
|
441 |
def liquid_viscosity(self): |
|
442 |
return float(self._liquid_viscosity) if isfloat( |
|
443 |
self._liquid_viscosity) else self._liquid_viscosity |
|
444 |
|
|
445 |
@liquid_viscosity.setter |
|
446 |
def liquid_viscosity(self, value): |
|
447 |
self._liquid_viscosity = value |
|
448 |
|
|
349 | 449 |
def fromRow(row): |
350 | 450 |
hmb = HMBData() |
351 | 451 |
hmb._uid = row[0] |
... | ... | |
380 | 480 |
hmb._pressure_drop_static = row[29] |
381 | 481 |
hmb._pressure_pipe_end_point = row[30] |
382 | 482 |
hmb._power = row[31] |
483 |
hmb._vapor_flowrate_mass = row[32] |
|
484 |
hmb._vapor_density = row[33] |
|
485 |
hmb._vapor_viscosity = row[34] |
|
486 |
hmb._vapor_pressure = row[35] |
|
487 |
hmb._vapor_temperature = row[36] |
|
488 |
hmb._vapor_molecular_weight = row[37] |
|
489 |
hmb._vapor_compress_factor = row[38] |
|
490 |
hmb._liquid_flowrate_mass = row[39] |
|
491 |
hmb._liquid_density = row[40] |
|
492 |
hmb._liquid_viscosity = row[41] |
|
383 | 493 |
|
384 | 494 |
return hmb |
385 | 495 |
|
... | ... | |
489 | 599 |
hmb.pressure_pipe_end_point = values['Pressure_Pipe_End_Point'] |
490 | 600 |
if 'Power' in values: |
491 | 601 |
hmb.power = values['Power'] |
602 |
if 'Vapor_Flowrate_Mass' in values: |
|
603 |
hmb.vapor_flowrate_mass = values['Vapor_Flowrate_Mass'] |
|
604 |
if 'Vapor_Density' in values: |
|
605 |
hmb.vapor_density = values['Vapor_Density'] |
|
606 |
if 'Vapor_Viscosity' in values: |
|
607 |
hmb.vapor_viscosity = values['Vapor_Viscosity'] |
|
608 |
if 'Vapor_Pressure' in values: |
|
609 |
hmb.vapor_pressure = values['Vapor_Pressure'] |
|
610 |
if 'Vapor_Temperature' in values: |
|
611 |
hmb.vapor_temperature = values['Vapor_Temperature'] |
|
612 |
if 'Vapor_Molecular_Weight' in values: |
|
613 |
hmb.vapor_molecular_weight = values['Vapor_Molecular_Weight'] |
|
614 |
if 'Vapor_Compress_Factor' in values: |
|
615 |
hmb.vapor_compress_factor = values['Vapor_Compress_Factor'] |
|
616 |
if 'Liquid_Flowrate_Mass' in values: |
|
617 |
hmb.liquid_flowrate_mass = values['Liquid_Flowrate_Mass'] |
|
618 |
if 'Liquid_Density' in values: |
|
619 |
hmb.liquid_density = values['Liquid_Density'] |
|
620 |
if 'Liquid_Viscosity' in values: |
|
621 |
hmb.liquid_viscosity = values['Liquid_Viscosity'] |
|
492 | 622 |
|
493 | 623 |
break |
494 | 624 |
except Exception as ex: |
... | ... | |
549 | 679 |
, h.Pressure_Drop_Static |
550 | 680 |
, h.Pressure_Pipe_End_Point |
551 | 681 |
, h.Power |
682 |
, h.Vapor_Flowrate_Mass |
|
683 |
, h.Vapor_Density |
|
684 |
, h.Vapor_Viscosity |
|
685 |
, h.Vapor_Pressure |
|
686 |
, h.Vapor_Temperature |
|
687 |
, h.Vapor_Molecular_Weight |
|
688 |
, h.Vapor_Compress_Factor |
|
689 |
, h.Liquid_Flowrate_Mass |
|
690 |
, h.Liquid_Density |
|
691 |
, h.Liquid_Viscosity |
|
552 | 692 |
from HMB h |
553 | 693 |
left join Components c |
554 | 694 |
on h.Components_UID = c.UID |
... | ... | |
601 | 741 |
'Density', 'Viscosity', |
602 | 742 |
'Temperature', 'Molecular_Weight', 'Specific_Heat_Ratio', 'Compress_Factor', |
603 | 743 |
'Nominal_Pipe_Size', 'Inside_Pipe_Size', |
604 |
'Schedule_No', 'Straight_Length', 'Equivalent_Length', 'Equivalent_Length_Input', 'Fitting_Length', |
|
744 |
'Schedule_No', 'Straight_Length', 'Equivalent_Length', 'Equivalent_Length_Input', |
|
745 |
'Fitting_Length', |
|
605 | 746 |
'Fitting_K', 'Equivalent_Length_Cal', 'Roughness', 'Limitation_Velocity', |
606 | 747 |
'Limitation_Pressure_Drop', |
607 | 748 |
'Velocity', 'Reynolds', 'Friction_Factor', 'Pressure_Drop', 'Pressure_Drop_Friction', |
608 |
'Pressure_Drop_Static', 'Pressure_Pipe_End_Point', 'Power'] |
|
609 |
values = ['?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', |
|
610 |
'?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?'] |
|
749 |
'Pressure_Drop_Static', 'Pressure_Pipe_End_Point', 'Power', 'Vapor_Flowrate_Mass', |
|
750 |
'Vapor_Density', 'Vapor_Viscosity', 'Vapor_Pressure', 'Vapor_Temperature', |
|
751 |
'Vapor_Molecular_Weight', 'Vapor_Compress_Factor', 'Liquid_Flowrate_Mass', |
|
752 |
'Liquid_Density', 'Liquid_Viscosity'] |
|
753 |
values = ['?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', |
|
754 |
'?', |
|
755 |
'?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', |
|
756 |
'?', '?', '?', '?', '?', '?', '?'] |
|
611 | 757 |
param = ( |
612 | 758 |
str(data.uid), str(data.components_uid), data.stream_no, data.phase_type, |
613 | 759 |
data.flowrate_mass, |
614 | 760 |
data.flowrate_volume, data.density, |
615 | 761 |
data.viscosity, data.temperature, data.molecular_weight, data.specific_heat_ratio, |
616 | 762 |
data.compress_factor, data.nominal_pipe_size, |
617 |
data.inside_pipe_size, data.schedule_no, data.straight_length, data.equivalent_length, data.equivalent_length_input, |
|
763 |
data.inside_pipe_size, data.schedule_no, data.straight_length, data.equivalent_length, |
|
764 |
data.equivalent_length_input, |
|
618 | 765 |
data.fitting_length, data.fitting_K, data.equivalent_length_cal, data.roughness, |
619 | 766 |
data.limitation_velocity, |
620 | 767 |
data.limitation_pressure_drop, data.velocity, data.reynolds, data.friction_factor, |
621 | 768 |
data.pressure_drop, data.pressure_drop_friction, |
622 |
data.pressure_drop_static, data.pressure_pipe_end_point, data.power) |
|
769 |
data.pressure_drop_static, data.pressure_pipe_end_point, data.power, |
|
770 |
data.vapor_flowrate_mass, |
|
771 |
data.vapor_density, data.vapor_viscosity, data.vapor_pressure, data.vapor_temperature, |
|
772 |
data.vapor_molecular_weight, |
|
773 |
data.vapor_compress_factor, data.liquid_flowrate_mass, data.liquid_density, |
|
774 |
data.liquid_viscosity) |
|
623 | 775 |
|
624 | 776 |
sql = 'insert or replace into HMB({}) values({})'.format(','.join(cols), ','.join(values)) |
625 | 777 |
cursor.execute(sql, param) |
HYTOS/HYTOS/Shapes/EngineeringStreamlineItem.py | ||
---|---|---|
40 | 40 |
try: |
41 | 41 |
QGraphicsPathItem.__init__(self, parent) |
42 | 42 |
QEngineeringAbstractItem.__init__(self) |
43 |
self.setFlags(QGraphicsItem.ItemIsSelectable|QGraphicsItem.ItemIsFocusable)
|
|
43 |
self.setFlags(QGraphicsItem.ItemIsSelectable | QGraphicsItem.ItemIsFocusable)
|
|
44 | 44 |
self.setAcceptHoverEvents(True) |
45 | 45 |
self.setAcceptTouchEvents(True) |
46 | 46 |
|
... | ... | |
49 | 49 |
self._vertices = [] |
50 | 50 |
self.isCreated = False |
51 | 51 |
self._pt = None |
52 |
self.setPen(QPen(Qt.blue, 1, Qt.SolidLine)) # set default pen |
|
53 |
|
|
52 |
self.setPen(QPen(Qt.blue, 1, Qt.SolidLine)) # set default pen
|
|
53 |
|
|
54 | 54 |
self._stream_no = 0 |
55 | 55 |
self._stream_no_text = None |
56 | 56 |
|
57 | 57 |
self._fittings = None |
58 |
self._geometry = None |
|
58 | 59 |
|
59 | 60 |
self.transfer = Transfer() |
60 | 61 |
self.setZValue(QEngineeringStreamlineItem.ZVALUE) |
61 | 62 |
except Exception as ex: |
62 | 63 |
from App import App |
63 | 64 |
from AppDocData import MessageType |
64 |
|
|
65 |
|
|
65 | 66 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
66 | 67 |
sys.exc_info()[-1].tb_lineno) |
67 | 68 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
... | ... | |
80 | 81 |
""" set fittings with given value """ |
81 | 82 |
self._fittings = value |
82 | 83 |
|
84 |
@property |
|
85 |
def geometry(self): |
|
86 |
""" return fittings """ |
|
87 |
return self._geometry |
|
88 |
|
|
89 |
@geometry.setter |
|
90 |
def geometry(self, value): |
|
91 |
""" set fittings with given value """ |
|
92 |
self._geometry = value |
|
83 | 93 |
|
84 | 94 |
@property |
85 | 95 |
def stream_no(self): |
... | ... | |
94 | 104 |
self._stream_no = value |
95 | 105 |
self._stream_no_text = QEngineeringStreamNoTextItem(f"{self._stream_no}", self) |
96 | 106 |
self.build_path() |
97 |
|
|
107 |
|
|
98 | 108 |
@property |
99 | 109 |
def data(self): |
100 | 110 |
""" return hmb data""" |
내보내기 Unified diff