#encoding:utf8
#电池厂提供excel电池曲线zcv到mtk电池曲线zcv转换
import pandas as pd
import openpyxl
import math
# 读取Excel文件
df = pd.read_excel("a55-zcv.xlsx")
for j in range(0,10):
if(j<3):
offset=0 #T0~T2
if(j==3):
offset=7 #T3
if(j==3):
offset=14 #T4~T9
print("/* T%s */"%(j))
print("struct fuelgauge_profile_struct fg_profile_t%s[TOTAL_BATTERY_NUMBER][100] = {"%(j))
for k in range(0,4):
print(r'{')
for i in range(0,100):
if(i>95):
i=95
mAh = df.iloc[i,3+offset]*10
mcV = df.iloc[i, 2+offset]*10
moM = int(df.iloc[i, 4+offset]*10000)
if(math.isnan(mcV)):
mcV=df.iloc[1, 2+offset]*10+8
if(math.isnan(mAh)):
mAh=0
if(math.isnan(moM)):
moM=0
print("{%s,%s,%s},"%(mAh,mcV,moM))
print(r'},')
print(r'};')