2 #######################################
8 ####################################################
9 ACTUATOR_ARCHIVING_PERIOD
= 900000 # ms = 15min
10 BEAM_ARCHIVING_PERIOD
= 1000 # ms
11 #####################################################
17 def __init__(self
, _attr_fullName
):
19 self
.attr_fullName
= _attr_fullName
21 splitted_attr_fullName
= self
.attr_fullName
.split('/')
22 self
.name
= splitted_attr_fullName
[-2] + '/'+ splitted_attr_fullName
[-1] # device_slash_attr
24 def get_attrName(self
):
25 return self
.name
.split('/')[1]
27 def get_devName(self
):
28 return self
.name
.split('/')[0]
31 ###############################
32 class steadiness_param(param
):
34 def __init__(self
, _attr_fullName
, _delta
= 0, _ok_values
= ['const'],
35 _archiving_period
= ACTUATOR_ARCHIVING_PERIOD
):
37 param
.__init
__(self
, _attr_fullName
)
41 self
.archiving_period
= _archiving_period
44 self
.archiving_mode
= ( 'MODE_P '+ str(self
.archiving_period
) + ' MODE_D ' + str(BEAM_ARCHIVING_PERIOD
) )
46 self
.archiving_mode
= ('MODE_P '+ str(self
.archiving_period
) +
47 ' MODE_A ' + str(BEAM_ARCHIVING_PERIOD
) + ' ' + str(self
.delta
) + ' ' + str(self
.delta
) + ' false')
49 self
.ok_values
= _ok_values
51 # ------------------------------------------------------
52 def get_variation(self
, param_data
, timeInterval_sec
):
58 #x_0 = timeInterval_sec[0]+float(param_data[0][0]-timeInterval_sec[0])/2
59 x_0
= (timeInterval_sec
[0], param_data
[0][0])
60 var_data
.append( ( x_0
, 0) )
62 for i
in range( 1, n
):
63 #x_i = param_data[i-1][0]+ float(param_data[i][0]-param_data[i-1][0])/2
64 x_i
= (param_data
[i
-1][0], param_data
[i
][0])
65 y_i
= abs( param_data
[i
][1]-param_data
[i
-1][1] )
66 var_data
.append( ( x_i
, y_i
) )
68 #x_n = param_data[n-1][0] + float(timeInterval_sec[1]-param_data[n-1][0])/2
69 x_n
= (param_data
[n
-1][0], timeInterval_sec
[1])
70 var_data
.append( ( x_n
, 0) )
74 # -----------------------
75 def is_ok(self
, _val
):
77 if self
.ok_values
!= ['const'] and _val
in self
.ok_values
:
80 elif self
.ok_values
== ['const']:
81 return (self
.delta
- _val
> 0) # _val = abs(param.val[i]-param.val[i-1])
85 # -----------------------
86 def set_delta(self
, _val
):
89 # -----------------------
90 def round_val(self
, _val
):
95 ###############################
96 class monitored_param(param
):
98 def __init__(self
, _attr_fullName
, _archiving_period
= BEAM_ARCHIVING_PERIOD
):
100 param
.__init
__(self
, _attr_fullName
)
102 self
.archiving_period
= _archiving_period
103 self
.archiving_mode
= 'MODE_P '+ str(self
.archiving_period
)
105 ## def set_archiPeriod(_archiving_period):
106 ## self.archiving_period = _archiving_period