Beispiel #1
0
 def main(self, data):
     self.__data = data
     print(fault_name + " Received request: %s" % data)
     try:
         execute = Execute()
         execute.set_data(float(data['current']))
         execute.set_execute_listener(CommonListener(self.__identify, self.__socket))
         algorithm = ValueIsLow()
         algorithm.set_threshold(0.5)
         execute.set_algorithm(algorithm)
         execute.execute()
     except json.JSONDecodeError:
         self.__socket.send_json({'token': self.__identify, 'data': {'error': 'json解析错误'}})
 def main(self, data):
     self.__data = data
     print(fault_name + " Received request: %s" % data)
     try:
         execute = Execute()
         execute.set_data(float(data['支路']['current'][0]))
         execute.set_execute_listener(
             CommonListener(self.__identify, self.__socket))
         execute.set_formatter(None, ResultFormatter())
         algorithm = ValueIsZero()
         algorithm.set_add_up(int(data['支路']['count'][0]))
         execute.set_algorithm(algorithm)
         execute.execute()
     except json.JSONDecodeError:
         self.__socket.send_json({
             'token': self.__identify,
             'data': {
                 'error': 'json解析错误'
             }
         })
 def main(self, data):
     self.__data = data
     print(func_name + " Received request: %s" % data)
     try:
         execute = Execute()
         # 设置数据
         execute.set_data((data['conversion'], 18))
         # 设置监听器
         execute.set_execute_listener(
             CommonListener(self.__identify, self.__socket))
         # 设置执行需要执行的算法
         execute.set_algorithm(PvCellUrlPrediction())
         # 执行
         execute.execute()
     except json.JSONDecodeError:
         self.__socket.send_json({
             'token': self.__identify,
             'data': {
                 'error': 'json解析错误'
             }
         })