'VALUE', #Функция аггрегации (минимум, максимум, среднее) см документацию 'pointId': { 'iess': tag } } items.append(item) dt = ds index = 0 PrevVals = [] for i in range(10): PrevVals.append(0) inited = False while dt < de: print(dt) request = web.createRequest(dt, dt + datetime.timedelta(hours=1), 1, items) #Здесь создаем запрос с нужным шагом reqId = web.soap_cln.service.requestTabular(web.auth_str, request) #Запускаем запрос web.runRequest(reqId) response = web.soap_cln.service.getTabular(web.auth_str, reqId) #Получаем ответ #points=response['pointsIds'] #for point in points: # print(point) rows = response['rows'] for row in rows: #Разбираем полученные строки ts = row['ts']['second']
dt=d1 for record in data: dt=record['start'] de=record['stop'] dt=dt+datetime.timedelta(seconds=60) de=de+datetime.timedelta(seconds=-60) print("Анализ {0}-{1}".format(dt,de)) while dt<de: de1=dt+datetime.timedelta(hours=12) if (de1>de): de1=de print("{0}".format(dt)) request=web.createRequest(dt,de1,step,items) reqId=web.soap_cln.service.requestTabular(web.auth_str,request) web.runRequest(reqId) response=web.soap_cln.service.getTabular(web.auth_str,reqId) rows=response['rows'] for row in rows: ts=row['ts']['second'] d1=datetime.datetime.fromtimestamp(ts) values=row['values'] vs=[] vs.append(values[0]['value'][0]) vs.append(values[1]['value'][0]) vs.append(values[2]['value'][0])
#tags={'61VT_UB16D-206.UNIT0@SCADA' } #ID запроса reqId = None items = [] for tag in tags: item = { 'function': 'VALUE', #Функция аггрегации (минимум, максимум, среднее) см документацию 'pointId': { 'iess': tag } } items.append(item) request = web.createRequest(ds, de, 1, items) #Здесь создаем запрос с нужным шагом reqId = web.soap_cln.service.requestTabular(web.auth_str, request) #Запускаем запрос web.runRequest(reqId) response = web.soap_cln.service.getTabular(web.auth_str, reqId) #Получаем ответ points = response['pointsIds'] for point in points: print(point) rows = response['rows'] for row in rows: #Разбираем полученные строки ts = row['ts']['second']
tags={'61VT_UB16D-206.UNIT0@SCADA' } reqId=None items=[] for tag in tags: item={ 'function':'VALUE', 'pointId':{ 'iess':tag } } items.append(item) request=web.createRequest(ds,de,1,items) reqId=web.soap_cln.service.requestTabular(web.auth_str,request) web.runRequest(reqId) response=web.soap_cln.service.getTabular(web.auth_str,reqId) points=response['pointsIds'] for point in points: print(point) rows=response['rows'] for row in rows: ts=row['ts']['second'] dt=datetime.datetime.fromtimestamp(ts)