개정판 fcc06b09
issue #1049 : 옵션 창 및 기능 : Unit 변경 시 적용
Change-Id: Ief6345fe4d99bfdc0bf074fdf1a24fbfe002acc7
HYTOS/HYTOS/Calculation.py | ||
---|---|---|
14 | 14 |
self._decimal = decimal |
15 | 15 |
|
16 | 16 |
curUnitsList = AppDocData.instance().getConfigs('Units') |
17 |
for curUnit in curUnitsList: |
|
18 |
|
|
17 |
for curUnit in curUnitsList: |
|
19 | 18 |
if curUnit.key == 'Flowrate_Mass': |
20 |
if curUnit.value != self.old_flowrate_mass_unit:
|
|
21 |
self.conversion_flowrate_mass(curUnit.value)
|
|
19 |
if curUnit.value != self.pre_flowrate_mass_unit:
|
|
20 |
self.convert_flowrate_mass(curUnit.value)
|
|
22 | 21 |
elif curUnit.key == 'Flowrate_Volume': |
23 |
if curUnit.value != self.old_flowrate_volume_unit: |
|
24 |
self.conversion_flowrate_volume(curUnit.value) |
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
def conversion_flowrate_mass(self, curUnit): |
|
22 |
if curUnit.value != self.pre_flowrate_volume_unit: |
|
23 |
self.convert_flowrate_volume(curUnit.value) |
|
24 |
elif curUnit.key == 'Density': |
|
25 |
if curUnit.value != self.pre_density_unit: |
|
26 |
self.convert_density(curUnit.value) |
|
27 |
elif curUnit.key == 'Viscosity': |
|
28 |
if curUnit.value != self.pre_viscosity_unit: |
|
29 |
self.convert_viscosity(curUnit.value) |
|
30 |
elif curUnit.key == 'Temperature': |
|
31 |
if curUnit.value != self.pre_temperature_unit: |
|
32 |
self.convert_temperature(curUnit.value) |
|
33 |
elif curUnit.key == 'Pressure': |
|
34 |
if curUnit.value != self.pre_pressure_unit: |
|
35 |
self.convert_pressure(curUnit.value) |
|
36 |
elif curUnit.key == 'Velocity': |
|
37 |
if curUnit.value != self.pre_velocity_unit: |
|
38 |
self.convert_velocity(curUnit.value) |
|
39 |
elif curUnit.key == 'Velocity': |
|
40 |
if curUnit.value != self.pre_velocity_unit: |
|
41 |
self.convert_velocity(curUnit.value) |
|
42 |
elif curUnit.key == 'Length': |
|
43 |
if curUnit.value != self.pre_length_unit: |
|
44 |
self.convert_length(curUnit.value) |
|
45 |
elif curUnit.key == 'Pipe_Diameter': |
|
46 |
if curUnit.value != self.pre_pipe_diameter_unit: |
|
47 |
self.convert_pipe_diameter(curUnit.value) |
|
48 |
elif curUnit.key == 'Roughness': |
|
49 |
if curUnit.value != self.pre_roughness_unit: |
|
50 |
self.convert_roughness(curUnit.value) |
|
51 |
elif curUnit.key == 'Power': |
|
52 |
if curUnit.value != self.pre_power_unit: |
|
53 |
self.convert_power(curUnit.value) |
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
def convert_flowrate_mass(self, curUnit): |
|
29 | 60 |
convert_factor = 1 |
30 | 61 |
|
31 |
if self.old_flowrate_mass_unit == 'kg/h':
|
|
62 |
if self.pre_flowrate_mass_unit == 'kg/h':
|
|
32 | 63 |
if curUnit == 'g/min': |
33 | 64 |
convert_factor = 16.6667 |
34 | 65 |
elif curUnit == 'lb/h': |
35 | 66 |
convert_factor = 2.2046 |
36 | 67 |
elif curUnit == 't/h': |
37 | 68 |
convert_factor = 0.001 |
38 |
elif self.old_flowrate_mass_unit == 'g/min':
|
|
69 |
elif self.pre_flowrate_mass_unit == 'g/min':
|
|
39 | 70 |
if curUnit == 'kg/h': |
40 | 71 |
convert_factor = 1 / 16.6667 |
41 | 72 |
elif curUnit == 'lb/h': |
42 | 73 |
convert_factor = 0.132277 |
43 | 74 |
elif curUnit == 't/h': |
44 | 75 |
convert_factor = 0.00006 |
45 |
elif self.old_flowrate_mass_unit == 'lb/h':
|
|
76 |
elif self.pre_flowrate_mass_unit == 'lb/h':
|
|
46 | 77 |
if curUnit == 'kg/h': |
47 | 78 |
convert_factor = 1 / 2.2046 |
48 | 79 |
elif curUnit == 'g/min': |
49 | 80 |
convert_factor = 1 / 0.132277 |
50 | 81 |
elif curUnit == 't/h': |
51 | 82 |
convert_factor = 0.0004536 |
52 |
elif self.old_flowrate_mass_unit == 't/h':
|
|
83 |
elif self.pre_flowrate_mass_unit == 't/h':
|
|
53 | 84 |
if curUnit == 'kg/h': |
54 | 85 |
convert_factor = 1 / 0.001 |
55 | 86 |
elif curUnit == 'g/min': |
... | ... | |
57 | 88 |
elif curUnit == 'lb/h': |
58 | 89 |
convert_factor = 1 / 0.0004536 |
59 | 90 |
|
60 |
self._hmb.flowrate_mass = round(self._hmb.flowrate_mass * convert_factor, self._decimal) |
|
91 |
if self._hmb.flowrate_mass: |
|
92 |
self._hmb.flowrate_mass = round(self._hmb.flowrate_mass * convert_factor, self._decimal) |
|
61 | 93 |
|
62 | 94 |
|
63 |
def conversion_flowrate_volume(self, curUnit):
|
|
95 |
def convert_flowrate_volume(self, curUnit):
|
|
64 | 96 |
convert_factor = 1 |
65 | 97 |
|
66 |
if self.old_flowrate_volume_unit == 'm3/h':
|
|
98 |
if self.pre_flowrate_volume_unit == 'm3/h':
|
|
67 | 99 |
if curUnit == 'l/min': |
68 | 100 |
convert_factor = 16.6667 |
69 | 101 |
elif curUnit == 'ft3/h': |
... | ... | |
72 | 104 |
convert_factor = 4.402867 |
73 | 105 |
elif curUnit == 'BPSD': |
74 | 106 |
convert_factor = 150.955464 |
75 |
elif self.old_flowrate_volume_unit == 'l/min':
|
|
107 |
elif self.pre_flowrate_volume_unit == 'l/min':
|
|
76 | 108 |
if curUnit == 'm3/h': |
77 | 109 |
convert_factor = 1 / 16.6667 |
78 | 110 |
elif curUnit == 'ft3/h': |
... | ... | |
81 | 113 |
convert_factor = 0.264172 |
82 | 114 |
elif curUnit == 'BPSD': |
83 | 115 |
convert_factor = 9.05732784 |
84 |
elif self.old_flowrate_volume_unit == 'ft3/h':
|
|
116 |
elif self.pre_flowrate_volume_unit == 'ft3/h':
|
|
85 | 117 |
if curUnit == 'm3/h': |
86 | 118 |
convert_factor = 1 / 35.31466 |
87 | 119 |
elif curUnit == 'l/min': |
... | ... | |
90 | 122 |
convert_factor = 0.124675333 |
91 | 123 |
elif curUnit == 'BPSD': |
92 | 124 |
convert_factor = 9.05732784 |
93 |
elif self.old_flowrate_volume_unit == 'USgpm':
|
|
125 |
elif self.pre_flowrate_volume_unit == 'USgpm':
|
|
94 | 126 |
if curUnit == 'm3/h': |
95 | 127 |
convert_factor = 1 / 4.402867 |
96 | 128 |
elif curUnit == 'l/min': |
... | ... | |
99 | 131 |
convert_factor = 1 / 0.124675333 |
100 | 132 |
elif curUnit == 'BPSD': |
101 | 133 |
convert_factor = 34.2857088 |
102 |
elif self.old_flowrate_volume_unit == 'BPSD':
|
|
134 |
elif self.pre_flowrate_volume_unit == 'BPSD':
|
|
103 | 135 |
if curUnit == 'm3/h': |
104 | 136 |
convert_factor = 1 / 150.955464 |
105 | 137 |
elif curUnit == 'l/min': |
... | ... | |
109 | 141 |
elif curUnit == 'USgpm': |
110 | 142 |
convert_factor = 1 / 34.2857088 |
111 | 143 |
|
144 |
if self._hmb.flowrate_volume: |
|
145 |
self._hmb.flowrate_volume = round(self._hmb.flowrate_volume * convert_factor, self._decimal) |
|
146 |
|
|
147 |
def convert_density(self, curUnit): |
|
148 |
convert_factor = 1 |
|
149 |
|
|
150 |
if self.pre_density_unit == 'kg/m3': |
|
151 |
if curUnit == 'lb/ft3': |
|
152 |
convert_factor = 0.06242797 |
|
153 |
elif self.pre_density_unit == 'lb/ft3': |
|
154 |
if curUnit == 'kg/m3': |
|
155 |
convert_factor =1 / 0.06242797 |
|
156 |
|
|
157 |
if self._hmb.density: |
|
158 |
self._hmb.density = round(self._hmb.density * convert_factor, self._decimal) |
|
159 |
|
|
160 |
def convert_viscosity(self, curUnit): |
|
161 |
convert_factor = 1 |
|
162 |
|
|
163 |
if self.pre_viscosity_unit == 'cP': |
|
164 |
if curUnit == 'kg/m.sec': |
|
165 |
convert_factor = 0.001 |
|
166 |
elif curUnit == 'kg/m.h': |
|
167 |
convert_factor = 3.6 |
|
168 |
elif curUnit == 'lb/ft.sec': |
|
169 |
convert_factor = 0.000671969 |
|
170 |
elif self.pre_viscosity_unit == 'kg/m.sec': |
|
171 |
if curUnit == 'cP': |
|
172 |
convert_factor = 1 / 0.001 |
|
173 |
elif curUnit == 'kg/m.h': |
|
174 |
convert_factor = 3600 |
|
175 |
elif curUnit == 'lb/ft.sec': |
|
176 |
convert_factor = 0.671969 |
|
177 |
elif self.pre_viscosity_unit == 'kg/m.h': |
|
178 |
if curUnit == 'cP': |
|
179 |
convert_factor = 1 / 3.6 |
|
180 |
elif curUnit == 'kg/m.sec': |
|
181 |
convert_factor = 1 / 3600 |
|
182 |
elif curUnit == 'lb/ft.sec': |
|
183 |
convert_factor = 0.000186658 |
|
184 |
elif self.pre_viscosity_unit == 'lb/ft.sec': |
|
185 |
if curUnit == 'cP': |
|
186 |
convert_factor = 1 / 0.000671969 |
|
187 |
elif curUnit == 'kg/m.sec': |
|
188 |
convert_factor = 1 / 0.671969 |
|
189 |
elif curUnit == 'kg/m.h': |
|
190 |
convert_factor = 1 / 0.000186658 |
|
191 |
|
|
192 |
if self._hmb.viscosity: |
|
193 |
self._hmb.viscosity = round(self._hmb.viscosity * convert_factor, self._decimal) |
|
194 |
|
|
195 |
def convert_temperature(self, curUnit): |
|
196 |
if self._hmb.temperature: |
|
197 |
if curUnit == '℉': |
|
198 |
self._hmb.temperature = round(1.8* self._hmb.temperature + 32, self._decimal) |
|
199 |
elif curUnit == '℃': |
|
200 |
self._hmb.temperature = round((self._hmb.temperature - 32) / 1.8, self._decimal) |
|
201 |
|
|
202 |
def convert_pressure(self, curUnit): |
|
203 |
convert_factor = 1 |
|
204 |
|
|
205 |
if self.pre_pressure_unit == 'kg/cm2': |
|
206 |
if curUnit == 'psi': |
|
207 |
convert_factor = 14.22334 |
|
208 |
elif curUnit == 'atm': |
|
209 |
convert_factor = 0.9678411 |
|
210 |
elif curUnit == 'bar': |
|
211 |
convert_factor = 0.980665 |
|
212 |
elif curUnit == 'mmHg': |
|
213 |
convert_factor = 735.5591 |
|
214 |
elif curUnit == 'kPa': |
|
215 |
convert_factor = 98.0665 |
|
216 |
elif curUnit == 'MPa': |
|
217 |
convert_factor = 0.0980665 |
|
218 |
elif self.pre_viscosity_unit == 'psi': |
|
219 |
if curUnit == 'kg/cm2': |
|
220 |
convert_factor = 1 / 14.22334 |
|
221 |
elif curUnit == 'atm': |
|
222 |
convert_factor = 0.06804596 |
|
223 |
elif curUnit == 'bar': |
|
224 |
convert_factor = 0.06894757 |
|
225 |
elif curUnit == 'mmHg': |
|
226 |
convert_factor = 51.71492 |
|
227 |
elif curUnit == 'kPa': |
|
228 |
convert_factor = 6.894757 |
|
229 |
elif curUnit == 'MPa': |
|
230 |
convert_factor = 0.006894757 |
|
231 |
elif self.pre_viscosity_unit == 'atm': |
|
232 |
if curUnit == 'kg/cm2': |
|
233 |
convert_factor = 1 / 0.9678411 |
|
234 |
elif curUnit == 'psi': |
|
235 |
convert_factor = 1 / 0.06804596 |
|
236 |
elif curUnit == 'bar': |
|
237 |
convert_factor = 1.01325 |
|
238 |
elif curUnit == 'mmHg': |
|
239 |
convert_factor = 759.9998 |
|
240 |
elif curUnit == 'kPa': |
|
241 |
convert_factor = 101.325 |
|
242 |
elif curUnit == 'MPa': |
|
243 |
convert_factor = 0.101325 |
|
244 |
elif self.pre_viscosity_unit == 'bar': |
|
245 |
if curUnit == 'kg/cm2': |
|
246 |
convert_factor = 1 / 0.980665 |
|
247 |
elif curUnit == 'psi': |
|
248 |
convert_factor = 1 / 0.06894757 |
|
249 |
elif curUnit == 'atm': |
|
250 |
convert_factor = 1 / 1.01325 |
|
251 |
elif curUnit == 'mmHg': |
|
252 |
convert_factor = 750.0615 |
|
253 |
elif curUnit == 'kPa': |
|
254 |
convert_factor = 100 |
|
255 |
elif curUnit == 'MPa': |
|
256 |
convert_factor = 0.1 |
|
257 |
elif self.pre_viscosity_unit == 'mmHg': |
|
258 |
if curUnit == 'kg/cm2': |
|
259 |
convert_factor = 1 / 735.5591 |
|
260 |
elif curUnit == 'psi': |
|
261 |
convert_factor = 1 / 51.71492 |
|
262 |
elif curUnit == 'atm': |
|
263 |
convert_factor = 1 / 759.9998 |
|
264 |
elif curUnit == 'bar': |
|
265 |
convert_factor = 1 / 750.0615 |
|
266 |
elif curUnit == 'kPa': |
|
267 |
convert_factor = 0.1333224 |
|
268 |
elif curUnit == 'MPa': |
|
269 |
convert_factor = 0.0001333224 |
|
270 |
elif self.pre_viscosity_unit == 'kPa': |
|
271 |
if curUnit == 'kg/cm2': |
|
272 |
convert_factor = 1 / 98.0665 |
|
273 |
elif curUnit == 'psi': |
|
274 |
convert_factor = 1 / 6.894757 |
|
275 |
elif curUnit == 'atm': |
|
276 |
convert_factor = 1 / 101.325 |
|
277 |
elif curUnit == 'bar': |
|
278 |
convert_factor = 1 / 100 |
|
279 |
elif curUnit == 'mmHg': |
|
280 |
convert_factor = 1 / 0.1333224 |
|
281 |
elif curUnit == 'MPa': |
|
282 |
convert_factor = 1 / 1000 |
|
283 |
elif self.pre_viscosity_unit == 'MPa': |
|
284 |
if curUnit == 'kg/cm2': |
|
285 |
convert_factor = 1 / 98.0665 * 1000 |
|
286 |
elif curUnit == 'psi': |
|
287 |
convert_factor = 1 / 6.894757 * 1000 |
|
288 |
elif curUnit == 'atm': |
|
289 |
convert_factor = 1 / 101.325 * 1000 |
|
290 |
elif curUnit == 'bar': |
|
291 |
convert_factor = 1 / 100 * 1000 |
|
292 |
elif curUnit == 'mmHg': |
|
293 |
convert_factor = 1 / 0.1333224 * 1000 |
|
294 |
elif curUnit == 'kPa': |
|
295 |
convert_factor = 1 # 기존 소스에 없음 |
|
296 |
|
|
297 |
if self._hmb.limitation_pressure_drop: |
|
298 |
self._hmb.limitation_pressure_drop = round(self._hmb.limitation_pressure_drop * convert_factor, self._decimal) |
|
299 |
|
|
300 |
if self._hmb.pressure_drop: |
|
301 |
self._hmb.pressure_drop = round(self._hmb.pressure_drop * convert_factor, self._decimal) |
|
302 |
|
|
303 |
if self._hmb.pressure_drop_friction: |
|
304 |
self._hmb.pressure_drop_friction = round(self._hmb.pressure_drop_friction * convert_factor, self._decimal) |
|
305 |
|
|
306 |
if self._hmb.pressure_drop_static: |
|
307 |
self._hmb.pressure_drop_static = round(self._hmb.pressure_drop_static * convert_factor, self._decimal) |
|
308 |
|
|
309 |
if self._hmb.pressure_pipe_end_point: |
|
310 |
self._hmb.pressure_pipe_end_point = round(self._hmb.pressure_pipe_end_point * convert_factor, self._decimal) |
|
311 |
|
|
312 |
def convert_velocity(self, curUnit): |
|
313 |
convert_factor = 1 |
|
112 | 314 |
|
113 |
self._hmb.flowrate_volume = round(self._hmb.flowrate_volume * convert_factor, self._decimal) |
|
315 |
if self.pre_velocity_unit == 'm/s': |
|
316 |
if curUnit == 'ft/s': |
|
317 |
convert_factor = 3.28084 |
|
318 |
elif self.pre_velocity_unit == 'ft/s': |
|
319 |
if curUnit == 'm/s': |
|
320 |
convert_factor = 1 / 3.28084 |
|
321 |
|
|
322 |
if self._hmb.limitation_velocity: |
|
323 |
self._hmb.limitation_velocity = round(self._hmb.limitation_velocity * convert_factor, self._decimal) |
|
324 |
|
|
325 |
if self._hmb.velocity: |
|
326 |
self._hmb.velocity = round(self._hmb.velocity * convert_factor, self._decimal) |
|
327 |
|
|
328 |
def convert_length(self, curUnit): |
|
329 |
convert_factor = 1 |
|
330 |
|
|
331 |
if self.pre_length_unit == 'in': |
|
332 |
if curUnit == 'm': |
|
333 |
convert_factor = 0.0254 |
|
334 |
elif curUnit == 'ft': |
|
335 |
convert_factor = 0.083333 |
|
336 |
elif curUnit == 'yd': |
|
337 |
convert_factor = 0.0277778 |
|
338 |
elif curUnit == 'mile': |
|
339 |
convert_factor = 0.00001578283 |
|
340 |
elif curUnit == 'mm': |
|
341 |
convert_factor = 25.4 |
|
342 |
elif self.pre_length_unit == 'm': |
|
343 |
if curUnit == 'in': |
|
344 |
convert_factor = 1 / 0.0254 |
|
345 |
elif curUnit == 'ft': |
|
346 |
convert_factor = 3.28084 |
|
347 |
elif curUnit == 'yd': |
|
348 |
convert_factor = 1.093613 |
|
349 |
elif curUnit == 'mile': |
|
350 |
convert_factor = 0.000621371 |
|
351 |
elif curUnit == 'mm': |
|
352 |
convert_factor = 1000 |
|
353 |
elif self.pre_length_unit == 'ft': |
|
354 |
if curUnit == 'in': |
|
355 |
convert_factor = 1 / 0.083333 |
|
356 |
elif curUnit == 'm': |
|
357 |
convert_factor = 1 / 3.28084 |
|
358 |
elif curUnit == 'yd': |
|
359 |
convert_factor = 0.33333 |
|
360 |
elif curUnit == 'mile': |
|
361 |
convert_factor = 0.000189394 |
|
362 |
elif curUnit == 'mm': |
|
363 |
convert_factor = 304.8 |
|
364 |
elif self.pre_length_unit == 'yd': |
|
365 |
if curUnit == 'in': |
|
366 |
convert_factor = 1 / 0.277778 |
|
367 |
elif curUnit == 'm': |
|
368 |
convert_factor = 1 / 1.093613 |
|
369 |
elif curUnit == 'ft': |
|
370 |
convert_factor = 1 / 0.33333 |
|
371 |
elif curUnit == 'mile': |
|
372 |
convert_factor = 0.000568182 |
|
373 |
elif curUnit == 'mm': |
|
374 |
convert_factor = 914.4 |
|
375 |
elif self.pre_length_unit == 'mile': |
|
376 |
if curUnit == 'in': |
|
377 |
convert_factor = 1 / 0.00001578283 |
|
378 |
elif curUnit == 'm': |
|
379 |
convert_factor = 1 / 0.000621371 |
|
380 |
elif curUnit == 'ft': |
|
381 |
convert_factor = 1 / 0.000189394 |
|
382 |
elif curUnit == 'yd': |
|
383 |
convert_factor = 1 / 0.000568182 |
|
384 |
elif curUnit == 'mm': |
|
385 |
convert_factor = 1609344 |
|
386 |
elif self.pre_length_unit == 'mm': |
|
387 |
if curUnit == 'in': |
|
388 |
convert_factor = 1 / 25.4 |
|
389 |
elif curUnit == 'm': |
|
390 |
convert_factor = 1 / 1000 |
|
391 |
elif curUnit == 'ft': |
|
392 |
convert_factor = 1 / 304.8 |
|
393 |
elif curUnit == 'yd': |
|
394 |
convert_factor = 1 / 914.4 |
|
395 |
elif curUnit == 'mile': |
|
396 |
convert_factor = 1 / 1609344 |
|
397 |
|
|
398 |
if self._hmb.straight_length: |
|
399 |
self._hmb.straight_length = round(self._hmb.straight_length * convert_factor, self._decimal) |
|
400 |
|
|
401 |
if self._hmb.equivalent_length: |
|
402 |
self._hmb.equivalent_length = round(self._hmb.equivalent_length * convert_factor, self._decimal) |
|
403 |
|
|
404 |
def convert_pipe_diameter(self, curUnit): |
|
405 |
convert_factor = 1 |
|
406 |
|
|
407 |
if self.pre_pipe_diameter_unit == 'in': |
|
408 |
if curUnit == 'mm': |
|
409 |
convert_factor = 25.4 |
|
410 |
elif self.pre_pipe_diameter_unit == 'mm': |
|
411 |
if curUnit == 'in': |
|
412 |
convert_factor = 1 / 25.4 |
|
413 |
|
|
414 |
if self._hmb.nominal_pipe_size: |
|
415 |
self._hmb.nominal_pipe_size = round(self._hmb.nominal_pipe_size * convert_factor, self._decimal) |
|
416 |
|
|
417 |
if self._hmb.inside_pipe_size: |
|
418 |
self._hmb.inside_pipe_size = round(self._hmb.inside_pipe_size * convert_factor, self._decimal) |
|
419 |
|
|
420 |
def convert_roughness(self, curUnit): |
|
421 |
convert_factor = 1 |
|
422 |
|
|
423 |
if self.pre_roughness_unit == 'in': |
|
424 |
if curUnit == 'm': |
|
425 |
convert_factor = 0.0254 |
|
426 |
elif curUnit == 'ft': |
|
427 |
convert_factor = 0.083333 |
|
428 |
elif curUnit == 'mm': |
|
429 |
convert_factor = 25.4 |
|
430 |
elif self.pre_roughness_unit == 'm': |
|
431 |
if curUnit == 'in': |
|
432 |
convert_factor = 1 / 0.0254 |
|
433 |
elif curUnit == 'ft': |
|
434 |
convert_factor = 3.28084 |
|
435 |
elif curUnit == 'mm': |
|
436 |
convert_factor = 1000 |
|
437 |
elif self.pre_roughness_unit == 'ft': |
|
438 |
if curUnit == 'in': |
|
439 |
convert_factor = 1 / 0.083333 |
|
440 |
elif curUnit == 'm': |
|
441 |
convert_factor = 1 / 3.28084 |
|
442 |
elif curUnit == 'mm': |
|
443 |
convert_factor = 304.8 |
|
444 |
elif self.pre_roughness_unit == 'mm': |
|
445 |
if curUnit == 'in': |
|
446 |
convert_factor = 1 / 25.4 |
|
447 |
elif curUnit == 'm': |
|
448 |
convert_factor = 1 / 1000 |
|
449 |
elif curUnit == 'ft': |
|
450 |
convert_factor = 1 / 304.8 |
|
451 |
|
|
452 |
if self._hmb.roughness: |
|
453 |
self._hmb.roughness = round(self._hmb.roughness * convert_factor, self._decimal) |
|
454 |
|
|
455 |
def convert_power(self, curUnit): |
|
456 |
convert_factor = 1 |
|
114 | 457 |
|
458 |
if self.pre_power_unit == 'kW': |
|
459 |
if curUnit == 'kcal/h': |
|
460 |
convert_factor = 860.4207 |
|
461 |
elif curUnit == 'btu/h': |
|
462 |
convert_factor = 3414.425 |
|
463 |
elif curUnit == 'Hp': |
|
464 |
convert_factor = 1.359622 |
|
465 |
elif curUnit == 'kg.m/sec': |
|
466 |
convert_factor = 101.9716 |
|
467 |
elif curUnit == 'ft.lb/sec': |
|
468 |
convert_factor = 737.5621 |
|
469 |
elif self.pre_power_unit == 'kcal/h': |
|
470 |
if curUnit == 'kW': |
|
471 |
convert_factor = 1 / 860.4207 |
|
472 |
elif curUnit == 'btu/h': |
|
473 |
convert_factor = 3.96832 |
|
474 |
elif curUnit == 'Hp': |
|
475 |
convert_factor = 0.001580182 |
|
476 |
elif curUnit == 'kg.m/sec': |
|
477 |
convert_factor = 0.1185137 |
|
478 |
elif curUnit == 'ft.lb/sec': |
|
479 |
convert_factor = 0.857211 |
|
480 |
elif self.pre_power_unit == 'btu/h': |
|
481 |
if curUnit == 'kW': |
|
482 |
convert_factor = 1 / 3414.425 |
|
483 |
elif curUnit == 'kcal/h': |
|
484 |
convert_factor = 1 / 3.96832 |
|
485 |
elif curUnit == 'Hp': |
|
486 |
convert_factor = 0.000398199 |
|
487 |
elif curUnit == 'kg.m/sec': |
|
488 |
convert_factor = 0.02986495 |
|
489 |
elif curUnit == 'ft.lb/sec': |
|
490 |
convert_factor = 0.2160136 |
|
491 |
elif self.pre_power_unit == 'Hp': |
|
492 |
if curUnit == 'kW': |
|
493 |
convert_factor = 11 / 1.359622 |
|
494 |
elif curUnit == 'kcal/h': |
|
495 |
convert_factor = 1 / 0.001580182 |
|
496 |
elif curUnit == 'btu/h': |
|
497 |
convert_factor = 1 / 0.000398199 |
|
498 |
elif curUnit == 'kg.m/sec': |
|
499 |
convert_factor = 75.00001 |
|
500 |
elif curUnit == 'ft.lb/sec': |
|
501 |
convert_factor = 542.4761 |
|
502 |
elif self.pre_power_unit == 'kg.m/sec': |
|
503 |
if curUnit == 'kW': |
|
504 |
convert_factor = 1 / 101.9716 |
|
505 |
elif curUnit == 'kcal/h': |
|
506 |
convert_factor = 1 / 0.1185137 |
|
507 |
elif curUnit == 'btu/h': |
|
508 |
convert_factor = 1 / 0.02986495 |
|
509 |
elif curUnit == 'Hp': |
|
510 |
convert_factor = 1 / 75.00001 |
|
511 |
elif curUnit == 'ft.lb/sec': |
|
512 |
convert_factor = 7.233014 |
|
513 |
elif self.pre_power_unit == 'ft.lb/sec': |
|
514 |
if curUnit == 'kW': |
|
515 |
convert_factor = 1 / 737.5621 |
|
516 |
elif curUnit == 'kcal/h': |
|
517 |
convert_factor = 1 / 0.857211 |
|
518 |
elif curUnit == 'btu/h': |
|
519 |
convert_factor = 1 / 0.2160136 |
|
520 |
elif curUnit == 'Hp': |
|
521 |
convert_factor = 1 / 542.4761 |
|
522 |
elif curUnit == 'kg.m/sec': |
|
523 |
convert_factor = 1 / 7.233014 |
|
524 |
|
|
525 |
if self._hmb.power: |
|
526 |
self._hmb.power = round(self._hmb.power * convert_factor, self._decimal) |
|
527 |
|
|
115 | 528 |
|
116 | 529 |
def initUnits(self): |
117 | 530 |
activeDrawing = AppDocData.instance().activeDrawing |
118 | 531 |
|
119 | 532 |
for attr in activeDrawing.attrs: |
120 | 533 |
if attr[0] == 'Units': |
121 |
self.old_flowrate_mass_unit = attr[1]['Flowrate_Mass'] |
|
122 |
self.old_flowrate_volume_unit = attr[1]['Flowrate_Volume'] |
|
123 |
self.old_density_unit = attr[1]['Density'] |
|
124 |
self.old_viscosity_unit = attr[1]['Viscosity'] |
|
125 |
self.old_velocity_unit = attr[1]['Velocity'] |
|
126 |
self.old_pressure_unit = attr[1]['Pressure'] |
|
127 |
self.old_length_unit = attr[1]['Length'] |
|
128 |
self.old_pipe_diameter_unit = attr[1]['Pipe_Diameter'] |
|
129 |
self.old_roughness_unit = attr[1]['Roughness'] |
|
130 |
self.old_temperature_unit = attr[1]['Temperature'] |
|
534 |
self.pre_flowrate_mass_unit = attr[1]['Flowrate_Mass'] |
|
535 |
self.pre_flowrate_volume_unit = attr[1]['Flowrate_Volume'] |
|
536 |
self.pre_density_unit = attr[1]['Density'] |
|
537 |
self.pre_viscosity_unit = attr[1]['Viscosity'] |
|
538 |
self.pre_velocity_unit = attr[1]['Velocity'] |
|
539 |
self.pre_pressure_unit = attr[1]['Pressure'] |
|
540 |
self.pre_length_unit = attr[1]['Length'] |
|
541 |
self.pre_pipe_diameter_unit = attr[1]['Pipe_Diameter'] |
|
542 |
self.pre_roughness_unit = attr[1]['Roughness'] |
|
543 |
self.pre_temperature_unit = attr[1]['Temperature'] |
|
544 |
self.pre_power_unit = attr[1]['Power'] |
|
131 | 545 |
|
132 | 546 |
|
133 | 547 |
|
HYTOS/HYTOS/ConfigurationDialog.py | ||
---|---|---|
221 | 221 |
configs.append(Config('Units', 'Pipe_Diameter', self.ui.comboBox_Pipe_Diameter.currentText())) |
222 | 222 |
configs.append(Config('Units', 'Length', self.ui.comboBox_Length.currentText())) |
223 | 223 |
configs.append(Config('Units', 'Roughness', self.ui.comboBox_Roughness.currentText())) |
224 |
configs.append(Config('Units', 'Power', self.ui.comboBox_Power.currentText())) |
|
224 | 225 |
|
225 | 226 |
# Calculation |
226 | 227 |
if self.ui.radioButton_Darcy.isChecked(): |
내보내기 Unified diff