def execute(self):
     df = self.graph.get_data_from_api(['drive_run'])
     measdate, switch_nums, run_time, stop_time = self.get_fe(
         df, self.graph.parameter)
     if measdate:
         if switch_nums > 0:
             index = Index({
                 'assetid': self.graph.deviceid,
                 'meastime1st': measdate,
                 'feid1st': "11100",
                 'value1st': float(switch_nums),
                 'indices2nd': []
             })
             self.graph.indices.append(index)
         if run_time > 0:
             index = Index({
                 'assetid': self.graph.deviceid,
                 'meastime1st': measdate,
                 'feid1st': "11101",
                 'value1st': float(run_time),
                 'indices2nd': []
             })
             self.graph.indices.append(index)
         if stop_time > 0:
             index = Index({
                 'assetid': self.graph.deviceid,
                 'meastime1st': measdate,
                 'feid1st': "11102",
                 'value1st': float(stop_time),
                 'indices2nd': []
             })
             self.graph.indices.append(index)
 def execute(self):
     measdate, avg_sv_out, std_sv_out, max_sv_out, min_sv_out = self.get_fe(self.graph.parameter)
     for i, meastime in enumerate(measdate):
         index = Index({'assetid': self.graph.deviceid, 'meastime1st': meastime, 'feid1st': "10400",
                        'value1st': avg_sv_out[i], 'indices2nd': []})
         self.graph.indices.append(index)
         index = Index({'assetid': self.graph.deviceid, 'meastime1st': meastime, 'feid1st': "10401",
                        'value1st': std_sv_out[i], 'indices2nd': []})
         self.graph.indices.append(index)
         index = Index({'assetid': self.graph.deviceid, 'meastime1st': meastime, 'feid1st': "10402",
                        'value1st': max_sv_out[i], 'indices2nd': []})
         self.graph.indices.append(index)
         index = Index({'assetid': self.graph.deviceid, 'meastime1st': meastime, 'feid1st': "10403",
                        'value1st': min_sv_out[i], 'indices2nd': []})
         self.graph.indices.append(index)
    def execute(self):
        if 1 == len(self.graph.channelid):
            df = self.graph.get_data_from_api(['speed'])
            measdate, s_total = self.get_fe_v1(df)  # 计算总里程
            if measdate:
                index = Index({
                    'assetid': self.graph.deviceid,
                    'meastime1st': measdate,
                    'feid1st': "11000",
                    'value1st': s_total,
                    'indices2nd': []
                })
                self.graph.indices.append(index)
        else:
            df = self.graph.get_data_from_api(['speed', 'in_force_control'])
            measdate, s_total, s_in_operation, s_idler = self.get_fe_v2(
                df)  # 计算总里程、负载里程、空载里程
            if measdate:
                index = Index({
                    'assetid': self.graph.deviceid,
                    'meastime1st': measdate,
                    'feid1st': "11000",
                    'value1st': s_total,
                    'indices2nd': []
                })
                self.graph.indices.append(index)

                index = Index({
                    'assetid': self.graph.deviceid,
                    'meastime1st': measdate,
                    'feid1st': "11001",
                    'value1st': s_in_operation,
                    'indices2nd': []
                })
                self.graph.indices.append(index)

                index = Index({
                    'assetid': self.graph.deviceid,
                    'meastime1st': measdate,
                    'feid1st': "11002",
                    'value1st': s_idler,
                    'indices2nd': []
                })
                self.graph.indices.append(index)
 def execute(self):
     df = self.graph.get_data_from_api(
         ['gap_ref', 'gap_act', 'sv_out', 'speed_ref'])
     measdate, avg_sv_out, std_sv_out, max_sv_out, min_sv_out = self.get_fe(
         df, self.graph.parameter)
     for i, meastime in enumerate(measdate):
         index = Index({
             'assetid': self.graph.deviceid,
             'meastime1st': meastime,
             'feid1st': "10400",
             'value1st': avg_sv_out[i],
             'indices2nd': []
         })
         self.graph.indices.append(index)
         index = Index({
             'assetid': self.graph.deviceid,
             'meastime1st': meastime,
             'feid1st': "10401",
             'value1st': std_sv_out[i],
             'indices2nd': []
         })
         self.graph.indices.append(index)
         index = Index({
             'assetid': self.graph.deviceid,
             'meastime1st': meastime,
             'feid1st': "10402",
             'value1st': max_sv_out[i],
             'indices2nd': []
         })
         self.graph.indices.append(index)
         index = Index({
             'assetid': self.graph.deviceid,
             'meastime1st': meastime,
             'feid1st': "10403",
             'value1st': min_sv_out[i],
             'indices2nd': []
         })
         self.graph.indices.append(index)
    def get_alarm(self):
        df = self.graph.get_data_from_api(['sv_ref', 'sv_act'])
        if df.empty:
            return
        algparas = self.graph.parameter

        rolling = df['sv_ref'].rolling(algparas[0] * df.dt)
        roll_cv = np.abs(rolling.std() / rolling.mean())  # 计算窗口变异系数

        min_cv = roll_cv.max()
        if min_cv > algparas[1]:  # 数据包不包含稳态工况
            return

        stidx = roll_cv.argmin() - np.floor(algparas[0] * df.dt / 2)
        edidx = roll_cv.argmin() + np.ceil(algparas[0] * df.dt / 2)

        n = (edidx - stidx) // 5  # 对稳态段切头切尾
        avg_ref = np.mean(df['sv_ref'][stidx + n:edidx - n])
        avg_act = np.mean(df['sv_act'][stidx + n:edidx - n])

        r = np.abs(avg_ref - avg_act) / avg_ref * 100  # 计算稳态工况设定值与实际值偏差

        index = Index({
            'assetid': self.graph.deviceid,
            'meastime1st': df.index[0],
            'feid1st': "16000",
            'value1st': r,
            'indices2nd': []
        })
        self.graph.indices.append(index)

        if r > algparas[2]:
            event = Event({
                'assetid': self.graph.deviceid,
                'meastime': df.index[0],
                'level': 1,
                'info': '伺服阀零偏报警'
            })
            self.graph.events.append(event)
    def get_alarm(self):
        df = self.graph.get_data_from_api(['pressure', 's1', 's2', 's3'])
        if df.empty:
            return

        algparas = self.graph.parameter

        rolling = df['s1'].rolling(algparas[0] * df.dt)
        roll_cv = np.abs(rolling.std() / rolling.mean())  # 计算窗口变异系数
        idx1 = roll_cv < algparas[1]
        if not idx1:
            return

        idx2 = pd.Series((df['s2'] == algparas[2]) & (df['s3'] == algparas[3]))\
            .rolling(algparas[0] * df.dt, center=True).min()   # 满足

        min_cv = roll_cv[idx1 & idx2].min()

        if np.isnan(min_cv):  # 数据包不包含稳态工况
            return

        stidx = roll_cv[idx1 & idx2].argmin() - np.floor(
            algparas[0] * df.dt / 2)
        edidx = roll_cv[idx1 & idx2].argmin() + np.ceil(
            algparas[0] * df.dt / 2)

        n = (edidx - stidx) // 5  # 对稳态段切头切尾
        avg_pressure = np.mean(df['pressure'][stidx + n:edidx - n])

        index = Index({
            'assetid': self.graph.deviceid,
            'meastime1st': df.index[0],
            'feid1st': "17000",
            'value1st': avg_pressure,
            'indices2nd': []
        })
        self.graph.indices.append(index)
    def execute(self):
        df = self.graph.get_data_from_api(
            ['agc_active', 'os_lc', 'os_pt', 'ds_lc', 'ds_pt'])

        df['force'] = df['os_lc']
        measdate, std_force, avg_force, max_force, min_force = self.get_fe(df)
        if measdate:
            index = Index({
                'assetid': self.graph.deviceid,
                'meastime1st': measdate,
                'feid1st': str(14000),
                'value1st': std_force,
                'indices2nd': []
            })
            self.graph.indices.append(index)
            index = Index({
                'assetid': self.graph.deviceid,
                'meastime1st': measdate,
                'feid1st': str(14001),
                'value1st': avg_force,
                'indices2nd': []
            })
            self.graph.indices.append(index)
            index = Index({
                'assetid': self.graph.deviceid,
                'meastime1st': measdate,
                'feid1st': str(14002),
                'value1st': max_force,
                'indices2nd': []
            })
            self.graph.indices.append(index)
            index = Index({
                'assetid': self.graph.deviceid,
                'meastime1st': measdate,
                'feid1st': str(14003),
                'value1st': min_force,
                'indices2nd': []
            })
            self.graph.indices.append(index)

        df['force'] = df['os_pt']
        measdate, std_force, avg_force, max_force, min_force = self.get_fe(df)
        if measdate:
            index = Index({
                'assetid': self.graph.deviceid,
                'meastime1st': measdate,
                'feid1st': str(14004),
                'value1st': std_force,
                'indices2nd': []
            })
            self.graph.indices.append(index)
            index = Index({
                'assetid': self.graph.deviceid,
                'meastime1st': measdate,
                'feid1st': str(14005),
                'value1st': avg_force,
                'indices2nd': []
            })
            self.graph.indices.append(index)
            index = Index({
                'assetid': self.graph.deviceid,
                'meastime1st': measdate,
                'feid1st': str(14006),
                'value1st': max_force,
                'indices2nd': []
            })
            self.graph.indices.append(index)
            index = Index({
                'assetid': self.graph.deviceid,
                'meastime1st': measdate,
                'feid1st': str(14007),
                'value1st': min_force,
                'indices2nd': []
            })
            self.graph.indices.append(index)

        df['force'] = df['ds_lc']
        if measdate:
            measdate, std_force, avg_force, max_force, min_force = self.get_fe(
                df)
            index = Index({
                'assetid': self.graph.deviceid,
                'meastime1st': measdate,
                'feid1st': str(14008),
                'value1st': std_force,
                'indices2nd': []
            })
            self.graph.indices.append(index)
            index = Index({
                'assetid': self.graph.deviceid,
                'meastime1st': measdate,
                'feid1st': str(14009),
                'value1st': avg_force,
                'indices2nd': []
            })
            self.graph.indices.append(index)
            index = Index({
                'assetid': self.graph.deviceid,
                'meastime1st': measdate,
                'feid1st': str(14010),
                'value1st': max_force,
                'indices2nd': []
            })
            self.graph.indices.append(index)
            index = Index({
                'assetid': self.graph.deviceid,
                'meastime1st': measdate,
                'feid1st': str(14011),
                'value1st': min_force,
                'indices2nd': []
            })
            self.graph.indices.append(index)

        df['force'] = df['ds_pt']
        if measdate:
            measdate, std_force, avg_force, max_force, min_force = self.get_fe(
                df)
            index = Index({
                'assetid': self.graph.deviceid,
                'meastime1st': measdate,
                'feid1st': str(14012),
                'value1st': std_force,
                'indices2nd': []
            })
            self.graph.indices.append(index)
            index = Index({
                'assetid': self.graph.deviceid,
                'meastime1st': measdate,
                'feid1st': str(14013),
                'value1st': avg_force,
                'indices2nd': []
            })
            self.graph.indices.append(index)
            index = Index({
                'assetid': self.graph.deviceid,
                'meastime1st': measdate,
                'feid1st': str(14014),
                'value1st': max_force,
                'indices2nd': []
            })
            self.graph.indices.append(index)
            index = Index({
                'assetid': self.graph.deviceid,
                'meastime1st': measdate,
                'feid1st': str(14015),
                'value1st': min_force,
                'indices2nd': []
            })
            self.graph.indices.append(index)
 def execute(self):
     measdate, curr_avg, curr_std, curr_max, curr_min, torq_avg, torq_std, torq_max, torq_min \
         = self.get_curr_avg_and_std()
     for i, meastime in enumerate(measdate):
         index = Index({
             'assetid': self.graph.deviceid,
             'meastime1st': meastime,
             'feid1st': "10100",
             'value1st': curr_avg[i],
             'indices2nd': []
         })
         self.graph.indices.append(index)
         index = Index({
             'assetid': self.graph.deviceid,
             'meastime1st': meastime,
             'feid1st': "10101",
             'value1st': curr_std[i],
             'indices2nd': []
         })
         self.graph.indices.append(index)
         index = Index({
             'assetid': self.graph.deviceid,
             'meastime1st': meastime,
             'feid1st': "10102",
             'value1st': curr_max[i],
             'indices2nd': []
         })
         self.graph.indices.append(index)
         index = Index({
             'assetid': self.graph.deviceid,
             'meastime1st': meastime,
             'feid1st': "10103",
             'value1st': curr_min[i],
             'indices2nd': []
         })
         self.graph.indices.append(index)
         if torq_avg:
             index = Index({
                 'assetid': self.graph.deviceid,
                 'meastime1st': meastime,
                 'feid1st': "10104",
                 'value1st': torq_avg[i],
                 'indices2nd': []
             })
             self.graph.indices.append(index)
             index = Index({
                 'assetid': self.graph.deviceid,
                 'meastime1st': meastime,
                 'feid1st': "10105",
                 'value1st': torq_std[i],
                 'indices2nd': []
             })
             self.graph.indices.append(index)
             index = Index({
                 'assetid': self.graph.deviceid,
                 'meastime1st': meastime,
                 'feid1st': "10106",
                 'value1st': torq_max[i],
                 'indices2nd': []
             })
             self.graph.indices.append(index)
             index = Index({
                 'assetid': self.graph.deviceid,
                 'meastime1st': meastime,
                 'feid1st': "10107",
                 'value1st': torq_min[i],
                 'indices2nd': []
             })
             self.graph.indices.append(index)
Beispiel #9
0
    def execute(self):
        df = self.graph.get_data_from_api(
            ['gap_act', 'pis_pressure', 'rod_pressure'])
        measdate1, avg_pressure1, std_pressure1, max_pressure1, min_pressure1, \
        measdate2, avg_pressure2, std_pressure2, max_pressure2, min_pressure2 \
            = self.get_fe(df, self.graph.parameter)

        for i, meastime in enumerate(measdate1):
            index = Index({
                'assetid': self.graph.deviceid,
                'meastime1st': meastime,
                'feid1st': "10300",
                'value1st': avg_pressure1[i],
                'indices2nd': []
            })
            self.graph.indices.append(index)
            index = Index({
                'assetid': self.graph.deviceid,
                'meastime1st': meastime,
                'feid1st': "10301",
                'value1st': std_pressure1[i],
                'indices2nd': []
            })
            self.graph.indices.append(index)
            index = Index({
                'assetid': self.graph.deviceid,
                'meastime1st': meastime,
                'feid1st': "10302",
                'value1st': max_pressure1[i],
                'indices2nd': []
            })
            self.graph.indices.append(index)
            index = Index({
                'assetid': self.graph.deviceid,
                'meastime1st': meastime,
                'feid1st': "10303",
                'value1st': min_pressure1[i],
                'indices2nd': []
            })
            self.graph.indices.append(index)

        for i, meastime in enumerate(measdate2):
            index = Index({
                'assetid': self.graph.deviceid,
                'meastime1st': meastime,
                'feid1st': "10304",
                'value1st': avg_pressure2[i],
                'indices2nd': []
            })
            self.graph.indices.append(index)
            index = Index({
                'assetid': self.graph.deviceid,
                'meastime1st': meastime,
                'feid1st': "10305",
                'value1st': std_pressure2[i],
                'indices2nd': []
            })
            self.graph.indices.append(index)
            index = Index({
                'assetid': self.graph.deviceid,
                'meastime1st': meastime,
                'feid1st': "10306",
                'value1st': max_pressure2[i],
                'indices2nd': []
            })
            self.graph.indices.append(index)
            index = Index({
                'assetid': self.graph.deviceid,
                'meastime1st': meastime,
                'feid1st': "10307",
                'value1st': min_pressure2[i],
                'indices2nd': []
            })
            self.graph.indices.append(index)