hytos / HYTOS / HYTOS / HMBTable.py @ 59bbfb9b
이력 | 보기 | 이력해설 | 다운로드 (21.8 KB)
1 |
# coding: utf-8
|
---|---|
2 |
|
3 |
import os |
4 |
import sys |
5 |
import sqlite3 |
6 |
from SingletonInstance import SingletonInstane |
7 |
|
8 |
'''
|
9 |
@brief HMB data
|
10 |
'''
|
11 |
|
12 |
|
13 |
class HMBData: |
14 |
def __init__(self, uid=None): |
15 |
self._uid = None |
16 |
self._components_uid = None |
17 |
self._stream_no = None |
18 |
self._phase_type = None |
19 |
self._flowrate_mass = None |
20 |
self._flowrate_volume = None |
21 |
self._density = None |
22 |
self._viscosity = None |
23 |
self._temperature = None |
24 |
self._molecular_weight = None |
25 |
self._specific_heat_ratio = None |
26 |
self._compress_factor = None |
27 |
self._nominal_pipe_size = None |
28 |
self._inside_pipe_size = None |
29 |
self._schedule_no = None |
30 |
self._straight_length = None |
31 |
self._equivalent_length_input = None |
32 |
self._fitting_length = None |
33 |
self._fitting_K = None |
34 |
self._equivalent_length_cal = None |
35 |
self._roughness = None |
36 |
self._limitation_velocity = None |
37 |
self._limitation_pressure_drop = None |
38 |
self._velocity = None |
39 |
self._reynolds = None |
40 |
self._friction_factor = None |
41 |
self._pressure_drop = None |
42 |
self._pressure_drop_friction = None |
43 |
self._pressure_drop_static = None |
44 |
self._pressure_pipe_end_point = None |
45 |
self._power = None |
46 |
self.isDeleted = False |
47 |
|
48 |
'''
|
49 |
@author humkyung
|
50 |
@date 2018.07.12
|
51 |
'''
|
52 |
|
53 |
@property
|
54 |
def uid(self): |
55 |
return self._uid |
56 |
|
57 |
'''
|
58 |
@author humkyung
|
59 |
@date 2018.07.12
|
60 |
'''
|
61 |
|
62 |
@uid.setter
|
63 |
def uid(self, value): |
64 |
self._uid = value
|
65 |
|
66 |
'''
|
67 |
@author humkyung
|
68 |
@date 2018.07.12
|
69 |
'''
|
70 |
|
71 |
@property
|
72 |
def components_uid(self): |
73 |
return self._components_uid |
74 |
|
75 |
'''
|
76 |
@author humkyung
|
77 |
@date 2018.07.12
|
78 |
'''
|
79 |
|
80 |
@components_uid.setter
|
81 |
def components_uid(self, value): |
82 |
self._components_uid = value
|
83 |
|
84 |
'''
|
85 |
@author humkyung
|
86 |
@date 2018.07.12
|
87 |
'''
|
88 |
|
89 |
@property
|
90 |
def stream_no(self): |
91 |
return self._stream_no |
92 |
|
93 |
'''
|
94 |
@author humkyung
|
95 |
@date 2018.07.12
|
96 |
'''
|
97 |
|
98 |
@stream_no.setter
|
99 |
def stream_no(self, value): |
100 |
if value:
|
101 |
self._stream_no = int(value) |
102 |
|
103 |
@property
|
104 |
def phase_type(self): |
105 |
return self._phase_type |
106 |
|
107 |
@phase_type.setter
|
108 |
def phase_type(self, value): |
109 |
if value:
|
110 |
self._phase_type = value
|
111 |
|
112 |
@property
|
113 |
def flowrate_mass(self): |
114 |
return self._flowrate_mass |
115 |
|
116 |
@flowrate_mass.setter
|
117 |
def flowrate_mass(self, value): |
118 |
self._flowrate_mass = float(value) if value else None |
119 |
|
120 |
@property
|
121 |
def flowrate_volume(self): |
122 |
return self._flowrate_volume |
123 |
|
124 |
@flowrate_volume.setter
|
125 |
def flowrate_volume(self, value): |
126 |
self._flowrate_volume = float(value) if value else None |
127 |
|
128 |
@property
|
129 |
def density(self): |
130 |
return self._density |
131 |
|
132 |
@density.setter
|
133 |
def density(self, value): |
134 |
self._density = float(value) if value else None |
135 |
|
136 |
@property
|
137 |
def viscosity(self): |
138 |
return self._viscosity |
139 |
|
140 |
@viscosity.setter
|
141 |
def viscosity(self, value): |
142 |
self._viscosity = float(value) if value else None |
143 |
|
144 |
@property
|
145 |
def temperature(self): |
146 |
return self._temperature |
147 |
|
148 |
@temperature.setter
|
149 |
def temperature(self, value): |
150 |
self._temperature = float(value) if value else None |
151 |
|
152 |
@property
|
153 |
def molecular_weight(self): |
154 |
return self._molecular_weight |
155 |
|
156 |
@molecular_weight.setter
|
157 |
def molecular_weight(self, value): |
158 |
self._molecular_weight = float(value) if value else None |
159 |
|
160 |
@property
|
161 |
def specific_heat_ratio(self): |
162 |
return self._specific_heat_ratio |
163 |
|
164 |
@specific_heat_ratio.setter
|
165 |
def specific_heat_ratio(self, value): |
166 |
self._specific_heat_ratio = float(value) if value else None |
167 |
|
168 |
@property
|
169 |
def compress_factor(self): |
170 |
return self._compress_factor |
171 |
|
172 |
@compress_factor.setter
|
173 |
def compress_factor(self, value): |
174 |
self._compress_factor = float(value) if value else None |
175 |
|
176 |
@property
|
177 |
def nominal_pipe_size(self): |
178 |
return self._nominal_pipe_size |
179 |
|
180 |
@nominal_pipe_size.setter
|
181 |
def nominal_pipe_size(self, value): |
182 |
self._nominal_pipe_size = float(value) if value else None |
183 |
|
184 |
@property
|
185 |
def inside_pipe_size(self): |
186 |
return self._inside_pipe_size |
187 |
|
188 |
@inside_pipe_size.setter
|
189 |
def inside_pipe_size(self, value): |
190 |
self._inside_pipe_size = float(value) if value else None |
191 |
|
192 |
@property
|
193 |
def schedule_no(self): |
194 |
return self._schedule_no |
195 |
|
196 |
@schedule_no.setter
|
197 |
def schedule_no(self, value): |
198 |
if value:
|
199 |
self._schedule_no = value
|
200 |
|
201 |
@property
|
202 |
def straight_length(self): |
203 |
return self._straight_length |
204 |
|
205 |
@straight_length.setter
|
206 |
def straight_length(self, value): |
207 |
self._straight_length = float(value) if value else None |
208 |
|
209 |
@property
|
210 |
def equivalent_length_input(self): |
211 |
return self._equivalent_length_input |
212 |
|
213 |
@equivalent_length_input.setter
|
214 |
def equivalent_length_input(self, value): |
215 |
self._equivalent_length_input = float(value) if value else None |
216 |
|
217 |
@property
|
218 |
def fitting_length(self): |
219 |
return self._fitting_length |
220 |
|
221 |
@fitting_length.setter
|
222 |
def fitting_length(self, value): |
223 |
self._fitting_length = float(value) if value else None |
224 |
|
225 |
@property
|
226 |
def fitting_K(self): |
227 |
return self._fitting_K |
228 |
|
229 |
@fitting_K.setter
|
230 |
def fitting_K(self, value): |
231 |
self._fitting_K = float(value) if value else None |
232 |
|
233 |
@property
|
234 |
def equivalent_length_cal(self): |
235 |
return self._equivalent_length_cal |
236 |
|
237 |
@equivalent_length_cal.setter
|
238 |
def equivalent_length_cal(self, value): |
239 |
self._equivalent_length_cal = float(value) if value else None |
240 |
|
241 |
@property
|
242 |
def roughness(self): |
243 |
return self._roughness |
244 |
|
245 |
@roughness.setter
|
246 |
def roughness(self, value): |
247 |
self._roughness = float(value) if value else None |
248 |
|
249 |
@property
|
250 |
def limitation_velocity(self): |
251 |
return self._limitation_velocity |
252 |
|
253 |
@limitation_velocity.setter
|
254 |
def limitation_velocity(self, value): |
255 |
self._limitation_velocity = float(value) if value else None |
256 |
|
257 |
@property
|
258 |
def limitation_pressure_drop(self): |
259 |
return self._limitation_pressure_drop |
260 |
|
261 |
@limitation_pressure_drop.setter
|
262 |
def limitation_pressure_drop(self, value): |
263 |
self._limitation_pressure_drop = float(value) if value else None |
264 |
|
265 |
@property
|
266 |
def velocity(self): |
267 |
return self._velocity |
268 |
|
269 |
@velocity.setter
|
270 |
def velocity(self, value): |
271 |
self._velocity = float(value) if value else None |
272 |
|
273 |
@property
|
274 |
def reynolds(self): |
275 |
return self._reynolds |
276 |
|
277 |
@reynolds.setter
|
278 |
def reynolds(self, value): |
279 |
self._reynolds = float(value) if value else None |
280 |
|
281 |
@property
|
282 |
def friction_factor(self): |
283 |
return self._friction_factor |
284 |
|
285 |
@friction_factor.setter
|
286 |
def friction_factor(self, value): |
287 |
self._friction_factor = float(value) if value else None |
288 |
|
289 |
@property
|
290 |
def pressure_drop(self): |
291 |
return self._pressure_drop |
292 |
|
293 |
@pressure_drop.setter
|
294 |
def pressure_drop(self, value): |
295 |
self._pressure_drop = float(value) if value else None |
296 |
|
297 |
@property
|
298 |
def pressure_drop_friction(self): |
299 |
return self._pressure_drop_friction |
300 |
|
301 |
@pressure_drop_friction.setter
|
302 |
def pressure_drop_friction(self, value): |
303 |
self._pressure_drop_friction = float(value) if value else None |
304 |
|
305 |
@property
|
306 |
def pressure_drop_static(self): |
307 |
return self._pressure_drop_static |
308 |
|
309 |
@pressure_drop_static.setter
|
310 |
def pressure_drop_static(self, value): |
311 |
self._pressure_drop_static = float(value) if value is not None else None |
312 |
|
313 |
@property
|
314 |
def pressure_pipe_end_point(self): |
315 |
return self._pressure_pipe_end_point |
316 |
|
317 |
@pressure_pipe_end_point.setter
|
318 |
def pressure_pipe_end_point(self, value): |
319 |
self._pressure_pipe_end_point = float(value) if value is not None else None |
320 |
|
321 |
@property
|
322 |
def power(self): |
323 |
return self._power |
324 |
|
325 |
@power.setter
|
326 |
def power(self, value): |
327 |
self._power = float(value) if value is not None else None |
328 |
|
329 |
def fromRow(row): |
330 |
hmb = HMBData() |
331 |
hmb._uid = row[0]
|
332 |
hmb._components_uid = row[1]
|
333 |
hmb._stream_no = row[2]
|
334 |
hmb._phase_type = row[3]
|
335 |
hmb._flowrate_mass = row[4]
|
336 |
hmb._flowrate_volume = row[5]
|
337 |
hmb._density = row[6]
|
338 |
hmb._viscosity = row[7]
|
339 |
hmb._temperature = row[8]
|
340 |
hmb._molecular_weight = row[9]
|
341 |
hmb._specific_heat_ratio = row[10]
|
342 |
hmb._compress_factor = row[11]
|
343 |
hmb._nominal_pipe_size = row[12]
|
344 |
hmb._inside_pipe_size = row[13]
|
345 |
hmb._schedule_no = row[14]
|
346 |
hmb._straight_length = row[15]
|
347 |
hmb._equivalent_length_input = row[16]
|
348 |
hmb._fitting_length = row[17]
|
349 |
hmb._fitting_K = row[18]
|
350 |
hmb._equivalent_length_cal = row[19]
|
351 |
hmb._roughness = row[20]
|
352 |
hmb._limitation_velocity = row[21]
|
353 |
hmb._limitation_pressure_drop = row[22]
|
354 |
hmb._velocity = row[23]
|
355 |
hmb._reynolds = row[24]
|
356 |
hmb._friction_factor = row[25]
|
357 |
hmb._pressure_drop = row[26]
|
358 |
hmb._pressure_drop_friction = row[27]
|
359 |
hmb._pressure_drop_static = row[28]
|
360 |
hmb._pressure_pipe_end_point = row[29]
|
361 |
hmb._power = row[30]
|
362 |
|
363 |
return hmb
|
364 |
|
365 |
|
366 |
class HMBTable: |
367 |
'''
|
368 |
@brief constructor
|
369 |
@author humkyung
|
370 |
@date 2018.07.12
|
371 |
'''
|
372 |
|
373 |
def __init__(self): |
374 |
self._hmbs = None |
375 |
|
376 |
@staticmethod
|
377 |
def new_data(): |
378 |
# 새로운 HMB 데이타를 생성한다.
|
379 |
hmb = HMBData() |
380 |
|
381 |
hmb.isDeleted = False
|
382 |
return hmb
|
383 |
|
384 |
'''
|
385 |
@brief delete hmb data by uid
|
386 |
@author yeonjin
|
387 |
@date 2019.08.19
|
388 |
'''
|
389 |
|
390 |
def deleteByUID(self, uid): |
391 |
hmbs = self._hmbs
|
392 |
if hmbs is not None: |
393 |
for hmb in hmbs: |
394 |
if str(hmb.components_uid) == str(uid): |
395 |
hmb.isDeleted = True
|
396 |
break
|
397 |
|
398 |
def add(self, components_uid, stream_no): |
399 |
import uuid |
400 |
|
401 |
hmb = HMBData() |
402 |
hmb.uid = str(uuid.uuid4())
|
403 |
hmb.components_uid = components_uid |
404 |
hmb.stream_no = stream_no |
405 |
hmb.isDeleted = False
|
406 |
|
407 |
self.append(hmb)
|
408 |
|
409 |
def updateByUID(self, components_uid, values): |
410 |
try:
|
411 |
for hmb in self._hmbs: |
412 |
if hmb.components_uid == components_uid:
|
413 |
if 'Phase_Type' in values: |
414 |
hmb.phase_type = values['Phase_Type']
|
415 |
if 'Flowrate_Mass' in values: |
416 |
hmb.flowrate_mass = values['Flowrate_Mass']
|
417 |
if 'Flowrate_Volume' in values: |
418 |
hmb.flowrate_volume = values['Flowrate_Volume']
|
419 |
if 'Viscosity' in values: |
420 |
hmb.viscosity = values['Viscosity']
|
421 |
if 'Density' in values: |
422 |
hmb.density = values['Density']
|
423 |
if 'Temperature' in values: |
424 |
hmb.temperature = values['Temperature']
|
425 |
if 'Molecular_Weight' in values: |
426 |
hmb.molecular_weight = values['Molecular_Weight']
|
427 |
if 'Specific_Heat_Ratio' in values: |
428 |
hmb.specific_heat_ratio = values['Specific_Heat_Ratio']
|
429 |
if 'Compress_Factor' in values: |
430 |
hmb.compress_factor = values['Compress_Factor']
|
431 |
if 'Nominal_Pipe_Size' in values: |
432 |
hmb.nominal_pipe_size = values['Nominal_Pipe_Size']
|
433 |
if 'Inside_Pipe_Size' in values: |
434 |
hmb.inside_pipe_size = values['Inside_Pipe_Size']
|
435 |
if 'Schedule_No' in values: |
436 |
hmb.schedule_no = values['Schedule_No']
|
437 |
if 'Straight_Length' in values: |
438 |
hmb.straight_length = values['Straight_Length']
|
439 |
if 'Equivalent_Length_Input' in values: |
440 |
hmb.equivalent_length_input = values['Equivalent_Length_Input']
|
441 |
if 'Fitting_Length' in values: |
442 |
hmb.fitting_length = values['Fitting_Length']
|
443 |
if 'Fitting_K' in values: |
444 |
hmb.fitting_K = values['Fitting_K']
|
445 |
if 'Equivalent_Length_Cal' in values: |
446 |
hmb.equivalent_length_cal = values['Equivalent_Length_Cal']
|
447 |
if 'Roughness' in values: |
448 |
hmb.roughness = values['Roughness']
|
449 |
if 'Limitation_Velocity' in values: |
450 |
hmb.limitation_velocity = values['Limitation_Velocity']
|
451 |
if 'Limitation_Pressure_Drop' in values: |
452 |
hmb.limitation_pressure_drop = values['Limitation_Pressure_Drop']
|
453 |
if 'Velocity' in values: |
454 |
hmb.velocity = values['Velocity']
|
455 |
if 'Reynolds' in values: |
456 |
hmb.reynolds = values['Reynolds']
|
457 |
if 'Friction_Factor' in values: |
458 |
hmb.friction_factor = values['Friction_Factor']
|
459 |
if 'Pressure_Drop' in values: |
460 |
hmb.pressure_drop = values['Pressure_Drop']
|
461 |
if 'Pressure_Drop_Friction' in values: |
462 |
hmb.pressure_drop_friction = values['Pressure_Drop_Friction']
|
463 |
if 'Pressure_Drop_Static' in values: |
464 |
hmb.pressure_drop_static = values['Pressure_Drop_Static']
|
465 |
if 'Pressure_Pipe_End_Point' in values: |
466 |
hmb.pressure_pipe_end_point = values['Pressure_Pipe_End_Point']
|
467 |
if 'Power' in values: |
468 |
hmb.power = values['Power']
|
469 |
|
470 |
break
|
471 |
except Exception as ex: |
472 |
from App import App |
473 |
from AppDocData import MessageType |
474 |
|
475 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
476 |
sys.exc_info()[-1].tb_lineno)
|
477 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
478 |
|
479 |
'''
|
480 |
@brief load hmb data from database
|
481 |
@author humkyung
|
482 |
@date 2018.07.12
|
483 |
'''
|
484 |
|
485 |
def load_data_by_drawing(self, drawing): |
486 |
from App import App |
487 |
from AppDocData import AppDocData |
488 |
|
489 |
if self._hmbs is None: |
490 |
self._hmbs = []
|
491 |
|
492 |
conn = sqlite3.connect(drawing.path) |
493 |
conn.execute('PRAGMA foreign_keys = ON')
|
494 |
with conn:
|
495 |
try:
|
496 |
cursor = conn.cursor() |
497 |
sql = """select h.UID
|
498 |
, h.Components_UID
|
499 |
, h.Stream_No
|
500 |
, h.Phase_Type
|
501 |
, h.Flowrate_Mass
|
502 |
, h.Flowrate_Volume
|
503 |
, h.Density
|
504 |
, h.Viscosity
|
505 |
, h.Temperature
|
506 |
, h.Molecular_Weight
|
507 |
, h.Specific_Heat_Ratio
|
508 |
, h.Compress_Factor
|
509 |
, h.Nominal_Pipe_Size
|
510 |
, h.Inside_Pipe_Size
|
511 |
, h.Schedule_No
|
512 |
, h.Straight_Length
|
513 |
, h.Equivalent_Length_Input
|
514 |
, h.Fitting_Length
|
515 |
, h.Fitting_K
|
516 |
, h.Equivalent_Length_Cal
|
517 |
, h.Roughness
|
518 |
, h.Limitation_Velocity
|
519 |
, h.Limitation_Pressure_Drop
|
520 |
, h.Velocity
|
521 |
, h.Reynolds
|
522 |
, h.Friction_Factor
|
523 |
, h.Pressure_Drop
|
524 |
, h.Pressure_Drop_Friction
|
525 |
, h.Pressure_Drop_Static
|
526 |
, h.Pressure_Pipe_End_Point
|
527 |
, h.Power
|
528 |
from HMB h
|
529 |
left join Components c
|
530 |
on h.Components_UID = c.UID
|
531 |
order by h.Stream_No"""
|
532 |
|
533 |
cursor.execute(sql) |
534 |
rows = cursor.fetchall() |
535 |
for row in rows: |
536 |
hmb = HMBData.fromRow(row) |
537 |
self._hmbs.append(hmb)
|
538 |
# Catch the exception
|
539 |
except Exception as ex: |
540 |
from App import App |
541 |
from AppDocData import MessageType |
542 |
|
543 |
# Roll back any change if something goes wrong
|
544 |
conn.rollback() |
545 |
|
546 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
547 |
sys.exc_info()[-1].tb_lineno)
|
548 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
549 |
|
550 |
return self._hmbs |
551 |
|
552 |
'''
|
553 |
@brief save hmb data
|
554 |
@author humkyung
|
555 |
@date 2018.07.12
|
556 |
'''
|
557 |
|
558 |
def saveData(self): |
559 |
import uuid |
560 |
from App import App |
561 |
from AppDocData import AppDocData |
562 |
|
563 |
if self._hmbs is None: |
564 |
return
|
565 |
|
566 |
app_doc_data = AppDocData.instance() |
567 |
conn = sqlite3.connect(app_doc_data.activeDrawing.path) |
568 |
conn.execute('PRAGMA foreign_keys = ON')
|
569 |
with conn:
|
570 |
try:
|
571 |
# Get a cursor object
|
572 |
cursor = conn.cursor() |
573 |
|
574 |
for data in self._hmbs: |
575 |
if data.isDeleted == False: |
576 |
cols = ['UID', 'Components_UID', 'Stream_No', 'Phase_Type', 'Flowrate_Mass', 'Flowrate_Volume', |
577 |
'Density', 'Viscosity', |
578 |
'Temperature', 'Molecular_Weight', 'Specific_Heat_Ratio', 'Compress_Factor', |
579 |
'Nominal_Pipe_Size', 'Inside_Pipe_Size', |
580 |
'Schedule_No', 'Straight_Length', 'Equivalent_Length_Input', 'Fitting_Length', |
581 |
'Fitting_K', 'Equivalent_Length_Cal', 'Roughness', 'Limitation_Velocity', |
582 |
'Limitation_Pressure_Drop',
|
583 |
'Velocity', 'Reynolds', 'Friction_Factor', 'Pressure_Drop', 'Pressure_Drop_Friction', |
584 |
'Pressure_Drop_Static', 'Pressure_Pipe_End_Point', 'Power'] |
585 |
values = ['?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', |
586 |
'?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?'] |
587 |
param = ( |
588 |
str(data.uid), str(data.components_uid), data.stream_no, data.phase_type, data.flowrate_mass, |
589 |
data.flowrate_volume, data.density, |
590 |
data.viscosity, data.temperature, data.molecular_weight, data.specific_heat_ratio, |
591 |
data.compress_factor, data.nominal_pipe_size, |
592 |
data.inside_pipe_size, data.schedule_no, data.straight_length, data.equivalent_length_input, |
593 |
data.fitting_length, data.fitting_K, data.equivalent_length_cal, data.roughness, |
594 |
data.limitation_velocity, |
595 |
data.limitation_pressure_drop, data.velocity, data.reynolds, data.friction_factor, |
596 |
data.pressure_drop, data.pressure_drop_friction, |
597 |
data.pressure_drop_static, data.pressure_pipe_end_point, data.power) |
598 |
|
599 |
sql = 'insert or replace into HMB({}) values({})'.format(','.join(cols), ','.join(values)) |
600 |
cursor.execute(sql, param) |
601 |
else:
|
602 |
sql = "delete from HMB where uid=?"
|
603 |
param = (data.uid,) |
604 |
cursor.execute(sql, param) |
605 |
|
606 |
conn.commit() |
607 |
# Catch the exception
|
608 |
except Exception as ex: |
609 |
from App import App |
610 |
from AppDocData import MessageType |
611 |
|
612 |
# Roll back any change if something goes wrong
|
613 |
conn.rollback() |
614 |
|
615 |
message = 'error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
616 |
sys.exc_info()[-1].tb_lineno)
|
617 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
618 |
|
619 |
'''
|
620 |
@brief return stream no collection which are not duplicated
|
621 |
@author humkyung
|
622 |
@date 2018.07.12
|
623 |
'''
|
624 |
|
625 |
def streamNos(self): |
626 |
return set([hmb.stream_no for hmb in self._hmbs if hmb.isDeleted == False]) if self._hmbs is not None else {} |
627 |
|
628 |
'''
|
629 |
@brief return given index's data
|
630 |
@author humkyung
|
631 |
@date 2018.07.12
|
632 |
'''
|
633 |
|
634 |
def dataOfStreamNo(self, streamNo): |
635 |
return [hmb for hmb in self._hmbs if |
636 |
hmb.streamNo == streamNo and hmb.isDeleted == False] if self._hmbs is not None else None |
637 |
|
638 |
'''
|
639 |
@brief append hmb data
|
640 |
@author humkyung
|
641 |
@date 2018.07.12
|
642 |
'''
|
643 |
|
644 |
def append(self, hmbData): |
645 |
if self._hmbs is None: |
646 |
self._hmbs = []
|
647 |
|
648 |
self._hmbs.append(hmbData)
|
649 |
|
650 |
'''
|
651 |
@brief reset
|
652 |
@author humkyung
|
653 |
@date 2018.07.12
|
654 |
'''
|
655 |
|
656 |
def reset(self): |
657 |
if self._hmbs is not None: |
658 |
del self._hmbs |
659 |
|
660 |
self._hmbs = None |
661 |
|
662 |
def get_hmb_data(self, component_uid): |
663 |
""" get hmb data has given stream no """
|
664 |
|
665 |
matches = [data for data in self._hmbs if data._components_uid == component_uid] |
666 |
return matches[0] if matches else None |