#coding=utf-8 import os import datetime import pandas as pd from LIB.BACKEND import DBManager, Log from LIB.MIDDLE import SignalMonitor from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker import time, datetime import traceback from LIB.MIDDLE.soh import NCMSoh_20210716 as NCMSoh from LIB.MIDDLE.soh import LFPSoh_20210711 as LFPSoh from urllib import parse dbManager = DBManager.DBManager() if __name__ == "__main__": SNdata_6040 = pd.read_excel('骑享资产梳理-20210621.xlsx', sheet_name='6040骑享') SNdata_6060 = pd.read_excel('骑享资产梳理-20210621.xlsx', sheet_name='6060') SNnums_6060=SNdata_6060['SN号'] SNnums_6040=SNdata_6040['SN号'] now_time=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') now_time=datetime.datetime.strptime(now_time,'%Y-%m-%d %H:%M:%S') start_time=now_time-datetime.timedelta(days=31) end_time=str(now_time) start_time=str(start_time) for sn in SNnums_6040.tolist(): res = NCMSoh.cal_soh(sn, end_time, start_time) res.to_csv('BMS_SOH_'+sn+'.csv',encoding='GB18030') for sn in SNnums_6060.tolist(): res = LFPSoh.cal_soh(sn, end_time, start_time) res.to_csv('BMS_SOH_'+sn+'.csv',encoding='GB18030')