import numpy as np import pandas as pd import datetime import pymysql from apscheduler.schedulers.blocking import BlockingScheduler from USER.SPF.alibaba.Common import log import CBMSBatCtrl #...................................SOC计算函数...................................................................................................................... def ctrl_cal(): global df_ram_rlyctrl global df_ram_statectrl global now_time global df_bms end_time=now_time+datetime.timedelta(seconds=3) start_time=now_time now_time=now_time+datetime.timedelta(seconds=3) host='120.25.223.1' port=4901 user='root' password='123456' db='ali' mysql = pymysql.connect (host=host, user=user, password=password, port=port, database=db) #log信息配置............................................................................................................................................................................ mylog=log.Mylog('log_ctrl.txt','error') mylog.logcfg() sn_list=['KPD001','KPD002','KPD003'] try: #读取所有康普盾电池包原始数据库最后一条数据........................................................................... df_bms= df_bms[(df_bms['time']>=start_time) & (df_bms['time']