change x-axis content
This commit is contained in:
parent
1cefe4a16b
commit
e1866758b7
Binary file not shown.
Binary file not shown.
@ -7,6 +7,7 @@ from time import sleep, time, strftime, localtime
|
|||||||
from pandas import DataFrame
|
from pandas import DataFrame
|
||||||
from openpyxl import load_workbook
|
from openpyxl import load_workbook
|
||||||
from math import sqrt
|
from math import sqrt
|
||||||
|
from numpy import power
|
||||||
|
|
||||||
tab_name = 'Durable Action'
|
tab_name = 'Durable Action'
|
||||||
count = 0
|
count = 0
|
||||||
@ -215,7 +216,6 @@ def get_durable_data(path, data, scenario_time, wait_time, rcs, hr, w2t):
|
|||||||
# f_obj.write(f"{_}\n")
|
# f_obj.write(f"{_}\n")
|
||||||
|
|
||||||
_d2d_trq = {0: [], 1: [], 2: [], 3: [], 4: [], 5: []}
|
_d2d_trq = {0: [], 1: [], 2: [], 3: [], 4: [], 5: []}
|
||||||
_d2d_trq_max = {0: [], 1: [], 2: [], 3: [], 4: [], 5: []}
|
|
||||||
|
|
||||||
for line in _data_list:
|
for line in _data_list:
|
||||||
for item in line['data']:
|
for item in line['data']:
|
||||||
@ -225,14 +225,24 @@ def get_durable_data(path, data, scenario_time, wait_time, rcs, hr, w2t):
|
|||||||
_d2d_trq[i].extend(item['value'])
|
_d2d_trq[i].extend(item['value'])
|
||||||
|
|
||||||
if len(_d2d_trq[0]) / 1000 > scenario_time + 1:
|
if len(_d2d_trq[0]) / 1000 > scenario_time + 1:
|
||||||
|
this_time = strftime("%Y-%m-%d %H:%M:%S", localtime(time()))
|
||||||
|
next_time = strftime("%Y-%m-%d %H:%M:%S", localtime(time()+wait_time+10+scenario_time)).split()[-1]
|
||||||
_df = DataFrame(_d2d_trq)
|
_df = DataFrame(_d2d_trq)
|
||||||
for i in range(6):
|
for i in range(6):
|
||||||
_ = sqrt(100*_df[i].apply(lambda x: (rcs[i]*x/10000)**2).sum()/len(_df[i]))
|
try:
|
||||||
|
_ = sqrt(_df[i].apply(lambda x: power((rcs[i]*x/1000), 2)).sum()/len(_df[i]))
|
||||||
|
except:
|
||||||
|
_df.to_excel(path+"\\err_data.xlsx")
|
||||||
|
w2t(f"{i}calculate error", 0, 11, 'red', tab_name)
|
||||||
del data[0][f"axis{i + 1}"][0]
|
del data[0][f"axis{i + 1}"][0]
|
||||||
data[0][f"axis{i + 1}"].append(_)
|
data[0][f"axis{i + 1}"].append(_)
|
||||||
|
del data[0]['time'][0]
|
||||||
|
data[0]['time'].append(next_time)
|
||||||
_ = rcs[i] * _df[i].abs().max() / 1000
|
_ = rcs[i] * _df[i].abs().max() / 1000
|
||||||
del data[1][f"axis{i + 1}"][0]
|
del data[1][f"axis{i + 1}"][0]
|
||||||
data[1][f"axis{i + 1}"].append(_)
|
data[1][f"axis{i + 1}"].append(_)
|
||||||
|
del data[1]['time'][0]
|
||||||
|
data[1]['time'].append(this_time.split()[-1])
|
||||||
_df_1 = DataFrame(data[0])
|
_df_1 = DataFrame(data[0])
|
||||||
_df_2 = DataFrame(data[1])
|
_df_2 = DataFrame(data[1])
|
||||||
|
|
||||||
@ -247,13 +257,11 @@ def get_durable_data(path, data, scenario_time, wait_time, rcs, hr, w2t):
|
|||||||
sleep(1)
|
sleep(1)
|
||||||
global count
|
global count
|
||||||
count += 1
|
count += 1
|
||||||
this_time = strftime("%Y-%m-%d %H:%M:%S", localtime(time()))
|
|
||||||
next_time = strftime("%Y-%m-%d %H:%M:%S", localtime(time()+wait_time+10+scenario_time)).split()[-1]
|
|
||||||
w2t(f"[{this_time}] 当前次数:{count:09d} | 预计下次数据更新时间:{next_time}", 0, 0, '#008B8B', tab_name)
|
w2t(f"[{this_time}] 当前次数:{count:09d} | 预计下次数据更新时间:{next_time}", 0, 0, '#008B8B', tab_name)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
with open(f'{path}\\device_servo_trq_feedback_0.txt', 'w', encoding='utf-8') as f_obj:
|
with open(f'{path}\\device_servo_trq_feedback_0.txt', 'w', encoding='utf-8') as f_obj:
|
||||||
for _ in _d2d_trq['device_servo_trq_feedback_0']:
|
for _ in _d2d_trq[0]:
|
||||||
f_obj.write(f"{_}\n")
|
f_obj.write(f"{_}\n")
|
||||||
w2t("采集的数据时间长度不够,需要确认。", 0, 2, 'red', tab_name)
|
w2t("采集的数据时间长度不够,需要确认。", 0, 2, 'red', tab_name)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user